cosmetic and formatting fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3277 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
24e0a465c1
commit
fc8e5cb0f2
|
@ -24,6 +24,9 @@ CVS code -
|
||||||
- chars.c:
|
- chars.c:
|
||||||
mbstrchr()
|
mbstrchr()
|
||||||
- Make parameter c const. (DLR)
|
- Make parameter c const. (DLR)
|
||||||
|
- files.c:
|
||||||
|
is_dir()
|
||||||
|
- Rename parameter ret to retval, for consistency. (DLR)
|
||||||
- utils.c:
|
- utils.c:
|
||||||
ngetdelim()
|
ngetdelim()
|
||||||
- Do sanity checks manually again instead of in an assert, and
|
- Do sanity checks manually again instead of in an assert, and
|
||||||
|
|
16
src/files.c
16
src/files.c
|
@ -3,7 +3,7 @@
|
||||||
* files.c *
|
* files.c *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 1999-2004 Chris Allegretta *
|
* Copyright (C) 1999-2004 Chris Allegretta *
|
||||||
* Copyright (C) 2005 David Lawrence Ramsey *
|
* Copyright (C) 2005-2006 David Lawrence Ramsey *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
* the Free Software Foundation; either version 2, or (at your option) *
|
* the Free Software Foundation; either version 2, or (at your option) *
|
||||||
|
@ -1954,15 +1954,14 @@ int is_dir(const char *buf)
|
||||||
{
|
{
|
||||||
char *dirptr = real_dir_from_tilde(buf);
|
char *dirptr = real_dir_from_tilde(buf);
|
||||||
struct stat fileinfo;
|
struct stat fileinfo;
|
||||||
|
int retval = (stat(dirptr, &fileinfo) != -1 &&
|
||||||
int ret = (stat(dirptr, &fileinfo) != -1 &&
|
|
||||||
S_ISDIR(fileinfo.st_mode));
|
S_ISDIR(fileinfo.st_mode));
|
||||||
|
|
||||||
assert(buf != NULL && dirptr != buf);
|
assert(buf != NULL && dirptr != buf);
|
||||||
|
|
||||||
free(dirptr);
|
free(dirptr);
|
||||||
|
|
||||||
return ret;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* These functions, username_tab_completion(), cwd_tab_completion()
|
/* These functions, username_tab_completion(), cwd_tab_completion()
|
||||||
|
@ -2078,9 +2077,8 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
|
||||||
#endif
|
#endif
|
||||||
/* See if this matches. */
|
/* See if this matches. */
|
||||||
if (strncmp(nextdir->d_name, filename, filenamelen) == 0 &&
|
if (strncmp(nextdir->d_name, filename, filenamelen) == 0 &&
|
||||||
(*filename == '.' ||
|
(*filename == '.' || (strcmp(nextdir->d_name, ".") !=
|
||||||
(strcmp(nextdir->d_name, ".") != 0 &&
|
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... */
|
||||||
|
|
||||||
|
@ -2101,8 +2099,8 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
|
||||||
free(tmp2);
|
free(tmp2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
matches = (char **)nrealloc(matches,
|
matches = (char **)nrealloc(matches, (*num_matches + 1) *
|
||||||
(*num_matches + 1) * sizeof(char *));
|
sizeof(char *));
|
||||||
matches[*num_matches] = mallocstrcpy(NULL, nextdir->d_name);
|
matches[*num_matches] = mallocstrcpy(NULL, nextdir->d_name);
|
||||||
++(*num_matches);
|
++(*num_matches);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue