Checking # of parms

Tad Alan Davis tad at cathedral.cerc.wvu.wvnet.edu
Thu Dec 21 05:58:47 AEST 1989


Is there a quick & dirty way, using grep, awk, or some such filter to check
the number of parmeters of a function.  Basically, I have a large set of 
functions which I call frequently with the wrong number of parms.  I want to
put the names of the functions and the number of parms in a file and use a
filter to check them in a C program.

For example	File	
			funcX 2

		Command	
			grep funcX prog.c | grep -v funcX([^,]*,[^,]*)

This works fine for

		funcX("a", "b");		not printed, valid
		funcX("a", "b", "c");		printed, invalid

      but not for

		funcX("a", funcX("a", "b"), "c");	not printed, invalid
		funcX("ok,ok", "a");			printed, valid


Any ideas which would only take an hour or two?



More information about the Comp.unix.questions mailing list