/* * p o s 1 6 . c */ /*)LIBRARY */ #ifdef DOCUMENTATION title pos16 Get First Occurance in Words index get first Occurance in words synopsis int pos16(c,s) char c; /* character to be looked for */ char *s; /* pointer to the buffer to look in */ description Using 16-bit characters (in ints) find the position of character c in string s return -1 if it isn't there return the index of 1st occurence if it is there. bugs author Machiavelli Systems #endif int pos16(c,s) int c; /* the search target */ int *s; /* string to search */ { int *p; /* look arround looking for the character, or null */ for (p=s; *p; p++) if (*p==c) break; /* if we're at the end, return -1 else return posn. in words */ return(*p ? p-s : -1); }