]> diplodocus.org Git - nmh/blob - docs/historical/mh-nov-1983/subs/printsw.c
Update XOAUTH2 documentation.
[nmh] / docs / historical / mh-nov-1983 / subs / printsw.c
1 #include "mh.h"
2
3 printsw(substr, swp, prefix)
4 char *substr, *prefix;
5 struct swit *swp;
6 {
7 char buf[128];
8 register char *cp, *cp1;
9 register int i;
10 int len;
11
12 len = strlen(substr);
13 for(; swp->sw; swp++)
14 if(!*substr || /* null matches all strings */
15 (ssequal(substr, swp->sw) && len >= swp->minchars))
16 if(swp->minchars > 0) {
17 cp = buf;
18 *cp++ = '(';
19 for(cp1 = swp->sw, i = 0; i < swp->minchars; i++)
20 *cp++ = *cp1++;
21 *cp++ = ')';
22 while(*cp++ = *cp1++);
23 printf(" %s%s\n", prefix, buf);
24 } else if(swp->minchars == 0)
25 printf(" %s%s\n", prefix, swp->sw);
26 }