home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 280_01 / cindex.c < prev    next >
Text File  |  1989-01-13  |  1KB  |  43 lines

  1. /* [cindex.c of JUGPDS Vol.17] */
  2. /*
  3. *****************************************************************
  4. *                                *
  5. *    Written by  Hakuo Katayose (JUG-CP/M No.179)        *
  6. *            49-114 Kawauchi-Sanjuunin-machi        *
  7. *            Sendai, Miyagi 980                          *
  8. *            Phone: 0222-61-3219                *
  9. *                                *
  10. *       Modifird by Toshiya Oota   (JUG-CPM No.10)              *
  11. *                   Sakae ko-po 205                 *
  12. *            5-19-6 Hosoda                *
  13. *            Katusikaku Tokyo 124            *
  14. *                                *
  15. *        for MS-DOS Lattice C V3.1J & 80186/V20/V30    *
  16. *                                *
  17. *    Compiler Option: -ccu -k0(1) -ms -n -v -w        *
  18. *                                *
  19. *    Edited & tested by Y. Monma (JUG-CP/M Disk Editor)    *
  20. *            &  T. Ota   (JUG-CP/M Sub Disk Editor)    *
  21. *                                *
  22. *****************************************************************
  23. */
  24.  
  25. /* Library functions for Software Tools */
  26.  
  27. #include "stdio.h"
  28. #include "dos.h"
  29. #include "ctype.h"
  30. #include "tools.h"
  31.  
  32. /* cindex - find character c in string str */
  33. int  cindex(str, c)
  34. char    *str;
  35. int    c;
  36.  
  37. {
  38. int    i;
  39.     i = 0;
  40.     while(*str && *str != c) *str++, i++;
  41.     return (*str == EOS ? ERROR : i);
  42. }
  43.