changeset 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 957fb6e08577
children d46ea7a3fa0c
files fteeprom/ftee-gen2232c.c fteeprom/ftee-gen2232h.c fteeprom/ftee-gen232r.c
diffstat 3 files changed, 41 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/fteeprom/ftee-gen2232c.c	Tue Sep 26 00:38:58 2023 +0000
+++ b/fteeprom/ftee-gen2232c.c	Tue Sep 26 01:17:32 2023 +0000
@@ -60,9 +60,22 @@
 }
 
 static void
+take_one_arg(arg)
+	char *arg;
+{
+	char *cp;
+
+	for (cp = arg; *cp && !isspace(*cp); cp++)
+		;
+	if (*cp)
+		*cp = '\0';
+}
+
+static void
 ftdi_chip_setting(arg, filename_for_errs, lineno)
 	char *arg, *filename_for_errs;
 {
+	take_one_arg(arg);
 	if (!strcasecmp(arg, "FT2232C"))
 		return;
 	if (!strcasecmp(arg, "FT2232D"))
@@ -78,6 +91,7 @@
 eeprom_setting(arg, filename_for_errs, lineno)
 	char *arg, *filename_for_errs;
 {
+	take_one_arg(arg);
 	if (!strcasecmp(arg, "93C46"))
 		eeprom_chip = 0x46;
 	else if (!strcasecmp(arg, "93C56"))
--- a/fteeprom/ftee-gen2232h.c	Tue Sep 26 00:38:58 2023 +0000
+++ b/fteeprom/ftee-gen2232h.c	Tue Sep 26 01:17:32 2023 +0000
@@ -60,9 +60,22 @@
 }
 
 static void
+take_one_arg(arg)
+	char *arg;
+{
+	char *cp;
+
+	for (cp = arg; *cp && !isspace(*cp); cp++)
+		;
+	if (*cp)
+		*cp = '\0';
+}
+
+static void
 ftdi_chip_setting(arg, filename_for_errs, lineno)
 	char *arg, *filename_for_errs;
 {
+	take_one_arg(arg);
 	if (!strcasecmp(arg, "FT2232H"))
 		return;
 	if (!strcasecmp(arg, "FT2232x"))
@@ -76,6 +89,7 @@
 eeprom_setting(arg, filename_for_errs, lineno)
 	char *arg, *filename_for_errs;
 {
+	take_one_arg(arg);
 	if (!strcasecmp(arg, "93C46"))
 		eeprom_chip = 0x46;
 	else if (!strcasecmp(arg, "93C56"))
--- a/fteeprom/ftee-gen232r.c	Tue Sep 26 00:38:58 2023 +0000
+++ b/fteeprom/ftee-gen232r.c	Tue Sep 26 01:17:32 2023 +0000
@@ -24,9 +24,22 @@
 unsigned eeprom_string_ptr = 0x0C;
 
 static void
+take_one_arg(arg)
+	char *arg;
+{
+	char *cp;
+
+	for (cp = arg; *cp && !isspace(*cp); cp++)
+		;
+	if (*cp)
+		*cp = '\0';
+}
+
+static void
 ftdi_chip_setting(arg, filename_for_errs, lineno)
 	char *arg, *filename_for_errs;
 {
+	take_one_arg(arg);
 	if (!strcasecmp(arg, "FT232R"))
 		return;
 	fprintf(stderr, "%s line %d: config is for wrong FTDI chip\n",