commit 7a2762d0c1e59cd9d6a69d882931befeb4af25b5
Author:     Jan Klemkow <[email protected]>
AuthorDate: Tue Apr 14 21:15:19 2020 +0200
Commit:     Jan Klemkow <[email protected]>
CommitDate: Tue Apr 14 21:15:19 2020 +0200

    add option -h for usage

diff --git a/scroll.1 b/scroll.1
index 2b892ec..b5524ab 100644
--- a/scroll.1
+++ b/scroll.1
@@ -21,7 +21,7 @@
 .Nd scrollback buffer
 .Sh SYNOPSIS
 .Nm
-.Op Fl M
+.Op Fl Mh
 .Op Fl m Ar size
 .Op program Op arg ...
 .Sh DESCRIPTION
@@ -38,6 +38,9 @@ starts the users default shell.
 .Pp
 The options are as follows:
 .Bl -tag -width Ds
+.It Fl h
+Shows usage of
+.Nm .
 .It Fl M
 Set memory limit used for scrollbackbuffer to maximum.
 .It Fl m Ar size
diff --git a/scroll.c b/scroll.c
index 1d65cd0..e9b267d 100644
--- a/scroll.c
+++ b/scroll.c
@@ -370,7 +370,7 @@ jumpdown(char *buf, size_t size)
 
 void
 usage(void) {
-       die("usage: scroll [-M] [-m mem] [program]");
+       die("usage: scroll [-Mh] [-m mem] [program]");
 }
 
 int
@@ -382,7 +382,7 @@ main(int argc, char *argv[])
        if (getrlimit(RLIMIT_DATA, &rlimit) == -1)
                die("getrlimit");
 
-       while ((ch = getopt(argc, argv, "Mm:")) != -1) {
+       while ((ch = getopt(argc, argv, "Mm:h")) != -1) {
                switch (ch) {
                case 'M':
                        rlimit.rlim_cur = rlimit.rlim_max;
@@ -392,6 +392,7 @@ main(int argc, char *argv[])
                        if (errno != 0)
                                die("strtoull: %s", optarg);
                        break;
+               case 'h':
                default:
                        usage();
                }

Reply via email to