Path: utzoo!mnetor!uunet!husc6!bbn!rochester!ritcv!mds7958 From: mds7958@ritcv.UUCP (Mark Sicignano) Newsgroups: comp.lang.c Subject: Re: finding stray /* Message-ID: <105@ritcv.UUCP> Date: 19 Jan 88 00:47:04 GMT References: <38384@sun.uucp> <3573@sdcc6.ucsd.EDU> <434@drilex.UUCP> <7124@brl-smoke.ARPA> <1464@dataio.Data-IO.COM> Organization: Rochester Institute of Technology, Rochester, NY Lines: 32 > In article <434@drilex.UUCP> dricej@drilex.UUCP (Craig Jackson) writes: > > a = b/*c; > >My friend spent two days looking for that one... > > A more subtle bug I've had serious problems with is: > > a = b; /* some explanatory comment > c = d; /* another comment */ > > Note the missing */ on the first comment, causing the c = d; to be ignored, > which was very difficult and frustrating to find. Wasting my time on this I use the following little script. It will display your C source files with the code being boldface and the comments being normal intensity. If you have a /* or a */ that doesn't belong, you will be able to see it right away. This will work on VT100 or any terminal which recognizes the ANSI escape sequences I used. Note that the ^[ is really an escape ( 0x1b in hex). ---cut here---------------------------------------------------- echo '^[[1m' expand $* | sed '{ s/\/\*/^[[0m\/\*/g s/\*\//\*\/^[[1m/g }' ---cut here----------------------------------------------------