Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!cca!ima!ism780b!jim From: jim@ism780b.UUCP Newsgroups: net.lang.c Subject: Re: C and AWK questions - (nf) Message-ID: <59@ism780b.UUCP> Date: Sat, 18-Aug-84 00:11:04 EDT Article-I.D.: ism780b.59 Posted: Sat Aug 18 00:11:04 1984 Date-Received: Sun, 19-Aug-84 13:43:39 EDT Lines: 26 #R:chemabs:-13400:ism780b:25500016:000:1007 ism780b!jim Aug 16 14:22:00 1984 malloc buffers get clobbered by falling off the end, usually by an improper limit check on an array index. A very frequent method is newfoo = strcpy(malloc(strlen(foo)), foo); which is wrong because strlen does not include the terminating NUL. Several programs, such as make and find, contain subroutines which do shell filename expansion. For some reason these have never been extracted out into a libc routine. It is depressing that awk does not have so fundamental a function as system(), so there is no way to execute other commands from within awk. Nor is there any way to read input from more than one file. the "uniq" command will eliminate duplicates, yield only the lines which are not duplicates, yield only lines which are duplicates, or produce each unique line with a count of occurrences, according to your fancy. If you just want the first occurrence of a pattern in a given file, use sed '/pattern/q' or awk '/pattern/ {print; exit}' -- Jim Balter, INTERACTIVE Systems (ima!jim)