diff options
author | cvs2svn <cvs2svn@FreeBSD.org> | 1993-07-30 20:16:54 +0000 |
---|---|---|
committer | cvs2svn <cvs2svn@FreeBSD.org> | 1993-07-30 20:16:54 +0000 |
commit | 4c6599b12882858dff92d2ae55f6683ca070bea5 (patch) | |
tree | 9ca97530aa31f1b27cf6847235f74abda80a9f75 /gnu/lib/libregex/test/syntax.skel | |
parent | 5e0c8d9ee2600d5f7d5c710e34249ae51db60ba7 (diff) | |
download | FreeBSD-src-4c6599b12882858dff92d2ae55f6683ca070bea5.zip FreeBSD-src-4c6599b12882858dff92d2ae55f6683ca070bea5.tar.gz |
This commit was manufactured by cvs2svn to create branch
'VENDOR-libregex'.
Diffstat (limited to 'gnu/lib/libregex/test/syntax.skel')
-rw-r--r-- | gnu/lib/libregex/test/syntax.skel | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/gnu/lib/libregex/test/syntax.skel b/gnu/lib/libregex/test/syntax.skel deleted file mode 100644 index a3fbf64..0000000 --- a/gnu/lib/libregex/test/syntax.skel +++ /dev/null @@ -1,74 +0,0 @@ -/* Print which syntax bits are set. */ - -#include <sys/types.h> -#include <stdio.h> -#include "regex.h" - -/* It's coincidental that these two are currently the same. */ -#define LONGEST_BIT_NAME "RE_UNMATCHED_RIGHT_PAREN_ORD" -#define LAST_BIT RE_UNMATCHED_RIGHT_PAREN_ORD - -/* Sum of above, when printed. Assigned in main. */ -static unsigned longest; - - -static void -test_bit (syntax, bit, name) - reg_syntax_t syntax; - unsigned bit; - char *name; -{ - char padding[100], test_str[100]; - int padding_count; - - sprintf (test_str, "%s (%d=0x%x)", name, bit, bit); - padding_count = longest - strlen (test_str); - - padding[padding_count] = 0; - while (padding_count--) - { - padding[padding_count] = ' '; - } - - printf ("%s%s (%d=0x%x): %c\n", - name, padding, bit, bit, syntax & bit ? 'y' : 'n'); -} - - -/* Macro to abbreviate the constant arguments. */ -#define TEST_BIT(bit) test_bit (syntax, bit, #bit) - -int -main (argc, argv) - int argc; - char *argv[]; -{ - reg_syntax_t syntax; - char syntax_str[1000], test_str[100]; - - switch (argc) - { - case 1: - printf ("Syntax? "); - scanf ("%s", syntax_str); - break; - - case 2: - strcpy (syntax_str, argv[1]); - break; - - default: - fprintf (stderr, "Usage: syntax [syntax].\n"); - exit (1); - } - - sscanf (syntax_str, "%i", &syntax); - - /* Figure out the longest name, so we can align the output nicely. */ - sprintf (test_str, "%s (%d=0x%x)", LONGEST_BIT_NAME, LAST_BIT, LAST_BIT); - longest = strlen (test_str); - - /* [[[replace with bit tests]]] */ - - return 0; -} |