rename a few more variables, and fix some indentation

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2508 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-05-14 23:14:47 +00:00
parent e781ddf3b1
commit 546f5b3d8a
4 changed files with 32 additions and 26 deletions

View File

@ -27,6 +27,8 @@ CVS code -
write_file()
- Since lineswritten is a size_t, print its value as an unsigned
long instead of an unsigned int. (DLR)
cwd_tab_completion(), browser_init()
- Rename variable next to nextdir to avoid confusion. (DLR)
do_browser()
- Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for
consistency. (DLR)
@ -52,6 +54,9 @@ CVS code -
num_of_digits()
- Use a size_t instead of an int, and rename to digits(). (DLR)
- winio.c:
statusq()
- Rename variable which_history to history_list, for
consistency. (DLR)
do_help()
- Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for
consistency. (DLR)

View File

@ -2062,7 +2062,7 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
size_t filenamelen;
char **matches = NULL;
DIR *dir;
const struct dirent *next;
const struct dirent *nextdir;
assert(dirname != NULL && num_matches != NULL && buflen >= 0);
@ -2102,15 +2102,16 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
#endif
filenamelen = strlen(filename);
while ((next = readdir(dir)) != NULL) {
while ((nextdir = readdir(dir)) != NULL) {
#ifdef DEBUG
fprintf(stderr, "Comparing \'%s\'\n", next->d_name);
fprintf(stderr, "Comparing \'%s\'\n", nextdir->d_name);
#endif
/* See if this matches. */
if (strncmp(next->d_name, filename, filenamelen) == 0 &&
(*filename == '.' || (strcmp(next->d_name, ".") != 0 &&
strcmp(next->d_name, "..") != 0))) {
if (strncmp(nextdir->d_name, filename, filenamelen) == 0 &&
(*filename == '.' ||
(strcmp(nextdir->d_name, ".") != 0 &&
strcmp(nextdir->d_name, "..") != 0))) {
/* Cool, found a match. Add it to the list. This makes a
* lot more sense to me (Chris) this way... */
@ -2121,9 +2122,9 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
* the directory name to the beginning of the proposed match
* before we check it. */
char *tmp2 = charalloc(strlen(dirname) +
strlen(next->d_name) + 1);
strlen(nextdir->d_name) + 1);
sprintf(tmp2, "%s%s", dirname, next->d_name);
sprintf(tmp2, "%s%s", dirname, nextdir->d_name);
if (check_operating_dir(tmp2, TRUE)) {
free(tmp2);
continue;
@ -2133,7 +2134,7 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
matches = (char **)nrealloc(matches, (*num_matches + 1) *
sizeof(char *));
matches[*num_matches] = mallocstrcpy(NULL, next->d_name);
matches[*num_matches] = mallocstrcpy(NULL, nextdir->d_name);
++(*num_matches);
}
}
@ -2341,7 +2342,7 @@ void striponedir(char *path)
char **browser_init(const char *path, int *longest, size_t *numents, DIR
*dir)
{
const struct dirent *next;
const struct dirent *nextdir;
char **filelist;
size_t i, path_len;
@ -2351,15 +2352,15 @@ char **browser_init(const char *path, int *longest, size_t *numents, DIR
i = 0;
while ((next = readdir(dir)) != NULL) {
while ((nextdir = readdir(dir)) != NULL) {
size_t dlen;
/* Don't show the . entry. */
if (strcmp(next->d_name, ".") == 0)
if (strcmp(nextdir->d_name, ".") == 0)
continue;
i++;
dlen = strlenpt(next->d_name);
dlen = strlenpt(nextdir->d_name);
if (dlen > *longest)
*longest = dlen;
}
@ -2374,13 +2375,13 @@ char **browser_init(const char *path, int *longest, size_t *numents, DIR
i = 0;
while ((next = readdir(dir)) != NULL && i < *numents) {
while ((nextdir = readdir(dir)) != NULL && i < *numents) {
/* Don't show the "." entry. */
if (strcmp(next->d_name, ".") == 0)
if (strcmp(nextdir->d_name, ".") == 0)
continue;
filelist[i] = charalloc(path_len + strlen(next->d_name) + 1);
sprintf(filelist[i], "%s%s", path, next->d_name);
filelist[i] = charalloc(path_len + strlen(nextdir->d_name) + 1);
sprintf(filelist[i], "%s%s", path, nextdir->d_name);
i++;
}

View File

@ -649,18 +649,18 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
int nanogetstr(bool allow_tabs, const char *buf, const char *def,
#ifndef NANO_SMALL
historyheadtype *history_list,
historyheadtype *history_list,
#endif
const shortcut *s
const shortcut *s
#ifndef DISABLE_TABCOMP
, bool *list
, bool *list
#endif
);
);
int statusq(bool allow_tabs, const shortcut *s, const char *def,
#ifndef NANO_SMALL
historyheadtype *history_list,
historyheadtype *history_list,
#endif
const char *msg, ...);
const char *msg, ...);
void statusq_abort(void);
void titlebar(const char *path);
void set_modified(void);

View File

@ -2652,9 +2652,9 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def,
* completion. */
int statusq(bool allow_tabs, const shortcut *s, const char *def,
#ifndef NANO_SMALL
historyheadtype *which_history,
historyheadtype *history_list,
#endif
const char *msg, ...)
const char *msg, ...)
{
va_list ap;
char *foo = charalloc(((COLS - 4) * mb_cur_max()) + 1);
@ -2672,7 +2672,7 @@ int statusq(bool allow_tabs, const shortcut *s, const char *def,
ret = nanogetstr(allow_tabs, foo, def,
#ifndef NANO_SMALL
which_history,
history_list,
#endif
s
#ifndef DISABLE_TABCOMP