comparison fteeprom/fteeprom-prog.c @ 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 16b625911e19
children 2c092eb1621b
comparison
equal deleted inserted replaced
41:79cdd210abe1 42:c4b9026c8875
15 process_cmdline(argc, argv) 15 process_cmdline(argc, argv)
16 char **argv; 16 char **argv;
17 { 17 {
18 int c; 18 int c;
19 extern int optind; 19 extern int optind;
20 extern char *optarg;
21 20
22 while ((c = getopt(argc, argv, "et:")) != EOF) { 21 while ((c = getopt(argc, argv, "bBe")) != EOF) {
23 switch (c) { 22 switch (c) {
23 case 'b':
24 eeprom_size = 128;
25 continue;
26 case 'B':
27 eeprom_size = 256;
28 continue;
24 case 'e': 29 case 'e':
25 erase = 1; 30 erase = 1;
26 continue;
27 case 't':
28 if (!strcmp(optarg, "46"))
29 eeprom_size = 64;
30 else if (!strcmp(optarg, "56"))
31 eeprom_size = 128;
32 else if (!strcmp(optarg, "66"))
33 eeprom_size = 256;
34 else {
35 fprintf(stderr,
36 "error: -t option invalid value \"%s\"\n",
37 optarg);
38 exit(1);
39 }
40 continue; 31 continue;
41 default: 32 default:
42 /* error msg already printed */ 33 /* error msg already printed */
43 exit(1); 34 exit(1);
44 } 35 }