diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/ChangeLog | 18 | ||||
-rw-r--r-- | util/iobuf.c | 22 | ||||
-rw-r--r-- | util/logger.c | 5 | ||||
-rw-r--r-- | util/pka.c | 25 | ||||
-rw-r--r-- | util/ttyio.c | 36 |
5 files changed, 92 insertions, 14 deletions
diff --git a/util/ChangeLog b/util/ChangeLog index 534e59dd3..e5928a32a 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,21 @@ +2010-09-28 Steven M. Schweda <[email protected]> (wk) + + Changes to help the VMS port. See + http://antinode.info/dec/sw/gnupg.html . + + * cert.c [__VMS]: Include cert_vms.h. + * ttyio.c [__VMS]: Include vms.h. + (init_ttyfp) [__VMS]: Make global. + (ttyfp_is) [__VMS]: New. + (do_get) [__VMS]: Disable terminal echo. + * srv.c [__VMS]: Include cert_vms.h. + * secmem.c (lock_pool) [__VMS]: Use log_warning. + * pka.c [USE_DNS_PKA]: Define T_CERT. + * logger.c [__VMS]: Include unistd.h and ttyio.h. + (g10_log_print_prefix) [__VMS]: Init logfp. + * iobuf.c [__VMS]: Include vms.h. + (iobuf_get_filelength) [__VMS]: Use VMS specific method. + 2009-09-03 Werner Koch <[email protected]> * ttyio.c (tty_printf) [_WIN32]: s/xtryasprintf/xtryvasprint/ diff --git a/util/iobuf.c b/util/iobuf.c index 72322f35b..384b96644 100644 --- a/util/iobuf.c +++ b/util/iobuf.c @@ -41,6 +41,11 @@ #include "util.h" #include "dynload.h" #include "iobuf.h" + +#ifdef __VMS +# include "vms.h" +# define open open_vms +#endif /* def __VMS */ /* The size of the internal buffers. NOTE: If you change this value you MUST also adjust the regression @@ -1916,13 +1921,24 @@ iobuf_get_filelength (IOBUF a, int *overflow ) if (overflow) *overflow = 0; - if( a->directfp ) { + if (a->directfp) + { FILE *fp = a->directfp; - if( !fstat(fileno(fp), &st) ) +#ifdef __VMS + /* 2009-02-19 SMS. + * On VMS, use a VMS-specific method to determine file size. + * For some non-UNIX-like file formats, the fstat() result + * will not agree with the C Standard I/O functions such as + * getc() and fread(), so these must be detected and handled + * specially. */ + return vms_file_size (fileno( fp)); +#else /*!__VMS */ + if( !fstat(fileno(fp), &st) ) return st.st_size; log_error("fstat() failed: %s\n", strerror(errno) ); return 0; +#endif /*!__VMS */ } /* Hmmm: file_filter may have already been removed */ @@ -1975,6 +1991,8 @@ iobuf_get_filelength (IOBUF a, int *overflow ) } log_error ("GetFileSize for handle %p failed: %s\n", fp, w32_strerror (0)); +#elif defined(__VMS) + return vms_file_size (my_fileno (fp)); #else if( !fstat(my_fileno(fp), &st) ) return st.st_size; diff --git a/util/logger.c b/util/logger.c index 5e603d678..745344443 100644 --- a/util/logger.c +++ b/util/logger.c @@ -27,6 +27,11 @@ #include "util.h" #include "i18n.h" +#ifdef __VMS +# include <unistd.h> +# include "ttyio.h" +#endif /* def __VMS */ + static char pidstring[15]; static char *pgm_name; static int errorcount; diff --git a/util/pka.c b/util/pka.c index 901bfb6c4..40f4dd1d9 100644 --- a/util/pka.c +++ b/util/pka.c @@ -24,15 +24,22 @@ #include <string.h> #ifdef USE_DNS_PKA -#include <sys/types.h> -#ifdef _WIN32 -#include <windows.h> -#else -#include <netinet/in.h> -#include <arpa/nameser.h> -#include <arpa/inet.h> -#include <resolv.h> -#endif +# include <sys/types.h> +# ifdef _WIN32 +# include <windows.h> +# else +# include <netinet/in.h> +# include <arpa/nameser.h> +# include <arpa/inet.h> +# include <resolv.h> + /* Not every installation has gotten around to supporting CERTs yet... */ +# ifndef T_CERT +# define T_CERT 37 +# ifdef __VMS +# include "cert_vms.h" +# endif /* def __VMS */ +# endif +# endif #endif /* USE_DNS_PKA */ #include "memory.h" diff --git a/util/ttyio.c b/util/ttyio.c index 3adcdf9ca..05c0a3796 100644 --- a/util/ttyio.c +++ b/util/ttyio.c @@ -50,6 +50,10 @@ #include <readline/history.h> #endif +#ifdef __VMS +# include "vms.h" +#endif /* __VMS */ + #include "util.h" #include "memory.h" #include "ttyio.h" @@ -130,7 +134,23 @@ tty_cleanup_after_signal (void) #endif } -static void +#ifdef __VMS +/* 2006-08-10 SMS. + Interface function needed for VMS (unless someone + wishes to make "ttyfp" global). See g10_log_print_prefix() in + util/logger.c. */ +FILE * +ttyfp_is (void) +{ + return ttyfp; +} +#endif /* def __VMS */ + + +#ifndef __VMS +static +#endif + void init_ttyfp(void) { if( initialized ) @@ -507,6 +527,11 @@ do_get( const char *prompt, int hidden ) if( tcsetattr( fileno(ttyfp), TCSAFLUSH, &term ) ) log_fatal("tcsetattr() failed: %s\n", strerror(errno) ); #endif +# ifdef __VMS + /* Disable terminal echo. */ + if (vms_set_term_echo (0)) + log_fatal ("error disabling terminal echo: %s\n", strerror (errno)); +# endif /* __VMS */ } tty_printf( "%s", prompt ); @@ -539,11 +564,16 @@ do_get( const char *prompt, int hidden ) if( hidden ) { -#ifdef HAVE_TCGETATTR +# ifdef HAVE_TCGETATTR if( tcsetattr(fileno(ttyfp), TCSAFLUSH, &termsave) ) log_error("tcsetattr() failed: %s\n", strerror(errno) ); restore_termios = 0; -#endif +# endif +# ifdef __VMS + /* Restore (most likely enable) terminal echo. */ + if (vms_set_term_echo( -1)) + log_fatal ("error enabling terminal echo: %s\n", strerror (errno)); +# endif /* __VMS */ } #endif /* end unix version */ buf[i] = 0; |