From: Chris Allegretta Date: Wed, 2 Jan 2002 13:59:11 +0000 (+0000) Subject: Get rid of \n in abort check of parse_next_word(), new var helplen in help_init() X-Git-Tag: v1.1.5~18 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=13fd44bfe45c7a11dfdee20aa108593122930d07;p=nano.git Get rid of \n in abort check of parse_next_word(), new var helplen in help_init() git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@959 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index f0799704..b2c2a078 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,9 +8,15 @@ CVS code - suspending nano on the Hurd. help_init() - Typo fixes in help strings (Jordi). + - New variable helplen needes cause currslen is not always + the length we want (bug found by David Lawrence Ramsey). - files.c: read_file() - Make conversion message less confusing (suggested by Jordi). +- rcfile.c: + parse_next_word() + - Get rid of ptr == \n check to abort, screws up option + parsing (bug found by David Lawrence Ramsey) - winio.c: update_line() - set realdata check to >= 1 && <= 31, lack of > 0 check screwed diff --git a/nano.c b/nano.c index 0709d2a6..9f823d07 100644 --- a/nano.c +++ b/nano.c @@ -2383,10 +2383,15 @@ int do_justify(void) #ifndef DISABLE_HELP void help_init(void) { - int i, sofar = 0; + int i, sofar = 0, helplen; long allocsize = 1; /* How much space we're gonna need for the help text */ char buf[BUFSIZ] = "", *ptr = NULL; + if (currslen == MAIN_VISIBLE) + helplen = MAIN_LIST_LEN; + else + helplen = currslen; + /* First set up the initial help text for the current function */ if (currshortcut == whereis_list || currshortcut == replace_list || currshortcut == replace_list_2) @@ -2466,7 +2471,7 @@ void help_init(void) /* Compute the space needed for the shortcut lists - we add 15 to have room for the shortcut abbrev and its possible alternate keys */ - for (i = 0; i <= currslen - 1; i++) + for (i = 0; i <= helplen - 1; i++) if (currshortcut[i].help != NULL) allocsize += strlen(currshortcut[i].help) + 15; @@ -2491,7 +2496,7 @@ void help_init(void) strcpy(help_text, ptr); /* Now add our shortcut info */ - for (i = 0; i <= currslen - 1; i++) { + for (i = 0; i <= helplen - 1; i++) { if (currshortcut[i].val > 0 && currshortcut[i].val < 'a') sofar = snprintf(buf, BUFSIZ, "^%c ", currshortcut[i].val + 64); else diff --git a/rcfile.c b/rcfile.c index b1527c29..29ed1153 100644 --- a/rcfile.c +++ b/rcfile.c @@ -107,10 +107,10 @@ void rcfile_msg(int *errors, char *msg, ...) /* Parse the next word from the string. Returns NULL if we hit EOL */ char *parse_next_word(char *ptr) { - while (*ptr != ' ' && *ptr != '\t' && *ptr != '\n' && ptr != '\0') + while (*ptr != ' ' && *ptr != '\t' && *ptr != '\n' && *ptr != '\0') ptr++; - if (*ptr == '\0' || *ptr == '\n') + if (*ptr == '\0') return NULL; /* Null terminate and advance ptr */