1 /* Print which syntax bits are set. */
7 /* It's coincidental that these two are currently the same. */
8 #define LONGEST_BIT_NAME "RE_UNMATCHED_RIGHT_PAREN_ORD"
9 #define LAST_BIT RE_UNMATCHED_RIGHT_PAREN_ORD
11 /* Sum of above, when printed. Assigned in main. */
12 static unsigned longest;
16 test_bit (syntax, bit, name)
21 char padding[100], test_str[100];
24 sprintf (test_str, "%s (%d=0x%x)", name, bit, bit);
25 padding_count = longest - strlen (test_str);
27 padding[padding_count] = 0;
28 while (padding_count--)
30 padding[padding_count] = ' ';
33 printf ("%s%s (%d=0x%x): %c\n",
34 name, padding, bit, bit, syntax & bit ? 'y' : 'n');
38 /* Macro to abbreviate the constant arguments. */
39 #define TEST_BIT(bit) test_bit (syntax, bit, #bit)
47 char syntax_str[1000], test_str[100];
53 scanf ("%s", syntax_str);
57 strcpy (syntax_str, argv[1]);
61 fprintf (stderr, "Usage: syntax [syntax].\n");
65 sscanf (syntax_str, "%i", &syntax);
67 /* Figure out the longest name, so we can align the output nicely. */
68 sprintf (test_str, "%s (%d=0x%x)", LONGEST_BIT_NAME, LAST_BIT, LAST_BIT);
69 longest = strlen (test_str);
71 /* [[[replace with bit tests]]] */