diff options
author | David Shaw <dshaw@jabberwocky.com> | 2002-06-29 15:46:34 +0200 |
---|---|---|
committer | David Shaw <dshaw@jabberwocky.com> | 2002-06-29 15:46:34 +0200 |
commit | 3f51f7db3de85574dc5d6efd8b54ef78c1cd3f37 (patch) | |
tree | dac7a3780fb4edf9ca89c93800230e88ab255434 /tools/mpicalc.c | |
parent | Update head to match stable 1.0 (diff) | |
download | gnupg2-3f51f7db3de85574dc5d6efd8b54ef78c1cd3f37.tar.xz gnupg2-3f51f7db3de85574dc5d6efd8b54ef78c1cd3f37.zip |
Update head to match stable 1.0
Diffstat (limited to 'tools/mpicalc.c')
-rw-r--r-- | tools/mpicalc.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/tools/mpicalc.c b/tools/mpicalc.c index aedb27ecf..2817c9932 100644 --- a/tools/mpicalc.c +++ b/tools/mpicalc.c @@ -1,5 +1,5 @@ /* mpitest.c - test the mpi functions - * Copyright (C) 1998 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. * * This is an RPN calculator; values must be given in hex. * Operation is like dc(1) except that the input/output radix is @@ -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; -static const char * -my_strusage( int level ) +const char * +strusage( int level ) { const char *p; switch( level ) { @@ -56,7 +56,7 @@ my_strusage( int level ) "\nSyntax: mpicalc [options] [files]\n" "MPI RPN calculator\n"; break; - default: p = NULL; + default: p = default_strusage(level); } return p; } @@ -71,35 +71,11 @@ i18n_init(void) #else setlocale( LC_ALL, "" ); #endif - bindtextdomain( PACKAGE, GNUPG_LOCALEDIR ); + bindtextdomain( PACKAGE, G10_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) @@ -257,7 +233,6 @@ 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 ) { |