diff --git a/libc/stdio/fgets.c b/libc/stdio/fgets.c index 99bdac995..f26385d6a 100644 --- a/libc/stdio/fgets.c +++ b/libc/stdio/fgets.c @@ -63,12 +63,12 @@ fgets(char *buf, int n, FILE *fp) /* EOF/error: stop with partial or no line */ if (s == buf) return (NULL); - break; - } + break; + } } len = fp->_r; p = fp->_p; - + /* * Scan through at most n bytes of the current buffer, * looking for '\n'. If found, copy up to and including diff --git a/libc/stdio/findfp.c b/libc/stdio/findfp.c index a55a65d6d..039293fa6 100644 --- a/libc/stdio/findfp.c +++ b/libc/stdio/findfp.c @@ -50,7 +50,7 @@ int __sdidinit; /* p r w flags file _bf z cookie close read seek write ext */ - /* the usual - (stdin + stdout + stderr) */ +/* the usual - (stdin + stdout + stderr) */ static FILE usual[FOPEN_MAX - 3]; static struct __sfileext usualext[FOPEN_MAX - 3]; static struct glue uglue = { 0, FOPEN_MAX - 3, usual }; diff --git a/libc/stdio/fopen.c b/libc/stdio/fopen.c index de15dc36c..a6cddd306 100644 --- a/libc/stdio/fopen.c +++ b/libc/stdio/fopen.c @@ -53,7 +53,7 @@ fopen(const char *file, const char *mode) if ((f = open(file, oflags, DEFFILEMODE)) < 0) { fp->_flags = 0; /* release */ return (NULL); - } + } fp->_file = f; fp->_flags = flags; fp->_cookie = fp; diff --git a/libc/stdio/fprintf.c b/libc/stdio/fprintf.c index 809d8dbc2..7415b2fca 100644 --- a/libc/stdio/fprintf.c +++ b/libc/stdio/fprintf.c @@ -38,10 +38,10 @@ int fprintf(FILE *fp, const char *fmt, ...) { int ret; - va_list ap; + va_list ap; va_start(ap, fmt); ret = vfprintf(fp, fmt, ap); - va_end(ap); + va_end(ap); return (ret); } diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c index 9f9977fdf..69c40b3e7 100644 --- a/libc/stdio/fread.c +++ b/libc/stdio/fread.c @@ -48,29 +48,29 @@ lflush(FILE *fp) size_t fread(void *buf, size_t size, size_t count, FILE *fp) { - size_t resid; - char *p; - int r; - size_t total; + size_t resid; + char *p; + int r; + size_t total; - /* - * The ANSI standard requires a return value of 0 for a count - * or a size of 0. Peculiarily, it imposes no such requirements - * on fwrite; it only requires fread to be broken. - */ - if ((resid = count * size) == 0) - return (0); - if (fp->_r < 0) - fp->_r = 0; - total = resid; - p = buf; + /* + * The ANSI standard requires a return value of 0 for a count + * or a size of 0. Peculiarily, it imposes no such requirements + * on fwrite; it only requires fread to be broken. + */ + if ((resid = count * size) == 0) + return (0); + if (fp->_r < 0) + fp->_r = 0; + total = resid; + p = buf; #if 1 /* BIONIC: optimize unbuffered reads */ if (fp->_flags & __SNBF && fp->_ur == 0) { - /* the following comes mainly from __srefill(), with slight - * modifications - */ + /* the following comes mainly from __srefill(), with slight + * modifications + */ /* make sure stdio is set up */ if (!__sdidinit) @@ -99,22 +99,22 @@ fread(void *buf, size_t size, size_t count, FILE *fp) } fp->_flags |= __SRD; } else { - /* - * We were reading. If there is an ungetc buffer, - * we must have been reading from that. Drop it, - * restoring the previous buffer (if any). If there - * is anything in that buffer, return. - */ + /* + * We were reading. If there is an ungetc buffer, + * we must have been reading from that. Drop it, + * restoring the previous buffer (if any). If there + * is anything in that buffer, return. + */ if (HASUB(fp)) { FREEUB(fp); } } - /* - * Before reading from a line buffered or unbuffered file, - * flush all line buffered output files, per the ANSI C - * standard. - */ + /* + * Before reading from a line buffered or unbuffered file, + * flush all line buffered output files, per the ANSI C + * standard. + */ if (fp->_flags & (__SLBF|__SNBF)) (void) _fwalk(lflush); @@ -151,8 +151,8 @@ fread(void *buf, size_t size, size_t count, FILE *fp) } } - (void)memcpy((void *)p, (void *)fp->_p, resid); - fp->_r -= resid; - fp->_p += resid; - return (count); + (void)memcpy((void *)p, (void *)fp->_p, resid); + fp->_r -= resid; + fp->_p += resid; + return (count); } diff --git a/libc/stdio/freopen.c b/libc/stdio/freopen.c index 414d8108e..59b222864 100644 --- a/libc/stdio/freopen.c +++ b/libc/stdio/freopen.c @@ -40,8 +40,8 @@ #include #include "local.h" -/* - * Re-direct an existing, open (probably) file to some other file. +/* + * Re-direct an existing, open (probably) file to some other file. * ANSI is written such that the original file gets closed if at * all possible, no matter what. */ diff --git a/libc/stdio/fseek.c b/libc/stdio/fseek.c index 0ac25e2fd..8581b62fc 100644 --- a/libc/stdio/fseek.c +++ b/libc/stdio/fseek.c @@ -204,7 +204,7 @@ fseeko(FILE *fp, off_t offset, int whence) if ((*seekfn)(fp->_cookie, curoff, SEEK_SET) == POS_ERR) goto dumb; fp->_r = 0; - fp->_p = fp->_bf._base; + fp->_p = fp->_bf._base; if (HASUB(fp)) FREEUB(fp); fp->_flags &= ~__SEOF; diff --git a/libc/stdio/fvwrite.c b/libc/stdio/fvwrite.c index bbea6728c..ee394006d 100644 --- a/libc/stdio/fvwrite.c +++ b/libc/stdio/fvwrite.c @@ -83,7 +83,7 @@ __sfvwrite(FILE *fp, struct __suio *uio) do { GETIOV(;); #if 1 /* BIONIC: don't limit to 1KB writes */ - w = (*fp->_write)(fp->_cookie, p, len); + w = (*fp->_write)(fp->_cookie, p, len); #else w = (*fp->_write)(fp->_cookie, p, MIN(len, BUFSIZ2)); #endif @@ -183,7 +183,7 @@ __sfvwrite(FILE *fp, struct __suio *uio) } else if (s >= (w = fp->_bf._size)) { w = (*fp->_write)(fp->_cookie, p, w); if (w <= 0) - goto err; + goto err; } else { w = s; COPY(w); diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c index 4acc19b05..614b43515 100644 --- a/libc/stdio/printf.c +++ b/libc/stdio/printf.c @@ -38,10 +38,10 @@ int printf(const char *fmt, ...) { int ret; - va_list ap; + va_list ap; va_start(ap, fmt); ret = vfprintf(stdout, fmt, ap); - va_end(ap); + va_end(ap); return (ret); } diff --git a/libc/stdio/putchar.c b/libc/stdio/putchar.c index 233cdfd02..eeed0a2c4 100644 --- a/libc/stdio/putchar.c +++ b/libc/stdio/putchar.c @@ -42,7 +42,7 @@ putchar_unlocked(int c) { FILE *so = stdout; - return (putc_unlocked(c,so)); + return (putc_unlocked(c, so)); } #undef putchar diff --git a/libc/stdio/snprintf.c b/libc/stdio/snprintf.c index e830c0f02..45ef7eb67 100644 --- a/libc/stdio/snprintf.c +++ b/libc/stdio/snprintf.c @@ -40,7 +40,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...) { - va_list ap; + va_list ap; int ret; char dummy; FILE f; @@ -61,7 +61,7 @@ snprintf(char *str, size_t n, const char *fmt, ...) f._bf._size = f._w = n - 1; va_start(ap, fmt); ret = vfprintf(&f, fmt, ap); - va_end(ap); + va_end(ap); *f._p = '\0'; return (ret); } diff --git a/libc/stdio/sprintf.c b/libc/stdio/sprintf.c index 739cde7fa..67f924b27 100644 --- a/libc/stdio/sprintf.c +++ b/libc/stdio/sprintf.c @@ -46,7 +46,7 @@ int sprintf(char *str, const char *fmt, ...) { int ret; - va_list ap; + va_list ap; FILE f; struct __sfileext fext; @@ -57,7 +57,7 @@ sprintf(char *str, const char *fmt, ...) f._bf._size = f._w = INT_MAX; va_start(ap, fmt); ret = vfprintf(&f, fmt, ap); - va_end(ap); + va_end(ap); *f._p = '\0'; return (ret); } diff --git a/libc/stdio/sscanf.c b/libc/stdio/sscanf.c index e141eec07..a0bdf1c52 100644 --- a/libc/stdio/sscanf.c +++ b/libc/stdio/sscanf.c @@ -48,7 +48,7 @@ int sscanf(const char *str, const char *fmt, ...) { int ret; - va_list ap; + va_list ap; FILE f; struct __sfileext fext; @@ -60,6 +60,6 @@ sscanf(const char *str, const char *fmt, ...) f._lb._base = NULL; va_start(ap, fmt); ret = vfscanf(&f, fmt, ap); - va_end(ap); + va_end(ap); return (ret); } diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c index a4a27b53b..1596ebf6c 100644 --- a/libc/stdio/stdio.c +++ b/libc/stdio/stdio.c @@ -45,7 +45,7 @@ __sread(void *cookie, char *buf, int n) { FILE *fp = cookie; int ret; - + ret = read(fp->_file, buf, n); /* if the read succeeded, update the current offset */ if (ret >= 0) @@ -71,7 +71,7 @@ __sseek(void *cookie, fpos_t offset, int whence) { FILE *fp = cookie; off_t ret; - + ret = lseek(fp->_file, (off_t)offset, whence); if (ret == (off_t)-1) fp->_flags &= ~__SOFF; diff --git a/libc/stdio/vsscanf.c b/libc/stdio/vsscanf.c index 47c1ae61d..9c4d805be 100644 --- a/libc/stdio/vsscanf.c +++ b/libc/stdio/vsscanf.c @@ -39,7 +39,6 @@ static int eofread(void *cookie, char *buf, int len) { - return (0); }