home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / c / hce.lha / HCE / LibSource / clib / String / src / strchr.a < prev    next >
Encoding:
Text File  |  1992-09-02  |  579 b   |  36 lines

  1. *    #include <stdio.h>
  2. *    
  3. *    char *strchr(string, symbol)
  4. *        register char *string;
  5. *        register char symbol;
  6. *    /*
  7. *     *    Return a pointer to the first occurance of <symbol> in <string>.
  8. *     *    NULL is returned if <symbol> is not found.
  9. *     */
  10. *        {
  11. *        do
  12. *            {
  13. *            if(*string == symbol)
  14. *                return(string);
  15. *            }
  16. *            while(*string++);
  17. *        return(NULL);
  18. *        }
  19.  
  20.     CODE    CODE
  21.     PUBLIC _strchr
  22. _strchr:
  23.     move.l    4(a7),a0
  24.     move.l    8(a7),d0    ; 05Aug89-Jal  move.w 8(a7),d0 for 2 byte ints.
  25. strchr1:
  26.     cmp.b    (a0),d0
  27.     bne    strchr2
  28.     move.l    a0,d0
  29.     rts
  30. strchr2:
  31.     tst.b    (a0)+
  32.     bne    strchr1
  33.     clr.l    d0
  34.     rts
  35.     END
  36.