commit 5c71d867b926ca74ab063744b0359086be572e88
parent 29ec796e11dfd5f8810c601efa2f71b694c5b5d3
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Mon, 9 May 2022 16:15:29 +0200
stddev, stdvar: add help option
Diffstat:
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/stddev.1 b/stddev.1
@@ -6,6 +6,7 @@
.Nd returns the standard deviation for each column
.Sh SYNOPSIS
.Nm
+.Op Fl h
.Op Fl u
.Sh DESCRIPTION
.Nm
@@ -17,6 +18,8 @@ The output is always in full double precision.
.Pp
The options are as follows:
.Bl -tag -width Ds
+.It Fl h
+Show usage information and exit.
.It Fl u
Return the uncorrected sample standard deviation instead.
.El
diff --git a/stddev.c b/stddev.c
@@ -12,7 +12,7 @@ char *argv0;
static void
usage(void)
{
- errx(1, "usage: %s [-u]\n", argv0);
+ errx(1, "usage: %s [-h] [-u]\n", argv0);
}
int
@@ -25,6 +25,9 @@ main(int argc, char *argv[])
err(2, "pledge");
ARGBEGIN {
+ case 'h':
+ usage();
+ break;
case 'u':
correction = 0;
break;
diff --git a/stdvar.1 b/stdvar.1
@@ -6,6 +6,7 @@
.Nd returns the standard variance for each column
.Sh SYNOPSIS
.Nm
+.Op Fl h
.Op Fl u
.Sh DESCRIPTION
.Nm
@@ -17,6 +18,8 @@ The output is always in full double precision.
.Pp
The options are as follows:
.Bl -tag -width Ds
+.It Fl h
+Show usage information and exit.
.It Fl u
Return the uncorrected sample standard variance instead.
.El
diff --git a/stdvar.c b/stdvar.c
@@ -12,7 +12,7 @@ char *argv0;
static void
usage(void)
{
- errx(1, "usage: %s [-u]\n", argv0);
+ errx(1, "usage: %s [-h] [-u]\n", argv0);
}
int
@@ -25,6 +25,9 @@ main(int argc, char *argv[])
err(2, "pledge");
ARGBEGIN {
+ case 'h':
+ usage();
+ break;
case 'u':
correction = 0;
break;