nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 13fd44bfe45c7a11dfdee20aa108593122930d07
parent 327939843d2a8412a4cb60872411f171dab982b6
Author: Chris Allegretta <chrisa@asty.org>
Date:   Wed,  2 Jan 2002 13:59:11 +0000

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

Diffstat:
MChangeLog | 6++++++
Mnano.c | 11++++++++---
Mrcfile.c | 4++--
3 files changed, 16 insertions(+), 5 deletions(-)

diff --git 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 @@ -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 @@ -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 */