--- a/components/popt/patches/popt-01-g11n-i18n-stdio.patch Fri Mar 11 05:36:16 2016 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,385 +0,0 @@
-Comment from the Desktop SUNWlibpopt.spec file:
-date:2007-12-21 owner:fujiwara type:bug bugster:6186542 bugzilla:178413 state:upstream
-
---- popt-1.7/Makefile.am.orig 2007-12-21 19:40:03.495254000 +0900
-+++ popt-1.7/Makefile.am 2007-12-21 19:42:56.088304000 +0900
-@@ -15,13 +15,13 @@ noinst_HEADERS = findme.h poptint.h syst
-
- noinst_PROGRAMS = test1 test2 test3
- test1_SOURCES = test1.c
--test1_LDFLAGS = -all-static
-+test1_LDFLAGS =
- test1_LDADD = $(lib_LTLIBRARIES)
- test2_SOURCES = test2.c
--test2_LDFLAGS = -all-static
-+test2_LDFLAGS =
- test2_LDADD = $(lib_LTLIBRARIES)
- test3_SOURCES = test3.c
--test3_LDFLAGS = -all-static
-+test3_LDFLAGS =
- test3_LDADD = $(lib_LTLIBRARIES)
-
- noinst_SCRIPTS = testit.sh
-@@ -33,7 +33,7 @@ TESTS = testit.sh
-
- include_HEADERS = popt.h
- lib_LTLIBRARIES = libpopt.la
--libpopt_la_SOURCES = popt.c findme.c poptparse.c poptconfig.c popthelp.c
-+libpopt_la_SOURCES = popt.c findme.c poptparse.c poptconfig.c popthelp.c poptint.c
-
- man_MANS = popt.3
-
---- popt-1.7/configure.in.orig 2007-12-21 19:40:09.557770000 +0900
-+++ popt-1.7/configure.in 2007-12-21 20:07:17.961454000 +0900
-@@ -1,9 +1,8 @@
- AC_INIT(popt.h)
- AC_CANONICAL_SYSTEM
- AC_PREREQ(2.12)
--AC_CONFIG_HEADERS
- AM_INIT_AUTOMAKE(popt, 1.7)
--AM_CONFIG_HEADER(config.h)
-+AC_CONFIG_HEADERS(config.h)
-
- ALL_LINGUAS="cs da de es eu_ES fi fr gl hu id is it ja ko no pl pt pt_BR ro ru sk sl sr sv tr uk wa zh zh_CN.GB2312"
-
-@@ -50,7 +49,7 @@ else
- fi
- AC_SUBST(TARGET)
-
--AC_CHECK_HEADERS(alloca.h float.h libintl.h mcheck.h unistd.h)
-+AC_CHECK_HEADERS(alloca.h float.h libintl.h mcheck.h unistd.h langinfo.h)
- AC_MSG_CHECKING(for /usr/ucblib in LIBS)
- if test -d /usr/ucblib ; then
- if test "$build" = "mips-sni-sysv4" ; then
-@@ -73,10 +72,10 @@ then
- AC_MSG_RESULT(yes)
- fi
-
--AC_CHECK_FUNCS(strerror mtrace getuid geteuid)
- AC_CHECK_FUNC(setreuid, [], [
- AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
- ])
-+AC_CHECK_FUNCS(getuid geteuid mtrace __secure_getenv setregid strerror iconv)
-
- AM_GNU_GETTEXT
-
---- popt-1.7/popt.h.orig 2007-12-21 20:31:45.455134000 +0900
-+++ popt-1.7/popt.h 2007-12-21 20:32:06.508963000 +0900
-@@ -34,6 +34,8 @@
- #define POPT_ARG_FLOAT 8 /*!< arg will be converted to float */
- #define POPT_ARG_DOUBLE 9 /*!< arg will be converted to double */
-
-+#define POPT_ARG_MAINCALL 10U /*!< return (*arg) (argc, argv) */
-+
- #define POPT_ARG_MASK 0x0000FFFF
- /*@}*/
-
---- popt-1.7/popthelp.c.orig 2007-12-21 19:40:16.105761000 +0900
-+++ popt-1.7/popthelp.c 2007-12-21 19:57:18.972191000 +0900
-@@ -208,6 +208,8 @@ static void singleOptionHelp(FILE * fp,
- char * defs = NULL;
- char * left;
- int nb = maxLeftCol + 1;
-+ int displaypad = 0;
-+ int xx;
-
- /* Make sure there's more than enough room in target buffer. */
- if (opt->longName) nb += strlen(opt->longName);
-@@ -307,8 +309,25 @@ static void singleOptionHelp(FILE * fp,
- break;
- }
- } else {
-- *le++ = '=';
-- strcpy(le, argDescrip); le += strlen(le);
-+ size_t lelen;
-+
-+ *le++ = ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_MAINCALL)
-+ ? ' ' : '=';
-+ strcpy(le, argDescrip);
-+ lelen = strlen(le);
-+ le += lelen;
-+
-+#ifdef POPT_WCHAR_HACK
-+ { const char * scopy = argDescrip;
-+ mbstate_t t;
-+ size_t n;
-+
-+ memset ((void *)&t, 0, sizeof (t)); /* In initial state. */
-+ /* Determine number of characters. */
-+ n = mbsrtowcs (NULL, &scopy, strlen(scopy), &t);
-+ displaypad = (int) (lelen-n);
-+ }
-+#endif
- }
- if (opt->argInfo & POPT_ARGFLAG_OPTIONAL)
- *le++ = ']';
-@@ -317,9 +336,9 @@ static void singleOptionHelp(FILE * fp,
- /*@=boundswrite@*/
-
- if (help)
-- fprintf(fp," %-*s ", maxLeftCol, left);
-+ xx = POPT_fprintf(fp," %-*s ", (int)(maxLeftCol+displaypad), left);
- else {
-- fprintf(fp," %s\n", left);
-+ xx = POPT_fprintf(fp," %s\n", left);
- goto out;
- }
-
-@@ -335,22 +354,24 @@ static void singleOptionHelp(FILE * fp,
- char format[16];
-
- ch = help + lineLength - 1;
-- while (ch > help && !isspace(*ch)) ch--;
-+ while (ch > help && !_isspaceptr(ch))
-+ ch = POPT_prev_char (ch);
- if (ch == help) break; /* give up */
-- while (ch > (help + 1) && isspace(*ch)) ch--;
-+ while (ch > (help + 1) && _isspaceptr(ch))
-+ ch = POPT_prev_char (ch);
- ch++;
-
- sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), indentLength);
- /*@-formatconst@*/
-- fprintf(fp, format, help, " ");
-+ xx = POPT_fprintf(fp, format, help, " ");
- /*@=formatconst@*/
- help = ch;
-- while (isspace(*help) && *help) help++;
-+ while (_isspaceptr(help) && *help) help++;
- helpLength = strlen(help);
- }
- /*@=boundsread@*/
-
-- if (helpLength) fprintf(fp, "%s\n", help);
-+ if (helpLength) xx = POPT_fprintf(fp, "%s\n", help);
-
- out:
- /*@-dependenttrans@*/
-@@ -443,6 +464,7 @@ static void singleTableHelp(poptContext
- {
- const struct poptOption * opt;
- const char *sub_transdom;
-+ int xx;
-
- if (table == poptAliasOptions) {
- itemHelp(fp, con->aliases, con->numAliases, left, NULL);
-@@ -466,7 +488,7 @@ static void singleTableHelp(poptContext
- sub_transdom = translation_domain;
-
- if (opt->descrip)
-- fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip));
-+ xx = POPT_fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip));
-
- singleTableHelp(con, fp, opt->arg, left, sub_transdom);
- }
---- popt-1.7/poptint.c.orig 1970-01-01 09:00:00.000000000 +0900
-+++ popt-1.7/poptint.c 2007-12-21 19:57:56.997312000 +0900
-@@ -0,0 +1,156 @@
-+#include "system.h"
-+#include <stdarg.h>
-+#include "poptint.h"
-+
-+#ifdef HAVE_ICONV
-+static /*@only@*/ /*@null@*/ char *
-+strdup_locale_from_utf8 (/*@null@*/ char *buffer)
-+ /*@*/
-+{
-+ char *codeset = NULL;
-+ char *dest_str;
-+ iconv_t fd;
-+
-+ if (buffer == NULL)
-+ return NULL;
-+
-+#ifdef HAVE_LANGINFO_H
-+/*@-type@*/
-+ codeset = nl_langinfo (CODESET);
-+/*@=type@*/
-+#endif
-+
-+ if (codeset && strcmp(codeset, "UTF-8")
-+ && (fd = iconv_open(codeset, "UTF-8")) != (iconv_t)-1)
-+ {
-+ char *pin = buffer;
-+ char *pout = NULL;
-+ size_t ib, ob, dest_size;
-+ int done;
-+ int is_error;
-+ size_t err;
-+ char *shift_pin = NULL;
-+ int xx;
-+
-+ err = iconv(fd, NULL, &ib, &pout, &ob);
-+ dest_size = ob = ib = strlen(buffer);
-+ dest_str = pout = malloc((dest_size + 1) * sizeof(*dest_str));
-+ if (dest_str)
-+ *dest_str = '\0';
-+ done = is_error = 0;
-+ if (pout != NULL)
-+ while (!done && !is_error) {
-+ err = iconv(fd, &pin, &ib, &pout, &ob);
-+
-+ if (err == (size_t)-1) {
-+ switch (errno) {
-+ case EINVAL:
-+ done = 1;
-+ /*@switchbreak@*/ break;
-+ case E2BIG:
-+ { size_t used = pout - dest_str;
-+ dest_size *= 2;
-+ dest_str = realloc(dest_str, (dest_size + 1) * sizeof(*dest_str));
-+ if (dest_str == NULL) {
-+ is_error = 1;
-+ continue;
-+ }
-+ pout = dest_str + used;
-+ ob = dest_size - used;
-+ } /*@switchbreak@*/ break;
-+ case EILSEQ:
-+ is_error = 1;
-+ /*@switchbreak@*/ break;
-+ default:
-+ is_error = 1;
-+ /*@switchbreak@*/ break;
-+ }
-+ } else {
-+ if (shift_pin == NULL) {
-+ shift_pin = pin;
-+ pin = NULL;
-+ ib = 0;
-+ } else {
-+ done = 1;
-+ }
-+ }
-+ }
-+ xx = iconv_close(fd);
-+ if (pout)
-+ *pout = '\0';
-+ if (dest_str != NULL)
-+ dest_str = xstrdup(dest_str);
-+ } else {
-+ dest_str = xstrdup(buffer);
-+ }
-+
-+ return dest_str;
-+}
-+#endif
-+
-+/*@-mustmod@*/ /* LCL: can't see the ap modification. */
-+static /*@only@*/ /*@null@*/ char *
-+strdup_vprintf (const char *format, va_list ap)
-+ /*@modifies ap @*/
-+{
-+ char *buffer;
-+ char c;
-+ va_list apc;
-+ int xx;
-+
-+/*@-noeffectuncon -unrecog @*/
-+ va_copy(apc, ap); /* XXX linux amd64/ppc needs a copy. */
-+/*@=noeffectuncon =unrecog @*/
-+
-+ buffer = calloc(sizeof(*buffer), vsnprintf (&c, 1, format, ap) + 1);
-+ if (buffer != NULL)
-+ xx = vsprintf(buffer, format, apc);
-+
-+ va_end(apc);
-+
-+ return buffer;
-+}
-+/*@=mustmod@*/
-+
-+char *
-+POPT_prev_char (const char *str)
-+{
-+ char *p = (char *)str;
-+
-+ while (1) {
-+ p--;
-+ if ((*p & 0xc0) != (char)0x80)
-+ return (char *)p;
-+ }
-+}
-+
-+int
-+POPT_fprintf (FILE* stream, const char *format, ...)
-+{
-+ int retval = 0;
-+ va_list args;
-+ char *buffer = NULL;
-+#ifdef HAVE_ICONV
-+ char *locale_str = NULL;
-+#endif
-+
-+ va_start (args, format);
-+ buffer = strdup_vprintf(format, args);
-+ va_end (args);
-+ if (buffer == NULL)
-+ return retval;
-+
-+#ifdef HAVE_ICONV
-+ locale_str = strdup_locale_from_utf8(buffer);
-+ if (locale_str) {
-+ retval = fprintf(stream, "%s", locale_str);
-+ free(locale_str);
-+ } else
-+#endif
-+ {
-+ retval = fprintf(stream, "%s", buffer);
-+ }
-+ free (buffer);
-+
-+ return retval;
-+}
---- popt-1.7/poptint.h.orig 2007-12-21 19:40:22.696680000 +0900
-+++ popt-1.7/poptint.h 2007-12-21 20:00:39.593387000 +0900
-@@ -113,4 +113,37 @@ struct poptContext_s {
-
- #define N_(foo) foo
-
-+#ifdef HAVE_ICONV
-+#include <iconv.h>
-+#if defined(__LCLINT__)
-+/*@-declundef -incondefs @*/
-+extern /*@only@*/ iconv_t iconv_open(const char *__tocode, const char *__fromcode)
-+ /*@*/;
-+
-+extern size_t iconv(iconv_t __cd, /*@null@*/ char ** __inbuf,
-+ /*@out@*/ size_t * __inbytesleft,
-+ /*@out@*/ char ** __outbuf,
-+ /*@out@*/ size_t * __outbytesleft)
-+ /*@modifies __cd,
-+ *__inbuf, *__inbytesleft, *__outbuf, *__outbytesleft @*/;
-+
-+extern int iconv_close(/*@only@*/ iconv_t __cd)
-+ /*@modifies __cd @*/;
-+/*@=declundef =incondefs @*/
-+#endif
-+#endif
-+
-+#ifdef HAVE_LANGINFO_H
-+#include <langinfo.h>
-+#if defined(__LCLINT__)
-+/*@-declundef -incondefs @*/
-+extern char *nl_langinfo (nl_item __item)
-+ /*@*/;
-+/*@=declundef =incondefs @*/
-+#endif
-+#endif
-+
-+int POPT_fprintf (FILE* steam, const char *format, ...);
-+char *POPT_prev_char (const char *str);
-+
- #endif
---- popt-1.7/system.h.orig 2007-12-21 20:01:08.290683000 +0900
-+++ popt-1.7/system.h 2007-12-21 20:01:59.455124000 +0900
-@@ -13,6 +13,9 @@ extern __const __int32_t *__ctype_touppe
-
- #include <ctype.h>
-
-+/* XXX isspace(3) has i18n encoding signednesss issues on Solaris. */
-+#define _isspaceptr(_chp) isspace((int)(*(unsigned char *)(_chp)))
-+
- #include <errno.h>
- #include <fcntl.h>
- #include <limits.h>