فهرست منبع

More header file cleanup.
-Erik

Eric Andersen 24 سال پیش
والد
کامیت
42ee079162
3فایلهای تغییر یافته به همراه136 افزوده شده و 19 حذف شده
  1. 3 0
      Makefile
  2. 102 19
      include/stdio.h
  3. 31 0
      include/unistd.h

+ 3 - 0
Makefile

@@ -4,6 +4,9 @@ DIRS = headers error getent malloc-simple misc net regexp rpc stdio2 \
 all: libc.a
 
 libc.a: $(DIRS) dummy
+	@echo
+	@echo Finally finished compiling...
+	@echo
 	$(CROSS)ranlib $@
 
 headers: dummy

+ 102 - 19
include/stdio.h

@@ -64,6 +64,16 @@ extern FILE stdout[1];
 extern FILE stderr[1];
 
 
+#define stdio_pending(fp) ((fp)->bufread>(fp)->bufpos)
+
+/* Read chunks of generic data from STREAM.  */
+extern size_t fread __P ((void *__restrict __ptr, size_t __size,
+			  size_t __n, FILE *__restrict __stream));
+/* Write chunks of generic data to STREAM.  */
+extern size_t fwrite __P ((__const void *__restrict __ptr, size_t __size,
+			   size_t __n, FILE *__restrict __s));
+
+
 #define putc(c, stream)	\
     (((stream)->bufpos >= (stream)->bufwrite) ? fputc((c), (stream))	\
                           : (unsigned char) (*(stream)->bufpos++ = (c))	)
@@ -88,31 +98,104 @@ extern int setvbuf __P((FILE*, char*, int, size_t));
 #define setbuf(__fp, __buf) setbuffer((__fp), (__buf), BUFSIZ)
 extern void setbuffer __P((FILE*, char*, int));
 
-extern int fgetc __P((FILE*));
-extern int fputc __P((int, FILE*));
-
-extern int fclose __P((FILE*));
-extern int fflush __P((FILE*));
-extern char *fgets __P((char*, size_t, FILE*));
-extern FILE *__fopen __P((char*, int, FILE*, char*));
-
+/* Read a character from STREAM.  */
+extern int fgetc __P ((FILE *__stream));
+extern int getc __P ((FILE *__stream));
+/* Push a character back onto the input buffer of STREAM.  */
+extern int ungetc __P ((int __c, FILE *__stream));
+/* Read a character from stdin.  */
+extern int getchar __P ((void));
+
+/* Write a character to STREAM.  */
+extern int fputc __P ((int __c, FILE *__stream));
+extern int putc __P ((int __c, FILE *__stream));
+/* Write a character to stdout.  */
+extern int putchar __P ((int __c));
+
+/* Close STREAM.  */
+extern int fclose __P ((FILE *__stream));
+/* Flush STREAM, or all streams if STREAM is NULL.  */
+extern int fflush __P ((FILE *__stream));
+
+/* Get a newline-terminated string from stdin, removing the newline.
+   DO NOT USE THIS FUNCTION!!  There is no limit on how much it will read.  */
+extern char *gets __P ((char *__s));
+/* Get a newline-terminated string of finite length from STREAM.  */
+extern char *fgets __P ((char *__restrict __s, int __n,
+			 FILE *__restrict __stream));
+
+
+extern FILE *__fopen __P((__const char *__restrict __filename, int __fd, 
+	    FILE *__restrict __stream, __const char *__restrict __modes));
+
+/* Open a file and create a new stream for it.  */
 #define fopen(__file, __mode)         __fopen((__file), -1, (FILE*)0, (__mode))
+/* Open a file, replacing an existing stream with it. */
 #define freopen(__file, __mode, __fp) __fopen((__file), -1, (__fp), (__mode))
+/* Create a new stream that refers to an existing system file descriptor.  */
 #define fdopen(__file, __mode)  __fopen((char*)0, (__file), (FILE*)0, (__mode))
 
-extern int fseek __P((FILE*, long, int));
-extern long ftell __P((FILE*));
-extern void rewind __P((FILE*));
 
-extern int fputs __P((char*, FILE*));
-extern int puts __P((char*));
+/* Seek to a certain position on STREAM.  */
+extern int fseek __P ((FILE *__stream, long int __off, int __whence));
+/* Return the current position of STREAM.  */
+extern long int ftell __P ((FILE *__stream));
+/* Rewind to the beginning of STREAM.  */
+extern void rewind __P ((FILE *__stream));
+
+
+/* Write a string, followed by a newline, to stdout.  */
+extern int puts __P ((__const char *__s));
+/* Write a string to STREAM.  */
+extern int fputs __P ((__const char *__restrict __s,
+		       FILE *__restrict __stream));
+
+
+/* Write formatted output to stdout.  */
+extern int printf __P ((__const char *__restrict __format, ...));
+/* Write formatted output to STREAM.  */
+extern int fprintf __P ((FILE *__restrict __stream,
+			 __const char *__restrict __format, ...));
+/* Write formatted output to S.  */
+extern int sprintf __P ((char *__restrict __s,
+			 __const char *__restrict __format, ...));
+
+/* Write formatted output to stdout from argument list ARG.  */
+extern int vprintf __P ((__const char *__restrict __format,
+			 va_list __arg));
+/* Write formatted output to S from argument list ARG.  */
+extern int vfprintf __P ((FILE *__restrict __s,
+			  __const char *__restrict __format,
+			  va_list __arg));
+/* Write formatted output to S from argument list ARG.  */
+extern int vsprintf __P ((char *__restrict __s,
+			  __const char *__restrict __format,
+			  va_list __arg));
+
+
+
+/* Read formatted input from stdin.  */
+extern int scanf __P ((__const char *__restrict __format, ...));
+/* Read formatted input from S.  */
+extern int sscanf __P ((__const char *__restrict __s,
+			__const char *__restrict __format, ...));
+/* Read formatted input from STREAM.  */
+extern int fscanf __P ((FILE *__restrict __stream,
+			__const char *__restrict __format, ...));
+/* Read formatted input from stdin into argument list ARG.  */
+extern int vscanf __P ((__const char *__restrict __format, va_list __arg))
+     __attribute__ ((__format__ (__scanf__, 1, 0)));
+/* Read formatted input from S into argument list ARG.  */
+extern int vsscanf __P ((__const char *__restrict __s,
+			 __const char *__restrict __format,
+			 va_list __arg))
+     __attribute__ ((__format__ (__scanf__, 2, 0)));
+/* Read formatted input from S into argument list ARG.  */
+extern int vfscanf __P ((FILE *__restrict __s,
+			 __const char *__restrict __format,
+			 va_list __arg))
+     __attribute__ ((__format__ (__scanf__, 2, 0)));
 
-extern int printf __P ((__const char*, ...));
-extern int fprintf __P ((FILE*, __const char*, ...));
-extern int sprintf __P ((char*, __const char*, ...));
 
-extern int ungetc __P ((int c, FILE * stream));
-
-#define stdio_pending(fp) ((fp)->bufread>(fp)->bufpos)
 
 #endif /* __STDIO_H */

+ 31 - 0
include/unistd.h

@@ -62,6 +62,37 @@ extern char * mktemp __P ((char * __template));
 extern int _clone __P ((int (*fn)(void *arg), void *child_stack, int flags, void *arg));
 
 
+/* Make PATH be the root directory (the starting point for absolute paths).
+   This call is restricted to the super-user.  */
+extern int chroot __P ((__const char *__path));
+
+
+
+
+/* Execute PATH with all arguments after PATH until
+   a NULL pointer and environment from `environ'.  */
+extern int execl __P ((__const char *__path, __const char *__arg, ...));
+
+/* Execute FILE, searching in the `PATH' environment variable if
+   it contains no slashes, with all arguments after FILE until a
+   NULL pointer and environment from `environ'.  */
+extern int execlp __P ((__const char *__file, __const char *__arg, ...));
+
+/* Execute PATH with arguments ARGV and environment from `environ'.  */
+extern int execv __P ((__const char *__path, char *__const __argv[]));
+
+/* Replace the current process, executing PATH with arguments ARGV and
+   environment ENVP.  ARGV and ENVP are terminated by NULL pointers.  */
+extern int execve __P ((__const char *__path, char *__const __argv[],
+			char *__const __envp[]));
+/* Execute FILE, searching in the `PATH' environment variable if it contains
+   no slashes, with arguments ARGV and environment from `environ'.  */
+extern int execvp __P ((__const char *__file, char *__const __argv[]));
+
+
+
+
+
 #if 0                                                                         
 #ifndef SYS_fork
 #define SYS_fork 2