sfputr.c revision 1
0N/A/*********************************************************************** 0N/A* This software is part of the ast package * 0N/A* Copyright (c) 1985-2011 AT&T Intellectual Property * 0N/A* and is licensed under the * 0N/A* Common Public License, Version 1.0 * 0N/A* by AT&T Intellectual Property * 0N/A* A copy of the License is available at * 0N/A* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 0N/A* Information and Software Systems Research * 0N/A* Glenn Fowler <gsf@research.att.com> * 0N/A* David Korn <dgk@research.att.com> * 0N/A* Phong Vo <kpv@research.att.com> * 0N/A***********************************************************************/ 0N/A/* Put out a null-terminated string 0N/A** Written by Kiem-Phong Vo. 0N/Achar* s;
/* string to write */ 0N/Aint rc;
/* record separator. */ 0N/A for(w = 0; (*s ||
rc >= 0); )
0N/A if(p >= (n + (
rc < 0 ? 0 :
1)) )
0N/A {
/* buffer can hold everything */ 0N/A {
/* create a reserve buffer to hold data */ 0N/A p = n + (
rc >= 0 ?
1 : 0);
0N/A for(; p > 0; --p, ++
ps, ++s)
0N/A /* sync unseekable shared streams */ 0N/A /* check for line buffering */