summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2010-08-08 05:24:47 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2010-08-08 05:24:47 +0000
commitee1830574683cc54cfd714492920e3171b167360 (patch)
tree0d49644fcad21bbe7d0aa9bd5551a8f5f086baab
parentb4d66e077ed465678f5fcef9c059ed184e39ba26 (diff)
make disklabel -p slightly nicer by accepting capital letters and printing
a more useful error message for invalid ones. ok deraadt
-rw-r--r--sbin/disklabel/disklabel.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index acc149d61f0..368d2f3ed2b 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.c,v 1.169 2010/08/03 00:19:42 krw Exp $ */
+/* $OpenBSD: disklabel.c,v 1.170 2010/08/08 05:24:46 tedu Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -188,10 +188,12 @@ main(int argc, char *argv[])
op = WRITE;
break;
case 'p':
- if (strchr("bckmgt", optarg[0]) == NULL ||
- optarg[1] != '\0')
- usage();
- print_unit = optarg[0];
+ if (strchr("bckmgtBCKMGT", optarg[0]) == NULL ||
+ optarg[1] != '\0') {
+ fprintf(stderr, "Valid units are bckmgt\n");
+ exit(1);
+ }
+ print_unit = tolower(optarg[0]);
break;
case 'n':
donothing++;