add a bunch of DB's miscellaneous fixes, plus a few of mine
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1890 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
049e4a5db3
Коммит
6420d445c2
20
ChangeLog
20
ChangeLog
@ -68,8 +68,8 @@ CVS code -
|
||||
- Readded the errors flag and moved the ending prompt from
|
||||
rcfile_error() to parse_rcfile() so that we only get prompted
|
||||
once for all errors instead of separately for each error.
|
||||
Also make sure that each rcfile error message ends in a
|
||||
newline. (DLR)
|
||||
(DLR) David Benbennick: Make sure that no rcfile error
|
||||
messages end in newlines.
|
||||
- Don't treat the return value of strn?(case)?cmp() as boolean.
|
||||
(DLR and David Benbennick)
|
||||
- Automatically install a symlink "rnano" pointing to nano.
|
||||
@ -83,6 +83,10 @@ CVS code -
|
||||
- Add various #ifdefs to fix warnings and compilation problems
|
||||
when compiling with every option manually turned on, including
|
||||
NANO_SMALL. (David Benbennick)
|
||||
- Simplify some of the rcfile and statusbar error messages, and
|
||||
make some of them more consistent. (David Benbennick and DLR)
|
||||
- Change some functions to take const char*'s instead of char*'s
|
||||
where possible. (David Benbennick)
|
||||
- files.c:
|
||||
get_next_filename()
|
||||
- Tweak for efficiency, and add the ".save" suffix to the file
|
||||
@ -95,7 +99,7 @@ CVS code -
|
||||
the mode of newly created files 666 instead of 600 before
|
||||
it's modified by the umask. (DLR)
|
||||
do_writeout()
|
||||
- If we're in restricted mode abd the current filename isn't
|
||||
- If we're in restricted mode and the current filename isn't
|
||||
blank, we can't change it, so disable tab completion in that
|
||||
case. (DLR)
|
||||
- Fix spacing problem in the "Save Under Different Name"
|
||||
@ -170,6 +174,8 @@ CVS code -
|
||||
used in the actual functions. (DLR)
|
||||
- Remove unused declaration of temp_opt. (David Benbennick)
|
||||
- Add missing copy_file() prototype. (David Benbennick)
|
||||
- Move the load_history() and save_history() prototypes up to
|
||||
match their corresponding location in files.c. (DLR)
|
||||
- rcfile.c:
|
||||
rcfile_msg()
|
||||
- Removed along with the related static int errors, and replaced
|
||||
@ -197,14 +203,20 @@ CVS code -
|
||||
- Use parse_num() to interpret a line entered by the user, and
|
||||
start the search for a line from current instead of fileage.
|
||||
(DLR)
|
||||
do_gotopos()
|
||||
do_gotopos(), find_node(), free_history()
|
||||
- Tweak for efficiency. (David Benbennick)
|
||||
free_history()
|
||||
- Only include when DEBUG is defined. (David Benbennick)
|
||||
- utils.c:
|
||||
parse_num()
|
||||
- New function to parse numeric values, so that we don't have to
|
||||
duplicate code that calls strtol() all over the place. (David
|
||||
Benbennick) DLR: Renamed from parse_int() to parse_num() and
|
||||
converted to use ssize_t instead of int.
|
||||
nstrnicmp()
|
||||
- Remove code chacking for n's being less than 0 that will never
|
||||
be run, since n is a size_t and is hence unsigned. (David
|
||||
Benbennick)
|
||||
- winio.c:
|
||||
get_kbinput()
|
||||
- Since the only valid values for escapes are 0, 1, and 2,
|
||||
|
53
src/files.c
53
src/files.c
@ -371,7 +371,7 @@ bool open_file(const char *filename, int insert, int quiet)
|
||||
|| ISSET(MULTIBUFFER)
|
||||
#endif
|
||||
)
|
||||
statusbar("%s: %s", strerror(errno), filename);
|
||||
statusbar("Error reading %s: %s", filename, strerror(errno));
|
||||
if (!insert)
|
||||
new_file();
|
||||
return FALSE;
|
||||
@ -1026,11 +1026,7 @@ char *get_full_path(const char *origpath)
|
||||
/* first, get the current directory, and tack a slash onto the end of
|
||||
it, unless it turns out to be "/", in which case leave it alone */
|
||||
|
||||
#ifdef PATH_MAX
|
||||
d_here = getcwd(NULL, PATH_MAX + 1);
|
||||
#else
|
||||
d_here = getcwd(NULL, 0);
|
||||
#endif
|
||||
|
||||
if (d_here != NULL) {
|
||||
|
||||
@ -1096,11 +1092,7 @@ char *get_full_path(const char *origpath)
|
||||
|
||||
free(d_there);
|
||||
|
||||
#ifdef PATH_MAX
|
||||
d_there = getcwd(NULL, PATH_MAX + 1);
|
||||
#else
|
||||
d_there = getcwd(NULL, 0);
|
||||
#endif
|
||||
|
||||
align(&d_there);
|
||||
if (d_there != NULL) {
|
||||
@ -1847,8 +1839,8 @@ int do_writeout(int exiting)
|
||||
/* If we're using restricted mode, the filename isn't blank,
|
||||
* and we're at the "Write File" prompt, disable tab
|
||||
* completion. */
|
||||
i = statusq(!ISSET(RESTRICTED) || filename[0] == '\0' ? TRUE :
|
||||
FALSE, writefile_list,
|
||||
i = statusq(!ISSET(RESTRICTED) || filename[0] == '\0',
|
||||
writefile_list,
|
||||
#ifndef NANO_SMALL
|
||||
ans, NULL, "%s%s%s", _(msg), formatstr, backupstr
|
||||
#else
|
||||
@ -2115,12 +2107,7 @@ char **cwd_tab_completion(char *buf, int *num_matches)
|
||||
|
||||
} else {
|
||||
|
||||
#ifdef PATH_MAX
|
||||
if ((dirname = getcwd(NULL, PATH_MAX + 1)) == NULL)
|
||||
#else
|
||||
/* The better, but apparently segfault-causing way */
|
||||
if ((dirname = getcwd(NULL, 0)) == NULL)
|
||||
#endif /* PATH_MAX */
|
||||
return matches;
|
||||
else
|
||||
tmp = buf;
|
||||
@ -2742,7 +2729,7 @@ char *do_browser(const char *inpath)
|
||||
path = new_path;
|
||||
return do_browser(path);
|
||||
|
||||
/* Goto a specific directory */
|
||||
/* Go to a specific directory */
|
||||
case NANO_GOTO_KEY:
|
||||
case NANO_GOTO_FKEY:
|
||||
case 'G': /* Pico compatibility */
|
||||
@ -2752,12 +2739,12 @@ char *do_browser(const char *inpath)
|
||||
#ifndef NANO_SMALL
|
||||
NULL,
|
||||
#endif
|
||||
_("Goto Directory"));
|
||||
_("Go To Directory"));
|
||||
bottombars(browser_list);
|
||||
curs_set(0);
|
||||
|
||||
if (j < 0) {
|
||||
statusbar(_("Goto Cancelled"));
|
||||
statusbar(_("Cancelled"));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2926,8 +2913,7 @@ char *do_browse_from(const char *inpath)
|
||||
}
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef ENABLE_NANORC
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
void load_history(void)
|
||||
{
|
||||
FILE *hist;
|
||||
@ -2939,24 +2925,24 @@ void load_history(void)
|
||||
|
||||
|
||||
if (homenv != NULL) {
|
||||
nanohist = charealloc(nanohist, strlen(homenv) + 15);
|
||||
sprintf(nanohist, "%s/.nano_history", homenv);
|
||||
nanohist = charealloc(nanohist, strlen(homenv) + 15);
|
||||
sprintf(nanohist, "%s/.nano_history", homenv);
|
||||
} else {
|
||||
userage = getpwuid(geteuid());
|
||||
endpwent();
|
||||
nanohist = charealloc(nanohist, strlen(userage->pw_dir) + 15);
|
||||
sprintf(nanohist, "%s/.nano_history", userage->pw_dir);
|
||||
nanohist = charealloc(nanohist, strlen(userage->pw_dir) + 15);
|
||||
sprintf(nanohist, "%s/.nano_history", userage->pw_dir);
|
||||
}
|
||||
|
||||
/* assume do_rcfile has reported missing home dir */
|
||||
/* assume do_rcfile() has reported missing home dir */
|
||||
|
||||
if (homenv != NULL || userage != NULL) {
|
||||
hist = fopen(nanohist, "r");
|
||||
if (hist == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
if (errno != ENOENT) {
|
||||
/* Don't save history when we quit. */
|
||||
UNSET(HISTORYLOG);
|
||||
rcfile_error(N_("Unable to open ~/.nano_history file: %s\n"), strerror(errno));
|
||||
rcfile_error(N_("Error reading %s: %s"), nanohist, strerror(errno));
|
||||
}
|
||||
free(nanohist);
|
||||
} else {
|
||||
@ -2990,7 +2976,7 @@ void save_history(void)
|
||||
|
||||
/* don't save unchanged or empty histories */
|
||||
if ((search_history.count == 0 && replace_history.count == 0) ||
|
||||
!ISSET(HISTORY_CHANGED) || ISSET(VIEW_MODE))
|
||||
!ISSET(HISTORY_CHANGED) || ISSET(VIEW_MODE))
|
||||
return;
|
||||
|
||||
if (homenv != NULL) {
|
||||
@ -3006,7 +2992,7 @@ void save_history(void)
|
||||
if (homenv != NULL || userage != NULL) {
|
||||
hist = fopen(nanohist, "wb");
|
||||
if (hist == NULL)
|
||||
rcfile_error(N_("Unable to write ~/.nano_history file: %s\n"), strerror(errno));
|
||||
rcfile_error(N_("Error writing %s: %s"), nanohist, strerror(errno));
|
||||
else {
|
||||
/* set rw only by owner for security ?? */
|
||||
chmod(nanohist, S_IRUSR | S_IWUSR);
|
||||
@ -3015,12 +3001,12 @@ void save_history(void)
|
||||
h->data = charealloc(h->data, strlen(h->data) + 2);
|
||||
strcat(h->data, "\n");
|
||||
if (fputs(h->data, hist) == EOF) {
|
||||
rcfile_error(N_("Unable to write ~/.nano_history file: %s\n"), strerror(errno));
|
||||
rcfile_error(N_("Error writing %s: %s"), nanohist, strerror(errno));
|
||||
goto come_from;
|
||||
}
|
||||
}
|
||||
if (fputs("\n", hist) == EOF) {
|
||||
rcfile_error(N_("Unable to write ~/.nano_history file: %s\n"), strerror(errno));
|
||||
rcfile_error(N_("Error writing %s: %s"), nanohist, strerror(errno));
|
||||
goto come_from;
|
||||
}
|
||||
for (h = replace_history.tail; h->prev; h = h->prev) {
|
||||
@ -3037,5 +3023,4 @@ void save_history(void)
|
||||
free(nanohist);
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_NANORC */
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_SMALL && ENABLE_NANORC */
|
||||
|
@ -3158,7 +3158,8 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
case 'T':
|
||||
if (!parse_num(optarg, &tabsize) || tabsize <= 0) {
|
||||
fprintf(stderr, _("Requested tab size %s invalid\n"), optarg);
|
||||
fprintf(stderr, _("Requested tab size %s invalid"), optarg);
|
||||
fprintf(stderr, "\n");
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
@ -3206,7 +3207,8 @@ int main(int argc, char *argv[])
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
case 'r':
|
||||
if (!parse_num(optarg, &wrap_at)) {
|
||||
fprintf(stderr, _("Requested fill size %s invalid\n"), optarg);
|
||||
fprintf(stderr, _("Requested fill size %s invalid"), optarg);
|
||||
fprintf(stderr, "\n");
|
||||
exit(1);
|
||||
}
|
||||
fill_flag_used = TRUE;
|
||||
|
12
src/proto.h
12
src/proto.h
@ -223,6 +223,10 @@ char **browser_init(const char *path, int *longest, int *numents);
|
||||
char *do_browser(const char *inpath);
|
||||
char *do_browse_from(const char *inpath);
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
void load_history(void);
|
||||
void save_history(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in global.c */
|
||||
size_t length_of_list(const shortcut *s);
|
||||
@ -409,17 +413,15 @@ void do_gotopos(int line, int pos_x, int pos_y, size_t pos_pww);
|
||||
void do_find_bracket(void);
|
||||
#ifndef NANO_SMALL
|
||||
void history_init(void);
|
||||
historytype *find_node(historytype *h, char *s);
|
||||
historytype *find_node(historytype *h, const char *s);
|
||||
void remove_node(historytype *r);
|
||||
void insert_node(historytype *h, const char *s);
|
||||
void update_history(historyheadtype *h, char *s);
|
||||
void update_history(historyheadtype *h, const char *s);
|
||||
char *get_history_older(historyheadtype *h);
|
||||
char *get_history_newer(historyheadtype *h);
|
||||
char *get_history_completion(historyheadtype *h, char *s);
|
||||
#ifdef DEBUG
|
||||
void free_history(historyheadtype *h);
|
||||
#ifdef ENABLE_NANORC
|
||||
void load_history(void);
|
||||
void save_history(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
42
src/rcfile.c
42
src/rcfile.c
@ -118,6 +118,8 @@ void rcfile_error(const char *msg, ...)
|
||||
va_start(ap, msg);
|
||||
vfprintf(stderr, _(msg), ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
/* Parse the next word from the string. Returns NULL if we hit EOL. */
|
||||
@ -166,7 +168,7 @@ char *parse_argument(char *ptr)
|
||||
ptr = NULL;
|
||||
else
|
||||
*ptr++ = '\0';
|
||||
rcfile_error(N_("Argument %s has unterminated \"\n"), ptr_bak);
|
||||
rcfile_error(N_("Argument %s has unterminated \""), ptr_bak);
|
||||
} else {
|
||||
*last_quote = '\0';
|
||||
ptr = last_quote + 1;
|
||||
@ -212,7 +214,7 @@ int colortoint(const char *colorname, int *bright)
|
||||
"Valid colors are \"green\", \"red\", \"blue\", \n"
|
||||
"\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
|
||||
"\"black\", with the optional prefix \"bright\" \n"
|
||||
"for foreground colors.\n"), colorname);
|
||||
"for foreground colors."), colorname);
|
||||
mcolor = -1;
|
||||
}
|
||||
return mcolor;
|
||||
@ -247,7 +249,7 @@ int nregcomp(regex_t *preg, const char *regex, int eflags)
|
||||
char *str = charalloc(len);
|
||||
|
||||
regerror(rc, preg, str, len);
|
||||
rcfile_error(N_("Bad regex \"%s\": %s\n"), regex, str);
|
||||
rcfile_error(N_("Bad regex \"%s\": %s"), regex, str);
|
||||
free(str);
|
||||
}
|
||||
return rc != 0;
|
||||
@ -267,7 +269,7 @@ void parse_syntax(char *ptr)
|
||||
return;
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character\n"));
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||
return;
|
||||
}
|
||||
ptr++;
|
||||
@ -276,7 +278,7 @@ void parse_syntax(char *ptr)
|
||||
ptr = parse_next_regex(ptr);
|
||||
|
||||
if (ptr == NULL) {
|
||||
rcfile_error(N_("Missing syntax name\n"));
|
||||
rcfile_error(N_("Missing syntax name"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -345,7 +347,7 @@ void parse_colors(char *ptr)
|
||||
ptr = parse_next_word(ptr);
|
||||
|
||||
if (ptr == NULL) {
|
||||
rcfile_error(N_("Missing color name\n"));
|
||||
rcfile_error(N_("Missing color name"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -354,7 +356,7 @@ void parse_colors(char *ptr)
|
||||
strtok(fgstr, ",");
|
||||
bgcolorname = strtok(NULL, ",");
|
||||
if (strncasecmp(bgcolorname, "bright", 6) == 0) {
|
||||
rcfile_error(N_("Background color %s cannot be bright\n"), bgcolorname);
|
||||
rcfile_error(N_("Background color %s cannot be bright"), bgcolorname);
|
||||
return;
|
||||
}
|
||||
bg = colortoint(bgcolorname, &bright);
|
||||
@ -368,7 +370,7 @@ void parse_colors(char *ptr)
|
||||
return;
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
rcfile_error(N_("Cannot add a color directive without a syntax line\n"));
|
||||
rcfile_error(N_("Cannot add a color directive without a syntax line"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -397,7 +399,7 @@ void parse_colors(char *ptr)
|
||||
}
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character\n"));
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||
ptr = parse_next_regex(ptr);
|
||||
continue;
|
||||
}
|
||||
@ -434,14 +436,14 @@ void parse_colors(char *ptr)
|
||||
|
||||
if (expectend) {
|
||||
if (ptr == NULL || strncasecmp(ptr, "end=", 4) != 0) {
|
||||
rcfile_error(N_("\"start=\" requires a corresponding \"end=\"\n"));
|
||||
rcfile_error(N_("\"start=\" requires a corresponding \"end=\""));
|
||||
return;
|
||||
}
|
||||
|
||||
ptr += 4;
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character\n"));
|
||||
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||
continue;
|
||||
}
|
||||
ptr++;
|
||||
@ -505,7 +507,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
parse_colors(ptr);
|
||||
#endif /* ENABLE_COLOR */
|
||||
else {
|
||||
rcfile_error(N_("Command %s not understood\n"), keyword);
|
||||
rcfile_error(N_("Command %s not understood"), keyword);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -544,7 +546,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
#endif
|
||||
) {
|
||||
if (*ptr == '\n' || *ptr == '\0') {
|
||||
rcfile_error(N_("Option %s requires an argument\n"), rcopts[i].name);
|
||||
rcfile_error(N_("Option %s requires an argument"), rcopts[i].name);
|
||||
continue;
|
||||
}
|
||||
option = ptr;
|
||||
@ -562,7 +564,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
if (strcasecmp(rcopts[i].name, "fill") == 0) {
|
||||
if (!parse_num(option, &wrap_at)) {
|
||||
rcfile_error(N_("Requested fill size %s invalid\n"), option);
|
||||
rcfile_error(N_("Requested fill size %s invalid"), option);
|
||||
wrap_at = -CHARS_FROM_EOL;
|
||||
}
|
||||
} else
|
||||
@ -573,7 +575,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
whitespace = mallocstrcpy(NULL, option);
|
||||
ws_len = strlen(whitespace);
|
||||
if (ws_len != 2 || (ws_len == 2 && (is_cntrl_char(whitespace[0]) || is_cntrl_char(whitespace[1])))) {
|
||||
rcfile_error(N_("Two non-control characters required\n"));
|
||||
rcfile_error(N_("Two non-control characters required"));
|
||||
free(whitespace);
|
||||
whitespace = NULL;
|
||||
}
|
||||
@ -583,14 +585,14 @@ void parse_rcfile(FILE *rcstream)
|
||||
if (strcasecmp(rcopts[i].name, "punct") == 0) {
|
||||
punct = mallocstrcpy(NULL, option);
|
||||
if (strchr(punct, '\t') != NULL || strchr(punct, ' ') != NULL) {
|
||||
rcfile_error(N_("Non-tab and non-space characters required\n"));
|
||||
rcfile_error(N_("Non-tab and non-space characters required"));
|
||||
free(punct);
|
||||
punct = NULL;
|
||||
}
|
||||
} else if (strcasecmp(rcopts[i].name, "brackets") == 0) {
|
||||
brackets = mallocstrcpy(NULL, option);
|
||||
if (strchr(brackets, '\t') != NULL || strchr(brackets, ' ') != NULL) {
|
||||
rcfile_error(N_("Non-tab and non-space characters required\n"));
|
||||
rcfile_error(N_("Non-tab and non-space characters required"));
|
||||
free(brackets);
|
||||
brackets = NULL;
|
||||
}
|
||||
@ -610,7 +612,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
#endif
|
||||
if (strcasecmp(rcopts[i].name, "tabsize") == 0) {
|
||||
if (!parse_num(option, &tabsize) || tabsize <= 0)
|
||||
rcfile_error(N_("Requested tab size %s invalid\n"), option);
|
||||
rcfile_error(N_("Requested tab size %s invalid"), option);
|
||||
tabsize = -1;
|
||||
}
|
||||
} else
|
||||
@ -673,7 +675,7 @@ void do_rcfile(void)
|
||||
endpwent();
|
||||
|
||||
if (userage == NULL) {
|
||||
rcfile_error(N_("I can't find my home directory! Wah!\n"));
|
||||
rcfile_error(N_("I can't find my home directory! Wah!"));
|
||||
SET(NO_RCFILE);
|
||||
} else {
|
||||
nanorc = charealloc(nanorc, strlen(userage->pw_dir) + 9);
|
||||
@ -693,7 +695,7 @@ void do_rcfile(void)
|
||||
if ((rcstream = fopen(nanorc, "r")) == NULL) {
|
||||
/* Don't complain about the file not existing */
|
||||
if (errno != ENOENT) {
|
||||
rcfile_error(N_("Unable to open ~/.nanorc file: %s\n"), strerror(errno));
|
||||
rcfile_error(N_("Error reading %s: %s"), nanorc, strerror(errno));
|
||||
SET(NO_RCFILE);
|
||||
}
|
||||
} else {
|
||||
|
12
src/search.c
12
src/search.c
@ -1006,7 +1006,7 @@ void history_init(void)
|
||||
}
|
||||
|
||||
/* find first node containing string *s in history list *h */
|
||||
historytype *find_node(historytype *h, char *s)
|
||||
historytype *find_node(historytype *h, const char *s)
|
||||
{
|
||||
for (; h->next != NULL; h = h->next)
|
||||
if (strcmp(s, h->data) == 0)
|
||||
@ -1030,14 +1030,14 @@ void insert_node(historytype *h, const char *s)
|
||||
|
||||
a = (historytype *)nmalloc(sizeof(historytype));
|
||||
a->next = h->next;
|
||||
a->prev = h->next->prev;
|
||||
a->prev = h;
|
||||
h->next->prev = a;
|
||||
h->next = a;
|
||||
a->data = mallocstrcpy(NULL, s);
|
||||
}
|
||||
|
||||
/* update history list */
|
||||
void update_history(historyheadtype *h, char *s)
|
||||
void update_history(historyheadtype *h, const char *s)
|
||||
{
|
||||
historytype *p;
|
||||
|
||||
@ -1095,14 +1095,16 @@ char *get_history_completion(historyheadtype *h, char *s)
|
||||
return s;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* free a history list */
|
||||
void free_history(historyheadtype *h)
|
||||
{
|
||||
historytype *p, *n;
|
||||
historytype *p;
|
||||
|
||||
for (p = h->next; (n = p->next); p = n)
|
||||
for (p = h->next; p->next != NULL; p = p->next)
|
||||
remove_node(p);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* end of history support functions */
|
||||
#endif /* !NANO_SMALL */
|
||||
|
@ -167,10 +167,8 @@ int nstrnicmp(const char *s1, const char *s2, size_t n)
|
||||
|
||||
if (n > 0)
|
||||
return (tolower(*s1) - tolower(*s2));
|
||||
else if (n == 0)
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user