2 ** print_sw.c -- print switches
4 ** This code is Copyright (c) 2002, by the authors of nmh. See the
5 ** COPYRIGHT file in the root directory of the nmh distribution for
6 ** complete copyright information.
13 print_sw(char *substr, struct swit *swp, char *prefix, FILE *fp)
17 register char *cp, *cp1, *sp;
21 for (; swp->sw; swp++) {
22 /* null matches all strings */
23 if (!*substr || (strncmp(swp->sw, substr, len)==0 &&
24 len >= swp->minchars)) {
27 if ((sp = (&swp[1])->sw)) {
28 if (!*substr && sp[0] == 'n' && sp[1] == 'o' &&
29 strcmp(&sp[2], swp->sw) == 0 && (
30 ((&swp[1])->minchars == 0 && swp->minchars == 0) ||
31 ((&swp[1])->minchars == (swp->minchars) + 2)))
35 if (swp->minchars > 0) {
42 for (cp1 = swp->sw, i = 0; i < swp->minchars; i++)
45 while ((*cp++ = *cp1++));
46 fprintf(fp, " %s%s\n", prefix, buf);
49 fprintf(fp, optno ? " %s[no]%s\n" : " %s%s\n",
53 swp++; /* skip -noswitch */