aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhpa <hpa>2005-08-26 05:34:35 +0000
committerhpa <hpa>2005-08-26 05:34:35 +0000
commit9bcc3a2714beddc156f05c0f389ee3ada23f459f (patch)
tree5d5838ddc1bcf3ef27c0d8c2ee8a1754243373a9
parent79c0cc898e58b79aa9414917b5866817ff954353 (diff)
downloadsyslinux-9bcc3a2714beddc156f05c0f389ee3ada23f459f.tar.gz
syslinux-9bcc3a2714beddc156f05c0f389ee3ada23f459f.tar.xz
syslinux-9bcc3a2714beddc156f05c0f389ee3ada23f459f.zip
Avoid doing the same job more than once...syslinux-3.11-pre3
-rw-r--r--com32/modules/readconfig.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/com32/modules/readconfig.c b/com32/modules/readconfig.c
index c8c57c04..3c69979f 100644
--- a/com32/modules/readconfig.c
+++ b/com32/modules/readconfig.c
@@ -94,10 +94,11 @@ skipspace(char *p)
}
/* Check to see if we are at a certain keyword (case insensitive) */
-static int
-looking_at(const char *line, const char *kwd)
+/* Returns a pointer to the first character past the keyword */
+static char *
+looking_at(char *line, const char *kwd)
{
- const char *p = line;
+ char *p = line;
const char *q = kwd;
while ( *p && *q && ((*p^*q) & ~0x20) == 0 ) {
@@ -106,9 +107,9 @@ looking_at(const char *line, const char *kwd)
}
if ( *q )
- return 0; /* Didn't see the keyword */
+ return NULL; /* Didn't see the keyword */
- return *p <= ' '; /* Must be EOL or whitespace */
+ return (*p <= ' ') ? p : NULL; /* Must be EOL or whitespace */
}
struct labeldata {
@@ -184,7 +185,7 @@ record(struct labeldata *ld, char *append)
void parse_config(const char *filename)
{
- char line[MAX_LINE], *p;
+ char line[MAX_LINE], *p, *ep;
FILE *f;
char *append = NULL;
static struct labeldata ld;
@@ -228,12 +229,11 @@ void parse_config(const char *filename)
menu_master_passwd = strdup(skipspace(p+6));
}
} else {
- /* Unknown, check for parameters */
+ /* Unknown, check for layout parameters */
struct menu_parameter *pp;
for ( pp = mparm ; pp->name ; pp++ ) {
- if ( looking_at(p, pp->name) ) {
- p = skipspace(p+strlen(pp->name));
- pp->value = atoi(p);
+ if ( (ep = looking_at(p, pp->name)) ) {
+ pp->value = atoi(skipspace(ep));
break;
}
}