adding feature to LESS V5
pwolfe at kailand.KAI.COM
pwolfe at kailand.KAI.COM
Sun Sep 25 05:58:00 AEST 1988
Okay, I'll try again.
Version 73 of less had a feature that was eliminated in the recent posting.
The "e" option still quits the second time you reach end of file, but now if
a single file being displayed that is less than one screen length, less
doesn't exit immediately, but displays it's prompt instead.
I prefered the old action (which was similar to the way "more" works), but I
found out from the original author that workstation users have problems with
this action causing windows to disappear as soon as they appear, so I made it
a separate option, -f.
This patch does not fix any bugs, so it is not really neccessary for you to
install it, but on the other hand, it shouldn't hurt either.
Patrick J. Wolfe (pwolfe at kai.com, uunet!kailand!pwolfe)
System Manager, Kuck and Associates Inc.
*** /tmp/,RCSt1006768 Sat Sep 24 13:23:42 1988
--- less.nro Sat Sep 24 13:20:55 1988
***************
*** 291,296
the second time it reaches end-of-file.
.IP -E
The -E flag causes less to exit the first time it reaches end-of-file.
.IP -h
Normally,
.I less
--- 291,301 -----
the second time it reaches end-of-file.
.IP -E
The -E flag causes less to exit the first time it reaches end-of-file.
+ .IP -f
+ When used with the -e option and the display is shorter than one screen,
+ less will exit immediately when it reaches end-of-file.
+ Workstations where less creates a window should NOT use this, or
+ the window will disappear immediately.
.IP -h
Normally,
.I less
*** /tmp/,RCSt1006789 Sat Sep 24 13:24:12 1988
--- option.c Sat Sep 24 12:43:17 1988
***************
*** 33,38
public int bs_mode; /* How to process backspaces */
public int know_dumb; /* Don't complain about dumb terminals */
public int quit_at_eof; /* Quit after hitting end of file twice */
public int squeeze; /* Squeeze multiple blank lines into one */
public int tabstop; /* Tab settings */
public int back_scroll; /* Repaint screen on backwards movement */
--- 33,39 -----
public int bs_mode; /* How to process backspaces */
public int know_dumb; /* Don't complain about dumb terminals */
public int quit_at_eof; /* Quit after hitting end of file twice */
+ public int exit_if_short; /* Quit immediately if file is short */
public int squeeze; /* Squeeze multiple blank lines into one */
public int tabstop; /* Tab settings */
public int back_scroll; /* Repaint screen on backwards movement */
***************
*** 102,107
{ "Don't quit at end-of-file",
"Quit at end-of-file",
"Quit immediately at end-of-file"
}
},
{ 'h', NUMBER, -1, &back_scroll,
--- 103,114 -----
{ "Don't quit at end-of-file",
"Quit at end-of-file",
"Quit immediately at end-of-file"
+ }
+ },
+ { 'f', BOOL, 0, &exit_if_short,
+ { "Don't quit at end-of-file if file is short",
+ "Quit immediately at end-of-file if file is short",
+ NULL
}
},
{ 'h', NUMBER, -1, &back_scroll,
*** /tmp/,RCSt1007557 Sat Sep 24 14:54:06 1988
--- prim.c Sat Sep 24 14:53:44 1988
***************
*** 21,26
extern int linenums;
extern int plusoption;
extern char *line;
extern char *first_cmd;
#if TAGS
extern int tagoption;
--- 21,28 -----
extern int linenums;
extern int plusoption;
extern char *line;
+ extern int ac;
+ extern int exit_if_short;
extern char *first_cmd;
#if TAGS
extern int tagoption;
***************
*** 198,203
eof_bell();
else if (do_repaint)
repaint();
first_time = 0;
(void) currline(BOTTOM);
}
--- 200,208 -----
eof_bell();
else if (do_repaint)
repaint();
+ if (exit_if_short && first_time && hit_eof && quit_at_eof && ac <= 1) {
+ quit ();
+ }
first_time = 0;
(void) currline(BOTTOM);
}
More information about the Comp.sources.bugs
mailing list