Revision 12455,
1.2 KB
checked in by danw, 26 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r12454,
which included commits to RCS files with non-trunk default branches.
|
Line | |
---|
1 | |
---|
2 | /* |
---|
3 | * print_sw.c -- print switches |
---|
4 | * |
---|
5 | * $Id: print_sw.c,v 1.1.1.1 1999-02-07 18:14:09 danw Exp $ |
---|
6 | */ |
---|
7 | |
---|
8 | #include <h/mh.h> |
---|
9 | |
---|
10 | |
---|
11 | void |
---|
12 | print_sw (char *substr, struct swit *swp, char *prefix) |
---|
13 | { |
---|
14 | int len, optno; |
---|
15 | register int i; |
---|
16 | register char *cp, *cp1, *sp; |
---|
17 | char buf[128]; |
---|
18 | |
---|
19 | len = strlen(substr); |
---|
20 | for (; swp->sw; swp++) { |
---|
21 | /* null matches all strings */ |
---|
22 | if (!*substr || (ssequal (substr, swp->sw) && len >= swp->minchars)) { |
---|
23 | optno = 0; |
---|
24 | /* next switch */ |
---|
25 | if ((sp = (&swp[1])->sw)) { |
---|
26 | if (!*substr && sp[0] == 'n' && sp[1] == 'o' && |
---|
27 | strcmp (&sp[2], swp->sw) == 0 && ( |
---|
28 | ((&swp[1])->minchars == 0 && swp->minchars == 0) || |
---|
29 | ((&swp[1])->minchars == (swp->minchars) + 2))) |
---|
30 | optno++; |
---|
31 | } |
---|
32 | |
---|
33 | if (swp->minchars > 0) { |
---|
34 | cp = buf; |
---|
35 | *cp++ = '('; |
---|
36 | if (optno) { |
---|
37 | strcpy (cp, "[no]"); |
---|
38 | cp += strlen (cp); |
---|
39 | } |
---|
40 | for (cp1 = swp->sw, i = 0; i < swp->minchars; i++) |
---|
41 | *cp++ = *cp1++; |
---|
42 | *cp++ = ')'; |
---|
43 | while ((*cp++ = *cp1++)); |
---|
44 | printf (" %s%s\n", prefix, buf); |
---|
45 | } else { |
---|
46 | if (!swp->minchars) |
---|
47 | printf(optno ? " %s[no]%s\n" : " %s%s\n", prefix, swp->sw); |
---|
48 | } |
---|
49 | if (optno) |
---|
50 | swp++; /* skip -noswitch */ |
---|
51 | } |
---|
52 | } |
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.