tstddev, stdvar: add help option - numtools - perform numerical operations on vectors and matrices in unix pipes
(HTM) git clone git://src.adamsgaard.dk/numtools
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 5c71d867b926ca74ab063744b0359086be572e88
(DIR) parent 29ec796e11dfd5f8810c601efa2f71b694c5b5d3
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Mon, 9 May 2022 16:15:29 +0200
stddev, stdvar: add help option
Diffstat:
M stddev.1 | 3 +++
M stddev.c | 5 ++++-
M stdvar.1 | 3 +++
M stdvar.c | 5 ++++-
4 files changed, 14 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/stddev.1 b/stddev.1
t@@ -6,6 +6,7 @@
.Nd returns the standard deviation for each column
.Sh SYNOPSIS
.Nm
+.Op Fl h
.Op Fl u
.Sh DESCRIPTION
.Nm
t@@ -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
(DIR) diff --git a/stddev.c b/stddev.c
t@@ -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
t@@ -25,6 +25,9 @@ main(int argc, char *argv[])
err(2, "pledge");
ARGBEGIN {
+ case 'h':
+ usage();
+ break;
case 'u':
correction = 0;
break;
(DIR) diff --git a/stdvar.1 b/stdvar.1
t@@ -6,6 +6,7 @@
.Nd returns the standard variance for each column
.Sh SYNOPSIS
.Nm
+.Op Fl h
.Op Fl u
.Sh DESCRIPTION
.Nm
t@@ -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
(DIR) diff --git a/stdvar.c b/stdvar.c
t@@ -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
t@@ -25,6 +25,9 @@ main(int argc, char *argv[])
err(2, "pledge");
ARGBEGIN {
+ case 'h':
+ usage();
+ break;
case 'u':
correction = 0;
break;