From: schwarze Date: Sat, 10 May 2014 16:45:23 +0000 (+0000) Subject: Give more(1) its own help file, shorter than the one for less(1). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3f5dee8e29002edc0d7fa96a95316d4b29ab8379;p=openbsd Give more(1) its own help file, shorter than the one for less(1). The helpfile itself was prepared by jmc@, the glue by me. OK millert@ jmc@ --- diff --git a/usr.bin/less/command.c b/usr.bin/less/command.c index 3666d56ecff..ed30367066b 100644 --- a/usr.bin/less/command.c +++ b/usr.bin/less/command.c @@ -1492,7 +1492,7 @@ commands() cmd_exec(); save_hshift = hshift; hshift = 0; - (void) edit(HELPFILE); + (void) edit(helpfile()); #endif /* !SMALL */ break; diff --git a/usr.bin/less/edit.c b/usr.bin/less/edit.c index e2b6eeaa381..28720fdef75 100644 --- a/usr.bin/less/edit.c +++ b/usr.bin/less/edit.c @@ -283,7 +283,7 @@ edit_ifile(ifile) chflags = 0; #if !SMALL - if (strcmp(open_filename, HELPFILE) == 0) + if (strcmp(open_filename, helpfile()) == 0) chflags |= CH_HELPFILE; #endif /* !SMALL */ if (alt_pipe != NULL) diff --git a/usr.bin/less/funcs.h b/usr.bin/less/funcs.h index 84b3bac7815..0e138ea4604 100644 --- a/usr.bin/less/funcs.h +++ b/usr.bin/less/funcs.h @@ -290,3 +290,4 @@ public void close_getchr (); public int getchr (); public void (*lsignal()) (); + public char * helpfile (); diff --git a/usr.bin/less/less/Makefile b/usr.bin/less/less/Makefile index 37bb8e022e3..4788428a415 100644 --- a/usr.bin/less/less/Makefile +++ b/usr.bin/less/less/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2014/04/26 11:53:05 millert Exp $ +# $OpenBSD: Makefile,v 1.4 2014/05/10 16:45:23 schwarze Exp $ PROG= less SRCS= main.c screen.c brac.c ch.c charset.c cmdbuf.c command.c cvt.c \ @@ -14,14 +14,18 @@ LINKS= ${BINDIR}/less ${BINDIR}/more MAN= less.1 more.1 -HELPFILE=${SHAREDIR}/misc/more.help +HELPDIR=${SHAREDIR}/misc -CFLAGS+=-DBINDIR=\"${BINDIR}\" -DSYSDIR=\"/etc\" -DHELPFILE=\"${HELPFILE}\" +CFLAGS+=-DBINDIR=\"${BINDIR}\" -DSYSDIR=\"/etc\" -DHELPDIR=\"${HELPDIR}\" CDIAGFLAGS+=-Wall -W beforeinstall: ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \ - -m ${SHAREMODE} ${.CURDIR}/../less.hlp ${DESTDIR}${HELPFILE} + -m ${SHAREMODE} ${.CURDIR}/../less.hlp \ + ${DESTDIR}${HELPDIR}/less.help + ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \ + -m ${SHAREMODE} ${.CURDIR}/../more.hlp \ + ${DESTDIR}${HELPDIR}/more.help .include diff --git a/usr.bin/less/main.c b/usr.bin/less/main.c index aa222e94110..3b63194f689 100644 --- a/usr.bin/less/main.c +++ b/usr.bin/less/main.c @@ -184,7 +184,7 @@ main(argc, argv) ifile = NULL_IFILE; #if !SMALL if (dohelp) - ifile = get_ifile(HELPFILE, ifile); + ifile = get_ifile(helpfile(), ifile); #endif /* !SMALL */ while (argc-- > 0) { @@ -420,3 +420,9 @@ quit(status) close_getchr(); exit(status); } + + public char * +helpfile(void) +{ + return (less_is_more ? HELPDIR "/more.help" : HELPDIR "/less.help"); +} diff --git a/usr.bin/less/more.hlp b/usr.bin/less/more.hlp new file mode 100644 index 00000000000..30eb4d02cae --- /dev/null +++ b/usr.bin/less/more.hlp @@ -0,0 +1,75 @@ + + SSUUMMMMAARRYY OOFF CCOOMMMMAANNDDSS + + Commands marked with * may be preceded by a number, _N. + Notes in parentheses indicate the behavior if _N is given. + A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K. + + h Display this help. + q :q ZZ Exit. + --------------------------------------------------------------------------- + + MMOOVVIINNGG + + j CR * Forward one line (or _N lines). + k * Backward one line (or _N lines). + f ^F SPACE * Forward one window (or _N lines). + b ^B * Backward one window (or _N lines). + d ^D * Forward one half-window (and set half-window to _N). + u ^U * Backward one half-window (and set half-window to _N). + r ^L Repaint screen. + R Repaint screen, discarding buffered input. + :t Go to supplied tag. + --------------------------------------------------- + Default "window" is the screen height. + Default "half-window" is half of the screen height. + --------------------------------------------------------------------------- + + SSEEAARRCCHHIINNGG + + /_p_a_t_t_e_r_n * Search forward for (_N-th) matching line. + ?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line. + n * Repeat previous search (for _N-th occurrence). + N Repeat previous search in reverse direction. + --------------------------------------------------- + A search pattern may be preceded by one or more of: + ! Search for NON-matching lines. + --------------------------------------------------------------------------- + + JJUUMMPPIINNGG + + g * Go to first line in file (or line _N). + G * Go to last line in file (or line _N). + --------------------------------------------------- + + m_<_l_e_t_t_e_r_> Mark the current position with . + '_<_l_e_t_t_e_r_> Go to a previously marked position. + '' Go to the previous position. + --------------------------------------------------- + A mark is any lower-case letter. + --------------------------------------------------------------------------- + + CCHHAANNGGIINNGG FFIILLEESS + + :e [_f_i_l_e] Examine a new file. + :n * Examine the (_N-th) next file from the command line. + :p * Examine the (_N-th) previous file from the command line. + = ^G Print current file name. + --------------------------------------------------------------------------- + + MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS + + v Edit the current file with $VISUAL or vi(1). + --------------------------------------------------------------------------- + + OOPPTTIIOONNSS + + -c Repaint by clearing rather than scrolling. + -e Quit at end of file. + -i Ignore case in searches. + -n _n_u_m_b_e_r Page number of lines per screenful. + -p _c_o_m_m_a_n_d Execute the specified commands. + -s Squeeze multiple blank lines. + -t _t_a_g Examine the file containing tag.. + -u Change handling of backspaces. +