Give more(1) its own help file, shorter than the one for less(1).
authorschwarze <schwarze@openbsd.org>
Sat, 10 May 2014 16:45:23 +0000 (16:45 +0000)
committerschwarze <schwarze@openbsd.org>
Sat, 10 May 2014 16:45:23 +0000 (16:45 +0000)
The helpfile itself was prepared by jmc@, the glue by me.
OK millert@ jmc@

usr.bin/less/command.c
usr.bin/less/edit.c
usr.bin/less/funcs.h
usr.bin/less/less/Makefile
usr.bin/less/main.c
usr.bin/less/more.hlp [new file with mode: 0644]

index 3666d56..ed30367 100644 (file)
@@ -1492,7 +1492,7 @@ commands()
                        cmd_exec();
                        save_hshift = hshift;
                        hshift = 0;
-                       (void) edit(HELPFILE);
+                       (void) edit(helpfile());
 #endif /* !SMALL */
                        break;
 
index e2b6eea..28720fd 100644 (file)
@@ -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)
index 84b3bac..0e138ea 100644 (file)
        public void close_getchr ();
        public int getchr ();
        public void (*lsignal()) ();
+       public char * helpfile ();
index 37bb8e0..4788428 100644 (file)
@@ -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 <bsd.prog.mk>
index aa222e9..3b63194 100644 (file)
@@ -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 (file)
index 0000000..30eb4d0
--- /dev/null
@@ -0,0 +1,75 @@
+
+                     S\bSU\bUM\bMM\bMA\bAR\bRY\bY O\bOF\bF C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
+
+      Commands marked with * may be preceded by a number, _\bN.
+      Notes in parentheses indicate the behavior if _\bN 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.
+ ---------------------------------------------------------------------------
+
+                           M\bMO\bOV\bVI\bIN\bNG\bG
+
+  j  CR             *  Forward  one line   (or _\bN lines).
+  k                 *  Backward one line   (or _\bN lines).
+  f  ^F  SPACE      *  Forward  one window (or _\bN lines).
+  b  ^B             *  Backward one window (or _\bN lines).
+  d  ^D             *  Forward  one half-window (and set half-window to _\bN).
+  u  ^U             *  Backward one half-window (and set half-window to _\bN).
+  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.
+ ---------------------------------------------------------------------------
+
+                          S\bSE\bEA\bAR\bRC\bCH\bHI\bIN\bNG\bG
+
+  /_\bp_\ba_\bt_\bt_\be_\br_\bn          *  Search forward for (_\bN-th) matching line.
+  ?_\bp_\ba_\bt_\bt_\be_\br_\bn          *  Search backward for (_\bN-th) matching line.
+  n                 *  Repeat previous search (for _\bN-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.
+ ---------------------------------------------------------------------------
+
+                           J\bJU\bUM\bMP\bPI\bIN\bNG\bG
+
+  g                 *  Go to first line in file (or line _\bN).
+  G                 *  Go to last line in file (or line _\bN).
+        ---------------------------------------------------
+
+  m_\b<_\bl_\be_\bt_\bt_\be_\br_\b>            Mark the current position with <letter>.
+  '_\b<_\bl_\be_\bt_\bt_\be_\br_\b>            Go to a previously marked position.
+  ''                   Go to the previous position.
+        ---------------------------------------------------
+        A mark is any lower-case letter.
+ ---------------------------------------------------------------------------
+
+                        C\bCH\bHA\bAN\bNG\bGI\bIN\bNG\bG F\bFI\bIL\bLE\bES\bS
+
+  :e [_\bf_\bi_\bl_\be]            Examine a new file.
+  :n                *  Examine the (_\bN-th) next file from the command line.
+  :p                *  Examine the (_\bN-th) previous file from the command line.
+  =  ^G                Print current file name.
+ ---------------------------------------------------------------------------
+
+                    M\bMI\bIS\bSC\bCE\bEL\bLL\bLA\bAN\bNE\bEO\bOU\bUS\bS C\bCO\bOM\bMM\bMA\bAN\bND\bDS\bS
+
+  v                    Edit the current file with $VISUAL or vi(1).
+ ---------------------------------------------------------------------------
+
+                           O\bOP\bPT\bTI\bIO\bON\bNS\bS
+
+  -c                   Repaint by clearing rather than scrolling.
+  -e                   Quit at end of file.
+  -i                   Ignore case in searches.
+  -n _\bn_\bu_\bm_\bb_\be_\br            Page number of lines per screenful.
+  -p _\bc_\bo_\bm_\bm_\ba_\bn_\bd           Execute the specified commands.
+  -s                   Squeeze multiple blank lines.
+  -t _\bt_\ba_\bg               Examine the file containing tag..
+  -u                   Change handling of backspaces.
+