home *** CD-ROM | disk | FTP | other *** search
/ Dream 48 / Amiga_Dream_48.iso / Atari / c / sozobon-v2 / dlibsrc.lha / STRCHR.S < prev    next >
Text File  |  1988-10-05  |  554b  |  35 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. .text
  21. .globl _strchr
  22. _strchr:
  23.     move.l    4(a7),a0
  24.     move.w    8(a7),d0
  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.