Add ABI compatability aliases.
authorIsaac Dunham <idunham@lavabit.com>
Sat, 6 Apr 2013 06:20:28 +0000 (23:20 -0700)
committerIsaac Dunham <idunham@lavabit.com>
Sat, 6 Apr 2013 06:20:28 +0000 (23:20 -0700)
GNU used several extensions that were incompatible with C99 and POSIX,
so they used alternate names for the standard functions.

The result is that we need these to run standards-conformant programs
that were linked with glibc.

13 files changed:
src/misc/getopt.c
src/stdio/fscanf.c
src/stdio/fwscanf.c
src/stdio/scanf.c
src/stdio/sscanf.c
src/stdio/swscanf.c
src/stdio/vfwscanf.c
src/stdio/vscanf.c
src/stdio/vsscanf.c
src/stdio/vswscanf.c
src/stdio/vwscanf.c
src/stdio/wscanf.c
src/string/strerror_r.c

index 35880a090719e8f3913bbcd63c0238214490826a..f1a1639c56da1ae9140cde36d486a928daf872fd 100644 (file)
@@ -70,3 +70,5 @@ int getopt(int argc, char * const argv[], const char *optstring)
        }
        return c;
 }
+
+weak_alias(getopt, __posix_getopt);
index ff6c7767affef698aa4abd41b43c7aef5c5b3392..58bc5fabd4e6394d6d7083c37a11782ad49a96da 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdarg.h>
+#include "libc.h"
 
 int fscanf(FILE *restrict f, const char *restrict fmt, ...)
 {
@@ -10,3 +11,5 @@ int fscanf(FILE *restrict f, const char *restrict fmt, ...)
        va_end(ap);
        return ret;
 }
+
+weak_alias(__isoc99_fscanf);
index 2f30dab4718dfa7357f4665ff4d31d542f7b9424..cb114b39f4bc9711b738aeac8f9ad8ec3ebc83db 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <wchar.h>
+#include "libc.h"
 
 int fwscanf(FILE *restrict f, const wchar_t *restrict fmt, ...)
 {
@@ -11,3 +12,5 @@ int fwscanf(FILE *restrict f, const wchar_t *restrict fmt, ...)
        va_end(ap);
        return ret;
 }
+
+weak_alias(fwscanf,__isoc99_fwscanf);
index 3b35bdce21f60b8919f7c4381cf1fc3e3c79a974..a740056cc9c92c4219dadc2fccbf8665529f12ef 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdarg.h>
+#include "libc.h"
 
 int scanf(const char *restrict fmt, ...)
 {
@@ -10,3 +11,5 @@ int scanf(const char *restrict fmt, ...)
        va_end(ap);
        return ret;
 }
+
+weak_alias(scanf,__isoc99_scanf);
index b575edf7769113dbf645e5412d0f03dac2453107..8a2302ff67a7f069226a7bdbc402221fa9314fdc 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdarg.h>
+#include "libc.h"
 
 int sscanf(const char *restrict s, const char *restrict fmt, ...)
 {
@@ -10,3 +11,5 @@ int sscanf(const char *restrict s, const char *restrict fmt, ...)
        va_end(ap);
        return ret;
 }
+
+weak_alias(sscanf,__isoc99_sscanf);
index 1fe3c3d888d9842c1b76804ff99bf56c204ce280..c7986096fb1835749f451a2e92d0c53f7647feed 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <wchar.h>
+#include "libc.h"
 
 int swscanf(const wchar_t *restrict s, const wchar_t *restrict fmt, ...)
 {
@@ -11,3 +12,5 @@ int swscanf(const wchar_t *restrict s, const wchar_t *restrict fmt, ...)
        va_end(ap);
        return ret;
 }
+
+weak_alias(swscanf,__isoc99_swscanf);
index b3bc6f3a285ee0a2339aae41d200a15ad4b27b01..44910b4cb0d843f721ed860ae1156df317e62d76 100644 (file)
@@ -14,6 +14,7 @@
 #include "shgetc.h"
 #include "intscan.h"
 #include "floatscan.h"
+#include "libc.h"
 
 #define SIZE_hh -2
 #define SIZE_h  -1
@@ -308,3 +309,5 @@ match_fail:
        FUNLOCK(f);
        return matches;
 }
+
+weak_alias(vfwscanf,__isoc99_vfwscanf);
index 6901958a61d03b52e10f9436b7734712ff41c997..43892f01b304d97a55a8c4ff512140a66edb11bf 100644 (file)
@@ -1,7 +1,10 @@
 #include <stdio.h>
 #include <stdarg.h>
+#include "libc.h"
 
 int vscanf(const char *restrict fmt, va_list ap)
 {
        return vfscanf(stdin, fmt, ap);
 }
+
+weak_alias(vscanf,__isoc99_vscanf);
index 049f4dd0e6c506940fe1d25479da669cdd73991f..929ffa3b0fd8a33754b0638536d0893bed74d9a1 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
+#include "libc.h"
 
 static size_t do_read(FILE *f, unsigned char *buf, size_t len)
 {
@@ -13,3 +14,5 @@ int vsscanf(const char *restrict s, const char *restrict fmt, va_list ap)
        };
        return vfscanf(&f, fmt, ap);
 }
+
+weak_alias(vsscanf,__isoc99_vsscanf);
index 7a2f7c7a98705c91a462c0bfbb3a029ae7d436f8..411dd39c9a27f763932126665cf95f9edc0bf422 100644 (file)
@@ -1,4 +1,5 @@
 #include "stdio_impl.h"
+#include "libc.h"
 #include <wchar.h>
 
 static size_t wstring_read(FILE *f, unsigned char *buf, size_t len)
@@ -34,3 +35,5 @@ int vswscanf(const wchar_t *restrict s, const wchar_t *restrict fmt, va_list ap)
        };
        return vfwscanf(&f, fmt, ap);
 }
+
+weak_alias(vswscanf,__isoc99_vswscanf);
index 9297cf0d9455c183ee42fdb5d9c23f0081361fc9..63c9cce10b15a6baba2d7bd3a83b1731ca62360f 100644 (file)
@@ -1,8 +1,11 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <wchar.h>
+#include "libc.h"
 
 int vwscanf(const wchar_t *restrict fmt, va_list ap)
 {
        return vfwscanf(stdin, fmt, ap);
 }
+
+weak_alias(vwscanf,__isoc99_vwscanf);
index a207cc1b703c8ee130428daa82169a36a418f2d9..80412252346d30021b60674641c3d4044834cd64 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <wchar.h>
+#include "libc.h"
 
 int wscanf(const wchar_t *restrict fmt, ...)
 {
@@ -11,3 +12,5 @@ int wscanf(const wchar_t *restrict fmt, ...)
        va_end(ap);
        return ret;
 }
+
+weak_alias(wscanf,__isoc99_wscanf);
index 907dcf079a9a39c977ef52523c4fb564676f5217..da26b4fe9875a13839ce0b105fade0c13fc12712 100644 (file)
@@ -1,5 +1,6 @@
 #include <string.h>
 #include <errno.h>
+#include "libc.h"
 
 int strerror_r(int err, char *buf, size_t buflen)
 {
@@ -15,3 +16,5 @@ int strerror_r(int err, char *buf, size_t buflen)
        memcpy(buf, msg, l+1);
        return 0;
 }
+
+weak_alias(strerror_r, __xpg_strerror_r);