still more miscellaneous minor fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3748 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2006-07-05 05:14:11 +00:00
parent ca53a6e35a
commit f1a8e7221d
1 changed files with 8 additions and 9 deletions

View File

@ -434,15 +434,14 @@ char *do_browse_from(const char *inpath)
/* Set filelist to the list of files contained in the directory path, /* Set filelist to the list of files contained in the directory path,
* set filelist_len to the number of files in that list, set longest to * set filelist_len to the number of files in that list, set longest to
* the width in columns of the longest filename in that list (between 15 * the width in columns of the longest filename in that list (between 15
* and COLS, and at least 15), and set width to the number of files that * and COLS), and set width to the number of files that we can display
* we can display per line. longest needs to be at least 15 columns in * per line. longest needs to be at least 15 columns in order to
* order to display ".. (parent dir)", as Pico does. Assume path exists * display ".. (parent dir)", as Pico does. Assume path exists and is a
* and is a directory. */ * directory. */
void browser_init(const char *path, DIR *dir) void browser_init(const char *path, DIR *dir)
{ {
const struct dirent *nextdir; const struct dirent *nextdir;
size_t i = 0; size_t i = 0, path_len = strlen(path);
size_t path_len = strlen(path);
int col = 0; int col = 0;
/* The maximum number of columns that the filenames will take /* The maximum number of columns that the filenames will take
* up. */ * up. */
@ -501,11 +500,11 @@ void browser_init(const char *path, DIR *dir)
closedir(dir); closedir(dir);
/* Make sure longest is between 15 and COLS, and at least 15. */ /* Make sure longest is between 15 and COLS. */
if (longest > COLS)
longest = COLS;
if (longest < 15) if (longest < 15)
longest = 15; longest = 15;
if (longest > COLS)
longest = COLS;
/* Set width to zero, just before we initialize it. */ /* Set width to zero, just before we initialize it. */
width = 0; width = 0;