diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-10-10 00:23:10 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-10-10 00:29:46 +0200 |
commit | 58e7ef40a6fc437f84b7761d2bf83acfc534ceb8 (patch) | |
tree | 57e60a788ce0e02413b80c00b09a6301fb738f51 /src/filelist.c | |
parent | b89a5f593d0a7739bb196be04af3d6c023f1b1d1 (diff) |
filelist.c, imlib.c: Simplify opt.quiet handling
Diffstat (limited to 'src/filelist.c')
-rw-r--r-- | src/filelist.c | 62 |
1 files changed, 28 insertions, 34 deletions
diff --git a/src/filelist.c b/src/filelist.c index 050246e..6439b9d 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -157,29 +157,26 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level) errno = 0; if (stat(path, &st)) { - /* Display useful error message */ - switch (errno) { - case ENOENT: - case ENOTDIR: - if (!opt.quiet) + if (!opt.quiet) { + switch (errno) { + case ENOENT: + case ENOTDIR: weprintf("%s does not exist - skipping", path); - break; - case ELOOP: - if (!opt.quiet) + break; + case ELOOP: weprintf("%s - too many levels of symbolic links - skipping", path); - break; - case EACCES: - if (!opt.quiet) + break; + case EACCES: weprintf("you don't have permission to open %s - skipping", path); - break; - case EOVERFLOW: - weprintf("Cannot open %s - EOVERFLOW.\n" - "Recompile with stat64=1 to fix this"); - break; - default: - if (!opt.quiet) + break; + case EOVERFLOW: + weprintf("Cannot open %s - EOVERFLOW.\n" + "Recompile with stat64=1 to fix this"); + break; + default: weprintf("couldn't open %s", path); - break; + break; + } } free(path); return; @@ -300,25 +297,22 @@ int feh_file_info_load(feh_file * file, Imlib_Image im) errno = 0; if (stat(file->filename, &st)) { - /* Display useful error message */ - switch (errno) { - case ENOENT: - case ENOTDIR: - if (!opt.quiet) + if (!opt.quiet) { + switch (errno) { + case ENOENT: + case ENOTDIR: weprintf("%s does not exist - skipping", file->filename); - break; - case ELOOP: - if (!opt.quiet) + break; + case ELOOP: weprintf("%s - too many levels of symbolic links - skipping", file->filename); - break; - case EACCES: - if (!opt.quiet) + break; + case EACCES: weprintf("you don't have permission to open %s - skipping", file->filename); - break; - default: - if (!opt.quiet) + break; + default: weprintf("couldn't open %s ", file->filename); - break; + break; + } } return(1); } |