return *ch;
}
-static int
-canopendir(char *path)
-{
- static DIR *dirp;
-
- dirp = opendir(path);
- if (dirp == NULL)
- return 0;
- closedir(dirp);
- return 1;
-}
-
/*
* Returns "dir/name or "/name"
*/
printw("%s\n", g_buf);
}
-static char*
+static char *
coolsize(off_t size)
{
static const char * const U[]
static regex_t re;
/* Can fail when permissions change while browsing */
- if (canopendir(path) == 0)
+ if (access(path, R_OK) == -1)
return -1;
/* Search filter */
}
dir = xdirname(path);
- if (canopendir(dir) == 0) {
+ if (access(dir, R_OK) == -1) {
printwarn();
goto nochange;
}
switch (sb.st_mode & S_IFMT) {
case S_IFDIR:
- if (canopendir(newpath) == 0) {
+ if (access(newpath, R_OK) == -1) {
printwarn();
goto nochange;
}
}
dir = xdirname(dir);
- if (canopendir(dir) == 0) {
+ if (access(dir, R_OK) == -1) {
printwarn();
free(input);
goto nochange;
free(input);
- if (canopendir(newpath) == 0) {
+ if (access(newpath, R_OK) == -1) {
printwarn();
break;
}
goto nochange;
}
- if (canopendir(tmp) == 0) {
+ if (access(tmp, R_OK) == -1) {
printwarn();
goto nochange;
}
presel = FILTER;
goto begin;
case SEL_CDBEGIN:
- if (canopendir(ipath) == 0) {
+ if (access(ipath, R_OK) == -1) {
printwarn();
goto nochange;
}
if (lastdir[0] == '\0')
break;
- if (canopendir(lastdir) == 0) {
+ if (access(lastdir, R_OK) == -1) {
printwarn();
goto nochange;
}
mkpath(path, bookmark[r].loc,
newpath, PATH_MAX);
- if (canopendir(newpath) == 0) {
+ if (access(newpath, R_OK) == -1) {
printwarn();
goto nochange;
}
signal(SIGINT, SIG_IGN);
/* Test initial path */
- if (canopendir(ipath) == 0) {
+ if (access(ipath, R_OK) == -1) {
fprintf(stderr, "%s: %s\n", ipath, strerror(errno));
exit(1);
}