aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrck <dev.rck@gmail.com>2011-09-26 15:40:07 +0200
committerrck <dev.rck@gmail.com>2011-09-26 15:40:07 +0200
commit3a81af41ac3ebdcfa13f70cca0408b2d7acfff3f (patch)
treee3222555c9d7af07c78c2d79b9e1009a525e9f92
parent515e41045198074cc1b015c6296f536edbfedff5 (diff)
make use of EXIT_ macros
-rw-r--r--commands.c6
-rw-r--r--main.c6
-rw-r--r--options.c10
-rw-r--r--util.c2
4 files changed, 12 insertions, 12 deletions
diff --git a/commands.c b/commands.c
index 7eef1fc..6fb25fc 100644
--- a/commands.c
+++ b/commands.c
@@ -48,7 +48,7 @@ extern int filecnt, fileidx;
bool it_quit(arg_t a) {
cleanup();
- exit(0);
+ exit(EXIT_SUCCESS);
}
bool it_switch_mode(arg_t a) {
@@ -388,7 +388,7 @@ bool it_open_with(arg_t a) {
execlp(prog, prog,
files[mode == MODE_IMAGE ? fileidx : tns.sel].path, NULL);
warn("could not exec: %s", prog);
- exit(1);
+ exit(EXIT_FAILURE);
} else if (pid < 0) {
warn("could not fork. program was: %s", prog);
}
@@ -415,7 +415,7 @@ bool it_shell_cmd(arg_t a) {
if ((pid = fork()) == 0) {
execl("/bin/sh", "/bin/sh", "-c", cmdline, NULL);
warn("could not exec: /bin/sh. command line was: %s", cmdline);
- exit(1);
+ exit(EXIT_FAILURE);
} else if (pid < 0) {
warn("could not fork. command line was: %s", cmdline);
return false;
diff --git a/main.c b/main.c
index 26f9f65..7eec9eb 100644
--- a/main.c
+++ b/main.c
@@ -471,12 +471,12 @@ int main(int argc, char **argv) {
if (options->clean_cache) {
tns_init(&tns, 0, NULL);
tns_clean_cache(&tns);
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (!options->filecnt) {
print_usage();
- exit(1);
+ exit(EXIT_FAILURE);
}
if (options->recursive || options->from_stdin)
@@ -526,7 +526,7 @@ int main(int argc, char **argv) {
if (!fileidx) {
fprintf(stderr, "sxiv: no valid image file given, aborting\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
filecnt = fileidx;
diff --git a/options.c b/options.c
index 2a04071..201b7cd 100644
--- a/options.c
+++ b/options.c
@@ -75,7 +75,7 @@ void parse_options(int argc, char **argv) {
switch (opt) {
case '?':
print_usage();
- exit(1);
+ exit(EXIT_FAILURE);
case 'c':
_options.clean_cache = true;
break;
@@ -93,12 +93,12 @@ void parse_options(int argc, char **argv) {
break;
case 'h':
print_usage();
- exit(0);
+ exit(EXIT_SUCCESS);
case 'n':
if (!sscanf(optarg, "%d", &t) || t < 1) {
fprintf(stderr, "sxiv: invalid argument for option -n: %s\n",
optarg);
- exit(1);
+ exit(EXIT_FAILURE);
} else {
_options.startnum = t - 1;
}
@@ -120,7 +120,7 @@ void parse_options(int argc, char **argv) {
break;
case 'v':
print_version();
- exit(0);
+ exit(EXIT_SUCCESS);
case 'Z':
_options.scalemode = SCALE_ZOOM;
_options.zoom = 1.0;
@@ -130,7 +130,7 @@ void parse_options(int argc, char **argv) {
if (!sscanf(optarg, "%d", &t) || t <= 0) {
fprintf(stderr, "sxiv: invalid argument for option -z: %s\n",
optarg);
- exit(1);
+ exit(EXIT_FAILURE);
}
_options.zoom = (float) t / 100.0;
break;
diff --git a/util.c b/util.c
index 99166f8..517e02b 100644
--- a/util.c
+++ b/util.c
@@ -87,7 +87,7 @@ void die(const char* fmt, ...) {
va_end(args);
cleanup();
- exit(1);
+ exit(EXIT_FAILURE);
}
ssize_t get_line(char **buf, size_t *n, FILE *stream) {