agent: Print a warning for obsolete options.

* g10/misc.c (obsolete_scdaemon_option): Move to
* common/miscellaneous.c (obsolete_option): ... here.
* agent/gpg-agent.c (main): Use obsolete_option for the 3 obsolete
options.
--

GnuPG-bug-id: 2016
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-06-17 12:59:29 +02:00
parent 685b782a18
commit 010d26a85b
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
5 changed files with 24 additions and 18 deletions

View File

@ -908,8 +908,10 @@ main (int argc, char **argv )
case oXauthority: default_xauthority = xstrdup (pargs.r.ret_str);
break;
case oUseStandardSocket: /* dummy */ break;
case oNoUseStandardSocket: /* dummy */ break;
case oUseStandardSocket:
case oNoUseStandardSocket:
obsolete_option (configname, configlineno, "use-standard-socket");
break;
case oFakedSystemTime:
{
@ -945,7 +947,9 @@ main (int argc, char **argv )
/* Only used by the first stage command line parser. */
break;
case oWriteEnvFile: /* dummy */ break;
case oWriteEnvFile:
obsolete_option (configname, configlineno, "write-env-file");
break;
default : pargs.err = configfp? 1:2; break;
}

View File

@ -104,6 +104,7 @@ setup_libgcrypt_logging (void)
gcry_set_outofcore_handler (my_gcry_outofcore_handler, NULL);
}
/* A wrapper around gcry_cipher_algo_name to return the string
"AES-128" instead of "AES". Given that we have an alias in
libgcrypt for it, it does not harm to too much to return this other
@ -122,6 +123,19 @@ gnupg_cipher_algo_name (int algo)
}
void
obsolete_option (const char *configname, unsigned int configlineno,
const char *name)
{
if (configname)
log_info (_("%s:%u: obsolete option \"%s\" - it has no effect\n"),
configname, configlineno, name);
else
log_info (_("WARNING: \"%s%s\" is an obsolete option - it has no effect\n"),
"--", name);
}
/* Decide whether the filename is stdout or a real filename and return
* an appropriate string. */
const char *

View File

@ -370,6 +370,9 @@ char *xtryasprintf (const char *fmt, ...) GPGRT_GCC_A_PRINTF(1,2);
/* Replacement for gcry_cipher_algo_name. */
const char *gnupg_cipher_algo_name (int algo);
void obsolete_option (const char *configname, unsigned int configlineno,
const char *name);
const char *print_fname_stdout (const char *s);
const char *print_fname_stdin (const char *s);
void print_utf8_buffer3 (estream_t fp, const void *p, size_t n,

View File

@ -134,8 +134,6 @@ char *pct_expando(const char *string,struct expando_args *args);
void deprecated_warning(const char *configname,unsigned int configlineno,
const char *option,const char *repl1,const char *repl2);
void deprecated_command (const char *name);
void obsolete_option (const char *configname, unsigned int configlineno,
const char *name);
void obsolete_scdaemon_option (const char *configname,
unsigned int configlineno, const char *name);

View File

@ -1012,19 +1012,6 @@ deprecated_command (const char *name)
}
void
obsolete_option (const char *configname, unsigned int configlineno,
const char *name)
{
if(configname)
log_info (_("%s:%u: obsolete option \"%s\" - it has no effect\n"),
configname, configlineno, name);
else
log_info (_("WARNING: \"%s%s\" is an obsolete option - it has no effect\n"),
"--", name);
}
void
obsolete_scdaemon_option (const char *configname, unsigned int configlineno,
const char *name)