Move path[], oldpath[] and fltr[] inside browse()

This commit is contained in:
sin 2016-02-10 15:32:41 +00:00
parent 5456b8a36a
commit 5629b49113
1 changed files with 7 additions and 7 deletions

14
noice.c
View File

@ -81,8 +81,6 @@ struct entry {
/* Global context */ /* Global context */
struct entry *dents; struct entry *dents;
int ndents, cur; int ndents, cur;
char path[PATH_MAX], oldpath[PATH_MAX];
char fltr[LINE_MAX];
int idle; int idle;
/* /*
@ -486,7 +484,7 @@ dentfind(struct entry *dents, int n, char *cwd, char *path)
} }
int int
populate(void) populate(char *path, char *oldpath, char *fltr)
{ {
regex_t re; regex_t re;
int r; int r;
@ -515,7 +513,7 @@ populate(void)
} }
void void
redraw(void) redraw(char *path)
{ {
char cwd[PATH_MAX], cwdresolved[PATH_MAX]; char cwd[PATH_MAX], cwdresolved[PATH_MAX];
size_t ncols; size_t ncols;
@ -565,7 +563,8 @@ redraw(void)
void void
browse(char *ipath, char *ifilter) browse(char *ipath, char *ifilter)
{ {
char newpath[PATH_MAX]; char path[PATH_MAX], oldpath[PATH_MAX], newpath[PATH_MAX];
char fltr[LINE_MAX];
char *bin, *dir, *tmp, *run, *env; char *bin, *dir, *tmp, *run, *env;
struct stat sb; struct stat sb;
regex_t re; regex_t re;
@ -573,15 +572,16 @@ browse(char *ipath, char *ifilter)
strlcpy(path, ipath, sizeof(path)); strlcpy(path, ipath, sizeof(path));
strlcpy(fltr, ifilter, sizeof(fltr)); strlcpy(fltr, ifilter, sizeof(fltr));
oldpath[0] = '\0';
begin: begin:
r = populate(); r = populate(path, oldpath, fltr);
if (r == -1) { if (r == -1) {
printwarn(); printwarn();
goto nochange; goto nochange;
} }
for (;;) { for (;;) {
redraw(); redraw(path);
nochange: nochange:
switch (nextsel(&run, &env)) { switch (nextsel(&run, &env)) {
case SEL_QUIT: case SEL_QUIT: