aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/tip
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2006-09-07 19:48:52 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2006-09-07 19:48:52 +0000
commit2aebb8bcb4e9552e723739ce37a912dd8cffceeb (patch)
tree7df58dd978d532a527498d13a33dcaac621c8df6 /usr.bin/tip
parentd2f03ebb1a4eda8fad5108e474604bbd82decc89 (diff)
Notes
Diffstat (limited to 'usr.bin/tip')
-rw-r--r--usr.bin/tip/tip/cu.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/usr.bin/tip/tip/cu.c b/usr.bin/tip/tip/cu.c
index f34bba2e029d6..d8d104d482e47 100644
--- a/usr.bin/tip/tip/cu.c
+++ b/usr.bin/tip/tip/cu.c
@@ -60,7 +60,26 @@ cumain(int argc, char *argv[])
CU = DV = NOSTR;
BR = DEFBR;
parity = 0; /* none */
- while ((ch = getopt(argc, argv, "a:l:s:htoe0123456789")) != -1) {
+
+ /*
+ * We want to accept -# as a speed. It's easiest to look through
+ * the arguments, replace -# with -s#, and let getopt() handle it.
+ */
+ for (i = 1; i < argc; i++) {
+ if (argv[i][0] == '-' &&
+ argv[i][1] >= '0' && argv[i][1] <= '9') {
+ asprintf(&cp, "-s%s", argv[i] + 1);
+ if (cp == NULL) {
+ fprintf(stderr,
+ "%s: cannot convert -# to -s#\n",
+ __progname);
+ exit(3);
+ }
+ argv[i] = cp;
+ }
+ }
+
+ while ((ch = getopt(argc, argv, "a:l:s:htoe")) != -1) {
switch (ch) {
case 'a':
CU = optarg;
@@ -105,13 +124,6 @@ cumain(int argc, char *argv[])
else
parity = -1; /* even */
break;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- if (CU)
- CU[strlen(CU)-1] = ch;
- if (DV)
- DV[strlen(DV)-1] = ch;
- break;
default:
cuusage();
break;