comparison fteeprom/ftee-gen2232c.c @ 77:66cbbd7d85cf

ftee-gen*: allow trailing ws and comments after ftdi-chip and eeprom settings
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 26 Sep 2023 01:17:32 +0000
parents 7ff9b4857aaf
children
comparison
equal deleted inserted replaced
76:957fb6e08577 77:66cbbd7d85cf
58 configfile = argv[optind]; 58 configfile = argv[optind];
59 serial = argv[optind+1]; 59 serial = argv[optind+1];
60 } 60 }
61 61
62 static void 62 static void
63 take_one_arg(arg)
64 char *arg;
65 {
66 char *cp;
67
68 for (cp = arg; *cp && !isspace(*cp); cp++)
69 ;
70 if (*cp)
71 *cp = '\0';
72 }
73
74 static void
63 ftdi_chip_setting(arg, filename_for_errs, lineno) 75 ftdi_chip_setting(arg, filename_for_errs, lineno)
64 char *arg, *filename_for_errs; 76 char *arg, *filename_for_errs;
65 { 77 {
78 take_one_arg(arg);
66 if (!strcasecmp(arg, "FT2232C")) 79 if (!strcasecmp(arg, "FT2232C"))
67 return; 80 return;
68 if (!strcasecmp(arg, "FT2232D")) 81 if (!strcasecmp(arg, "FT2232D"))
69 return; 82 return;
70 if (!strcasecmp(arg, "FT2232x")) 83 if (!strcasecmp(arg, "FT2232x"))
76 89
77 static void 90 static void
78 eeprom_setting(arg, filename_for_errs, lineno) 91 eeprom_setting(arg, filename_for_errs, lineno)
79 char *arg, *filename_for_errs; 92 char *arg, *filename_for_errs;
80 { 93 {
94 take_one_arg(arg);
81 if (!strcasecmp(arg, "93C46")) 95 if (!strcasecmp(arg, "93C46"))
82 eeprom_chip = 0x46; 96 eeprom_chip = 0x46;
83 else if (!strcasecmp(arg, "93C56")) 97 else if (!strcasecmp(arg, "93C56"))
84 eeprom_chip = 0x56; 98 eeprom_chip = 0x56;
85 else if (!strcasecmp(arg, "93C66")) 99 else if (!strcasecmp(arg, "93C66"))