浏览代码

Merge branch 'cleanup' into 'master'

General test cleanups

See merge request redox-os/relibc!193
Jeremy Soller 6 年之前
父节点
当前提交
f19e029468
共有 100 个文件被更改,包括 211 次插入271 次删除
  1. 9 9
      CONTRIBUTING.md
  2. 1 1
      tests/alloca.c
  3. 1 2
      tests/args.c
  4. 1 1
      tests/arpainet.c
  5. 1 1
      tests/assert.c
  6. 1 1
      tests/constructor.c
  7. 5 4
      tests/ctype.c
  8. 1 1
      tests/destructor.c
  9. 3 4
      tests/dirent/main.c
  10. 2 2
      tests/dirent/scandir.c
  11. 1 2
      tests/error.c
  12. 4 3
      tests/fcntl/create.c
  13. 1 2
      tests/fcntl/fcntl.c
  14. 1 1
      tests/fnmatch.c
  15. 3 4
      tests/libgen.c
  16. 1 1
      tests/locale.c
  17. 1 2
      tests/math.c
  18. 1 3
      tests/netdb/getaddrinfo.c
  19. 1 1
      tests/netdb/netdb.c
  20. 9 9
      tests/pwd.c
  21. 4 3
      tests/regex.c
  22. 2 2
      tests/resource/getrusage.c
  23. 1 1
      tests/select.c
  24. 1 1
      tests/setjmp.c
  25. 4 3
      tests/signal.c
  26. 1 2
      tests/stdio/all.c
  27. 1 1
      tests/stdio/buffer.c
  28. 3 2
      tests/stdio/fgets.c
  29. 1 3
      tests/stdio/fputs.c
  30. 3 4
      tests/stdio/fread.c
  31. 1 2
      tests/stdio/freopen.c
  32. 3 2
      tests/stdio/fseek.c
  33. 4 5
      tests/stdio/fwrite.c
  34. 4 3
      tests/stdio/getc_unget.c
  35. 5 4
      tests/stdio/mutex.c
  36. 4 5
      tests/stdio/popen.c
  37. 1 2
      tests/stdio/printf.c
  38. 4 3
      tests/stdio/rename.c
  39. 1 1
      tests/stdio/scanf.c
  40. 1 2
      tests/stdio/setvbuf.c
  41. 4 3
      tests/stdio/sprintf.c
  42. 3 4
      tests/stdlib/a64l.c
  43. 1 3
      tests/stdlib/alloc.c
  44. 1 2
      tests/stdlib/atof.c
  45. 1 2
      tests/stdlib/atoi.c
  46. 2 3
      tests/stdlib/bsearch.c
  47. 3 7
      tests/stdlib/div.c
  48. 2 2
      tests/stdlib/env.c
  49. 1 2
      tests/stdlib/mkostemps.c
  50. 1 2
      tests/stdlib/mktemp.c
  51. 1 1
      tests/stdlib/rand.c
  52. 3 3
      tests/stdlib/realpath.c
  53. 1 1
      tests/stdlib/strtod.c
  54. 1 3
      tests/stdlib/strtol.c
  55. 1 3
      tests/stdlib/strtoul.c
  56. 1 2
      tests/stdlib/system.c
  57. 7 8
      tests/string/mem.c
  58. 1 3
      tests/string/strcat.c
  59. 1 3
      tests/string/strchr.c
  60. 1 1
      tests/string/strcpy.c
  61. 1 3
      tests/string/strcspn.c
  62. 1 3
      tests/string/strncmp.c
  63. 2 4
      tests/string/strpbrk.c
  64. 4 5
      tests/string/strrchr.c
  65. 1 3
      tests/string/strspn.c
  66. 1 3
      tests/string/strstr.c
  67. 1 3
      tests/string/strtok.c
  68. 1 3
      tests/string/strtok_r.c
  69. 1 1
      tests/strings.c
  70. 1 1
      tests/sys_utsname/uname.c
  71. 2 3
      tests/time/asctime.c
  72. 1 1
      tests/time/gettimeofday.c
  73. 3 4
      tests/time/gmtime.c
  74. 1 1
      tests/time/localtime.c
  75. 1 1
      tests/time/macros.c
  76. 5 4
      tests/time/mktime.c
  77. 2 1
      tests/time/strftime.c
  78. 5 6
      tests/time/time.c
  79. 1 1
      tests/time/times.c
  80. 4 3
      tests/unistd/access.c
  81. 1 2
      tests/unistd/brk.c
  82. 1 2
      tests/unistd/chdir.c
  83. 1 2
      tests/unistd/dup.c
  84. 1 2
      tests/unistd/exec.c
  85. 1 2
      tests/unistd/fchdir.c
  86. 1 2
      tests/unistd/fsync.c
  87. 1 2
      tests/unistd/ftruncate.c
  88. 2 2
      tests/unistd/getcwd.c
  89. 1 1
      tests/unistd/gethostname.c
  90. 1 2
      tests/unistd/getid.c
  91. 1 1
      tests/unistd/isatty.c
  92. 6 5
      tests/unistd/link.c
  93. 1 2
      tests/unistd/pathconf.c
  94. 10 12
      tests/unistd/pipe.c
  95. 1 2
      tests/unistd/rmdir.c
  96. 2 5
      tests/unistd/setid.c
  97. 1 2
      tests/unistd/sleep.c
  98. 3 2
      tests/unistd/stat.c
  99. 1 2
      tests/unistd/sysconf.c
  100. 1 2
      tests/unistd/write.c

+ 9 - 9
CONTRIBUTING.md

@@ -88,14 +88,14 @@ just in case, it'd be a good idea to map inputs to variables.
 #include "string.h"
 #include "string.h"
 #include "stdio.h"
 #include "stdio.h"
 
 
-int main() {
-	// Don't do this
-	printf("%d\n", strcspn("Hello", "Hi"));
-
-	// Do this
-	char *first = "Hello";
-	char *second = "Hi";
-	printf("%d\n", strcspn(first, second));
+int main(void) {
+    // Don't do this
+    printf("%d\n", strcspn("Hello", "Hi"));
+
+    // Do this
+    char *first = "Hello";
+    char *second = "Hi";
+    printf("%d\n", strcspn(first, second));
 }
 }
 ```
 ```
 
 
@@ -120,4 +120,4 @@ You can test against verified correct output with `make verify` in the tests
 directory. You will need to manually create the correct output and put it in the
 directory. You will need to manually create the correct output and put it in the
 tests/expected directory. Running any `make` commands in the tests directory
 tests/expected directory. Running any `make` commands in the tests directory
 will ***not*** rebuild relibc, so you'll need to go back to the root directory
 will ***not*** rebuild relibc, so you'll need to go back to the root directory
-if you need to rebuild relibc.
+if you need to rebuild relibc.

+ 1 - 1
tests/alloca.c

@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
     char *str = (char *) alloca(17);
     char *str = (char *) alloca(17);
 
 
     memset(str, 'A', 16);
     memset(str, 'A', 16);

+ 1 - 2
tests/args.c

@@ -1,12 +1,11 @@
 #include <string.h>
 #include <string.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-int main(int argc, char ** argv) {
+int main(int argc, char *argv[]) {
     int i;
     int i;
     for(i = 0; i < argc; i++) {
     for(i = 0; i < argc; i++) {
         write(STDOUT_FILENO, argv[i], strlen(argv[i]));
         write(STDOUT_FILENO, argv[i], strlen(argv[i]));
         write(STDOUT_FILENO, " ", 1);
         write(STDOUT_FILENO, " ", 1);
     }
     }
     write(STDOUT_FILENO, "\n", 1);
     write(STDOUT_FILENO, "\n", 1);
-    return 0;
 }
 }

+ 1 - 1
tests/arpainet.c

@@ -3,7 +3,7 @@
 #include <string.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     uint32_t hl = 0xBADFACED;
     uint32_t hl = 0xBADFACED;
     uint32_t nl = htonl(hl);
     uint32_t nl = htonl(hl);
     assert(nl == 0xEDACDFBA);
     assert(nl == 0xEDACDFBA);

+ 1 - 1
tests/assert.c

@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main() {
+int main(void) {
     assert(1 == 1);
     assert(1 == 1);
     assert(1 + 1 == 2);
     assert(1 + 1 == 2);
     puts("yay!");
     puts("yay!");

+ 1 - 1
tests/constructor.c

@@ -16,6 +16,6 @@ TEST(102)
 TEST(103)
 TEST(103)
 TEST(104)
 TEST(104)
 
 
-int main(int argc, char *argv[]) {
+int main(void) {
     puts("main");
     puts("main");
 }
 }

+ 5 - 4
tests/ctype.c

@@ -1,5 +1,6 @@
 #include <ctype.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 
 struct test_case {
 struct test_case {
     int c;
     int c;
@@ -289,12 +290,12 @@ size_t num_test_cases = sizeof(test_cases) / sizeof(struct test_case);
 
 
 #define CHECK_TEST(tc, fn, retval) \
 #define CHECK_TEST(tc, fn, retval) \
     if (fn(tc.c) != tc.fn) { \
     if (fn(tc.c) != tc.fn) { \
-        retval = -1; \
+        retval = EXIT_FAILURE; \
         printf("Unexpected result: " #fn "('%c') != %d // Char value: %d\n", tc.c, tc.fn, tc.c); \
         printf("Unexpected result: " #fn "('%c') != %d // Char value: %d\n", tc.c, tc.fn, tc.c); \
     }
     }
 
 
-int main(int argc, char* argv[]) {
-    int retval = 0;
+int main(void) {
+    int retval = EXIT_SUCCESS;
 
 
     for(int i = 0; i < num_test_cases; ++i) {
     for(int i = 0; i < num_test_cases; ++i) {
         struct test_case tc = test_cases[i];
         struct test_case tc = test_cases[i];
@@ -316,7 +317,7 @@ int main(int argc, char* argv[]) {
         CHECK_TEST(tc, toupper, retval);
         CHECK_TEST(tc, toupper, retval);
     }
     }
 
 
-    if (!retval) {
+    if (retval == EXIT_SUCCESS) {
         printf("Success: %d\n", retval);
         printf("Success: %d\n", retval);
     } else {
     } else {
         printf("Failure: %d\n", retval);
         printf("Failure: %d\n", retval);

+ 1 - 1
tests/destructor.c

@@ -16,6 +16,6 @@ TEST(102)
 TEST(103)
 TEST(103)
 TEST(104)
 TEST(104)
 
 
-int main(int argc, char *argv[]) {
+int main(void) {
     puts("main");
     puts("main");
 }
 }

+ 3 - 4
tests/dirent/main.c

@@ -1,15 +1,16 @@
 #include <dirent.h>
 #include <dirent.h>
 #include <errno.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 
-int main() {
+int main(void) {
     printf("%lu\n", sizeof(struct dirent));
     printf("%lu\n", sizeof(struct dirent));
 
 
     DIR* dir = opendir("example_dir/");
     DIR* dir = opendir("example_dir/");
 
 
     if (dir == NULL) {
     if (dir == NULL) {
         perror("opendir");
         perror("opendir");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
 
 
     struct dirent* entry;
     struct dirent* entry;
@@ -37,6 +38,4 @@ int main() {
     // puts(entry->d_name);
     // puts(entry->d_name);
 
 
     closedir(dir);
     closedir(dir);
-
-    return 0;
 }
 }

+ 2 - 2
tests/dirent/scandir.c

@@ -7,12 +7,12 @@ int filter(const struct dirent* dirent) {
     return strstr(dirent->d_name, "3") == NULL;
     return strstr(dirent->d_name, "3") == NULL;
 }
 }
 
 
-int main() {
+int main(void) {
     struct dirent** array;
     struct dirent** array;
     int len = scandir("example_dir/", &array, filter, alphasort);
     int len = scandir("example_dir/", &array, filter, alphasort);
     if (len < 0) {
     if (len < 0) {
         perror("scandir");
         perror("scandir");
-        return -1;
+        return EXIT_FAILURE;
     }
     }
 
 
     for(int i = 0; i < len; i += 1) {
     for(int i = 0; i < len; i += 1) {

+ 1 - 2
tests/error.c

@@ -3,9 +3,8 @@
 #include <string.h>
 #include <string.h>
 #include <errno.h>
 #include <errno.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     chdir("nonexistent");
     chdir("nonexistent");
     printf("errno: %d = %s\n", errno, strerror(errno));
     printf("errno: %d = %s\n", errno, strerror(errno));
     perror("perror");
     perror("perror");
-    return 0;
 }
 }

+ 4 - 3
tests/fcntl/create.c

@@ -1,14 +1,15 @@
 #include <fcntl.h>
 #include <fcntl.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
     int fd = creat("create.out", 0755);
     int fd = creat("create.out", 0755);
     if (fd >= 0) {
     if (fd >= 0) {
         write(fd, "Hello World!\n", 13);
         write(fd, "Hello World!\n", 13);
         close(fd);
         close(fd);
-        return 0;
+        return EXIT_SUCCESS;
     } else {
     } else {
         write(STDERR_FILENO, "creat failed\n", 13);
         write(STDERR_FILENO, "creat failed\n", 13);
-        return 1;
+        return EXIT_FAILURE;
     }
     }
 }
 }

+ 1 - 2
tests/fcntl/fcntl.c

@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-int main() {
+int main(void) {
     //Lose our fd and pull it again
     //Lose our fd and pull it again
     creat("fcntl.out", 0777);
     creat("fcntl.out", 0777);
     int newfd = open("fcntl.out", 0);
     int newfd = open("fcntl.out", 0);
@@ -10,5 +10,4 @@ int main() {
     printf("fd %d duped into fd %d\n", newfd, newfd2);
     printf("fd %d duped into fd %d\n", newfd, newfd2);
     close(newfd);
     close(newfd);
     close(newfd2);
     close(newfd2);
-    return 0;
 }
 }

+ 1 - 1
tests/fnmatch.c

@@ -9,7 +9,7 @@ void test(char* pattern, char* input, int flags) {
     }
     }
 }
 }
 
 
-int main() {
+int main(void) {
     puts("Should succeed:");
     puts("Should succeed:");
     test("*World", "Hello World", 0);
     test("*World", "Hello World", 0);
     test("*World", "World", 0);
     test("*World", "World", 0);

+ 3 - 4
tests/libgen.c

@@ -18,7 +18,7 @@ char * get_mutable_string(char *str) {
   return copy;
   return copy;
 }
 }
 
 
-void test_basename() {
+void test_basename(void) {
   test_case test_cases[] =
   test_case test_cases[] =
   { {"/usr/lib", "lib"},
   { {"/usr/lib", "lib"},
     {"//usr//lib//", "lib"},
     {"//usr//lib//", "lib"},
@@ -44,7 +44,7 @@ void test_basename() {
   return;
   return;
 }
 }
 
 
-void test_dirname() {
+void test_dirname(void) {
   test_case test_cases[] =
   test_case test_cases[] =
   { {"/usr/lib", "/usr"},
   { {"/usr/lib", "/usr"},
     {"//usr//lib//", "//usr"},
     {"//usr//lib//", "//usr"},
@@ -73,9 +73,8 @@ void test_dirname() {
   return;
   return;
 }
 }
 
 
-int main() {
+int main(void) {
   printf("Testing libgen.h\n");
   printf("Testing libgen.h\n");
   test_basename();
   test_basename();
   test_dirname();
   test_dirname();
-  return 0;
 }
 }

+ 1 - 1
tests/locale.c

@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
 
 
-int main() {
+int main(void) {
     // TODO: Implement locale properly and test it here
     // TODO: Implement locale properly and test it here
     char* val = setlocale(LC_ALL, NULL);
     char* val = setlocale(LC_ALL, NULL);
     if (strcmp(val, "C") == 0) {
     if (strcmp(val, "C") == 0) {

+ 1 - 2
tests/math.c

@@ -1,9 +1,8 @@
 #include <math.h>
 #include <math.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
     double pi = 3.14;
     double pi = 3.14;
     float c = cos(pi);
     float c = cos(pi);
     printf("cos(%f) = %f\n", pi, c);
     printf("cos(%f) = %f\n", pi, c);
-    return 0;
 }
 }

+ 1 - 3
tests/netdb/getaddrinfo.c

@@ -22,7 +22,7 @@ int main(void) {
     errcode = getaddrinfo("www.redox-os.org", NULL, &hints, &res);
     errcode = getaddrinfo("www.redox-os.org", NULL, &hints, &res);
     if (errcode != 0) {
     if (errcode != 0) {
         perror("getaddrinfo");
         perror("getaddrinfo");
-        return -1;
+        return EXIT_FAILURE;
     }
     }
 
 
     while (res) {
     while (res) {
@@ -45,6 +45,4 @@ int main(void) {
 
 
         res = res->ai_next;
         res = res->ai_next;
     }
     }
-
-    return 0;
 }
 }

+ 1 - 1
tests/netdb/netdb.c

@@ -225,6 +225,6 @@ do_test (void)
   return (error_count != 0);
   return (error_count != 0);
 }
 }
 
 
-int main() {
+int main(void) {
     do_test();
     do_test();
 }
 }

+ 9 - 9
tests/pwd.c

@@ -13,13 +13,13 @@ void print(struct passwd *pwd) {
     printf("pw_shell: %s\n", pwd->pw_shell);
     printf("pw_shell: %s\n", pwd->pw_shell);
 }
 }
 
 
-int main() {
+int main(void) {
     puts("--- Checking getpwuid ---");
     puts("--- Checking getpwuid ---");
     errno = 0;
     errno = 0;
     struct passwd *pwd = getpwuid(0);
     struct passwd *pwd = getpwuid(0);
     if (errno != 0) {
     if (errno != 0) {
         perror("getpwuid");
         perror("getpwuid");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     if (pwd != NULL) {
     if (pwd != NULL) {
         print(pwd);
         print(pwd);
@@ -30,7 +30,7 @@ int main() {
     pwd = getpwnam("nobody");
     pwd = getpwnam("nobody");
     if (errno != 0) {
     if (errno != 0) {
         perror("getpwnam");
         perror("getpwnam");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     if (pwd != NULL) {
     if (pwd != NULL) {
         print(pwd);
         print(pwd);
@@ -43,12 +43,12 @@ int main() {
     if (getpwuid_r(0, &pwd2, buf, 100, &result) < 0) {
     if (getpwuid_r(0, &pwd2, buf, 100, &result) < 0) {
         perror("getpwuid_r");
         perror("getpwuid_r");
         free(buf);
         free(buf);
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     if (result != NULL) {
     if (result != NULL) {
         if (result != &pwd2) {
         if (result != &pwd2) {
             free(buf);
             free(buf);
-            return 1;
+            return EXIT_FAILURE;
         }
         }
         print(&pwd2);
         print(&pwd2);
     }
     }
@@ -57,12 +57,12 @@ int main() {
     if (getpwnam_r("nobody", &pwd2, buf, 100, &result) < 0) {
     if (getpwnam_r("nobody", &pwd2, buf, 100, &result) < 0) {
         perror("getpwuid_r");
         perror("getpwuid_r");
         free(buf);
         free(buf);
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     if (result != NULL) {
     if (result != NULL) {
         if (result != &pwd2) {
         if (result != &pwd2) {
             free(buf);
             free(buf);
-            return 1;
+            return EXIT_FAILURE;
         }
         }
         print(&pwd2);
         print(&pwd2);
     }
     }
@@ -72,11 +72,11 @@ int main() {
     char buf2[1];
     char buf2[1];
     if (getpwuid_r(0, &pwd2, buf2, 1, &result) == 0) {
     if (getpwuid_r(0, &pwd2, buf2, 1, &result) == 0) {
         puts("This shouldn't have succeeded, but did!");
         puts("This shouldn't have succeeded, but did!");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     if (errno != ERANGE) {
     if (errno != ERANGE) {
         perror("getpwuid_r");
         perror("getpwuid_r");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     puts("Returned ERANGE because the buffer was too small 👍");
     puts("Returned ERANGE because the buffer was too small 👍");
 }
 }

+ 4 - 3
tests/regex.c

@@ -1,7 +1,8 @@
 #include <regex.h>
 #include <regex.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 
-int main() {
+int main(void) {
     regex_t regex;
     regex_t regex;
     char error_buf[256];
     char error_buf[256];
 
 
@@ -10,7 +11,7 @@ int main() {
         regerror(error, &regex, error_buf, 255);
         regerror(error, &regex, error_buf, 255);
         error_buf[255] = 0;
         error_buf[255] = 0;
         printf("regcomp error: %d = %s\n", error, error_buf);
         printf("regcomp error: %d = %s\n", error, error_buf);
-        return -1;
+        return EXIT_FAILURE;
     }
     }
 
 
     regmatch_t matches[3] = {{0}};
     regmatch_t matches[3] = {{0}};
@@ -22,7 +23,7 @@ int main() {
     if (error) {
     if (error) {
         regerror(error, &regex, error_buf, 255);
         regerror(error, &regex, error_buf, 255);
         printf("regexec error: %d = %s\n", error, error_buf);
         printf("regexec error: %d = %s\n", error, error_buf);
-        return -1;
+        return EXIT_FAILURE;
     }
     }
 
 
     for (int group = 0; group < 3; group += 1) {
     for (int group = 0; group < 3; group += 1) {

+ 2 - 2
tests/resource/getrusage.c

@@ -6,11 +6,11 @@ void ptimeval(struct timeval* val) {
     printf("{ tv_sec: %ld, tv_usec: %ld }\n", val->tv_sec, val->tv_usec);
     printf("{ tv_sec: %ld, tv_usec: %ld }\n", val->tv_sec, val->tv_usec);
 }
 }
 
 
-int main() {
+int main(void) {
     struct rusage r_usage;
     struct rusage r_usage;
     if (getrusage(RUSAGE_SELF, &r_usage) < 0) {
     if (getrusage(RUSAGE_SELF, &r_usage) < 0) {
         perror("getrusage");
         perror("getrusage");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     printf("ru_utime:");
     printf("ru_utime:");
     ptimeval(&r_usage.ru_utime);
     ptimeval(&r_usage.ru_utime);

+ 1 - 1
tests/select.c

@@ -3,7 +3,7 @@
 #include <sys/select.h>
 #include <sys/select.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-int main() {
+int main(void) {
     int fd = open("select.c", 0, 0);
     int fd = open("select.c", 0, 0);
 
 
     fd_set read;
     fd_set read;

+ 1 - 1
tests/setjmp.c

@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <setjmp.h>
 #include <setjmp.h>
 
 
-int main() {
+int main(void) {
     jmp_buf buf;
     jmp_buf buf;
     if (setjmp(buf)) {
     if (setjmp(buf)) {
         puts("hi from jump");
         puts("hi from jump");

+ 4 - 3
tests/signal.c

@@ -1,5 +1,6 @@
 #include <signal.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <errno.h>
 #include <errno.h>
 
 
@@ -7,18 +8,18 @@ void handler(int sig) {
     puts("Signal handler called!");
     puts("Signal handler called!");
 }
 }
 
 
-int main() {
+int main(void) {
     if (signal(SIGUSR1, &handler) == SIG_ERR) {
     if (signal(SIGUSR1, &handler) == SIG_ERR) {
         puts("Signal error!");
         puts("Signal error!");
         printf("%d\n", errno);
         printf("%d\n", errno);
-        return 1;
+        return EXIT_FAILURE;
     }
     }
 
 
     puts("Raising...");
     puts("Raising...");
     if (raise(SIGUSR1)) {
     if (raise(SIGUSR1)) {
         puts("Raise error!");
         puts("Raise error!");
         printf("%d\n", errno);
         printf("%d\n", errno);
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     puts("Raised.");
     puts("Raised.");
 }
 }

+ 1 - 2
tests/stdio/all.c

@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
 	FILE *f = fopen("stdio/stdio.in", "r");
 	FILE *f = fopen("stdio/stdio.in", "r");
 	printf("%c\n", fgetc(f));
 	printf("%c\n", fgetc(f));
 	ungetc('H', f);
 	ungetc('H', f);
@@ -9,5 +9,4 @@ int main(int argc, char ** argv) {
 	printf("%s\n", fgets(in, 30, f));
 	printf("%s\n", fgets(in, 30, f));
 	setvbuf(stdout, 0, _IONBF, 0);
 	setvbuf(stdout, 0, _IONBF, 0);
 	printf("Hello\n");
 	printf("Hello\n");
-	return 0;
 }
 }

+ 1 - 1
tests/stdio/buffer.c

@@ -1,6 +1,6 @@
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main() {
+int main(void) {
     // Tests what used to be a bug with buffering
     // Tests what used to be a bug with buffering
     fwrite("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 1, 999, stdout);
     fwrite("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 1, 999, stdout);
     fwrite("Test\n", 1, 5, stdout);
     fwrite("Test\n", 1, 5, stdout);

+ 3 - 2
tests/stdio/fgets.c

@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 
-int main() {
+int main(void) {
     //FILE *f = fopen("/etc/ssl/certs/ca-certificates.crt", "r");
     //FILE *f = fopen("/etc/ssl/certs/ca-certificates.crt", "r");
     FILE *f = fopen("stdio/stdio.in", "r");
     FILE *f = fopen("stdio/stdio.in", "r");
     char line[256];
     char line[256];
@@ -12,7 +13,7 @@ int main() {
             puts("EOF");
             puts("EOF");
             if (!feof(f)) {
             if (!feof(f)) {
                 puts("feof() not updated!");
                 puts("feof() not updated!");
-                return -1;
+                return EXIT_FAILURE;
             }
             }
             break;
             break;
         }
         }

+ 1 - 3
tests/stdio/fputs.c

@@ -1,11 +1,9 @@
 #include <stdio.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <errno.h>
 #include <errno.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
 	FILE *f = fopen("stdio/fputs.out", "w");
 	FILE *f = fopen("stdio/fputs.out", "w");
 	char *in = "Hello World!";
 	char *in = "Hello World!";
 	fputs(in, f); // calls fwrite, helpers::fwritex, internal::to_write and internal::stdio_write
 	fputs(in, f); // calls fwrite, helpers::fwritex, internal::to_write and internal::stdio_write
 	fclose(f);
 	fclose(f);
-	return 0;
 }
 }

+ 3 - 4
tests/stdio/fread.c

@@ -1,14 +1,15 @@
 #include <errno.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 
-int main(int argc, char *argv[]) {
+int main(void) {
     FILE *fp = fopen("stdio/fread.in", "rb");
     FILE *fp = fopen("stdio/fread.in", "rb");
 
 
     char buf[33] = { 0 };
     char buf[33] = { 0 };
     for (int i = 1; i <= 32; ++i) {
     for (int i = 1; i <= 32; ++i) {
         if (fread(buf, 1, i, fp) < 0) {
         if (fread(buf, 1, i, fp) < 0) {
             perror("fread");
             perror("fread");
-            return 0;
+            return EXIT_FAILURE;
         }
         }
         buf[i] = 0;
         buf[i] = 0;
 
 
@@ -16,6 +17,4 @@ int main(int argc, char *argv[]) {
     }
     }
 
 
     fclose(fp);
     fclose(fp);
-
-    return 0;
 }
 }

+ 1 - 2
tests/stdio/freopen.c

@@ -1,9 +1,8 @@
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
 	freopen("stdio/stdio.in", "r", stdin);
 	freopen("stdio/stdio.in", "r", stdin);
 	char in[6];
 	char in[6];
 	fgets(in, 6, stdin);
 	fgets(in, 6, stdin);
 	printf("%s\n", in); // should print Hello
 	printf("%s\n", in); // should print Hello
-	return 0;
 }
 }

+ 3 - 2
tests/stdio/fseek.c

@@ -1,10 +1,11 @@
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 
-int main() {
+int main(void) {
 	FILE *f = fopen("stdio/stdio.in", "r");
 	FILE *f = fopen("stdio/stdio.in", "r");
     if (fseek(f, 14, SEEK_CUR) < 0) {
     if (fseek(f, 14, SEEK_CUR) < 0) {
         puts("fseek error");
         puts("fseek error");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     char buffer[256];
     char buffer[256];
     printf("%s", fgets(buffer, 256, f));
     printf("%s", fgets(buffer, 256, f));

+ 4 - 5
tests/stdio/fwrite.c

@@ -2,23 +2,22 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <errno.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
 	FILE *f = fopen("stdio/fwrite.out", "w");
 	FILE *f = fopen("stdio/fwrite.out", "w");
 	const char ptr[] = "Hello World!";
 	const char ptr[] = "Hello World!";
 
 
 	if (fwrite(ptr, 0, 17, f)) {
 	if (fwrite(ptr, 0, 17, f)) {
-		return -1;
+		return EXIT_FAILURE;
 	}
 	}
 
 
 	if (fwrite(ptr, 7, 0, f)) {
 	if (fwrite(ptr, 7, 0, f)) {
-		return -1;
+		return EXIT_FAILURE;
 	}
 	}
 
 
 	if (fwrite(ptr, 0, 0, f)) {
 	if (fwrite(ptr, 0, 0, f)) {
-		return -1;
+		return EXIT_FAILURE;
 	}
 	}
 
 
 	fwrite(ptr, sizeof(ptr), 1, f);
 	fwrite(ptr, sizeof(ptr), 1, f);
 	fclose(f);
 	fclose(f);
-	return 0;
 }
 }

+ 4 - 3
tests/stdio/getc_unget.c

@@ -1,12 +1,13 @@
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
 	ungetc('h', stdin);
 	ungetc('h', stdin);
 	char c;
 	char c;
 	if ((c = getchar()) == 'h') {
 	if ((c = getchar()) == 'h') {
 		printf("Worked!\n");
 		printf("Worked!\n");
-		return 0;
+		return EXIT_SUCCESS;
 	}
 	}
 	printf("failed :( %c\n", c);
 	printf("failed :( %c\n", c);
-	return 0;
+	return EXIT_FAILURE;
 }
 }

+ 5 - 4
tests/stdio/mutex.c

@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 
-int main() {
+int main(void) {
     FILE* f = fopen("stdio/stdio.in", "r");
     FILE* f = fopen("stdio/stdio.in", "r");
 
 
     flockfile(f);
     flockfile(f);
@@ -10,17 +11,17 @@ int main() {
 
 
     if (!ftrylockfile(f)) {
     if (!ftrylockfile(f)) {
         puts("Mutex unlocked but it shouldn't be");
         puts("Mutex unlocked but it shouldn't be");
-        return -1;
+        return EXIT_FAILURE;
     }
     }
     funlockfile(f);
     funlockfile(f);
 
 
     if (ftrylockfile(f)) {
     if (ftrylockfile(f)) {
         puts("Mutex locked but it shouldn't be");
         puts("Mutex locked but it shouldn't be");
-        return -1;
+        return EXIT_FAILURE;
     }
     }
     if (!ftrylockfile(f)) {
     if (!ftrylockfile(f)) {
         puts("Mutex unlocked but it shouldn't be");
         puts("Mutex unlocked but it shouldn't be");
-        return -1;
+        return EXIT_FAILURE;
     }
     }
     funlockfile(f);
     funlockfile(f);
 }
 }

+ 4 - 5
tests/stdio/popen.c

@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 
-int main(int argc, char **argv) {
+int main(void) {
     FILE *fp;
     FILE *fp;
     int status;
     int status;
     char path[256];
     char path[256];
@@ -9,7 +10,7 @@ int main(int argc, char **argv) {
     fp = popen("ls -1 example_dir", "r");
     fp = popen("ls -1 example_dir", "r");
     if (fp == NULL) {
     if (fp == NULL) {
         perror("popen");
         perror("popen");
-        return -1;
+        return EXIT_FAILURE;
     }
     }
 
 
     while (fgets(path, 256, fp) != NULL) {
     while (fgets(path, 256, fp) != NULL) {
@@ -20,10 +21,8 @@ int main(int argc, char **argv) {
     status = pclose(fp);
     status = pclose(fp);
     if (status == -1) {
     if (status == -1) {
         perror("pclose");
         perror("pclose");
-        return -1;
+        return EXIT_FAILURE;
     } else {
     } else {
         printf("status %x\n", status);
         printf("status %x\n", status);
     }
     }
-
-    return 0;
 }
 }

+ 1 - 2
tests/stdio/printf.c

@@ -1,6 +1,6 @@
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
     int sofar = 0;
     int sofar = 0;
     int len = printf(
     int len = printf(
         "percent: %%\nstring: %s\nchar: %c\nchar: %c\nint: %d\n%nuint: %u\nhex: %x\nHEX: %X\nstring: %s\n",
         "percent: %%\nstring: %s\nchar: %c\nchar: %c\nint: %d\n%nuint: %u\nhex: %x\nHEX: %X\nstring: %s\n",
@@ -48,5 +48,4 @@ int main(int argc, char ** argv) {
     printf("%G\n", 0.0001);
     printf("%G\n", 0.0001);
     printf("%G\n", 0.00001);
     printf("%G\n", 0.00001);
     printf("%E\n", 0.00001);
     printf("%E\n", 0.00001);
-    return 0;
 }
 }

+ 4 - 3
tests/stdio/rename.c

@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <fcntl.h>
+#include <stdlib.h>
 #include <string.h>
 #include <string.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
@@ -8,7 +9,7 @@ static char newpath[] = "new-name.out";
 static char str[] = "Hello, World!";
 static char str[] = "Hello, World!";
 int str_len = 13;
 int str_len = 13;
 
 
-int main() {
+int main(void) {
     char buf[14];
     char buf[14];
     buf[13] = 0x00;
     buf[13] = 0x00;
     int fd = creat(oldpath, 0777);
     int fd = creat(oldpath, 0777);
@@ -20,8 +21,8 @@ int main() {
     close(fd);
     close(fd);
     remove(newpath);
     remove(newpath);
     if (strcmp(str, buf) == 0) {
     if (strcmp(str, buf) == 0) {
-        return 0;
+        return EXIT_SUCCESS;
     } else {
     } else {
-        return -1;
+        return EXIT_FAILURE;
     }
     }
 }
 }

+ 1 - 1
tests/stdio/scanf.c

@@ -25,7 +25,7 @@ void test(char* fmt_in, char* input, struct params *p, ...) {
     );
     );
 }
 }
 
 
-int main(int argc, char ** argv) {
+int main(void) {
     struct params p = { .c = 'a' };
     struct params p = { .c = 'a' };
 
 
     test("%hhd %d", "12 345", &p, &p.sa, &p.ia);
     test("%hhd %d", "12 345", &p, &p.sa, &p.ia);

+ 1 - 2
tests/stdio/setvbuf.c

@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
 	setvbuf(stdout, 0, _IONBF, 0);
 	setvbuf(stdout, 0, _IONBF, 0);
 	FILE *f = fopen("stdio/stdio.in", "r");
 	FILE *f = fopen("stdio/stdio.in", "r");
 	setvbuf(f, 0, _IONBF, 0);
 	setvbuf(f, 0, _IONBF, 0);
@@ -10,5 +10,4 @@ int main(int argc, char ** argv) {
 	char *in = malloc(30);
 	char *in = malloc(30);
 	printf("%s\n", fgets(in, 30, f));
 	printf("%s\n", fgets(in, 30, f));
 	printf("Hello\n");
 	printf("Hello\n");
-	return 0;
 }
 }

+ 4 - 3
tests/stdio/sprintf.c

@@ -1,7 +1,8 @@
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <string.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
     char buffer[72];
     char buffer[72];
 
 
     int ret = sprintf(
     int ret = sprintf(
@@ -11,7 +12,7 @@ int main(int argc, char ** argv) {
     );
     );
     if (ret != 68) {
     if (ret != 68) {
         printf("Failed! Return value was %d\n", ret);
         printf("Failed! Return value was %d\n", ret);
-        return -1;
+        return EXIT_FAILURE;
     }
     }
 
 
     memset(buffer, 0, sizeof(buffer));
     memset(buffer, 0, sizeof(buffer));
@@ -24,7 +25,7 @@ int main(int argc, char ** argv) {
     );
     );
     if (ret != 86) {
     if (ret != 86) {
         printf("Failed! Return value was %d\n", ret);
         printf("Failed! Return value was %d\n", ret);
-        return -1;
+        return EXIT_FAILURE;
     }
     }
 
 
     puts(buffer);
     puts(buffer);

+ 3 - 4
tests/stdlib/a64l.c

@@ -1,12 +1,12 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
     char * s = "azAZ9."; // test boundaries
     char * s = "azAZ9."; // test boundaries
     long l = a64l(s);
     long l = a64l(s);
     if (l != 194301926) {
     if (l != 194301926) {
         printf("Invalid result: a64l(%s) = %ld\n", s, l);
         printf("Invalid result: a64l(%s) = %ld\n", s, l);
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     printf("Correct a64l: %s = %ld\n", s, l);
     printf("Correct a64l: %s = %ld\n", s, l);
 
 
@@ -15,8 +15,7 @@ int main(int argc, char* argv[]) {
     l = a64l(s);
     l = a64l(s);
     if (l != 53222) {
     if (l != 53222) {
         printf("Invalid result: a64l(%s) = %ld\n", s, l);
         printf("Invalid result: a64l(%s) = %ld\n", s, l);
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     printf("Correct a64l: %s = %ld\n", s, l);
     printf("Correct a64l: %s = %ld\n", s, l);
-    return 0;
 }
 }

+ 1 - 3
tests/stdlib/alloc.c

@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
     char * ptr = (char *)malloc(256);
     char * ptr = (char *)malloc(256);
     printf("malloc %p\n", ptr);
     printf("malloc %p\n", ptr);
     int i;
     int i;
@@ -24,6 +24,4 @@ int main(int argc, char ** argv) {
         ptra[i] = (char)i;
         ptra[i] = (char)i;
     }
     }
     free(ptra);
     free(ptra);
-
-    return 0;
 }
 }

+ 1 - 2
tests/stdlib/atof.c

@@ -1,8 +1,7 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
     double d = atof("-3.14");
     double d = atof("-3.14");
     printf("%f\n", d);
     printf("%f\n", d);
-    return 0;
 }
 }

+ 1 - 2
tests/stdlib/atoi.c

@@ -1,12 +1,11 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
     printf("%d\n", atoi("         -42"));
     printf("%d\n", atoi("         -42"));
     printf("%d\n", atoi(" +555"));
     printf("%d\n", atoi(" +555"));
     printf("%d\n", atoi("   1234567890    "));
     printf("%d\n", atoi("   1234567890    "));
     printf("%ld\n", atol("         -42"));
     printf("%ld\n", atol("         -42"));
     printf("%ld\n", atol(" +555"));
     printf("%ld\n", atol(" +555"));
     printf("%ld\n", atol("   1234567890    "));
     printf("%ld\n", atol("   1234567890    "));
-    return 0;
 }
 }

+ 2 - 3
tests/stdlib/bsearch.c

@@ -13,13 +13,13 @@ int int_cmp(const void* a, const void* b) {
       size_t i = 0; \
       size_t i = 0; \
       for (; i < len; ++i) printf("%d,", arr[i]); \
       for (; i < len; ++i) printf("%d,", arr[i]); \
       printf("] expected %p but got %p\n", (void*) expect, res); \
       printf("] expected %p but got %p\n", (void*) expect, res); \
-      return 1; \
+      return EXIT_FAILURE; \
     } \
     } \
   } while (0);
   } while (0);
 
 
 
 
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
   int x = 0;
   int x = 0;
   int y = 1024;
   int y = 1024;
 
 
@@ -53,5 +53,4 @@ int main(int argc, char* argv[]) {
   BSEARCH_TEST_INT(x, big, 7, NULL);
   BSEARCH_TEST_INT(x, big, 7, NULL);
 
 
   printf("PASS bsearch\n");
   printf("PASS bsearch\n");
-  return 0;
 }
 }

+ 3 - 7
tests/stdlib/div.c

@@ -3,10 +3,9 @@
          volatile long double ld;
          volatile long double ld;
          volatile unsigned long long ll;
          volatile unsigned long long ll;
          lldiv_t mydivt;
          lldiv_t mydivt;
-int
-main ()
-{
-char* tmp;
+
+int main(void) {
+         char* tmp;
          f = strtof("gnu", &tmp);
          f = strtof("gnu", &tmp);
          ld = strtold("gnu", &tmp);
          ld = strtold("gnu", &tmp);
          ll = strtoll("gnu", &tmp, 10);
          ll = strtoll("gnu", &tmp, 10);
@@ -17,8 +16,5 @@ char* tmp;
          ll = mydivt.rem;
          ll = mydivt.rem;
          ll = atoll("10");
          ll = atoll("10");
          _Exit(0);
          _Exit(0);
-
-  ;
-  return 0;
 }
 }
 
 

+ 2 - 2
tests/stdlib/env.c

@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
 
 
-int main() {
+int main(void) {
     //puts(getenv("SHELL"));
     //puts(getenv("SHELL"));
     //puts(getenv("CC"));
     //puts(getenv("CC"));
 
 
@@ -34,7 +34,7 @@ int main() {
     if (env) {
     if (env) {
         puts("This should be null, but isn't");
         puts("This should be null, but isn't");
         puts(env);
         puts(env);
-        return 1;
+        return EXIT_FAILURE;
     } else {
     } else {
         puts("Value deleted successfully!");
         puts("Value deleted successfully!");
     }
     }

+ 1 - 2
tests/stdlib/mkostemps.c

@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     char* file_name = (char*) calloc(18, sizeof(char));
     char* file_name = (char*) calloc(18, sizeof(char));
     strcpy(file_name, "tempXXXXXX.suffix");
     strcpy(file_name, "tempXXXXXX.suffix");
     int fd = mkostemps(file_name, 7, 0);
     int fd = mkostemps(file_name, 7, 0);
@@ -23,5 +23,4 @@ int main(int argc, char** argv) {
     }
     }
     fclose(fp);
     fclose(fp);
     remove(file_name);
     remove(file_name);
-    return 0;
 }
 }

+ 1 - 2
tests/stdlib/mktemp.c

@@ -2,11 +2,10 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     char* string = (char*) calloc(20, sizeof(char));
     char* string = (char*) calloc(20, sizeof(char));
     strcpy(string, "tempXXXXXX");
     strcpy(string, "tempXXXXXX");
     mktemp(string);
     mktemp(string);
     printf("%s\n",string);
     printf("%s\n",string);
     free(string);
     free(string);
-    return 0;
 }
 }

+ 1 - 1
tests/stdlib/rand.c

@@ -1,7 +1,7 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     printf("%d\n", rand());
     printf("%d\n", rand());
     srand(259);
     srand(259);
     printf("%d\n", rand());
     printf("%d\n", rand());

+ 3 - 3
tests/stdlib/realpath.c

@@ -4,11 +4,11 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
 
 
-int main() {
+int main(void) {
     char* path = realpath("stdlib/realpath.c", NULL);
     char* path = realpath("stdlib/realpath.c", NULL);
     if (!path) {
     if (!path) {
         perror("realpath");
         perror("realpath");
-        return -1;
+        return EXIT_FAILURE;
     }
     }
     puts(path);
     puts(path);
 
 
@@ -21,7 +21,7 @@ int main() {
     if (!path) {
     if (!path) {
         perror("realpath");
         perror("realpath");
         free(path);
         free(path);
-        return -1;
+        return EXIT_FAILURE;
     }
     }
     puts(path);
     puts(path);
 
 

+ 1 - 1
tests/stdlib/strtod.c

@@ -1,7 +1,7 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main() {
+int main(void) {
     char* endptr = 0;
     char* endptr = 0;
     double d;
     double d;
 
 

+ 1 - 3
tests/stdlib/strtol.c

@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
     printf("%ld\n", strtol("         -42", NULL, 0));
     printf("%ld\n", strtol("         -42", NULL, 0));
     printf("%ld\n", strtol(" +555", NULL, 0));
     printf("%ld\n", strtol(" +555", NULL, 0));
     printf("%ld\n", strtol("   1234567890    ", NULL, 0));
     printf("%ld\n", strtol("   1234567890    ", NULL, 0));
@@ -26,6 +26,4 @@ int main(int argc, char* argv[]) {
     if(errno != 0) {
     if(errno != 0) {
         printf("errno is not 0 (%d), something went wrong\n", errno);
         printf("errno is not 0 (%d), something went wrong\n", errno);
     }
     }
-
-    return 0;
 }
 }

+ 1 - 3
tests/stdlib/strtoul.c

@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
     printf("%ld\n", strtoul("         -42", NULL, 0));
     printf("%ld\n", strtoul("         -42", NULL, 0));
     printf("%ld\n", strtoul(" +555", NULL, 0));
     printf("%ld\n", strtoul(" +555", NULL, 0));
     printf("%ld\n", strtoul("   1234567890    ", NULL, 0));
     printf("%ld\n", strtoul("   1234567890    ", NULL, 0));
@@ -25,6 +25,4 @@ int main(int argc, char* argv[]) {
     if(errno != 0) {
     if(errno != 0) {
         printf("errno is not 0 (%d), something went wrong\n", errno);
         printf("errno is not 0 (%d), something went wrong\n", errno);
     }
     }
-
-    return 0;
 }
 }

+ 1 - 2
tests/stdlib/system.c

@@ -1,6 +1,5 @@
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
     system("echo test of system");
     system("echo test of system");
-    return 0;
 }
 }

+ 7 - 8
tests/string/mem.c

@@ -2,14 +2,14 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
     puts("# mem #");
     puts("# mem #");
     char arr[100];
     char arr[100];
     memset(arr, 0, 100); // Compiler builtin, should work
     memset(arr, 0, 100); // Compiler builtin, should work
     arr[50] = 1;
     arr[50] = 1;
     if ((size_t)memchr((void *)arr, 1, 100) - (size_t)arr != 50) {
     if ((size_t)memchr((void *)arr, 1, 100) - (size_t)arr != 50) {
         puts("Incorrect memchr");
         puts("Incorrect memchr");
-        exit(1);
+        return EXIT_FAILURE;
     }
     }
     puts("Correct memchr");
     puts("Correct memchr");
     char arr2[51];
     char arr2[51];
@@ -17,26 +17,25 @@ int main(int argc, char ** argv) {
     memccpy((void *)arr2, (void *)arr, 1, 100);
     memccpy((void *)arr2, (void *)arr, 1, 100);
     if (arr[50] != 1) {
     if (arr[50] != 1) {
         puts("Incorrect memccpy");
         puts("Incorrect memccpy");
-        exit(1);
+        return EXIT_FAILURE;
     }
     }
     puts("Correct memccpy");
     puts("Correct memccpy");
     int res;
     int res;
     if ((res = memcmp("hello world", "hello world", 11))) {
     if ((res = memcmp("hello world", "hello world", 11))) {
         printf("Incorrect memcmp (1), expected 0 found %d\n", res);
         printf("Incorrect memcmp (1), expected 0 found %d\n", res);
-        exit(1);
+        return EXIT_FAILURE;
     }
     }
     if ((res = memcmp("hello world", "hello worlt", 11)) >= 0) {
     if ((res = memcmp("hello world", "hello worlt", 11)) >= 0) {
         printf("Incorrect memcmp (2), expected -, found %d\n", res);
         printf("Incorrect memcmp (2), expected -, found %d\n", res);
-        exit(1);
+        return EXIT_FAILURE;
     }
     }
     if ((res = memcmp("hello world", "hallo world", 5)) <= 0) {
     if ((res = memcmp("hello world", "hallo world", 5)) <= 0) {
         printf("Incorrect memcmp (3), expected +, found %d\n", res);
         printf("Incorrect memcmp (3), expected +, found %d\n", res);
-        exit(1);
+        return EXIT_FAILURE;
     }
     }
     if ((res = memcmp("hello world", "henlo world", 5)) >= 0) {
     if ((res = memcmp("hello world", "henlo world", 5)) >= 0) {
         printf("Incorrect memcmp (4), expected -, found %d\n", res);
         printf("Incorrect memcmp (4), expected -, found %d\n", res);
-        exit(1);
+        return EXIT_FAILURE;
     }
     }
     puts("Correct memcmp");
     puts("Correct memcmp");
-    return 0;
 }
 }

+ 1 - 3
tests/string/strcat.c

@@ -1,12 +1,10 @@
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
     char dest1[12] = "hello";
     char dest1[12] = "hello";
 	  printf("%s\n", strcat(dest1, " world")); // should be hello world
 	  printf("%s\n", strcat(dest1, " world")); // should be hello world
 
 
     char dest2[12] = "hello";
     char dest2[12] = "hello";
   	printf("%s\n", strncat(dest2, " world foobar", 6)); // should be hello world
   	printf("%s\n", strncat(dest2, " world foobar", 6)); // should be hello world
-
-    return 0;
 }
 }

+ 1 - 3
tests/string/strchr.c

@@ -1,10 +1,8 @@
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
 	printf("%s\n", strchr("hello", 'e')); // should be ello
 	printf("%s\n", strchr("hello", 'e')); // should be ello
 	printf("%s\n", strchr("world", 'l')); // should be ld
 	printf("%s\n", strchr("world", 'l')); // should be ld
 	printf("%i\n", strchr("world", 0) == NULL); // should be 1
 	printf("%i\n", strchr("world", 0) == NULL); // should be 1
-
-    return 0;
 }
 }

+ 1 - 1
tests/string/strcpy.c

@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
 
 
-int main() {
+int main(void) {
     char dst[20];
     char dst[20];
 
 
     strcpy(dst, "strcpy works!");
     strcpy(dst, "strcpy works!");

+ 1 - 3
tests/string/strcspn.c

@@ -1,10 +1,8 @@
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
 	char *world = "world";
 	char *world = "world";
 	printf("%ld\n", strcspn("hello", world)); // should be 2
 	printf("%ld\n", strcspn("hello", world)); // should be 2
 	printf("%ld\n", strcspn("banana", world)); // should be 6
 	printf("%ld\n", strcspn("banana", world)); // should be 6
-
-    return 0;
 }
 }

+ 1 - 3
tests/string/strncmp.c

@@ -1,13 +1,11 @@
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
     printf("%d\n", strncmp("a", "aa", 2));
     printf("%d\n", strncmp("a", "aa", 2));
     printf("%d\n", strncmp("a", "aä", 2));
     printf("%d\n", strncmp("a", "aä", 2));
     printf("%d\n", strncmp("\xFF", "\xFE", 2));
     printf("%d\n", strncmp("\xFF", "\xFE", 2));
     printf("%d\n", strncmp("", "\xFF", 1));
     printf("%d\n", strncmp("", "\xFF", 1));
     printf("%d\n", strncmp("a", "c", 1));
     printf("%d\n", strncmp("a", "c", 1));
     printf("%d\n", strncmp("a", "a", 2));
     printf("%d\n", strncmp("a", "a", 2));
-
-    return 0;
 }
 }

+ 2 - 4
tests/string/strpbrk.c

@@ -1,7 +1,7 @@
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
     char* source = "The quick drawn fix jumps over the lazy bug";
     char* source = "The quick drawn fix jumps over the lazy bug";
 
 
     // should be "The quick drawn fix jumps over the lazy bug"
     // should be "The quick drawn fix jumps over the lazy bug"
@@ -14,7 +14,5 @@ int main(int argc, char* argv[]) {
 
 
     // should be "NULL"
     // should be "NULL"
     char* res3 = strpbrk(source, "404");
     char* res3 = strpbrk(source, "404");
-    printf("%s\n", (res3) ? res3 : "NULL"); 
-
-    return 0;
+    printf("%s\n", (res3) ? res3 : "NULL");
 }
 }

+ 4 - 5
tests/string/strrchr.c

@@ -1,22 +1,21 @@
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 
-
-int main(int argc, char* argv[]) {
+int main(void) {
   char s0[] = "hello, world";
   char s0[] = "hello, world";
   char* ptr = strrchr(s0, 'l');
   char* ptr = strrchr(s0, 'l');
   if (ptr != &s0[10]) {
   if (ptr != &s0[10]) {
     printf("%p != %p\n", ptr, &s0[10]);
     printf("%p != %p\n", ptr, &s0[10]);
     printf("strrchr FAIL , exit with status code %d\n", 1);
     printf("strrchr FAIL , exit with status code %d\n", 1);
-    return 1;
+    return EXIT_FAILURE;
   }
   }
   char s1[] = "";
   char s1[] = "";
   ptr = strrchr(s1, 'a');
   ptr = strrchr(s1, 'a');
   if (ptr != NULL) {
   if (ptr != NULL) {
     printf("%p != 0\n", ptr);
     printf("%p != 0\n", ptr);
     printf("strrchr FAIL, exit with status code %d\n", 1);
     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);
   printf("strrch PASS, exiting with status code %d\n", 0);
-  return 0;
 }
 }

+ 1 - 3
tests/string/strspn.c

@@ -1,13 +1,11 @@
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
 	char *hello = "hello";
 	char *hello = "hello";
 	char *world = "world";
 	char *world = "world";
 	char *banana = "banana";
 	char *banana = "banana";
 	printf("%lu\n", strspn(hello, "hello")); // should be 5
 	printf("%lu\n", strspn(hello, "hello")); // should be 5
 	printf("%lu\n", strspn(world, "wendy")); // should be 1
 	printf("%lu\n", strspn(world, "wendy")); // should be 1
 	printf("%lu\n", strspn(banana, "apple")); // should be 0
 	printf("%lu\n", strspn(banana, "apple")); // should be 0
-
-    return 0;
 }
 }

+ 1 - 3
tests/string/strstr.c

@@ -1,12 +1,10 @@
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
     printf("%s\n", strstr("In relibc we trust", "rust"));
     printf("%s\n", strstr("In relibc we trust", "rust"));
     printf("%s\n", strstr("In relibc we trust", "libc"));
     printf("%s\n", strstr("In relibc we trust", "libc"));
     printf("%s\n", strstr("In relibc we trust", "bugs"));
     printf("%s\n", strstr("In relibc we trust", "bugs"));
     printf("%s\n", strstr("IN RELIBC WE TRUST", "rust"));
     printf("%s\n", strstr("IN RELIBC WE TRUST", "rust"));
     printf("%s\n", strcasestr("IN RELIBC WE TRUST", "rust"));
     printf("%s\n", strcasestr("IN RELIBC WE TRUST", "rust"));
-
-    return 0;
 }
 }

+ 1 - 3
tests/string/strtok.c

@@ -1,7 +1,7 @@
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
     char source[] = "I'd just like to interject for a moment.  What you're referring to as Linux, "
     char source[] = "I'd just like to interject for a moment.  What you're referring to as Linux, "
                     "is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux.\n";
                     "is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux.\n";
 
 
@@ -12,6 +12,4 @@ int main(int argc, char* argv[]) {
             printf("_");
             printf("_");
         }
         }
     }
     }
-
-    return 0;
 }
 }

+ 1 - 3
tests/string/strtok_r.c

@@ -1,7 +1,7 @@
 #include <string.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char* argv[]) {
+int main(void) {
     char source[] = "I'd just like to interject for a moment.  What you're referring to as Linux, "
     char source[] = "I'd just like to interject for a moment.  What you're referring to as Linux, "
                     "is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux.\n";
                     "is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux.\n";
     char* sp;
     char* sp;
@@ -13,6 +13,4 @@ int main(int argc, char* argv[]) {
             printf("_");
             printf("_");
         }
         }
     }
     }
-
-    return 0;
 }
 }

+ 1 - 1
tests/strings.c

@@ -3,7 +3,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <strings.h>
 #include <strings.h>
 
 
-int main() {
+int main(void) {
     assert(!bcmp("hello", "hehe", 2));
     assert(!bcmp("hello", "hehe", 2));
     assert(bcmp("hello", "haha", 2));
     assert(bcmp("hello", "haha", 2));
 
 

+ 1 - 1
tests/sys_utsname/uname.c

@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <sys/utsname.h>
 #include <sys/utsname.h>
 
 
-int main() {
+int main(void) {
     struct utsname system_info;
     struct utsname system_info;
 
 
     int result = uname(&system_info);
     int result = uname(&system_info);

+ 2 - 3
tests/time/asctime.c

@@ -3,14 +3,13 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     time_t a = 0;
     time_t a = 0;
     struct tm *time_info = gmtime(&a);
     struct tm *time_info = gmtime(&a);
 
 
     char *time_string = asctime(time_info);
     char *time_string = asctime(time_info);
 
 
     if (time_string == NULL || strcmp(time_string, "Thu Jan  1 00:00:00 1970\n") != 0) {
     if (time_string == NULL || strcmp(time_string, "Thu Jan  1 00:00:00 1970\n") != 0) {
-        exit(1);
+        return EXIT_FAILURE;
     }
     }
-    return 0;
 }
 }

+ 1 - 1
tests/time/gettimeofday.c

@@ -1,7 +1,7 @@
 #include <sys/time.h>
 #include <sys/time.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main() {
+int main(void) {
     struct timeval tv;
     struct timeval tv;
     gettimeofday(&tv, NULL);
     gettimeofday(&tv, NULL);
     printf("%ld: %ld\n", tv.tv_sec, tv.tv_usec);
     printf("%ld: %ld\n", tv.tv_sec, tv.tv_usec);

+ 3 - 4
tests/time/gmtime.c

@@ -3,7 +3,7 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     time_t a = 0;
     time_t a = 0;
     struct tm expected = { .tm_sec = 0, .tm_min = 0, .tm_hour = 0, .tm_mday = 1, .tm_year = 70,
     struct tm expected = { .tm_sec = 0, .tm_min = 0, .tm_hour = 0, .tm_mday = 1, .tm_year = 70,
                     .tm_wday = 4, .tm_yday = 0, .tm_isdst = 0, .tm_gmtoff = 0, .tm_zone = "UTC" };
                     .tm_wday = 4, .tm_yday = 0, .tm_isdst = 0, .tm_gmtoff = 0, .tm_zone = "UTC" };
@@ -14,7 +14,7 @@ int main(int argc, char** argv) {
         info->tm_year != expected.tm_year || info->tm_wday != expected.tm_wday ||
         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_yday != expected.tm_yday || info->tm_isdst != expected.tm_isdst ||
         info->tm_gmtoff != expected.tm_gmtoff || strcmp(info->tm_zone, expected.tm_zone) != 0) {
         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 ||
     if (info->tm_sec != expected.tm_sec || info->tm_min != expected.tm_min ||
@@ -22,7 +22,6 @@ int main(int argc, char** argv) {
         info->tm_year != expected.tm_year || info->tm_wday != expected.tm_wday ||
         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_yday != expected.tm_yday || info->tm_isdst != expected.tm_isdst ||
         info->tm_gmtoff != expected.tm_gmtoff || strcmp(info->tm_zone, expected.tm_zone) != 0) {
         info->tm_gmtoff != expected.tm_gmtoff || strcmp(info->tm_zone, expected.tm_zone) != 0) {
-            exit(1);
+            return EXIT_FAILURE;
     }
     }
-    return 0;
 }
 }

+ 1 - 1
tests/time/localtime.c

@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <time.h>
 #include <time.h>
 
 
-int main() {
+int main(void) {
     int day = 60 * 60 * 24;
     int day = 60 * 60 * 24;
     time_t inputs[] = { -(day * 33), -day, -1, -500, 0, 1, 1531454950 };
     time_t inputs[] = { -(day * 33), -day, -1, -500, 0, 1, 1531454950 };
     for (int i = 0; i < (sizeof(inputs) / sizeof(time_t)); i += 1) {
     for (int i = 0; i < (sizeof(inputs) / sizeof(time_t)); i += 1) {

+ 1 - 1
tests/time/macros.c

@@ -1,7 +1,7 @@
 #include <assert.h>
 #include <assert.h>
 #include <sys/time.h>
 #include <sys/time.h>
 
 
-int main() {
+int main(void) {
     struct timeval x = { .tv_usec = 15 };
     struct timeval x = { .tv_usec = 15 };
     struct timeval y = { 0 };
     struct timeval y = { 0 };
     struct timeval z = { 0 };
     struct timeval z = { 0 };

+ 5 - 4
tests/time/mktime.c

@@ -14,11 +14,12 @@ 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
             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!");
         puts("Failed!");
-        return -1;
+        return EXIT_FAILURE;
     }
     }
-    return 0;
+    return EXIT_SUCCESS;
 }
 }
-int main() {
+
+int main(void) {
     struct tm t = { 0 };
     struct tm t = { 0 };
 
 
     t.tm_year = 71;
     t.tm_year = 71;
@@ -30,7 +31,7 @@ int main() {
     time_t inputs[] = { -(day * 33), -day, -500, 0, 1531454950 };
     time_t inputs[] = { -(day * 33), -day, -500, 0, 1531454950 };
     for (int i = 0; i < 5; i += 1) {
     for (int i = 0; i < 5; i += 1) {
         if (check(inputs[i])) {
         if (check(inputs[i])) {
-            return -1;
+            return EXIT_FAILURE;
         }
         }
     }
     }
 
 

+ 2 - 1
tests/time/strftime.c

@@ -8,7 +8,8 @@ void print(time_t timestamp, char* fmt) {
     printf("%zu: %s\n", n, out);
     printf("%zu: %s\n", n, out);
     free(out);
     free(out);
 }
 }
-int main() {
+
+int main(void) {
     print(1531808742, "%a %A %b %B");
     print(1531808742, "%a %A %b %B");
     print(1531808742, "The %Cst century");
     print(1531808742, "The %Cst century");
     print(1531808742, "%I:%M:%S %p");
     print(1531808742, "%I:%M:%S %p");

+ 5 - 6
tests/time/time.c

@@ -1,26 +1,25 @@
 #include <time.h>
 #include <time.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     struct timespec tm = {0, 0};
     struct timespec tm = {0, 0};
 
 
     int cgt = clock_gettime(CLOCK_REALTIME, &tm);
     int cgt = clock_gettime(CLOCK_REALTIME, &tm);
     if (cgt == -1) {
     if (cgt == -1) {
         perror("clock_gettime");
         perror("clock_gettime");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
 
 
     time_t t = time(NULL);
     time_t t = time(NULL);
     if (t == (time_t)-1) {
     if (t == (time_t)-1) {
         perror("time");
         perror("time");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
 
 
     clock_t c = clock();
     clock_t c = clock();
     if (c == (clock_t)-1) {
     if (c == (clock_t)-1) {
         perror("clock");
         perror("clock");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
-
-    return 0;
 }
 }

+ 1 - 1
tests/time/times.c

@@ -2,7 +2,7 @@
 #include <sys/times.h>
 #include <sys/times.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-int main() {
+int main(void) {
     struct tms tms;
     struct tms tms;
     printf("return: %ld\n", times(&tms));
     printf("return: %ld\n", times(&tms));
 
 

+ 4 - 3
tests/unistd/access.c

@@ -1,14 +1,15 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <unistd.h>
+#include <stdlib.h>
 
 
-int main() {
+int main(void) {
     if (access("example_dir/1-never-gonna-give-you-up", R_OK | W_OK)) {
     if (access("example_dir/1-never-gonna-give-you-up", R_OK | W_OK)) {
         perror("access");
         perror("access");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     if (!access("example_dir/1-never-gonna-give-you-up", X_OK)) {
     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("Accessing a file with X_OK worked even though it... probably... shouldn't?");
         puts("Please run `chmod 644 example_dir/*` and try again.");
         puts("Please run `chmod 644 example_dir/*` and try again.");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
 }
 }

+ 1 - 2
tests/unistd/brk.c

@@ -1,8 +1,7 @@
 #include <unistd.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     int status = brk((void*)100);
     int status = brk((void*)100);
     printf("brk exited with status code %d\n", status);
     printf("brk exited with status code %d\n", status);
-    return 0;
 }
 }

+ 1 - 2
tests/unistd/chdir.c

@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     char* cwd1 = malloc(4096*sizeof(char));//(char*) calloc(4096 + 1, sizeof(char));
     char* cwd1 = malloc(4096*sizeof(char));//(char*) calloc(4096 + 1, sizeof(char));
     getcwd(cwd1, 4096);
     getcwd(cwd1, 4096);
     printf("initial cwd: %s\n", cwd1);
     printf("initial cwd: %s\n", cwd1);
@@ -12,5 +12,4 @@ int main(int argc, char** argv) {
     getcwd(cwd2, 4096);
     getcwd(cwd2, 4096);
     printf("final cwd: %s\n", cwd2);
     printf("final cwd: %s\n", cwd2);
     free(cwd2);
     free(cwd2);
-    return 0;
 }
 }

+ 1 - 2
tests/unistd/dup.c

@@ -2,7 +2,7 @@
 #include <fcntl.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     creat("dup.out", 0777);
     creat("dup.out", 0777);
     int fd1 = open("dup.out", 0);
     int fd1 = open("dup.out", 0);
     int fd2 = dup(fd1);
     int fd2 = dup(fd1);
@@ -13,5 +13,4 @@ int main(int argc, char** argv) {
     dup2(fd3, 1);
     dup2(fd3, 1);
     printf("hello fd %d", fd3);
     printf("hello fd %d", fd3);
     close(fd3);
     close(fd3);
-    return 0;
 }
 }

+ 1 - 2
tests/unistd/exec.c

@@ -1,9 +1,8 @@
 #include <unistd.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     char* args[] = {"sh", "-c", "echo 'exec works :D'", NULL};
     char* args[] = {"sh", "-c", "echo 'exec works :D'", NULL};
     execv("/bin/sh", args);
     execv("/bin/sh", args);
     perror("execv");
     perror("execv");
-    return 0;
 }
 }

+ 1 - 2
tests/unistd/fchdir.c

@@ -2,11 +2,10 @@
 #include <fcntl.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main (int argc, char** argv) {
+int main(void) {
     int fd = open("..", 0, 0);
     int fd = open("..", 0, 0);
     int status;
     int status;
     status = fchdir(fd);
     status = fchdir(fd);
     printf("fchdir exited with status code %d\n", status);
     printf("fchdir exited with status code %d\n", status);
     close(fd);
     close(fd);
-    return 0;
 }
 }

+ 1 - 2
tests/unistd/fsync.c

@@ -2,11 +2,10 @@
 #include <fcntl.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main (int argc, char** argv) {
+int main(void) {
     int fd = open(".", 0, 0);
     int fd = open(".", 0, 0);
     int status;
     int status;
     status = fsync(fd);
     status = fsync(fd);
     printf("fsync exited with status code %d\n", status);
     printf("fsync exited with status code %d\n", status);
     close(fd);
     close(fd);
-    return 0;
 }
 }

+ 1 - 2
tests/unistd/ftruncate.c

@@ -2,11 +2,10 @@
 #include <fcntl.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main (int argc, char** argv) {
+int main(void) {
     int fd = creat("ftruncate.out", 0777);
     int fd = creat("ftruncate.out", 0777);
     int status;
     int status;
     status = ftruncate(fd, 100);
     status = ftruncate(fd, 100);
     printf("ftruncate exited with status code %d\n", status);
     printf("ftruncate exited with status code %d\n", status);
     close(fd);
     close(fd);
-    return 0;
 }
 }

+ 2 - 2
tests/unistd/getcwd.c

@@ -4,7 +4,7 @@
 #include <string.h>
 #include <string.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-int main() {
+int main(void) {
     char first[PATH_MAX];
     char first[PATH_MAX];
     getcwd(first, PATH_MAX);
     getcwd(first, PATH_MAX);
     puts(first);
     puts(first);
@@ -15,7 +15,7 @@ int main() {
     if (strcmp(first, second)) {
     if (strcmp(first, second)) {
         puts("Not matching");
         puts("Not matching");
         free(second);
         free(second);
-        return 1;
+        return EXIT_FAILURE;
     }
     }
 
 
     free(second);
     free(second);

+ 1 - 1
tests/unistd/gethostname.c

@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-int main() {
+int main(void) {
     char* hostname = malloc(256);
     char* hostname = malloc(256);
     if (gethostname(hostname, 256) == 0) {
     if (gethostname(hostname, 256) == 0) {
         printf("Hostname: %s\n", hostname);
         printf("Hostname: %s\n", hostname);

+ 1 - 2
tests/unistd/getid.c

@@ -1,7 +1,7 @@
 #include <unistd.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     gid_t egid = getegid();
     gid_t egid = getegid();
     uid_t euid = geteuid();
     uid_t euid = geteuid();
     gid_t gid = getgid();
     gid_t gid = getgid();
@@ -11,5 +11,4 @@ int main(int argc, char** argv) {
     uid_t uid = getuid();
     uid_t uid = getuid();
     printf("egid: %d, euid: %d, gid: %d, pgid: %d, pid: %d, ppid %d, uid %d\n",
     printf("egid: %d, euid: %d, gid: %d, pgid: %d, pid: %d, ppid %d, uid %d\n",
             egid, euid, gid, pgid, pid, ppid, uid);
             egid, euid, gid, pgid, pid, ppid, uid);
-    return 0;
 }
 }

+ 1 - 1
tests/unistd/isatty.c

@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-int main() {
+int main(void) {
     // 1 is stdout
     // 1 is stdout
     if (isatty(1)) {
     if (isatty(1)) {
         puts("'Tis a tty :D");
         puts("'Tis a tty :D");

+ 6 - 5
tests/unistd/link.c

@@ -1,9 +1,10 @@
 #include <errno.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     printf("%ld\n", sizeof(struct stat));
     printf("%ld\n", sizeof(struct stat));
 
 
     struct stat buf;
     struct stat buf;
@@ -11,7 +12,7 @@ int main(int argc, char** argv) {
     // Stat for the inode
     // Stat for the inode
     if (stat("unistd/link.c", &buf)) {
     if (stat("unistd/link.c", &buf)) {
         perror("stat");
         perror("stat");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     unsigned long inode = buf.st_ino;
     unsigned long inode = buf.st_ino;
     printf("%ld\n", inode);
     printf("%ld\n", inode);
@@ -19,7 +20,7 @@ int main(int argc, char** argv) {
     // Create the link
     // Create the link
     if (link("unistd/link.c", "link.out")) {
     if (link("unistd/link.c", "link.out")) {
         perror("link");
         perror("link");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
 
 
     // Make sure inodes match
     // Make sure inodes match
@@ -37,10 +38,10 @@ int main(int argc, char** argv) {
     // Remove link
     // Remove link
     if (unlink("link.out")) {
     if (unlink("link.out")) {
         perror("unlink");
         perror("unlink");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
     if (!stat("link.out", &buf) || errno != ENOENT) {
     if (!stat("link.out", &buf) || errno != ENOENT) {
         perror("stat");
         perror("stat");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
 }
 }

+ 1 - 2
tests/unistd/pathconf.c

@@ -7,7 +7,7 @@
 	printf("%s (%d): %ld (%d)\n", #N, _PC_ ## N, fpathconf(0, _PC_ ## N), errno); \
 	printf("%s (%d): %ld (%d)\n", #N, _PC_ ## N, fpathconf(0, _PC_ ## N), errno); \
 }
 }
 
 
-int main(){
+int main(void) {
 	PC(LINK_MAX);
 	PC(LINK_MAX);
 	PC(MAX_CANON);
 	PC(MAX_CANON);
 	PC(MAX_INPUT);
 	PC(MAX_INPUT);
@@ -29,5 +29,4 @@ int main(){
 	PC(ALLOC_SIZE_MIN);
 	PC(ALLOC_SIZE_MIN);
 	PC(SYMLINK_MAX);
 	PC(SYMLINK_MAX);
 	PC(2_SYMLINKS);
 	PC(2_SYMLINKS);
-	return 0;
 }
 }

+ 10 - 12
tests/unistd/pipe.c

@@ -1,18 +1,17 @@
 //http://www2.cs.uregina.ca/~hamilton/courses/330/notes/unix/pipes/pipes.html
 //http://www2.cs.uregina.ca/~hamilton/courses/330/notes/unix/pipes/pipes.html
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <string.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-int main()
-{
-
+int main(void) {
     int pid, pip[2];
     int pid, pip[2];
     char instring[20];
     char instring[20];
     char * outstring = "Hello World!";
     char * outstring = "Hello World!";
 
 
     if (pipe(pip) < 0) {
     if (pipe(pip) < 0) {
         perror("pipe");
         perror("pipe");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
 
 
     pid = fork();
     pid = fork();
@@ -30,13 +29,13 @@ int main()
         /* check result */
         /* check result */
         if (bytes < 0) {
         if (bytes < 0) {
             perror("pipe write");
             perror("pipe write");
-            return 1;
+            return EXIT_FAILURE;
         } else if (bytes != strlen(outstring)) {
         } else if (bytes != strlen(outstring)) {
             fprintf(stderr, "pipe write: %d != %ld\n", 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 */
     else			/* parent : receives message from child */
     {
     {
@@ -55,18 +54,17 @@ int main()
         /* check result */
         /* check result */
         if (bytes < 0) {
         if (bytes < 0) {
             perror("pipe read");
             perror("pipe read");
-            return 1;
+            return EXIT_FAILURE;
         } else if (bytes != strlen(outstring)) {
         } else if (bytes != strlen(outstring)) {
             fprintf(stderr, "pipe read: %d != %ld\n", 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) {
         } else if (memcmp(instring, outstring, strlen(outstring)) != 0) {
             fprintf(stderr, "pipe read does not match pipe write\n");
             fprintf(stderr, "pipe read does not match pipe write\n");
-            return 1;
+            return EXIT_FAILURE;
         } else {
         } else {
             printf("%s\n", instring);
             printf("%s\n", instring);
         }
         }
 
 
-        return 0;
+        return EXIT_SUCCESS;
     }
     }
-    return 0;
 }
 }

+ 1 - 2
tests/unistd/rmdir.c

@@ -2,9 +2,8 @@
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     mkdir("foo", 0);
     mkdir("foo", 0);
     int status = rmdir("foo");
     int status = rmdir("foo");
     printf("rmdir exited with status code %d\n", status);
     printf("rmdir exited with status code %d\n", status);
-    return 0;
 }
 }

+ 2 - 5
tests/unistd/setid.c

@@ -4,10 +4,8 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <unistd.h>
-#include <stdlib.h>
 
 
-int main( void )
-  {
+int main(void) {
     if( setpgid( getpid(), 0 ) == -1 ) {
     if( setpgid( getpid(), 0 ) == -1 ) {
         perror( "setpgid" );
         perror( "setpgid" );
     }
     }
@@ -23,5 +21,4 @@ int main( void )
         perror( "setreuid" );
         perror( "setreuid" );
     }
     }
     printf("%d has euid %d and uid %d\n", getpid(), geteuid(), getuid());
     printf("%d has euid %d and uid %d\n", getpid(), geteuid(), getuid());
-    return 0;
-  }
+}

+ 1 - 2
tests/unistd/sleep.c

@@ -2,7 +2,7 @@
 #include <unistd.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
-int main(int argc, char** argv) {
+int main(void) {
     sleep(2);
     sleep(2);
     perror("sleep");
     perror("sleep");
     usleep(1000);
     usleep(1000);
@@ -10,5 +10,4 @@ int main(int argc, char** argv) {
     struct timespec tm = {0, 10000};
     struct timespec tm = {0, 10000};
     nanosleep(&tm, NULL);
     nanosleep(&tm, NULL);
     perror("nanosleep");
     perror("nanosleep");
-    return 0;
 }
 }

+ 3 - 2
tests/unistd/stat.c

@@ -1,16 +1,17 @@
 #include <errno.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unistd.h>
 
 
-int main() {
+int main(void) {
     printf("%ld\n", sizeof(struct stat));
     printf("%ld\n", sizeof(struct stat));
 
 
     struct stat buf;
     struct stat buf;
 
 
     if (stat("unistd/stat.c", &buf)) {
     if (stat("unistd/stat.c", &buf)) {
         perror("stat");
         perror("stat");
-        return 1;
+        return EXIT_FAILURE;
     }
     }
 
 
     printf("st_size: %lu\n", buf.st_size);
     printf("st_size: %lu\n", buf.st_size);

+ 1 - 2
tests/unistd/sysconf.c

@@ -7,7 +7,7 @@
 	printf("%s (%d): %ld (%d)\n", #N, _SC_ ## N, sysconf(_SC_ ## N), errno); \
 	printf("%s (%d): %ld (%d)\n", #N, _SC_ ## N, sysconf(_SC_ ## N), errno); \
 }
 }
 
 
-int main(){
+int main(void) {
 	SC(ARG_MAX);
 	SC(ARG_MAX);
 	SC(CHILD_MAX);
 	SC(CHILD_MAX);
 	SC(CLK_TCK);
 	SC(CLK_TCK);
@@ -22,5 +22,4 @@ int main(){
 	SC(TTY_NAME_MAX);
 	SC(TTY_NAME_MAX);
 	SC(SYMLOOP_MAX);
 	SC(SYMLOOP_MAX);
 	SC(HOST_NAME_MAX);
 	SC(HOST_NAME_MAX);
-	return 0;
 }
 }

+ 1 - 2
tests/unistd/write.c

@@ -1,6 +1,5 @@
 #include <unistd.h>
 #include <unistd.h>
 
 
-int main(int argc, char ** argv) {
+int main(void) {
     write(STDOUT_FILENO, "Hello World!\n", 13);
     write(STDOUT_FILENO, "Hello World!\n", 13);
-    return 0;
 }
 }

部分文件因为文件数量过多而无法显示