summaryrefslogtreecommitdiff
path: root/usr.bin/less
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-04-14 15:09:58 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-04-14 15:09:58 +0000
commitd787e9698d512a27483973f725c07429bad7d2d8 (patch)
treee4c0ccb590c0104b87f3c1060bd4d28875c78429 /usr.bin/less
parent6025c5c0ce44ad4000d159741e7c03539edcb7d5 (diff)
Make the GNU_OPTIONS define actually do something (was a no-op)
Diffstat (limited to 'usr.bin/less')
-rw-r--r--usr.bin/less/command.c8
-rw-r--r--usr.bin/less/option.c7
-rw-r--r--usr.bin/less/opttbl.c57
3 files changed, 71 insertions, 1 deletions
diff --git a/usr.bin/less/command.c b/usr.bin/less/command.c
index 1aea3386561..7caac511dc9 100644
--- a/usr.bin/less/command.c
+++ b/usr.bin/less/command.c
@@ -159,8 +159,10 @@ mca_opt_toggle()
mca = A_OPT_TOGGLE;
clear_cmd();
cmd_putstr(dash);
+#if GNU_OPTIONS
if (optgetname)
cmd_putstr(dash);
+#endif
if (no_prompt)
cmd_putstr("(P)");
switch (flag)
@@ -320,6 +322,7 @@ mca_char(c)
if (optchar == '\0' && len_cmdbuf() == 0)
{
flag = (optflag & ~OPT_NO_PROMPT);
+#if GNU_OPTIONS
if (flag == OPT_NO_TOGGLE)
{
switch (c)
@@ -331,6 +334,7 @@ mca_char(c)
return (MCA_MORE);
}
} else
+#endif
{
switch (c)
{
@@ -350,14 +354,17 @@ mca_char(c)
optflag ^= OPT_NO_PROMPT;
mca_opt_toggle();
return (MCA_MORE);
+#if GNU_OPTIONS
case '-':
/* "--" = long option name. */
optgetname = TRUE;
mca_opt_toggle();
return (MCA_MORE);
+#endif
}
}
}
+#if GNU_OPTIONS
if (optgetname)
{
/*
@@ -432,6 +439,7 @@ mca_char(c)
return (MCA_MORE);
}
} else
+#endif
{
if (c == erase_char || c == kill_char)
break;
diff --git a/usr.bin/less/option.c b/usr.bin/less/option.c
index a56a56fb53d..2ff34680114 100644
--- a/usr.bin/less/option.c
+++ b/usr.bin/less/option.c
@@ -90,6 +90,7 @@ scan_option(s)
case END_OPTION_STRING:
continue;
case '-':
+#if GNU_OPTIONS
/*
* "--" indicates an option name instead of a letter.
*/
@@ -98,6 +99,7 @@ scan_option(s)
optname = ++s;
break;
}
+#endif
/*
* "-+" means set these options back to their defaults.
* (They may have been set otherwise by previous
@@ -144,7 +146,9 @@ scan_option(s)
printopt = propt(optc);
lc = SIMPLE_IS_LOWER(optc);
o = findopt(optc);
- } else
+ }
+#if GNU_OPTIONS
+ else
{
printopt = optname;
lc = SIMPLE_IS_LOWER(optname[0]);
@@ -181,6 +185,7 @@ scan_option(s)
o = NULL;
}
}
+#endif
if (o == NULL)
{
parg.p_string = printopt;
diff --git a/usr.bin/less/opttbl.c b/usr.bin/less/opttbl.c
index f3f45c8b014..71471b81e3b 100644
--- a/usr.bin/less/opttbl.c
+++ b/usr.bin/less/opttbl.c
@@ -57,6 +57,7 @@ public int hilite_search; /* Highlight matched search patterns? */
/*
* Long option names.
*/
+#if GNU_OPTIONS
static struct optname a_optname = { "search-skip-screen", NULL };
static struct optname b_optname = { "buffers", NULL };
static struct optname B__optname = { "auto-buffers", NULL };
@@ -108,6 +109,60 @@ static struct optname tilde_optname = { "tilde", NULL };
static struct optname query_optname = { "help", NULL };
static struct optname pound_optname = { "shift", NULL };
static struct optname keypad_optname = { "no-keypad", NULL };
+#else
+static struct optname fake_optname = { "fake", NULL };
+#define a_optname fake_optname
+#define b_optname fake_optname
+#define B__optname fake_optname
+#define c_optname fake_optname
+#define d_optname fake_optname
+#if MSDOS_COMPILER
+#define D__optname fake_optname
+#endif
+#define e_optname fake_optname
+#define f_optname fake_optname
+#define F__optname fake_optname
+#if HILITE_SEARCH
+#define g_optname fake_optname
+#endif
+#define h_optname fake_optname
+#define i_optname fake_optname
+#define j_optname fake_optname
+#define J__optname fake_optname
+#if USERFILE
+#define k_optname fake_optname
+#endif
+#define L__optname fake_optname
+#define m_optname fake_optname
+#define n_optname fake_optname
+#if LOGFILE
+#define o_optname fake_optname
+#define O__optname fake_optname
+#endif
+#define p_optname fake_optname
+#define P__optname fake_optname
+#define q2_optname fake_optname
+#define q_optname fake_optname
+#define r_optname fake_optname
+#define s_optname fake_optname
+#define S__optname fake_optname
+#if TAGS
+#define t_optname fake_optname
+#define T__optname fake_optname
+#endif
+#define u_optname fake_optname
+#define V__optname fake_optname
+#define w_optname fake_optname
+#define x_optname fake_optname
+#define X__optname fake_optname
+#define y_optname fake_optname
+#define z_optname fake_optname
+#define quote_optname fake_optname
+#define tilde_optname fake_optname
+#define query_optname fake_optname
+#define pound_optname fake_optname
+#define keypad_optname fake_optname
+#endif
/*
@@ -502,6 +557,7 @@ is_optchar(c)
return 0;
}
+#if GNU_OPTIONS
/*
* Find an option in the option table, given its option name.
* p_optname is the (possibly partial) name to look for, and
@@ -588,3 +644,4 @@ findopt_name(p_optname, p_oname, p_err)
*p_oname = maxoname == NULL ? NULL : maxoname->oname;
return (maxo);
}
+#endif