Commit 546f5b3d authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

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
No related merge requests found
Showing with 32 additions and 26 deletions
+32 -26
...@@ -27,6 +27,8 @@ CVS code - ...@@ -27,6 +27,8 @@ CVS code -
write_file() write_file()
- Since lineswritten is a size_t, print its value as an unsigned - Since lineswritten is a size_t, print its value as an unsigned
long instead of an unsigned int. (DLR) long instead of an unsigned int. (DLR)
cwd_tab_completion(), browser_init()
- Rename variable next to nextdir to avoid confusion. (DLR)
do_browser() do_browser()
- Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for - Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for
consistency. (DLR) consistency. (DLR)
...@@ -52,6 +54,9 @@ CVS code - ...@@ -52,6 +54,9 @@ CVS code -
num_of_digits() num_of_digits()
- Use a size_t instead of an int, and rename to digits(). (DLR) - Use a size_t instead of an int, and rename to digits(). (DLR)
- winio.c: - winio.c:
statusq()
- Rename variable which_history to history_list, for
consistency. (DLR)
do_help() do_help()
- Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for - Don't treat NANO_CANCEL_KEY as NANO_EXIT_KEY anymore, for
consistency. (DLR) consistency. (DLR)
......
...@@ -2062,7 +2062,7 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t ...@@ -2062,7 +2062,7 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
size_t filenamelen; size_t filenamelen;
char **matches = NULL; char **matches = NULL;
DIR *dir; DIR *dir;
const struct dirent *next; const struct dirent *nextdir;
assert(dirname != NULL && num_matches != NULL && buflen >= 0); 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 ...@@ -2102,15 +2102,16 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
#endif #endif
filenamelen = strlen(filename); filenamelen = strlen(filename);
while ((next = readdir(dir)) != NULL) { while ((nextdir = readdir(dir)) != NULL) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "Comparing \'%s\'\n", next->d_name); fprintf(stderr, "Comparing \'%s\'\n", nextdir->d_name);
#endif #endif
/* See if this matches. */ /* See if this matches. */
if (strncmp(next->d_name, filename, filenamelen) == 0 && if (strncmp(nextdir->d_name, filename, filenamelen) == 0 &&
(*filename == '.' || (strcmp(next->d_name, ".") != 0 && (*filename == '.' ||
strcmp(next->d_name, "..") != 0))) { (strcmp(nextdir->d_name, ".") != 0 &&
strcmp(nextdir->d_name, "..") != 0))) {
/* Cool, found a match. Add it to the list. This makes a /* Cool, found a match. Add it to the list. This makes a
* lot more sense to me (Chris) this way... */ * 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 ...@@ -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 * the directory name to the beginning of the proposed match
* before we check it. */ * before we check it. */
char *tmp2 = charalloc(strlen(dirname) + 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)) { if (check_operating_dir(tmp2, TRUE)) {
free(tmp2); free(tmp2);
continue; continue;
...@@ -2133,7 +2134,7 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t ...@@ -2133,7 +2134,7 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
matches = (char **)nrealloc(matches, (*num_matches + 1) * matches = (char **)nrealloc(matches, (*num_matches + 1) *
sizeof(char *)); sizeof(char *));
matches[*num_matches] = mallocstrcpy(NULL, next->d_name); matches[*num_matches] = mallocstrcpy(NULL, nextdir->d_name);
++(*num_matches); ++(*num_matches);
} }
} }
...@@ -2341,7 +2342,7 @@ void striponedir(char *path) ...@@ -2341,7 +2342,7 @@ void striponedir(char *path)
char **browser_init(const char *path, int *longest, size_t *numents, DIR char **browser_init(const char *path, int *longest, size_t *numents, DIR
*dir) *dir)
{ {
const struct dirent *next; const struct dirent *nextdir;
char **filelist; char **filelist;
size_t i, path_len; size_t i, path_len;
...@@ -2351,15 +2352,15 @@ char **browser_init(const char *path, int *longest, size_t *numents, DIR ...@@ -2351,15 +2352,15 @@ char **browser_init(const char *path, int *longest, size_t *numents, DIR
i = 0; i = 0;
while ((next = readdir(dir)) != NULL) { while ((nextdir = readdir(dir)) != NULL) {
size_t dlen; size_t dlen;
/* Don't show the . entry. */ /* Don't show the . entry. */
if (strcmp(next->d_name, ".") == 0) if (strcmp(nextdir->d_name, ".") == 0)
continue; continue;
i++; i++;
dlen = strlenpt(next->d_name); dlen = strlenpt(nextdir->d_name);
if (dlen > *longest) if (dlen > *longest)
*longest = dlen; *longest = dlen;
} }
...@@ -2374,13 +2375,13 @@ char **browser_init(const char *path, int *longest, size_t *numents, DIR ...@@ -2374,13 +2375,13 @@ char **browser_init(const char *path, int *longest, size_t *numents, DIR
i = 0; i = 0;
while ((next = readdir(dir)) != NULL && i < *numents) { while ((nextdir = readdir(dir)) != NULL && i < *numents) {
/* Don't show the "." entry. */ /* Don't show the "." entry. */
if (strcmp(next->d_name, ".") == 0) if (strcmp(nextdir->d_name, ".") == 0)
continue; continue;
filelist[i] = charalloc(path_len + strlen(next->d_name) + 1); filelist[i] = charalloc(path_len + strlen(nextdir->d_name) + 1);
sprintf(filelist[i], "%s%s", path, next->d_name); sprintf(filelist[i], "%s%s", path, nextdir->d_name);
i++; i++;
} }
......
...@@ -2652,7 +2652,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, ...@@ -2652,7 +2652,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def,
* completion. */ * completion. */
int statusq(bool allow_tabs, const shortcut *s, const char *def, int statusq(bool allow_tabs, const shortcut *s, const char *def,
#ifndef NANO_SMALL #ifndef NANO_SMALL
historyheadtype *which_history, historyheadtype *history_list,
#endif #endif
const char *msg, ...) const char *msg, ...)
{ {
...@@ -2672,7 +2672,7 @@ int statusq(bool allow_tabs, const shortcut *s, const char *def, ...@@ -2672,7 +2672,7 @@ int statusq(bool allow_tabs, const shortcut *s, const char *def,
ret = nanogetstr(allow_tabs, foo, def, ret = nanogetstr(allow_tabs, foo, def,
#ifndef NANO_SMALL #ifndef NANO_SMALL
which_history, history_list,
#endif #endif
s s
#ifndef DISABLE_TABCOMP #ifndef DISABLE_TABCOMP
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment