summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2014-04-09 20:50:36 +0000
committermillert <millert@openbsd.org>2014-04-09 20:50:36 +0000
commit6727ee955ecadd8c13bc374b6bf66079bd70a2e3 (patch)
treefaaf7db3aaa5cd94c79955fce542ebbb3d453e6d
parentRevert 1.93, it breaks permission checks. (diff)
downloadwireguard-openbsd-6727ee955ecadd8c13bc374b6bf66079bd70a2e3.tar.xz
wireguard-openbsd-6727ee955ecadd8c13bc374b6bf66079bd70a2e3.zip
In "more" mode, POSIX says the command specified by the -p option
should apply to every edited file, not just the first one. It is equivalent to less's ++ option. Patch sent to upstream. OK shadchin@
-rw-r--r--usr.bin/less/optfunc.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.bin/less/optfunc.c b/usr.bin/less/optfunc.c
index de34bcf27fa..72821553cdb 100644
--- a/usr.bin/less/optfunc.c
+++ b/usr.bin/less/optfunc.c
@@ -67,6 +67,7 @@ extern int ul_fg_color, ul_bg_color;
extern int so_fg_color, so_bg_color;
extern int bl_fg_color, bl_bg_color;
#endif
+extern char *every_first_cmd;
#if LOGFILE
@@ -366,14 +367,17 @@ opt_p(type, s)
* {{ This won't work if the "/" command is
* changed or invalidated by a .lesskey file. }}
*/
- plusoption = TRUE;
- ungetsc(s);
- /*
- * In "more" mode, the -p argument is a command,
- * not a search string, so we don't need a slash.
- */
- if (!less_is_more)
+ if (less_is_more) {
+ /*
+ * In "more" mode, the -p argument is a command,
+ * not a search string, run for each file.
+ */
+ every_first_cmd = save(s);
+ } else {
+ plusoption = TRUE;
+ ungetsc(s);
ungetsc("/");
+ }
break;
}
}