home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / libnix-0.8-src.lha / libnix-0.8 / sources / nix / string / strchr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-12  |  400 b   |  37 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stabs.h>
  4.  
  5. #ifndef mc68000
  6.  
  7. char *strchr(const char *s,int c)
  8. {
  9.   while (*s!=(char)c)
  10.     if (!(*s++))
  11.     {
  12.       s=NULL;
  13.       break;
  14.     }
  15.   return (char *)s;
  16. }
  17.  
  18. #else
  19.  
  20. asm("
  21.     .globl    _strchr
  22. _strchr:
  23.     movel    sp@(4:W),a0
  24.     movel    sp@(8:W),d0
  25. L2:    cmpb    a0@,d0
  26.     jeq    L1
  27.     tstb    a0@+
  28.     jne    L2
  29.     subal    a0,a0
  30. L1:    movel    a0,d0
  31.     rts
  32. ");
  33.  
  34. #endif
  35.  
  36. ALIAS(index,strchr);
  37.