summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--laden/ChangeLog5
-rw-r--r--laden/output-serial.c26
-rw-r--r--viengoos/ChangeLog5
-rw-r--r--viengoos/output-serial.c24
4 files changed, 51 insertions, 9 deletions
diff --git a/laden/ChangeLog b/laden/ChangeLog
index 727390b..4fa0215 100644
--- a/laden/ChangeLog
+++ b/laden/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-06 Neal H. Walfield <neal@gnu.org>
+
+ * output-serial.c (serial_init): Rewrite command-line parser to
+ not use strtok.
+
2008-01-24 Neal H. Walfield <neal@gnu.org>
* Makefile.am (laden_LDADD): Set to ../libc-parts/libc-kernel.a,
diff --git a/laden/output-serial.c b/laden/output-serial.c
index 1cc6049..16da415 100644
--- a/laden/output-serial.c
+++ b/laden/output-serial.c
@@ -1,5 +1,5 @@
/* output-serial.c - A serial port output driver.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2008 Free Software Foundation, Inc.
Written by Daniel Wagner.
This file is part of the GNU Hurd.
@@ -65,16 +65,22 @@ static unsigned short int uart_base = UART1_BASE;
static void
serial_init (const char *driver_cfg)
{
- static const char delimiters[] = ",";
/* Twice the desired UART speed, to allow for .5 values. */
unsigned int uart_speed = 2 * UART_SPEED_DEFAULT;
unsigned int divider;
volatile int busy_wait_var;
if (driver_cfg)
- {
+ {
char *cfg = strdupa (driver_cfg);
- char *token = strtok (cfg, delimiters);
+
+ char *token = cfg;
+ bool done = false;
+ while (*cfg && *cfg != ',' )
+ cfg ++;
+ if (*cfg == 0)
+ done = true;
+ *cfg = 0;
while (token)
{
@@ -101,7 +107,17 @@ serial_init (const char *driver_cfg)
&& new_speed > UART_SPEED_MIN && new_speed < UART_SPEED_MAX)
uart_speed = new_speed;
}
- token = strtok (NULL, delimiters);
+
+ if (done)
+ token = NULL;
+ else
+ {
+ while (*cfg && *cfg != ',' )
+ cfg ++;
+ if (*cfg == 0)
+ done = true;
+ *cfg = 0;
+ }
}
}
diff --git a/viengoos/ChangeLog b/viengoos/ChangeLog
index 9654339..f0fbf96 100644
--- a/viengoos/ChangeLog
+++ b/viengoos/ChangeLog
@@ -1,5 +1,10 @@
2008-02-06 Neal H. Walfield <neal@gnu.org>
+ * output-serial.c (serial_init): Rewrite command-line parser to
+ not use strtok.
+
+2008-02-06 Neal H. Walfield <neal@gnu.org>
+
* as.c (do_index): New function.
(as_build_internal): Don't index a page table directly. Instead,
use the above new function.
diff --git a/viengoos/output-serial.c b/viengoos/output-serial.c
index af7f15d..cf39f90 100644
--- a/viengoos/output-serial.c
+++ b/viengoos/output-serial.c
@@ -1,5 +1,5 @@
/* output-serial.c - A serial port output driver.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2008 Free Software Foundation, Inc.
Written by Daniel Wagner.
This file is part of the GNU Hurd.
@@ -70,7 +70,6 @@
static void
serial_init (struct output_driver *device, const char *driver_cfg)
{
- static const char delimiters[] = ",";
/* Twice the desired UART speed, to allow for .5 values. */
unsigned int uart_speed = 2 * UART_SPEED_DEFAULT;
unsigned int divider;
@@ -79,7 +78,14 @@ serial_init (struct output_driver *device, const char *driver_cfg)
if (driver_cfg)
{
char *cfg = strdupa (driver_cfg);
- char *token = strtok (cfg, delimiters);
+
+ char *token = cfg;
+ bool done = false;
+ while (*cfg && *cfg != ',' )
+ cfg ++;
+ if (*cfg == 0)
+ done = true;
+ *cfg = 0;
while (token)
{
@@ -106,7 +112,17 @@ serial_init (struct output_driver *device, const char *driver_cfg)
&& new_speed > UART_SPEED_MIN && new_speed < UART_SPEED_MAX)
uart_speed = new_speed;
}
- token = strtok (NULL, delimiters);
+
+ if (done)
+ token = NULL;
+ else
+ {
+ while (*cfg && *cfg != ',' )
+ cfg ++;
+ if (*cfg == 0)
+ done = true;
+ *cfg = 0;
+ }
}
}