source: tags/initial/GDE/PHYLIP/vaxfix.c

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
5void vax_printf_is_broken(const char *fmt,...);
6void vax_fprintf_is_broken(FILE *fp,const char *fmt,...);
7void vax_tweak_fmt(char *);
8
9
10void vax_tweak_fmt(char *format)
11{
12int inperc,rp,wp;
13rp=0;
14wp=0;
15while (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
31void vax_printf_is_broken(const char *fmt,...)
32{
33va_list args;
34char output[256];
35vax_tweak_fmt(fmt);
36va_start(args,fmt);
37vsprintf(output,fmt,args);
38va_end(args);
39fputs(output,stdout);
40}
41
42void vax_fprintf_is_broken(FILE *fp,const char *fmt,...)
43{
44va_list args;
45char output[256];
46vax_tweak_fmt(fmt);
47va_start(args,fmt);
48vfprintf(fp,fmt,args);
49va_end(args);
50}
Note: See TracBrowser for help on using the repository browser.