소스 검색

make use of EXIT_ macros

master
rck 13 년 전
부모
커밋
3a81af41ac
4개의 변경된 파일12개의 추가작업 그리고 12개의 파일을 삭제
  1. +3
    -3
      commands.c
  2. +3
    -3
      main.c
  3. +5
    -5
      options.c
  4. +1
    -1
      util.c

+ 3
- 3
commands.c 파일 보기

@@ -48,7 +48,7 @@ extern int filecnt, fileidx;


bool it_quit(arg_t a) { bool it_quit(arg_t a) {
cleanup(); cleanup();
exit(0);
exit(EXIT_SUCCESS);
} }


bool it_switch_mode(arg_t a) { bool it_switch_mode(arg_t a) {
@@ -388,7 +388,7 @@ bool it_open_with(arg_t a) {
execlp(prog, prog, execlp(prog, prog,
files[mode == MODE_IMAGE ? fileidx : tns.sel].path, NULL); files[mode == MODE_IMAGE ? fileidx : tns.sel].path, NULL);
warn("could not exec: %s", prog); warn("could not exec: %s", prog);
exit(1);
exit(EXIT_FAILURE);
} else if (pid < 0) { } else if (pid < 0) {
warn("could not fork. program was: %s", prog); warn("could not fork. program was: %s", prog);
} }
@@ -415,7 +415,7 @@ bool it_shell_cmd(arg_t a) {
if ((pid = fork()) == 0) { if ((pid = fork()) == 0) {
execl("/bin/sh", "/bin/sh", "-c", cmdline, NULL); execl("/bin/sh", "/bin/sh", "-c", cmdline, NULL);
warn("could not exec: /bin/sh. command line was: %s", cmdline); warn("could not exec: /bin/sh. command line was: %s", cmdline);
exit(1);
exit(EXIT_FAILURE);
} else if (pid < 0) { } else if (pid < 0) {
warn("could not fork. command line was: %s", cmdline); warn("could not fork. command line was: %s", cmdline);
return false; return false;


+ 3
- 3
main.c 파일 보기

@@ -471,12 +471,12 @@ int main(int argc, char **argv) {
if (options->clean_cache) { if (options->clean_cache) {
tns_init(&tns, 0, NULL); tns_init(&tns, 0, NULL);
tns_clean_cache(&tns); tns_clean_cache(&tns);
exit(0);
exit(EXIT_SUCCESS);
} }


if (!options->filecnt) { if (!options->filecnt) {
print_usage(); print_usage();
exit(1);
exit(EXIT_FAILURE);
} }


if (options->recursive || options->from_stdin) if (options->recursive || options->from_stdin)
@@ -526,7 +526,7 @@ int main(int argc, char **argv) {


if (!fileidx) { if (!fileidx) {
fprintf(stderr, "sxiv: no valid image file given, aborting\n"); fprintf(stderr, "sxiv: no valid image file given, aborting\n");
exit(1);
exit(EXIT_FAILURE);
} }


filecnt = fileidx; filecnt = fileidx;


+ 5
- 5
options.c 파일 보기

@@ -75,7 +75,7 @@ void parse_options(int argc, char **argv) {
switch (opt) { switch (opt) {
case '?': case '?':
print_usage(); print_usage();
exit(1);
exit(EXIT_FAILURE);
case 'c': case 'c':
_options.clean_cache = true; _options.clean_cache = true;
break; break;
@@ -93,12 +93,12 @@ void parse_options(int argc, char **argv) {
break; break;
case 'h': case 'h':
print_usage(); print_usage();
exit(0);
exit(EXIT_SUCCESS);
case 'n': case 'n':
if (!sscanf(optarg, "%d", &t) || t < 1) { if (!sscanf(optarg, "%d", &t) || t < 1) {
fprintf(stderr, "sxiv: invalid argument for option -n: %s\n", fprintf(stderr, "sxiv: invalid argument for option -n: %s\n",
optarg); optarg);
exit(1);
exit(EXIT_FAILURE);
} else { } else {
_options.startnum = t - 1; _options.startnum = t - 1;
} }
@@ -120,7 +120,7 @@ void parse_options(int argc, char **argv) {
break; break;
case 'v': case 'v':
print_version(); print_version();
exit(0);
exit(EXIT_SUCCESS);
case 'Z': case 'Z':
_options.scalemode = SCALE_ZOOM; _options.scalemode = SCALE_ZOOM;
_options.zoom = 1.0; _options.zoom = 1.0;
@@ -130,7 +130,7 @@ void parse_options(int argc, char **argv) {
if (!sscanf(optarg, "%d", &t) || t <= 0) { if (!sscanf(optarg, "%d", &t) || t <= 0) {
fprintf(stderr, "sxiv: invalid argument for option -z: %s\n", fprintf(stderr, "sxiv: invalid argument for option -z: %s\n",
optarg); optarg);
exit(1);
exit(EXIT_FAILURE);
} }
_options.zoom = (float) t / 100.0; _options.zoom = (float) t / 100.0;
break; break;


+ 1
- 1
util.c 파일 보기

@@ -87,7 +87,7 @@ void die(const char* fmt, ...) {
va_end(args); va_end(args);


cleanup(); cleanup();
exit(1);
exit(EXIT_FAILURE);
} }


ssize_t get_line(char **buf, size_t *n, FILE *stream) { ssize_t get_line(char **buf, size_t *n, FILE *stream) {


불러오는 중...
취소
저장