tUse EXIT_FAILURE and EXIT_SUCCESS - ratox - FIFO based tox client
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 0aa1d26ad3957de8737de94d9c70c59f9329894a
 (DIR) parent 7420a01a8f96b1e6f9db9fcd6fd1a566e00cb628
 (HTM) Author: sin <sin@2f30.org>
       Date:   Mon, 15 Sep 2014 15:48:08 +0100
       
       Use EXIT_FAILURE and EXIT_SUCCESS
       
       Diffstat:
         M ratatox.c                           |      40 ++++++++++++++++----------------
       
       1 file changed, 20 insertions(+), 20 deletions(-)
       ---
 (DIR) diff --git a/ratatox.c b/ratatox.c
       t@@ -189,7 +189,7 @@ cb_conn_status(Tox *tox, int32_t fid, uint8_t status, void *udata)
                r = tox_get_name(tox, fid, name);
                if (r < 0) {
                        fprintf(stderr, "tox_get_name() on fid %d failed\n", fid);
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
                name[r] = '\0';
        
       t@@ -231,7 +231,7 @@ cb_friend_request(Tox *tox, const uint8_t *id, const uint8_t *data, uint16_t len
                req = calloc(1, sizeof(*req));
                if (!req) {
                        perror("calloc");
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
                memcpy(req->id, id, TOX_CLIENT_ID_SIZE);
                id2str(req->id, req->idstr);
       t@@ -240,7 +240,7 @@ cb_friend_request(Tox *tox, const uint8_t *id, const uint8_t *data, uint16_t len
                        req->msgstr = malloc(len + 1);
                        if (!req->msgstr) {
                                perror("malloc");
       -                        exit(1);
       +                        exit(EXIT_FAILURE);
                        }
                        memcpy(req->msgstr, data, len);
                        req->msgstr[len] = '\0';
       t@@ -306,7 +306,7 @@ again:
                        if (errno == EINTR)
                                goto again;
                        perror("read");
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
                if (buf[n - 1] == '\n')
                        n--;
       t@@ -332,17 +332,17 @@ dataload(void)
                data = malloc(sz);
                if (!data) {
                        perror("malloc");
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
        
                if (fread(data, 1, sz, fp) != sz || ferror(fp)) {
                        fprintf(stderr, "failed to read %s\n", DATAFILE);
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
                r = tox_load(tox, data, sz);
                if (r < 0) {
                        fprintf(stderr, "tox_load() failed\n");
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
                if (r == 1)
                        printf("Found encrypted data in %s\n", DATAFILE);
       t@@ -361,20 +361,20 @@ datasave(void)
                fp = fopen(DATAFILE, "w");
                if (!fp) {
                        fprintf(stderr, "can't open %s for writing\n", DATAFILE);
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
        
                sz = tox_size(tox);
                data = malloc(sz);
                if (!data) {
                        perror("malloc");
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
        
                tox_save(tox, data);
                if (fwrite(data, 1, sz, fp) != sz || ferror(fp)) {
                        fprintf(stderr, "failed to write %s\n", DATAFILE);
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
        
                free(data);
       t@@ -454,13 +454,13 @@ friendcreate(int32_t fid)
                f = calloc(1, sizeof(*f));
                if (!f) {
                        perror("calloc");
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
        
                r = tox_get_name(tox, fid, f->namestr);
                if (r < 0) {
                        fprintf(stderr, "tox_get_name() on fid %d failed\n", fid);
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
                f->namestr[r] = '\0';
        
       t@@ -471,7 +471,7 @@ friendcreate(int32_t fid)
                r = mkdir(f->idstr, 0755);
                if (r < 0 && errno != EEXIST) {
                        perror("mkdir");
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
        
                for (i = 0; i < LEN(fifos); i++) {
       t@@ -480,12 +480,12 @@ friendcreate(int32_t fid)
                        r = mkfifo(path, fifos[i].mode);
                        if (r < 0 && errno != EEXIST) {
                                perror("mkfifo");
       -                        exit(1);
       +                        exit(EXIT_FAILURE);
                        }
                        r = open(path, fifos[i].flags, 0);
                        if (r < 0) {
                                perror("open");
       -                        exit(1);
       +                        exit(EXIT_FAILURE);
                        }
                        f->fd[i] = r;
                }
       t@@ -516,7 +516,7 @@ friendload(void)
                fids = malloc(sz);
                if (!fids) {
                        perror("malloc");
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
        
                tox_get_friendlist(tox, fids, sz);
       t@@ -674,7 +674,7 @@ again:
                        if (errno == EINTR)
                                goto again;
                        perror("read");
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
                if (n == 0)
                        return 0;
       t@@ -705,7 +705,7 @@ blabla(struct friend *f, const char *file, const char *mode,
                fp = fopen(path, mode);
                if (!fp) {
                        perror("fopen");
       -                exit(1);
       +                exit(EXIT_FAILURE);
                }
                va_start(ap, fmt);
                vfprintf(fp, fmt, ap);
       t@@ -762,7 +762,7 @@ loop(void)
                                if (errno == EINTR)
                                        continue;
                                perror("select");
       -                        exit(1);
       +                        exit(EXIT_FAILURE);
                        }
                        if (n == 0)
                                continue;
       t@@ -793,5 +793,5 @@ main(void)
                toxinit();
                friendload();
                loop();
       -        return 0;
       +        return EXIT_SUCCESS;
        }