diff options
Diffstat (limited to 'shells/pdksh/files/shf.c')
-rw-r--r-- | shells/pdksh/files/shf.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/shells/pdksh/files/shf.c b/shells/pdksh/files/shf.c index 3d2cc17b265..ecfbebfa595 100644 --- a/shells/pdksh/files/shf.c +++ b/shells/pdksh/files/shf.c @@ -1,6 +1,14 @@ +/* $NetBSD: shf.c,v 1.2 2008/05/31 16:47:37 tnn Exp $ */ + /* * Shell file I/O routines */ +#include <sys/cdefs.h> + +#ifndef lint +__RCSID("$NetBSD: shf.c,v 1.2 2008/05/31 16:47:37 tnn Exp $"); +#endif + #include "sh.h" #include "ksh_stat.h" @@ -355,7 +363,6 @@ shf_emptybuf(shf, flags) shf->rp = nbuf + (shf->rp - shf->buf); shf->wp = nbuf + (shf->wp - shf->buf); shf->rbsize += shf->wbsize; - shf->wbsize += shf->wbsize; shf->wnleft += shf->wbsize; shf->wbsize *= 2; shf->buf = nbuf; @@ -838,7 +845,7 @@ shf_smprintf(fmt, va_alist) * this out... * * For shorts, we want sign extend for %d but not for %[oxu] - on 16 bit - * machines it don't matter. Assmumes C compiler has converted shorts to + * machines it don't matter. Assumes C compiler has converted shorts to * ints before pushing them. */ #define POP_INT(f, s, a) (((f) & FL_LONG) ? \ @@ -896,6 +903,7 @@ shf_vfprintf(shf, fmt, args) char numbuf[(BITS(long) + 2) / 3 + 1]; /* this stuff for dealing with the buffer */ int nwritten = 0; + static char nulls[] = "(null %s)"; #ifdef FP /* should be in <math.h> * extern double frexp(); @@ -921,7 +929,7 @@ shf_vfprintf(shf, fmt, args) * This will accept flags/fields in any order - not * just the order specified in printf(3), but this is * the way _doprnt() seems to work (on bsd and sysV). - * The only resriction is that the format character must + * The only restriction is that the format character must * come last :-). */ flags = field = precision = 0; @@ -1082,7 +1090,7 @@ shf_vfprintf(shf, fmt, args) char *p; /* - * This could proabably be done better, + * This could probably be done better, * but it seems to work. Note that gcvt() * is not used, as you cannot tell it to * not strip the zeros. @@ -1102,7 +1110,7 @@ shf_vfprintf(shf, fmt, args) * This is the same as * expo = ceil(log10(fpnum)) * but doesn't need -lm. This is an - * aproximation as expo is rounded up. + * approximation as expo is rounded up. */ (void) frexp(fpnum, &expo); expo = my_ceil(expo / LOG2_10); @@ -1214,7 +1222,7 @@ shf_vfprintf(shf, fmt, args) case 's': if (!(s = va_arg(args, char *))) - s = "(null %s)"; + s = nulls; len = strlen(s); break; |