From 600ef07113caa7a901c7d486bc8ebd1ae47f885c Mon Sep 17 00:00:00 2001 From: Tiago Vignatti Date: Fri, 3 Aug 2007 15:33:41 -0300 Subject: [PATCH] Fix kdrive command line parser. --- hw/kdrive/src/kinput.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index cfd162f57..8018befdc 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -1233,14 +1233,17 @@ KdParsePointer (char *arg) bzero(newopt, sizeof (InputOption)); for (tmpo = &options; *tmpo; tmpo = &(*tmpo)->next) + ; /* Hello, I'm here */ + *tmpo = newopt; - if (strchr(arg, '=')) + if (strchr(save, '=')) { - i = (strchr(arg, '=') - arg); - newopt->key = (char *)xalloc(i+1); - strncpy(newopt->key, arg, i+1); - newopt->value = xstrdup(strchr(arg, '=') + 1); + i = (strchr(save, '=') - save); + newopt->key = (char *)xalloc(i); + strncpy(newopt->key, save, i); + newopt->key[i] = '\0'; + newopt->value = xstrdup(strchr(save, '=') + 1); } else {