home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d3xx / d306 / rexxplplot.lha / RexxPlPlot / src / src.zoo / strpos.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-06  |  538 b   |  24 lines

  1. /* Searches string str for first occurence of character chr.  If found */
  2. /* the position of the character in the string is returned (the first  */
  3. /* character has position 0).  If the character is not found a -1 is   */
  4. /* returned. */
  5.  
  6. #include "plplot.h"
  7. #include <stdio.h>     /* Needed to define NULL */
  8. #ifdef AZTEC_C
  9. extern char *strchr();
  10. #else
  11. #include <string.h>
  12. #endif
  13.  
  14. int strpos(str,chr)
  15. char *str,chr;
  16. {
  17.     char *temp;
  18.  
  19.     if ( (temp = strchr(str,chr)) != NULL)
  20.         return(temp - str);
  21.     else
  22.         return(-1);
  23. }
  24.