diff options
author | H. Peter Anvin <hpa@zytor.com> | 2006-01-19 08:52:09 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2006-01-19 08:52:09 -0800 |
commit | e9f0a6a9c46bb2b8806e69ec6b62a00fcb7ff4fa (patch) | |
tree | d452c177b458bfd68cc3f555ebbb2a7c065450cd | |
parent | a16afeb49ad4daa97f895a98ac42d551785fff54 (diff) | |
download | syslinux-e9f0a6a9c46bb2b8806e69ec6b62a00fcb7ff4fa.tar.gz |
Clean up the handling of "extended whitespace"; fix typos
-rw-r--r-- | com32/modules/menu.c | 8 | ||||
-rw-r--r-- | com32/modules/menu.h | 5 | ||||
-rw-r--r-- | com32/modules/readconfig.c | 8 |
3 files changed, 13 insertions, 8 deletions
diff --git a/com32/modules/menu.c b/com32/modules/menu.c index df0fe998..2a29cf6d 100644 --- a/com32/modules/menu.c +++ b/com32/modules/menu.c @@ -458,10 +458,10 @@ edit_cmdline(char *input, int top) if ( cursor ) { int prevcursor = cursor; - while ( cursor && (cmdline[cursor-1] <= ' ') ) + while ( cursor && my_isspace(cmdline[cursor-1]) ) cursor--; - while ( cursor && (cmdline[cursor-1] > ' ') ) + while ( cursor && !my_isspace(cmdline[cursor-1]) ) cursor--; memmove(cmdline+cursor, cmdline+prevcursor, len-prevcursor+1); @@ -790,13 +790,13 @@ execute(const char *cmdline) kernel = q; p = cmdline; - while ( *p && *p > ' ' ) { + while ( *p && !my_isspace(*p) ) { *q++ = *p++; } *q++ = '\0'; args = q; - while ( *p && *p <= ' ' ) + while ( *p && my_isspace(*p) ) p++; strcpy(q, p); diff --git a/com32/modules/menu.h b/com32/modules/menu.h index 53af4003..59247df2 100644 --- a/com32/modules/menu.h +++ b/com32/modules/menu.h @@ -65,5 +65,10 @@ extern char *menu_master_passwd; void parse_config(const char *filename); +static inline int my_isspace(char c) +{ + return (unsigned char)c <= ' '; +} + #endif /* MENU_H */ diff --git a/com32/modules/readconfig.c b/com32/modules/readconfig.c index 2208d23f..4fb5b07e 100644 --- a/com32/modules/readconfig.c +++ b/com32/modules/readconfig.c @@ -89,7 +89,7 @@ get_config(void) static char * skipspace(char *p) { - while ( *p && *p <= ' ' ) + while ( *p && my_isspace(*p) ) p++; return p; @@ -111,7 +111,7 @@ looking_at(char *line, const char *kwd) if ( *q ) return NULL; /* Didn't see the keyword */ - return (*p <= ' ') ? p : NULL; /* Must be EOL or whitespace */ + return my_isspace(*p) ? p : NULL; /* Must be EOL or whitespace */ } struct labeldata { @@ -195,14 +195,14 @@ unlabel(char *str) int i, pos; p = str; - while ( *p && !isspace(*p) ) + while ( *p && !my_isspace(*p) ) p++; /* p now points to the first byte beyond the kernel name */ pos = p-str; for ( i = 0 ; i < nentries ; i++ ) { - me = &menu_entry[i]; + me = &menu_entries[i]; if ( !strncmp(str, me->label, pos) && !me->label[pos] ) { /* Found matching label */ |