GNUPGHOME and the registry on mingw

jrobinson jrobinson at airswitch.net
Tue Apr 24 21:56:01 CEST 2001


Hello,

I would like GnuPG to check the GNUPGHOME environment variable before it
looks in the registry on Windows.  This is useful when you have a
program that runs GnuPG, and you want to set where it looks for its home
directory, instead of looking in the registry.

What do you think?

- Jared Robinson

Here are my patches (generated with "cvs diff -c")

Index: g10.c
===================================================================
RCS file: /cvs/gnupg/gnupg/g10/Attic/g10.c,v
retrieving revision 1.129.2.43
diff -c -r1.129.2.43 g10.c
*** g10.c	2001/03/27 18:13:16	1.129.2.43
--- g10.c	2001/04/24 18:50:36
***************
*** 652,666 ****
      opt.max_cert_depth = 5;
      opt.pgp2_workarounds = 1;
      opt.auto_key_retrieve = 1;
-   #ifdef __MINGW32__
-     opt.homedir = read_w32_registry_string( NULL,
"Software\\GNU\\GnuPG", "HomeDir" );
-   #else
      opt.homedir = getenv("GNUPGHOME");
-   #endif
      if( !opt.homedir || !*opt.homedir ) {
  	opt.homedir = GNUPG_HOMEDIR;
      }
! 
      /* check whether we have a config file on the commandline */
      orig_argc = argc;
      orig_argv = argv;
--- 652,669 ----
      opt.max_cert_depth = 5;
      opt.pgp2_workarounds = 1;
      opt.auto_key_retrieve = 1;
      opt.homedir = getenv("GNUPGHOME");
      if( !opt.homedir || !*opt.homedir ) {
+   #ifdef __MINGW32__
+         opt.homedir = read_w32_registry_string( NULL,
"Software\\GNU\\GnuPG", "HomeDir" );
+         if( !opt.homedir || !*opt.homedir ) {
+             opt.homedir = GNUPG_HOMEDIR;
+         }
+   #else
  	opt.homedir = GNUPG_HOMEDIR;
+   #endif
      }
!         
      /* check whether we have a config file on the commandline */
      orig_argc = argc;
      orig_argv = argv;
Index: gpgv.c
===================================================================
RCS file: /cvs/gnupg/gnupg/g10/Attic/gpgv.c,v
retrieving revision 1.1.2.4
diff -c -r1.1.2.4 gpgv.c
*** gpgv.c	2001/03/08 14:33:23	1.1.2.4
--- gpgv.c	2001/04/24 18:50:36
***************
*** 146,158 ****
      opt.always_trust = 1;
      opt.batch = 1;
  
-   #ifdef __MINGW32__
-     opt.homedir = read_w32_registry_string( NULL,
"Software\\GNU\\GnuPG", "HomeDir" );
-   #else
      opt.homedir = getenv("GNUPGHOME");
-   #endif
      if( !opt.homedir || !*opt.homedir ) {
  	opt.homedir = GNUPG_HOMEDIR;
      }
      tty_no_terminal(1);
      tty_batchmode(1);
--- 146,161 ----
      opt.always_trust = 1;
      opt.batch = 1;
  
      opt.homedir = getenv("GNUPGHOME");
      if( !opt.homedir || !*opt.homedir ) {
+   #ifdef __MINGW32__
+         opt.homedir = read_w32_registry_string( NULL,
"Software\\GNU\\GnuPG", "HomeDir" );
+         if( !opt.homedir || !*opt.homedir ) {
+             opt.homedir = GNUPG_HOMEDIR;
+         }
+   #else
  	opt.homedir = GNUPG_HOMEDIR;
+   #endif
      }
      tty_no_terminal(1);
      tty_batchmode(1);





More information about the Gnupg-devel mailing list