Skip to content

Commit

Permalink
Don't pass "-" to non-pipe LESSOPEN unless it starts with a dash.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwsw committed Apr 23, 2009
1 parent 1636601 commit b75dba6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
8 changes: 7 additions & 1 deletion NEWS.VER
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@

======================================================================

Major changes between "less" versions 424 and @@VERSION@@
Major changes between "less" versions 429 and @@VERSION@@

* Don't pass "-" to non-pipe LESSOPEN unless it starts with "-".

======================================================================

Major changes between "less" versions 424 and 429

* LESSOPEN pipe will now be used on standard input, if the LESSOPEN
environment variable begins with "|-".
Expand Down
18 changes: 9 additions & 9 deletions filename.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,17 +843,17 @@ open_altfile(filename, pf, pfd)
#else
lessopen++;
returnfd = 1;
if (*lessopen == '-') {
/*
* Lessopen preprocessor will accept "-" as a filename.
*/
lessopen++;
} else {
if (strcmp(filename, "-") == 0)
return (NULL);
}
#endif
}
if (*lessopen == '-') {
/*
* Lessopen preprocessor will accept "-" as a filename.
*/
lessopen++;
} else {
if (strcmp(filename, "-") == 0)
return (NULL);
}

len = strlen(lessopen) + strlen(filename) + 2;
cmd = (char *) ecalloc(len, sizeof(char));
Expand Down
14 changes: 11 additions & 3 deletions less.nro.VER
Original file line number Diff line number Diff line change
Expand Up @@ -1149,11 +1149,19 @@ postprocessor is "\-".
.PP
For compatibility with previous versions of
.I less,
the input pipe is not used if
the input preprocessor or pipe is not used if
.I less
is viewing standard input.
However, if the character after the vertical bar is a dash (\-),
the input pipe is used on standard input as well as other files.
However, if the first character of LESSOPEN is a dash (\-),
the input preprocessor is used on standard input as well as other files.
In this case, the dash is not considered to be part of
the preprocessor command.
If standard input is being viewed, the input preprocessor is passed
a file name consisting of a single dash.
Similarly, if the first two characters of LESSOPEN are vertical bar and dash
(|\-), the input pipe is used on standard input as well as other files.
Again, in this case the dash is not considered to be part of
the input pipe command.

.SH "NATIONAL CHARACTER SETS"
There are three types of characters in the input file:
Expand Down
4 changes: 3 additions & 1 deletion version.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,8 @@ v426 10/27/08 Fix ignaw terminal handling (thanks to Per Hedeland);
v427 3/16/09 A few Win32 fixes (thanks to Jason Hood).
v428 3/30/09 Add "|-" syntax to LESSOPEN.
v429 4/10/09 Fix search highlighting bug with underlined text.
-----------------------------------------------------------------
v430 4/22/09 Don't pass "-" to non-pipe LESSOPEN unless it starts with "-".
*/

char version[] = "429";
char version[] = "430";

0 comments on commit b75dba6

Please sign in to comment.