diff --git a/tests/args.c b/tests/args.c index e05509c40518fbe65a053941d1edb00056cbcd66..9f59c9012dc2e6fbbb89afc3e401d70ade82ee4d 100644 --- a/tests/args.c +++ b/tests/args.c @@ -1,3 +1,4 @@ +#include <stdlib.h> #include <string.h> #include <unistd.h> @@ -8,5 +9,5 @@ int main(int argc, char *argv[]) { write(STDOUT_FILENO, " ", 1); } write(STDOUT_FILENO, "\n", 1); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/dirent/main.c b/tests/dirent/main.c index 430626af706ac9650037390d1d3796179564d4a5..aa574ba7d3e319821fbd9ba2f248580557f4adb6 100644 --- a/tests/dirent/main.c +++ b/tests/dirent/main.c @@ -1,6 +1,7 @@ #include <dirent.h> #include <errno.h> #include <stdio.h> +#include <stdlib.h> int main(void) { printf("%lu\n", sizeof(struct dirent)); @@ -9,7 +10,7 @@ int main(void) { if (dir == NULL) { perror("opendir"); - return 1; + return EXIT_FAILURE; } struct dirent* entry; @@ -38,5 +39,5 @@ int main(void) { closedir(dir); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/dirent/scandir.c b/tests/dirent/scandir.c index 2b2ea03c2b338fc271cc31aa163a9dff72dba96c..8bbee0d13f8e2046a39f204079d0a2bc3c97713a 100644 --- a/tests/dirent/scandir.c +++ b/tests/dirent/scandir.c @@ -12,7 +12,7 @@ int main(void) { int len = scandir("example_dir/", &array, filter, alphasort); if (len < 0) { perror("scandir"); - return -1; + return EXIT_FAILURE; } for(int i = 0; i < len; i += 1) { diff --git a/tests/error.c b/tests/error.c index ac84c343b8cb517d605bf41fd4c9d4c2cabb8fbd..3bfd5217ff4115ce72f02d334d4d73150d141d6d 100644 --- a/tests/error.c +++ b/tests/error.c @@ -1,5 +1,6 @@ #include <unistd.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <errno.h> @@ -7,5 +8,5 @@ int main(void) { chdir("nonexistent"); printf("errno: %d = %s\n", errno, strerror(errno)); perror("perror"); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/fcntl/create.c b/tests/fcntl/create.c index 8e70cb6c608aff57f68c299cab6c67115bd9798b..c881270c2f3c79fccccbe1da3913d1677f0240e5 100644 --- a/tests/fcntl/create.c +++ b/tests/fcntl/create.c @@ -1,4 +1,5 @@ #include <fcntl.h> +#include <stdlib.h> #include <unistd.h> int main(void) { @@ -6,9 +7,9 @@ int main(void) { if (fd >= 0) { write(fd, "Hello World!\n", 13); close(fd); - return 0; + return EXIT_SUCCESS; } else { write(STDERR_FILENO, "creat failed\n", 13); - return 1; + return EXIT_FAILURE; } } diff --git a/tests/fcntl/fcntl.c b/tests/fcntl/fcntl.c index 474e163f563e302b250a4f9887269b3c5c83a35d..d6f85a9a46aa196ee9a5f34ad83f0a428d2bccfe 100644 --- a/tests/fcntl/fcntl.c +++ b/tests/fcntl/fcntl.c @@ -1,5 +1,6 @@ #include <fcntl.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> int main(void) { @@ -10,5 +11,5 @@ int main(void) { printf("fd %d duped into fd %d\n", newfd, newfd2); close(newfd); close(newfd2); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/libgen.c b/tests/libgen.c index fd79f5b9d6438e917768c275514a8ed3b056e4ff..4feee89bf02c899410107a7358d811634274b6bd 100644 --- a/tests/libgen.c +++ b/tests/libgen.c @@ -77,5 +77,5 @@ int main(void) { printf("Testing libgen.h\n"); test_basename(); test_dirname(); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/math.c b/tests/math.c index 014529f468315d55c38df71fd0e6802d45012505..b06109775567d638a2892bafc5174f817ecf21d4 100644 --- a/tests/math.c +++ b/tests/math.c @@ -1,9 +1,10 @@ #include <math.h> #include <stdio.h> +#include <stdlib.h> int main(void) { double pi = 3.14; float c = cos(pi); printf("cos(%f) = %f\n", pi, c); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/netdb/getaddrinfo.c b/tests/netdb/getaddrinfo.c index 3864d0d9903b788b4c3c49a6d5c440187b2d4b94..efe4c5dfece7e69dce9836fbf35ee4e5bb04388e 100644 --- a/tests/netdb/getaddrinfo.c +++ b/tests/netdb/getaddrinfo.c @@ -22,7 +22,7 @@ int main(void) { errcode = getaddrinfo("www.redox-os.org", NULL, &hints, &res); if (errcode != 0) { perror("getaddrinfo"); - return -1; + return EXIT_FAILURE; } while (res) { @@ -46,5 +46,5 @@ int main(void) { res = res->ai_next; } - return 0; + return EXIT_SUCCESS; } diff --git a/tests/pwd.c b/tests/pwd.c index 77087425efdf1c497a7ba4feb373a552a15d890b..029972c7b78bd3d97853b1688ac3bab2e166e124 100644 --- a/tests/pwd.c +++ b/tests/pwd.c @@ -19,7 +19,7 @@ int main(void) { struct passwd *pwd = getpwuid(0); if (errno != 0) { perror("getpwuid"); - return 1; + return EXIT_FAILURE; } if (pwd != NULL) { print(pwd); @@ -30,7 +30,7 @@ int main(void) { pwd = getpwnam("nobody"); if (errno != 0) { perror("getpwnam"); - return 1; + return EXIT_FAILURE; } if (pwd != NULL) { print(pwd); @@ -43,12 +43,12 @@ int main(void) { if (getpwuid_r(0, &pwd2, buf, 100, &result) < 0) { perror("getpwuid_r"); free(buf); - return 1; + return EXIT_FAILURE; } if (result != NULL) { if (result != &pwd2) { free(buf); - return 1; + return EXIT_FAILURE; } print(&pwd2); } @@ -57,12 +57,12 @@ int main(void) { if (getpwnam_r("nobody", &pwd2, buf, 100, &result) < 0) { perror("getpwuid_r"); free(buf); - return 1; + return EXIT_FAILURE; } if (result != NULL) { if (result != &pwd2) { free(buf); - return 1; + return EXIT_FAILURE; } print(&pwd2); } @@ -72,11 +72,11 @@ int main(void) { char buf2[1]; if (getpwuid_r(0, &pwd2, buf2, 1, &result) == 0) { puts("This shouldn't have succeeded, but did!"); - return 1; + return EXIT_FAILURE; } if (errno != ERANGE) { perror("getpwuid_r"); - return 1; + return EXIT_FAILURE; } puts("Returned ERANGE because the buffer was too small ðŸ‘"); } diff --git a/tests/regex.c b/tests/regex.c index b74a0f2ce69894e103bcf1841f7e2dffb2d23333..e920b601d367e113ccb46394393ab512d26c47ad 100644 --- a/tests/regex.c +++ b/tests/regex.c @@ -1,5 +1,6 @@ #include <regex.h> #include <stdio.h> +#include <stdlib.h> int main(void) { regex_t regex; @@ -10,7 +11,7 @@ int main(void) { regerror(error, ®ex, error_buf, 255); error_buf[255] = 0; printf("regcomp error: %d = %s\n", error, error_buf); - return -1; + return EXIT_FAILURE; } regmatch_t matches[3] = {{0}}; @@ -22,7 +23,7 @@ int main(void) { if (error) { regerror(error, ®ex, error_buf, 255); printf("regexec error: %d = %s\n", error, error_buf); - return -1; + return EXIT_FAILURE; } for (int group = 0; group < 3; group += 1) { diff --git a/tests/resource/getrusage.c b/tests/resource/getrusage.c index e04a623910bac07c7d55fc6d33ddc9c890aebe2c..1650dd6fc51ee91f439cf03ab2ee82db3b764611 100644 --- a/tests/resource/getrusage.c +++ b/tests/resource/getrusage.c @@ -10,7 +10,7 @@ int main(void) { struct rusage r_usage; if (getrusage(RUSAGE_SELF, &r_usage) < 0) { perror("getrusage"); - return 1; + return EXIT_FAILURE; } printf("ru_utime:"); ptimeval(&r_usage.ru_utime); diff --git a/tests/signal.c b/tests/signal.c index aa9a563e01a48924bc70b388eb8fb62e8d35c9a2..1a480045070f02e5b4263e89d5576e3d84019f20 100644 --- a/tests/signal.c +++ b/tests/signal.c @@ -1,5 +1,6 @@ #include <signal.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #include <errno.h> @@ -11,14 +12,14 @@ int main(void) { if (signal(SIGUSR1, &handler) == SIG_ERR) { puts("Signal error!"); printf("%d\n", errno); - return 1; + return EXIT_FAILURE; } puts("Raising..."); if (raise(SIGUSR1)) { puts("Raise error!"); printf("%d\n", errno); - return 1; + return EXIT_FAILURE; } puts("Raised."); } diff --git a/tests/stdio/all.c b/tests/stdio/all.c index c049e3eb0e8911e8dfb2c1115bd00ad505ce1b1a..33a5f905b12e137afaf34502bd9293b4ad657b29 100644 --- a/tests/stdio/all.c +++ b/tests/stdio/all.c @@ -9,5 +9,5 @@ int main(void) { printf("%s\n", fgets(in, 30, f)); setvbuf(stdout, 0, _IONBF, 0); printf("Hello\n"); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdio/fgets.c b/tests/stdio/fgets.c index 404002a8b2c3c4fe9d6f68ff19f713840fad304d..e48247b98f22b2ee521d1443e4d7e66c4cb84330 100644 --- a/tests/stdio/fgets.c +++ b/tests/stdio/fgets.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> int main(void) { //FILE *f = fopen("/etc/ssl/certs/ca-certificates.crt", "r"); @@ -12,7 +13,7 @@ int main(void) { puts("EOF"); if (!feof(f)) { puts("feof() not updated!"); - return -1; + return EXIT_FAILURE; } break; } diff --git a/tests/stdio/fputs.c b/tests/stdio/fputs.c index 2ce599203c685ab0b76aed48cd0a517778d8147c..74424b20ee862d5f718abc3466f32b0527cad733 100644 --- a/tests/stdio/fputs.c +++ b/tests/stdio/fputs.c @@ -7,5 +7,5 @@ int main(void) { char *in = "Hello World!"; fputs(in, f); // calls fwrite, helpers::fwritex, internal::to_write and internal::stdio_write fclose(f); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdio/fread.c b/tests/stdio/fread.c index f87e9172b164c24d1c1785645352430962d38fd7..6e95bc729180aad07c5a3b98271e60284da3499d 100644 --- a/tests/stdio/fread.c +++ b/tests/stdio/fread.c @@ -1,5 +1,6 @@ #include <errno.h> #include <stdio.h> +#include <stdlib.h> int main(void) { FILE *fp = fopen("stdio/fread.in", "rb"); @@ -8,7 +9,7 @@ int main(void) { for (int i = 1; i <= 32; ++i) { if (fread(buf, 1, i, fp) < 0) { perror("fread"); - return 0; + return EXIT_FAILURE; } buf[i] = 0; @@ -17,5 +18,5 @@ int main(void) { fclose(fp); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdio/freopen.c b/tests/stdio/freopen.c index 3189b7e64d256c6b773ebc898d4a8310137c5fd9..b68a858383ae3749bbc7144d71033594fb69d854 100644 --- a/tests/stdio/freopen.c +++ b/tests/stdio/freopen.c @@ -1,9 +1,10 @@ #include <stdio.h> +#include <stdlib.h> int main(void) { freopen("stdio/stdio.in", "r", stdin); char in[6]; fgets(in, 6, stdin); printf("%s\n", in); // should print Hello - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdio/fseek.c b/tests/stdio/fseek.c index eed59eca0c1632949cbe08101328e844dce2cd66..6f166928f309af64cf65e6ed5ddf71caf5bbf3f2 100644 --- a/tests/stdio/fseek.c +++ b/tests/stdio/fseek.c @@ -1,10 +1,11 @@ #include <stdio.h> +#include <stdlib.h> int main(void) { FILE *f = fopen("stdio/stdio.in", "r"); if (fseek(f, 14, SEEK_CUR) < 0) { puts("fseek error"); - return 1; + return EXIT_FAILURE; } char buffer[256]; printf("%s", fgets(buffer, 256, f)); diff --git a/tests/stdio/fwrite.c b/tests/stdio/fwrite.c index 37df8a75c91da1aaf9fae9822c23c6575c738aae..93f412413ca414dc3b2410b978cea3c51eb0f0e7 100644 --- a/tests/stdio/fwrite.c +++ b/tests/stdio/fwrite.c @@ -7,18 +7,18 @@ int main(void) { const char ptr[] = "Hello World!"; if (fwrite(ptr, 0, 17, f)) { - return -1; + return EXIT_FAILURE; } if (fwrite(ptr, 7, 0, f)) { - return -1; + return EXIT_FAILURE; } if (fwrite(ptr, 0, 0, f)) { - return -1; + return EXIT_FAILURE; } fwrite(ptr, sizeof(ptr), 1, f); fclose(f); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdio/getc_unget.c b/tests/stdio/getc_unget.c index 257170a04b522521f665409795c028e95a768906..55eb6bbb3ed8145c1aad876e854643438145ae58 100644 --- a/tests/stdio/getc_unget.c +++ b/tests/stdio/getc_unget.c @@ -1,12 +1,13 @@ #include <stdio.h> +#include <stdlib.h> int main(void) { ungetc('h', stdin); char c; if ((c = getchar()) == 'h') { printf("Worked!\n"); - return 0; + return EXIT_SUCCESS; } printf("failed :( %c\n", c); - return 0; + return EXIT_FAILURE; } diff --git a/tests/stdio/mutex.c b/tests/stdio/mutex.c index 04f7b386c9c59be66e0b59cf5b2281e39f96b5f3..d318ea3e2b372fb4d1c3ee8cf6e7b3022799d6a0 100644 --- a/tests/stdio/mutex.c +++ b/tests/stdio/mutex.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> int main(void) { FILE* f = fopen("stdio/stdio.in", "r"); @@ -10,17 +11,17 @@ int main(void) { if (!ftrylockfile(f)) { puts("Mutex unlocked but it shouldn't be"); - return -1; + return EXIT_FAILURE; } funlockfile(f); if (ftrylockfile(f)) { puts("Mutex locked but it shouldn't be"); - return -1; + return EXIT_FAILURE; } if (!ftrylockfile(f)) { puts("Mutex unlocked but it shouldn't be"); - return -1; + return EXIT_FAILURE; } funlockfile(f); } diff --git a/tests/stdio/popen.c b/tests/stdio/popen.c index 364b3753b5b9e332630e9f9b571c83ca48ccfc37..89f1d9a097d55348de1ead7ec42ea6bfe89ab852 100644 --- a/tests/stdio/popen.c +++ b/tests/stdio/popen.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> int main(void) { FILE *fp; @@ -9,7 +10,7 @@ int main(void) { fp = popen("ls -1 example_dir", "r"); if (fp == NULL) { perror("popen"); - return -1; + return EXIT_FAILURE; } while (fgets(path, 256, fp) != NULL) { @@ -20,10 +21,10 @@ int main(void) { status = pclose(fp); if (status == -1) { perror("pclose"); - return -1; + return EXIT_FAILURE; } else { printf("status %x\n", status); } - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdio/printf.c b/tests/stdio/printf.c index 833b39c84cf4fe2d0869d02e7b11bee7570e389a..ebe84e79d0d21367098199a75b3a6653520ed1c3 100644 --- a/tests/stdio/printf.c +++ b/tests/stdio/printf.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> int main(void) { int sofar = 0; @@ -48,5 +49,5 @@ int main(void) { printf("%G\n", 0.0001); printf("%G\n", 0.00001); printf("%E\n", 0.00001); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdio/rename.c b/tests/stdio/rename.c index 537b2dc6a46dd9f21a1602b80abb39e398ea0a67..df88c5f54f3da61a245dffe7b381348222709a28 100644 --- a/tests/stdio/rename.c +++ b/tests/stdio/rename.c @@ -1,5 +1,6 @@ #include <stdio.h> #include <fcntl.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> @@ -20,8 +21,8 @@ int main(void) { close(fd); remove(newpath); if (strcmp(str, buf) == 0) { - return 0; + return EXIT_SUCCESS; } else { - return -1; + return EXIT_FAILURE; } } diff --git a/tests/stdio/setvbuf.c b/tests/stdio/setvbuf.c index 46191f53cd35385967ecd685fdb03a89aba0af58..8d38913cf2c309179fda3acfdf80734ad95abbc3 100644 --- a/tests/stdio/setvbuf.c +++ b/tests/stdio/setvbuf.c @@ -10,5 +10,5 @@ int main(void) { char *in = malloc(30); printf("%s\n", fgets(in, 30, f)); printf("Hello\n"); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdio/sprintf.c b/tests/stdio/sprintf.c index 3205473e3babeede22dc6aec4382688a02b25c21..829ce59989af2905a0865859fdea9e19eb3c7a21 100644 --- a/tests/stdio/sprintf.c +++ b/tests/stdio/sprintf.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> #include <string.h> int main(void) { @@ -11,7 +12,7 @@ int main(void) { ); if (ret != 68) { printf("Failed! Return value was %d\n", ret); - return -1; + return EXIT_FAILURE; } memset(buffer, 0, sizeof(buffer)); @@ -24,7 +25,7 @@ int main(void) { ); if (ret != 86) { printf("Failed! Return value was %d\n", ret); - return -1; + return EXIT_FAILURE; } puts(buffer); diff --git a/tests/stdlib/a64l.c b/tests/stdlib/a64l.c index 14d44a9f83aaa9377894b662c1ec98c04da94f47..0ffb73effc6b91344d0f9e8ce20c4b3e9eea00a7 100644 --- a/tests/stdlib/a64l.c +++ b/tests/stdlib/a64l.c @@ -6,7 +6,7 @@ int main(void) { long l = a64l(s); if (l != 194301926) { printf("Invalid result: a64l(%s) = %ld\n", s, l); - return 1; + return EXIT_FAILURE; } printf("Correct a64l: %s = %ld\n", s, l); @@ -15,8 +15,8 @@ int main(void) { l = a64l(s); if (l != 53222) { printf("Invalid result: a64l(%s) = %ld\n", s, l); - return 1; + return EXIT_FAILURE; } printf("Correct a64l: %s = %ld\n", s, l); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdlib/alloc.c b/tests/stdlib/alloc.c index 85d6c9c07656d33ad00e46db276328c3b1a90af0..4e0b72de3d63e2d18613280b42f8cfbd9eaac17d 100644 --- a/tests/stdlib/alloc.c +++ b/tests/stdlib/alloc.c @@ -25,5 +25,5 @@ int main(void) { } free(ptra); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdlib/atof.c b/tests/stdlib/atof.c index 37f8d11299bd20144330dea1300154120223d24e..f686bd12c2b48e9f599b8285f132441e09bc0932 100644 --- a/tests/stdlib/atof.c +++ b/tests/stdlib/atof.c @@ -4,5 +4,5 @@ int main(void) { double d = atof("-3.14"); printf("%f\n", d); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdlib/atoi.c b/tests/stdlib/atoi.c index 8ce33962f0b8506c7af10888d60c405a5d57f83f..2960697f02e6d9e521f092c59a66c7428a63ec29 100644 --- a/tests/stdlib/atoi.c +++ b/tests/stdlib/atoi.c @@ -8,5 +8,5 @@ int main(void) { printf("%ld\n", atol(" -42")); printf("%ld\n", atol(" +555")); printf("%ld\n", atol(" 1234567890 ")); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdlib/bsearch.c b/tests/stdlib/bsearch.c index 9ccd1a7d4700dffe58129c06ca2d4899d59befeb..834e56e2cd043c81a3b6587ab815bb693b16107f 100644 --- a/tests/stdlib/bsearch.c +++ b/tests/stdlib/bsearch.c @@ -13,7 +13,7 @@ int int_cmp(const void* a, const void* b) { size_t i = 0; \ for (; i < len; ++i) printf("%d,", arr[i]); \ printf("] expected %p but got %p\n", (void*) expect, res); \ - return 1; \ + return EXIT_FAILURE; \ } \ } while (0); @@ -53,5 +53,5 @@ int main(void) { BSEARCH_TEST_INT(x, big, 7, NULL); printf("PASS bsearch\n"); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdlib/div.c b/tests/stdlib/div.c index 7752fb5d177be7433a483f3632538e100ace1e75..9939f07b47def02e67e6421f0d7f50cdd1449da6 100644 --- a/tests/stdlib/div.c +++ b/tests/stdlib/div.c @@ -18,6 +18,6 @@ int main(void) { _Exit(0); ; - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdlib/env.c b/tests/stdlib/env.c index 684e78bedf4abf757f951eaf32b0935b2c1d624f..83cd0b44fc569619445f88995b79b1166d137a40 100644 --- a/tests/stdlib/env.c +++ b/tests/stdlib/env.c @@ -34,7 +34,7 @@ int main(void) { if (env) { puts("This should be null, but isn't"); puts(env); - return 1; + return EXIT_FAILURE; } else { puts("Value deleted successfully!"); } diff --git a/tests/stdlib/mkostemps.c b/tests/stdlib/mkostemps.c index c3547f49c20e269dda5850f62c95df1c7e739d5e..5af996f6b35b9cd4e958211d718a425924a98798 100644 --- a/tests/stdlib/mkostemps.c +++ b/tests/stdlib/mkostemps.c @@ -23,5 +23,5 @@ int main(void) { } fclose(fp); remove(file_name); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdlib/mktemp.c b/tests/stdlib/mktemp.c index e2394f63603181f0b4696fdb53e7726204bebe73..02c2e72e26cd39a3b7e05b9b42afb28ed419214c 100644 --- a/tests/stdlib/mktemp.c +++ b/tests/stdlib/mktemp.c @@ -8,5 +8,5 @@ int main(void) { mktemp(string); printf("%s\n",string); free(string); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdlib/realpath.c b/tests/stdlib/realpath.c index 918874ee2366a118cb6d2b3ae713971d9eee7b1f..5bcea427178714057da5e6a43f33084fbb30b516 100644 --- a/tests/stdlib/realpath.c +++ b/tests/stdlib/realpath.c @@ -8,7 +8,7 @@ int main(void) { char* path = realpath("stdlib/realpath.c", NULL); if (!path) { perror("realpath"); - return -1; + return EXIT_FAILURE; } puts(path); @@ -21,7 +21,7 @@ int main(void) { if (!path) { perror("realpath"); free(path); - return -1; + return EXIT_FAILURE; } puts(path); diff --git a/tests/stdlib/strtol.c b/tests/stdlib/strtol.c index e98964ad5968d0bc9b7f298a9abcb24f6c02f31d..283a622c05d8673442c46babfa6b562a5449b9aa 100644 --- a/tests/stdlib/strtol.c +++ b/tests/stdlib/strtol.c @@ -27,5 +27,5 @@ int main(void) { printf("errno is not 0 (%d), something went wrong\n", errno); } - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdlib/strtoul.c b/tests/stdlib/strtoul.c index 2e7f3686730b770a0bc10c5a69a461d44251b010..d33ca9b7f8f392b715bcbce52499187438e0bffe 100644 --- a/tests/stdlib/strtoul.c +++ b/tests/stdlib/strtoul.c @@ -26,5 +26,5 @@ int main(void) { printf("errno is not 0 (%d), something went wrong\n", errno); } - return 0; + return EXIT_SUCCESS; } diff --git a/tests/stdlib/system.c b/tests/stdlib/system.c index 9acc8d6b3340f3a88837d3cb674682815091850a..9b3270eb79aab17730d6941f693721455976ced2 100644 --- a/tests/stdlib/system.c +++ b/tests/stdlib/system.c @@ -2,5 +2,5 @@ int main(void) { system("echo test of system"); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/string/mem.c b/tests/string/mem.c index 43424b81651134ff17c07977584006085ea1bb17..9c8db1e8c06d9bb73f35124e5d6d5b102299051f 100644 --- a/tests/string/mem.c +++ b/tests/string/mem.c @@ -9,7 +9,7 @@ int main(void) { arr[50] = 1; if ((size_t)memchr((void *)arr, 1, 100) - (size_t)arr != 50) { puts("Incorrect memchr"); - exit(1); + return EXIT_FAILURE; } puts("Correct memchr"); char arr2[51]; @@ -17,26 +17,26 @@ int main(void) { memccpy((void *)arr2, (void *)arr, 1, 100); if (arr[50] != 1) { puts("Incorrect memccpy"); - exit(1); + return EXIT_FAILURE; } puts("Correct memccpy"); int res; if ((res = memcmp("hello world", "hello world", 11))) { printf("Incorrect memcmp (1), expected 0 found %d\n", res); - exit(1); + return EXIT_FAILURE; } if ((res = memcmp("hello world", "hello worlt", 11)) >= 0) { printf("Incorrect memcmp (2), expected -, found %d\n", res); - exit(1); + return EXIT_FAILURE; } if ((res = memcmp("hello world", "hallo world", 5)) <= 0) { printf("Incorrect memcmp (3), expected +, found %d\n", res); - exit(1); + return EXIT_FAILURE; } if ((res = memcmp("hello world", "henlo world", 5)) >= 0) { printf("Incorrect memcmp (4), expected -, found %d\n", res); - exit(1); + return EXIT_FAILURE; } puts("Correct memcmp"); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/string/strcat.c b/tests/string/strcat.c index 2ccc932729e8bededd3a20ac0ad16651ab37fbf9..cb58004d1d37743ee7a852f69762ec1c6d6ebff3 100644 --- a/tests/string/strcat.c +++ b/tests/string/strcat.c @@ -1,5 +1,6 @@ #include <string.h> #include <stdio.h> +#include <stdlib.h> int main(void) { char dest1[12] = "hello"; @@ -8,5 +9,5 @@ int main(void) { char dest2[12] = "hello"; printf("%s\n", strncat(dest2, " world foobar", 6)); // should be hello world - return 0; + return EXIT_SUCCESS; } diff --git a/tests/string/strchr.c b/tests/string/strchr.c index 7ef4452eef095e05713d35b22a4a70197f163026..3273d88a7359758c3423555070d6d9815f8e96dc 100644 --- a/tests/string/strchr.c +++ b/tests/string/strchr.c @@ -1,10 +1,11 @@ #include <string.h> #include <stdio.h> +#include <stdlib.h> int main(void) { printf("%s\n", strchr("hello", 'e')); // should be ello printf("%s\n", strchr("world", 'l')); // should be ld printf("%i\n", strchr("world", 0) == NULL); // should be 1 - return 0; + return EXIT_SUCCESS; } diff --git a/tests/string/strcspn.c b/tests/string/strcspn.c index b9a81c8b28c86d30d78b8edcc8d3250b7bae7a84..8511b95cb96cff3234362e28899aa1f44fe7726a 100644 --- a/tests/string/strcspn.c +++ b/tests/string/strcspn.c @@ -1,10 +1,11 @@ #include <string.h> #include <stdio.h> +#include <stdlib.h> int main(void) { char *world = "world"; printf("%ld\n", strcspn("hello", world)); // should be 2 printf("%ld\n", strcspn("banana", world)); // should be 6 - return 0; + return EXIT_SUCCESS; } diff --git a/tests/string/strncmp.c b/tests/string/strncmp.c index 122a1ca64765861d451859942e24bf65a7ae768f..913200be7cd15cdc3659836c5d4fbbaa3360b7b0 100644 --- a/tests/string/strncmp.c +++ b/tests/string/strncmp.c @@ -1,5 +1,6 @@ #include <string.h> #include <stdio.h> +#include <stdlib.h> int main(void) { printf("%d\n", strncmp("a", "aa", 2)); @@ -9,5 +10,5 @@ int main(void) { printf("%d\n", strncmp("a", "c", 1)); printf("%d\n", strncmp("a", "a", 2)); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/string/strpbrk.c b/tests/string/strpbrk.c index 248ade939318e3eded8e855532c10455daa0531d..d61de169565023ea4c2f0f47949b042d769e613a 100644 --- a/tests/string/strpbrk.c +++ b/tests/string/strpbrk.c @@ -1,5 +1,6 @@ #include <string.h> #include <stdio.h> +#include <stdlib.h> int main(void) { char* source = "The quick drawn fix jumps over the lazy bug"; @@ -16,5 +17,5 @@ int main(void) { char* res3 = strpbrk(source, "404"); printf("%s\n", (res3) ? res3 : "NULL"); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/string/strrchr.c b/tests/string/strrchr.c index d999cacc4271b1df0ce4254cab834419bd6f0ab0..c8d2f65ad54dba6e15bd5eb7d48be74e2fab0cb7 100644 --- a/tests/string/strrchr.c +++ b/tests/string/strrchr.c @@ -1,5 +1,6 @@ #include <string.h> #include <stdio.h> +#include <stdlib.h> int main(void) { char s0[] = "hello, world"; @@ -7,15 +8,15 @@ int main(void) { if (ptr != &s0[10]) { printf("%p != %p\n", ptr, &s0[10]); printf("strrchr FAIL , exit with status code %d\n", 1); - return 1; + return EXIT_FAILURE; } char s1[] = ""; ptr = strrchr(s1, 'a'); if (ptr != NULL) { printf("%p != 0\n", ptr); printf("strrchr FAIL, exit with status code %d\n", 1); - return 1; + return EXIT_FAILURE; } printf("strrch PASS, exiting with status code %d\n", 0); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/string/strspn.c b/tests/string/strspn.c index 30caaaaf97bb93782e49d58e1baec23374e5be7c..cd9316fad739d7115d3c38057da157189cca993e 100644 --- a/tests/string/strspn.c +++ b/tests/string/strspn.c @@ -1,5 +1,6 @@ #include <string.h> #include <stdio.h> +#include <stdlib.h> int main(void) { char *hello = "hello"; @@ -9,5 +10,5 @@ int main(void) { printf("%lu\n", strspn(world, "wendy")); // should be 1 printf("%lu\n", strspn(banana, "apple")); // should be 0 - return 0; + return EXIT_SUCCESS; } diff --git a/tests/string/strstr.c b/tests/string/strstr.c index 90c8f349757b80e2afc943a7b83bcd772ebb3c24..1e9f38cf97d3c027a0f9e963382ab1f0fa61fed7 100644 --- a/tests/string/strstr.c +++ b/tests/string/strstr.c @@ -1,5 +1,6 @@ #include <string.h> #include <stdio.h> +#include <stdlib.h> int main(void) { printf("%s\n", strstr("In relibc we trust", "rust")); @@ -8,5 +9,5 @@ int main(void) { printf("%s\n", strstr("IN RELIBC WE TRUST", "rust")); printf("%s\n", strcasestr("IN RELIBC WE TRUST", "rust")); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/string/strtok.c b/tests/string/strtok.c index 6333f5c3b814b06fa461110d1b3c392147895fd8..cfa716fe7f1b9e7b99b03d6dd99839f1d82dda97 100644 --- a/tests/string/strtok.c +++ b/tests/string/strtok.c @@ -1,5 +1,6 @@ #include <string.h> #include <stdio.h> +#include <stdlib.h> int main(void) { char source[] = "I'd just like to interject for a moment. What you're referring to as Linux, " @@ -13,5 +14,5 @@ int main(void) { } } - return 0; + return EXIT_SUCCESS; } diff --git a/tests/string/strtok_r.c b/tests/string/strtok_r.c index 9238f0a185515291b79385c06c1e23d1ba21a6f8..2abe530b0efab7069482e3ad6ede12e261dd6442 100644 --- a/tests/string/strtok_r.c +++ b/tests/string/strtok_r.c @@ -1,5 +1,6 @@ #include <string.h> #include <stdio.h> +#include <stdlib.h> int main(void) { char source[] = "I'd just like to interject for a moment. What you're referring to as Linux, " @@ -14,5 +15,5 @@ int main(void) { } } - return 0; + return EXIT_SUCCESS; } diff --git a/tests/time/asctime.c b/tests/time/asctime.c index a76b032b23327cb959c95b129afaccb85d79a0ef..2624ec9b7be087bfdf7a73c61614b10afd32034d 100644 --- a/tests/time/asctime.c +++ b/tests/time/asctime.c @@ -10,7 +10,7 @@ int main(void) { char *time_string = asctime(time_info); if (time_string == NULL || strcmp(time_string, "Thu Jan 1 00:00:00 1970\n") != 0) { - exit(1); + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } diff --git a/tests/time/gmtime.c b/tests/time/gmtime.c index f8be76adcecbc4a0b174ac9345ecbe9bc6a21ac5..38d0b8d3471e45a3addf7d5cedf95036c9acda88 100644 --- a/tests/time/gmtime.c +++ b/tests/time/gmtime.c @@ -14,7 +14,7 @@ int main(void) { info->tm_year != expected.tm_year || info->tm_wday != expected.tm_wday || info->tm_yday != expected.tm_yday || info->tm_isdst != expected.tm_isdst || info->tm_gmtoff != expected.tm_gmtoff || strcmp(info->tm_zone, expected.tm_zone) != 0) { - exit(1); + return EXIT_FAILURE; } if (info->tm_sec != expected.tm_sec || info->tm_min != expected.tm_min || @@ -22,7 +22,7 @@ int main(void) { info->tm_year != expected.tm_year || info->tm_wday != expected.tm_wday || info->tm_yday != expected.tm_yday || info->tm_isdst != expected.tm_isdst || info->tm_gmtoff != expected.tm_gmtoff || strcmp(info->tm_zone, expected.tm_zone) != 0) { - exit(1); + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } diff --git a/tests/time/mktime.c b/tests/time/mktime.c index 94b96eb8c200f72b77a5fcc15129e28554ba05e1..eba83363c0c90cf9780e08b06ba70d865697c3b7 100644 --- a/tests/time/mktime.c +++ b/tests/time/mktime.c @@ -14,9 +14,9 @@ int check(time_t input) { t->tm_year, t->tm_yday, t->tm_mon, t->tm_mday, t->tm_wday, t->tm_hour, t->tm_min, t->tm_sec ); puts("Failed!"); - return -1; + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } int main(void) { @@ -31,7 +31,7 @@ int main(void) { time_t inputs[] = { -(day * 33), -day, -500, 0, 1531454950 }; for (int i = 0; i < 5; i += 1) { if (check(inputs[i])) { - return -1; + return EXIT_FAILURE; } } diff --git a/tests/time/time.c b/tests/time/time.c index 3fe2fc2322aeb65b95c579998d65ade59c9072f2..3c5aed66b7969c51576e79a6489546b30c888484 100644 --- a/tests/time/time.c +++ b/tests/time/time.c @@ -1,5 +1,6 @@ #include <time.h> #include <stdio.h> +#include <stdlib.h> int main(void) { struct timespec tm = {0, 0}; @@ -7,20 +8,20 @@ int main(void) { int cgt = clock_gettime(CLOCK_REALTIME, &tm); if (cgt == -1) { perror("clock_gettime"); - return 1; + return EXIT_FAILURE; } time_t t = time(NULL); if (t == (time_t)-1) { perror("time"); - return 1; + return EXIT_FAILURE; } clock_t c = clock(); if (c == (clock_t)-1) { perror("clock"); - return 1; + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/access.c b/tests/unistd/access.c index 2ba3d0184952a476dc68693bee8acaad7bc014e4..9de843b6d188d7f362d784c55b17e0b2005c00e0 100644 --- a/tests/unistd/access.c +++ b/tests/unistd/access.c @@ -1,14 +1,15 @@ #include <stdio.h> #include <unistd.h> +#include <stdlib.h> int main(void) { if (access("example_dir/1-never-gonna-give-you-up", R_OK | W_OK)) { perror("access"); - return 1; + return EXIT_FAILURE; } if (!access("example_dir/1-never-gonna-give-you-up", X_OK)) { puts("Accessing a file with X_OK worked even though it... probably... shouldn't?"); puts("Please run `chmod 644 example_dir/*` and try again."); - return 1; + return EXIT_FAILURE; } } diff --git a/tests/unistd/brk.c b/tests/unistd/brk.c index 60d3ad0d14c1c2e217f7fd7b43b5ff8ce52548d5..5b4ffc1418eb1f33298969b634adad2fccd4c8d2 100644 --- a/tests/unistd/brk.c +++ b/tests/unistd/brk.c @@ -1,8 +1,9 @@ #include <unistd.h> #include <stdio.h> +#include <stdlib.h> int main(void) { int status = brk((void*)100); printf("brk exited with status code %d\n", status); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/chdir.c b/tests/unistd/chdir.c index f0cd849af0858c5bc34c0336f8b589e885bb671f..eb8341eeb5c2f437461f78e58a26a3c587a253b7 100644 --- a/tests/unistd/chdir.c +++ b/tests/unistd/chdir.c @@ -12,5 +12,5 @@ int main(void) { getcwd(cwd2, 4096); printf("final cwd: %s\n", cwd2); free(cwd2); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/dup.c b/tests/unistd/dup.c index 10a56ea8828492d66a08e135498150f269e4bc0e..8a0ca9809e1b65a953024463ba88ddee094952a7 100644 --- a/tests/unistd/dup.c +++ b/tests/unistd/dup.c @@ -1,6 +1,7 @@ #include <unistd.h> #include <fcntl.h> #include <stdio.h> +#include <stdlib.h> int main(void) { creat("dup.out", 0777); @@ -13,5 +14,5 @@ int main(void) { dup2(fd3, 1); printf("hello fd %d", fd3); close(fd3); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/exec.c b/tests/unistd/exec.c index fd603471ef4d54b92dbaa33bbbc618b996e5ac4c..97eae0fed9f2593411982d7fe1c1f42cd3afdd63 100644 --- a/tests/unistd/exec.c +++ b/tests/unistd/exec.c @@ -1,9 +1,10 @@ #include <unistd.h> #include <stdio.h> +#include <stdlib.h> int main(void) { char* args[] = {"sh", "-c", "echo 'exec works :D'", NULL}; execv("/bin/sh", args); perror("execv"); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/fchdir.c b/tests/unistd/fchdir.c index 07256cf28c64a142b24ee9e782937fb05de10e12..b2b4b7d00d6759130ab46a68edcd43b4b3294c31 100644 --- a/tests/unistd/fchdir.c +++ b/tests/unistd/fchdir.c @@ -1,6 +1,7 @@ #include <unistd.h> #include <fcntl.h> #include <stdio.h> +#include <stdlib.h> int main(void) { int fd = open("..", 0, 0); @@ -8,5 +9,5 @@ int main(void) { status = fchdir(fd); printf("fchdir exited with status code %d\n", status); close(fd); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/fsync.c b/tests/unistd/fsync.c index b7d2f76d5880e908f7d6941c77e0264007c72080..0db9d00fcfe559cbb2327c4b30cbaba438591d58 100644 --- a/tests/unistd/fsync.c +++ b/tests/unistd/fsync.c @@ -1,6 +1,7 @@ #include <unistd.h> #include <fcntl.h> #include <stdio.h> +#include <stdlib.h> int main(void) { int fd = open(".", 0, 0); @@ -8,5 +9,5 @@ int main(void) { status = fsync(fd); printf("fsync exited with status code %d\n", status); close(fd); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/ftruncate.c b/tests/unistd/ftruncate.c index 05634015c18e47edc9e01a1736337be7b7a64a59..df2212cfb335066b88940d940f8fc11216178606 100644 --- a/tests/unistd/ftruncate.c +++ b/tests/unistd/ftruncate.c @@ -1,6 +1,7 @@ #include <unistd.h> #include <fcntl.h> #include <stdio.h> +#include <stdlib.h> int main(void) { int fd = creat("ftruncate.out", 0777); @@ -8,5 +9,5 @@ int main(void) { status = ftruncate(fd, 100); printf("ftruncate exited with status code %d\n", status); close(fd); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/getcwd.c b/tests/unistd/getcwd.c index fd5bd60cc5942e5157237eb5d008b831d6f906f9..f1e088f8ca762b4bb1f2cea9c070abc29c50a490 100644 --- a/tests/unistd/getcwd.c +++ b/tests/unistd/getcwd.c @@ -15,7 +15,7 @@ int main(void) { if (strcmp(first, second)) { puts("Not matching"); free(second); - return 1; + return EXIT_FAILURE; } free(second); diff --git a/tests/unistd/getid.c b/tests/unistd/getid.c index b6a8507dc29b5a72e2ae2870a57eabd89db19a41..e0719b4413a84c10b7af92ca79c35963f0640f1d 100644 --- a/tests/unistd/getid.c +++ b/tests/unistd/getid.c @@ -1,5 +1,6 @@ #include <unistd.h> #include <stdio.h> +#include <stdlib.h> int main(void) { gid_t egid = getegid(); @@ -11,5 +12,5 @@ int main(void) { uid_t uid = getuid(); printf("egid: %d, euid: %d, gid: %d, pgid: %d, pid: %d, ppid %d, uid %d\n", egid, euid, gid, pgid, pid, ppid, uid); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/link.c b/tests/unistd/link.c index 264c2dda5f8ec9c8a1e07f59e58629b21f832a5f..7c2af4565e43c68fc3c5f06ef2294bc9cfee257c 100644 --- a/tests/unistd/link.c +++ b/tests/unistd/link.c @@ -1,5 +1,6 @@ #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <sys/stat.h> #include <unistd.h> @@ -11,7 +12,7 @@ int main(void) { // Stat for the inode if (stat("unistd/link.c", &buf)) { perror("stat"); - return 1; + return EXIT_FAILURE; } unsigned long inode = buf.st_ino; printf("%ld\n", inode); @@ -19,7 +20,7 @@ int main(void) { // Create the link if (link("unistd/link.c", "link.out")) { perror("link"); - return 1; + return EXIT_FAILURE; } // Make sure inodes match @@ -37,10 +38,10 @@ int main(void) { // Remove link if (unlink("link.out")) { perror("unlink"); - return 1; + return EXIT_FAILURE; } if (!stat("link.out", &buf) || errno != ENOENT) { perror("stat"); - return 1; + return EXIT_FAILURE; } } diff --git a/tests/unistd/pathconf.c b/tests/unistd/pathconf.c index 77cb7d54664e063a17dc39116ad04b7b03452731..c878efb24e3b05ada40245ce3e854375d4061719 100644 --- a/tests/unistd/pathconf.c +++ b/tests/unistd/pathconf.c @@ -1,5 +1,6 @@ #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #define PC(N) { \ @@ -29,5 +30,5 @@ int main(void) { PC(ALLOC_SIZE_MIN); PC(SYMLINK_MAX); PC(2_SYMLINKS); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/pipe.c b/tests/unistd/pipe.c index 2e1edf2c9e0847f5c03e00d14fa111bb191040a8..320b3906d7415895523c4867e0acb5bc4a1f517c 100644 --- a/tests/unistd/pipe.c +++ b/tests/unistd/pipe.c @@ -1,5 +1,6 @@ //http://www2.cs.uregina.ca/~hamilton/courses/330/notes/unix/pipes/pipes.html #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <unistd.h> @@ -10,7 +11,7 @@ int main(void) { if (pipe(pip) < 0) { perror("pipe"); - return 1; + return EXIT_FAILURE; } pid = fork(); @@ -28,13 +29,13 @@ int main(void) { /* check result */ if (bytes < 0) { perror("pipe write"); - return 1; + return EXIT_FAILURE; } else if (bytes != strlen(outstring)) { fprintf(stderr, "pipe write: %d != %ld\n", bytes, strlen(outstring)); - return 1; + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } else /* parent : receives message from child */ { @@ -53,18 +54,18 @@ int main(void) { /* check result */ if (bytes < 0) { perror("pipe read"); - return 1; + return EXIT_FAILURE; } else if (bytes != strlen(outstring)) { fprintf(stderr, "pipe read: %d != %ld\n", bytes, strlen(outstring)); - return 1; + return EXIT_FAILURE; } else if (memcmp(instring, outstring, strlen(outstring)) != 0) { fprintf(stderr, "pipe read does not match pipe write\n"); - return 1; + return EXIT_FAILURE; } else { printf("%s\n", instring); } - return 0; + return EXIT_SUCCESS; } - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/rmdir.c b/tests/unistd/rmdir.c index 11a8bd646e21d5b18c9923246a2bfc697288ba53..2af003c3fe249b4ed2393809f6e0885f5c1c5bac 100644 --- a/tests/unistd/rmdir.c +++ b/tests/unistd/rmdir.c @@ -1,10 +1,11 @@ #include <unistd.h> #include <sys/stat.h> #include <stdio.h> +#include <stdlib.h> int main(void) { mkdir("foo", 0); int status = rmdir("foo"); printf("rmdir exited with status code %d\n", status); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/setid.c b/tests/unistd/setid.c index 78b01dda2e9dedb4e5366e1e3a20063b702f95ac..f267814d13d5c6d02c64ad66d3200a256d4b2809 100644 --- a/tests/unistd/setid.c +++ b/tests/unistd/setid.c @@ -22,5 +22,5 @@ int main(void) { perror( "setreuid" ); } printf("%d has euid %d and uid %d\n", getpid(), geteuid(), getuid()); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/sleep.c b/tests/unistd/sleep.c index df69754dd24e749c51bedd09a89955477ee4058e..ab27aa303bac783ad8f4b150c05185d83c5d71a0 100644 --- a/tests/unistd/sleep.c +++ b/tests/unistd/sleep.c @@ -1,6 +1,7 @@ #include <time.h> #include <unistd.h> #include <stdio.h> +#include <stdlib.h> int main(void) { sleep(2); @@ -10,5 +11,5 @@ int main(void) { struct timespec tm = {0, 10000}; nanosleep(&tm, NULL); perror("nanosleep"); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/stat.c b/tests/unistd/stat.c index a0775bc535095d22ac5c5e59a0001fc61e11c9b9..7287c0018ec37f5499abbe9f2612ca6880720d74 100644 --- a/tests/unistd/stat.c +++ b/tests/unistd/stat.c @@ -1,5 +1,6 @@ #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <sys/stat.h> #include <unistd.h> @@ -10,7 +11,7 @@ int main(void) { if (stat("unistd/stat.c", &buf)) { perror("stat"); - return 1; + return EXIT_FAILURE; } printf("st_size: %lu\n", buf.st_size); diff --git a/tests/unistd/sysconf.c b/tests/unistd/sysconf.c index 6e53ee3c407d7fe3df37fdb7a061700e60ec3964..9aca5f418795731fe910e464902d22745f87d4db 100644 --- a/tests/unistd/sysconf.c +++ b/tests/unistd/sysconf.c @@ -1,5 +1,6 @@ #include <errno.h> #include <stdio.h> +#include <stdlib.h> #include <unistd.h> #define SC(N) { \ @@ -22,5 +23,5 @@ int main(void) { SC(TTY_NAME_MAX); SC(SYMLOOP_MAX); SC(HOST_NAME_MAX); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/unistd/write.c b/tests/unistd/write.c index bfc52a920b9d0a34410ebb558e8457b8bce6ed74..e9af15ab7a76c04e3f8ce68b443eed395deece6e 100644 --- a/tests/unistd/write.c +++ b/tests/unistd/write.c @@ -1,6 +1,7 @@ +#include <stdlib.h> #include <unistd.h> int main(void) { write(STDOUT_FILENO, "Hello World!\n", 13); - return 0; + return EXIT_SUCCESS; } diff --git a/tests/waitpid.c b/tests/waitpid.c index 0a52eaa45a48ebba29d4d36f9b853522f1a972fc..5f94f5b7ca18147391af68166b21d427c00aca55 100644 --- a/tests/waitpid.c +++ b/tests/waitpid.c @@ -7,11 +7,11 @@ int main(void) { if (pid == 0) { // child sleep(1); - exit(0); + return EXIT_SUCCESS; } else { // parent int stat_loc; waitpid(pid, &stat_loc, 0); } - return 0; + return EXIT_SUCCESS; } diff --git a/tests/wchar/putwchar.c b/tests/wchar/putwchar.c index a777854a538b2de7c084b27843f1912acea3bfa2..0380d5ae335f07422759444207f03cb70f09cc1e 100644 --- a/tests/wchar/putwchar.c +++ b/tests/wchar/putwchar.c @@ -12,9 +12,9 @@ int main(void) { if (0xFFFFFFFFu == putwchar(wcs[i])) { printf("Unable to putwchar() the wide character.\n"); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } } - return 0; + return EXIT_SUCCESS; }