Add ABI compatability aliases.

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.
This commit is contained in:
Isaac Dunham 2013-04-05 23:20:28 -07:00
parent ced64995c2
commit 14f0272ea1
13 changed files with 38 additions and 0 deletions

View File

@ -70,3 +70,5 @@ int getopt(int argc, char * const argv[], const char *optstring)
}
return c;
}
weak_alias(getopt, __posix_getopt);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);