home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #1 / MONSTER.ISO / prog / gen / regex011.taz / regex011 / regex-0.11 / test / bsd-interf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-16  |  824 b   |  39 lines

  1. /* bsd-interf.c: test BSD interface.  */
  2.  
  3. #ifndef _POSIX_SOURCE /* whole file */
  4.  
  5. #include "test.h"
  6.  
  7. void
  8. test_berk_search (pattern, string)
  9.     const char *pattern;
  10.     char *string;
  11. {
  12.   const char *return_value = re_comp (pattern);
  13.   
  14.   if (return_value != 0)
  15.     {
  16.       printf ("This didn't compile: `%s'.\n", pattern);
  17.       printf ("  The error message was: `%s'.\n", return_value);
  18.     }
  19.   else
  20.     if (test_should_match && re_exec (string) != strlen (string))
  21.       {
  22.         printf ("Should have matched but didn't:\n");
  23.         printf ("  The pattern was: %s.\n", pattern);
  24.         if (string)
  25.           printf ("  The string was: `%s'.'n", string);
  26.         else
  27.           printf ("  The string was empty.\n");
  28.       }
  29. }
  30.  
  31.  
  32. void
  33. test_bsd_interface ()
  34. {
  35.   test_berk_search ("a", "ab");
  36. }
  37.  
  38. #endif /* _POSIX_SOURCE */
  39.