3 * print_sw.c -- print switches
7 * This code is Copyright (c) 2002, by the authors of nmh. See the
8 * COPYRIGHT file in the root directory of the nmh distribution for
9 * complete copyright information.
16 print_sw (char *substr, struct swit *swp, char *prefix)
20 register char *cp, *cp1, *sp;
24 for (; swp->sw; swp++) {
25 /* null matches all strings */
26 if (!*substr || (ssequal (substr, swp->sw) && len >= swp->minchars)) {
29 if ((sp = (&swp[1])->sw)) {
30 if (!*substr && sp[0] == 'n' && sp[1] == 'o' &&
31 strcmp (&sp[2], swp->sw) == 0 && (
32 ((&swp[1])->minchars == 0 && swp->minchars == 0) ||
33 ((&swp[1])->minchars == (swp->minchars) + 2)))
37 if (swp->minchars > 0) {
44 for (cp1 = swp->sw, i = 0; i < swp->minchars; i++)
47 while ((*cp++ = *cp1++));
48 printf (" %s%s\n", prefix, buf);
51 printf(optno ? " %s[no]%s\n" : " %s%s\n", prefix, swp->sw);
54 swp++; /* skip -noswitch */