home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / c / string.arc / STRCMP.C < prev    next >
Text File  |  1984-12-31  |  768b  |  23 lines

  1. /*  File   : strcmp.c
  2.     Author : Richard A. O'Keefe.
  3.     Updated: 10 April 1984
  4.     Defines: strcmp()
  5.  
  6.     strcmp(s, t) returns > 0, = 0,  or < 0  when s > t, s = t,  or s < t
  7.     according  to  the  ordinary  lexicographical  order.   To  test for
  8.     equality, the macro streql(s,t) is clearer than  !strcmp(s,t).  Note
  9.     that  if the string contains characters outside the range 0..127 the
  10.     result is machine-dependent; PDP-11s and  VAXen  use  signed  bytes,
  11.     some other machines use unsigned bytes.
  12. */
  13.  
  14. #include "strings.h"
  15.  
  16. int strcmp(s, t)
  17.     register char *s, *t;
  18.     {
  19.     while (*s == *t++) if (!*s++) return 0;
  20.     return s[0]-t[-1];
  21.     }
  22.