diff options
Diffstat (limited to 'gnulib/lib/unistdio')
73 files changed, 2438 insertions, 0 deletions
diff --git a/gnulib b/gnulib deleted file mode 160000 -Subproject 443bc5ffcf7429e557f4a371b0661abe98ddbc1 diff --git a/gnulib/lib/unistdio/u-asnprintf.h b/gnulib/lib/unistdio/u-asnprintf.h new file mode 100644 index 0000000..7efc4e4 --- /dev/null +++ b/gnulib/lib/unistdio/u-asnprintf.h @@ -0,0 +1,28 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +DCHAR_T * +ASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, const FCHAR_T *format, ...) +{ + va_list args; + DCHAR_T *result; + + va_start (args, format); + result = VASNPRINTF (resultbuf, lengthp, format, args); + va_end (args); + return result; +} diff --git a/gnulib/lib/unistdio/u-asprintf.h b/gnulib/lib/unistdio/u-asprintf.h new file mode 100644 index 0000000..38d9829 --- /dev/null +++ b/gnulib/lib/unistdio/u-asprintf.h @@ -0,0 +1,28 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +int +ASPRINTF (DCHAR_T **resultp, const FCHAR_T *format, ...) +{ + va_list args; + int result; + + va_start (args, format); + result = VASPRINTF (resultp, format, args); + va_end (args); + return result; +} diff --git a/gnulib/lib/unistdio/u-printf-args.c b/gnulib/lib/unistdio/u-printf-args.c new file mode 100644 index 0000000..a32991d --- /dev/null +++ b/gnulib/lib/unistdio/u-printf-args.c @@ -0,0 +1,23 @@ +/* Decomposed printf argument list. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio/u-printf-args.h" + +#include "printf-args.c" diff --git a/gnulib/lib/unistdio/u-printf-args.h b/gnulib/lib/unistdio/u-printf-args.h new file mode 100644 index 0000000..feb3f56 --- /dev/null +++ b/gnulib/lib/unistdio/u-printf-args.h @@ -0,0 +1,28 @@ +/* Decomposed printf argument list. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef _U_PRINTF_ARGS_H +#define _U_PRINTF_ARGS_H + +#include "unitypes.h" + +/* Parametrization of printf-args.h. */ +#define ENABLE_UNISTDIO 1 +#define PRINTF_FETCHARGS u_printf_fetchargs +#include "printf-args.h" + +#endif /* _U_PRINTF_ARGS_H */ diff --git a/gnulib/lib/unistdio/u-printf-parse.h b/gnulib/lib/unistdio/u-printf-parse.h new file mode 100644 index 0000000..651c7fe --- /dev/null +++ b/gnulib/lib/unistdio/u-printf-parse.h @@ -0,0 +1,28 @@ +/* Parse printf format string. + Copyright (C) 1999, 2002, 2005, 2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef _U_PRINTF_PARSE_H +#define _U_PRINTF_PARSE_H + +#include "unistdio/u-printf-args.h" + +/* Parametrization of printf-parse.h. */ +#undef ENABLE_UNISTDIO +#define ENABLE_UNISTDIO 1 +#include "printf-parse.h" + +#endif /* _U_PRINTF_PARSE_H */ diff --git a/gnulib/lib/unistdio/u-snprintf.h b/gnulib/lib/unistdio/u-snprintf.h new file mode 100644 index 0000000..8094f49 --- /dev/null +++ b/gnulib/lib/unistdio/u-snprintf.h @@ -0,0 +1,28 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +int +SNPRINTF (DCHAR_T *buf, size_t size, const FCHAR_T *format, ...) +{ + va_list args; + int result; + + va_start (args, format); + result = VSNPRINTF (buf, size, format, args); + va_end (args); + return result; +} diff --git a/gnulib/lib/unistdio/u-sprintf.h b/gnulib/lib/unistdio/u-sprintf.h new file mode 100644 index 0000000..eb3119d --- /dev/null +++ b/gnulib/lib/unistdio/u-sprintf.h @@ -0,0 +1,28 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +int +SPRINTF (DCHAR_T *buf, const FCHAR_T *format, ...) +{ + va_list args; + int result; + + va_start (args, format); + result = VSPRINTF (buf, format, args); + va_end (args); + return result; +} diff --git a/gnulib/lib/unistdio/u-vasprintf.h b/gnulib/lib/unistdio/u-vasprintf.h new file mode 100644 index 0000000..68bc9b5 --- /dev/null +++ b/gnulib/lib/unistdio/u-vasprintf.h @@ -0,0 +1,35 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +int +VASPRINTF (DCHAR_T **resultp, const FCHAR_T *format, va_list args) +{ + size_t length; + DCHAR_T *result = VASNPRINTF (NULL, &length, format, args); + if (result == NULL) + return -1; + + if (length > INT_MAX) + { + free (result); + errno = EOVERFLOW; + return -1; + } + + *resultp = result; + /* Return the number of resulting units, excluding the trailing NUL. */ + return length; +} diff --git a/gnulib/lib/unistdio/u-vsnprintf.h b/gnulib/lib/unistdio/u-vsnprintf.h new file mode 100644 index 0000000..977a123 --- /dev/null +++ b/gnulib/lib/unistdio/u-vsnprintf.h @@ -0,0 +1,52 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +int +VSNPRINTF (DCHAR_T *buf, size_t size, const FCHAR_T *format, va_list args) +{ + size_t length; + DCHAR_T *result; + + if (size == 0) + buf = NULL; + else + length = size; + result = VASNPRINTF (buf, &length, format, args); + if (result == NULL) + return -1; + + if (result != buf) + { + if (size != 0) + { + /* The result did not fit into the buffer. Copy the initial segment + into the buffer, truncating it if necessary. */ + size_t n = (length < size ? length : size - 1); + DCHAR_CPY (buf, result, n); + buf[n] = '\0'; + } + free (result); + } + + if (length > INT_MAX) + { + errno = EOVERFLOW; + return -1; + } + + /* Return the number of resulting units, excluding the trailing NUL. */ + return length; +} diff --git a/gnulib/lib/unistdio/u-vsprintf.h b/gnulib/lib/unistdio/u-vsprintf.h new file mode 100644 index 0000000..28a0c9b --- /dev/null +++ b/gnulib/lib/unistdio/u-vsprintf.h @@ -0,0 +1,58 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t) -1) +#endif + +int +VSPRINTF (DCHAR_T *buf, const FCHAR_T *format, va_list args) +{ + /* Pass an infinite length. But note that *vasnprintf may fail if the buffer + argument is larger than INT_MAX (if that fits into a 'size_t' at all). + Also note that glibc's iconv fails with E2BIG when we pass a length that + is so large that buf + length wraps around, i.e. + (uintptr_t) (buf + length) < (uintptr_t) buf. */ + size_t length; + DCHAR_T *result; + + /* Set length = min (SIZE_MAX, INT_MAX, - (uintptr_t) buf - 1). */ + length = (SIZE_MAX < INT_MAX ? SIZE_MAX : INT_MAX); + if (length > (~ (uintptr_t) buf) / sizeof (DCHAR_T)) + length = (~ (uintptr_t) buf) / sizeof (DCHAR_T); + + result = VASNPRINTF (buf, &length, format, args); + if (result == NULL) + return -1; + + /* The infinite buffer size guarantees that the result is not malloc()ed. */ + if (result != buf) + { + /* length is near SIZE_MAX. */ + free (result); + errno = EOVERFLOW; + return -1; + } + + if (length > INT_MAX) + { + errno = EOVERFLOW; + return -1; + } + + /* Return the number of resulting units, excluding the trailing NUL. */ + return length; +} diff --git a/gnulib/lib/unistdio/u16-asnprintf.c b/gnulib/lib/unistdio/u16-asnprintf.c new file mode 100644 index 0000000..a589f25 --- /dev/null +++ b/gnulib/lib/unistdio/u16-asnprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASNPRINTF u16_asnprintf +#define VASNPRINTF u16_vasnprintf +#define FCHAR_T char +#define DCHAR_T uint16_t +#include "u-asnprintf.h" diff --git a/gnulib/lib/unistdio/u16-asprintf.c b/gnulib/lib/unistdio/u16-asprintf.c new file mode 100644 index 0000000..d26f5cb --- /dev/null +++ b/gnulib/lib/unistdio/u16-asprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASPRINTF u16_asprintf +#define VASPRINTF u16_vasprintf +#define FCHAR_T char +#define DCHAR_T uint16_t +#include "u-asprintf.h" diff --git a/gnulib/lib/unistdio/u16-printf-parse.c b/gnulib/lib/unistdio/u16-printf-parse.c new file mode 100644 index 0000000..815e2e2 --- /dev/null +++ b/gnulib/lib/unistdio/u16-printf-parse.c @@ -0,0 +1,27 @@ +/* Formatted output to strings. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2011 Free Software + Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio/u-printf-parse.h" + +#define PRINTF_PARSE u16_printf_parse +#define CHAR_T uint16_t +#define DIRECTIVE u16_directive +#define DIRECTIVES u16_directives +#include "printf-parse.c" diff --git a/gnulib/lib/unistdio/u16-snprintf.c b/gnulib/lib/unistdio/u16-snprintf.c new file mode 100644 index 0000000..0ef7c6d --- /dev/null +++ b/gnulib/lib/unistdio/u16-snprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SNPRINTF u16_snprintf +#define VSNPRINTF u16_vsnprintf +#define FCHAR_T char +#define DCHAR_T uint16_t +#include "u-snprintf.h" diff --git a/gnulib/lib/unistdio/u16-sprintf.c b/gnulib/lib/unistdio/u16-sprintf.c new file mode 100644 index 0000000..fbacdd4 --- /dev/null +++ b/gnulib/lib/unistdio/u16-sprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SPRINTF u16_sprintf +#define VSPRINTF u16_vsprintf +#define FCHAR_T char +#define DCHAR_T uint16_t +#include "u-sprintf.h" diff --git a/gnulib/lib/unistdio/u16-u16-asnprintf.c b/gnulib/lib/unistdio/u16-u16-asnprintf.c new file mode 100644 index 0000000..56a86cc --- /dev/null +++ b/gnulib/lib/unistdio/u16-u16-asnprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASNPRINTF u16_u16_asnprintf +#define VASNPRINTF u16_u16_vasnprintf +#define FCHAR_T uint16_t +#define DCHAR_T uint16_t +#include "u-asnprintf.h" diff --git a/gnulib/lib/unistdio/u16-u16-asprintf.c b/gnulib/lib/unistdio/u16-u16-asprintf.c new file mode 100644 index 0000000..4efeefd --- /dev/null +++ b/gnulib/lib/unistdio/u16-u16-asprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASPRINTF u16_u16_asprintf +#define VASPRINTF u16_u16_vasprintf +#define FCHAR_T uint16_t +#define DCHAR_T uint16_t +#include "u-asprintf.h" diff --git a/gnulib/lib/unistdio/u16-u16-snprintf.c b/gnulib/lib/unistdio/u16-u16-snprintf.c new file mode 100644 index 0000000..bf74511 --- /dev/null +++ b/gnulib/lib/unistdio/u16-u16-snprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SNPRINTF u16_u16_snprintf +#define VSNPRINTF u16_u16_vsnprintf +#define FCHAR_T uint16_t +#define DCHAR_T uint16_t +#include "u-snprintf.h" diff --git a/gnulib/lib/unistdio/u16-u16-sprintf.c b/gnulib/lib/unistdio/u16-u16-sprintf.c new file mode 100644 index 0000000..3876b0e --- /dev/null +++ b/gnulib/lib/unistdio/u16-u16-sprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SPRINTF u16_u16_sprintf +#define VSPRINTF u16_u16_vsprintf +#define FCHAR_T uint16_t +#define DCHAR_T uint16_t +#include "u-sprintf.h" diff --git a/gnulib/lib/unistdio/u16-u16-vasnprintf.c b/gnulib/lib/unistdio/u16-u16-vasnprintf.c new file mode 100644 index 0000000..146e55c --- /dev/null +++ b/gnulib/lib/unistdio/u16-u16-vasnprintf.c @@ -0,0 +1,50 @@ +/* Formatted output to UTF-16 strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Tell glibc's <stdio.h> to provide a prototype for snprintf(). + This must come before <config.h> because <config.h> may include + <features.h>, and once <features.h> has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#include <config.h> +#include <alloca.h> + +/* Specification. */ +#include "unistdio.h" + +#include "uniconv.h" +#include "unistr.h" +#include "unistdio/u-printf-parse.h" + +#define VASNPRINTF u16_u16_vasnprintf +#define FCHAR_T uint16_t +#define DIRECTIVE u16_directive +#define DIRECTIVES u16_directives +#define PRINTF_PARSE u16_printf_parse +#define DCHAR_T uint16_t +#define DCHAR_T_IS_UINT16_T 1 +#define DCHAR_CPY u16_cpy +#define DCHAR_SET u16_set +#define DCHAR_MBSNLEN u16_mbsnlen +#define DCHAR_IS_UINT16_T 1 +#define U8_TO_DCHAR u8_to_u16 +#define U32_TO_DCHAR u32_to_u16 +#define DCHAR_CONV_FROM_ENCODING u16_conv_from_encoding +#define TCHAR_T char +#include "vasnprintf.c" diff --git a/gnulib/lib/unistdio/u16-u16-vasprintf.c b/gnulib/lib/unistdio/u16-u16-vasprintf.c new file mode 100644 index 0000000..8fd47bc --- /dev/null +++ b/gnulib/lib/unistdio/u16-u16-vasprintf.c @@ -0,0 +1,31 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdlib.h> + +#define VASPRINTF u16_u16_vasprintf +#define VASNPRINTF u16_u16_vasnprintf +#define FCHAR_T uint16_t +#define DCHAR_T uint16_t +#include "u-vasprintf.h" diff --git a/gnulib/lib/unistdio/u16-u16-vsnprintf.c b/gnulib/lib/unistdio/u16-u16-vsnprintf.c new file mode 100644 index 0000000..7b5443b --- /dev/null +++ b/gnulib/lib/unistdio/u16-u16-vsnprintf.c @@ -0,0 +1,34 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdlib.h> +#include "unistr.h" + +#define VSNPRINTF u16_u16_vsnprintf +#define VASNPRINTF u16_u16_vasnprintf +#define FCHAR_T uint16_t +#define DCHAR_T uint16_t +#define DCHAR_CPY u16_cpy +#include "u-vsnprintf.h" diff --git a/gnulib/lib/unistdio/u16-u16-vsprintf.c b/gnulib/lib/unistdio/u16-u16-vsprintf.c new file mode 100644 index 0000000..c6b69a9 --- /dev/null +++ b/gnulib/lib/unistdio/u16-u16-vsprintf.c @@ -0,0 +1,33 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdint.h> +#include <stdlib.h> + +#define VSPRINTF u16_u16_vsprintf +#define VASNPRINTF u16_u16_vasnprintf +#define FCHAR_T uint16_t +#define DCHAR_T uint16_t +#include "u-vsprintf.h" diff --git a/gnulib/lib/unistdio/u16-vasnprintf.c b/gnulib/lib/unistdio/u16-vasnprintf.c new file mode 100644 index 0000000..3c20d6e --- /dev/null +++ b/gnulib/lib/unistdio/u16-vasnprintf.c @@ -0,0 +1,51 @@ +/* Formatted output to UTF-16 strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Tell glibc's <stdio.h> to provide a prototype for snprintf(). + This must come before <config.h> because <config.h> may include + <features.h>, and once <features.h> has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#include <config.h> +#include <alloca.h> + +/* Specification. */ +#include "unistdio.h" + +#include "uniconv.h" +#include "unistr.h" +#include "unistdio/u-printf-parse.h" + +#define VASNPRINTF u16_vasnprintf +#define FCHAR_T char +#define DIRECTIVE char_directive +#define DIRECTIVES char_directives +#define ASCII_ONLY 1 +#define PRINTF_PARSE ulc_printf_parse +#define DCHAR_T uint16_t +#define DCHAR_T_IS_UINT16_T 1 +#define DCHAR_CPY u16_cpy +#define DCHAR_SET u16_set +#define DCHAR_MBSNLEN u16_mbsnlen +#define DCHAR_IS_UINT16_T 1 +#define U8_TO_DCHAR u8_to_u16 +#define U32_TO_DCHAR u32_to_u16 +#define DCHAR_CONV_FROM_ENCODING u16_conv_from_encoding +#define TCHAR_T char +#include "vasnprintf.c" diff --git a/gnulib/lib/unistdio/u16-vasprintf.c b/gnulib/lib/unistdio/u16-vasprintf.c new file mode 100644 index 0000000..5bb1bdb --- /dev/null +++ b/gnulib/lib/unistdio/u16-vasprintf.c @@ -0,0 +1,31 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdlib.h> + +#define VASPRINTF u16_vasprintf +#define VASNPRINTF u16_vasnprintf +#define FCHAR_T char +#define DCHAR_T uint16_t +#include "u-vasprintf.h" diff --git a/gnulib/lib/unistdio/u16-vsnprintf.c b/gnulib/lib/unistdio/u16-vsnprintf.c new file mode 100644 index 0000000..0add114 --- /dev/null +++ b/gnulib/lib/unistdio/u16-vsnprintf.c @@ -0,0 +1,34 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdlib.h> +#include "unistr.h" + +#define VSNPRINTF u16_vsnprintf +#define VASNPRINTF u16_vasnprintf +#define FCHAR_T char +#define DCHAR_T uint16_t +#define DCHAR_CPY u16_cpy +#include "u-vsnprintf.h" diff --git a/gnulib/lib/unistdio/u16-vsprintf.c b/gnulib/lib/unistdio/u16-vsprintf.c new file mode 100644 index 0000000..eee0be7 --- /dev/null +++ b/gnulib/lib/unistdio/u16-vsprintf.c @@ -0,0 +1,33 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdint.h> +#include <stdlib.h> + +#define VSPRINTF u16_vsprintf +#define VASNPRINTF u16_vasnprintf +#define FCHAR_T char +#define DCHAR_T uint16_t +#include "u-vsprintf.h" diff --git a/gnulib/lib/unistdio/u32-asnprintf.c b/gnulib/lib/unistdio/u32-asnprintf.c new file mode 100644 index 0000000..588b9d8 --- /dev/null +++ b/gnulib/lib/unistdio/u32-asnprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASNPRINTF u32_asnprintf +#define VASNPRINTF u32_vasnprintf +#define FCHAR_T char +#define DCHAR_T uint32_t +#include "u-asnprintf.h" diff --git a/gnulib/lib/unistdio/u32-asprintf.c b/gnulib/lib/unistdio/u32-asprintf.c new file mode 100644 index 0000000..fffd751 --- /dev/null +++ b/gnulib/lib/unistdio/u32-asprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASPRINTF u32_asprintf +#define VASPRINTF u32_vasprintf +#define FCHAR_T char +#define DCHAR_T uint32_t +#include "u-asprintf.h" diff --git a/gnulib/lib/unistdio/u32-printf-parse.c b/gnulib/lib/unistdio/u32-printf-parse.c new file mode 100644 index 0000000..972f273 --- /dev/null +++ b/gnulib/lib/unistdio/u32-printf-parse.c @@ -0,0 +1,27 @@ +/* Formatted output to strings. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2011 Free Software + Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio/u-printf-parse.h" + +#define PRINTF_PARSE u32_printf_parse +#define CHAR_T uint32_t +#define DIRECTIVE u32_directive +#define DIRECTIVES u32_directives +#include "printf-parse.c" diff --git a/gnulib/lib/unistdio/u32-snprintf.c b/gnulib/lib/unistdio/u32-snprintf.c new file mode 100644 index 0000000..bcd4485 --- /dev/null +++ b/gnulib/lib/unistdio/u32-snprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SNPRINTF u32_snprintf +#define VSNPRINTF u32_vsnprintf +#define FCHAR_T char +#define DCHAR_T uint32_t +#include "u-snprintf.h" diff --git a/gnulib/lib/unistdio/u32-sprintf.c b/gnulib/lib/unistdio/u32-sprintf.c new file mode 100644 index 0000000..a45c0bb --- /dev/null +++ b/gnulib/lib/unistdio/u32-sprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SPRINTF u32_sprintf +#define VSPRINTF u32_vsprintf +#define FCHAR_T char +#define DCHAR_T uint32_t +#include "u-sprintf.h" diff --git a/gnulib/lib/unistdio/u32-u32-asnprintf.c b/gnulib/lib/unistdio/u32-u32-asnprintf.c new file mode 100644 index 0000000..b389424 --- /dev/null +++ b/gnulib/lib/unistdio/u32-u32-asnprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASNPRINTF u32_u32_asnprintf +#define VASNPRINTF u32_u32_vasnprintf +#define FCHAR_T uint32_t +#define DCHAR_T uint32_t +#include "u-asnprintf.h" diff --git a/gnulib/lib/unistdio/u32-u32-asprintf.c b/gnulib/lib/unistdio/u32-u32-asprintf.c new file mode 100644 index 0000000..a9869e3 --- /dev/null +++ b/gnulib/lib/unistdio/u32-u32-asprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASPRINTF u32_u32_asprintf +#define VASPRINTF u32_u32_vasprintf +#define FCHAR_T uint32_t +#define DCHAR_T uint32_t +#include "u-asprintf.h" diff --git a/gnulib/lib/unistdio/u32-u32-snprintf.c b/gnulib/lib/unistdio/u32-u32-snprintf.c new file mode 100644 index 0000000..7991ad6 --- /dev/null +++ b/gnulib/lib/unistdio/u32-u32-snprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SNPRINTF u32_u32_snprintf +#define VSNPRINTF u32_u32_vsnprintf +#define FCHAR_T uint32_t +#define DCHAR_T uint32_t +#include "u-snprintf.h" diff --git a/gnulib/lib/unistdio/u32-u32-sprintf.c b/gnulib/lib/unistdio/u32-u32-sprintf.c new file mode 100644 index 0000000..769aa88 --- /dev/null +++ b/gnulib/lib/unistdio/u32-u32-sprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SPRINTF u32_u32_sprintf +#define VSPRINTF u32_u32_vsprintf +#define FCHAR_T uint32_t +#define DCHAR_T uint32_t +#include "u-sprintf.h" diff --git a/gnulib/lib/unistdio/u32-u32-vasnprintf.c b/gnulib/lib/unistdio/u32-u32-vasnprintf.c new file mode 100644 index 0000000..084549e --- /dev/null +++ b/gnulib/lib/unistdio/u32-u32-vasnprintf.c @@ -0,0 +1,50 @@ +/* Formatted output to UTF-32 strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Tell glibc's <stdio.h> to provide a prototype for snprintf(). + This must come before <config.h> because <config.h> may include + <features.h>, and once <features.h> has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#include <config.h> +#include <alloca.h> + +/* Specification. */ +#include "unistdio.h" + +#include "uniconv.h" +#include "unistr.h" +#include "unistdio/u-printf-parse.h" + +#define VASNPRINTF u32_u32_vasnprintf +#define FCHAR_T uint32_t +#define DIRECTIVE u32_directive +#define DIRECTIVES u32_directives +#define PRINTF_PARSE u32_printf_parse +#define DCHAR_T uint32_t +#define DCHAR_T_IS_UINT32_T 1 +#define DCHAR_CPY u32_cpy +#define DCHAR_SET u32_set +#define DCHAR_MBSNLEN u32_mbsnlen +#define DCHAR_IS_UINT32_T 1 +#define U8_TO_DCHAR u8_to_u32 +#define U16_TO_DCHAR u16_to_u32 +#define DCHAR_CONV_FROM_ENCODING u32_conv_from_encoding +#define TCHAR_T char +#include "vasnprintf.c" diff --git a/gnulib/lib/unistdio/u32-u32-vasprintf.c b/gnulib/lib/unistdio/u32-u32-vasprintf.c new file mode 100644 index 0000000..3c11874 --- /dev/null +++ b/gnulib/lib/unistdio/u32-u32-vasprintf.c @@ -0,0 +1,31 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdlib.h> + +#define VASPRINTF u32_u32_vasprintf +#define VASNPRINTF u32_u32_vasnprintf +#define FCHAR_T uint32_t +#define DCHAR_T uint32_t +#include "u-vasprintf.h" diff --git a/gnulib/lib/unistdio/u32-u32-vsnprintf.c b/gnulib/lib/unistdio/u32-u32-vsnprintf.c new file mode 100644 index 0000000..21ba48d --- /dev/null +++ b/gnulib/lib/unistdio/u32-u32-vsnprintf.c @@ -0,0 +1,34 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdlib.h> +#include "unistr.h" + +#define VSNPRINTF u32_u32_vsnprintf +#define VASNPRINTF u32_u32_vasnprintf +#define FCHAR_T uint32_t +#define DCHAR_T uint32_t +#define DCHAR_CPY u32_cpy +#include "u-vsnprintf.h" diff --git a/gnulib/lib/unistdio/u32-u32-vsprintf.c b/gnulib/lib/unistdio/u32-u32-vsprintf.c new file mode 100644 index 0000000..4f0b4a7 --- /dev/null +++ b/gnulib/lib/unistdio/u32-u32-vsprintf.c @@ -0,0 +1,33 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdint.h> +#include <stdlib.h> + +#define VSPRINTF u32_u32_vsprintf +#define VASNPRINTF u32_u32_vasnprintf +#define FCHAR_T uint32_t +#define DCHAR_T uint32_t +#include "u-vsprintf.h" diff --git a/gnulib/lib/unistdio/u32-vasnprintf.c b/gnulib/lib/unistdio/u32-vasnprintf.c new file mode 100644 index 0000000..7705cdc --- /dev/null +++ b/gnulib/lib/unistdio/u32-vasnprintf.c @@ -0,0 +1,51 @@ +/* Formatted output to UTF-32 strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Tell glibc's <stdio.h> to provide a prototype for snprintf(). + This must come before <config.h> because <config.h> may include + <features.h>, and once <features.h> has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#include <config.h> +#include <alloca.h> + +/* Specification. */ +#include "unistdio.h" + +#include "uniconv.h" +#include "unistr.h" +#include "unistdio/u-printf-parse.h" + +#define VASNPRINTF u32_vasnprintf +#define FCHAR_T char +#define DIRECTIVE char_directive +#define DIRECTIVES char_directives +#define ASCII_ONLY 1 +#define PRINTF_PARSE ulc_printf_parse +#define DCHAR_T uint32_t +#define DCHAR_T_IS_UINT32_T 1 +#define DCHAR_CPY u32_cpy +#define DCHAR_SET u32_set +#define DCHAR_MBSNLEN u32_mbsnlen +#define DCHAR_IS_UINT32_T 1 +#define U8_TO_DCHAR u8_to_u32 +#define U16_TO_DCHAR u16_to_u32 +#define DCHAR_CONV_FROM_ENCODING u32_conv_from_encoding +#define TCHAR_T char +#include "vasnprintf.c" diff --git a/gnulib/lib/unistdio/u32-vasprintf.c b/gnulib/lib/unistdio/u32-vasprintf.c new file mode 100644 index 0000000..32b3979 --- /dev/null +++ b/gnulib/lib/unistdio/u32-vasprintf.c @@ -0,0 +1,31 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdlib.h> + +#define VASPRINTF u32_vasprintf +#define VASNPRINTF u32_vasnprintf +#define FCHAR_T char +#define DCHAR_T uint32_t +#include "u-vasprintf.h" diff --git a/gnulib/lib/unistdio/u32-vsnprintf.c b/gnulib/lib/unistdio/u32-vsnprintf.c new file mode 100644 index 0000000..5d5b159 --- /dev/null +++ b/gnulib/lib/unistdio/u32-vsnprintf.c @@ -0,0 +1,34 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdlib.h> +#include "unistr.h" + +#define VSNPRINTF u32_vsnprintf +#define VASNPRINTF u32_vasnprintf +#define FCHAR_T char +#define DCHAR_T uint32_t +#define DCHAR_CPY u32_cpy +#include "u-vsnprintf.h" diff --git a/gnulib/lib/unistdio/u32-vsprintf.c b/gnulib/lib/unistdio/u32-vsprintf.c new file mode 100644 index 0000000..fd0eff9 --- /dev/null +++ b/gnulib/lib/unistdio/u32-vsprintf.c @@ -0,0 +1,33 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdint.h> +#include <stdlib.h> + +#define VSPRINTF u32_vsprintf +#define VASNPRINTF u32_vasnprintf +#define FCHAR_T char +#define DCHAR_T uint32_t +#include "u-vsprintf.h" diff --git a/gnulib/lib/unistdio/u8-asnprintf.c b/gnulib/lib/unistdio/u8-asnprintf.c new file mode 100644 index 0000000..a51fb44 --- /dev/null +++ b/gnulib/lib/unistdio/u8-asnprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASNPRINTF u8_asnprintf +#define VASNPRINTF u8_vasnprintf +#define FCHAR_T char +#define DCHAR_T uint8_t +#include "u-asnprintf.h" diff --git a/gnulib/lib/unistdio/u8-asprintf.c b/gnulib/lib/unistdio/u8-asprintf.c new file mode 100644 index 0000000..8f20526 --- /dev/null +++ b/gnulib/lib/unistdio/u8-asprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASPRINTF u8_asprintf +#define VASPRINTF u8_vasprintf +#define FCHAR_T char +#define DCHAR_T uint8_t +#include "u-asprintf.h" diff --git a/gnulib/lib/unistdio/u8-printf-parse.c b/gnulib/lib/unistdio/u8-printf-parse.c new file mode 100644 index 0000000..deaf1bf --- /dev/null +++ b/gnulib/lib/unistdio/u8-printf-parse.c @@ -0,0 +1,27 @@ +/* Formatted output to strings. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2011 Free Software + Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio/u-printf-parse.h" + +#define PRINTF_PARSE u8_printf_parse +#define CHAR_T uint8_t +#define DIRECTIVE u8_directive +#define DIRECTIVES u8_directives +#include "printf-parse.c" diff --git a/gnulib/lib/unistdio/u8-snprintf.c b/gnulib/lib/unistdio/u8-snprintf.c new file mode 100644 index 0000000..dd7257e --- /dev/null +++ b/gnulib/lib/unistdio/u8-snprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SNPRINTF u8_snprintf +#define VSNPRINTF u8_vsnprintf +#define FCHAR_T char +#define DCHAR_T uint8_t +#include "u-snprintf.h" diff --git a/gnulib/lib/unistdio/u8-sprintf.c b/gnulib/lib/unistdio/u8-sprintf.c new file mode 100644 index 0000000..670c047 --- /dev/null +++ b/gnulib/lib/unistdio/u8-sprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SPRINTF u8_sprintf +#define VSPRINTF u8_vsprintf +#define FCHAR_T char +#define DCHAR_T uint8_t +#include "u-sprintf.h" diff --git a/gnulib/lib/unistdio/u8-u8-asnprintf.c b/gnulib/lib/unistdio/u8-u8-asnprintf.c new file mode 100644 index 0000000..264edd1 --- /dev/null +++ b/gnulib/lib/unistdio/u8-u8-asnprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASNPRINTF u8_u8_asnprintf +#define VASNPRINTF u8_u8_vasnprintf +#define FCHAR_T uint8_t +#define DCHAR_T uint8_t +#include "u-asnprintf.h" diff --git a/gnulib/lib/unistdio/u8-u8-asprintf.c b/gnulib/lib/unistdio/u8-u8-asprintf.c new file mode 100644 index 0000000..a80fd1c --- /dev/null +++ b/gnulib/lib/unistdio/u8-u8-asprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASPRINTF u8_u8_asprintf +#define VASPRINTF u8_u8_vasprintf +#define FCHAR_T uint8_t +#define DCHAR_T uint8_t +#include "u-asprintf.h" diff --git a/gnulib/lib/unistdio/u8-u8-snprintf.c b/gnulib/lib/unistdio/u8-u8-snprintf.c new file mode 100644 index 0000000..bbe7d8b --- /dev/null +++ b/gnulib/lib/unistdio/u8-u8-snprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SNPRINTF u8_u8_snprintf +#define VSNPRINTF u8_u8_vsnprintf +#define FCHAR_T uint8_t +#define DCHAR_T uint8_t +#include "u-snprintf.h" diff --git a/gnulib/lib/unistdio/u8-u8-sprintf.c b/gnulib/lib/unistdio/u8-u8-sprintf.c new file mode 100644 index 0000000..fa3c5c9 --- /dev/null +++ b/gnulib/lib/unistdio/u8-u8-sprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SPRINTF u8_u8_sprintf +#define VSPRINTF u8_u8_vsprintf +#define FCHAR_T uint8_t +#define DCHAR_T uint8_t +#include "u-sprintf.h" diff --git a/gnulib/lib/unistdio/u8-u8-vasnprintf.c b/gnulib/lib/unistdio/u8-u8-vasnprintf.c new file mode 100644 index 0000000..4e0af81 --- /dev/null +++ b/gnulib/lib/unistdio/u8-u8-vasnprintf.c @@ -0,0 +1,50 @@ +/* Formatted output to UTF-8 strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Tell glibc's <stdio.h> to provide a prototype for snprintf(). + This must come before <config.h> because <config.h> may include + <features.h>, and once <features.h> has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#include <config.h> +#include <alloca.h> + +/* Specification. */ +#include "unistdio.h" + +#include "uniconv.h" +#include "unistr.h" +#include "unistdio/u-printf-parse.h" + +#define VASNPRINTF u8_u8_vasnprintf +#define FCHAR_T uint8_t +#define DIRECTIVE u8_directive +#define DIRECTIVES u8_directives +#define PRINTF_PARSE u8_printf_parse +#define DCHAR_T uint8_t +#define DCHAR_T_IS_UINT8_T 1 +#define DCHAR_CPY u8_cpy +#define DCHAR_SET u8_set +#define DCHAR_MBSNLEN u8_mbsnlen +#define DCHAR_IS_UINT8_T 1 +#define U16_TO_DCHAR u16_to_u8 +#define U32_TO_DCHAR u32_to_u8 +#define DCHAR_CONV_FROM_ENCODING u8_conv_from_encoding +#define TCHAR_T char +#include "vasnprintf.c" diff --git a/gnulib/lib/unistdio/u8-u8-vasprintf.c b/gnulib/lib/unistdio/u8-u8-vasprintf.c new file mode 100644 index 0000000..2fa8d60 --- /dev/null +++ b/gnulib/lib/unistdio/u8-u8-vasprintf.c @@ -0,0 +1,31 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdlib.h> + +#define VASPRINTF u8_u8_vasprintf +#define VASNPRINTF u8_u8_vasnprintf +#define FCHAR_T uint8_t +#define DCHAR_T uint8_t +#include "u-vasprintf.h" diff --git a/gnulib/lib/unistdio/u8-u8-vsnprintf.c b/gnulib/lib/unistdio/u8-u8-vsnprintf.c new file mode 100644 index 0000000..c5195f6 --- /dev/null +++ b/gnulib/lib/unistdio/u8-u8-vsnprintf.c @@ -0,0 +1,34 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdlib.h> +#include "unistr.h" + +#define VSNPRINTF u8_u8_vsnprintf +#define VASNPRINTF u8_u8_vasnprintf +#define FCHAR_T uint8_t +#define DCHAR_T uint8_t +#define DCHAR_CPY u8_cpy +#include "u-vsnprintf.h" diff --git a/gnulib/lib/unistdio/u8-u8-vsprintf.c b/gnulib/lib/unistdio/u8-u8-vsprintf.c new file mode 100644 index 0000000..8964dea --- /dev/null +++ b/gnulib/lib/unistdio/u8-u8-vsprintf.c @@ -0,0 +1,33 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdint.h> +#include <stdlib.h> + +#define VSPRINTF u8_u8_vsprintf +#define VASNPRINTF u8_u8_vasnprintf +#define FCHAR_T uint8_t +#define DCHAR_T uint8_t +#include "u-vsprintf.h" diff --git a/gnulib/lib/unistdio/u8-vasnprintf.c b/gnulib/lib/unistdio/u8-vasnprintf.c new file mode 100644 index 0000000..0076cd3 --- /dev/null +++ b/gnulib/lib/unistdio/u8-vasnprintf.c @@ -0,0 +1,51 @@ +/* Formatted output to UTF-8 strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Tell glibc's <stdio.h> to provide a prototype for snprintf(). + This must come before <config.h> because <config.h> may include + <features.h>, and once <features.h> has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#include <config.h> +#include <alloca.h> + +/* Specification. */ +#include "unistdio.h" + +#include "uniconv.h" +#include "unistr.h" +#include "unistdio/u-printf-parse.h" + +#define VASNPRINTF u8_vasnprintf +#define FCHAR_T char +#define DIRECTIVE char_directive +#define DIRECTIVES char_directives +#define ASCII_ONLY 1 +#define PRINTF_PARSE ulc_printf_parse +#define DCHAR_T uint8_t +#define DCHAR_T_IS_UINT8_T 1 +#define DCHAR_CPY u8_cpy +#define DCHAR_SET u8_set +#define DCHAR_MBSNLEN u8_mbsnlen +#define DCHAR_IS_UINT8_T 1 +#define U16_TO_DCHAR u16_to_u8 +#define U32_TO_DCHAR u32_to_u8 +#define DCHAR_CONV_FROM_ENCODING u8_conv_from_encoding +#define TCHAR_T char +#include "vasnprintf.c" diff --git a/gnulib/lib/unistdio/u8-vasprintf.c b/gnulib/lib/unistdio/u8-vasprintf.c new file mode 100644 index 0000000..27b35bb --- /dev/null +++ b/gnulib/lib/unistdio/u8-vasprintf.c @@ -0,0 +1,31 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdlib.h> + +#define VASPRINTF u8_vasprintf +#define VASNPRINTF u8_vasnprintf +#define FCHAR_T char +#define DCHAR_T uint8_t +#include "u-vasprintf.h" diff --git a/gnulib/lib/unistdio/u8-vsnprintf.c b/gnulib/lib/unistdio/u8-vsnprintf.c new file mode 100644 index 0000000..625d9d4 --- /dev/null +++ b/gnulib/lib/unistdio/u8-vsnprintf.c @@ -0,0 +1,34 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdlib.h> +#include "unistr.h" + +#define VSNPRINTF u8_vsnprintf +#define VASNPRINTF u8_vasnprintf +#define FCHAR_T char +#define DCHAR_T uint8_t +#define DCHAR_CPY u8_cpy +#include "u-vsnprintf.h" diff --git a/gnulib/lib/unistdio/u8-vsprintf.c b/gnulib/lib/unistdio/u8-vsprintf.c new file mode 100644 index 0000000..184703d --- /dev/null +++ b/gnulib/lib/unistdio/u8-vsprintf.c @@ -0,0 +1,33 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdint.h> +#include <stdlib.h> + +#define VSPRINTF u8_vsprintf +#define VASNPRINTF u8_vasnprintf +#define FCHAR_T char +#define DCHAR_T uint8_t +#include "u-vsprintf.h" diff --git a/gnulib/lib/unistdio/ulc-asnprintf.c b/gnulib/lib/unistdio/ulc-asnprintf.c new file mode 100644 index 0000000..73c0175 --- /dev/null +++ b/gnulib/lib/unistdio/ulc-asnprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASNPRINTF ulc_asnprintf +#define VASNPRINTF ulc_vasnprintf +#define FCHAR_T char +#define DCHAR_T char +#include "u-asnprintf.h" diff --git a/gnulib/lib/unistdio/ulc-asprintf.c b/gnulib/lib/unistdio/ulc-asprintf.c new file mode 100644 index 0000000..64e21d7 --- /dev/null +++ b/gnulib/lib/unistdio/ulc-asprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define ASPRINTF ulc_asprintf +#define VASPRINTF ulc_vasprintf +#define FCHAR_T char +#define DCHAR_T char +#include "u-asprintf.h" diff --git a/gnulib/lib/unistdio/ulc-fprintf.c b/gnulib/lib/unistdio/ulc-fprintf.c new file mode 100644 index 0000000..b6d5192 --- /dev/null +++ b/gnulib/lib/unistdio/ulc-fprintf.c @@ -0,0 +1,74 @@ +/* Formatted output to a stream. + Copyright (C) 2004, 2006-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> + +#include "fseterr.h" + +/* Print formatted output to the stream FP. + Return string length of formatted string. On error, return a negative + value. */ +int +ulc_fprintf (FILE *fp, const char *format, ...) +{ + char buf[2000]; + char *output; + size_t len; + size_t lenbuf = sizeof (buf); + va_list args; + + va_start (args, format); + output = ulc_vasnprintf (buf, &lenbuf, format, args); + len = lenbuf; + va_end (args); + + if (!output) + { + fseterr (fp); + return -1; + } + + if (fwrite (output, 1, len, fp) < len) + { + if (output != buf) + { + int saved_errno = errno; + free (output); + errno = saved_errno; + } + return -1; + } + + if (len > INT_MAX) + { + errno = EOVERFLOW; + fseterr (fp); + return -1; + } + + return len; +} diff --git a/gnulib/lib/unistdio/ulc-printf-parse.c b/gnulib/lib/unistdio/ulc-printf-parse.c new file mode 100644 index 0000000..b690198 --- /dev/null +++ b/gnulib/lib/unistdio/ulc-printf-parse.c @@ -0,0 +1,28 @@ +/* Formatted output to strings. + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2011 Free Software + Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio/u-printf-parse.h" + +#define PRINTF_PARSE ulc_printf_parse +#define CHAR_T char +#define CHAR_T_ONLY_ASCII 1 +#define DIRECTIVE char_directive +#define DIRECTIVES char_directives +#include "printf-parse.c" diff --git a/gnulib/lib/unistdio/ulc-snprintf.c b/gnulib/lib/unistdio/ulc-snprintf.c new file mode 100644 index 0000000..573ca89 --- /dev/null +++ b/gnulib/lib/unistdio/ulc-snprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SNPRINTF ulc_snprintf +#define VSNPRINTF ulc_vsnprintf +#define FCHAR_T char +#define DCHAR_T char +#include "u-snprintf.h" diff --git a/gnulib/lib/unistdio/ulc-sprintf.c b/gnulib/lib/unistdio/ulc-sprintf.c new file mode 100644 index 0000000..e3cf9fa --- /dev/null +++ b/gnulib/lib/unistdio/ulc-sprintf.c @@ -0,0 +1,29 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2005-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <stdarg.h> + +#define SPRINTF ulc_sprintf +#define VSPRINTF ulc_vsprintf +#define FCHAR_T char +#define DCHAR_T char +#include "u-sprintf.h" diff --git a/gnulib/lib/unistdio/ulc-vasnprintf.c b/gnulib/lib/unistdio/ulc-vasnprintf.c new file mode 100644 index 0000000..2520acb --- /dev/null +++ b/gnulib/lib/unistdio/ulc-vasnprintf.c @@ -0,0 +1,47 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Tell glibc's <stdio.h> to provide a prototype for snprintf(). + This must come before <config.h> because <config.h> may include + <features.h>, and once <features.h> has been included, it's too late. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +#include <config.h> +#include <alloca.h> + +/* Specification. */ +#include "unistdio.h" + +#include "uniconv.h" +#include "unistr.h" +#include "unistdio/u-printf-parse.h" + +#define VASNPRINTF ulc_vasnprintf +#define FCHAR_T char +#define DIRECTIVE char_directive +#define DIRECTIVES char_directives +#define FCHAR_T_ONLY_ASCII 1 +#define PRINTF_PARSE ulc_printf_parse +#define DCHAR_T char +#define DCHAR_CPY memcpy +#define DCHAR_SET memset +#define DCHAR_MBSNLEN mbsnlen +#define TCHAR_T char +#define DCHAR_IS_TCHAR 1 +#include "vasnprintf.c" diff --git a/gnulib/lib/unistdio/ulc-vasprintf.c b/gnulib/lib/unistdio/ulc-vasprintf.c new file mode 100644 index 0000000..eeaf507 --- /dev/null +++ b/gnulib/lib/unistdio/ulc-vasprintf.c @@ -0,0 +1,31 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdlib.h> + +#define VASPRINTF ulc_vasprintf +#define VASNPRINTF ulc_vasnprintf +#define FCHAR_T char +#define DCHAR_T char +#include "u-vasprintf.h" diff --git a/gnulib/lib/unistdio/ulc-vfprintf.c b/gnulib/lib/unistdio/ulc-vfprintf.c new file mode 100644 index 0000000..2ce0835 --- /dev/null +++ b/gnulib/lib/unistdio/ulc-vfprintf.c @@ -0,0 +1,71 @@ +/* Formatted output to a stream. + Copyright (C) 2004, 2006-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> + +#include "fseterr.h" + +/* Print formatted output to the stream FP. + Return string length of formatted string. On error, return a negative + value. */ +int +ulc_vfprintf (FILE *fp, const char *format, va_list args) +{ + char buf[2000]; + char *output; + size_t len; + size_t lenbuf = sizeof (buf); + + output = ulc_vasnprintf (buf, &lenbuf, format, args); + len = lenbuf; + + if (!output) + { + fseterr (fp); + return -1; + } + + if (fwrite (output, 1, len, fp) < len) + { + if (output != buf) + { + int saved_errno = errno; + free (output); + errno = saved_errno; + } + return -1; + } + + if (len > INT_MAX) + { + errno = EOVERFLOW; + fseterr (fp); + return -1; + } + + return len; +} diff --git a/gnulib/lib/unistdio/ulc-vsnprintf.c b/gnulib/lib/unistdio/ulc-vsnprintf.c new file mode 100644 index 0000000..e2a4b15 --- /dev/null +++ b/gnulib/lib/unistdio/ulc-vsnprintf.c @@ -0,0 +1,34 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdlib.h> +#include <string.h> + +#define VSNPRINTF ulc_vsnprintf +#define VASNPRINTF ulc_vasnprintf +#define FCHAR_T char +#define DCHAR_T char +#define DCHAR_CPY memcpy +#include "u-vsnprintf.h" diff --git a/gnulib/lib/unistdio/ulc-vsprintf.c b/gnulib/lib/unistdio/ulc-vsprintf.c new file mode 100644 index 0000000..1aacb26 --- /dev/null +++ b/gnulib/lib/unistdio/ulc-vsprintf.c @@ -0,0 +1,33 @@ +/* Formatted output to strings. + Copyright (C) 1999, 2002, 2006-2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include "unistdio.h" + +#include <errno.h> +#include <limits.h> +#include <stdarg.h> +#include <stdint.h> +#include <stdlib.h> + +#define VSPRINTF ulc_vsprintf +#define VASNPRINTF ulc_vasnprintf +#define FCHAR_T char +#define DCHAR_T char +#include "u-vsprintf.h" |