aboutsummaryrefslogtreecommitdiff
path: root/contrib/less/opttbl.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/less/opttbl.c')
-rw-r--r--contrib/less/opttbl.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/contrib/less/opttbl.c b/contrib/less/opttbl.c
index bdf8d05fc75e..bd9f97f3cef9 100644
--- a/contrib/less/opttbl.c
+++ b/contrib/less/opttbl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2002 Mark Nudelman
+ * Copyright (C) 1984-2004 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
@@ -48,10 +48,13 @@ public int show_attn; /* Hilite first unread line */
public int shift_count; /* Number of positions to shift horizontally */
public int status_col; /* Display a status column */
public int use_lessopen; /* Use the LESSOPEN filter */
+public int quit_on_intr; /* Quit on interrupt */
#if HILITE_SEARCH
public int hilite_search; /* Highlight matched search patterns? */
#endif
+public int less_is_more = 0; /* Make compatible with POSIX more */
+
/*
* Long option names.
*/
@@ -76,6 +79,7 @@ static struct optname J__optname = { "status-column", NULL };
#if USERFILE
static struct optname k_optname = { "lesskey-file", NULL };
#endif
+static struct optname K__optname = { "quit-on-intr", NULL };
static struct optname L__optname = { "no-lessopen", NULL };
static struct optname m_optname = { "long-prompt", NULL };
static struct optname n_optname = { "line-numbers", NULL };
@@ -245,6 +249,14 @@ static struct loption option[] =
{ NULL, NULL, NULL }
},
#endif
+ { 'K', &K__optname,
+ BOOL, OPT_OFF, &quit_on_intr, NULL,
+ {
+ "Interrupt (ctrl-C) returns to prompt",
+ "Interrupt (ctrl-C) exits less",
+ NULL
+ }
+ },
{ 'l', NULL,
STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_l,
{ NULL, NULL, NULL }
@@ -428,6 +440,11 @@ static struct loption option[] =
init_option()
{
register struct loption *o;
+ char *p;
+
+ p = lgetenv("LESS_IS_MORE");
+ if (p != NULL && *p != '\0')
+ less_is_more = 1;
for (o = option; o->oletter != '\0'; o++)
{
@@ -454,7 +471,7 @@ findopt(c)
{
if (o->oletter == c)
return (o);
- if ((o->otype & TRIPLE) && toupper(o->oletter) == c)
+ if ((o->otype & TRIPLE) && ASCII_TO_UPPER(o->oletter) == c)
return (o);
}
return (NULL);
@@ -467,9 +484,9 @@ findopt(c)
is_optchar(c)
char c;
{
- if (SIMPLE_IS_UPPER(c))
+ if (ASCII_IS_UPPER(c))
return 1;
- if (SIMPLE_IS_LOWER(c))
+ if (ASCII_IS_LOWER(c))
return 1;
if (c == '-')
return 1;
@@ -498,7 +515,6 @@ findopt_name(p_optname, p_oname, p_err)
int maxlen = 0;
int ambig = 0;
int exact = 0;
- char *eq;
/*
* Check all options.