1: /*
   2:  * Copyright (c) 1980 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)s_cmp.c	5.1	6/7/85
   7:  */
   8: 
   9: int s_cmp(a, b, la, lb) /* compare two strings */
  10: register char *a, *b;
  11: long int la, lb;
  12: {
  13: register char *aend, *bend;
  14: aend = a + la;
  15: bend = b + lb;
  16: 
  17: if(la <= lb)
  18:     {
  19:     while(a < aend)
  20:         if(*a != *b)
  21:             return( *a - *b );
  22:         else
  23:             { ++a; ++b; }
  24: 
  25:     while(b < bend)
  26:         if(*b != ' ')
  27:             return( ' ' - *b );
  28:         else    ++b;
  29:     }
  30: 
  31: else
  32:     {
  33:     while(b < bend)
  34:         if(*a == *b)
  35:             { ++a; ++b; }
  36:         else
  37:             return( *a - *b );
  38:     while(a < aend)
  39:         if(*a != ' ')
  40:             return(*a - ' ');
  41:         else    ++a;
  42:     }
  43: return(0);
  44: }
Last modified: 1985-06-08
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 412
Valid CSS Valid XHTML 1.0 Strict