File: bsd-interf.c

package info (click to toggle)
bibtool 2.48alpha.2-3.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,208 kB
  • ctags: 1,974
  • sloc: ansic: 18,936; xml: 1,036; makefile: 672; sh: 293; perl: 261; tcl: 51; awk: 15; sed: 8
file content (38 lines) | stat: -rw-r--r-- 824 bytes parent folder | download | duplicates (23)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* bsd-interf.c: test BSD interface.  */

#ifndef _POSIX_SOURCE /* whole file */

#include "test.h"

void
test_berk_search (pattern, string)
    const char *pattern;
    char *string;
{
  const char *return_value = re_comp (pattern);
  
  if (return_value != 0)
    {
      printf ("This didn't compile: `%s'.\n", pattern);
      printf ("  The error message was: `%s'.\n", return_value);
    }
  else
    if (test_should_match && re_exec (string) != strlen (string))
      {
        printf ("Should have matched but didn't:\n");
        printf ("  The pattern was: %s.\n", pattern);
        if (string)
          printf ("  The string was: `%s'.'n", string);
        else
          printf ("  The string was empty.\n");
      }
}


void
test_bsd_interface ()
{
  test_berk_search ("a", "ab");
}

#endif /* _POSIX_SOURCE */