agent: Add command "getinfo std_env_names".

* agent/command.c (cmd_getinfo): Add new sub-command.
--

The current output is:

  > getinfo std_env_names
  D GPG_TTY
  D TERM
  D DISPLAY
  D XAUTHORITY
  D XMODIFIERS
  D GTK_IM_MODULE
  D QT_IM_MODULE
  D PINENTRY_USER_DATA
  OK

Note that there is an invisible \x00 at the end of each line.
This commit is contained in:
Werner Koch 2015-06-08 18:38:00 +02:00
parent cf508a1f7f
commit 8425db6a26
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 16 additions and 0 deletions

View File

@ -2756,6 +2756,7 @@ static const char hlp_getinfo[] =
" ssh_socket_name - Return the name of the ssh socket.\n"
" scd_running - Return OK if the SCdaemon is already running.\n"
" s2k_count - Return the calibrated S2K count.\n"
" std_env_names - List the names of the standard environment.\n"
" std_session_env - List the standard session environment.\n"
" std_startup_env - List the standard startup environment.\n"
" cmd_has_option\n"
@ -2849,6 +2850,21 @@ cmd_getinfo (assuan_context_t ctx, char *line)
{
rc = agent_scd_check_running ()? 0 : gpg_error (GPG_ERR_GENERAL);
}
else if (!strcmp (line, "std_env_names"))
{
int iterator;
const char *name;
iterator = 0;
while ((name = session_env_list_stdenvnames (&iterator, NULL)))
{
rc = assuan_send_data (ctx, name, strlen (name)+1);
if (!rc)
rc = assuan_send_data (ctx, NULL, 0);
if (rc)
break;
}
}
else if (!strcmp (line, "std_session_env")
|| !strcmp (line, "std_startup_env"))
{