Browse Source

Use "stdin", "stdout", and "stderr", not "_stdin", "_stdout", and
"_stderr", since this is what gcc and libgcc expect...
-Erik

Eric Andersen 24 years ago
parent
commit
cd66911e9d
2 changed files with 19 additions and 19 deletions
  1. 9 9
      include/stdio.h
  2. 10 10
      libc/stdio/stdio.c

+ 9 - 9
include/stdio.h

@@ -94,15 +94,15 @@ typedef struct __stdio_file FILE;
 #include <bits/stdio_lim.h>
 #undef __need_FOPEN_MAX
 
-/* Standard streams (internal).  */
-extern FILE *_stdin;
-extern FILE *_stdout;
-extern FILE *_stderr;
 
+/* Standard streams.  */
+extern FILE *stdin;		/* Standard input stream.  */
+extern FILE *stdout;		/* Standard output stream.  */
+extern FILE *stderr;		/* Standard error output stream.  */
 /* C89/C99 say they're macros.  Make them happy.  */
-#define stdin  _stdin
-#define stdout _stdout
-#define stderr _stderr
+#define stdin stdin
+#define stdout stdout
+#define stderr stderr
 
 /* Remove file FILENAME.  */
 extern int remove __P ((__const char *__filename));
@@ -287,7 +287,7 @@ extern int getchar __P ((void));
     (*(stream)->bufpos++))
 /* getchar() is equivalent to getc(stdin).  Since getc is a macro, 
  * that means that getchar() should be a macro too...  */
-#define getchar() getc(_stdin)
+#define getchar() getc(stdin)
 
 /* Write a character to STREAM.  */
 extern int fputc __P ((int __c, FILE *__stream));
@@ -302,7 +302,7 @@ extern int putchar __P ((int __c));
                           : (unsigned char) (*(stream)->bufpos++ = (c))	)
 /* putchar() is equivalent to putc(c,stdout).  Since putc is a macro,
  * that means that putchar() should be a macro too...  */
-#define putchar(c) putc((c), _stdout)
+#define putchar(c) putc((c), stdout)
 
 #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
 /* Get a word (int) from STREAM.  */

+ 10 - 10
libc/stdio/stdio.c

@@ -177,9 +177,9 @@ FILE _stdio_streams[FIXED_STREAMS] = {
 	 2, _IONBF | __MODE_FREEFIL }
 };
 
-FILE *_stdin = _stdio_streams + 0;
-FILE *_stdout = _stdio_streams + 1;
-FILE *_stderr = _stdio_streams + 2;
+FILE *stdin = _stdio_streams + 0;
+FILE *stdout = _stdio_streams + 1;
+FILE *stderr = _stdio_streams + 2;
 
 /*
  * Note: the following forces linking of the __init_stdio function if
@@ -328,7 +328,7 @@ char *gets(char *str) /* This is an UNSAFE function! */
 	 *
 	 * Besides, this function is inherently unsafe and shouldn't be used.
 	 */
-	return fgets(str, INT_MAX, _stdin);
+	return fgets(str, INT_MAX, stdin);
 }
 #endif
 
@@ -352,8 +352,8 @@ int puts(const char *str)
 {
 	int n;
 
-	n = fputs(str, _stdout);	/* Let next fputc handle EOF or error. */
-	if (fputc('\n', _stdout) == EOF) { /* Don't use putc since we want to */
+	n = fputs(str, stdout);	/* Let next fputc handle EOF or error. */
+	if (fputc('\n', stdout) == EOF) { /* Don't use putc since we want to */
 		return EOF;				/* fflush stdout if it is line buffered. */
 	}
 	return n + 1;
@@ -396,8 +396,8 @@ off_t _uClibc_fread(unsigned char *buf, off_t bytes, FILE *fp)
 		fp->mode |= __MODE_ERR;
 	} else if (WRITING(fp)) {
 		fflush(fp);
-	} else if (fp->mode & _stdout->mode & __MODE_TIED) {
-		fflush(_stdout);
+	} else if (fp->mode & stdout->mode & __MODE_TIED) {
+		fflush(stdout);
 	}
 	if (EOF_OR_ERROR(fp) || (bytes <= 0)) {
 		return 0;
@@ -1001,7 +1001,7 @@ FILE *fdopen(int fd, __const char *mode)
 #undef getchar
 int getchar(void)
 {
-	return getc(_stdin);
+	return getc(stdin);
 }
 #endif
 
@@ -1009,7 +1009,7 @@ int getchar(void)
 #undef putchar
 int putchar(int c)
 {
-	return putc(c, _stdout);
+	return putc(c, stdout);
 }
 #endif