aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2003-10-26 15:49:44 +0000
committerDavid Shaw <[email protected]>2003-10-26 15:49:44 +0000
commitce4c9b6b5fdb279b294ba2141338efe1a3b150a0 (patch)
tree1277fedafd792819eea3216f8e4eaac21583a2fc
parent* g10.c (main): Add --symmetric --encrypt command. This generates a (diff)
downloadgnupg-ce4c9b6b5fdb279b294ba2141338efe1a3b150a0.tar.gz
gnupg-ce4c9b6b5fdb279b294ba2141338efe1a3b150a0.zip
* g10.c (main): Enhance the version-specific config file code to try for
more specific matches before giving up (e.g. 1.3.3-cvs, 1.3.3, 1.3, 1).
-rw-r--r--g10/ChangeLog6
-rw-r--r--g10/g10.c34
2 files changed, 33 insertions, 7 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 3ed0f520e..39daffb97 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,9 @@
+2003-10-26 David Shaw <[email protected]>
+
+ * g10.c (main): Enhance the version-specific config file code to
+ try for more specific matches before giving up (e.g. 1.3.3-cvs,
+ 1.3.3, 1.3, 1).
+
2003-10-25 David Shaw <[email protected]>
* g10.c (main): Add --symmetric --encrypt command. This generates
diff --git a/g10/g10.c b/g10/g10.c
index e1b4d42aa..9123bc4d3 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -1299,17 +1299,37 @@ main( int argc, char **argv )
set_native_charset (NULL); /* Try to auto set the character set */
+ /* Try for a version specific config file first */
if( default_config )
{
- /* Try for a version specific config file first */
- configname = make_filename(opt.homedir,
- "gpg" EXTSEP_S "conf-" SAFE_VERSION, NULL );
- if(access(configname,R_OK))
+ char *name=m_strdup("gpg" EXTSEP_S "conf-" SAFE_VERSION);
+ char *ver=&name[strlen("gpg" EXTSEP_S "conf-")];
+
+ do
{
- m_free(configname);
- configname = make_filename(opt.homedir,
- "gpg" EXTSEP_S "conf", NULL );
+ if(configname)
+ {
+ char *tok;
+
+ m_free(configname);
+ configname=NULL;
+
+ if((tok=strrchr(ver,SAFE_VERSION_DASH)))
+ *tok='\0';
+ else if((tok=strrchr(ver,SAFE_VERSION_DOT)))
+ *tok='\0';
+ else
+ break;
+ }
+
+ configname = make_filename(opt.homedir,name,NULL);
}
+ while(access(configname,R_OK));
+
+ m_free(name);
+
+ if(!configname)
+ configname=make_filename(opt.homedir, "gpg" EXTSEP_S "conf", NULL );
if (!access (configname, R_OK))
{ /* Print a warning when both config files are present. */
char *p = make_filename(opt.homedir, "options", NULL );