nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

byte_rchr.c (390B)


      1 #include "byte.h"
      2 
      3 unsigned int byte_rchr(char *s, unsigned int n, int c)
      4 {
      5   char ch;
      6   char *t;
      7   char *u;
      8 
      9   ch = c;
     10   t = s;
     11   u = 0;
     12   for (;;) {
     13     if (!n) break; if (*t == ch) u = t; ++t; --n;
     14     if (!n) break; if (*t == ch) u = t; ++t; --n;
     15     if (!n) break; if (*t == ch) u = t; ++t; --n;
     16     if (!n) break; if (*t == ch) u = t; ++t; --n;
     17   }
     18   if (!u) u = t;
     19   return u - s;
     20 }