Skip to content

Commit

Permalink
Allow old sysless file for backwards compatibility.
Browse files Browse the repository at this point in the history
Add --no-keypad option.
Add latin9 & charset aliases.
  • Loading branch information
gwsw committed Dec 6, 2001
1 parent 79cb0b8 commit 6035ed5
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SHELL = /bin/sh
# This rule allows us to supply the necessary -D options
# in addition to whatever the user asks for.
.c.o:
${CC} -I. ${CFLAGS_COMPILE_ONLY} -DSYSDIR=\"${sysconfdir}\" ${CPPFLAGS} ${CFLAGS} $<
${CC} -I. ${CFLAGS_COMPILE_ONLY} -DBINDIR=\"${bindir}\" -DSYSDIR=\"${sysconfdir}\" ${CPPFLAGS} ${CFLAGS} $<

OBJ = main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \
command.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \
Expand Down
7 changes: 6 additions & 1 deletion NEWS.VER
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@

* Status column (enabled with -J) now shows search results.

* System-wide lesskey file now defaults to etc directory instead of bin.
* System-wide lesskey file now defaults to sysless in etc directory
instead of .sysless in bin directory.
Use "configure --sysconfdir=..." to change it.
(For backwards compatibility, .sysless in bin is still recognized.)

* -X no longer disables keypad initialization.
New option --no-keypad disables keypad initialization.

* Windows version sets window title.

Expand Down
21 changes: 20 additions & 1 deletion charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,20 @@ struct charset {
{ "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" },
{ "iso8859", NULL, "8bcccbcc18b95.33b." },
{ "koi8-r", NULL, "8bcccbcc18b95.b128." },
{ "latin1", NULL, "8bcccbcc18b95.33b." },
{ "next", NULL, "8bcccbcc18b95.bb125.bb" },
{ "utf-8", &utf_mode, "8bcccbcc18b." },
{ NULL, NULL, NULL }
};

struct cs_alias {
char *name;
char *oname;
} cs_aliases[] = {
{ "latin1", "iso8859" },
{ "latin9", "iso8859" },
{ NULL, NULL }
};

#define IS_BINARY_CHAR 01
#define IS_CONTROL_CHAR 02

Expand Down Expand Up @@ -127,10 +135,21 @@ icharset(name)
register char *name;
{
register struct charset *p;
register struct cs_alias *a;

if (name == NULL || *name == '\0')
return (0);

/* First see if the name is an alias. */
for (a = cs_aliases; a->name != NULL; a++)
{
if (strcmp(name, a->name) == 0)
{
name = a->oname;
break;
}
}

for (p = charsets; p->name != NULL; p++)
{
if (strcmp(name, p->name) == 0)
Expand Down
7 changes: 6 additions & 1 deletion decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ init_cmds()
add_fcmd_table((char*)cmdtable, sizeof(cmdtable));
add_ecmd_table((char*)edittable, sizeof(edittable));
#if USERFILE
/*
* For backwards compatibility,
* try to add tables in the OLD system lesskey file.
*/
add_hometable(NULL, BINDIR "/.sysless", 1);
/*
* Try to add the tables in the system lesskey file.
*/
Expand Down Expand Up @@ -708,7 +713,7 @@ add_hometable(envname, def_filename, sysvar)
char *filename;
PARG parg;

if ((filename = lgetenv(envname)) != NULL)
if (envname != NULL && (filename = lgetenv(envname)) != NULL)
filename = save(filename);
else if (sysvar)
filename = save(def_filename);
Expand Down
11 changes: 9 additions & 2 deletions less.nro.VER
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,11 @@ Disables sending the termcap initialization and deinitialization strings
to the terminal.
This is sometimes desirable if the deinitialization string does
something unnecessary, like clearing the screen.
.IP "--no-keypad"
Disables sending the keypad initialization and deinitialization strings
to the terminal.
This is sometimes useful if the keypad strings make the numeric
keypad behave in an undesirable manner.
.IP "-y\fIn\fP or --max-forw-scroll=\fIn\fP"
Specifies a maximum number of lines to scroll forward.
If it is necessary to scroll forward more than \fIn\fP lines,
Expand Down Expand Up @@ -920,11 +925,11 @@ uses that as the name of the system-wide lesskey file.
Otherwise,
.I less
looks in a standard place for the system-wide lesskey file:
On Unix systems, the system-wide lesskey file is /usr/local/etc/.sysless.
On Unix systems, the system-wide lesskey file is /usr/local/etc/sysless.
(However, if
.I less
was built with a different sysconf directory than /usr/local/etc,
that directory is where the .sysless file is found.)
that directory is where the sysless file is found.)
On MS-DOS and Windows systems, the system-wide lesskey file is c:\\_sysless.
On OS/2 systems, the system-wide lesskey file is c:\\sysless.ini.

Expand Down Expand Up @@ -1080,6 +1085,8 @@ This is the same as ASCII, except characters between 160 and 255 are
treated as normal characters.
.IP latin1
Same as iso8859.
.IP latin9
Same as iso8859.
.IP dos
Selects a character set appropriate for MS-DOS.
.IP ebcdic
Expand Down
8 changes: 8 additions & 0 deletions opttbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public int swindow; /* Size of scrolling window */
public int jump_sline; /* Screen line of "jump target" */
public int chopline; /* Truncate displayed lines at screen width */
public int no_init; /* Disable sending ti/te termcap strings */
public int no_keypad; /* Disable sending ks/ke termcap strings */
public int twiddle; /* Show tildes after EOF */
public int show_attn; /* Hilite first unread line */
public int shift_count; /* Number of positions to shift horizontally */
Expand Down Expand Up @@ -102,6 +103,7 @@ static struct optname quote_optname = { "quotes", NULL };
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 };


/*
Expand Down Expand Up @@ -330,6 +332,12 @@ static struct option option[] =
"Horizontal shift %d positions",
NULL
},
{ '.', &keypad_optname,
BOOL|NO_TOGGLE, OPT_OFF, &no_keypad, NULL,
"Use keypad mode",
"Don't use keypad mode",
NULL
},
{ '\0', NULL, NOVAR, 0, NULL, NULL, NULL, NULL, NULL }
};

Expand Down
37 changes: 13 additions & 24 deletions screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ extern int quiet; /* If VERY_QUIET, use visual bell for bell */
extern int no_back_scroll;
extern int swindow;
extern int no_init;
extern int no_keypad;
extern int sigs;
extern int wscroll;
extern int screen_trashed;
Expand Down Expand Up @@ -1429,21 +1430,15 @@ win32_deinit_term()
public void
init()
{
if (no_init)
{
#if MSDOS_COMPILER==WIN32C
/* no_init or not, never trash win32 console colors. */
initcolor();
flush();
#endif
return;
}
#if !MSDOS_COMPILER
tputs(sc_init, sc_height, putchr);
tputs(sc_s_keypad, sc_height, putchr);
if (!no_init)
tputs(sc_init, sc_height, putchr);
if (!no_keypad)
tputs(sc_s_keypad, sc_height, putchr);
#else
#if MSDOS_COMPILER==WIN32C
win32_init_term();
if (!no_init)
win32_init_term();
#endif
initcolor();
flush();
Expand All @@ -1457,25 +1452,19 @@ init()
public void
deinit()
{
if (no_init)
{
#if MSDOS_COMPILER==WIN32C
/* no_init or not, never trash win32 console colors. */
SETCOLORS(sy_fg_color, sy_bg_color);
#endif
return;
}

if (!init_done)
return;
#if !MSDOS_COMPILER
tputs(sc_e_keypad, sc_height, putchr);
tputs(sc_deinit, sc_height, putchr);
if (!no_keypad)
tputs(sc_e_keypad, sc_height, putchr);
if (!no_init)
tputs(sc_deinit, sc_height, putchr);
#else
/* Restore system colors. */
SETCOLORS(sy_fg_color, sy_bg_color);
#if MSDOS_COMPILER==WIN32C
win32_deinit_term();
if (!no_init)
win32_deinit_term();
#else
/* Need clreol to make SETCOLORS take effect. */
clreol();
Expand Down
3 changes: 2 additions & 1 deletion version.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,8 @@ v361 12/4/01 Add IBM-1047 charset & EBCDIC fixes (thanks to Thomas Dorner).
Fix 32 bit dependencies (thanks to Paul Eggert).
Fix UTF-8 overstriking (thanks to Robert Brady).
v362 12/4/01 Make status column show search targets.
v363 12/6/01 Add --no-keypad option.
*/

char version[] = "361";
char version[] = "363";

0 comments on commit 6035ed5

Please sign in to comment.