summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpgen <p.gen.progs@gmail.com>2016-12-02 17:00:17 +0100
committerpgen <p.gen.progs@gmail.com>2016-12-02 17:00:17 +0100
commit38a1ffb3d3499a29d996716aeaf77bda9e806295 (patch)
treea1113fe73c89f31074e86e2d47762fd87ee40f24
parentde5ee4dc720b664f34f3d189196dee53b5c45923 (diff)
Add the -? option to only display the synopsys
-rw-r--r--smenu.16
-rw-r--r--smenu.c51
2 files changed, 34 insertions, 23 deletions
diff --git a/smenu.1 b/smenu.1
index 715138c..832251d 100644
--- a/smenu.1
+++ b/smenu.1
@@ -4,7 +4,7 @@ smenu - filter that allows to interactively select a word from stdin
and outputs the selection to stdout.
.SH SYNOPSIS
.nf
-\f(CRsmenu [\fB-h\fP] [\fB-n\fP \fIlines\fP] [\fB-t\fP [\fIcols\fP]] \\
+\f(CRsmenu [\fB-h\fP|\fB-?\fP] [\fB-n\fP \fIlines\fP] [\fB-t\fP [\fIcols\fP]] \\
[\fB-k\fP] [\fB-s\fP \fIpattern\fP] [\fB-m\fP \fImessage\fP] [\fB-w\fP] \\
[\fB-d\fP] [\fB-M\fP] [\fB-c\fP] [\fB-l\fP] [\fB-r\fP] [\fB-b\fP] \\
[\fB-i\fP \fIregex\fP] [\fB-e\fP \fIregex\fP] \\
@@ -222,8 +222,8 @@ the "\fB=\fP".
.IP * 2
Everything following a \fB;\fP is ignored.
.SH OPTIONS
-.IP \fB-h\fP
-Displays a short help message and exists.
+.IP "\fB-h\fP or \fB-?\fP"
+Displays a log (\fB-h\fP) or short (\fB-?\fP) help message and exits.
.IP "\fB-n\fP \fIlines\fB"
Gives the maximum number of lines in the scrolling selection window. By
default five lines at most are displayed and the other ones, if
diff --git a/smenu.c b/smenu.c
index b9b5e32..8880136 100644
--- a/smenu.c
+++ b/smenu.c
@@ -456,21 +456,20 @@ struct ll_s
void
short_usage(void)
{
- fprintf(stderr, "Usage: smenu [-h] [-n lines] [-c] [-l] [-s pattern] ");
- fprintf(stderr, "[-m message] [-w] [-d] \\\n");
- fprintf(stderr,
- " [-M] [-t [cols]] [-k] [-r] [-b] [-i regex] [-e regex]");
- fprintf(stderr, " \\\n");
+ fprintf(stderr, "Usage: smenu [-h|-?] [-n lines] [-c] [-l] [-s pattern] ");
+ fprintf(stderr, "[-m message] [-w] \\\n");
+ fprintf(stderr, " [-d] [-M] [-t [cols]] [-k] [-r] [-b] [-i regex] ");
+ fprintf(stderr, "[-e regex] \\\n");
fprintf(stderr, " [-C [a|A|s|S|r|R|d|D]col1[-col2],[col1[-col2]]...]");
- fprintf(stderr, " \\\n");
+ fprintf(stderr, " \\\n");
fprintf(stderr, " [-R [a|A|s|S|r|R|d|D]row1[-row2],[row1[-row2]]...] ");
- fprintf(stderr, " \\\n");
+ fprintf(stderr, " \\\n");
fprintf(stderr, " [-S /regex/repl/[g][v][s][i]] ");
- fprintf(stderr, "[-I /regex/repl/[g][v][s][i]] \\\n");
+ fprintf(stderr, "[-I /regex/repl/[g][v][s][i]] \\\n");
fprintf(stderr, " [-E /regex/repl/[g][v][s][i]] ");
- fprintf(stderr, "[-A regex] [-Z regex] \\\n");
+ fprintf(stderr, "[-A regex] [-Z regex] \\\n");
fprintf(stderr, " [-1 regex [attr]] [-2 regex [attr]] ... ");
- fprintf(stderr, "[-5 regex [attr]] [-g] \\\n");
+ fprintf(stderr, "[-5 regex [attr]] [-g] \\\n");
fprintf(stderr, " [-W bytes] [-L bytes] [-V]\n");
}
@@ -542,14 +541,26 @@ usage(void)
fprintf(stderr, "-L sets the input lines separators.\n");
fprintf(stderr, "-V displays the current version and quits.\n");
fprintf(stderr, "\nNavigation keys are:\n");
- fprintf(stderr, " Left/Down/Up/Right arrows or h/j/k/l\n");
- fprintf(stderr, " Home/End\n");
- fprintf(stderr, " SPACE to search for the next match of a previously\n");
- fprintf(stderr, " entered search prefix if any, see below.\n\n");
- fprintf(stderr, "Exit key without output (do nothing): q\n");
- fprintf(stderr, "Selection key : ENTER\n");
- fprintf(stderr, "Cancel key : ESC\n");
- fprintf(stderr, "Search key : / or CTRL-F\n\n");
+ fprintf(stderr, " - Left/Down/Up/Right arrows or h/j/k/l.\n");
+ fprintf(stderr, " - Home/End.\n");
+ fprintf(stderr, " - SPACE to search for the next match of a previously\n");
+ fprintf(stderr, " entered search prefix if any, see below.\n\n");
+ fprintf(stderr, "Other useful keys are:\n");
+ fprintf(stderr,
+ " - Help key (temporary display of a short help line): "
+ "?\n");
+ fprintf(stderr,
+ " - Exit key without output (do nothing) : "
+ "q\n");
+ fprintf(stderr,
+ " - Selection key : "
+ "ENTER\n");
+ fprintf(stderr,
+ " - Cancel key : "
+ "ESC\n");
+ fprintf(stderr,
+ " - Search key : "
+ "/ or CTRL-F\n\n");
fprintf(stderr, "The search key activates a timed search mode in which\n");
fprintf(stderr, "you can enter the first letters of the searched word.\n");
fprintf(stderr, "When entering this mode you have 7s to start typing\n");
@@ -3965,7 +3976,7 @@ search_next(tst_node_t * tst, word_t * word_a, char * search_buf,
/* None of these constants are referenced in the executable portion of */
/* the code ... their sole purpose is to initialize global variables. */
/* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */
-#define BADCH (int)'?'
+#define BADCH (int)'@'
#define NEEDSEP (int)':'
#define MAYBESEP (int)'%'
#define ERRFD 2
@@ -4576,7 +4587,7 @@ main(int argc, char * argv[])
/* Command line options analysis */
/* """"""""""""""""""""""""""""" */
while ((opt = egetopt(argc, argv,
- "VhqdMbi:e:S:I:E:A:Z:1:2:3:4:5:C:R:"
+ "Vh?qdMbi:e:S:I:E:A:Z:1:2:3:4:5:C:R:"
"kclwrgn:t%m:s:W:L:1:2:3:4:"))
!= -1)
{