Update main() declarations and replace exit() calls with return in Config .c files
authorRemco Rijnders <remmy@serenity-irc.net>
Mon, 26 Jan 2026 21:00:57 +0000 (21:00 +0000)
committerRemco Rijnders <remmy@serenity-irc.net>
Mon, 26 Jan 2026 21:00:57 +0000 (21:00 +0000)
Config

diff --git a/Config b/Config
index 15a09d9aa86b640dd597e129095d6585575ab566..57fc5f52818974b75a80648fca8cb080254886c6 100755 (executable)
--- a/Config
+++ b/Config
@@ -158,7 +158,7 @@ case "$OS" in
 # New, cleaner detection code. -8/15/99 Sean-Paul Rees (sean@dreamfire.net)
        cat > $TMP << __EOF__
 #include <stdio.h>
-main()
+int main(void)
 {
        #ifdef __GLIBC__
        printf("%d_%d\n", __GLIBC__, __GLIBC_MINOR__);
@@ -166,7 +166,7 @@ main()
        printf("0\n");
        #endif
 
-       exit(0);
+       return 0;
 }
 __EOF__
 #
@@ -254,7 +254,7 @@ echo "Compiler selected: $CCPATH"
 echo " "
 # Check it out
 cat > $TMP <<__EOF__
-main() {}
+int main(void) {}
 __EOF__
 $CCPATH $TMP -o $EXEC >/dev/null 2>&1
 if [ ! -f $EXEC ] ; then
@@ -392,13 +392,13 @@ fi
 #
 echo $n "Searching for bcopy/bzero/bcmp...$c"
 cat > $TMP <<__EOF__
-main()
+int main(void)
 {
        char    a[3], b[3];
        bzero(b,3);
        bcopy(a,b,3);
        (void)bcmp(a,b,3);
-       exit(0);
+       return 0;
 }
 __EOF__
 $COMP >/dev/null 2>&1
@@ -414,7 +414,7 @@ echo $n "Which one, gettimeofday, or lrand48..$c"
 cat > $TMP <<__EOF__
 #include <stdio.h>
 #include <sys/time.h>
-main()
+int main(void)
  {
    struct timeval tv;
    (void) gettimeofday(&tv, NULL);
@@ -427,7 +427,7 @@ if [ $? -eq 0 ] ; then
 else
        echo "No gettimeofday. Trying lrand48."
 cat > $TMP <<__EOF__
-main()
+int main(void)
 {
    int a;
    a=lrand48();
@@ -453,11 +453,12 @@ cat > $PLATE <<__EOF__
 #include <sys/ioctl.h>
 #include <sys/file.h>
 #include <signal.h>
+#include <stdlib.h>
 alarmed()
 {
        exit(1);
 }
-main()
+int main(void)
 {
        char b[12], x[32];
        int f, l = sizeof(x);
@@ -469,7 +470,7 @@ main()
                alarm(0);
                exit(0);
        }
-       exit(1);
+       return 1;
 }
 __EOF__
 sed -e 's/BLOCKING/O_NONBLOCK/' $PLATE > $TMP
@@ -515,7 +516,7 @@ echo "Checking if you have 'action from POSIX..."
 cat > $TMP <<__EOF__
 #include <signal.h>
 
-main()
+int main(void)
 {      /* poor replacement for NULL but who cares here ? */
        sigaction(SIGTERM, (struct sigaction *)0L, (struct sigaction *)0L);
 }
@@ -537,11 +538,11 @@ void      handler()
        kill(getpid(), SIGTERM);
        sleep(1);
 }
-main()
+int main(void)
 {
        signal(SIGTERM, handler);
        kill(getpid(), SIGTERM);
-       exit (0);
+       retrun 0;
 }
 __EOF__
        echo $n "No, but you have...$c"
@@ -566,10 +567,10 @@ cat > $TMP <<__EOF__
 #ifdef STRINGSH
 #include <strings.h>
 #endif
-main()
+int main(void)
 {
        char *s = index("foo", 'o');
-       exit(0);
+       return 0;
 }
 __EOF__
 $COMP >/dev/null 2>&1
@@ -588,7 +589,7 @@ cat > $TMP <<__EOF__
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/resource.h>
-main()
+int main(void)
 {
        struct  rusage  rus;
        (void)getrusage(RUSAGE_SELF, &rus);
@@ -604,7 +605,7 @@ else
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/times.h>
-main()
+int main(void)
 {
        struct  tms     tmsbuf;
        (void)times(&tmsbuf);
@@ -631,10 +632,10 @@ cat > $TMP <<__EOF__
 #ifdef STRINGSH
 #include <strings.h>
 #endif
-main()
+int main(void)
 {
         char *s = strcasecmp('a', 'a');
-        exit(0);
+        return 0;
 }
 __EOF__
 $COMP >/dev/null 2>&1
@@ -648,12 +649,12 @@ fi
 echo "Checking for additional components..."
 echo $n "Searching...$c"
 cat > $TMP <<__EOF__
-main()
+int main(void)
 {
        unsigned long foo;
 
        char  *s = strtoul("0x12345", &foo, 16);
-       exit(0);
+       return 0;
 }
 __EOF__
 $COMP >/dev/null 2>&1
@@ -671,10 +672,10 @@ else
 fi
 $RM -f $EXEC $TMP
 cat > $TMP <<__EOF__
-main()
+int main(void)
 {
        char  *s = strerror(0);
-       exit(0);
+       return 0;
 }
 __EOF__
 $COMP >/dev/null 2>&1
@@ -690,10 +691,10 @@ cat > $TMP <<__EOF__
 #include <arpa/nameser.h>
 #include <resolv.h>
 
-main()
+int main(void)
 {
        dn_skipname("","");
-       exit(0);
+       return 0;
 }
 __EOF__
 $COMP >/dev/null 2>&1
@@ -709,10 +710,10 @@ fi
 $RM -f $EXEC $TMP
 cat > $TMP <<__EOF__
 #include <sys/types.h>
-main()
+int main(void)
 {
     u_int32_t foo;
-    exit(0);
+    return 0;
 }
 __EOF__
 $COMP >/dev/null 2>&1
@@ -738,12 +739,12 @@ cat > $TMP <<__EOF__
 #ifdef STRINGSH
 #include <strings.h>
 #endif
-main()
+int main(void)
 {
        char  t[] = "a", **p = NULL, *s = strtoken(&p, t, ",");
        if (!strcmp(t, s))
                exit(0);
-       exit(1);
+       return 1;
 }
 __EOF__
 $COMP >/dev/null 2>&1
@@ -767,12 +768,12 @@ cat > $TMP <<__EOF__
 #ifdef STRINGSH
 #include <strings.h>
 #endif
-main()
+int main(void)
 {
        char  t[] = "a", *s = strtok(t, ",");
        if (!strcmp(t, s))
                exit(0);
-       exit(1);
+       return 1;
 }
 __EOF__
 $COMP >/dev/null 2>&1
@@ -790,7 +791,7 @@ $RM -f $EXEC $TMP
 cat > $TMP << __EOF__
 #include <sys/types.h>
 #include <netinet/in.h>
-main()
+int main(void)
 {
        struct  in_addr in;
        (void)inet_addr("1.2.3.4");
@@ -805,7 +806,7 @@ $RM -f $EXEC $TMP
 cat > $TMP << __EOF__
 #include <sys/types.h>
 #include <netinet/in.h>
-main()
+int main(void)
 {
        struct  in_addr in;
        in.s_addr = 0x12345678;
@@ -820,7 +821,7 @@ $RM -f $EXEC $TMP
 cat > $TMP << __EOF__
 #include <sys/types.h>
 #include <netinet/in.h>
-main()
+int main(void)
 {
        struct  in_addr in;
        in.s_addr = 0x87654321;