os161-1.99
 All Data Structures
stdio.h
00001 /*
00002  * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
00003  *      The President and Fellows of Harvard College.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the University nor the names of its contributors
00014  *    may be used to endorse or promote products derived from this software
00015  *    without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00027  * SUCH DAMAGE.
00028  */
00029 
00030 #ifndef _STDIO_H_
00031 #define _STDIO_H_
00032 
00033 /*
00034  * Get the __-protected definition of va_list. We aren't supposed to
00035  * include stdarg.h here.
00036  */
00037 #include <kern/types.h>
00038 #include <types/size_t.h>
00039 #include <sys/null.h>
00040 
00041 /* Constant returned by a bunch of stdio functions on error */
00042 #define EOF (-1)
00043 
00044 /*
00045  * The actual guts of printf
00046  * (for libc internal use only)
00047  */
00048 int __vprintf(void (*sendfunc)(void *clientdata, const char *, size_t len),
00049               void *clientdata,
00050               const char *fmt,
00051               __va_list ap);
00052 
00053 /* Printf calls for user programs */
00054 int printf(const char *fmt, ...);
00055 int vprintf(const char *fmt, __va_list ap);
00056 int snprintf(char *buf, size_t len, const char *fmt, ...);
00057 int vsnprintf(char *buf, size_t len, const char *fmt, __va_list ap);
00058 
00059 /* Print the argument string and then a newline. Returns 0 or -1 on error. */
00060 int puts(const char *);
00061 
00062 /* Like puts, but without the newline. Returns #chars written. */
00063 /* Nonstandard C, hence the __. */
00064 int __puts(const char *);
00065 
00066 /* Writes one character. Returns it. */
00067 int putchar(int);
00068 
00069 /* Reads one character (0-255) or returns EOF on error. */
00070 int getchar(void);
00071 
00072 #endif /* _STDIO_H_ */
 All Data Structures