home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / d / libc / libc-4.6 / libc-4 / libc-linux / string / strbug.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-25  |  697 b   |  34 lines

  1. #include <errno.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <strings.h>
  6. #include <fcntl.h>
  7.  
  8. #if !defined(HAVE_GNU_LD) && !defined (__ELF__)
  9. #define _sys_nerr    sys_nerr
  10. #define _sys_errlist    sys_errlist
  11. #endif
  12.  
  13. #define    STREQ(a, b)    (strcmp((a), (b)) == 0)
  14.  
  15. /* Complain if condition is not true.  */
  16. void
  17. check (int thing, int number)
  18. {
  19.   if (!thing)
  20.     {
  21.       printf("strcmp: flunked test %d with result %d\n", number, thing);
  22.     }
  23.   else
  24.       printf("strcmp: passed test %d with result %d\n", number, thing);
  25. }
  26.  
  27. int
  28. main ()
  29. {
  30.   /* Test strcmp first because we use it to test other things.  */
  31.   check(strcmp("abcd", "abc"), 5);
  32.   check(strcmp("abcd", "abc") > 0, 5);
  33. }
  34.