From 8425db6a26bf66dad16dfbc26be9af7d272f31d3 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 8 Jun 2015 18:38:00 +0200 Subject: [PATCH] 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. --- agent/command.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/agent/command.c b/agent/command.c index f71325d55..82d93e954 100644 --- a/agent/command.c +++ b/agent/command.c @@ -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")) {