Rev 6412 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6412 | Rev 6424 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include |
1 | #include |
2 | #include |
2 | #include |
Line 3... | Line -... | ||
3 | - | ||
4 | int format_print(char *dest, size_t maxlen, const char *fmt,va_list argp); |
- | |
5 | 3 | ||
6 | int fprintf(FILE* file, const char* format, ...) |
4 | int fprintf(FILE* file, const char* format, ...) |
7 | { |
5 | { |
8 | va_list arg; |
6 | va_list arg; |
9 | char *buf; |
7 | char *buf; |
Line 13... | Line 11... | ||
13 | va_start (arg, format); |
11 | va_start (arg, format); |
14 | buf=malloc(4096*2); //8kb max |
12 | buf=malloc(4096*2); //8kb max |
15 | //data[0]=(int)&arg-(int)&format; |
13 | //data[0]=(int)&arg-(int)&format; |
Line 16... | Line 14... | ||
16 | 14 | ||
- | 15 | printed=format_print(buf,8191, format,arg); |
|
- | 16 | if (file == stderr) |
|
- | 17 | debug_out_str(buf); |
|
17 | printed=format_print(buf,8191, format,arg); |
18 | else |
18 | fwrite(buf,printed,1,file); |
19 | fwrite(buf,printed,1,file); |
Line 19... | Line 20... | ||
19 | free(buf); |
20 | free(buf); |
20 | 21 |