It is probably not a big deal for most people, but this change to printsw.c
helps to reduce the number of lines that scroll by when a user asks for
help. This is based on 6.5 sources, but it didn't look to me that 6.8.3
sources had changed much here (if at all)...
MAXCOL should come from the window width information...sigh...
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
/* printsw.c - print switches */
#include "../h/mh.h"
#define MAXCOL 70
void printsw (substr, swp, prefix)
register char *substr,
*prefix;
register struct swit *swp;
{
struct swit *swp1;
int len, optno, llen, maxcol = 0;
int col = 0;
register int i;
register char *cp,
*cp1,
*sp;
char buf[128];
for (swp1 = swp; swp1->sw; swp1++)
maxcol = maxcol > strlen (swp1->sw) ? maxcol : strlen
(swp1->sw);
maxcol += 7;
len = strlen (substr);
for (; swp -> sw; swp++) {
if (!*substr || /* null matches all strings */
(ssequal (substr, swp -> sw) && len >=
swp -> minchars)) {
optno = 0;
if (sp = (&swp[1]) -> sw) { /* next switch */
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) {
(void) strcpy (cp, "[no]");
cp += strlen (cp);
}
for (cp1 = swp -> sw, i = 0; i < swp ->
minchars; i++)
*cp++ = *cp1++;
*cp++ = ')';
strcpy (cp, cp1);
llen = strlen (prefix) + strlen (buf);
if ((col += maxcol) > MAXCOL) {
putchar ('\n');
col = maxcol;
}
printf ("%s%s%*s", prefix, buf, maxcol - llen,
"");
} else {
if (swp -> minchars == 0) {
llen = strlen (prefix) + strlen
(swp->sw) +
(optno ? 4:0);
if ((col += maxcol) > MAXCOL) {
putchar ('\n');
col = maxcol;
}
printf (optno ? "%s[no]%s%*s" :
"%s%s%*s",
prefix, swp -> sw, maxcol - llen, "");
}
}
if (optno)
swp++; /* skip -noswitch */
}
}
putchar ('\n');
}
-----
gregg(_dot_)g(_dot_)wonderly(_at_)att(_dot_)com (AT&T Bell Laboratories, or
intgp1!gregg)