diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2014-04-09 20:50:37 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2014-04-09 20:50:37 +0000 |
commit | 7fe20220626c1c4fdde7fdcfbdca140a646a787c (patch) | |
tree | 22da7442b60b845d8523fb5e1b02d585bd72cd1e | |
parent | 268e204aee2ba2549c76a21e2ff0f08c63e7a6e6 (diff) |
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.c | 18 |
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; } } |