wanted: converter for fcn declarators

Mark Zimmermann science at nems.dt.navy.mil
Mon Jun 4 21:03:46 AEST 1990


I am writing C using the newer ANSI-style function declarations (see
examples below) and this is great for my Macintosh and PC C compilers --
but the generic UNIX 'cc' available to me on Macintosh under A/UX, on
Sun Sparcstation, and on VAX under Ultrix do NOT understand this style,
alas.  Could somebody help me find or develop a quick program to convert
from new ANSI-prototype-style declarators to the old way?

I would estimate that this could be done in 5-10 lines of awk, since I
can *guarantee* that my function declarations look like the following
examples and never extend over more than 2 lines.  But I'm not quite good
enough at awk to do it myself, and I am sure that others must have
encountered this same problem often enough to have solved it cleanly.

My functions currently look like:
main (int argc, char *argv[])
void print_help (void)
void load_docfile (FILE* docfile, unsigned char *docp, long start,
	    long doclength)
void make_index_ptrs (unsigned char *doc0, long doclength,
	    zndxptr *ptr0, long ptrcount)
long write_index_files (unsigned char *doc0, zndxptr *ptr0, long ptrcount,
		FILE *kfile, FILE *pfile)
...
and so forth ... in each case, the function declarator is followed by a
newline, an indentation, and a '{' on a line by itself before the body
of the function (in my typing style, anyway) ... apologies for not putting
'int' in front of 'main' ...

Tnx for help!!  ^z
(science at nems.dt.navy.mil on Internet)



More information about the Comp.lang.c mailing list