aboutsummaryrefslogtreecommitdiff
path: root/contrib/less/optfunc.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/less/optfunc.c')
-rw-r--r--contrib/less/optfunc.c61
1 files changed, 60 insertions, 1 deletions
diff --git a/contrib/less/optfunc.c b/contrib/less/optfunc.c
index e3fb861d4271..524551c26951 100644
--- a/contrib/less/optfunc.c
+++ b/contrib/less/optfunc.c
@@ -42,6 +42,7 @@ extern char closequote;
extern char *prproto[];
extern char *eqproto;
extern char *hproto;
+extern char *wproto;
extern IFILE curr_ifile;
extern char version[];
#if LOGFILE
@@ -291,6 +292,7 @@ opt__P(type, s)
case 'M': proto = &prproto[PR_LONG]; s++; break;
case '=': proto = &eqproto; s++; break;
case 'h': proto = &hproto; s++; break;
+ case 'w': proto = &wproto; s++; break;
default: proto = &prproto[PR_SHORT]; break;
}
free(*proto);
@@ -368,10 +370,11 @@ opt__V(type, s)
any_display = 1;
putstr("less ");
putstr(version);
- putstr("\nCopyright (C) 2000 Mark Nudelman\n\n");
+ putstr("\nCopyright (C) 2001 Mark Nudelman\n\n");
putstr("less comes with NO WARRANTY, to the extent permitted by law.\n");
putstr("For information about the terms of redistribution,\n");
putstr("see the file named README in the less distribution.\n");
+ putstr("Homepage: http://www.greenwoodsoftware.com/less\n");
quit(QUIT_OK);
break;
}
@@ -461,6 +464,62 @@ opt_D(type, s)
#endif
/*
+ * Handler for the -x option.
+ */
+ public void
+opt_x(type, s)
+ int type;
+ register char *s;
+{
+ extern int tabstops[];
+ extern int ntabstops;
+ extern int tabdefault;
+ char msg[60+(4*TABSTOP_MAX)];
+ int i;
+ PARG p;
+
+ switch (type)
+ {
+ case INIT:
+ case TOGGLE:
+ /* Start at 1 because tabstops[0] is always zero. */
+ for (i = 1; i < TABSTOP_MAX; )
+ {
+ int n = 0;
+ while (*s >= '0' && *s <= '9')
+ n = (10 * n) + (*s++ - '0');
+ if (n > tabstops[i-1])
+ tabstops[i++] = n;
+ if (*s++ != ',')
+ break;
+ }
+ if (i < 2)
+ return;
+ ntabstops = i;
+ tabdefault = tabstops[ntabstops-1] - tabstops[ntabstops-2];
+ break;
+ case QUERY:
+ strcpy(msg, "Tab stops ");
+ if (ntabstops > 2)
+ {
+ for (i = 1; i < ntabstops; i++)
+ {
+ if (i > 1)
+ strcat(msg, ",");
+ sprintf(msg+strlen(msg), "%d", tabstops[i]);
+ }
+ sprintf(msg+strlen(msg), " and then ");
+ }
+ sprintf(msg+strlen(msg), "every %d spaces",
+ tabdefault);
+ p.p_string = msg;
+ error("%s", &p);
+ break;
+ }
+}
+
+
+/*
* Handler for the -" option.
*/
public void