changeset 42:c4b9026c8875

fteeprom-{prog,read}: -t option replaced with -b and -B
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 22 Apr 2019 01:17:07 +0000
parents 79cdd210abe1
children ea0b5aed9a9c
files fteeprom/fteeprom-prog.c fteeprom/fteeprom-read.c
diffstat 2 files changed, 13 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/fteeprom/fteeprom-prog.c	Mon Apr 22 00:19:13 2019 +0000
+++ b/fteeprom/fteeprom-prog.c	Mon Apr 22 01:17:07 2019 +0000
@@ -17,27 +17,18 @@
 {
 	int c;
 	extern int optind;
-	extern char *optarg;
 
-	while ((c = getopt(argc, argv, "et:")) != EOF) {
+	while ((c = getopt(argc, argv, "bBe")) != EOF) {
 		switch (c) {
+		case 'b':
+			eeprom_size = 128;
+			continue;
+		case 'B':
+			eeprom_size = 256;
+			continue;
 		case 'e':
 			erase = 1;
 			continue;
-		case 't':
-			if (!strcmp(optarg, "46"))
-				eeprom_size = 64;
-			else if (!strcmp(optarg, "56"))
-				eeprom_size = 128;
-			else if (!strcmp(optarg, "66"))
-				eeprom_size = 256;
-			else {
-				fprintf(stderr,
-				"error: -t option invalid value \"%s\"\n",
-					optarg);
-				exit(1);
-			}
-			continue;
 		default:
 			/* error msg already printed */
 			exit(1);
--- a/fteeprom/fteeprom-read.c	Mon Apr 22 00:19:13 2019 +0000
+++ b/fteeprom/fteeprom-read.c	Mon Apr 22 01:17:07 2019 +0000
@@ -14,23 +14,14 @@
 {
 	int c;
 	extern int optind;
-	extern char *optarg;
 
-	while ((c = getopt(argc, argv, "t:")) != EOF) {
+	while ((c = getopt(argc, argv, "bB")) != EOF) {
 		switch (c) {
-		case 't':
-			if (!strcmp(optarg, "46"))
-				eeprom_size = 64;
-			else if (!strcmp(optarg, "56"))
-				eeprom_size = 128;
-			else if (!strcmp(optarg, "66"))
-				eeprom_size = 256;
-			else {
-				fprintf(stderr,
-				"error: -t option invalid value \"%s\"\n",
-					optarg);
-				exit(1);
-			}
+		case 'b':
+			eeprom_size = 128;
+			continue;
+		case 'B':
+			eeprom_size = 256;
 			continue;
 		default:
 			/* error msg already printed */