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
master
Chris Allegretta 2002-01-02 13:59:11 +00:00
parent 327939843d
commit 13fd44bfe4
3 changed files with 16 additions and 5 deletions

View File

@ -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

11
nano.c
View File

@ -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

View File

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