diff options
author | Elliott Hughes <enh@google.com> | 2016-08-01 16:35:17 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2016-08-01 18:06:38 -0700 |
commit | 70715da453670b40701ea7d02ea9f702d10d783b (patch) | |
tree | a8e6c37cf0d36012df03ac0d68f395cb2d6e2f0d /libc | |
parent | a86e11f529aca06b2f4d5141ea838f2bc5ae9a73 (diff) |
More stdio one-liners.
This actually turns up a bug in fmemopen, so I guess that's what I'll
look at next...
Change-Id: I2971ecd1b5a3a3c7f43c22d985f88e389af89e97
Diffstat (limited to 'libc')
-rw-r--r-- | libc/Android.bp | 15 | ||||
-rw-r--r-- | libc/stdio/local.h | 10 | ||||
-rw-r--r-- | libc/stdio/stdio.cpp | 95 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/dprintf.c | 48 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/fprintf.c | 48 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/fscanf.c | 48 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/fwprintf.c | 48 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/fwscanf.c | 44 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/getc.c | 62 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/getchar.c | 58 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/printf.c | 48 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/putc.c | 68 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/putchar.c | 59 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/scanf.c | 48 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/swprintf.c | 45 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/swscanf.c | 44 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/wprintf.c | 48 | ||||
-rw-r--r-- | libc/upstream-openbsd/lib/libc/stdio/wscanf.c | 44 |
18 files changed, 94 insertions, 786 deletions
diff --git a/libc/Android.bp b/libc/Android.bp index 4905ec68d..592c40179 100644 --- a/libc/Android.bp +++ b/libc/Android.bp @@ -417,7 +417,6 @@ cc_library_static { "upstream-openbsd/lib/libc/net/ntohs.c", "upstream-openbsd/lib/libc/net/res_random.c", "upstream-openbsd/lib/libc/stdio/asprintf.c", - "upstream-openbsd/lib/libc/stdio/dprintf.c", "upstream-openbsd/lib/libc/stdio/fflush.c", "upstream-openbsd/lib/libc/stdio/fgetln.c", "upstream-openbsd/lib/libc/stdio/fgets.c", @@ -425,20 +424,14 @@ cc_library_static { "upstream-openbsd/lib/libc/stdio/fgetws.c", "upstream-openbsd/lib/libc/stdio/flags.c", "upstream-openbsd/lib/libc/stdio/fmemopen.c", - "upstream-openbsd/lib/libc/stdio/fprintf.c", "upstream-openbsd/lib/libc/stdio/fpurge.c", "upstream-openbsd/lib/libc/stdio/fputs.c", "upstream-openbsd/lib/libc/stdio/fputwc.c", "upstream-openbsd/lib/libc/stdio/fputws.c", - "upstream-openbsd/lib/libc/stdio/fscanf.c", "upstream-openbsd/lib/libc/stdio/fvwrite.c", "upstream-openbsd/lib/libc/stdio/fwalk.c", "upstream-openbsd/lib/libc/stdio/fwide.c", - "upstream-openbsd/lib/libc/stdio/fwprintf.c", "upstream-openbsd/lib/libc/stdio/fwrite.c", - "upstream-openbsd/lib/libc/stdio/fwscanf.c", - "upstream-openbsd/lib/libc/stdio/getc.c", - "upstream-openbsd/lib/libc/stdio/getchar.c", "upstream-openbsd/lib/libc/stdio/getdelim.c", "upstream-openbsd/lib/libc/stdio/gets.c", "upstream-openbsd/lib/libc/stdio/makebuf.c", @@ -446,17 +439,11 @@ cc_library_static { "upstream-openbsd/lib/libc/stdio/open_memstream.c", "upstream-openbsd/lib/libc/stdio/open_wmemstream.c", "upstream-openbsd/lib/libc/stdio/perror.c", - "upstream-openbsd/lib/libc/stdio/printf.c", - "upstream-openbsd/lib/libc/stdio/putc.c", - "upstream-openbsd/lib/libc/stdio/putchar.c", "upstream-openbsd/lib/libc/stdio/puts.c", "upstream-openbsd/lib/libc/stdio/remove.c", "upstream-openbsd/lib/libc/stdio/rget.c", - "upstream-openbsd/lib/libc/stdio/scanf.c", "upstream-openbsd/lib/libc/stdio/setvbuf.c", "upstream-openbsd/lib/libc/stdio/sscanf.c", - "upstream-openbsd/lib/libc/stdio/swprintf.c", - "upstream-openbsd/lib/libc/stdio/swscanf.c", "upstream-openbsd/lib/libc/stdio/tempnam.c", "upstream-openbsd/lib/libc/stdio/tmpnam.c", "upstream-openbsd/lib/libc/stdio/ungetc.c", @@ -473,8 +460,6 @@ cc_library_static { "upstream-openbsd/lib/libc/stdio/vswprintf.c", "upstream-openbsd/lib/libc/stdio/vswscanf.c", "upstream-openbsd/lib/libc/stdio/wbuf.c", - "upstream-openbsd/lib/libc/stdio/wprintf.c", - "upstream-openbsd/lib/libc/stdio/wscanf.c", "upstream-openbsd/lib/libc/stdio/wsetup.c", "upstream-openbsd/lib/libc/stdlib/abs.c", "upstream-openbsd/lib/libc/stdlib/atoi.c", diff --git a/libc/stdio/local.h b/libc/stdio/local.h index f25e90213..7be5a7cb9 100644 --- a/libc/stdio/local.h +++ b/libc/stdio/local.h @@ -246,19 +246,9 @@ int __vfwscanf(FILE * __restrict, const wchar_t * __restrict, __va_list); #define NO_PRINTF_PERCENT_N /* OpenBSD exposes these in <stdio.h>, but we only want them exposed to the implementation. */ -#define __sfeof(p) (((p)->_flags & __SEOF) != 0) #define __sferror(p) (((p)->_flags & __SERR) != 0) #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) -#if !defined(__cplusplus) #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) -static __inline int __sputc(int _c, FILE* _p) { - if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) { - return (*_p->_p++ = _c); - } else { - return (__swbuf(_c, _p)); - } -} -#endif /* OpenBSD declares these in fvwrite.h but we want to ensure they're hidden. */ struct __suio; diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp index d218ee6d7..53b3faeb1 100644 --- a/libc/stdio/stdio.cpp +++ b/libc/stdio/stdio.cpp @@ -53,6 +53,13 @@ #define NDYNAMIC 10 /* add ten more whenever necessary */ +#define PRINTF_IMPL(expr) \ + va_list ap; \ + va_start(ap, fmt); \ + int result = (expr); \ + va_end(ap); \ + return result; + #define std(flags, file) \ {0,0,0,flags,file,{0,0},0,__sF+file,__sclose,__sread,nullptr,__swrite, \ {(unsigned char *)(__sFext+file), 0},nullptr,0,{0},{0},{0,0},0,0} @@ -412,7 +419,7 @@ void clearerr(FILE* fp) { } int feof_unlocked(FILE* fp) { - return __sfeof(fp); + return ((fp->_flags & __SEOF) != 0); } int feof(FILE* fp) { @@ -640,6 +647,14 @@ char* ctermid(char* s) { return s ? strcpy(s, _PATH_TTY) : const_cast<char*>(_PATH_TTY); } +int dprintf(int fd, const char* fmt, ...) { + PRINTF_IMPL(vdprintf(fd, fmt, ap)); +} + +int fprintf(FILE* fp, const char* fmt, ...) { + PRINTF_IMPL(vfprintf(fp, fmt, ap)); +} + int fgetc(FILE* fp) { return getc(fp); } @@ -648,6 +663,35 @@ int fputc(int c, FILE* fp) { return putc(c, fp); } +int fscanf(FILE* fp, const char* fmt, ...) { + PRINTF_IMPL(vfscanf(fp, fmt, ap)); +} + +int fwprintf(FILE* fp, const wchar_t* fmt, ...) { + PRINTF_IMPL(vfwprintf(fp, fmt, ap)); +} + +int fwscanf(FILE* fp, const wchar_t* fmt, ...) { + PRINTF_IMPL(vfwscanf(fp, fmt, ap)); +} + +int getc(FILE* fp) { + ScopedFileLock sfl(fp); + return getc_unlocked(fp); +} + +int getc_unlocked(FILE* fp) { + return __sgetc(fp); +} + +int getchar_unlocked() { + return getc_unlocked(stdin); +} + +int getchar() { + return getc(stdin); +} + ssize_t getline(char** buf, size_t* len, FILE* fp) { return getdelim(buf, len, '\n', fp); } @@ -660,6 +704,35 @@ wint_t getwchar() { return fgetwc(stdin); } +int printf(const char* fmt, ...) { + PRINTF_IMPL(vfprintf(stdout, fmt, ap)); +} + +int putc(int c, FILE* fp) { + ScopedFileLock sfl(fp); + return putc_unlocked(c, fp); +} + +int putc_unlocked(int c, FILE* fp) { + if (cantwrite(fp)) { + errno = EBADF; + return EOF; + } + _SET_ORIENTATION(fp, -1); + if (--fp->_w >= 0 || (fp->_w >= fp->_lbfsize && c != '\n')) { + return (*fp->_p++ = c); + } + return (__swbuf(c, fp)); +} + +int putchar(int c) { + return putc(c, stdout); +} + +int putchar_unlocked(int c) { + return putc_unlocked(c, stdout); +} + wint_t putwc(wchar_t wc, FILE* fp) { return fputwc(wc, fp); } @@ -674,6 +747,10 @@ void rewind(FILE* fp) { clearerr_unlocked(fp); } +int scanf(const char* fmt, ...) { + PRINTF_IMPL(vfscanf(stdin, fmt, ap)); +} + void setbuf(FILE* fp, char* buf) { setbuffer(fp, buf, BUFSIZ); } @@ -686,6 +763,14 @@ int setlinebuf(FILE* fp) { return setvbuf(fp, nullptr, _IOLBF, 0); } +int swprintf(wchar_t* s, size_t n, const wchar_t* fmt, ...) { + PRINTF_IMPL(vswprintf(s, n, fmt, ap)); +} + +int swscanf(const wchar_t* s, const wchar_t* fmt, ...) { + PRINTF_IMPL(vswscanf(s, fmt, ap)); +} + int vprintf(const char* fmt, va_list ap) { return vfprintf(stdout, fmt, ap); } @@ -701,3 +786,11 @@ int vwprintf(const wchar_t* fmt, va_list ap) { int vwscanf(const wchar_t* fmt, va_list ap) { return vfwscanf(stdin, fmt, ap); } + +int wprintf(const wchar_t* fmt, ...) { + PRINTF_IMPL(vfwprintf(stdout, fmt, ap)); +} + +int wscanf(const wchar_t* fmt, ...) { + PRINTF_IMPL(vfwscanf(stdin, fmt, ap)); +} diff --git a/libc/upstream-openbsd/lib/libc/stdio/dprintf.c b/libc/upstream-openbsd/lib/libc/stdio/dprintf.c deleted file mode 100644 index dbf7d3457..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/dprintf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: dprintf.c,v 1.1 2013/01/30 00:08:13 brad Exp $ */ -/* $FreeBSD: src/lib/libc/stdio/dprintf.c,v 1.2 2012/11/17 01:49:39 svnexp Exp $ */ - -/*- - * Copyright (c) 2009 David Schultz <das@FreeBSD.org> - * All rights reserved. - * - * Copyright (c) 2011 The FreeBSD Foundation - * All rights reserved. - * Portions of this software were developed by David Chisnall - * under sponsorship from the FreeBSD Foundation. - * - * 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. - * - * 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. - */ - -#include <stdio.h> -#include <stdarg.h> - -int -dprintf(int fd, const char * __restrict fmt, ...) -{ - va_list ap; - int ret; - - va_start(ap, fmt); - ret = vdprintf(fd, fmt, ap); - va_end(ap); - return ret; -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/fprintf.c b/libc/upstream-openbsd/lib/libc/stdio/fprintf.c deleted file mode 100644 index a391142ea..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/fprintf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: fprintf.c,v 1.7 2011/05/30 18:48:33 martynas Exp $ */ -/*- - * Copyright (c) 1990, 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. 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 <stdio.h> -#include <stdarg.h> - -/* PRINTFLIKE2 */ -int -fprintf(FILE *fp, const char *fmt, ...) -{ - int ret; - va_list ap; - - va_start(ap, fmt); - ret = vfprintf(fp, fmt, ap); - va_end(ap); - return (ret); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/fscanf.c b/libc/upstream-openbsd/lib/libc/stdio/fscanf.c deleted file mode 100644 index 5fd10d4a4..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/fscanf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: fscanf.c,v 1.10 2011/05/30 18:48:33 martynas Exp $ */ -/*- - * Copyright (c) 1990, 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. 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 <stdio.h> -#include <stdarg.h> - -/* SCANFLIKE2 */ -int -fscanf(FILE *fp, const char *fmt, ...) -{ - int ret; - va_list ap; - - va_start(ap, fmt); - ret = vfscanf(fp, fmt, ap); - va_end(ap); - return (ret); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/fwprintf.c b/libc/upstream-openbsd/lib/libc/stdio/fwprintf.c deleted file mode 100644 index 4474e8b35..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/fwprintf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: fwprintf.c,v 1.3 2011/04/28 17:38:46 stsp Exp $ */ -/*- - * Copyright (c) 1990, 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. 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 <stdio.h> -#include <stdarg.h> -#include <wchar.h> - -int -fwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...) -{ - int ret; - va_list ap; - - va_start(ap, fmt); - ret = vfwprintf(fp, fmt, ap); - va_end(ap); - return (ret); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/fwscanf.c b/libc/upstream-openbsd/lib/libc/stdio/fwscanf.c deleted file mode 100644 index b716cbff3..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/fwscanf.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: fwscanf.c,v 1.2 2012/12/05 23:20:01 deraadt Exp $ */ - -/*- - * Copyright (c) 2002 Tim J. Robbins - * 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. - * - * 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. - */ - -#include <stdarg.h> -#include <stdio.h> -#include <wchar.h> - -int -fwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...) -{ - va_list ap; - int r; - - va_start(ap, fmt); - r = vfwscanf(fp, fmt, ap); - va_end(ap); - - return (r); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/getc.c b/libc/upstream-openbsd/lib/libc/stdio/getc.c deleted file mode 100644 index 6879cbb79..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/getc.c +++ /dev/null @@ -1,62 +0,0 @@ -/* $OpenBSD: getc.c,v 1.9 2009/11/09 00:18:27 kurt Exp $ */ -/*- - * Copyright (c) 1990, 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. 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 <stdio.h> -#include "local.h" - -/* - * A subroutine version of the macro getc_unlocked. - */ -#undef getc_unlocked - -int -getc_unlocked(FILE *fp) -{ - return (__sgetc(fp)); -} - -/* - * A subroutine version of the macro getc. - */ -#undef getc - -int -getc(FILE *fp) -{ - int c; - - FLOCKFILE(fp); - c = __sgetc(fp); - FUNLOCKFILE(fp); - return (c); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/getchar.c b/libc/upstream-openbsd/lib/libc/stdio/getchar.c deleted file mode 100644 index 550817de0..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/getchar.c +++ /dev/null @@ -1,58 +0,0 @@ -/* $OpenBSD: getchar.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */ -/*- - * Copyright (c) 1990, 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. 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 <stdio.h> - -/* - * A subroutine version of the macro getchar_unlocked. - */ -#undef getchar_unlocked - -int -getchar_unlocked(void) -{ - return (getc_unlocked(stdin)); -} - - -/* - * A subroutine version of the macro getchar. - */ - -#undef getchar - -int -getchar(void) -{ - return (getc(stdin)); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/printf.c b/libc/upstream-openbsd/lib/libc/stdio/printf.c deleted file mode 100644 index 09bb3d7f7..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/printf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: printf.c,v 1.8 2011/05/30 18:48:33 martynas Exp $ */ -/*- - * Copyright (c) 1990, 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. 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 <stdio.h> -#include <stdarg.h> - -/* PRINTFLIKE1 */ -int -printf(const char *fmt, ...) -{ - int ret; - va_list ap; - - va_start(ap, fmt); - ret = vfprintf(stdout, fmt, ap); - va_end(ap); - return (ret); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/putc.c b/libc/upstream-openbsd/lib/libc/stdio/putc.c deleted file mode 100644 index 762fecb2d..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/putc.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $OpenBSD: putc.c,v 1.12 2009/11/21 10:11:54 guenther Exp $ */ -/*- - * Copyright (c) 1990, 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. 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 <stdio.h> -#include <errno.h> -#include "local.h" - -/* - * A subroutine version of the macro putc_unlocked. - */ -#undef putc_unlocked - -int -putc_unlocked(int c, FILE *fp) -{ - if (cantwrite(fp)) { - errno = EBADF; - return (EOF); - } - _SET_ORIENTATION(fp, -1); - return (__sputc(c, fp)); -} - -/* - * A subroutine version of the macro putc. - */ -#undef putc - -int -putc(int c, FILE *fp) -{ - int ret; - - FLOCKFILE(fp); - ret = putc_unlocked(c, fp); - FUNLOCKFILE(fp); - return (ret); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/putchar.c b/libc/upstream-openbsd/lib/libc/stdio/putchar.c deleted file mode 100644 index 233cdfd02..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/putchar.c +++ /dev/null @@ -1,59 +0,0 @@ -/* $OpenBSD: putchar.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */ -/*- - * Copyright (c) 1990, 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. 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 <stdio.h> - -#undef putchar_unlocked -/* - * A subrouting version of the macro putchar_unlocked - */ -int -putchar_unlocked(int c) -{ - FILE *so = stdout; - - return (putc_unlocked(c,so)); -} - -#undef putchar - -/* - * A subroutine version of the macro putchar - */ -int -putchar(int c) -{ - FILE *so = stdout; - - return (putc(c, so)); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/scanf.c b/libc/upstream-openbsd/lib/libc/stdio/scanf.c deleted file mode 100644 index 90cf12a3b..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/scanf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: scanf.c,v 1.10 2011/05/30 18:48:33 martynas Exp $ */ -/*- - * Copyright (c) 1990, 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. 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 <stdio.h> -#include <stdarg.h> - -/* SCANFLIKE1 */ -int -scanf(const char *fmt, ...) -{ - int ret; - va_list ap; - - va_start(ap, fmt); - ret = vfscanf(stdin, fmt, ap); - va_end(ap); - return (ret); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/swprintf.c b/libc/upstream-openbsd/lib/libc/stdio/swprintf.c deleted file mode 100644 index 8928aeabb..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/swprintf.c +++ /dev/null @@ -1,45 +0,0 @@ -/* $OpenBSD: swprintf.c,v 1.5 2012/12/05 23:20:01 deraadt Exp $ */ -/* $NetBSD: swprintf.c,v 1.1 2005/05/14 23:51:02 christos Exp $ */ - -/*- - * Copyright (c) 2002 Tim J. Robbins - * 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. - * - * 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. - */ - -#include <stdarg.h> -#include <stdio.h> -#include <wchar.h> - -int -swprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, ...) -{ - int ret; - va_list ap; - - va_start(ap, fmt); - ret = vswprintf(s, n, fmt, ap); - va_end(ap); - - return (ret); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/swscanf.c b/libc/upstream-openbsd/lib/libc/stdio/swscanf.c deleted file mode 100644 index a85e9ee2b..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/swscanf.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: swscanf.c,v 1.2 2012/12/05 23:20:01 deraadt Exp $ */ - -/*- - * Copyright (c) 2002 Tim J. Robbins - * 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. - * - * 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. - */ - -#include <stdarg.h> -#include <stdio.h> -#include <wchar.h> - -int -swscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt, ...) -{ - va_list ap; - int r; - - va_start(ap, fmt); - r = vswscanf(str, fmt, ap); - va_end(ap); - - return (r); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/wprintf.c b/libc/upstream-openbsd/lib/libc/stdio/wprintf.c deleted file mode 100644 index 9f7abb64e..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/wprintf.c +++ /dev/null @@ -1,48 +0,0 @@ -/* $OpenBSD: wprintf.c,v 1.3 2011/04/28 17:38:46 stsp Exp $ */ -/*- - * Copyright (c) 1990, 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. 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 <stdio.h> -#include <stdarg.h> -#include <wchar.h> - -int -wprintf(const wchar_t * __restrict fmt, ...) -{ - int ret; - va_list ap; - - va_start(ap, fmt); - ret = vfwprintf(stdout, fmt, ap); - va_end(ap); - return (ret); -} diff --git a/libc/upstream-openbsd/lib/libc/stdio/wscanf.c b/libc/upstream-openbsd/lib/libc/stdio/wscanf.c deleted file mode 100644 index 06c0829ab..000000000 --- a/libc/upstream-openbsd/lib/libc/stdio/wscanf.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: wscanf.c,v 1.2 2012/12/05 23:20:01 deraadt Exp $ */ - -/*- - * Copyright (c) 2002 Tim J. Robbins - * 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. - * - * 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. - */ - -#include <stdarg.h> -#include <stdio.h> -#include <wchar.h> - -int -wscanf(const wchar_t * __restrict fmt, ...) -{ - va_list ap; - int r; - - va_start(ap, fmt); - r = vfwscanf(stdin, fmt, ap); - va_end(ap); - - return (r); -} |