string.c extension

John Antypas jantypas at wolf.SNS
Sat May 3 07:21:45 AEST 1986


In the Unix system, many libarary functions are provided as part of the
C library and Unix itself.  Yet time and time again they leave something
out.  The code below adds four string functions to C/Unix which I find
useful.  I hope others do also.

int strindex()  -- Find a STRING pattern in another string and return
                   its index otherwise (-1).

int strreplace() -- Replace first occurrance of pattern with replacement
                   pattern.  The replacement can be empty ("") providing
                   strdelete in effect. (a defined macro here)

int strword() -- Returns either number of words in string or the selected
                 word from the string.  The character which separates words
                 is passed as well allowing user to even scan UUCP paths.

John Antypas -- U.C. San Diego
uucp: ...!sdcsvax!jantypas       arpa: jantypas at sdcsvax.ucsd.edu



More information about the Comp.sources.unix mailing list