Krolyxon
Commit 3a81af4

Branches

Refs →

nsxiv3a81af4

make use of EXIT_ macros

Author
rck
Date
2011-09-26 15:40 +0200
Parent
515e410
Commit
3a81af41ac3ebdcfa13f70cca0408b2d7acfff3f

+12 −12

4 files changed

  1. M commands.c +3 −3
  2. M main.c +3 −3
  3. M options.c +5 −5
  4. M util.c +1 −1
M commands.c View
@@ -48,7 +48,7 @@ extern int filecnt, fileidx;
4848
4949 bool it_quit(arg_t a) {
5050 cleanup();
51− exit(0);
51+ exit(EXIT_SUCCESS);
5252 }
5353
5454 bool it_switch_mode(arg_t a) {
@@ -388,7 +388,7 @@ bool it_open_with(arg_t a) {
388388 execlp(prog, prog,
389389 files[mode == MODE_IMAGE ? fileidx : tns.sel].path, NULL);
390390 warn("could not exec: %s", prog);
391− exit(1);
391+ exit(EXIT_FAILURE);
392392 } else if (pid < 0) {
393393 warn("could not fork. program was: %s", prog);
394394 }
@@ -415,7 +415,7 @@ bool it_shell_cmd(arg_t a) {
415415 if ((pid = fork()) == 0) {
416416 execl("/bin/sh", "/bin/sh", "-c", cmdline, NULL);
417417 warn("could not exec: /bin/sh. command line was: %s", cmdline);
418− exit(1);
418+ exit(EXIT_FAILURE);
419419 } else if (pid < 0) {
420420 warn("could not fork. command line was: %s", cmdline);
421421 return false;
M main.c View
@@ -471,12 +471,12 @@ int main(int argc, char **argv) {
471471 if (options->clean_cache) {
472472 tns_init(&tns, 0, NULL);
473473 tns_clean_cache(&tns);
474− exit(0);
474+ exit(EXIT_SUCCESS);
475475 }
476476
477477 if (!options->filecnt) {
478478 print_usage();
479− exit(1);
479+ exit(EXIT_FAILURE);
480480 }
481481
482482 if (options->recursive || options->from_stdin)
@@ -526,7 +526,7 @@ int main(int argc, char **argv) {
526526
527527 if (!fileidx) {
528528 fprintf(stderr, "sxiv: no valid image file given, aborting\n");
529− exit(1);
529+ exit(EXIT_FAILURE);
530530 }
531531
532532 filecnt = fileidx;
M options.c View
@@ -75,7 +75,7 @@ void parse_options(int argc, char **argv) {
7575 switch (opt) {
7676 case '?':
7777 print_usage();
78− exit(1);
78+ exit(EXIT_FAILURE);
7979 case 'c':
8080 _options.clean_cache = true;
8181 break;
@@ -93,12 +93,12 @@ void parse_options(int argc, char **argv) {
9393 break;
9494 case 'h':
9595 print_usage();
96− exit(0);
96+ exit(EXIT_SUCCESS);
9797 case 'n':
9898 if (!sscanf(optarg, "%d", &t) || t < 1) {
9999 fprintf(stderr, "sxiv: invalid argument for option -n: %s\n",
100100 optarg);
101− exit(1);
101+ exit(EXIT_FAILURE);
102102 } else {
103103 _options.startnum = t - 1;
104104 }
@@ -120,7 +120,7 @@ void parse_options(int argc, char **argv) {
120120 break;
121121 case 'v':
122122 print_version();
123− exit(0);
123+ exit(EXIT_SUCCESS);
124124 case 'Z':
125125 _options.scalemode = SCALE_ZOOM;
126126 _options.zoom = 1.0;
@@ -130,7 +130,7 @@ void parse_options(int argc, char **argv) {
130130 if (!sscanf(optarg, "%d", &t) || t <= 0) {
131131 fprintf(stderr, "sxiv: invalid argument for option -z: %s\n",
132132 optarg);
133− exit(1);
133+ exit(EXIT_FAILURE);
134134 }
135135 _options.zoom = (float) t / 100.0;
136136 break;
M util.c View
@@ -87,7 +87,7 @@ void die(const char* fmt, ...) {
8787 va_end(args);
8888
8989 cleanup();
90− exit(1);
90+ exit(EXIT_FAILURE);
9191 }
9292
9393 ssize_t get_line(char **buf, size_t *n, FILE *stream) {