rs@uunet.UU.NET (Rich Salz) (06/24/87)
Mod.sources: Volume 10, Number 20 Submitted by: Hal Render <render@b.cs.uiuc.edu> Archive-Name: fastgrep/Patch1 [ If you are running 4.3, SystemV, or if you have Henry's string library posted here last volume, then you won't need this. --r$ ] The fastgrep sources I got were apparently incomplete. The code in the file 'egrep.c' called for a routine 'strpbrk(s1, s2)'. I guessed from the context that the routine looks for occurrences of characters in the second parameter string in the first parameter string, returning a pointer to the first occurrence of one of the characters. Accordingly, I wrote a simple routine to do this. Here it is, for the benefit of whomever wants it. I have tested the compiled binaries, and they work fine. Note that the Makefile included with the sources should be changed to include the file 'strpbrk.o' as one of the files assigned to the OBJ variable (i.e. 'OBJ= strpbrk.o ...' should be in the Makefile). Hal Render University of Illinois at Urbana-Champaign render@b.cs.uiuc.edu (ARPA) {seismo,pur-ee}!uiucdcs!render (USENET) -------------CUT HERE---------------------------------------------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh. # The following files will be created: # strpbrk.c # This archive created: Thu Jun 18 10:49:34 1987 export PATH; PATH=/bin:$PATH if test -f 'strpbrk.c' then echo shar: over-writing existing file "'strpbrk.c'" fi cat << \SHAR_EOF > 'strpbrk.c' #include <strings.h> char * strpbrk(pat1, pat2) register char *pat1; /* target pattern */ char *pat2; /* list of characters to search for */ { register char *cp1, *cp2; cp1 = pat2; while (*cp1 != '\0') { if ((cp2 = index(pat1, *cp1)) != (char *) 0) return(cp2); cp1++; } return((char *) 0); } SHAR_EOF # End of shell archive exit 0