honzo@4gl.UUCP (04/18/87)
# I should have made this a long time before. # # tok - a tool for the poor souls that have to live with # c compilers that do not understand long-names. # # Usage: 1. ensure that all you .c and .h files are sitting # in one directory. # 2. type tok # #! /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/[k]sh to create the files: # Makefile # tok # tok1.l # tok2.c # This archive created: Fri Apr 17 23:16:49 1987 # By: honzo export PATH; PATH=/bin:$PATH if test -f 'Makefile' then echo shar: will not over-write existing file "'Makefile'" else cat > 'Makefile' << \S!H!A!R # tok - the sound that a chicken makes # all: tok1 tok2 tok1: lex.yy.c cc lex.yy.c -o tok1 -ll tok2: tok2.c cc tok2.c -o tok2 lex.yy.c: tok1.l lex tok1.l S!H!A!R fi # end of overwriting check if test -f 'tok' then echo shar: will not over-write existing file "'tok'" else cat > 'tok' << \S!H!A!R echo "Making sed script ..." cat *.[ch] | tok1 | sort -u | tok2 >sed.script for FILE in *.[ch] do echo "Sediting file $FILE" mv $FILE tok.$$ sed -f sed.script tok.$$ > $FILE done rm tok.$$ S!H!A!R chmod +x 'tok' fi # end of overwriting check if test -f 'tok1.l' then echo shar: will not over-write existing file "'tok1.l'" else cat > 'tok1.l' << \S!H!A!R %% [_A-Za-z][_A-Za-z0-9]* printf("%s\n", yytext); [0-9][0-9x\\]* ; \" while(input() != '"'); "/*" { loop: while(input() != '*'); switch(input()) { case '/': break; case '*': unput('*'); default: goto loop; } } " " | "\t" | "\r" | "\n" | "\b" | "!" | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*" | "+" | "," | "-" | "." | "/" | ":" | ";" | "<" | "=" | ">" | "?" | "@" | "[" | "\\" | "]" | "^" | "_" | "`" | "{" | "|" | "}" | "~" ; S!H!A!R fi # end of overwriting check if test -f 'tok2.c' then echo shar: will not over-write existing file "'tok2.c'" else cat > 'tok2.c' << \S!H!A!R #include <stdio.h> main() { char buffer[2][80]; int i = 0, count = 0; while(!feof(stdin)) { i = (i == 1) ? 0 : 1; gets(buffer[i]); if (strncmp(buffer[0], buffer[1], 7) == 0) printf("/%s/s//F%d_%s/g\n",buffer[i],count++,buffer[i]); } } S!H!A!R fi # end of overwriting check # End of shell archive echo "What... " sleep 2 echo " ...no Copyright notice ???" exit 0 -- I_I( _ UUCP: ..mcvax!honzo@4gl I I ) Honzo Svasek @ 4GL Consultants b.v. FIDO: Honzo Svasek @ 500/333