Requires: sqlite
Requires: iniparser
-Provides: libosp-appfw.so.1, libosp-newlib.so.1
+Provides: libosp-appfw.so.1
Requires(post): /sbin/ldconfig
Requires(post): coreutils
/usr/share/locale/*
%config /usr/etc/*
%{_libdir}/osp/libosp-appfw.so*
-%{_libdir}/osp/libosp-newlib.so*
%{_libdir}/osp-server/libosp-appfw-server.so*
%{_libdir}/osp-server/libosp-system-server.so*
%files debug
%{_libdir}/osp/debug/libosp-appfw.so*
-%{_libdir}/osp/debug/libosp-newlib.so*
%{_libdir}/osp-server/debug/libosp-appfw-server.so*
%{_libdir}/osp-server/debug/libosp-system-server.so*
## Add SubModules
-ADD_SUBDIRECTORY(newlib-compat)
ADD_SUBDIRECTORY(app)
ADD_SUBDIRECTORY(io)
ADD_SUBDIRECTORY(base)
OSP_ADD_OBJS_IN_ARCHIVE(${STATIC_LIBS})
# add explicit dependency
-SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed -losp-newlib")
-
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed")
TARGET_LINK_LIBRARIES( ${this_target} ${STATIC_LIBS})
+++ /dev/null
-SET (this_target osp-newlib)
-
-INCLUDE_DIRECTORIES(
- ${SLP_INCLUDE_DIRS}
- ${CMAKE_SOURCE_DIR}/inc
-)
-
-SET (${this_target}_SOURCE_FILES
- NewlibCompatMisc.cpp
- NewlibCompatStdio.cpp
- NewlibCompatStdlib.cpp
- NewlibCompatString.cpp
-)
-
-## SET EXTRA COMPILER FLAGS
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC" )
-
-## SET C COMPILER FLAGS
-SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
-
-## SET CPP COMPILER FLAGS
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
-SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
-
-SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed")
-
-## Create Library
-ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
-
-SET_TARGET_PROPERTIES(${this_target}
- PROPERTIES
- VERSION ${FULLVER}
- SOVERSION ${MAJORVER}
- CLEAN_DIRECT_OUTPUT 1
-)
-
-ADD_CUSTOM_COMMAND(TARGET ${this_target}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${FULLVER}
- COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${FULLVER} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${MAJORVER}
- COMMAND ${CMAKE_STRIP} --strip-unneeded ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}
- COMMENT "strip ${this_target}"
-)
-
+++ /dev/null
-//
-// Copyright (c) 1981, 1993
-// The Regents of the University of California. All rights reserved.
-//
-// This code is derived from software contributed to Berkeley by
-// Chris Torek.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// 3. All advertising materials mentioning features or use of this software
-// must display the following acknowledgement:
-// This product includes software developed by the University of
-// California, Berkeley and its contributors.
-// 4. Neither the name of the University nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-// 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.
-//
-
-
-#include <FOspCompat.h>
-
-_OSP_EXPORT_ const char __unctrllen[256] = {
- 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 2,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
-};
-
-
+++ /dev/null
-//
-// Copyright (c) 1990, 2007 The Regents of the University of California.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms are permitted
-// provided that the above copyright notice and this paragraph are
-// duplicated in all such forms and that any documentation,
-// advertising materials, and other materials related to such
-// distribution and use acknowledge that the software was developed
-// by the University of California, Berkeley. The name of the
-// University may not be used to endorse or promote products derived
-// from this software without specific prior written permission.
-// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-//
-// This license applies to all the permissions of the below mentioned functions.
-// Functions: asiprintf, iprintf, fiprintf, siprintf, sniprintf, vasiprintf,
-// viprintf, vsiprintf, vsniprintf, siscanf, vfiscanf, vsiscanf, fiscanf
-//
-
-
-//
-// Copyright (c) 1990 The Regents of the University of California.
-// All rights reserved.
-//
-// This code is derived from software contributed to Berkeley by
-// Chris Torek.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// 3. All advertising materials mentioning features or use of this software
-// must display the following acknowledgement:
-// This product includes software developed by the University of
-// California, Berkeley and its contributors.
-// 4. Neither the name of the University nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-// 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.
-//
-// This license applies to all the permissions of the below mentioned function.
-// Function: vfiprintf
-//
-
-//
-// Copyright (C) 2007, 2008 Eric Blake
-// Permission to use, copy, modify, and distribute this software
-// is freely granted, provided that this notice is preserved.
-//
-// This license applies to all the permissions of the below mentioned functions.
-// Functions: asnprintfc, vasnprintf, asniprintf, vasniprintf, funopen, fropen, fwopen
-//
-
-//
-// Copyright 2005, 2007 Shaun Jackman
-// Permission to use, copy, modify, and distribute this software
-// is freely granted, provided that this notice is preserved.
-//
-// This license applies to all the permissions of the below mentioned functions.
-// Functions: diprintf, vdiprintf
-//
-
-
-#include <FOspCompat.h>
-
-char*
-asnprintf(char* buf, size_t* lenp, const char* format, ...)
-{
- va_list ap;
- int len = 0;
- va_start (ap, format);
- len = vsnprintf (NULL, 0, format, ap);
- va_end (ap);
-
- if (len < 0)
- {
- return NULL; // errno set by vsnprintf
- }
-
- if (!buf || len >= (int)*lenp)
- {
- buf = (char *)realloc(buf, len + 1);
- if (!buf)
- {
- return NULL; // errno set by malloc
- }
- }
-
- va_start (ap, format);
- *lenp = vsnprintf (buf, len + 1, format, ap);
- va_end (ap);
- return buf;
-}
-
-
-char*
-vasnprintf(char *buf, size_t *lenp, const char *format, va_list ap)
-{
- va_list ap2; // don't consume the original ap, we'll need it again
- va_copy(ap2, ap);
- int len = 0;
- len = vsnprintf (NULL, 0, format, ap2);
- va_end (ap2);
-
- if (len < 0)
- {
- return NULL; // errno set by vsnprintf
- }
- if (!buf || len >= (int)*lenp)
- {
- buf = (char *)realloc(buf, len + 1);
- if (!buf)
- {
- return NULL; // errno set by malloc
- }
- }
- *lenp = vsnprintf(buf, len + 1, format, ap);
-
- return buf;
-}
-
-
-int
-asiprintf(char **strp, const char *format, ...)
-{
- va_list ap;
- va_start (ap, format);
- int ret_val = 0;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- *strp = (char*)realloc(*strp, sizeof(char)*2);
- strcpy(*strp, " ");
- va_end (ap);
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
-
- ret_val = vasprintf(strp, format, ap);
- va_end (ap);
- return ret_val;
-
-done:
- va_end (ap);
- return EOF;
-}
-
-
-char *
-asniprintf(char *buf, size_t *lenp, const char *format, ... )
-{
- va_list ap;
- va_start (ap, format);
- char* pret_val = NULL;
-
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
-
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- va_end (ap);
- return NULL;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- pret_val = vasnprintf(buf, lenp, format, ap);
- va_end (ap);
- return pret_val;
-
-done:
- va_end (ap);
- return NULL;
-}
-
-
-int
-iprintf(const char *format, ...)
-{
- va_list ap;
- va_start (ap, format);
- int ret_val = 0;
-
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
-
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- va_end (ap);
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vprintf(format, ap);
- va_end (ap);
- return ret_val;
-
-done:
- va_end (ap);
- return EOF;
-}
-
-
-int
-fiprintf(FILE * fp, const char *format, ...)
-{
- va_list ap;
- va_start (ap, format);
- int ret_val = 0;
-
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
-
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- va_end (ap);
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vfprintf(fp, format, ap);
- va_end (ap);
- return ret_val;
-
-done:
- va_end (ap);
- return EOF;
-}
-
-int
-siprintf(char *str, const char *format, ...)
-{
- va_list ap;
- va_start (ap, format);
- int ret_val = 0;
-
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- va_end (ap);
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vsprintf(str, format, ap);
- va_end (ap);
- return ret_val;
-
-done:
- va_end (ap);
- return EOF;
-}
-
-
-int
-sniprintf(char *str, size_t size, const char *format, ...)
-{
- va_list ap;
- va_start (ap, format);
- int ret_val = -1;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- va_end (ap);
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
-
- ret_val = vsnprintf(str, size, format, ap);
-
-done:
- va_end (ap);
- return ret_val;
-}
-
-int
-vasiprintf(char **strp, const char *format, va_list ap)
-{
- int ret_val = 0;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vasprintf(strp, format, ap);
- return ret_val;
-
-done: return EOF;
-}
-
-
-char*
-vasniprintf(char *buf, size_t *lenp, const char *format, va_list ap)
-{
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- int len = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
-
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- return NULL;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- pfmt = (char *)format;
-
- len = vsnprintf (NULL, 0, pfmt, ap);
- va_end (ap);
-
- if (len < 0)
- {
- return NULL; // errno set by vsnprintf
- }
-
- if (!buf || len >= (int)(*lenp))
- {
- buf = (char*)malloc(len + 1);
- }
-
- if (!buf)
- {
- return NULL; // errno set by malloc
- }
-
- *lenp = vsnprintf (buf, len + 1, format, ap);
- return buf;
-done: return NULL;
-}
-
-
-int
-vfiprintf(FILE * fp, const char *format, va_list ap)
-{
- int ret_val = 0;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vfprintf(fp, format, ap);
- return ret_val;
-
-done: return EOF;
-}
-
-
-int
-viprintf(const char *format, va_list ap)
-{
- int ret_val = 0;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vprintf(format, ap);
- return ret_val;
-
-done: return EOF;
-}
-
-
-int
-vsiprintf(char *str, const char *format, va_list ap)
-{
- int ret_val = 0;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vsprintf(str, format, ap);
- return ret_val;
-
-done: return EOF;
-}
-
-
-int
-vsniprintf(char *str, size_t size, const char *format, va_list ap)
-{
- int ret_val = 0;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vsnprintf(str, size, format, ap);
- return ret_val;
-
-done: return EOF;
-}
-
-
-int
-diprintf(int fd, const char *format, ...)
-{
- va_list ap;
- va_start (ap, format);
- int ret_val = 0;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- va_end (ap);
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vdprintf(fd, format, ap);
- va_end (ap);
- return ret_val;
-
-done:
- va_end (ap);
- return EOF;
-}
-
-
-int
-siscanf( const char* str, const char* format, ...)
-{
- va_list ap;
- va_start (ap, format);
- int ret_val = 0;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- if (count == 0) // as no format specifier in string
- {
- va_end (ap);
- return 0;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- va_end (ap);
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vsscanf(str, format, ap);
- va_end (ap);
- return ret_val;
-
-done:
- va_end (ap);
- return EOF;
-}
-
-
-int
-vdiprintf(int fd, const char *format, va_list ap)
-{
- int ret_val = 0;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
-
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vdprintf(fd, format, ap);
- return ret_val;
-
-done: return EOF;
-}
-
-int vfiscanf(FILE *fp, const char *format, va_list ap)
-{
- int ret_val = 0;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- if (count == 0) // as no format specifier in string
- {
- return 0;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vfscanf(fp, format, ap);
- return ret_val;
-
-done: return EOF;
-
-}
-
-
-int
-vsiscanf(const char *str, const char *format, va_list ap)
-{
- int ret_val = 0;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- if (count == 0) // as no format specifier in string
- {
- return 0;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vsscanf(str, format, ap);
- return ret_val;
-
-done: return EOF;
-
-}
-
-int
-fiscanf(FILE *fp, const char *format, ...)
-{
- va_list ap;
- va_start (ap, format);
- int ret_val = 0;
- char* pfmt = NULL; // format string
- char ch = 0; // character from pfmt
- int pos[100] = {0, };
- int count = 0;
- int index = 0;
- pfmt = (char *)format;
- while (*pfmt != '\0')
- {
- if (*pfmt == '%')
- {
- pos[count++] = index;
- }
- index++;
- pfmt++;
- }
- if (count == 0) // as no format specifier in string
- {
- va_end (ap);
- return 0;
- }
- pfmt = (char *)format;
-
- if (*pfmt == '\0')
- {
- goto done;
- }
- while ((*pfmt != '%') && ( *pfmt != '\0'))
- {
- pfmt++;
- }
- index = 1;
-
- if (count)
- {
- count--;
- }
-rflag: ch = *pfmt++;
-
- switch (ch)
- {
- case '\'':
- goto rflag;
- // fall through
- case ' ':
- goto rflag;
- // fall through
- case '#':
- goto rflag;
- // fall through
- case '*':
- goto rflag;
- // fall through
- case '-':
- goto rflag;
- // fall through
- case '+':
- goto rflag;
- // fall through
- case '.':
- goto rflag;
- // fall through
-
- case '0':
- goto rflag;
- // fall through
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- goto rflag;
- // fall through
- case 'L':
- goto rflag;
- // fall through
- case 'a':
- case 'A':
- case 'F':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- va_end (ap);
- return EOF;
- break;
-
- default: // "%?" prints ?, unless ? is NUL
- if (count)
- {
- pfmt = (char *)format;
- pfmt = pfmt + pos[index++];
- count--;
- pfmt++;
- goto rflag;
- // fall through
- }
- }
- ret_val = vfscanf(fp, format, ap);
- va_end (ap);
- return ret_val;
-
-done:
- va_end (ap);
- return EOF;
-}
-
-
-typedef __ssize_t __io_read_fn (void* __cookie, char* __buf, size_t __nbytes);
-typedef __ssize_t __io_write_fn (void* __cookie, __const char* __buf, size_t __n);
-typedef int __io_seek_fn (void* __cookie, _IO_off64_t* __pos, int __w);
-typedef int __io_close_fn (void* __cookie);
-
-//typedef _IO_cookie_io_functions_t ;
-
-//FILE* funopen(const void* cookie, funread readfn, funwrite writefn, funseek seekfn, funclose closefn);
-
-FILE*
-funopen(const void* cookie, funread readfn, funwrite writefn, funseek seekfn, funclose closefn)
-{
- cookie_io_functions_t cookiefn;
- char mode[3] = {0, };
- if (readfn)
- {
- cookiefn.read = (__io_read_fn*)readfn;
- if (writefn)
- {
- strcpy(mode, "r+");
- cookiefn.write = (__io_write_fn*)writefn;
- }
- else
- {
- strcpy(mode, "r");
- cookiefn.write = NULL;
- }
- }
- else
- {
- strcpy(mode, "w");
- cookiefn.write = (__io_write_fn*)writefn;
- cookiefn.read = NULL;
- }
- cookiefn.seek = (__io_seek_fn*)seekfn;
- cookiefn.close = (__io_close_fn*)closefn;
-
- return fopencookie((void*)cookie, mode, cookiefn);
-}
-
-
-FILE*
-fropen(const void* cookie, funread readfn)
-{
- return funopen(cookie, readfn, (int (*)(void*, const char*, int))0, (fpos_t (*)(void*, fpos_t , int ))0, (int (*)(void*))0);
-}
-
-FILE*
-fwopen(const void* cookie, funwrite writefn)
-{
- return funopen(cookie, (int (*)(void*, char*, int))0, writefn, (fpos_t (*)(void*, fpos_t , int))0, (int (*)(void*))0);
-}
+++ /dev/null
-//
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// This license applies to all functions, except for the functions under the below mentioned license
-// in this file.
-//
-
-
-//
-// Copyright (c) 1998, M. Warner Losh <imp@freebsd.org>
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.c
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-// 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.
-//
-// This license applies to all the permissions of the below mentioned function.
-// Function: reallocf
-//
-
-
-#include <FOspCompat.h>
-
-float
-atoff(const char* pcStr)
-{
- return strtof (pcStr, NULL);
-}
-
-char*
-ecvtf(float fval, int ndigit, int* decpt, int* sign)
-{
- return ecvt((double)fval, ndigit, decpt, sign);
-}
-
-
-char*
-ecvtbuf(double invalue, int ndigit, int* decpt, int* sign, char* ecvt_buf)
-{
- char* pecvt_ret = ecvt(invalue, ndigit, decpt, sign);
- strcpy(ecvt_buf, pecvt_ret);
- return ecvt_buf;
-}
-
-
-char*
-fcvtf( float fval, int ndigit, int* decpt, int* sign)
-{
- return fcvt((double)fval, ndigit, decpt, sign);
-}
-
-
-char*
-fcvtbuf(double invalue, int ndigit, int* decpt, int* sign, char* fcvt_buf)
-{
- char* pfcvt_ret = fcvt( invalue, ndigit, decpt, sign);
- strcpy(fcvt_buf, pfcvt_ret);
- return fcvt_buf;
-}
-
-
-char*
-gcvtf( float fval, int ndigit, char* buf)
-{
- return gcvt((double)fval, ndigit, buf);
-}
-
-
-void*
-reallocf(void* ptr, unsigned int size)
-{
- void* ptemp = NULL;
- ptemp = realloc( ptr, size);
- if (!ptemp && ptr)
- {
- free( ptr);
- }
- return (ptemp);
-}
+++ /dev/null
-//
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// This license applies to all functions, except for the functions under the below mentioned license
-// in this file.
-//
-
-
-//
-// Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-// 3. The name of the author may not be used to endorse or promote products
-// derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-// THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT 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.
-//
-// This license applies to all the permissions of the below mentioned functions.
-// Functions: wcslcat, wcslcpy
-//
-
-
-#include <FOspCompat.h>
-
-char*
-strlwr(char* pcStr)
-{
- unsigned char* pucs = (unsigned char*) pcStr;
- while (*pucs != '\0')
- {
- *pucs = tolower(*pucs);
- pucs++;
- }
- return pcStr;
-}
-
-
-char*
-strupr(char* pcStr)
-{
- unsigned char *pucs = (unsigned char*) pcStr;
- while (*pucs != '\0')
- {
- *pucs = toupper(*pucs);
- pucs++;
- }
- return pcStr;
-}
-
-
-size_t
-wcslcat(wchar_t* wcDst, const wchar_t* wcSrc, size_t siz)
-{
- wchar_t* pdst = wcDst;
- const wchar_t* psrc = wcSrc;
- size_t count = siz;
- size_t dlen = 0;
-
- // Find the end of pdst and adjust bytes left but don't go past end
- while ((*pdst != '\0') && (count-- != 0))
- {
- pdst++;
- }
-
- dlen = pdst - wcDst;
- count = siz - dlen;
-
- if (count == 0)
- {
- return (dlen + wcslen (psrc));
- }
-
- while (*psrc != '\0')
- {
- if (count != 1)
- {
- *pdst++ = *psrc;
- count--;
- }
- psrc++;
- }
- *pdst = '\0';
-
- return (dlen + (psrc - wcSrc)); // count does not include NUL
-}
-
-
-size_t
-wcslcpy( wchar_t* wcDst, const wchar_t* wcSrc, size_t siz)
-{
- wchar_t* pdst = wcDst;
- const wchar_t* psrc = wcSrc;
- size_t count = siz;
-
- // CopyPanel as many bytes as will fit
- if ((count != 0) && (--count != 0))
- {
- do
- {
- if ((*pdst++ = *psrc++) == 0)
- {
- break;
- }
- }
- while (--count != 0);
- }
-
- // Not enough room in pdst, add NUL and traverse rest of psrc
- if (count == 0)
- {
- if (siz != 0)
- {
- *pdst = '\0'; // NUL-terminate pdst
- }
- while (*psrc++)
- {
- ;
- }
- }
-
- return (psrc - wcSrc - 1); // count does not include NUL
-}
-