[svn] gcry - r1240 - in trunk: . src tests
svn author wk
cvs at cvs.gnupg.org
Mon Apr 30 19:00:52 CEST 2007
Author: wk
Date: 2007-04-30 19:00:21 +0200 (Mon, 30 Apr 2007)
New Revision: 1240
Modified:
trunk/NEWS
trunk/src/ChangeLog
trunk/src/g10lib.h
trunk/src/gcrypt.h.in
trunk/src/global.c
trunk/src/misc.c
trunk/tests/version.c
Log:
Dropped GCRYCTL_DUMP_CONFIG in favor of GCRYCTL_PRINT_CONFIG.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2007-04-30 15:37:37 UTC (rev 1239)
+++ trunk/NEWS 2007-04-30 17:00:21 UTC (rev 1240)
@@ -57,7 +57,7 @@
GCRY_PK_ECDSA NEW
GCRY_CIPHER_SEED NEW
GCRYCTL_FAKED_RANDOM_P NEW
- GCRYCTL_DUMP_CONFIG NEW
+ GCRYCTL_PRINT_CONFIG NEW
GCRYCTL_SET_RNDEGD_SOCKET NEW.
gcry_mpi_scan CHANGED: Argument BUFFER is now void*.
gcry_pk_algo_name CHANGED: Returns "?" instead of NULL.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2007-04-30 15:37:37 UTC (rev 1239)
+++ trunk/src/ChangeLog 2007-04-30 17:00:21 UTC (rev 1240)
@@ -1,9 +1,11 @@
2007-04-30 Werner Koch <wk at g10code.com>
- * gcrypt.h.in (GCRYCTL_DUMP_CONFIG): New.
+ * gcrypt.h.in (GCRYCTL_PRINT_CONFIG): New.
(GCRYCTL_SET_RNDEGD_SOCKET): New.
- * global.c (gcry_control): Add GCRYCTL_DUMP_CONFIG and
+ * global.c (gcry_control): Add GCRYCTL_PRINT_CONFIG and
GCRYCTL_SET_RNDEGD_SOCKET.
+ (print_config): New.
+ * misc.c (_gcry_log_info_with_dummy_fp): New.
2007-04-18 Werner Koch <wk at g10code.com>
Modified: trunk/src/g10lib.h
===================================================================
--- trunk/src/g10lib.h 2007-04-30 15:37:37 UTC (rev 1239)
+++ trunk/src/g10lib.h 2007-04-30 17:00:21 UTC (rev 1240)
@@ -34,6 +34,8 @@
#error something is wrong with config.h
#endif
+#include <stdio.h>
+
#include <gcrypt.h>
#include "types.h"
@@ -83,6 +85,8 @@
void _gcry_log_fatal( const char *fmt, ... ) JNLIB_GCC_A_NR_PRINTF(1,2);
void _gcry_log_error( const char *fmt, ... ) JNLIB_GCC_A_PRINTF(1,2);
void _gcry_log_info( const char *fmt, ... ) JNLIB_GCC_A_PRINTF(1,2);
+int _gcry_log_info_with_dummy_fp (FILE *fp, const char *fmt, ... )
+ JNLIB_GCC_A_PRINTF(2,3);
void _gcry_log_debug( const char *fmt, ... ) JNLIB_GCC_A_PRINTF(1,2);
void _gcry_log_printf ( const char *fmt, ... ) JNLIB_GCC_A_PRINTF(1,2);
Modified: trunk/src/gcrypt.h.in
===================================================================
--- trunk/src/gcrypt.h.in 2007-04-30 15:37:37 UTC (rev 1239)
+++ trunk/src/gcrypt.h.in 2007-04-30 17:00:21 UTC (rev 1240)
@@ -356,8 +356,8 @@
GCRYCTL_SET_RANDOM_DAEMON_SOCKET = 49,
GCRYCTL_USE_RANDOM_DAEMON = 50,
GCRYCTL_FAKED_RANDOM_P = 51,
- GCRYCTL_DUMP_CONFIG = 52,
- GCRYCTL_SET_RNDEGD_SOCKET = 53
+ GCRYCTL_SET_RNDEGD_SOCKET = 52,
+ GCRYCTL_PRINT_CONFIG = 53
};
/* Perform various operations defined by CMD. */
Modified: trunk/src/global.c
===================================================================
--- trunk/src/global.c 2007-04-30 15:37:37 UTC (rev 1239)
+++ trunk/src/global.c 2007-04-30 17:00:21 UTC (rev 1240)
@@ -197,6 +197,30 @@
return NULL;
}
+
+static void
+print_config ( int (*fnc)(FILE *fp, const char *format, ...), FILE *fp)
+{
+ fnc (fp, "version:%s:\n", VERSION);
+ fnc (fp, "mpi-asm:%s:\n", _gcry_mpi_get_hw_config ());
+ fnc (fp, "rnd-mod:"
+#if USE_RNDEGD
+ "egd:"
+#endif
+#if USE_RNDLINUX
+ "linux:"
+#endif
+#if USE_RNDUNIX
+ "unix:"
+#endif
+#if USE_RNDW32
+ "w32:"
+#endif
+ "\n");
+
+}
+
+
/* Command dispatcher function, acting as general control
@@ -361,28 +385,16 @@
_gcry_random_initialize (1);
_gcry_use_random_daemon (!! va_arg (arg_ptr, int));
break;
-
+
/* This command dumps information pertaining to the
- configuration of libgcrypt to the logging stream. It may be
+ configuration of libgcrypt to the given stream. It may be
used before the intialization has been finished but not
before a gcry_version_check. */
- case GCRYCTL_DUMP_CONFIG:
- log_info ("version:%s:\n", VERSION);
- log_info ("mpi-asm:%s:\n", _gcry_mpi_get_hw_config ());
- log_info ("rnd-mod:"
-#if USE_RNDEGD
- "egd:"
-#endif
-#if USE_RNDLINUX
- "linux:"
-#endif
-#if USE_RNDUNIX
- "unix:"
-#endif
-#if USE_RNDW32
- "w32:"
-#endif
- "\n");
+ case GCRYCTL_PRINT_CONFIG:
+ {
+ FILE *fp = va_arg (arg_ptr, FILE *);
+ print_config (fp?fprintf:_gcry_log_info_with_dummy_fp, fp);
+ }
break;
default:
Modified: trunk/src/misc.c
===================================================================
--- trunk/src/misc.c 2007-04-30 15:37:37 UTC (rev 1239)
+++ trunk/src/misc.c 2007-04-30 17:00:21 UTC (rev 1240)
@@ -172,6 +172,18 @@
va_end(arg_ptr);
}
+int
+_gcry_log_info_with_dummy_fp (FILE *fp, const char *fmt, ... )
+{
+ va_list arg_ptr;
+
+ (void)fp;
+ va_start( arg_ptr, fmt ) ;
+ _gcry_logv( GCRY_LOG_INFO, fmt, arg_ptr );
+ va_end(arg_ptr);
+ return 0;
+}
+
void
_gcry_log_error( const char *fmt, ... )
{
Modified: trunk/tests/version.c
===================================================================
--- trunk/tests/version.c 2007-04-30 15:37:37 UTC (rev 1239)
+++ trunk/tests/version.c 2007-04-30 17:00:21 UTC (rev 1240)
@@ -51,7 +51,7 @@
exit (1);
}
- gcry_control (GCRYCTL_DUMP_CONFIG, 0);
+ gcry_control (GCRYCTL_PRINT_CONFIG, NULL);
return 0;
}
More information about the Gnupg-commits
mailing list