Add Socket Libraries.
Add Posix functions for porting compatibility. Fix compliance issues with ISO/IEC 9899:199409 New Functions: setenv(), fparseln(), GetFileNameFromPath(), rename(), realpath(), setprogname(), getprogname(), strlcat(), strlcpy(), strsep(), setitimer(), getitimer(), timegm(), getopt(), basename(), mkstemp(), ffs(), vsnprintf(), snprintf(), getpass(), usleep(), select(), writev(), strcasecmp(), getcwd(), chdir(), tcgetpgrp(), getpgrp(), gettimeofday(), bcopy(), git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12061 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -72,6 +72,7 @@
|
||||
|
||||
snprintf.c
|
||||
vsnprintf.c
|
||||
fparseln.c
|
||||
|
||||
# Wide character functions
|
||||
fgetwc.c #
|
||||
|
@@ -104,7 +104,7 @@ freopen(const char *file, const char *mode, FILE *fp)
|
||||
(void) __sflush(fp);
|
||||
/* if close is NULL, closing is a no-op, hence pointless */
|
||||
isopen = fp->_close != NULL;
|
||||
if ((wantfd = fp->_file) < 0 && isopen) {
|
||||
if (((wantfd = fp->_file) >= 0) && isopen) {
|
||||
(void) (*fp->_close)(fp->_cookie);
|
||||
isopen = 0;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ freopen(const char *file, const char *mode, FILE *fp)
|
||||
* keep fp->_base: it may be the wrong size. This loses the effect
|
||||
* of any setbuffer calls, but stdio has always done this before.
|
||||
*/
|
||||
if (isopen && f != wantfd)
|
||||
if (isopen && (f != wantfd))
|
||||
(void) (*fp->_close)(fp->_cookie);
|
||||
if (fp->_flags & __SMBF)
|
||||
free((char *)fp->_bf._base);
|
||||
|
@@ -238,6 +238,7 @@ fseeko(FILE *fp, off_t offset, int whence)
|
||||
fp->_r = (int)(n - o);
|
||||
if (HASUB(fp))
|
||||
FREEUB(fp);
|
||||
WCIO_FREE(fp); /* Should this really be unconditional??? */
|
||||
fp->_flags &= ~__SEOF;
|
||||
FUNLOCKFILE(fp);
|
||||
return (0);
|
||||
@@ -261,6 +262,7 @@ fseeko(FILE *fp, off_t offset, int whence)
|
||||
fp->_p = fp->_bf._base;
|
||||
if (HASUB(fp))
|
||||
FREEUB(fp);
|
||||
WCIO_FREE(fp); /* Should this really be unconditional??? */
|
||||
fp->_flags &= ~__SEOF;
|
||||
n = (int)(target - curoff);
|
||||
if (n) {
|
||||
@@ -290,9 +292,10 @@ dumb:
|
||||
/* success: clear EOF indicator and discard ungetc() data */
|
||||
if (HASUB(fp))
|
||||
FREEUB(fp);
|
||||
WCIO_FREE(fp); /* Should this really be unconditional??? */
|
||||
fp->_p = fp->_bf._base;
|
||||
fp->_r = 0;
|
||||
/* fp->_w = 0; */ /* unnecessary (I think...) */
|
||||
fp->_w = 0;
|
||||
fp->_flags &= ~__SEOF;
|
||||
FUNLOCKFILE(fp);
|
||||
//Print(L"%a: %d\n", __func__, __LINE__);
|
||||
|
@@ -45,7 +45,7 @@
|
||||
#include "nbtool_config.h"
|
||||
#endif
|
||||
|
||||
#if !HAVE_NBTOOL_CONFIG_H || !HAVE_MKSTEMP || !HAVE_MKDTEMP
|
||||
#if !defined(HAVE_NBTOOL_CONFIG_H) || !defined(HAVE_MKSTEMP) || !defined(HAVE_MKDTEMP)
|
||||
|
||||
#include <sys/EfiCdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
|
@@ -64,11 +64,11 @@ extern int _fwalk(int (*)(FILE *));
|
||||
extern char *_mktemp(char *);
|
||||
extern int __swsetup(FILE *);
|
||||
extern int __sflags(const char *, int *);
|
||||
extern int __svfscanf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_)
|
||||
extern int __svfscanf(FILE * __restrict, const char * __restrict, va_list)
|
||||
__attribute__((__format__(__scanf__, 2, 0)));
|
||||
extern int __svfscanf_unlocked(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_)
|
||||
extern int __svfscanf_unlocked(FILE * __restrict, const char * __restrict, va_list)
|
||||
__attribute__((__format__(__scanf__, 2, 0)));
|
||||
extern int __vfprintf_unlocked(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_);
|
||||
extern int __vfprintf_unlocked(FILE * __restrict, const char * __restrict, va_list);
|
||||
|
||||
|
||||
extern int __sdidinit;
|
||||
@@ -80,8 +80,8 @@ extern wint_t __fputwc_unlock(wchar_t, FILE *);
|
||||
|
||||
extern char *__fgetstr(FILE * __restrict, size_t * __restrict, int);
|
||||
extern int __slbexpand(FILE *, size_t);
|
||||
extern int __vfwprintf_unlocked(FILE *, const wchar_t *, _BSD_VA_LIST_);
|
||||
extern int __vfwscanf_unlocked(FILE * __restrict, const wchar_t * __restrict, _BSD_VA_LIST_);
|
||||
extern int __vfwprintf_unlocked(FILE *, const wchar_t *, va_list);
|
||||
extern int __vfwscanf_unlocked(FILE * __restrict, const wchar_t * __restrict, va_list);
|
||||
|
||||
/*
|
||||
* Return true iff the given FILE cannot be written now.
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#include "nbtool_config.h"
|
||||
#endif
|
||||
|
||||
#if !HAVE_NBTOOL_CONFIG_H || !HAVE_MKSTEMP
|
||||
#if !defined(HAVE_NBTOOL_CONFIG_H) || !defined(HAVE_MKSTEMP)
|
||||
|
||||
#include <sys/EfiCdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
|
@@ -1,6 +1,13 @@
|
||||
/* $NetBSD: setbuffer.c,v 1.10 2003/08/07 16:43:31 agc Exp $ */
|
||||
/*
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License that accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
@@ -30,16 +37,12 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
NetBSD: setbuffer.c,v 1.10 2003/08/07 16:43:31 agc Exp
|
||||
setbuffer.c 8.1 (Berkeley) 6/4/93
|
||||
*/
|
||||
#include <LibConfig.h>
|
||||
#include <sys/EfiCdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)setbuffer.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: setbuffer.c,v 1.10 2003/08/07 16:43:31 agc Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
@@ -1056,8 +1056,6 @@ reswitch: switch (ch) {
|
||||
xdigs = xdigs_upper;
|
||||
expchar = 'P';
|
||||
}
|
||||
if (prec >= 0)
|
||||
prec++;
|
||||
if (flags & LONGDBL) {
|
||||
fparg.ldbl = GETARG(long double);
|
||||
dtoaresult =
|
||||
@@ -1092,10 +1090,8 @@ reswitch: switch (ch) {
|
||||
case 'e':
|
||||
case 'E':
|
||||
expchar = ch;
|
||||
if (prec < 0) /* account for digit before decpt */
|
||||
prec = DEFPREC + 1;
|
||||
else
|
||||
prec++;
|
||||
if (prec < 0)
|
||||
prec = DEFPREC;
|
||||
goto fp_begin;
|
||||
case 'f':
|
||||
case 'F':
|
||||
@@ -1165,10 +1161,8 @@ fp_common:
|
||||
case 'e':
|
||||
case 'E':
|
||||
expchar = ch;
|
||||
if (prec < 0) /* account for digit before decpt */
|
||||
prec = DEFPREC /* + 1*/ ;
|
||||
else
|
||||
prec++;
|
||||
if (prec < 0)
|
||||
prec = DEFPREC;
|
||||
goto fp_begin;
|
||||
case 'f':
|
||||
case 'F':
|
||||
@@ -1242,16 +1236,21 @@ fp_begin:
|
||||
/*
|
||||
* Make %[gG] smell like %[eE], but
|
||||
* trim trailing zeroes if no # flag.
|
||||
*
|
||||
* Note: The precision field used with [gG] is the number significant
|
||||
* digits to print. When converting to [eE] the digit before the
|
||||
* decimal must not be included in the precision value.
|
||||
*/
|
||||
if (!(flags & ALT))
|
||||
prec = ndig;
|
||||
prec = ndig - 1;
|
||||
}
|
||||
}
|
||||
if (expchar) {
|
||||
dprec = prec; /* In some cases dprec will not be set. Make sure it is set now */
|
||||
expsize = exponent(expstr, expt - 1, expchar);
|
||||
size = expsize + prec;
|
||||
if (prec > 1 || flags & ALT)
|
||||
++size;
|
||||
size = expsize + prec + 1; /* Leading digit + exponent string + precision */
|
||||
if (prec >= 1 || flags & ALT)
|
||||
++size; /* Decimal point is added to character count */
|
||||
} else {
|
||||
/* space for digits before decimal point */
|
||||
if (expt > 0)
|
||||
@@ -1322,7 +1321,7 @@ fp_begin:
|
||||
* defined manner.''
|
||||
* -- ANSI X3J11
|
||||
*/
|
||||
ujval = (uintmax_t)GETARG(void *);
|
||||
ujval = (uintmax_t) (UINTN) GETARG(void *);
|
||||
base = 16;
|
||||
xdigs = xdigs_lower;
|
||||
flags = flags | INTMAXT;
|
||||
@@ -1332,7 +1331,7 @@ fp_begin:
|
||||
flags |= LONGINT;
|
||||
/*FALLTHROUGH*/
|
||||
case 's':
|
||||
if ((flags & LONGINT) != MULTI) {
|
||||
if (((flags & LONGINT) ? 1:0) != MULTI) {
|
||||
if ((result = GETARG(CHAR_T *)) == NULL)
|
||||
result = STRCONST("(null)");
|
||||
} else {
|
||||
@@ -1538,7 +1537,7 @@ number: if ((dprec = prec) >= 0)
|
||||
PRINTANDPAD(result, convbuf + ndig, prec,
|
||||
zeroes);
|
||||
} else { /* %[eE] or sufficiently long %[gG] */
|
||||
if (prec > 1 || flags & ALT) {
|
||||
if (prec >= 1 || flags & ALT) {
|
||||
buf[0] = *result++;
|
||||
buf[1] = *decimal_point;
|
||||
PRINT(buf, 2);
|
||||
@@ -2003,8 +2002,6 @@ cvt(double value, int ndigits, int flags, char *sign, int *decpt, int ch,
|
||||
*decpt = -ndigits + 1;
|
||||
bp += *decpt;
|
||||
}
|
||||
if (value == 0) /* kludge for __dtoa irregularity */
|
||||
rve = bp;
|
||||
while (rve < bp)
|
||||
*rve++ = '0';
|
||||
}
|
||||
|
@@ -198,7 +198,7 @@ literal:
|
||||
goto input_failure;
|
||||
if (wi != c) {
|
||||
ungetwc(wi, fp);
|
||||
goto input_failure;
|
||||
goto match_failure;
|
||||
}
|
||||
nread++;
|
||||
continue;
|
||||
@@ -721,20 +721,19 @@ literal:
|
||||
if ((width = parsefloat(fp, buf, buf + width)) == 0)
|
||||
goto match_failure;
|
||||
if ((flags & SUPPRESS) == 0) {
|
||||
#ifdef notyet
|
||||
#ifdef REAL_LONG_DOUBLE_SUPPORT
|
||||
if (flags & LONGDBL) {
|
||||
long double res = wcstold(buf, &p);
|
||||
*va_arg(ap, long double *) = res;
|
||||
} else
|
||||
#endif
|
||||
if (flags & LONG) {
|
||||
if (flags & (LONG | LONGDBL)) {
|
||||
double res = wcstod(buf, &p);
|
||||
*va_arg(ap, double *) = res;
|
||||
#ifdef notyet
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
float res = wcstof(buf, &p);
|
||||
*va_arg(ap, float *) = res;
|
||||
#endif
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (p - buf != width)
|
||||
|
@@ -50,7 +50,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
vprintf(char const *fmt, _BSD_VA_LIST_ ap)
|
||||
vprintf(char const *fmt, va_list ap)
|
||||
{
|
||||
_DIAGASSERT(fmt != NULL);
|
||||
|
||||
|
@@ -54,7 +54,7 @@ __weak_alias(vsnprintf,_vsnprintf)
|
||||
#endif
|
||||
|
||||
int
|
||||
vsnprintf(char *str, size_t n, const char *fmt, _BSD_VA_LIST_ ap)
|
||||
vsnprintf(char *str, size_t n, const char *fmt, va_list ap)
|
||||
{
|
||||
int ret;
|
||||
FILE f;
|
||||
|
@@ -117,7 +117,7 @@ __weak_alias(vsnprintf_ss,_vsnprintf_ss)
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
int
|
||||
vsnprintf_ss(char *sbuf, size_t slen, const char *fmt0, _BSD_VA_LIST_ ap)
|
||||
vsnprintf_ss(char *sbuf, size_t slen, const char *fmt0, va_list ap)
|
||||
{
|
||||
const char *fmt; /* format string */
|
||||
int ch; /* character from fmt */
|
||||
|
@@ -53,7 +53,7 @@
|
||||
#include "local.h"
|
||||
|
||||
int
|
||||
vsprintf(char *str, const char *fmt, _BSD_VA_LIST_ ap)
|
||||
vsprintf(char *str, const char *fmt, va_list ap)
|
||||
{
|
||||
int ret;
|
||||
FILE f;
|
||||
|
Reference in New Issue
Block a user