Last change
on this file was
2,
checked in by oldcode, 24 years ago
|
Initial revision
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
982 bytes
|
Line | |
---|
1 | #include<stdio.h> |
---|
2 | #include<stdarg.h> |
---|
3 | #define printf vax_printf_is_broken |
---|
4 | |
---|
5 | void vax_printf_is_broken(const char *fmt,...); |
---|
6 | void vax_fprintf_is_broken(FILE *fp,const char *fmt,...); |
---|
7 | void vax_tweak_fmt(char *); |
---|
8 | |
---|
9 | |
---|
10 | void vax_tweak_fmt(char *format) |
---|
11 | { |
---|
12 | int inperc,rp,wp; |
---|
13 | rp=0; |
---|
14 | wp=0; |
---|
15 | while (rp <= strlen(format)) |
---|
16 | { |
---|
17 | format[rp] = format[wp]; |
---|
18 | if (format[rp] == '%') |
---|
19 | inperc = 1; |
---|
20 | if (inperc){ |
---|
21 | if ((format[rp] < '0' || format[rp] > '9') && format[rp] != 'h' |
---|
22 | && format[rp] != '%') |
---|
23 | inperc=0; |
---|
24 | } |
---|
25 | wp++; |
---|
26 | if (!inperc || (inperc && format[rp] != 'h')) |
---|
27 | rp++; |
---|
28 | } |
---|
29 | } |
---|
30 | |
---|
31 | void vax_printf_is_broken(const char *fmt,...) |
---|
32 | { |
---|
33 | va_list args; |
---|
34 | char output[256]; |
---|
35 | vax_tweak_fmt(fmt); |
---|
36 | va_start(args,fmt); |
---|
37 | vsprintf(output,fmt,args); |
---|
38 | va_end(args); |
---|
39 | fputs(output,stdout); |
---|
40 | } |
---|
41 | |
---|
42 | void vax_fprintf_is_broken(FILE *fp,const char *fmt,...) |
---|
43 | { |
---|
44 | va_list args; |
---|
45 | char output[256]; |
---|
46 | vax_tweak_fmt(fmt); |
---|
47 | va_start(args,fmt); |
---|
48 | vfprintf(fp,fmt,args); |
---|
49 | va_end(args); |
---|
50 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.