improve readability of stdio: fix indentation and remove trailing spaces

Change-Id: Ic51e58a7c75d20bf770dc0ebd7f97a338fbe0036
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
diff --git a/libc/stdio/fgets.c b/libc/stdio/fgets.c
index 99bdac9..f26385d 100644
--- a/libc/stdio/fgets.c
+++ b/libc/stdio/fgets.c
@@ -63,12 +63,12 @@
 				/* 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 a55a65d..039293f 100644
--- a/libc/stdio/findfp.c
+++ b/libc/stdio/findfp.c
@@ -50,7 +50,7 @@
 /*	 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 de15dc3..a6cddd3 100644
--- a/libc/stdio/fopen.c
+++ b/libc/stdio/fopen.c
@@ -53,7 +53,7 @@
 	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 809d8db..7415b2f 100644
--- a/libc/stdio/fprintf.c
+++ b/libc/stdio/fprintf.c
@@ -38,10 +38,10 @@
 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 9f9977f..69c40b3 100644
--- a/libc/stdio/fread.c
+++ b/libc/stdio/fread.c
@@ -48,29 +48,29 @@
 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 @@
             }
             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 @@
         }
     }
 
-	(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 414d810..59b2228 100644
--- a/libc/stdio/freopen.c
+++ b/libc/stdio/freopen.c
@@ -40,8 +40,8 @@
 #include <stdlib.h>
 #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 0ac25e2..8581b62 100644
--- a/libc/stdio/fseek.c
+++ b/libc/stdio/fseek.c
@@ -204,7 +204,7 @@
 	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 bbea672..ee39400 100644
--- a/libc/stdio/fvwrite.c
+++ b/libc/stdio/fvwrite.c
@@ -83,7 +83,7 @@
 		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 @@
 			} 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 4acc19b..614b435 100644
--- a/libc/stdio/printf.c
+++ b/libc/stdio/printf.c
@@ -38,10 +38,10 @@
 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 233cdfd..eeed0a2 100644
--- a/libc/stdio/putchar.c
+++ b/libc/stdio/putchar.c
@@ -42,7 +42,7 @@
 {
 	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 e830c0f..45ef7eb 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 @@
 	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 739cde7..67f924b 100644
--- a/libc/stdio/sprintf.c
+++ b/libc/stdio/sprintf.c
@@ -46,7 +46,7 @@
 sprintf(char *str, const char *fmt, ...)
 {
 	int ret;
-  va_list ap;
+	va_list ap;
 	FILE f;
 	struct __sfileext fext;
 
@@ -57,7 +57,7 @@
 	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 e141eec..a0bdf1c 100644
--- a/libc/stdio/sscanf.c
+++ b/libc/stdio/sscanf.c
@@ -48,7 +48,7 @@
 sscanf(const char *str, const char *fmt, ...)
 {
 	int ret;
-  va_list ap;
+	va_list ap;
 	FILE f;
 	struct __sfileext fext;
 
@@ -60,6 +60,6 @@
 	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 a4a27b5..1596ebf 100644
--- a/libc/stdio/stdio.c
+++ b/libc/stdio/stdio.c
@@ -45,7 +45,7 @@
 {
 	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 @@
 {
 	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 47c1ae6..9c4d805 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);
 }