summaryrefslogtreecommitdiffstats
path: root/usr.bin/jot
diff options
context:
space:
mode:
authordds <dds@FreeBSD.org>2006-11-06 11:03:43 +0000
committerdds <dds@FreeBSD.org>2006-11-06 11:03:43 +0000
commit571eb96dc650429a7f821588890b99411559c8d6 (patch)
treeacc1507c0740c0167762909e6826450dca99d3e1 /usr.bin/jot
parentdc4421d112e00dc1d01e8aefdb999f4002bfdfc9 (diff)
downloadFreeBSD-src-571eb96dc650429a7f821588890b99411559c8d6.zip
FreeBSD-src-571eb96dc650429a7f821588890b99411559c8d6.tar.gz
Avoid negative array indices: an empty string can also be used
to specify a default value.
Diffstat (limited to 'usr.bin/jot')
-rw-r--r--usr.bin/jot/jot.13
-rw-r--r--usr.bin/jot/jot.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/jot/jot.1 b/usr.bin/jot/jot.1
index 4452bbc..e1e98ac 100644
--- a/usr.bin/jot/jot.1
+++ b/usr.bin/jot/jot.1
@@ -106,7 +106,8 @@ and the step size or, for random data, the seed.
While at least one of them must appear,
any of the other three may be omitted, and
will be considered as such if given as
-.Fl "" .
+.Fl ""
+or as an empty string.
Any three of these arguments determines the fourth.
If four are specified and the given and computed values of
.Ar reps
diff --git a/usr.bin/jot/jot.c b/usr.bin/jot/jot.c
index bb3073b..1464e4d 100644
--- a/usr.bin/jot/jot.c
+++ b/usr.bin/jot/jot.c
@@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
#define HAVE_BEGIN 4
#define HAVE_REPS 8
-#define is_default(s) (strcmp((s), "-") == 0)
+#define is_default(s) (*(s) == 0 || strcmp((s), "-") == 0)
double begin;
double ender;
OpenPOWER on IntegriCloud