From 270c4830551c9810ad4e83f9a1db2b1cb946208c Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sat, 1 Oct 2016 00:33:49 +0200 Subject: New upstream version 1.4.2 --- clients/cli/common.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'clients/cli/common.c') diff --git a/clients/cli/common.c b/clients/cli/common.c index f1ec46a1..f8dc5239 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -1058,13 +1058,15 @@ get_secrets_from_user (const char *request_id, nmc_rl_pre_input_deftext = g_strdup (secret->value); } } - g_print ("%s\n", msg); + if (msg) + g_print ("%s\n", msg); pwd = nmc_readline_echo (secret->password ? echo_on : TRUE, "%s (%s): ", secret->name, secret->prop_name); if (!pwd) pwd = g_strdup (""); } else { - g_print ("%s\n", msg); + if (msg) + g_print ("%s\n", msg); g_printerr (_("Warning: password for '%s' not given in 'passwd-file' " "and nmcli cannot ask without '--ask' option.\n"), secret->prop_name); @@ -1354,6 +1356,33 @@ nmc_rl_gen_func_basic (const char *text, int state, const char **words) return NULL; } +char * +nmc_rl_gen_func_ifnames (const char *text, int state) +{ + int i; + const GPtrArray *devices; + const char **ifnames; + char *ret; + + nm_cli.get_client (&nm_cli); + devices = nm_client_get_devices (nm_cli.client); + if (devices->len == 0) + return NULL; + + ifnames = g_new (const char *, devices->len + 1); + for (i = 0; i < devices->len; i++) { + NMDevice *dev = g_ptr_array_index (devices, i); + const char *ifname = nm_device_get_iface (dev); + ifnames[i] = ifname; + } + ifnames[i] = NULL; + + ret = nmc_rl_gen_func_basic (text, state, ifnames); + + g_free (ifnames); + return ret; +} + /* for pre-filling a string to readline prompt */ char *nmc_rl_pre_input_deftext; -- cgit 1.3.0-6-gf8a5