home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 344b.lha / plplot_v2.6 / src / strpos.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-27  |  493 b   |  23 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. #ifdef PLSTDC
  8. #include <string.h>
  9. #else
  10. extern char *strchr();
  11. #endif
  12.  
  13. PLINT strpos(str,chr)
  14. char *str,chr;
  15. {
  16.     char *temp;
  17.  
  18.     if (temp = strchr(str,chr))
  19.         return((PLINT)(temp - str));
  20.     else
  21.         return((PLINT)-1);
  22. }
  23.