source: trunk/sys/dietlibc/dietstdio.h @ 26

Last change on this file since 26 was 1, checked in by alain, 8 years ago

First import

File size: 1.8 KB
RevLine 
[1]1/* diet stdio */
2
3#include <sys/types.h>
4#include "dietfeatures.h"
5#ifdef WANT_THREAD_SAFE
6#include <pthread.h>
7#endif
8#include <stdarg.h>
9
10#ifdef WANT_SMALL_STDIO_BUFS
11#define BUFSIZE 128
12#else
13#define BUFSIZE 2048
14#endif
15
16struct __stdio_file {
17  int fd;
18  int flags;
19  uint32_t bs;  /* read: bytes in buffer */
20  uint32_t bm;  /* position in buffer */
21  uint32_t buflen;      /* length of buf */
22  char *buf;
23  struct __stdio_file *next;    /* for fflush */
24  pid_t popen_kludge;
25  unsigned char ungetbuf;
26  char ungotten;
27#ifdef WANT_THREAD_SAFE
28  pthread_mutex_t m;
29#endif
30};
31
32#define ERRORINDICATOR 1
33#define EOFINDICATOR 2
34#define BUFINPUT 4
35#define BUFLINEWISE 8
36#define NOBUF 16
37#define STATICBUF 32
38#define FDPIPE 64
39#define CANREAD 128
40#define CANWRITE 256
41
42#define _IONBF 0
43#define _IOLBF 1
44#define _IOFBF 2
45
46#include <stdio.h>
47
48/* internal function to flush buffer.
49 * However, if next is BUFINPUT and the buffer is an input buffer, it
50 * will not be flushed. Vice versa for output */
51extern int __fflush4(FILE *stream,int next);
52extern int __buffered_outs(const char *s,size_t len);
53
54/* ..scanf */
55struct arg_scanf {
56  void *data;
57  int (*getch)(void*);
58  int (*putch)(int,void*);
59};
60
61int __v_scanf(struct arg_scanf* fn, const char *format, va_list arg_ptr);
62
63struct arg_printf {
64  void *data;
65  int (*put)(void*,size_t,void*);
66};
67
68int __v_printf(struct arg_printf* fn, const char *format, va_list arg_ptr);
69
70extern FILE *__stdio_root;
71
72int __fflush_stdin(void);
73int __fflush_stdout(void);
74int __fflush_stderr(void);
75
76FILE* __stdio_init_file(int fd,int closeonerror,int mode);
77int __stdio_parse_mode(const char *mode);
78void __stdio_flushall(void);
79
80FILE *fopen_unlocked(const char *path, const char *mode);
81FILE *fdopen_unlocked(int fildes, const char *mode);
82FILE *freopen_unlocked(const char *path, const char *mode, FILE *stream);
83
84int __stdout_is_tty(void);
85int __stdin_is_tty(void);
Note: See TracBrowser for help on using the repository browser.