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 / strrchr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-12  |  401 b   |  35 lines

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