summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn van Duren <martijn@cvs.openbsd.org>2021-08-13 11:27:34 +0000
committerMartijn van Duren <martijn@cvs.openbsd.org>2021-08-13 11:27:34 +0000
commit052f7e3ba8127288b9db8f1520795117f9c3cc26 (patch)
treeabb6ae22f00413ff0fc20bb8c3db19b4d3f17bfc
parent5072493ca9551f8ca94315853f195a74a52ddc82 (diff)
Make -b, -c, and -b mutually exclusive.
Help/Feedback/OK schwarze@, tb@
-rw-r--r--usr.bin/jot/jot.116
-rw-r--r--usr.bin/jot/jot.c8
2 files changed, 22 insertions, 2 deletions
diff --git a/usr.bin/jot/jot.1 b/usr.bin/jot/jot.1
index 4e11b900776..69c7c640409 100644
--- a/usr.bin/jot/jot.1
+++ b/usr.bin/jot/jot.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: jot.1,v 1.24 2021/08/13 07:59:04 martijn Exp $
+.\" $OpenBSD: jot.1,v 1.25 2021/08/13 11:27:33 martijn Exp $
.\" $NetBSD: jot.1,v 1.2 1994/11/14 20:27:36 jtc Exp $
.\"
.\" Copyright (c) 1993
@@ -58,9 +58,18 @@ The options are as follows:
Just print
.Ar word
repetitively.
+Overrides earlier
+.Fl b ,
+.Fl c ,
+and
+.Fl w .
.It Fl c
This is an abbreviation for
.Fl w Ic %c .
+Overrides earlier
+.Fl b
+and
+.Fl w .
.It Fl n
Do not print the final newline normally appended to the output.
.It Fl p Ar precision
@@ -99,6 +108,11 @@ are possible by using the appropriate
conversion specification inside
.Ar word ,
in which case the data is inserted rather than appended.
+Overrides earlier
+.Fl b ,
+.Fl c ,
+and
+.Fl w .
.El
.Pp
The last four arguments specify the length of the output sequence,
diff --git a/usr.bin/jot/jot.c b/usr.bin/jot/jot.c
index e5d3f96bede..0051195bd9d 100644
--- a/usr.bin/jot/jot.c
+++ b/usr.bin/jot/jot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: jot.c,v 1.54 2021/08/13 10:45:26 tb Exp $ */
+/* $OpenBSD: jot.c,v 1.55 2021/08/13 11:27:33 martijn Exp $ */
/* $NetBSD: jot.c,v 1.3 1994/12/02 20:29:43 pk Exp $ */
/*-
@@ -70,6 +70,7 @@ static bool intdata;
static bool longdata;
static bool nosign;
static bool randomize;
+static bool word;
static void getformat(void);
static int getprec(char *);
@@ -94,10 +95,13 @@ main(int argc, char *argv[])
switch (ch) {
case 'b':
boring = true;
+ chardata = word = false;
format = optarg;
break;
case 'c':
chardata = true;
+ boring = word = false;
+ format = "";
break;
case 'n':
finalnl = false;
@@ -115,6 +119,8 @@ main(int argc, char *argv[])
sepstring = optarg;
break;
case 'w':
+ word = true;
+ boring = chardata = false;
format = optarg;
break;
default: