X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fprint_sw.c;h=dad30d2aebb66d3682c23feeb365e7f9a9705f06;hp=6d475aba175eedd361ae4871cdee3d608c7667bc;hb=a485ed478abbd599d8c9aab48934e7a26733ecb1;hpb=f480c03187724e54e5391ee61b810827da319a6c diff --git a/sbr/print_sw.c b/sbr/print_sw.c index 6d475ab..dad30d2 100644 --- a/sbr/print_sw.c +++ b/sbr/print_sw.c @@ -1,4 +1,3 @@ - /* * print_sw.c -- print switches * @@ -13,44 +12,44 @@ void print_sw (char *substr, struct swit *swp, char *prefix, FILE *fp) { - int len, optno; - register int i; - register char *cp, *cp1, *sp; - char buf[128]; + int len, optno; + register int i; + register char *cp, *cp1, *sp; + char buf[128]; - len = strlen(substr); - for (; swp->sw; swp++) { - /* null matches all strings */ - if (!*substr || (ssequal (substr, swp->sw) && len >= swp->minchars)) { - optno = 0; - /* next switch */ - if ((sp = (&swp[1])->sw)) { - if (!*substr && sp[0] == 'n' && sp[1] == 'o' && - strcmp (&sp[2], swp->sw) == 0 && ( - ((&swp[1])->minchars == 0 && swp->minchars == 0) || - ((&swp[1])->minchars == (swp->minchars) + 2))) - optno++; - } + len = strlen(substr); + for (; swp->sw; swp++) { + /* null matches all strings */ + if (!*substr || (ssequal (substr, swp->sw) && len >= swp->minchars)) { + optno = 0; + /* next switch */ + if ((sp = (&swp[1])->sw)) { + if (!*substr && sp[0] == 'n' && sp[1] == 'o' && + strcmp (&sp[2], swp->sw) == 0 && ( + ((&swp[1])->minchars == 0 && swp->minchars == 0) || + ((&swp[1])->minchars == (swp->minchars) + 2))) + optno++; + } - if (swp->minchars > 0) { - cp = buf; - *cp++ = '('; - if (optno) { - strcpy (cp, "[no]"); - cp += strlen (cp); + if (swp->minchars > 0) { + cp = buf; + *cp++ = '('; + if (optno) { + strcpy (cp, "[no]"); + cp += strlen (cp); + } + for (cp1 = swp->sw, i = 0; i < swp->minchars; i++) + *cp++ = *cp1++; + *cp++ = ')'; + while ((*cp++ = *cp1++)); + fprintf (fp, " %s%s\n", prefix, buf); + } else { + if (!swp->minchars) + fprintf(fp, optno ? " %s[no]%s\n" : " %s%s\n", + prefix, swp->sw); + } + if (optno) + swp++; /* skip -noswitch */ } - for (cp1 = swp->sw, i = 0; i < swp->minchars; i++) - *cp++ = *cp1++; - *cp++ = ')'; - while ((*cp++ = *cp1++)); - fprintf (fp, " %s%s\n", prefix, buf); - } else { - if (!swp->minchars) - fprintf(fp, optno ? " %s[no]%s\n" : " %s%s\n", - prefix, swp->sw); - } - if (optno) - swp++; /* skip -noswitch */ } - } }