diff options
author | Werner Koch <[email protected]> | 2000-01-31 16:48:54 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2000-01-31 16:48:54 +0000 |
commit | f00d949f8798530c6042734b8013554cc82ffe10 (patch) | |
tree | add7140501b9f2361a0b3d5c3dd61a78eb8b505d /tools | |
parent | See ChangeLog: Mon Jan 31 16:37:34 CET 2000 Werner Koch (diff) | |
download | gnupg-f00d949f8798530c6042734b8013554cc82ffe10.tar.gz gnupg-f00d949f8798530c6042734b8013554cc82ffe10.zip |
See ChangeLog: Mon Jan 31 17:48:10 CET 2000 Werner Koch
Diffstat (limited to 'tools')
-rw-r--r-- | tools/ChangeLog | 6 | ||||
-rw-r--r-- | tools/Makefile.am | 3 | ||||
-rw-r--r-- | tools/bftest.c | 7 | ||||
-rw-r--r-- | tools/mpicalc.c | 35 | ||||
-rw-r--r-- | tools/shmtest.c | 15 |
5 files changed, 44 insertions, 22 deletions
diff --git a/tools/ChangeLog b/tools/ChangeLog index f3b32eac0..a5566e84b 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,9 @@ +Mon Jan 31 17:46:35 CET 2000 Werner Koch <wk@> + + * Makefile.am: Add libjnlib. + * bftest.c: Some minor hacks to let it compile. + * mpicalc.c: Ditto. + Thu Jul 8 16:21:27 CEST 1999 Werner Koch <[email protected]> diff --git a/tools/Makefile.am b/tools/Makefile.am index 07fd1145a..92e008dfd 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -2,7 +2,8 @@ EXTRA_DIST = lspgpot INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -needed_libs = ../util/libutil.la ../gcrypt/libgcrypt.la @INTLLIBS@ +needed_libs = ../gcrypt/libgcrypt.la \ + ../util/libutil.la ../jnlib/libjnlib.la @INTLLIBS@ noinst_PROGRAMS = mpicalc bftest clean-sat mk-tdata shmtest diff --git a/tools/bftest.c b/tools/bftest.c index 8b8175901..1902703f7 100644 --- a/tools/bftest.c +++ b/tools/bftest.c @@ -38,11 +38,6 @@ my_usage(void) exit(1); } -const char * -strusage( int level ) -{ - return default_strusage(level); -} static void i18n_init(void) @@ -53,7 +48,7 @@ i18n_init(void) #else setlocale( LC_ALL, "" ); #endif - bindtextdomain( PACKAGE, G10_LOCALEDIR ); + bindtextdomain( PACKAGE, GNUPG_LOCALEDIR ); textdomain( PACKAGE ); #endif } diff --git a/tools/mpicalc.c b/tools/mpicalc.c index 95ab47c29..aedb27ecf 100644 --- a/tools/mpicalc.c +++ b/tools/mpicalc.c @@ -28,9 +28,9 @@ #include <stdio.h> #include <stdlib.h> #include <ctype.h> +#include <gcrypt.h> #include "util.h" -#include "mpi.h" #include "i18n.h" #define STACKSIZE 100 @@ -38,8 +38,8 @@ static MPI stack[STACKSIZE]; static int stackidx; -const char * -strusage( int level ) +static const char * +my_strusage( int level ) { const char *p; switch( level ) { @@ -56,7 +56,7 @@ strusage( int level ) "\nSyntax: mpicalc [options] [files]\n" "MPI RPN calculator\n"; break; - default: p = default_strusage(level); + default: p = NULL; } return p; } @@ -71,11 +71,35 @@ i18n_init(void) #else setlocale( LC_ALL, "" ); #endif - bindtextdomain( PACKAGE, G10_LOCALEDIR ); + bindtextdomain( PACKAGE, GNUPG_LOCALEDIR ); textdomain( PACKAGE ); #endif } +int +mpi_print( FILE *fp, MPI a, int mode ) +{ + int n=0; + + if( !a ) + return fprintf(fp, "[MPI_NULL]"); + if( !mode ) { + unsigned int n1; + n1 = gcry_mpi_get_nbits(a); + n += fprintf(fp, "[%u bits]", n1); + } + else { + int rc; + char *buffer; + + rc = gcry_mpi_aprint( GCRYMPI_FMT_HEX, (void **)&buffer, NULL, a ); + fputs( buffer, fp ); + n += strlen(buffer); + gcry_free( buffer ); + } + return n; +} + static void do_add(void) @@ -233,6 +257,7 @@ main(int argc, char **argv) pargs.argv = &argv; pargs.flags = 0; + set_strusage( my_strusage ); i18n_init(); while( arg_parse( &pargs, opts) ) { switch( pargs.r_opt ) { diff --git a/tools/shmtest.c b/tools/shmtest.c index 1cfb9b4ed..956dec6c5 100644 --- a/tools/shmtest.c +++ b/tools/shmtest.c @@ -15,6 +15,7 @@ #ifdef HAVE_SYS_SHM_H #include <sys/shm.h> #endif +#include <gcrypt.h> #include "util.h" #include "ttyio.h" #include "i18n.h" @@ -36,12 +37,6 @@ my_usage(void) exit(1); } -const char * -strusage( int level ) -{ - return default_strusage(level); -} - static void i18n_init(void) { @@ -51,7 +46,7 @@ i18n_init(void) #else setlocale( LC_ALL, "" ); #endif - bindtextdomain( PACKAGE, G10_LOCALEDIR ); + bindtextdomain( PACKAGE, GNUPG_LOCALEDIR ); textdomain( PACKAGE ); #endif } @@ -77,7 +72,7 @@ do_get_string( int mode, const char *keyword, byte *area, size_t areasize ) memcpy( area+n+2, p, len ); area[n] = len >> 8; area[n+1] = len; - m_free(p); + gcry_free(p); } else { /* bool */ area[n] = 0; @@ -112,7 +107,7 @@ main(int argc, char **argv) for(n=0,i=1; i < argc; i++ ) n += strlen(argv[i]) + 1; - p = m_alloc( 100 + n ); + p = gcry_xmalloc( 100 + n ); strcpy( p, "../g10/gpg --status-fd 1 --run-as-shm-coprocess 0"); for(i=1; i < argc; i++ ) { strcat(p, " " ); @@ -120,7 +115,7 @@ main(int argc, char **argv) } fp = popen( p, "r" ); - m_free( p ); + gcry_free( p ); if( !fp ) log_error("popen failed: %s\n", strerror(errno)); |