From 0ebf79c824a0eebff35f757f85608e3dd7750ac3 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 21 Oct 2004 16:56:22 +0000 Subject: [PATCH] * configure.ac: Remove the check for asprintf * app-common.h (app_openpgp_storekey: Add prototype. * app-openpgp.c (do_sign): Replace asprintf by direct allocation. This avoids problems with missing vasprintf implementations. * card-util.c (generate_card_keys): Add a #warning for gnupg 1.9 and use the same string there. * util.h [!HAVE_VASPRINTF]: Removed prototype. * vasprintf.c: Removed. It was used only at one place and I don't want to get into build problems in 1.4. --- AUTHORS | 5 ++ ChangeLog | 4 ++ NEWS | 2 + configure.ac | 2 +- g10/ChangeLog | 10 +++ g10/app-common.h | 7 ++ g10/app-openpgp.c | 7 +- g10/card-util.c | 6 +- include/ChangeLog | 4 ++ include/util.h | 9 --- util/ChangeLog | 5 ++ util/vasprintf.c | 169 ---------------------------------------------- 12 files changed, 47 insertions(+), 183 deletions(-) delete mode 100644 util/vasprintf.c diff --git a/AUTHORS b/AUTHORS index dc16ad635..b760d8241 100644 --- a/AUTHORS +++ b/AUTHORS @@ -9,6 +9,8 @@ Authors Birger Langkjer Translations [da] +Britov Ivanovich Translations [ru] + Daniel Resare Translations [sv] David Shaw Assigns past and future changes. @@ -58,6 +60,9 @@ Nils Ellmenreich Paul Eggert (configuration macros for LFS) +Pavel I. Shajdo Translations [ru] + (man pages) + Pedro Morais Translations [pt_PT] Rémi Guyomarch Assigns past and future changes. diff --git a/ChangeLog b/ChangeLog index 077f6a293..e2294c950 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-10-21 Werner Koch + + * configure.ac: Remove the check for asprintf + 2004-10-15 Werner Koch Released 1.3.91. diff --git a/NEWS b/NEWS index cf8ca70b8..5905f8983 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ Noteworthy changes in version 1.3.92 ------------------------------------------------- + + * Added Russian man page. Thanks to Pawel I. Shajdo. Noteworthy changes in version 1.3.91 (2004-10-15) diff --git a/configure.ac b/configure.ac index c75a77451..8276a98c8 100644 --- a/configure.ac +++ b/configure.ac @@ -799,7 +799,7 @@ AC_CHECK_FUNCS(memmove gettimeofday getrusage setrlimit clock_gettime) AC_CHECK_FUNCS(atexit raise getpagesize strftime nl_langinfo setlocale) AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask rand pipe stat getaddrinfo) AC_REPLACE_FUNCS(mkdtemp timegm) -AC_REPLACE_FUNCS(vasprintf) + AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include ]) # See if getopt is in libiberty. This is of course not optimal since diff --git a/g10/ChangeLog b/g10/ChangeLog index 4b040b3a8..72604ae62 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,13 @@ +2004-10-21 Werner Koch + + * app-common.h (app_openpgp_storekey: Add prototype. + + * app-openpgp.c (do_sign): Replace asprintf by direct allocation. + This avoids problems with missing vasprintf implementations. + + * card-util.c (generate_card_keys): Add a #warning for gnupg 1.9 + and use the same string there. + 2004-10-20 David Shaw * g10.c (parse_list_options): Fix non-constant initializer so we diff --git a/g10/app-common.h b/g10/app-common.h index f54f6da92..48bd349f4 100644 --- a/g10/app-common.h +++ b/g10/app-common.h @@ -88,6 +88,13 @@ struct app_ctx_s { #if GNUPG_MAJOR_VERSION == 1 int app_select_openpgp (app_t app); int app_get_serial_and_stamp (app_t app, char **serial, time_t *stamp); +int app_openpgp_storekey (app_t app, int keyno, + unsigned char *template, size_t template_len, + time_t created_at, + const unsigned char *m, size_t mlen, + const unsigned char *e, size_t elen, + int (*pincb)(void*, const char *, char **), + void *pincb_arg); #else /*-- app-help.c --*/ gpg_error_t app_help_get_keygrip_string (ksba_cert_t cert, char *hexkeygrip); diff --git a/g10/app-openpgp.c b/g10/app-openpgp.c index d6cbe88a6..11be93e28 100644 --- a/g10/app-openpgp.c +++ b/g10/app-openpgp.c @@ -1298,10 +1298,15 @@ do_sign (app_t app, const char *keyidstr, int hashalgo, { char *prompt; - if (asprintf (&prompt, _("PIN [sigs done: %lu]"), sigcount) < 0) +#define PROMPTSTRING _("PIN [sigs done: %lu]") + + prompt = malloc (strlen (PROMPTSTRING) + 50); + if (!prompt) return gpg_error_from_errno (errno); + sprintf (prompt, PROMPTSTRING, sigcount); rc = pincb (pincb_arg, prompt, &pinvalue); free (prompt); +#undef PROMPTSTRING } if (rc) { diff --git a/g10/card-util.c b/g10/card-util.c index 1d2e47ea2..8cae1dab6 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -895,10 +895,10 @@ generate_card_keys (const char *serialno) m_free(answer); } #else - /* Does 1.9 have answer_is_yes_no_default() ? */ - want_backup = !(cpr_get_answer_is_yes + want_backup = cpr_get_answer_is_yes ( "cardedit.genkeys.backup_enc", - _("Inhibit off-card backup of encryption key? (y/N) "))); + _("Make off-card backup of encryption key? (Y/n) ")); +#warning we need answer_is_yes_no_default() #endif if ( (info.fpr1valid && !fpr_is_zero (info.fpr1)) diff --git a/include/ChangeLog b/include/ChangeLog index 37cc4f19a..c1c3df077 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2004-10-21 Werner Koch + + * util.h [!HAVE_VASPRINTF]: Removed prototype. + 2004-10-15 Werner Koch * util.h [!HAVE_VASPRINTF]: Add asprintf prototype. diff --git a/include/util.h b/include/util.h index a2c65e497..ba493b1be 100644 --- a/include/util.h +++ b/include/util.h @@ -245,15 +245,6 @@ int asprintf (char **buf, const char *fmt, ...); /*-- Replacement functions from funcname.c --*/ -#if !HAVE_VASPRINTF -int asprintf (char **result, const char *format, ...) -#if defined (__riscos__) \ - || (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )) - __attribute__ ((format (printf,2,3))) -#endif - ; - -#endif /******** some macros ************/ diff --git a/util/ChangeLog b/util/ChangeLog index 9d42f3a39..780616502 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,8 @@ +2004-10-21 Werner Koch + + * vasprintf.c: Removed. It was used only at one place and I don't + want to get into build problems in 1.4. + 2004-10-18 David Shaw * http.c (connect_server, send_request): Use the URI scheme as the diff --git a/util/vasprintf.c b/util/vasprintf.c deleted file mode 100644 index 9efea33f2..000000000 --- a/util/vasprintf.c +++ /dev/null @@ -1,169 +0,0 @@ -/* Like vsprintf but provides a pointer to malloc'd storage, which must - be freed by the caller. - Copyright (C) 1994, 2002 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - -#ifdef TEST -int global_total_width; -#endif - -int -vasprintf (char **result, const char *format, va_list args) -{ - const char *p = format; - /* Add one to make sure that it is never zero, which might cause malloc - to return NULL. */ - int total_width = strlen (format) + 1; - va_list ap; - -#ifdef va_copy - va_copy (ap, args); -#else -#ifdef __va_copy - __va_copy (ap, args); -#else - memcpy (&ap, args, sizeof (va_list)); -#endif /* __va_copy */ -#endif /* va_copy */ - - while (*p != '\0') - { - if (*p++ == '%') - { - while (strchr ("-+ #0", *p)) - ++p; - if (*p == '*') - { - ++p; - total_width += abs (va_arg (ap, int)); - } - else - total_width += strtoul (p, (char**)&p, 10); - if (*p == '.') - { - ++p; - if (*p == '*') - { - ++p; - total_width += abs (va_arg (ap, int)); - } - else - total_width += strtoul (p, (char**)&p, 10); - } - while (strchr ("hlL", *p)) - ++p; - /* Should be big enough for any format specifier except %s - and floats. */ - total_width += 30; - switch (*p) - { - case 'd': - case 'i': - case 'o': - case 'u': - case 'x': - case 'X': - case 'c': - (void) va_arg (ap, int); - break; - case 'f': - case 'e': - case 'E': - case 'g': - case 'G': - (void) va_arg (ap, double); - /* Since an ieee double can have an exponent of 307, we'll - make the buffer wide enough to cover the gross case. */ - total_width += 307; - break; - case 's': - { - char *tmp = va_arg (ap, char *); - if (tmp) - total_width += strlen (tmp); - else /* in case the vsprintf does prints a text */ - total_width += 25; /* e.g. "(null pointer reference)" */ - } - break; - case 'p': - case 'n': - (void) va_arg (ap, char *); - break; - } - } - } -#ifdef TEST - global_total_width = total_width; -#endif - *result = malloc (total_width); - if (*result != NULL) - return vsprintf (*result, format, args); - else - return 0; -} - - -int -asprintf (char **buf, const char *fmt, ...) -{ - int status; - va_list ap; - - va_start (ap, fmt); - status = vasprintf (buf, fmt, ap); - va_end (ap); - return status; -} - - -#ifdef TEST -void -checkit (const char* format, ...) -{ - va_list args; - char *result; - - va_start (args, format); - vasprintf (&result, format, args); - if (strlen (result) < global_total_width) - printf ("PASS: "); - else - printf ("FAIL: "); - printf ("%d %s\n", global_total_width, result); -} - -int -main (void) -{ - checkit ("%d", 0x12345678); - checkit ("%200d", 5); - checkit ("%.300d", 6); - checkit ("%100.150d", 7); - checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\ -777777777777777777333333333333366666666666622222222222777777777777733333"); - checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"); -} -#endif /* TEST */