Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!sun-barr!decwrl!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.unix.questions Subject: Re: Checking # of parms Message-ID: <6641@jpl-devvax.JPL.NASA.GOV> Date: 20 Dec 89 22:58:23 GMT References: <339@cerc.wvu.wvnet.edu.edu> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 38 In article <339@cerc.wvu.wvnet.edu.edu> tad@cathedral.cerc.wvu.wvnet.edu (Tad Alan Davis) writes: : 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? How about a minute or two. Put your definitions into File as #define funcX(a,b) Then do something like cat File prog.c | /lib/cpp >/dev/null or whatever you need to do to feed your files to the C preprocessor. Larry Wall lwall@jpl-devvax.jpl.nasa.gov