revert erroneous change
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3776 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
87b37bde9b
Коммит
b08c9f004c
@ -34,8 +34,6 @@ CVS code -
|
|||||||
- After entering "..", select the directory we were in before
|
- After entering "..", select the directory we were in before
|
||||||
instead of the first filename in the list, as Pico does. (DLR)
|
instead of the first filename in the list, as Pico does. (DLR)
|
||||||
- Simplify screen update handling and exiting. (DLR)
|
- Simplify screen update handling and exiting. (DLR)
|
||||||
- Move the opening of path here from do_browse_from(), so that
|
|
||||||
we no longer need a DIR* parameter. (DLR)
|
|
||||||
do_browse_from()
|
do_browse_from()
|
||||||
- During the operating directory check, if path isn't NULL,
|
- During the operating directory check, if path isn't NULL,
|
||||||
don't bother freeing it before mallocstrcpy()ing operating_dir
|
don't bother freeing it before mallocstrcpy()ing operating_dir
|
||||||
|
@ -46,7 +46,7 @@ static bool search_last_file = FALSE;
|
|||||||
|
|
||||||
/* Our main file browser function. path is the tilde-expanded path to
|
/* Our main file browser function. path is the tilde-expanded path to
|
||||||
* start browsing from. */
|
* start browsing from. */
|
||||||
char *do_browser(char *path)
|
char *do_browser(char *path, DIR *dir)
|
||||||
{
|
{
|
||||||
char *retval = NULL;
|
char *retval = NULL;
|
||||||
int kbinput;
|
int kbinput;
|
||||||
@ -60,13 +60,6 @@ char *do_browser(char *path)
|
|||||||
/* The last answer the user typed on the statusbar. */
|
/* The last answer the user typed on the statusbar. */
|
||||||
size_t old_selected;
|
size_t old_selected;
|
||||||
/* The selected file we had before the current selected file. */
|
/* The selected file we had before the current selected file. */
|
||||||
DIR *dir;
|
|
||||||
|
|
||||||
/* If we have no path, or we can't open it, get out. */
|
|
||||||
if (path == NULL || (dir = opendir(path)) == NULL) {
|
|
||||||
beep();
|
|
||||||
goto cleanup_browser;
|
|
||||||
}
|
|
||||||
|
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
@ -377,16 +370,12 @@ char *do_browser(char *path)
|
|||||||
if (old_const_update)
|
if (old_const_update)
|
||||||
SET(CONST_UPDATE);
|
SET(CONST_UPDATE);
|
||||||
|
|
||||||
cleanup_browser:
|
|
||||||
if (path != NULL)
|
|
||||||
free(path);
|
free(path);
|
||||||
if (ans != NULL)
|
|
||||||
free(ans);
|
free(ans);
|
||||||
if (filelist != NULL) {
|
|
||||||
free_chararray(filelist, filelist_len);
|
free_chararray(filelist, filelist_len);
|
||||||
filelist = NULL;
|
filelist = NULL;
|
||||||
filelist_len = 0;
|
filelist_len = 0;
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -399,6 +388,7 @@ char *do_browse_from(const char *inpath)
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
char *path;
|
char *path;
|
||||||
/* This holds the tilde-expanded version of inpath. */
|
/* This holds the tilde-expanded version of inpath. */
|
||||||
|
DIR *dir = NULL;
|
||||||
|
|
||||||
assert(inpath != NULL);
|
assert(inpath != NULL);
|
||||||
|
|
||||||
@ -431,7 +421,17 @@ char *do_browse_from(const char *inpath)
|
|||||||
path = mallocstrcpy(path, operating_dir);
|
path = mallocstrcpy(path, operating_dir);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return do_browser(path);
|
if (path != NULL)
|
||||||
|
dir = opendir(path);
|
||||||
|
|
||||||
|
/* If we can't open the path, get out. */
|
||||||
|
if (dir == NULL) {
|
||||||
|
free(path);
|
||||||
|
beep();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return do_browser(path, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set filelist to the list of files contained in the directory path,
|
/* Set filelist to the list of files contained in the directory path,
|
||||||
|
@ -143,7 +143,7 @@ extern char *homedir;
|
|||||||
|
|
||||||
/* Public functions in browser.c. */
|
/* Public functions in browser.c. */
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
char *do_browser(char *path);
|
char *do_browser(char *path, DIR *dir);
|
||||||
char *do_browse_from(const char *inpath);
|
char *do_browse_from(const char *inpath);
|
||||||
void browser_init(const char *path, DIR *dir);
|
void browser_init(const char *path, DIR *dir);
|
||||||
void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key);
|
void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user