home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 191.lha / ARequester / strcmpa.c < prev    next >
C/C++ Source or Header  |  1988-04-28  |  458b  |  25 lines

  1. #include <ctype.h>
  2.  
  3. /* compare two strings without regard to case */
  4.  
  5. short strcmpa(scan1, scan2)
  6. register char *scan1;
  7. register char *scan2;
  8. {
  9.  
  10. while( *scan1 != '\0' && toupper(*scan1) == toupper(*scan2) )
  11.    {
  12.    scan1++;
  13.    scan2++;
  14.    }
  15.  
  16. if( *scan1 == '\0' && *scan2 == '\0')
  17.    return((short)0);
  18. else if (*scan1 == '\0')
  19.    return((short)-1);
  20. else if (*scan2 == '\0')
  21.    return((short)1);
  22. else
  23.    return( (short)(toupper(*scan1) - toupper(*scan2)) );
  24. }
  25.