commit 7a2762d0c1e59cd9d6a69d882931befeb4af25b5
parent c63796d9bdb510b9486b684d93bdd2658ac3abd3
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date: Tue, 14 Apr 2020 21:15:19 +0200
add option -h for usage
Diffstat:
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git 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
@@ -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();
}