home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / src / cmd / tbl / ts.c < prev    next >
Encoding:
C/C++ Source or Header  |  1979-01-10  |  675 b   |  50 lines

  1.  /* ts.c: minor string processing subroutines */
  2. match (s1, s2)
  3.     char *s1, *s2;
  4. {
  5.     while (*s1 == *s2)
  6.         if (*s1++ == '\0')
  7.             return(1);
  8.         else
  9.             s2++;
  10.     return(0);
  11. }
  12. prefix(small, big)
  13.     char *small, *big;
  14. {
  15. int c;
  16. while ((c= *small++) == *big++)
  17.     if (c==0) return(1);
  18. return(c==0);
  19. }
  20. letter (ch)
  21.     {
  22.     if (ch >= 'a' && ch <= 'z')
  23.         return(1);
  24.     if (ch >= 'A' && ch <= 'Z')
  25.         return(1);
  26.     return(0);
  27.     }
  28. numb(str)
  29.     char *str;
  30.     {
  31.     /* convert to integer */
  32.     int k;
  33.     for (k=0; *str >= '0' && *str <= '9'; str++)
  34.         k = k*10 + *str - '0';
  35.     return(k);
  36.     }
  37. digit(x)
  38.     {
  39.     return(x>= '0' && x<= '9');
  40.     }
  41. max(a,b)
  42. {
  43. return( a>b ? a : b);
  44. }
  45. tcopy (s,t)
  46.     char *s, *t;
  47. {
  48.     while (*s++ = *t++);
  49. }
  50.