diff options
author | Thomas Haller <thaller@redhat.com> | 2023-02-06 16:57:38 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-02-08 10:11:18 +0100 |
commit | b32e4c941a7525881599f6d419ddaafacd85b52c (patch) | |
tree | cd82f5eaafdc17687c6687e01548153592dc625a | |
parent | 4cf94f30c72bce47c5079e8534dda7f9b3c49869 (diff) | |
download | NetworkManager-b32e4c941a7525881599f6d419ddaafacd85b52c.tar.gz |
nmcli: replace all uses of g_print()/g_printerr() with nmc_print()/nmc_printerr()
The main purpose is to simplify printf debugging and manual testing. We
can now trivially patch the code so that all output from nmcli gets
(additionally) written to a file. That is useful when debugging a unit
test in "test-client.py". Thereby we can duplicate all messages via
nm_utils_print(), which is in sync with the debug messages from libnm
and which honors LIBNM_CLIENT_DEBUG_FILE.
-rw-r--r-- | src/nmcli/agent.c | 40 | ||||
-rw-r--r-- | src/nmcli/common.c | 20 | ||||
-rw-r--r-- | src/nmcli/connections.c | 1054 | ||||
-rw-r--r-- | src/nmcli/devices.c | 269 | ||||
-rw-r--r-- | src/nmcli/general.c | 230 | ||||
-rw-r--r-- | src/nmcli/nmcli.c | 22 | ||||
-rw-r--r-- | src/nmcli/polkit-agent.c | 9 | ||||
-rw-r--r-- | src/nmcli/settings.c | 24 | ||||
-rw-r--r-- | src/nmcli/utils.c | 76 |
9 files changed, 885 insertions, 859 deletions
diff --git a/src/nmcli/agent.c b/src/nmcli/agent.c index 6d0fcfb5c9..b16a3c51c9 100644 --- a/src/nmcli/agent.c +++ b/src/nmcli/agent.c @@ -22,36 +22,36 @@ static void usage(void) { - g_printerr(_("Usage: nmcli agent { COMMAND | help }\n\n" - "COMMAND := { secret | polkit | all }\n\n")); + nmc_printerr(_("Usage: nmcli agent { COMMAND | help }\n\n" + "COMMAND := { secret | polkit | all }\n\n")); } static void usage_agent_secret(void) { - g_printerr(_("Usage: nmcli agent secret { help }\n" - "\n" - "Runs nmcli as NetworkManager secret agent. When NetworkManager requires\n" - "a password it asks registered agents for it. This command keeps nmcli running\n" - "and if a password is required asks the user for it.\n\n")); + nmc_printerr(_("Usage: nmcli agent secret { help }\n" + "\n" + "Runs nmcli as NetworkManager secret agent. When NetworkManager requires\n" + "a password it asks registered agents for it. This command keeps nmcli running\n" + "and if a password is required asks the user for it.\n\n")); } static void usage_agent_polkit(void) { - g_printerr(_("Usage: nmcli agent polkit { help }\n" - "\n" - "Registers nmcli as a polkit action for the user session.\n" - "When a polkit daemon requires an authorization, nmcli asks the user and gives\n" - "the response back to polkit.\n\n")); + nmc_printerr(_("Usage: nmcli agent polkit { help }\n" + "\n" + "Registers nmcli as a polkit action for the user session.\n" + "When a polkit daemon requires an authorization, nmcli asks the user and gives\n" + "the response back to polkit.\n\n")); } static void usage_agent_all(void) { - g_printerr(_("Usage: nmcli agent all { help }\n" - "\n" - "Runs nmcli as both NetworkManager secret and a polkit agent.\n\n")); + nmc_printerr(_("Usage: nmcli agent all { help }\n" + "\n" + "Runs nmcli as both NetworkManager secret and a polkit agent.\n\n")); } static char *pre_input_deftext; @@ -82,7 +82,7 @@ get_secrets_from_user(const NmcConfig *nmc_config, /* Ask user for the password */ if (msg) - g_print("%s\n", msg); + nmc_print("%s\n", msg); if (secret->value) { /* Prefill the password if we have it. */ rl_startup_hook = set_deftext; @@ -138,7 +138,7 @@ do_agent_secret(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const * NM_SECRET_AGENT_SIMPLE_REQUEST_SECRETS, G_CALLBACK(secrets_requested), nmc); - g_print(_("nmcli successfully registered as a NetworkManager's secret agent.\n")); + nmc_print(_("nmcli successfully registered as a NetworkManager's secret agent.\n")); } else { g_string_printf(nmc->return_text, _("Error: secret agent initialization failed")); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; @@ -148,7 +148,7 @@ do_agent_secret(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const * static void polkit_registered(gpointer instance, gpointer user_data) { - g_print(_("nmcli successfully registered as a polkit agent.\n")); + nmc_print(_("nmcli successfully registered as a polkit agent.\n")); } static void @@ -202,14 +202,14 @@ do_agent_all(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const *arg do_agent_secret(cmd, nmc, argc, argv); r = nmc->return_value; if (r != NMC_RESULT_SUCCESS) { - g_printerr("%s\n", nmc->return_text->str); + nmc_printerr("%s\n", nmc->return_text->str); g_string_truncate(nmc->return_text, 0); nmc->return_value = NMC_RESULT_SUCCESS; } do_agent_polkit(cmd, nmc, argc, argv); if (nmc->return_value != NMC_RESULT_SUCCESS) { - g_printerr("%s\n", nmc->return_text->str); + nmc_printerr("%s\n", nmc->return_text->str); g_string_truncate(nmc->return_text, 0); } diff --git a/src/nmcli/common.c b/src/nmcli/common.c index 8c89f82dcc..f31d09872d 100644 --- a/src/nmcli/common.c +++ b/src/nmcli/common.c @@ -660,16 +660,16 @@ vpn_openconnect_get_secrets(NMConnection *connection, GPtrArray *secrets) /* Interactively authenticate to OpenConnect server and get secrets */ ret = nm_vpn_openconnect_authenticate_helper(gw, &cookie, &gateway, &gwcert, &status, &error); if (!ret) { - g_printerr(_("Error: openconnect failed: %s\n"), error->message); + nmc_printerr(_("Error: openconnect failed: %s\n"), error->message); g_clear_error(&error); return FALSE; } if (WIFEXITED(status)) { if (WEXITSTATUS(status) != 0) - g_printerr(_("Error: openconnect failed with status %d\n"), WEXITSTATUS(status)); + nmc_printerr(_("Error: openconnect failed with status %d\n"), WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) - g_printerr(_("Error: openconnect failed with signal %d\n"), WTERMSIG(status)); + nmc_printerr(_("Error: openconnect failed with signal %d\n"), WTERMSIG(status)); /* Append port to the host value */ if (gateway && port) { @@ -743,7 +743,7 @@ get_secrets_from_user(const NmcConfig *nmc_config, } } if (msg) - g_print("%s\n", msg); + nmc_print("%s\n", msg); echo_on = secret->is_secret ? nmc_config->show_secrets : TRUE; @@ -760,10 +760,10 @@ get_secrets_from_user(const NmcConfig *nmc_config, pwd = g_strdup(""); } else { 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->entry_id); + nmc_print("%s\n", msg); + nmc_printerr(_("Warning: password for '%s' not given in 'passwd-file' " + "and nmcli cannot ask without '--ask' option.\n"), + secret->entry_id); } } /* No password provided, cancel the secrets. */ @@ -1532,7 +1532,7 @@ nmc_do_cmd(NmCli *nmc, const NMCCommand cmds[], const char *cmd, int argc, const if (argc == 1 && nmc->complete) { for (c = cmds; c->cmd; ++c) { if (!*cmd || matches(cmd, c->cmd)) - g_print("%s\n", c->cmd); + nmc_print("%s\n", c->cmd); } nmc_complete_help(cmd); g_task_return_boolean(task, TRUE); @@ -1612,7 +1612,7 @@ nmc_complete_strv(const char *prefix, gssize nargs, const char *const *args) if (prefix && !matches(prefix, candidate)) continue; - g_print("%s\n", candidate); + nmc_print("%s\n", candidate); } } diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c index 97cd991e8b..36de6373e9 100644 --- a/src/nmcli/connections.c +++ b/src/nmcli/connections.c @@ -1084,7 +1084,7 @@ static TabCompletionInfo nmc_tab_completion; static void usage(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli connection { COMMAND | help }\n\n" "COMMAND := { show | up | down | add | modify | clone | edit | delete | monitor | reload " "| load | import | export }\n\n" @@ -1110,7 +1110,7 @@ usage(void) static void usage_connection_show(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli connection show { ARGUMENTS | help }\n" "\n" "ARGUMENTS := [--active] [--order <order spec>]\n" @@ -1132,171 +1132,173 @@ usage_connection_show(void) static void usage_connection_up(void) { - g_printerr(_("Usage: nmcli connection up { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [id | uuid | path] <ID> [ifname <ifname>] [ap <BSSID>] [nsp <name>] " - "[passwd-file <file with passwords>]\n" - "\n" - "Activate a connection on a device. The profile to activate is identified by its\n" - "name, UUID or D-Bus path.\n" - "\n" - "ARGUMENTS := ifname <ifname> [ap <BSSID>] [nsp <name>] [passwd-file <file with " - "passwords>]\n" - "\n" - "Activate a device with a connection. The connection profile is selected\n" - "automatically by NetworkManager.\n" - "\n" - "ifname - specifies the device to active the connection on\n" - "ap - specifies AP to connect to (only valid for Wi-Fi)\n" - "nsp - specifies NSP to connect to (only valid for WiMAX)\n" - "passwd-file - file with password(s) required to activate the connection\n\n")); + nmc_printerr( + _("Usage: nmcli connection up { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [id | uuid | path] <ID> [ifname <ifname>] [ap <BSSID>] [nsp <name>] " + "[passwd-file <file with passwords>]\n" + "\n" + "Activate a connection on a device. The profile to activate is identified by its\n" + "name, UUID or D-Bus path.\n" + "\n" + "ARGUMENTS := ifname <ifname> [ap <BSSID>] [nsp <name>] [passwd-file <file with " + "passwords>]\n" + "\n" + "Activate a device with a connection. The connection profile is selected\n" + "automatically by NetworkManager.\n" + "\n" + "ifname - specifies the device to active the connection on\n" + "ap - specifies AP to connect to (only valid for Wi-Fi)\n" + "nsp - specifies NSP to connect to (only valid for WiMAX)\n" + "passwd-file - file with password(s) required to activate the connection\n\n")); } static void usage_connection_down(void) { - g_printerr(_("Usage: nmcli connection down { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [id | uuid | path | apath] <ID> ...\n" - "\n" - "Deactivate a connection from a device (without preventing the device from\n" - "further auto-activation). The profile to deactivate is identified by its name,\n" - "UUID or D-Bus path.\n\n")); + nmc_printerr( + _("Usage: nmcli connection down { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [id | uuid | path | apath] <ID> ...\n" + "\n" + "Deactivate a connection from a device (without preventing the device from\n" + "further auto-activation). The profile to deactivate is identified by its name,\n" + "UUID or D-Bus path.\n\n")); } static void usage_connection_add(void) { - g_printerr(_("Usage: nmcli connection add { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS SLAVE_OPTIONS IP_OPTIONS [-- " - "([+|-]<setting>.<property> <value>)+]\n\n" - " COMMON_OPTIONS:\n" - " type <type>\n" - " [ifname <interface name> | \"*\"]\n" - " [con-name <connection name>]\n" - " [autoconnect yes|no]\n" - " [save yes|no]\n" - " [master <master (ifname, or connection UUID or name)>]\n" - " [slave-type <master connection type>]\n\n" - " TYPE_SPECIFIC_OPTIONS:\n" - " ethernet: [mac <MAC address>]\n" - " [cloned-mac <cloned MAC address>]\n" - " [mtu <MTU>]\n\n" - " wifi: ssid <SSID>\n" - " [mac <MAC address>]\n" - " [cloned-mac <cloned MAC address>]\n" - " [mtu <MTU>]\n" - " [mode infrastructure|ap|adhoc]\n\n" - " wimax: [mac <MAC address>]\n" - " [nsp <NSP>]\n\n" - " pppoe: username <PPPoE username>\n" - " [password <PPPoE password>]\n" - " [service <PPPoE service name>]\n" - " [mtu <MTU>]\n" - " [mac <MAC address>]\n\n" - " gsm: apn <APN>\n" - " [user <username>]\n" - " [password <password>]\n\n" - " cdma: [user <username>]\n" - " [password <password>]\n\n" - " infiniband: [mac <MAC address>]\n" - " [mtu <MTU>]\n" - " [transport-mode datagram | connected]\n" - " [parent <ifname>]\n" - " [p-key <IPoIB P_Key>]\n\n" - " bluetooth: [addr <bluetooth address>]\n" - " [bt-type panu|nap|dun-gsm|dun-cdma]\n\n" - " vlan: dev <parent device (connection UUID, ifname, or MAC)>\n" - " id <VLAN ID>\n" - " [flags <VLAN flags>]\n" - " [ingress <ingress priority mapping>]\n" - " [egress <egress priority mapping>]\n" - " [mtu <MTU>]\n\n" - " bond: [mode balance-rr (0) | active-backup (1) | balance-xor (2) | " - "broadcast (3) |\n" - " 802.3ad (4) | balance-tlb (5) | balance-alb (6)]\n" - " [primary <ifname>]\n" - " [miimon <num>]\n" - " [downdelay <num>]\n" - " [updelay <num>]\n" - " [arp-interval <num>]\n" - " [arp-ip-target <num>]\n" - " [lacp-rate slow (0) | fast (1)]\n\n" - " bond-slave: master <master (ifname, or connection UUID or name)>\n" - " [queue-id <0-65535>]\n\n" - " team: [config <file>|<raw JSON data>]\n\n" - " team-slave: master <master (ifname, or connection UUID or name)>\n" - " [config <file>|<raw JSON data>]\n\n" - " bridge: [stp yes|no]\n" - " [priority <num>]\n" - " [forward-delay <2-30>]\n" - " [hello-time <1-10>]\n" - " [max-age <6-40>]\n" - " [ageing-time <0-1000000>]\n" - " [multicast-snooping yes|no]\n" - " [mac <MAC address>]\n\n" - " bridge-slave: master <master (ifname, or connection UUID or name)>\n" - " [priority <0-63>]\n" - " [path-cost <1-65535>]\n" - " [hairpin yes|no]\n\n" - " vpn: vpn-type " - "vpnc|openvpn|pptp|openconnect|openswan|libreswan|ssh|l2tp|iodine|...\n" - " [user <username>]\n\n" - " olpc-mesh: ssid <SSID>\n" - " [channel <1-13>]\n" - " [dhcp-anycast <MAC address>]\n\n" - " adsl: username <username>\n" - " protocol pppoa|pppoe|ipoatm\n" - " [password <password>]\n" - " [encapsulation vcmux|llc]\n\n" - " tun: mode tun|tap\n" - " [owner <UID>]\n" - " [group <GID>]\n" - " [pi yes|no]\n" - " [vnet-hdr yes|no]\n" - " [multi-queue yes|no]\n\n" - " ip-tunnel: mode ipip|gre|sit|isatap|vti|ip6ip6|ipip6|ip6gre|vti6\n" - " remote <remote endpoint IP>\n" - " [local <local endpoint IP>]\n" - " [dev <parent device (ifname or connection UUID)>]\n\n" - " macsec: dev <parent device (connection UUID, ifname, or MAC)>\n" - " mode <psk|eap>\n" - " [cak <key> ckn <key>]\n" - " [encrypt yes|no]\n" - " [port 1-65534]\n\n\n" - " macvlan: dev <parent device (connection UUID, ifname, or MAC)>\n" - " mode vepa|bridge|private|passthru|source\n" - " [tap yes|no]\n\n" - " vxlan: id <VXLAN ID>\n" - " [remote <IP of multicast group or remote address>]\n" - " [local <source IP>]\n" - " [dev <parent device (ifname or connection UUID)>]\n" - " [source-port-min <0-65535>]\n" - " [source-port-max <0-65535>]\n" - " [destination-port <0-65535>]\n\n" - " wpan: [short-addr <0x0000-0xffff>]\n" - " [pan-id <0x0000-0xffff>]\n" - " [page <default|0-31>]\n" - " [channel <default|0-26>]\n" - " [mac <MAC address>]\n\n" - " 6lowpan: dev <parent device (connection UUID, ifname, or MAC)>\n" - " dummy:\n\n" - " SLAVE_OPTIONS:\n" - " bridge: [priority <0-63>]\n" - " [path-cost <1-65535>]\n" - " [hairpin yes|no]\n\n" - " team: [config <file>|<raw JSON data>]\n\n" - " bond: [queue-id <0-65535>]\n\n" - " IP_OPTIONS:\n" - " [ip4 <IPv4 address>] [gw4 <IPv4 gateway>]\n" - " [ip6 <IPv6 address>] [gw6 <IPv6 gateway>]\n\n")); + nmc_printerr(_("Usage: nmcli connection add { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS SLAVE_OPTIONS IP_OPTIONS [-- " + "([+|-]<setting>.<property> <value>)+]\n\n" + " COMMON_OPTIONS:\n" + " type <type>\n" + " [ifname <interface name> | \"*\"]\n" + " [con-name <connection name>]\n" + " [autoconnect yes|no]\n" + " [save yes|no]\n" + " [master <master (ifname, or connection UUID or name)>]\n" + " [slave-type <master connection type>]\n\n" + " TYPE_SPECIFIC_OPTIONS:\n" + " ethernet: [mac <MAC address>]\n" + " [cloned-mac <cloned MAC address>]\n" + " [mtu <MTU>]\n\n" + " wifi: ssid <SSID>\n" + " [mac <MAC address>]\n" + " [cloned-mac <cloned MAC address>]\n" + " [mtu <MTU>]\n" + " [mode infrastructure|ap|adhoc]\n\n" + " wimax: [mac <MAC address>]\n" + " [nsp <NSP>]\n\n" + " pppoe: username <PPPoE username>\n" + " [password <PPPoE password>]\n" + " [service <PPPoE service name>]\n" + " [mtu <MTU>]\n" + " [mac <MAC address>]\n\n" + " gsm: apn <APN>\n" + " [user <username>]\n" + " [password <password>]\n\n" + " cdma: [user <username>]\n" + " [password <password>]\n\n" + " infiniband: [mac <MAC address>]\n" + " [mtu <MTU>]\n" + " [transport-mode datagram | connected]\n" + " [parent <ifname>]\n" + " [p-key <IPoIB P_Key>]\n\n" + " bluetooth: [addr <bluetooth address>]\n" + " [bt-type panu|nap|dun-gsm|dun-cdma]\n\n" + " vlan: dev <parent device (connection UUID, ifname, or MAC)>\n" + " id <VLAN ID>\n" + " [flags <VLAN flags>]\n" + " [ingress <ingress priority mapping>]\n" + " [egress <egress priority mapping>]\n" + " [mtu <MTU>]\n\n" + " bond: [mode balance-rr (0) | active-backup (1) | balance-xor (2) | " + "broadcast (3) |\n" + " 802.3ad (4) | balance-tlb (5) | balance-alb (6)]\n" + " [primary <ifname>]\n" + " [miimon <num>]\n" + " [downdelay <num>]\n" + " [updelay <num>]\n" + " [arp-interval <num>]\n" + " [arp-ip-target <num>]\n" + " [lacp-rate slow (0) | fast (1)]\n\n" + " bond-slave: master <master (ifname, or connection UUID or name)>\n" + " [queue-id <0-65535>]\n\n" + " team: [config <file>|<raw JSON data>]\n\n" + " team-slave: master <master (ifname, or connection UUID or name)>\n" + " [config <file>|<raw JSON data>]\n\n" + " bridge: [stp yes|no]\n" + " [priority <num>]\n" + " [forward-delay <2-30>]\n" + " [hello-time <1-10>]\n" + " [max-age <6-40>]\n" + " [ageing-time <0-1000000>]\n" + " [multicast-snooping yes|no]\n" + " [mac <MAC address>]\n\n" + " bridge-slave: master <master (ifname, or connection UUID or name)>\n" + " [priority <0-63>]\n" + " [path-cost <1-65535>]\n" + " [hairpin yes|no]\n\n" + " vpn: vpn-type " + "vpnc|openvpn|pptp|openconnect|openswan|libreswan|ssh|l2tp|iodine|...\n" + " [user <username>]\n\n" + " olpc-mesh: ssid <SSID>\n" + " [channel <1-13>]\n" + " [dhcp-anycast <MAC address>]\n\n" + " adsl: username <username>\n" + " protocol pppoa|pppoe|ipoatm\n" + " [password <password>]\n" + " [encapsulation vcmux|llc]\n\n" + " tun: mode tun|tap\n" + " [owner <UID>]\n" + " [group <GID>]\n" + " [pi yes|no]\n" + " [vnet-hdr yes|no]\n" + " [multi-queue yes|no]\n\n" + " ip-tunnel: mode ipip|gre|sit|isatap|vti|ip6ip6|ipip6|ip6gre|vti6\n" + " remote <remote endpoint IP>\n" + " [local <local endpoint IP>]\n" + " [dev <parent device (ifname or connection UUID)>]\n\n" + " macsec: dev <parent device (connection UUID, ifname, or MAC)>\n" + " mode <psk|eap>\n" + " [cak <key> ckn <key>]\n" + " [encrypt yes|no]\n" + " [port 1-65534]\n\n\n" + " macvlan: dev <parent device (connection UUID, ifname, or MAC)>\n" + " mode vepa|bridge|private|passthru|source\n" + " [tap yes|no]\n\n" + " vxlan: id <VXLAN ID>\n" + " [remote <IP of multicast group or remote address>]\n" + " [local <source IP>]\n" + " [dev <parent device (ifname or connection UUID)>]\n" + " [source-port-min <0-65535>]\n" + " [source-port-max <0-65535>]\n" + " [destination-port <0-65535>]\n\n" + " wpan: [short-addr <0x0000-0xffff>]\n" + " [pan-id <0x0000-0xffff>]\n" + " [page <default|0-31>]\n" + " [channel <default|0-26>]\n" + " [mac <MAC address>]\n\n" + " 6lowpan: dev <parent device (connection UUID, ifname, or MAC)>\n" + " dummy:\n\n" + " SLAVE_OPTIONS:\n" + " bridge: [priority <0-63>]\n" + " [path-cost <1-65535>]\n" + " [hairpin yes|no]\n\n" + " team: [config <file>|<raw JSON data>]\n\n" + " bond: [queue-id <0-65535>]\n\n" + " IP_OPTIONS:\n" + " [ip4 <IPv4 address>] [gw4 <IPv4 gateway>]\n" + " [ip6 <IPv6 address>] [gw6 <IPv6 gateway>]\n\n")); } static void usage_connection_modify(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli connection modify { ARGUMENTS | help }\n" "\n" "ARGUMENTS := [id | uuid | path] <ID> ([+|-]<setting>.<property> <value>)+\n" @@ -1325,77 +1327,78 @@ usage_connection_modify(void) static void usage_connection_clone(void) { - g_printerr(_("Usage: nmcli connection clone { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [--temporary] [id | uuid | path] <ID> <new name>\n" - "\n" - "Clone an existing connection profile. The newly created connection will be\n" - "the exact copy of the <ID>, except the uuid property (will be generated) and\n" - "id (provided as <new name> argument).\n\n")); + nmc_printerr(_("Usage: nmcli connection clone { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [--temporary] [id | uuid | path] <ID> <new name>\n" + "\n" + "Clone an existing connection profile. The newly created connection will be\n" + "the exact copy of the <ID>, except the uuid property (will be generated) and\n" + "id (provided as <new name> argument).\n\n")); } static void usage_connection_edit(void) { - g_printerr(_("Usage: nmcli connection edit { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [id | uuid | path] <ID>\n" - "\n" - "Edit an existing connection profile in an interactive editor.\n" - "The profile is identified by its name, UUID or D-Bus path\n" - "\n" - "ARGUMENTS := [type <new connection type>] [con-name <new connection name>]\n" - "\n" - "Add a new connection profile in an interactive editor.\n\n")); + nmc_printerr(_("Usage: nmcli connection edit { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [id | uuid | path] <ID>\n" + "\n" + "Edit an existing connection profile in an interactive editor.\n" + "The profile is identified by its name, UUID or D-Bus path\n" + "\n" + "ARGUMENTS := [type <new connection type>] [con-name <new connection name>]\n" + "\n" + "Add a new connection profile in an interactive editor.\n\n")); } static void usage_connection_delete(void) { - g_printerr(_("Usage: nmcli connection delete { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [id | uuid | path] <ID>, ...\n" - "\n" - "Delete connection profiles.\n" - "The profiles are identified by their name, UUID or D-Bus path.\n\n")); + nmc_printerr(_("Usage: nmcli connection delete { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [id | uuid | path] <ID>, ...\n" + "\n" + "Delete connection profiles.\n" + "The profiles are identified by their name, UUID or D-Bus path.\n\n")); } static void usage_connection_monitor(void) { - g_printerr(_("Usage: nmcli connection monitor { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [id | uuid | path] <ID> ...\n" - "\n" - "Monitor connection profile activity.\n" - "This command prints a line whenever the specified connection changes.\n" - "Monitors all connection profiles in case none is specified.\n\n")); + nmc_printerr(_("Usage: nmcli connection monitor { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [id | uuid | path] <ID> ...\n" + "\n" + "Monitor connection profile activity.\n" + "This command prints a line whenever the specified connection changes.\n" + "Monitors all connection profiles in case none is specified.\n\n")); } static void usage_connection_reload(void) { - g_printerr(_("Usage: nmcli connection reload { help }\n" - "\n" - "Reload all connection files from disk.\n\n")); + nmc_printerr(_("Usage: nmcli connection reload { help }\n" + "\n" + "Reload all connection files from disk.\n\n")); } static void usage_connection_load(void) { - g_printerr(_("Usage: nmcli connection load { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := <filename> [<filename>...]\n" - "\n" - "Load/reload one or more connection files from disk. Use this after manually\n" - "editing a connection file to ensure that NetworkManager is aware of its latest\n" - "state.\n\n")); + nmc_printerr( + _("Usage: nmcli connection load { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := <filename> [<filename>...]\n" + "\n" + "Load/reload one or more connection files from disk. Use this after manually\n" + "editing a connection file to ensure that NetworkManager is aware of its latest\n" + "state.\n\n")); } static void usage_connection_import(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli connection import { ARGUMENTS | help }\n" "\n" "ARGUMENTS := [--temporary] type <type> file <file to import>\n" @@ -1409,23 +1412,24 @@ usage_connection_import(void) static void usage_connection_export(void) { - g_printerr(_("Usage: nmcli connection export { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [id | uuid | path] <ID> [<output file>]\n" - "\n" - "Export a connection. Only VPN connections are supported at the moment.\n" - "The data are directed to standard output or to a file if a name is given.\n\n")); + nmc_printerr( + _("Usage: nmcli connection export { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [id | uuid | path] <ID> [<output file>]\n" + "\n" + "Export a connection. Only VPN connections are supported at the moment.\n" + "The data are directed to standard output or to a file if a name is given.\n\n")); } static void usage_connection_migrate(void) { - g_printerr(_("Usage: nmcli connection migrate { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [--plugin <plugin>] [id | uuid | path] <ID>, ...\n" - "\n" - "Migrate connection profiles to a different settings plugin,\n" - "such as \"keyfile\" (default) or \"ifcfg-rh\".\n\n")); + nmc_printerr(_("Usage: nmcli connection migrate { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [--plugin <plugin>] [id | uuid | path] <ID>, ...\n" + "\n" + "Migrate connection profiles to a different settings plugin,\n" + "such as \"keyfile\" (default) or \"ifcfg-rh\".\n\n")); } static char * @@ -1503,9 +1507,9 @@ got_secrets(GObject *source_object, GAsyncResult *res, gpointer user_data) gs_free_error GError *error = NULL; if (!nm_connection_update_secrets(data->local, NULL, secrets, &error) && error) { - g_printerr(_("Error updating secrets for %s: %s\n"), - data->setting_name, - error->message); + nmc_printerr(_("Error updating secrets for %s: %s\n"), + data->setting_name, + error->message); } } @@ -1613,7 +1617,7 @@ nmc_connection_profile_details(NMConnection *connection, NmCli *nmc) if (NM_IN_SET(nmc->nmc_config.print_output, NMC_PRINT_NORMAL, NMC_PRINT_PRETTY) && !nmc->nmc_config.multiline_output && was_output) - g_print("\n"); /* Empty line */ + nmc_print("\n"); /* Empty line */ was_output = FALSE; @@ -1719,7 +1723,7 @@ nmc_active_connection_details(NMActiveConnection *acon, NmCli *nmc) if (NM_IN_SET(nmc->nmc_config.print_output, NMC_PRINT_NORMAL, NMC_PRINT_PRETTY) && !nmc->nmc_config.multiline_output && was_output) - g_print("\n"); + nmc_print("\n"); was_output = FALSE; @@ -2507,7 +2511,7 @@ do_connections_show(const NMCCommand *cmd, NmCli *nmc, int argc, const char *con nm_assert(explicit_acon || con); if (new_line) - g_print("\n"); + nmc_print("\n"); new_line = TRUE; if (without_fields || profile_flds) { @@ -2532,7 +2536,7 @@ do_connections_show(const NMCCommand *cmd, NmCli *nmc, int argc, const char *con /* if there are multiple active connections, separate them with newline. * that is a bit odd, because we already separate connections with newlines, * and commonly don't separate the connection from the first active connection. */ - g_print("\n"); + nmc_print("\n"); } if (explicit_acon) @@ -2800,12 +2804,12 @@ check_activated(ActivateConnectionInfo *info) if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line(); if (reason) { - g_print(_("Connection successfully activated (%s) (D-Bus active path: %s)\n"), - reason, - nm_object_get_path(NM_OBJECT(info->active))); + nmc_print(_("Connection successfully activated (%s) (D-Bus active path: %s)\n"), + reason, + nm_object_get_path(NM_OBJECT(info->active))); } else { - g_print(_("Connection successfully activated (D-Bus active path: %s)\n"), - nm_object_get_path(NM_OBJECT(info->active))); + nmc_print(_("Connection successfully activated (D-Bus active path: %s)\n"), + nm_object_get_path(NM_OBJECT(info->active))); } activate_connection_info_finish(info); break; @@ -2955,8 +2959,8 @@ activate_connection_cb(GObject *client, GAsyncResult *result, gpointer user_data if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line(); - g_print(_("Connection successfully activated (D-Bus active path: %s)\n"), - nm_object_get_path(NM_OBJECT(active))); + nmc_print(_("Connection successfully activated (D-Bus active path: %s)\n"), + nm_object_get_path(NM_OBJECT(active))); } activate_connection_info_finish(info); } else { @@ -3325,9 +3329,9 @@ connection_removed_cb(NMClient *client, NMConnection *connection, ConnectionCbIn { if (!connection_cb_info_obj_list_has(info, connection)) return; - g_print(_("Connection '%s' (%s) successfully deleted.\n"), - nm_connection_get_id(connection), - nm_connection_get_uuid(connection)); + nmc_print(_("Connection '%s' (%s) successfully deleted.\n"), + nm_connection_get_id(connection), + nm_connection_get_uuid(connection)); connection_cb_info_finish(info, connection); } @@ -3341,9 +3345,9 @@ down_active_connection_state_cb(NMActiveConnection *active, if (info->nmc->nmc_config.print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line(); - g_print(_("Connection '%s' successfully deactivated (D-Bus active path: %s)\n"), - nm_active_connection_get_id(active), - nm_object_get_path(NM_OBJECT(active))); + nmc_print(_("Connection '%s' successfully deactivated (D-Bus active path: %s)\n"), + nm_active_connection_get_id(active), + nm_object_get_path(NM_OBJECT(active))); g_signal_handlers_disconnect_by_func(G_OBJECT(active), down_active_connection_state_cb, info); connection_cb_info_finish(info, active); @@ -3422,7 +3426,7 @@ do_connection_down(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons arg_num == 1 && nmc->complete); if (!active) { if (!nmc->complete) - g_printerr(_("Error: '%s' is not an active connection.\n"), *arg_ptr); + nmc_printerr(_("Error: '%s' is not an active connection.\n"), *arg_ptr); g_string_printf(nmc->return_text, _("Error: not all active connections found.")); nmc->return_value = NMC_RESULT_ERROR_NOT_FOUND; } @@ -3463,9 +3467,9 @@ do_connection_down(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons active = found_active_cons->pdata[i]; if (!nm_client_deactivate_connection(nmc->client, active, NULL, &error)) { - g_print(_("Connection '%s' deactivation failed: %s\n"), - nm_active_connection_get_id(active), - error->message); + nmc_print(_("Connection '%s' deactivation failed: %s\n"), + nm_active_connection_get_id(active), + error->message); g_clear_error(&error); if (info) { @@ -3944,7 +3948,7 @@ normalized_master_for_slave(const GPtrArray *connections, } if (!out_master) { - g_print(_("Warning: master='%s' doesn't refer to any existing profile.\n"), master); + nmc_print(_("Warning: master='%s' doesn't refer to any existing profile.\n"), master); out_master = master; if (out_type) *out_type = type; @@ -4985,7 +4989,7 @@ complete_property_name(NmCli *nmc, prefix, postfix); if (word_list) - g_print("%s", word_list); + nmc_print("%s", word_list); if (modifier != NM_META_ACCESSOR_MODIFIER_SET) return; @@ -5014,7 +5018,7 @@ complete_property_name(NmCli *nmc, if (!bi->base.property_alias || !g_str_has_prefix(bi->base.property_alias, prefix)) continue; - g_print("%s\n", bi->base.property_alias); + nmc_print("%s\n", bi->base.property_alias); } } else { if (!property_info->is_cli_option) @@ -5022,7 +5026,7 @@ complete_property_name(NmCli *nmc, if (!property_info->property_alias || !g_str_has_prefix(property_info->property_alias, prefix)) continue; - g_print("%s\n", property_info->property_alias); + nmc_print("%s\n", property_info->property_alias); } } } @@ -5035,7 +5039,7 @@ run_rl_generator(rl_compentry_func_t *generator_func, const char *prefix) char *str; while ((str = generator_func(prefix, state))) { - g_print("%s\n", str); + nmc_print("%s\n", str); g_free(str); if (state == 0) state = 1; @@ -5069,7 +5073,7 @@ complete_option(NmCli *nmc, } if (values) { for (; values[0]; values++) - g_print("%s\n", values[0]); + nmc_print("%s\n", values[0]); return TRUE; } @@ -5094,11 +5098,11 @@ complete_existing_setting(NmCli *nmc, NMConnection *connection, const char *pref editor = nm_meta_setting_info_editor_find_by_setting(settings[i]); if (!prefix || g_str_has_prefix(editor->general->setting_name, prefix)) - g_print("%s\n", editor->general->setting_name); + nmc_print("%s\n", editor->general->setting_name); if (editor->alias) { if (!prefix || g_str_has_prefix(editor->alias, prefix)) - g_print("%s\n", editor->alias); + nmc_print("%s\n", editor->alias); } } } @@ -5386,7 +5390,7 @@ nmc_process_connection_properties(NmCli *nmc, if (!chosen) { if (*argc == 1 && nmc->complete) { if (allow_setting_removal && g_str_has_prefix("remove", option)) - g_print("remove\n"); + nmc_print("remove\n"); complete_property_name(nmc, connection, modifier, option, NULL); } g_set_error(error, @@ -5426,7 +5430,7 @@ connection_warnings(NmCli *nmc, NMConnection *connection) deprecated = nmc_connection_check_deprecated(NM_CONNECTION(connection)); if (deprecated) - g_printerr(_("Warning: %s.\n"), deprecated); + nmc_printerr(_("Warning: %s.\n"), deprecated); connections = nmc_get_connections(nmc); id = nm_connection_get_id(connection); @@ -5441,15 +5445,15 @@ connection_warnings(NmCli *nmc, NMConnection *connection) } if (found > 0) { - g_printerr(g_dngettext(GETTEXT_PACKAGE, - "Warning: There is another connection with the name '%1$s'. " - "Reference the connection by its uuid '%2$s'\n", - "Warning: There are %3$u other connections with the name " - "'%1$s'. Reference the connection by its uuid '%2$s'\n", - found), - id, - nm_connection_get_uuid(NM_CONNECTION(connection)), - found); + nmc_printerr(g_dngettext(GETTEXT_PACKAGE, + "Warning: There is another connection with the name '%1$s'. " + "Reference the connection by its uuid '%2$s'\n", + "Warning: There are %3$u other connections with the name " + "'%1$s'. Reference the connection by its uuid '%2$s'\n", + found), + id, + nm_connection_get_uuid(NM_CONNECTION(connection)), + found); } } @@ -5481,9 +5485,9 @@ add_connection_cb(GObject *client, GAsyncResult *result, gpointer user_data) * * This is true for many messages that the user might parse. But this one * seems in particular interesting for a user to parse. */ - g_print(_("Connection '%s' (%s) successfully added.\n"), - nm_connection_get_id(NM_CONNECTION(connection)), - nm_connection_get_uuid(NM_CONNECTION(connection))); + nmc_print(_("Connection '%s' (%s) successfully added.\n"), + nm_connection_get_id(NM_CONNECTION(connection)), + nm_connection_get_uuid(NM_CONNECTION(connection))); g_object_unref(connection); } @@ -5629,7 +5633,8 @@ ask_option(NmCli *nmc, NMConnection *connection, const NMMetaAbstractInfo *abstr multi = NM_FLAGS_HAS(inf_flags, NM_META_PROPERTY_INF_FLAG_MULTI); if (multi) - g_print(_("You can specify this option more than once. Press <Enter> when you're done.\n")); + nmc_print( + _("You can specify this option more than once. Press <Enter> when you're done.\n")); again: nm_clear_g_free(&value); @@ -5638,7 +5643,7 @@ again: value = nmc_readline(&nmc->nmc_config, "%s", prompt); if (!set_option(nmc, connection, abstract_info, value, FALSE, &error)) { - g_printerr("%s\n", error->message); + nmc_printerr("%s\n", error->message); goto again; } @@ -5740,7 +5745,7 @@ want_provide_opt_args(const NmcConfig *nmc_config, const char *type, guint num) return TRUE; /* Ask for optional arguments. */ - g_print(_("There are %d optional settings for %s.\n"), (int) num, type); + nmc_print(_("There are %d optional settings for %s.\n"), (int) num, type); answer = nmc_readline(nmc_config, _("Do you want to provide them? %s"), prompt_yes_no(TRUE, NULL)); nm_strstrip(answer); @@ -6872,7 +6877,7 @@ load_history_cmds(const char *uuid) kf = g_key_file_new(); if (!g_key_file_load_from_file(kf, filename, G_KEY_FILE_KEEP_COMMENTS, &err)) { if (g_error_matches(err, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE)) - g_print("Warning: %s parse error: %s\n", filename, err->message); + nmc_print("Warning: %s parse error: %s\n", filename, err->message); g_key_file_free(kf); g_free(filename); return; @@ -6911,7 +6916,7 @@ save_history_cmds(const char *uuid) if (!g_key_file_load_from_file(kf, filename, G_KEY_FILE_KEEP_COMMENTS, &error)) { if (!g_error_matches(error, G_FILE_ERROR, G_FILE_ERROR_NOENT) && !g_error_matches(error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) { - g_print("Warning: %s parse error: %s\n", filename, error->message); + nmc_print("Warning: %s parse error: %s\n", filename, error->message); return; } g_clear_error(&error); @@ -6947,7 +6952,7 @@ editor_show_connection(NMConnection *connection, NmCli *nmc) static void editor_show_setting(NMSetting *setting, NmCli *nmc) { - g_print(_("['%s' setting values]\n"), nm_setting_get_name(setting)); + nmc_print(_("['%s' setting values]\n"), nm_setting_get_name(setting)); nmc->nmc_config_mutable.print_output = NMC_PRINT_NORMAL; nmc->nmc_config_mutable.multiline_output = TRUE; @@ -7054,24 +7059,24 @@ fail: static void editor_main_usage(void) { - g_print("------------------------------------------------------------------------------\n"); + nmc_print("------------------------------------------------------------------------------\n"); /* TRANSLATORS: do not translate command names and keywords before :: * However, you should translate terms enclosed in <>. */ - g_print(_("---[ Main menu ]---\n" - "goto [<setting> | <prop>] :: go to a setting or property\n" - "remove <setting>[.<prop>] | <prop> :: remove setting or reset property value\n" - "set [<setting>.<prop> <value>] :: set property value\n" - "describe [<setting>.<prop>] :: describe property\n" - "print [all | <setting>[.<prop>]] :: print the connection\n" - "verify [all | fix] :: verify the connection\n" - "save [persistent|temporary] :: save the connection\n" - "activate [<ifname>] [/<ap>|<nsp>] :: activate the connection\n" - "back :: go one level up (back)\n" - "help/? [<command>] :: print this help\n" - "nmcli <conf-option> <value> :: nmcli configuration\n" - "quit :: exit nmcli\n")); - g_print("------------------------------------------------------------------------------\n"); + nmc_print(_("---[ Main menu ]---\n" + "goto [<setting> | <prop>] :: go to a setting or property\n" + "remove <setting>[.<prop>] | <prop> :: remove setting or reset property value\n" + "set [<setting>.<prop> <value>] :: set property value\n" + "describe [<setting>.<prop>] :: describe property\n" + "print [all | <setting>[.<prop>]] :: print the connection\n" + "verify [all | fix] :: verify the connection\n" + "save [persistent|temporary] :: save the connection\n" + "activate [<ifname>] [/<ap>|<nsp>] :: activate the connection\n" + "back :: go one level up (back)\n" + "help/? [<command>] :: print this help\n" + "nmcli <conf-option> <value> :: nmcli configuration\n" + "quit :: exit nmcli\n")); + nmc_print("------------------------------------------------------------------------------\n"); } static void @@ -7085,14 +7090,15 @@ editor_main_help(const char *command) switch (cmd) { case NMC_EDITOR_MAIN_CMD_GOTO: - g_print(_("goto <setting>[.<prop>] | <prop> :: enter setting/property for editing\n\n" - "This command enters into a setting or property for editing it.\n\n" - "Examples: nmcli> goto connection\n" - " nmcli connection> goto secondaries\n" - " nmcli> goto ipv4.addresses\n")); + nmc_print( + _("goto <setting>[.<prop>] | <prop> :: enter setting/property for editing\n\n" + "This command enters into a setting or property for editing it.\n\n" + "Examples: nmcli> goto connection\n" + " nmcli connection> goto secondaries\n" + " nmcli> goto ipv4.addresses\n")); break; case NMC_EDITOR_MAIN_CMD_REMOVE: - g_print( + nmc_print( _("remove <setting>[.<prop>] :: remove setting or reset property value\n\n" "This command removes an entire setting from the connection, or if a property\n" "is given, resets that property to the default value.\n\n" @@ -7100,27 +7106,27 @@ editor_main_help(const char *command) " nmcli> remove eth.mtu\n")); break; case NMC_EDITOR_MAIN_CMD_SET: - g_print(_("set [<setting>.<prop> <value>] :: set property value\n\n" - "This command sets property value.\n\n" - "Example: nmcli> set con.id My connection\n")); + nmc_print(_("set [<setting>.<prop> <value>] :: set property value\n\n" + "This command sets property value.\n\n" + "Example: nmcli> set con.id My connection\n")); break; case NMC_EDITOR_MAIN_CMD_ADD: - g_print(_("add [<setting>.<prop> <value>] :: add property value\n\n" - "This command appends property value.\n\n" - "Example: nmcli> add ipv4.addresses 192.168.1.1/24\n")); + nmc_print(_("add [<setting>.<prop> <value>] :: add property value\n\n" + "This command appends property value.\n\n" + "Example: nmcli> add ipv4.addresses 192.168.1.1/24\n")); break; case NMC_EDITOR_MAIN_CMD_DESCRIBE: - g_print(_("describe [<setting>.<prop>] :: describe property\n\n" - "Shows property description. You can consult nm-settings(5) " - "manual page to see all NM settings and properties.\n")); + nmc_print(_("describe [<setting>.<prop>] :: describe property\n\n" + "Shows property description. You can consult nm-settings(5) " + "manual page to see all NM settings and properties.\n")); break; case NMC_EDITOR_MAIN_CMD_PRINT: - g_print(_("print [all] :: print setting or connection values\n\n" - "Shows current property or the whole connection.\n\n" - "Example: nmcli ipv4> print all\n")); + nmc_print(_("print [all] :: print setting or connection values\n\n" + "Shows current property or the whole connection.\n\n" + "Example: nmcli ipv4> print all\n")); break; case NMC_EDITOR_MAIN_CMD_VERIFY: - g_print( + nmc_print( _("verify [all | fix] :: verify setting or connection validity\n\n" "Verifies whether the setting or connection is valid and can be saved later.\n" "It indicates invalid values on error. Some errors may be fixed automatically\n" @@ -7130,7 +7136,7 @@ editor_main_help(const char *command) " nmcli bond> verify\n")); break; case NMC_EDITOR_MAIN_CMD_SAVE: - g_print( + nmc_print( _("save [persistent|temporary] :: save the connection\n\n" "Sends the connection profile to NetworkManager that either will save it\n" "persistently, or will only keep it in memory. 'save' without an argument\n" @@ -7142,48 +7148,48 @@ editor_main_help(const char *command) "profile must be deleted.\n")); break; case NMC_EDITOR_MAIN_CMD_ACTIVATE: - g_print(_("activate [<ifname>] [/<ap>|<nsp>] :: activate the connection\n\n" - "Activates the connection.\n\n" - "Available options:\n" - "<ifname> - device the connection will be activated on\n" - "/<ap>|<nsp> - AP (Wi-Fi) or NSP (WiMAX) (prepend with / when <ifname> is " - "not specified)\n")); + nmc_print(_("activate [<ifname>] [/<ap>|<nsp>] :: activate the connection\n\n" + "Activates the connection.\n\n" + "Available options:\n" + "<ifname> - device the connection will be activated on\n" + "/<ap>|<nsp> - AP (Wi-Fi) or NSP (WiMAX) (prepend with / when <ifname> is " + "not specified)\n")); break; case NMC_EDITOR_MAIN_CMD_BACK: - g_print(_("back :: go to upper menu level\n\n")); + nmc_print(_("back :: go to upper menu level\n\n")); break; case NMC_EDITOR_MAIN_CMD_HELP: - g_print(_("help/? [<command>] :: help for the nmcli commands\n\n")); + nmc_print(_("help/? [<command>] :: help for the nmcli commands\n\n")); break; case NMC_EDITOR_MAIN_CMD_NMCLI: - g_print(_("nmcli [<conf-option> <value>] :: nmcli configuration\n\n" - "Configures nmcli. The following options are available:\n" - "status-line yes | no [default: no]\n" - "save-confirmation yes | no [default: yes]\n" - "show-secrets yes | no [default: no]\n" - "prompt-color <color> | <0-8> [default: 0]\n" - "%s" /* color table description */ - "\n" - "Examples: nmcli> nmcli status-line yes\n" - " nmcli> nmcli save-confirmation no\n" - " nmcli> nmcli prompt-color 3\n"), - " 0 = normal\n" - " 1 = \33[30mblack\33[0m\n" - " 2 = \33[31mred\33[0m\n" - " 3 = \33[32mgreen\33[0m\n" - " 4 = \33[33myellow\33[0m\n" - " 5 = \33[34mblue\33[0m\n" - " 6 = \33[35mmagenta\33[0m\n" - " 7 = \33[36mcyan\33[0m\n" - " 8 = \33[37mwhite\33[0m\n"); + nmc_print(_("nmcli [<conf-option> <value>] :: nmcli configuration\n\n" + "Configures nmcli. The following options are available:\n" + "status-line yes | no [default: no]\n" + "save-confirmation yes | no [default: yes]\n" + "show-secrets yes | no [default: no]\n" + "prompt-color <color> | <0-8> [default: 0]\n" + "%s" /* color table description */ + "\n" + "Examples: nmcli> nmcli status-line yes\n" + " nmcli> nmcli save-confirmation no\n" + " nmcli> nmcli prompt-color 3\n"), + " 0 = normal\n" + " 1 = \33[30mblack\33[0m\n" + " 2 = \33[31mred\33[0m\n" + " 3 = \33[32mgreen\33[0m\n" + " 4 = \33[33myellow\33[0m\n" + " 5 = \33[34mblue\33[0m\n" + " 6 = \33[35mmagenta\33[0m\n" + " 7 = \33[36mcyan\33[0m\n" + " 8 = \33[37mwhite\33[0m\n"); break; case NMC_EDITOR_MAIN_CMD_QUIT: - g_print(_("quit :: exit nmcli\n\n" - "This command exits nmcli. When the connection being edited " - "is not saved, the user is asked to confirm the action.\n")); + nmc_print(_("quit :: exit nmcli\n\n" + "This command exits nmcli. When the connection being edited " + "is not saved, the user is asked to confirm the action.\n")); break; default: - g_print(_("Unknown command: '%s'\n"), command); + nmc_print(_("Unknown command: '%s'\n"), command); break; } } @@ -7244,21 +7250,21 @@ fail: static void editor_sub_help(void) { - g_print("------------------------------------------------------------------------------\n"); + nmc_print("------------------------------------------------------------------------------\n"); /* TRANSLATORS: do not translate command names and keywords before :: * However, you should translate terms enclosed in <>. */ - g_print(_("---[ Property menu ]---\n" - "set [<value>] :: set new value\n" - "add [<value>] :: add new option to the property\n" - "change :: change current value\n" - "remove [<index> | <option>] :: delete the value\n" - "describe :: describe property\n" - "print [setting | connection] :: print property (setting/connection) value(s)\n" - "back :: go to upper level\n" - "help/? [<command>] :: print this help or command description\n" - "quit :: exit nmcli\n")); - g_print("------------------------------------------------------------------------------\n"); + nmc_print(_("---[ Property menu ]---\n" + "set [<value>] :: set new value\n" + "add [<value>] :: add new option to the property\n" + "change :: change current value\n" + "remove [<index> | <option>] :: delete the value\n" + "describe :: describe property\n" + "print [setting | connection] :: print property (setting/connection) value(s)\n" + "back :: go to upper level\n" + "help/? [<command>] :: print this help or command description\n" + "quit :: exit nmcli\n")); + nmc_print("------------------------------------------------------------------------------\n"); } static void @@ -7272,21 +7278,21 @@ editor_sub_usage(const char *command) switch (cmdsub) { case NMC_EDITOR_SUB_CMD_SET: - g_print(_("set [<value>] :: set new value\n\n" - "This command sets provided <value> to this property\n")); + nmc_print(_("set [<value>] :: set new value\n\n" + "This command sets provided <value> to this property\n")); break; case NMC_EDITOR_SUB_CMD_ADD: - g_print(_("add [<value>] :: append new value to the property\n\n" - "This command adds provided <value> to this property, if " - "the property is of a container type. For single-valued " - "properties the property value is replaced (same as 'set').\n")); + nmc_print(_("add [<value>] :: append new value to the property\n\n" + "This command adds provided <value> to this property, if " + "the property is of a container type. For single-valued " + "properties the property value is replaced (same as 'set').\n")); break; case NMC_EDITOR_SUB_CMD_CHANGE: - g_print(_("change :: change current value\n\n" - "Displays current value and allows editing it.\n")); + nmc_print(_("change :: change current value\n\n" + "Displays current value and allows editing it.\n")); break; case NMC_EDITOR_SUB_CMD_REMOVE: - g_print(_( + nmc_print(_( "remove [<value>|<index>|<option name>] :: delete the value\n\n" "Removes the property value. For single-valued properties, this sets the\n" "property back to its default value. For container-type properties, this removes\n" @@ -7298,29 +7304,29 @@ editor_sub_usage(const char *command) " nmcli bond.options> remove downdelay\n\n")); break; case NMC_EDITOR_SUB_CMD_DESCRIBE: - g_print(_("describe :: describe property\n\n" - "Shows property description. You can consult nm-settings(5) " - "manual page to see all NM settings and properties.\n")); + nmc_print(_("describe :: describe property\n\n" + "Shows property description. You can consult nm-settings(5) " + "manual page to see all NM settings and properties.\n")); break; case NMC_EDITOR_SUB_CMD_PRINT: - g_print(_("print [property|setting|connection] :: print property (setting, " - "connection) value(s)\n\n" - "Shows property value. Providing an argument you can also display " - "values for the whole setting or connection.\n")); + nmc_print(_("print [property|setting|connection] :: print property (setting, " + "connection) value(s)\n\n" + "Shows property value. Providing an argument you can also display " + "values for the whole setting or connection.\n")); break; case NMC_EDITOR_SUB_CMD_BACK: - g_print(_("back :: go to upper menu level\n\n")); + nmc_print(_("back :: go to upper menu level\n\n")); break; case NMC_EDITOR_SUB_CMD_HELP: - g_print(_("help/? [<command>] :: help for nmcli commands\n\n")); + nmc_print(_("help/? [<command>] :: help for nmcli commands\n\n")); break; case NMC_EDITOR_SUB_CMD_QUIT: - g_print(_("quit :: exit nmcli\n\n" - "This command exits nmcli. When the connection being edited " - "is not saved, the user is asked to confirm the action.\n")); + nmc_print(_("quit :: exit nmcli\n\n" + "This command exits nmcli. When the connection being edited " + "is not saved, the user is asked to confirm the action.\n")); break; default: - g_print(_("Unknown command: '%s'\n"), command); + nmc_print(_("Unknown command: '%s'\n"), command); break; } } @@ -7398,13 +7404,13 @@ progress_activation_editor_cb(gpointer user_data) if (ac_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED || dev_state == NM_DEVICE_STATE_ACTIVATED) { nmc_terminal_erase_line(); - g_print(_("Connection successfully activated (D-Bus active path: %s)\n"), - nm_object_get_path(NM_OBJECT(ac))); + nmc_print(_("Connection successfully activated (D-Bus active path: %s)\n"), + nm_object_get_path(NM_OBJECT(ac))); goto finish; } else if (ac_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED || dev_state == NM_DEVICE_STATE_FAILED) { nmc_terminal_erase_line(); - g_print(_("Error: Connection activation failed.\n")); + nmc_print(_("Error: Connection activation failed.\n")); goto finish; } @@ -7469,7 +7475,7 @@ print_property_description(NMSetting *setting, const char *prop_name) desc = nmc_setting_get_property_desc(setting, prop_name); if (desc) { - g_print("\n=== [%s] ===\n%s\n", prop_name, desc); + nmc_print("\n=== [%s] ===\n%s\n", prop_name, desc); g_free(desc); } } @@ -7482,7 +7488,7 @@ print_setting_description(NMSetting *setting) int i; all_props = nmc_setting_get_valid_properties(setting); - g_print(("<<< %s >>>\n"), nm_setting_get_name(setting)); + nmc_print(("<<< %s >>>\n"), nm_setting_get_name(setting)); for (i = 0; all_props && all_props[i]; i++) print_property_description(setting, all_props[i]); g_strfreev(all_props); @@ -7502,12 +7508,12 @@ editor_show_status_line(NMConnection *connection, gboolean dirty, gboolean temp) con_uuid = nm_connection_get_uuid(connection); /* TRANSLATORS: status line in nmcli connection editor */ - g_print(_("[ Type: %s | Name: %s | UUID: %s | Dirty: %s | Temp: %s ]\n"), - con_type, - con_id, - con_uuid, - dirty ? _("yes") : _("no"), - temp ? _("yes") : _("no")); + nmc_print(_("[ Type: %s | Name: %s | UUID: %s | Dirty: %s | Temp: %s ]\n"), + con_type, + con_id, + con_uuid, + dirty ? _("yes") : _("no"), + temp ? _("yes") : _("no")); } static gboolean @@ -7584,8 +7590,8 @@ property_edit_submenu(NmCli *nmc, /* Get the remote connection again, it may have disappeared */ removed = refresh_remote_connection(rem_con_weak, rem_con); if (removed) { - g_print(_("The connection profile has been removed from another client. " - "You may type 'save' in the main menu to restore it.\n")); + nmc_print(_("The connection profile has been removed from another client. " + "You may type 'save' in the main menu to restore it.\n")); } /* Connection is dirty? (not saved or differs from the saved) */ @@ -7616,7 +7622,7 @@ property_edit_submenu(NmCli *nmc, gs_free char *avals_str = NULL; avals_str = nmc_util_strv_for_display(avals, FALSE); - g_print(_("Allowed values for '%s' property: %s\n"), prop_name, avals_str); + nmc_print(_("Allowed values for '%s' property: %s\n"), prop_name, avals_str); } prop_val_user = nmc_readline(&nmc->nmc_config, _("Enter '%s' value: "), prop_name); } else @@ -7631,7 +7637,9 @@ property_edit_submenu(NmCli *nmc, prop_val_user, &tmp_err); if (!set_result) { - g_print(_("Error: failed to set '%s' property: %s\n"), prop_name, tmp_err->message); + nmc_print(_("Error: failed to set '%s' property: %s\n"), + prop_name, + tmp_err->message); g_clear_error(&tmp_err); } break; @@ -7648,7 +7656,9 @@ property_edit_submenu(NmCli *nmc, NM_META_ACCESSOR_MODIFIER_SET, prop_val_user, &tmp_err)) { - g_print(_("Error: failed to set '%s' property: %s\n"), prop_name, tmp_err->message); + nmc_print(_("Error: failed to set '%s' property: %s\n"), + prop_name, + tmp_err->message); g_clear_error(&tmp_err); } break; @@ -7661,7 +7671,7 @@ property_edit_submenu(NmCli *nmc, : NM_META_ACCESSOR_MODIFIER_SET), cmd_property_arg, &tmp_err)) { - g_print(_("Error: %s\n"), tmp_err->message); + nmc_print(_("Error: %s\n"), tmp_err->message); g_clear_error(&tmp_err); } break; @@ -7680,12 +7690,12 @@ property_edit_submenu(NmCli *nmc, || matches(cmd_property_arg, "all")) editor_show_connection(connection, nmc); else - g_print(_("Unknown command argument: '%s'\n"), cmd_property_arg); + nmc_print(_("Unknown command argument: '%s'\n"), cmd_property_arg); } else { gs_free char *prop_val = NULL; prop_val = nmc_setting_get_property(curr_setting, prop_name, NULL); - g_print("%s: %s\n", prop_name, prop_val); + nmc_print("%s: %s\n", prop_name, prop_val); } break; @@ -7708,7 +7718,7 @@ property_edit_submenu(NmCli *nmc, case NMC_EDITOR_SUB_CMD_UNKNOWN: default: - g_print(_("Unknown command: '%s'\n"), cmd_property_user); + nmc_print(_("Unknown command: '%s'\n"), cmd_property_user); break; } } @@ -7775,7 +7785,7 @@ ask_check_setting(const NmcConfig *nmc_config, GError *err = NULL; if (!arg) { - g_print(_("Available settings: %s\n"), valid_settings_str); + nmc_print(_("Available settings: %s\n"), valid_settings_str); setting_name_user = nmc_readline(nmc_config, EDITOR_PROMPT_SETTING); } else setting_name_user = g_strdup(arg); @@ -7786,7 +7796,7 @@ ask_check_setting(const NmcConfig *nmc_config, valid_settings_main, valid_settings_slave, &err))) { - g_print(_("Error: invalid setting name; %s\n"), err->message); + nmc_print(_("Error: invalid setting name; %s\n"), err->message); g_clear_error(&err); } return setting_name; @@ -7803,7 +7813,7 @@ ask_check_property(const NmcConfig *nmc_config, const char *prop_name; if (!arg) { - g_print(_("Available properties: %s\n"), valid_props_str); + nmc_print(_("Available properties: %s\n"), valid_props_str); prop_name_user = nmc_readline(nmc_config, EDITOR_PROMPT_PROPERTY); nm_strstrip(prop_name_user); } else @@ -7811,7 +7821,7 @@ ask_check_property(const NmcConfig *nmc_config, prop_name = nmc_string_is_valid(prop_name_user, valid_props, &tmp_err); if (!prop_name) - g_print(_("Error: property %s\n"), tmp_err->message); + nmc_print(_("Error: property %s\n"), tmp_err->message); return prop_name; } @@ -7942,7 +7952,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty valid_settings_slave = nm_meta_setting_info_valid_parts_for_slave_type(s_type, NULL); valid_settings_str = get_valid_options_string(valid_settings_main, valid_settings_slave); - g_print(_("You may edit the following settings: %s\n"), valid_settings_str); + nmc_print(_("You may edit the following settings: %s\n"), valid_settings_str); menu_ctx.main_prompt = nmc_colorize(&nmc->nmc_config, NM_META_COLOR_PROMPT, BASE_PROMPT); @@ -7970,8 +7980,8 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty /* Get the remote connection again, it may have disappeared */ removed = refresh_remote_connection(&weak, &rem_con); if (removed) { - g_print(_("The connection profile has been removed from another client. " - "You may type 'save' to restore it.\n")); + nmc_print(_("The connection profile has been removed from another client. " + "You may type 'save' to restore it.\n")); } if (!cmd_user || !*cmd_user) @@ -8008,7 +8018,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty gs_free char *avals_str = NULL; avals_str = nmc_util_strv_for_display(avals, FALSE); - g_print(_("Allowed values for '%s' property: %s\n"), prop_name, avals_str); + nmc_print(_("Allowed values for '%s' property: %s\n"), + prop_name, + avals_str); } prop_val_user = nmc_readline(&nmc->nmc_config, _("Enter '%s' value: "), prop_name); @@ -8019,14 +8031,15 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty NM_META_ACCESSOR_MODIFIER_ADD, prop_val_user, &tmp_err)) { - g_print(_("Error: failed to set '%s' property: %s\n"), - prop_name, - tmp_err->message); + nmc_print(_("Error: failed to set '%s' property: %s\n"), + prop_name, + tmp_err->message); g_clear_error(&tmp_err); } } else { - g_print(_("Error: no setting selected; valid are [%s]\n"), valid_settings_str); - g_print(_("use 'goto <setting>' first, or 'set <setting>.<property>'\n")); + nmc_print(_("Error: no setting selected; valid are [%s]\n"), + valid_settings_str); + nmc_print(_("use 'goto <setting>' first, or 'set <setting>.<property>'\n")); } } else { gs_free char *prop_name = NULL; @@ -8046,9 +8059,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty valid_settings_slave); ss = ss_created; if (!ss) { - g_print(_("Error: invalid setting argument '%s'; valid are [%s]\n"), - cmd_arg_s, - valid_settings_str); + nmc_print(_("Error: invalid setting argument '%s'; valid are [%s]\n"), + cmd_arg_s, + valid_settings_str); break; } } @@ -8056,14 +8069,14 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty if (menu_ctx.curr_setting) ss = menu_ctx.curr_setting; else { - g_print(_("Error: missing setting for '%s' property\n"), cmd_arg_p); + nmc_print(_("Error: missing setting for '%s' property\n"), cmd_arg_p); break; } } prop_name = is_property_valid(ss, cmd_arg_p, &tmp_err); if (!prop_name) { - g_print(_("Error: invalid property: %s\n"), tmp_err->message); + nmc_print(_("Error: invalid property: %s\n"), tmp_err->message); g_clear_error(&tmp_err); break; } @@ -8078,7 +8091,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty gs_free char *avals_str = NULL; avals_str = nmc_util_strv_for_display(avals, FALSE); - g_print(_("Allowed values for '%s' property: %s\n"), prop_name, avals_str); + nmc_print(_("Allowed values for '%s' property: %s\n"), + prop_name, + avals_str); } cmd_arg_v = nmc_readline(&nmc->nmc_config, _("Enter '%s' value: "), prop_name); } @@ -8091,9 +8106,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty : NM_META_ACCESSOR_MODIFIER_SET, cmd_arg_v, &tmp_err)) { - g_print(_("Error: failed to set '%s' property: %s\n"), - prop_name, - tmp_err->message); + nmc_print(_("Error: failed to set '%s' property: %s\n"), + prop_name, + tmp_err->message); g_clear_error(&tmp_err); } @@ -8124,7 +8139,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty setting_info = nm_meta_setting_info_editor_find_by_name(setting_name, FALSE); if (!setting_info) { - g_print(_("Error: unknown setting '%s'\n"), setting_name); + nmc_print(_("Error: unknown setting '%s'\n"), setting_name); break; } @@ -8150,8 +8165,8 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty menu_switch_to_level1(&nmc->nmc_config, &menu_ctx, setting, setting_name); if (!cmd_arg_s) { - g_print(_("You may edit the following properties: %s\n"), - menu_ctx.valid_props_str); + nmc_print(_("You may edit the following properties: %s\n"), + menu_ctx.valid_props_str); break; } } @@ -8196,13 +8211,13 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty NM_META_ACCESSOR_MODIFIER_SET, NULL, &tmp_err)) { - g_print(_("Error: failed to remove value of '%s': %s\n"), - prop_name, - tmp_err->message); + nmc_print(_("Error: failed to remove value of '%s': %s\n"), + prop_name, + tmp_err->message); g_clear_error(&tmp_err); } } else - g_print(_("Error: no argument given; valid are [%s]\n"), valid_settings_str); + nmc_print(_("Error: no argument given; valid are [%s]\n"), valid_settings_str); } else { NMSetting *ss = NULL; gboolean descr_all; @@ -8221,11 +8236,12 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty valid_settings_main, valid_settings_slave, NULL)) { - g_print(_("Setting '%s' is not present in the connection.\n"), user_s); + nmc_print(_("Setting '%s' is not present in the connection.\n"), + user_s); } else { - g_print(_("Error: invalid setting argument '%s'; valid are [%s]\n"), - user_s, - valid_settings_str); + nmc_print(_("Error: invalid setting argument '%s'; valid are [%s]\n"), + user_s, + valid_settings_str); } break; } @@ -8237,7 +8253,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty /* Remove setting from the connection */ if (!connection_remove_setting(connection, ss, &local)) - g_print("%s\n", local->message); + nmc_print("%s\n", local->message); if (ss == menu_ctx.curr_setting) { /* If we removed the setting we are in, go up */ @@ -8257,9 +8273,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty : NM_META_ACCESSOR_MODIFIER_SET, cmd_arg_v ? cmd_arg_v : NULL, &tmp_err)) { - g_print(_("Error: failed to remove value of '%s': %s\n"), - prop_name, - tmp_err->message); + nmc_print(_("Error: failed to remove value of '%s': %s\n"), + prop_name, + tmp_err->message); } } else { NMSetting *s_tmp; @@ -8274,7 +8290,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty /* Remove setting from the connection */ if (!connection_remove_setting(connection, s_tmp, &local)) - g_print("%s\n", local->message); + nmc_print("%s\n", local->message); /* coverity[copy_paste_error] - suppress Coverity COPY_PASTE_ERROR defect */ if (ss == menu_ctx.curr_setting) { @@ -8283,8 +8299,8 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty nmc_tab_completion.setting = NULL; /* for TAB completion */ } } else { - g_print(_("Error: %s properties, nor it is a setting name.\n"), - tmp_err->message); + nmc_print(_("Error: %s properties, nor it is a setting name.\n"), + tmp_err->message); } } } @@ -8307,8 +8323,10 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty /* Show property description */ print_property_description(menu_ctx.curr_setting, prop_name); } else { - g_print(_("Error: no setting selected; valid are [%s]\n"), valid_settings_str); - g_print(_("use 'goto <setting>' first, or 'describe <setting>.<property>'\n")); + nmc_print(_("Error: no setting selected; valid are [%s]\n"), + valid_settings_str); + nmc_print( + _("use 'goto <setting>' first, or 'describe <setting>.<property>'\n")); } } else { gs_unref_object NMSetting *ss_free = NULL; @@ -8329,9 +8347,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty valid_settings_main, valid_settings_slave); if (!ss) { - g_print(_("Error: invalid setting argument '%s'; valid are [%s]\n"), - user_s, - valid_settings_str); + nmc_print(_("Error: invalid setting argument '%s'; valid are [%s]\n"), + user_s, + valid_settings_str); break; } ss_free = ss; @@ -8340,8 +8358,10 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty ss = menu_ctx.curr_setting; if (!ss) { - g_print(_("Error: no setting selected; valid are [%s]\n"), valid_settings_str); - g_print(_("use 'goto <setting>' first, or 'describe <setting>.<property>'\n")); + nmc_print(_("Error: no setting selected; valid are [%s]\n"), + valid_settings_str); + nmc_print( + _("use 'goto <setting>' first, or 'describe <setting>.<property>'\n")); } else if (descr_all) { /* Show description for all properties */ print_setting_description(ss); @@ -8364,9 +8384,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty if (s_tmp) print_setting_description(s_tmp); else { - g_print(_("Error: invalid property: %s, " - "neither a valid setting name.\n"), - tmp_err->message); + nmc_print(_("Error: invalid property: %s, " + "neither a valid setting name.\n"), + tmp_err->message); } } } @@ -8394,13 +8414,13 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty valid_settings_slave, NULL); if (!s_name) { - g_print(_("Error: unknown setting: '%s'\n"), user_s); + nmc_print(_("Error: unknown setting: '%s'\n"), user_s); break; } ss = nm_connection_get_setting_by_name(connection, s_name); if (!ss) { - g_print(_("Error: '%s' setting not present in the connection\n"), - s_name); + nmc_print(_("Error: '%s' setting not present in the connection\n"), + s_name); break; } } else @@ -8419,7 +8439,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty gs_free char *prop_val = NULL; prop_val = nmc_setting_get_property(ss, prop_name, NULL); - g_print("%s.%s: %s\n", nm_setting_get_name(ss), prop_name, prop_val); + nmc_print("%s.%s: %s\n", nm_setting_get_name(ss), prop_name, prop_val); } else { /* If the string is not a property, try it as a setting */ NMSetting *s_tmp; @@ -8431,9 +8451,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty /* Print the whole setting */ editor_show_setting(s_tmp, nmc); } else - g_print(_("Error: invalid property: %s%s\n"), - err->message, - cmd_arg_s ? "" : _(", neither a valid setting name")); + nmc_print(_("Error: invalid property: %s%s\n"), + err->message, + cmd_arg_s ? "" : _(", neither a valid setting name")); g_clear_error(&err); } } @@ -8449,7 +8469,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty case NMC_EDITOR_MAIN_CMD_VERIFY: /* Verify current setting or the whole connection */ if (cmd_arg && !nm_streq(cmd_arg, "all") && !nm_streq(cmd_arg, "fix")) { - g_print(_("Invalid verify option: %s\n"), cmd_arg); + nmc_print(_("Invalid verify option: %s\n"), cmd_arg); break; } @@ -8457,9 +8477,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty gs_free_error GError *tmp_err = NULL; nm_setting_verify(menu_ctx.curr_setting, NULL, &tmp_err); - g_print(_("Verify setting '%s': %s\n"), - nm_setting_get_name(menu_ctx.curr_setting), - tmp_err ? tmp_err->message : "OK"); + nmc_print(_("Verify setting '%s': %s\n"), + nm_setting_get_name(menu_ctx.curr_setting), + tmp_err ? tmp_err->message : "OK"); } else { gs_free_error GError *tmp_err = NULL; gboolean fixed = TRUE; @@ -8472,9 +8492,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty g_clear_error(&tmp_err); fixed = nm_connection_normalize(connection, NULL, &modified, &tmp_err); } - g_print(_("Verify connection: %s\n"), tmp_err ? tmp_err->message : "OK"); + nmc_print(_("Verify connection: %s\n"), tmp_err ? tmp_err->message : "OK"); if (!fixed) - g_print(_("The error cannot be fixed automatically.\n")); + nmc_print(_("The error cannot be fixed automatically.\n")); } break; @@ -8494,7 +8514,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty else if (matches(cmd_arg, "persistent")) temporary = FALSE; else { - g_print(_("Error: invalid argument '%s'\n"), cmd_arg); + nmc_print(_("Error: invalid argument '%s'\n"), cmd_arg); break; } } @@ -8551,20 +8571,20 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty g_source_destroy(source); if (nmc_editor_error) { - g_print(_("Error: Failed to save '%s' (%s) connection: %s\n"), - nm_connection_get_id(connection), - nm_connection_get_uuid(connection), - nmc_editor_error->message); + nmc_print(_("Error: Failed to save '%s' (%s) connection: %s\n"), + nm_connection_get_id(connection), + nm_connection_get_uuid(connection), + nmc_editor_error->message); g_error_free(nmc_editor_error); } else if (timeout) { - g_print(_("Error: Timeout saving '%s' (%s) connection\n"), - nm_connection_get_id(connection), - nm_connection_get_uuid(connection)); + nmc_print(_("Error: Timeout saving '%s' (%s) connection\n"), + nm_connection_get_id(connection), + nm_connection_get_uuid(connection)); } else { - g_print(!rem_con ? _("Connection '%s' (%s) successfully saved.\n") - : _("Connection '%s' (%s) successfully updated.\n"), - nm_connection_get_id(connection), - nm_connection_get_uuid(connection)); + nmc_print(!rem_con ? _("Connection '%s' (%s) successfully saved.\n") + : _("Connection '%s' (%s) successfully updated.\n"), + nm_connection_get_id(connection), + nm_connection_get_uuid(connection)); con_tmp = nm_client_get_connection_by_uuid(nmc->client, nm_connection_get_uuid(connection)); @@ -8596,9 +8616,9 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty nmc_editor_cb_called = FALSE; nmc_editor_error = NULL; } else { - g_print(_("Error: connection verification failed: %s\n"), - err1 ? err1->message : _("(unknown error)")); - g_print(_("You may try running 'verify fix' to fix errors.\n")); + nmc_print(_("Error: connection verification failed: %s\n"), + err1 ? err1->message : _("(unknown error)")); + nmc_print(_("You may try running 'verify fix' to fix errors.\n")); } g_clear_error(&err1); @@ -8621,11 +8641,11 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty if (is_connection_dirty(connection, rem_con)) { /* TRANSLATORS: do not translate 'save', leave it as it is */ - g_print(_("Error: connection is not saved. Type 'save' first.\n")); + nmc_print(_("Error: connection is not saved. Type 'save' first.\n")); break; } if (!nm_connection_verify(NM_CONNECTION(rem_con), &tmp_err)) { - g_print(_("Error: connection is not valid: %s\n"), tmp_err->message); + nmc_print(_("Error: connection is not valid: %s\n"), tmp_err->message); g_clear_error(&tmp_err); break; } @@ -8641,7 +8661,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty NULL, activate_connection_editor_cb, &tmp_err)) { - g_print(_("Error: Cannot activate connection: %s.\n"), tmp_err->message); + nmc_print(_("Error: Cannot activate connection: %s.\n"), tmp_err->message); g_clear_error(&tmp_err); break; } @@ -8650,10 +8670,10 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty g_main_context_iteration(NULL, TRUE); if (nmc_editor_error) { - g_print(_("Error: Failed to activate '%s' (%s) connection: %s\n"), - nm_connection_get_id(connection), - nm_connection_get_uuid(connection), - nmc_editor_error->message); + nmc_print(_("Error: Failed to activate '%s' (%s) connection: %s\n"), + nm_connection_get_id(connection), + nm_connection_get_uuid(connection), + nmc_editor_error->message); g_error_free(nmc_editor_error); } else { nmc_readline(&nmc->nmc_config, @@ -8692,7 +8712,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty GError *tmp_err = NULL; gboolean bb; if (!nmc_string_to_bool(cmd_arg_v ? g_strstrip(cmd_arg_v) : "", &bb, &tmp_err)) { - g_print(_("Error: status-line: %s\n"), tmp_err->message); + nmc_print(_("Error: status-line: %s\n"), tmp_err->message); g_clear_error(&tmp_err); } else nmc->editor_status_line = bb; @@ -8700,7 +8720,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty GError *tmp_err = NULL; gboolean bb; if (!nmc_string_to_bool(cmd_arg_v ? g_strstrip(cmd_arg_v) : "", &bb, &tmp_err)) { - g_print(_("Error: save-confirmation: %s\n"), tmp_err->message); + nmc_print(_("Error: save-confirmation: %s\n"), tmp_err->message); g_clear_error(&tmp_err); } else nmc->editor_save_confirmation = bb; @@ -8708,7 +8728,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty GError *tmp_err = NULL; gboolean bb; if (!nmc_string_to_bool(cmd_arg_v ? g_strstrip(cmd_arg_v) : "", &bb, &tmp_err)) { - g_print(_("Error: show-secrets: %s\n"), tmp_err->message); + nmc_print(_("Error: show-secrets: %s\n"), tmp_err->message); g_clear_error(&tmp_err); } else nmc->nmc_config_mutable.show_secrets = bb; @@ -8716,17 +8736,17 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty g_debug("Ignoring erroneous --prompt-color argument. Use terminal-colors.d(5) to " "set the prompt color.\n"); } else if (!cmd_arg_p) { - g_print(_("Current nmcli configuration:\n")); - g_print("status-line: %s\n" - "save-confirmation: %s\n" - "show-secrets: %s\n", - nmc->editor_status_line ? "yes" : "no", - nmc->editor_save_confirmation ? "yes" : "no", - nmc->nmc_config.show_secrets ? "yes" : "no"); + nmc_print(_("Current nmcli configuration:\n")); + nmc_print("status-line: %s\n" + "save-confirmation: %s\n" + "show-secrets: %s\n", + nmc->editor_status_line ? "yes" : "no", + nmc->editor_save_confirmation ? "yes" : "no", + nmc->nmc_config.show_secrets ? "yes" : "no"); } else - g_print(_("Invalid configuration option '%s'; allowed [%s]\n"), - cmd_arg_v ?: "", - "status-line, save-confirmation, show-secrets"); + nmc_print(_("Invalid configuration option '%s'; allowed [%s]\n"), + cmd_arg_v ?: "", + "status-line, save-confirmation, show-secrets"); break; @@ -8740,7 +8760,7 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty case NMC_EDITOR_MAIN_CMD_UNKNOWN: default: - g_print(_("Unknown command: '%s'\n"), cmd_user); + nmc_print(_("Unknown command: '%s'\n"), cmd_user); break; } } @@ -8883,9 +8903,9 @@ nmc_complete_connection_type(const char *prefix) const NMMetaSettingInfoEditor *setting_info = &nm_meta_setting_infos_editor[i]; if (!*prefix || matches(prefix, setting_info->general->setting_name)) - g_print("%s\n", setting_info->general->setting_name); + nmc_print("%s\n", setting_info->general->setting_name); if (setting_info->alias && (!*prefix || matches(prefix, setting_info->alias))) - g_print("%s\n", setting_info->alias); + nmc_print("%s\n", setting_info->alias); } } @@ -8988,10 +9008,10 @@ do_connection_edit(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons connection_type = nm_setting_connection_get_connection_type(s_con); if (type) - g_print(_("Warning: editing existing connection '%s'; 'type' argument is ignored\n"), - nm_connection_get_id(connection)); + nmc_print(_("Warning: editing existing connection '%s'; 'type' argument is ignored\n"), + nm_connection_get_id(connection)); if (con_name) - g_print( + nmc_print( _("Warning: editing existing connection '%s'; 'con-name' argument is ignored\n"), nm_connection_get_id(connection)); @@ -9019,9 +9039,9 @@ do_connection_edit(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons gs_free char *type_ask = NULL; if (!type) - g_print(_("Valid connection types: %s\n"), tmp_str); + nmc_print(_("Valid connection types: %s\n"), tmp_str); else - g_print(_("Error: invalid connection type; %s\n"), err1->message); + nmc_print(_("Error: invalid connection type; %s\n"), err1->message); g_clear_error(&err1); type_ask = nmc_readline(&nmc->nmc_config, EDITOR_PROMPT_CON_TYPE); @@ -9059,23 +9079,23 @@ do_connection_edit(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons /* nmcli runs the editor */ nmc->nmc_config_mutable.in_editor = TRUE; - g_print("\n"); - g_print(_("===| nmcli interactive connection editor |===")); - g_print("\n\n"); + nmc_print("\n"); + nmc_print(_("===| nmcli interactive connection editor |===")); + nmc_print("\n\n"); if (con) - g_print(_("Editing existing '%s' connection: '%s'"), connection_type, con); + nmc_print(_("Editing existing '%s' connection: '%s'"), connection_type, con); else - g_print(_("Adding a new '%s' connection"), connection_type); - g_print("\n\n"); + nmc_print(_("Adding a new '%s' connection"), connection_type); + nmc_print("\n\n"); /* TRANSLATORS: do not translate 'help', leave it as it is */ - g_print(_("Type 'help' or '?' for available commands.")); - g_print("\n"); + nmc_print(_("Type 'help' or '?' for available commands.")); + nmc_print("\n"); /* TRANSLATORS: do not translate 'print', leave it as it is */ - g_print(_("Type 'print' to show all the connection properties.")); - g_print("\n"); + nmc_print(_("Type 'print' to show all the connection properties.")); + nmc_print("\n"); /* TRANSLATORS: do not translate 'describe', leave it as it is */ - g_print(_("Type 'describe [<setting>.<prop>]' for detailed property description.")); - g_print("\n\n"); + nmc_print(_("Type 'describe [<setting>.<prop>]' for detailed property description.")); + nmc_print("\n\n"); nmc_tab_completion.nmc = nmc; nmc_tab_completion.con_type = g_strdup(connection_type); @@ -9109,9 +9129,9 @@ modify_connection_cb(GObject *connection, GAsyncResult *result, gpointer user_da connection_warnings(nmc, NM_CONNECTION(connection)); if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) { - g_print(_("Connection '%s' (%s) successfully modified.\n"), - nm_connection_get_id(NM_CONNECTION(connection)), - nm_connection_get_uuid(NM_CONNECTION(connection))); + nmc_print(_("Connection '%s' (%s) successfully modified.\n"), + nm_connection_get_id(NM_CONNECTION(connection)), + nm_connection_get_uuid(NM_CONNECTION(connection))); } } quit(); @@ -9182,11 +9202,11 @@ clone_connection_cb(GObject *client, GAsyncResult *result, gpointer user_data) error->message); nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION; } else { - g_print(_("%s (%s) cloned as %s (%s).\n"), - info->orig_id, - info->orig_uuid, - nm_connection_get_id(NM_CONNECTION(connection)), - nm_connection_get_uuid(NM_CONNECTION(connection))); + nmc_print(_("%s (%s) cloned as %s (%s).\n"), + info->orig_id, + info->orig_uuid, + nm_connection_get_id(NM_CONNECTION(connection)), + nm_connection_get_uuid(NM_CONNECTION(connection))); } quit(); @@ -9283,7 +9303,7 @@ delete_cb(GObject *con, GAsyncResult *result, gpointer user_data) if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; g_string_printf(info->nmc->return_text, _("Error: not all connections deleted.")); - g_printerr(_("Error: Connection deletion failed: %s\n"), error->message); + nmc_printerr(_("Error: Connection deletion failed: %s\n"), error->message); g_error_free(error); info->nmc->return_value = NMC_RESULT_ERROR_CON_DEL; connection_cb_info_finish(info, con); @@ -9338,7 +9358,7 @@ do_connection_delete(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co get_connection(nmc, &arg_num, &arg_ptr, &cur_selector, &cur_value, &found_cons, &error); if (!connection) { if (!nmc->complete) - g_printerr(_("Error: %s.\n"), error->message); + nmc_printerr(_("Error: %s.\n"), error->message); g_string_printf(nmc->return_text, _("Error: not all connections found.")); nmc->return_value = error->code; g_clear_error(&error); @@ -9406,7 +9426,7 @@ finish: static void connection_changed(NMConnection *connection, NmCli *nmc) { - g_print(_("%s: connection profile changed\n"), nm_connection_get_id(connection)); + nmc_print(_("%s: connection profile changed\n"), nm_connection_get_id(connection)); } static void @@ -9432,7 +9452,7 @@ connection_added(NMClient *client, NMRemoteConnection *con, NmCli *nmc) { NMConnection *connection = NM_CONNECTION(con); - g_print(_("%s: connection profile created\n"), nm_connection_get_id(connection)); + nmc_print(_("%s: connection profile created\n"), nm_connection_get_id(connection)); connection_watch(nmc, connection); } @@ -9441,7 +9461,7 @@ connection_removed(NMClient *client, NMRemoteConnection *con, NmCli *nmc) { NMConnection *connection = NM_CONNECTION(con); - g_print(_("%s: connection profile removed\n"), nm_connection_get_id(connection)); + nmc_print(_("%s: connection profile removed\n"), nm_connection_get_id(connection)); connection_unwatch(nmc, connection); } @@ -9465,7 +9485,7 @@ do_connection_monitor(const NMCCommand *cmd, NmCli *nmc, int argc, const char *c while (argc > 0) { if (!get_connection(nmc, &argc, &argv, NULL, NULL, &found_cons, &error)) { if (!nmc->complete) - g_printerr(_("Error: %s.\n"), error->message); + nmc_printerr(_("Error: %s.\n"), error->message); g_string_printf(nmc->return_text, _("Error: not all connections found.")); nmc->return_value = error->code; return; @@ -9589,7 +9609,7 @@ do_connection_load(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons if (failures) { for (i = 0; failures[i]; i++) - g_printerr(_("Could not load file '%s'\n"), failures[i]); + nmc_printerr(_("Could not load file '%s'\n"), failures[i]); } } @@ -9839,7 +9859,7 @@ do_connection_export(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; goto finish; } - g_print("%s", contents); + nmc_print("%s", contents); } finish: @@ -9858,13 +9878,13 @@ migrate_cb(GObject *obj, GAsyncResult *result, gpointer user_data) res = nm_remote_connection_update2_finish(NM_REMOTE_CONNECTION(obj), result, &error); if (!res) { g_string_printf(info->nmc->return_text, _("Error: not all connections migrated.")); - g_printerr(_("Error: Connection migration failed: %s\n"), error->message); + nmc_printerr(_("Error: Connection migration failed: %s\n"), error->message); g_error_free(error); info->nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; } else { - g_print(_("Connection '%s' (%s) successfully migrated.\n"), - nm_connection_get_id(connection), - nm_connection_get_uuid(connection)); + nmc_print(_("Connection '%s' (%s) successfully migrated.\n"), + nm_connection_get_id(connection), + nm_connection_get_uuid(connection)); } connection_cb_info_finish(info, obj); } @@ -9927,7 +9947,7 @@ do_connection_migrate(const NMCCommand *cmd, NmCli *nmc, int argc, const char *c get_connection(nmc, &arg_num, &arg_ptr, &cur_selector, &cur_value, &found_cons, &error); if (!connection) { if (!nmc->complete) - g_printerr(_("Error: %s.\n"), error->message); + nmc_printerr(_("Error: %s.\n"), error->message); g_string_printf(nmc->return_text, _("Error: not all connections found.")); nmc->return_value = error->code; g_clear_error(&error); diff --git a/src/nmcli/devices.c b/src/nmcli/devices.c index 445f12313f..31e7d8be4d 100644 --- a/src/nmcli/devices.c +++ b/src/nmcli/devices.c @@ -838,34 +838,35 @@ static guint progress_id = 0; /* ID of event source for displaying progress */ static void usage(void) { - g_printerr(_("Usage: nmcli device { COMMAND | help }\n\n" - "COMMAND := { status | show | set | connect | reapply | modify | disconnect | " - "delete | monitor | wifi | lldp }\n\n" - " status\n\n" - " show [<ifname>]\n\n" - " set [ifname] <ifname> [autoconnect yes|no] [managed yes|no]\n\n" - " connect <ifname>\n\n" - " reapply <ifname>\n\n" - " modify <ifname> ([+|-]<setting>.<property> <value>)+\n\n" - " disconnect <ifname> ...\n\n" - " delete <ifname> ...\n\n" - " monitor <ifname> ...\n\n" - " wifi [list [ifname <ifname>] [bssid <BSSID>] [--rescan yes|no|auto]]\n\n" - " wifi connect <(B)SSID> [password <password>] [wep-key-type key|phrase] [ifname " - "<ifname>]\n" - " [bssid <BSSID>] [name <name>] [private yes|no] [hidden " - "yes|no]\n\n" - " wifi hotspot [ifname <ifname>] [con-name <name>] [ssid <SSID>] [band a|bg] " - "[channel <channel>] [password <password>]\n\n" - " wifi rescan [ifname <ifname>] [[ssid <SSID to scan>] ...]\n\n" - " wifi show-password [ifname <ifname>]\n\n" - " lldp [list [ifname <ifname>]]\n\n")); + nmc_printerr( + _("Usage: nmcli device { COMMAND | help }\n\n" + "COMMAND := { status | show | set | connect | reapply | modify | disconnect | " + "delete | monitor | wifi | lldp }\n\n" + " status\n\n" + " show [<ifname>]\n\n" + " set [ifname] <ifname> [autoconnect yes|no] [managed yes|no]\n\n" + " connect <ifname>\n\n" + " reapply <ifname>\n\n" + " modify <ifname> ([+|-]<setting>.<property> <value>)+\n\n" + " disconnect <ifname> ...\n\n" + " delete <ifname> ...\n\n" + " monitor <ifname> ...\n\n" + " wifi [list [ifname <ifname>] [bssid <BSSID>] [--rescan yes|no|auto]]\n\n" + " wifi connect <(B)SSID> [password <password>] [wep-key-type key|phrase] [ifname " + "<ifname>]\n" + " [bssid <BSSID>] [name <name>] [private yes|no] [hidden " + "yes|no]\n\n" + " wifi hotspot [ifname <ifname>] [con-name <name>] [ssid <SSID>] [band a|bg] " + "[channel <channel>] [password <password>]\n\n" + " wifi rescan [ifname <ifname>] [[ssid <SSID to scan>] ...]\n\n" + " wifi show-password [ifname <ifname>]\n\n" + " lldp [list [ifname <ifname>]]\n\n")); } static void usage_device_status(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli device status { help }\n" "\n" "Show status for all devices.\n" @@ -881,41 +882,41 @@ usage_device_status(void) static void usage_device_show(void) { - g_printerr(_("Usage: nmcli device show { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [<ifname>]\n" - "\n" - "Show details of device(s).\n" - "The command lists details for all devices, or for a given device.\n\n")); + nmc_printerr(_("Usage: nmcli device show { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [<ifname>]\n" + "\n" + "Show details of device(s).\n" + "The command lists details for all devices, or for a given device.\n\n")); } static void usage_device_connect(void) { - g_printerr(_("Usage: nmcli device connect { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := <ifname>\n" - "\n" - "Connect the device.\n" - "NetworkManager will try to find a suitable connection that will be activated.\n" - "It will also consider connections that are not set to auto-connect.\n\n")); + nmc_printerr(_("Usage: nmcli device connect { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := <ifname>\n" + "\n" + "Connect the device.\n" + "NetworkManager will try to find a suitable connection that will be activated.\n" + "It will also consider connections that are not set to auto-connect.\n\n")); } static void usage_device_reapply(void) { - g_printerr(_("Usage: nmcli device reapply { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := <ifname>\n" - "\n" - "Attempts to update device with changes to the currently active connection\n" - "made since it was last applied.\n\n")); + nmc_printerr(_("Usage: nmcli device reapply { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := <ifname>\n" + "\n" + "Attempts to update device with changes to the currently active connection\n" + "made since it was last applied.\n\n")); } static void usage_device_modify(void) { - g_printerr(_( + nmc_printerr(_( "Usage: nmcli device modify { ARGUMENTS | help }\n" "\n" "ARGUMENTS := <ifname> ([+|-]<setting>.<property> <value>)+\n" @@ -936,57 +937,57 @@ usage_device_modify(void) static void usage_device_disconnect(void) { - g_printerr(_("Usage: nmcli device disconnect { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := <ifname> ...\n" - "\n" - "Disconnect devices.\n" - "The command disconnects the device and prevents it from auto-activating\n" - "further connections without user/manual intervention.\n\n")); + nmc_printerr(_("Usage: nmcli device disconnect { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := <ifname> ...\n" + "\n" + "Disconnect devices.\n" + "The command disconnects the device and prevents it from auto-activating\n" + "further connections without user/manual intervention.\n\n")); } static void usage_device_delete(void) { - g_printerr(_("Usage: nmcli device delete { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := <ifname> ...\n" - "\n" - "Delete the software devices.\n" - "The command removes the interfaces. It only works for software devices\n" - "(like bonds, bridges, etc.). Hardware devices cannot be deleted by the\n" - "command.\n\n")); + nmc_printerr(_("Usage: nmcli device delete { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := <ifname> ...\n" + "\n" + "Delete the software devices.\n" + "The command removes the interfaces. It only works for software devices\n" + "(like bonds, bridges, etc.). Hardware devices cannot be deleted by the\n" + "command.\n\n")); } static void usage_device_set(void) { - g_printerr(_("Usage: nmcli device set { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := DEVICE { PROPERTY [ PROPERTY ... ] }\n" - "DEVICE := [ifname] <ifname> \n" - "PROPERTY := { autoconnect { yes | no } |\n" - " { managed { yes | no }\n" - "\n" - "Modify device properties.\n\n")); + nmc_printerr(_("Usage: nmcli device set { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := DEVICE { PROPERTY [ PROPERTY ... ] }\n" + "DEVICE := [ifname] <ifname> \n" + "PROPERTY := { autoconnect { yes | no } |\n" + " { managed { yes | no }\n" + "\n" + "Modify device properties.\n\n")); } static void usage_device_monitor(void) { - g_printerr(_("Usage: nmcli device monitor { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [<ifname>] ...\n" - "\n" - "Monitor device activity.\n" - "This command prints a line whenever the specified devices change state.\n" - "Monitors all devices in case no interface is specified.\n\n")); + nmc_printerr(_("Usage: nmcli device monitor { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [<ifname>] ...\n" + "\n" + "Monitor device activity.\n" + "This command prints a line whenever the specified devices change state.\n" + "Monitors all devices in case no interface is specified.\n\n")); } static void usage_device_wifi(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli device wifi { ARGUMENTS | help }\n" "\n" "Perform operation on Wi-Fi devices.\n" @@ -1035,24 +1036,24 @@ usage_device_wifi(void) static void usage_device_lldp(void) { - g_printerr(_("Usage: nmcli device lldp { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [list [ifname <ifname>]]\n" - "\n" - "List neighboring devices discovered through LLDP. The 'ifname' option can be\n" - "used to list neighbors for a particular interface.\n\n")); + nmc_printerr(_("Usage: nmcli device lldp { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [list [ifname <ifname>]]\n" + "\n" + "List neighboring devices discovered through LLDP. The 'ifname' option can be\n" + "used to list neighbors for a particular interface.\n\n")); } static void usage_device_checkpoint(void) { - g_printerr(_("Usage: nmcli device checkpoint { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [--timeout <seconds>] -- COMMAND...\n" - "\n" - "Runs the command with a configuration checkpoint taken and asks for a\n" - "confirmation when finished. When the confirmation is not given, the\n" - "checkpoint is automatically restored after timeout.\n\n")); + nmc_printerr(_("Usage: nmcli device checkpoint { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [--timeout <seconds>] -- COMMAND...\n" + "\n" + "Runs the command with a configuration checkpoint taken and asks for a\n" + "confirmation when finished. When the confirmation is not given, the\n" + "checkpoint is automatically restored after timeout.\n\n")); } static void @@ -1109,7 +1110,7 @@ complete_device(NMDevice **devices, const char *prefix, gboolean wifi_only) continue; if (g_str_has_prefix(iface, prefix)) - g_print("%s\n", iface); + nmc_print("%s\n", iface); } } @@ -1178,10 +1179,10 @@ get_device_list(NmCli *nmc, int *argc, const char *const **argv) if (!g_ptr_array_find(queue, device, NULL)) g_ptr_array_add(queue, g_object_ref(device)); else - g_printerr(_("Warning: argument '%s' is duplicated.\n"), **argv); + nmc_printerr(_("Warning: argument '%s' is duplicated.\n"), **argv); } else { if (!nmc->complete) - g_printerr(_("Error: Device '%s' not found.\n"), **argv); + nmc_printerr(_("Error: Device '%s' not found.\n"), **argv); g_string_printf(nmc->return_text, _("Error: not all devices found.")); nmc->return_value = NMC_RESULT_ERROR_NOT_FOUND; } @@ -1645,7 +1646,7 @@ show_device_info(NMDevice *device, NmCli *nmc) if (NM_IN_SET(nmc->nmc_config.print_output, NMC_PRINT_NORMAL, NMC_PRINT_PRETTY) && !nmc->nmc_config.multiline_output && was_output) - g_print("\n"); /* Print empty line between groups in tabular mode */ + nmc_print("\n"); /* Print empty line between groups in tabular mode */ was_output = FALSE; @@ -2033,7 +2034,7 @@ do_device_show(const NMCCommand *cmd, NmCli *nmc, int argc, const char *const *a if (!show_device_info(devices[i], nmc)) break; if (devices[i + 1]) - g_print("\n"); /* Empty line */ + nmc_print("\n"); /* Empty line */ } g_free(devices); @@ -2124,12 +2125,12 @@ add_and_activate_check_state(AddAndActivateInfo *info) if (state == NM_DEVICE_STATE_ACTIVATED) { nmc_terminal_erase_line(); - g_print(_("Device '%s' successfully activated with '%s'.\n"), - nm_device_get_iface(info->device), - nm_active_connection_get_uuid(info->active)); + nmc_print(_("Device '%s' successfully activated with '%s'.\n"), + nm_device_get_iface(info->device), + nm_active_connection_get_uuid(info->active)); if (info->hotspot) - g_print( + nmc_print( _("Hint: \"nmcli dev wifi show-password\" shows the Wi-Fi name and password.\n")); } else if (state <= NM_DEVICE_STATE_DISCONNECTED || state >= NM_DEVICE_STATE_DEACTIVATING) { reason = nm_device_get_state_reason(info->device); @@ -2195,7 +2196,7 @@ add_and_activate_cb(GObject *client, GAsyncResult *result, gpointer user_data) deprecated = nmc_connection_check_deprecated(NM_CONNECTION(nm_active_connection_get_connection(active))); if (deprecated) - g_printerr(_("Warning: %s.\n"), deprecated); + nmc_printerr(_("Warning: %s.\n"), deprecated); if (nmc->nowait_flag) { quit(); @@ -2383,9 +2384,9 @@ device_removed_cb(NMClient *client, NMDevice *device, DeviceCbInfo *info) return; if (info->cmd_disconnect) - g_print(_("Device '%s' successfully disconnected.\n"), nm_device_get_iface(device)); + nmc_print(_("Device '%s' successfully disconnected.\n"), nm_device_get_iface(device)); else - g_print(_("Device '%s' successfully removed.\n"), nm_device_get_iface(device)); + nmc_print(_("Device '%s' successfully removed.\n"), nm_device_get_iface(device)); device_cb_info_finish(info, device); } @@ -2396,7 +2397,7 @@ disconnect_state_cb(NMDevice *device, GParamSpec *pspec, DeviceCbInfo *info) return; if (nm_device_get_state(device) <= NM_DEVICE_STATE_DISCONNECTED) { - g_print(_("Device '%s' successfully disconnected.\n"), nm_device_get_iface(device)); + nmc_print(_("Device '%s' successfully disconnected.\n"), nm_device_get_iface(device)); device_cb_info_finish(info, device); } } @@ -2455,8 +2456,8 @@ reapply_device_cb(GObject *object, GAsyncResult *result, gpointer user_data) } else { if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line(); - g_print(_("Connection successfully reapplied to device '%s'.\n"), - nm_device_get_iface(device)); + nmc_print(_("Connection successfully reapplied to device '%s'.\n"), + nm_device_get_iface(device)); device_cb_info_finish(info, device); } } @@ -2536,8 +2537,8 @@ modify_reapply_cb(GObject *object, GAsyncResult *result, gpointer user_data) } else { if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line(); - g_print(_("Connection successfully reapplied to device '%s'.\n"), - nm_device_get_iface(device)); + nmc_print(_("Connection successfully reapplied to device '%s'.\n"), + nm_device_get_iface(device)); } quit(); @@ -2636,10 +2637,10 @@ disconnect_device_cb(GObject *object, GAsyncResult *result, gpointer user_data) return; nmc = info->nmc; g_string_printf(nmc->return_text, _("Error: not all devices disconnected.")); - g_printerr(_("Error: Device '%s' (%s) disconnecting failed: %s\n"), - nm_device_get_iface(device), - nm_object_get_path(NM_OBJECT(device)), - error->message); + nmc_printerr(_("Error: Device '%s' (%s) disconnecting failed: %s\n"), + nm_device_get_iface(device), + nm_object_get_path(NM_OBJECT(device)), + error->message); g_error_free(error); nmc->return_value = NMC_RESULT_ERROR_DEV_DISCONNECT; device_cb_info_finish(info, device); @@ -2651,7 +2652,8 @@ disconnect_device_cb(GObject *object, GAsyncResult *result, gpointer user_data) if (state <= NM_DEVICE_STATE_DISCONNECTED) { if (nmc->nmc_config.print_output == NMC_PRINT_PRETTY) nmc_terminal_erase_line(); - g_print(_("Device '%s' successfully disconnected.\n"), nm_device_get_iface(device)); + nmc_print(_("Device '%s' successfully disconnected.\n"), + nm_device_get_iface(device)); } device_cb_info_finish(info, device); } @@ -2713,15 +2715,15 @@ delete_device_cb(GObject *object, GAsyncResult *result, gpointer user_data) if (!nm_device_delete_finish(device, result, &error)) { g_string_printf(nmc->return_text, _("Error: not all devices deleted.")); - g_printerr(_("Error: Device '%s' (%s) deletion failed: %s\n"), - nm_device_get_iface(device), - nm_object_get_path(NM_OBJECT(device)), - error->message); + nmc_printerr(_("Error: Device '%s' (%s) deletion failed: %s\n"), + nm_device_get_iface(device), + nm_object_get_path(NM_OBJECT(device)), + error->message); g_error_free(error); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; device_cb_info_finish(info, device); } else { - g_print(_("Device '%s' successfully removed.\n"), nm_device_get_iface(device)); + nmc_print(_("Device '%s' successfully removed.\n"), nm_device_get_iface(device)); device_cb_info_finish(info, device); } } @@ -2877,7 +2879,7 @@ device_state(NMDevice *device, GParamSpec *pspec, NmCli *nmc) nm_device_get_iface(device), gettext(nmc_device_state_to_string_with_external(device))); - g_print("%s", str); + nmc_print("%s", str); } static void @@ -2889,7 +2891,7 @@ device_ac(NMDevice *device, GParamSpec *pspec, NmCli *nmc) if (!id) return; - g_print(_("%s: using connection '%s'\n"), nm_device_get_iface(device), id); + nmc_print(_("%s: using connection '%s'\n"), nm_device_get_iface(device), id); } static void @@ -2915,14 +2917,14 @@ device_unwatch(NmCli *nmc, NMDevice *device) static void device_added(NMClient *client, NMDevice *device, NmCli *nmc) { - g_print(_("%s: device created\n"), nm_device_get_iface(device)); + nmc_print(_("%s: device created\n"), nm_device_get_iface(device)); device_watch(nmc, NM_DEVICE(device)); } static void device_removed(NMClient *client, NMDevice *device, NmCli *nmc) { - g_print(_("%s: device removed\n"), nm_device_get_iface(device)); + nmc_print(_("%s: device removed\n"), nm_device_get_iface(device)); device_unwatch(nmc, device); } @@ -3020,7 +3022,7 @@ find_ap_on_device(NMDevice *device, const char *bssid, const char *ssid, gboolea /* Compare BSSIDs */ if (complete) { if (g_str_has_prefix(candidate_bssid, bssid)) - g_print("%s\n", candidate_bssid); + nmc_print("%s\n", candidate_bssid); } else if (strcmp(bssid, candidate_bssid) != 0) continue; } @@ -3040,7 +3042,7 @@ find_ap_on_device(NMDevice *device, const char *bssid, const char *ssid, gboolea /* Compare SSIDs */ if (complete) { if (g_str_has_prefix(ssid_tmp, ssid)) - g_print("%s\n", ssid_tmp); + nmc_print("%s\n", ssid_tmp); } else if (strcmp(ssid, ssid_tmp) != 0) { g_free(ssid_tmp); continue; @@ -3108,7 +3110,7 @@ wifi_print_aps(NMDeviceWifi *wifi, static gboolean empty_line = FALSE; if (empty_line) - g_print("\n"); /* Empty line between devices' APs */ + nmc_print("\n"); /* Empty line between devices' APs */ /* Main header name */ header_name = construct_header_name(base_hdr, nm_device_get_iface(NM_DEVICE(wifi))); @@ -3980,9 +3982,10 @@ do_device_wifi_connect(const NMCCommand *cmd, NmCli *nmc, int argc, const char * /* Warn when the provided AP identifier looks like BSSID instead of SSID */ if (bssid1_arr) - g_printerr(_("Warning: '%s' should be SSID for hidden APs; but it looks like a " - "BSSID.\n"), - param_user); + nmc_printerr( + _("Warning: '%s' should be SSID for hidden APs; but it looks like a " + "BSSID.\n"), + param_user); } } } @@ -4202,7 +4205,7 @@ set_wireless_security_for_hotspot(NMSettingWirelessSecurity *s_wsec, NULL); } if (show_password) - g_print(_("Hotspot password: %s\n"), key); + nmc_print(_("Hotspot password: %s\n"), key); return TRUE; } @@ -4688,7 +4691,7 @@ print_wifi_connection(const NmcConfig *nmc_config, NMConnection *connection) g_return_if_fail(ssid_bytes); ssid = nm_utils_ssid_to_utf8(g_bytes_get_data(ssid_bytes, NULL), g_bytes_get_size(ssid_bytes)); g_return_if_fail(ssid); - g_print("SSID: %s\n", ssid); + nmc_print("SSID: %s\n", ssid); string = g_string_sized_new(64); g_string_append(string, "WIFI:"); @@ -4701,21 +4704,21 @@ print_wifi_connection(const NmcConfig *nmc_config, NMConnection *connection) if (key_mgmt == NULL) { type = "nopass"; - g_print("%s: %s\n", _("Security"), _("None")); + nmc_print("%s: %s\n", _("Security"), _("None")); } else if (strcmp(key_mgmt, "none") == 0 || strcmp(key_mgmt, "ieee8021x") == 0) { type = "WEP"; - g_print("%s: WEP\n", _("Security")); + nmc_print("%s: WEP\n", _("Security")); } else if (strcmp(key_mgmt, "wpa-none") == 0 || strcmp(key_mgmt, "wpa-psk") == 0 || strcmp(key_mgmt, "sae") == 0) { type = "WPA"; - g_print("%s: WPA\n", _("Security")); + nmc_print("%s: WPA\n", _("Security")); } else if (strcmp(key_mgmt, "owe") == 0) { type = "nopass"; - g_print("%s: OWE\n", _("Security")); + nmc_print("%s: OWE\n", _("Security")); } if (psk) - g_print("%s: %s\n", _("Password"), psk); + nmc_print("%s: %s\n", _("Password"), psk); string_append_mecard(string, "T:", type); string_append_mecard(string, "S:", ssid); @@ -4728,7 +4731,7 @@ print_wifi_connection(const NmcConfig *nmc_config, NMConnection *connection) if (nmc_config->use_colors) nmc_print_qrcode(string->str); - g_print("\n"); + nmc_print("\n"); } static gboolean @@ -5091,7 +5094,7 @@ checkpoints_changed_cb(GObject *object, GParamSpec *pspec, CheckpointCbInfo *inf if (!info->child_id) { /* The command is done, we're in the confirmation prompt. */ - g_print("%s\n", _("No")); + nmc_print("%s\n", _("No")); g_main_loop_quit(loop); } } diff --git a/src/nmcli/general.c b/src/nmcli/general.c index 4cacc027d1..26988cd82c 100644 --- a/src/nmcli/general.c +++ b/src/nmcli/general.c @@ -299,19 +299,19 @@ static const NmcMetaGenericInfo static void usage_general(void) { - g_printerr(_("Usage: nmcli general { COMMAND | help }\n\n" - "COMMAND := { status | hostname | permissions | logging | reload }\n\n" - " status\n\n" - " hostname [<hostname>]\n\n" - " permissions\n\n" - " logging [level <log level>] [domains <log domains>]\n\n" - " reload [<flags>]\n\n")); + nmc_printerr(_("Usage: nmcli general { COMMAND | help }\n\n" + "COMMAND := { status | hostname | permissions | logging | reload }\n\n" + " status\n\n" + " hostname [<hostname>]\n\n" + " permissions\n\n" + " logging [level <log level>] [domains <log domains>]\n\n" + " reload [<flags>]\n\n")); } static void usage_general_status(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli general status { help }\n" "\n" "Show overall status of NetworkManager.\n" @@ -321,7 +321,7 @@ usage_general_status(void) static void usage_general_hostname(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli general hostname { ARGUMENTS | help }\n" "\n" "ARGUMENTS := [<hostname>]\n" @@ -334,87 +334,88 @@ usage_general_hostname(void) static void usage_general_permissions(void) { - g_printerr(_("Usage: nmcli general permissions { help }\n" - "\n" - "Show caller permissions for authenticated operations.\n\n")); + nmc_printerr(_("Usage: nmcli general permissions { help }\n" + "\n" + "Show caller permissions for authenticated operations.\n\n")); } static void usage_general_reload(void) { - g_printerr(_("Usage: nmcli general reload { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [<flag>[,<flag>...]]\n" - "\n" - "Reload NetworkManager's configuration and perform certain updates, like\n" - "flushing caches or rewriting external state to disk. This is similar to\n" - "sending SIGHUP to NetworkManager but it allows for more fine-grained\n" - "control over what to reload through the flags argument. It also allows\n" - "non-root access via PolicyKit and contrary to signals it is synchronous.\n" - "\n" - "Available flags are:\n" - "\n" - " 'conf' Reload the NetworkManager.conf configuration from\n" - " disk. Note that this does not include connections, which\n" - " can be reloaded through 'nmcli connection reload' instead.\n" - "\n" - " 'dns-rc' Update DNS configuration, which usually involves writing\n" - " /etc/resolv.conf anew. This is equivalent to sending the\n" - " SIGUSR1 signal to the NetworkManager process.\n" - "\n" - " 'dns-full' Restart the DNS plugin. This is for example useful when\n" - " using dnsmasq plugin, which uses additional configuration\n" - " in /etc/NetworkManager/dnsmasq.d. If you edit those files,\n" - " you can restart the DNS plugin. This action shortly\n" - " interrupts name resolution.\n" - "\n" - "With no flags, everything that is supported is reloaded, which is\n" - "identical to sending a SIGHUP.\n")); + nmc_printerr(_("Usage: nmcli general reload { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [<flag>[,<flag>...]]\n" + "\n" + "Reload NetworkManager's configuration and perform certain updates, like\n" + "flushing caches or rewriting external state to disk. This is similar to\n" + "sending SIGHUP to NetworkManager but it allows for more fine-grained\n" + "control over what to reload through the flags argument. It also allows\n" + "non-root access via PolicyKit and contrary to signals it is synchronous.\n" + "\n" + "Available flags are:\n" + "\n" + " 'conf' Reload the NetworkManager.conf configuration from\n" + " disk. Note that this does not include connections, which\n" + " can be reloaded through 'nmcli connection reload' instead.\n" + "\n" + " 'dns-rc' Update DNS configuration, which usually involves writing\n" + " /etc/resolv.conf anew. This is equivalent to sending the\n" + " SIGUSR1 signal to the NetworkManager process.\n" + "\n" + " 'dns-full' Restart the DNS plugin. This is for example useful when\n" + " using dnsmasq plugin, which uses additional configuration\n" + " in /etc/NetworkManager/dnsmasq.d. If you edit those files,\n" + " you can restart the DNS plugin. This action shortly\n" + " interrupts name resolution.\n" + "\n" + "With no flags, everything that is supported is reloaded, which is\n" + "identical to sending a SIGHUP.\n")); } static void usage_general_logging(void) { - g_printerr(_("Usage: nmcli general logging { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [level <log level>] [domains <log domains>]\n" - "\n" - "Get or change NetworkManager logging level and domains.\n" - "Without any argument current logging level and domains are shown. In order to\n" - "change logging state, provide level and/or domain. Please refer to the man page\n" - "for the list of possible logging domains.\n\n")); + nmc_printerr( + _("Usage: nmcli general logging { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [level <log level>] [domains <log domains>]\n" + "\n" + "Get or change NetworkManager logging level and domains.\n" + "Without any argument current logging level and domains are shown. In order to\n" + "change logging state, provide level and/or domain. Please refer to the man page\n" + "for the list of possible logging domains.\n\n")); } static void usage_networking(void) { - g_printerr(_("Usage: nmcli networking { COMMAND | help }\n\n" - "COMMAND := { [ on | off | connectivity ] }\n\n" - " on\n\n" - " off\n\n" - " connectivity [check]\n\n")); + nmc_printerr(_("Usage: nmcli networking { COMMAND | help }\n\n" + "COMMAND := { [ on | off | connectivity ] }\n\n" + " on\n\n" + " off\n\n" + " connectivity [check]\n\n")); } static void usage_networking_on(void) { - g_printerr(_("Usage: nmcli networking on { help }\n" - "\n" - "Switch networking on.\n\n")); + nmc_printerr(_("Usage: nmcli networking on { help }\n" + "\n" + "Switch networking on.\n\n")); } static void usage_networking_off(void) { - g_printerr(_("Usage: nmcli networking off { help }\n" - "\n" - "Switch networking off.\n\n")); + nmc_printerr(_("Usage: nmcli networking off { help }\n" + "\n" + "Switch networking off.\n\n")); } static void usage_networking_connectivity(void) { - g_printerr( + nmc_printerr( _("Usage: nmcli networking connectivity { ARGUMENTS | help }\n" "\n" "ARGUMENTS := [check]\n" @@ -426,48 +427,48 @@ usage_networking_connectivity(void) static void usage_radio(void) { - g_printerr(_("Usage: nmcli radio { COMMAND | help }\n\n" - "COMMAND := { all | wifi | wwan }\n\n" - " all | wifi | wwan [ on | off ]\n\n")); + nmc_printerr(_("Usage: nmcli radio { COMMAND | help }\n\n" + "COMMAND := { all | wifi | wwan }\n\n" + " all | wifi | wwan [ on | off ]\n\n")); } static void usage_radio_all(void) { - g_printerr(_("Usage: nmcli radio all { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [on | off]\n" - "\n" - "Get status of all radio switches, or turn them on/off.\n\n")); + nmc_printerr(_("Usage: nmcli radio all { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [on | off]\n" + "\n" + "Get status of all radio switches, or turn them on/off.\n\n")); } static void usage_radio_wifi(void) { - g_printerr(_("Usage: nmcli radio wifi { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [on | off]\n" - "\n" - "Get status of Wi-Fi radio switch, or turn it on/off.\n\n")); + nmc_printerr(_("Usage: nmcli radio wifi { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [on | off]\n" + "\n" + "Get status of Wi-Fi radio switch, or turn it on/off.\n\n")); } static void usage_radio_wwan(void) { - g_printerr(_("Usage: nmcli radio wwan { ARGUMENTS | help }\n" - "\n" - "ARGUMENTS := [on | off]\n" - "\n" - "Get status of mobile broadband radio switch, or turn it on/off.\n\n")); + nmc_printerr(_("Usage: nmcli radio wwan { ARGUMENTS | help }\n" + "\n" + "ARGUMENTS := [on | off]\n" + "\n" + "Get status of mobile broadband radio switch, or turn it on/off.\n\n")); } static void usage_monitor(void) { - g_printerr(_("Usage: nmcli monitor\n" - "\n" - "Monitor NetworkManager changes.\n" - "Prints a line whenever a change occurs in NetworkManager\n\n")); + nmc_printerr(_("Usage: nmcli monitor\n" + "\n" + "Monitor NetworkManager changes.\n" + "Prints a line whenever a change occurs in NetworkManager\n\n")); } static void @@ -748,7 +749,7 @@ nmc_complete_strings_nocase(const char *prefix, ...) va_start(args, prefix); while ((candidate = va_arg(args, const char *))) { if (strncasecmp(prefix, candidate, len) == 0) - g_print("%s\n", candidate); + nmc_print("%s\n", candidate); } va_end(args); } @@ -919,13 +920,13 @@ do_general_hostname(const NMCCommand *cmd, NmCli *nmc, int argc, const char *con g_object_get(nmc->client, NM_CLIENT_HOSTNAME, &s, NULL); if (s) - g_print("%s\n", s); + nmc_print("%s\n", s); return; } hostname = *argv; if (next_arg(nmc, &argc, &argv, NULL) == 0) - g_print("Warning: ignoring extra garbage after '%s' hostname\n", hostname); + nmc_print("Warning: ignoring extra garbage after '%s' hostname\n", hostname); nmc->should_wait++; nm_client_save_hostname_async(nmc->client, hostname, NULL, save_hostname_cb, nmc); @@ -1234,7 +1235,7 @@ networkmanager_running(NMClient *client, GParamSpec *param, NmCli *nmc) str = nmc_colorize(&nmc->nmc_config, running ? NM_META_COLOR_MANAGER_RUNNING : NM_META_COLOR_MANAGER_STOPPED, running ? _("NetworkManager is running") : _("NetworkManager is stopped")); - g_print("%s\n", str); + nmc_print("%s\n", str); g_free(str); } @@ -1244,7 +1245,7 @@ client_hostname(NMClient *client, GParamSpec *param, NmCli *nmc) const char *hostname; g_object_get(client, NM_CLIENT_HOSTNAME, &hostname, NULL); - g_print(_("Hostname set to '%s'\n"), hostname); + nmc_print(_("Hostname set to '%s'\n"), hostname); } static void @@ -1259,9 +1260,9 @@ client_primary_connection(NMClient *client, GParamSpec *param, NmCli *nmc) if (!id) id = nm_active_connection_get_uuid(primary); - g_print(_("'%s' is now the primary connection\n"), id); + nmc_print(_("'%s' is now the primary connection\n"), id); } else { - g_print(_("There's no primary connection\n")); + nmc_print(_("There's no primary connection\n")); } } @@ -1276,7 +1277,7 @@ client_connectivity(NMClient *client, GParamSpec *param, NmCli *nmc) connectivity_to_color(connectivity), _("Connectivity is now '%s'\n"), gettext(nm_connectivity_to_string(connectivity))); - g_print("%s", str); + nmc_print("%s", str); g_free(str); } @@ -1291,7 +1292,7 @@ client_state(NMClient *client, GParamSpec *param, NmCli *nmc) state_to_color(state), _("Networkmanager is now in the '%s' state\n"), gettext(nm_state_to_string(state))); - g_print("%s", str); + nmc_print("%s", str); g_free(str); } @@ -1310,9 +1311,9 @@ device_overview(NmCli *nmc, NMDevice *device) if (nm_device_get_state(device) == NM_DEVICE_STATE_DISCONNECTED) { if (activatable) { if (activatable->len == 1) - g_print("\t%d %s\n", activatable->len, _("connection available")); + nmc_print("\t%d %s\n", activatable->len, _("connection available")); else if (activatable->len > 1) - g_print("\t%d %s\n", activatable->len, _("connections available")); + nmc_print("\t%d %s\n", activatable->len, _("connections available")); } } @@ -1401,7 +1402,7 @@ device_overview(NmCli *nmc, NMDevice *device) if (outbuf->len >= 2) { g_string_truncate(outbuf, outbuf->len - 2); - g_print("\t%s\n", outbuf->str); + nmc_print("\t%s\n", outbuf->str); } g_string_free(outbuf, TRUE); @@ -1428,7 +1429,7 @@ ac_overview(NmCli *nmc, NMActiveConnection *ac) g_string_append_printf(outbuf, "%s, ", _("ip6 default")); if (outbuf->len >= 2) { g_string_truncate(outbuf, outbuf->len - 2); - g_print("\t%s\n", outbuf->str); + nmc_print("\t%s\n", outbuf->str); } ip = nm_active_connection_get_ip4_config(ac); @@ -1439,7 +1440,7 @@ ac_overview(NmCli *nmc, NMActiveConnection *ac) p = nm_ip_config_get_addresses(ip); for (i = 0; i < p->len; i++) { NMIPAddress *a = p->pdata[i]; - g_print("\tinet4 %s/%d\n", nm_ip_address_get_address(a), nm_ip_address_get_prefix(a)); + nmc_print("\tinet4 %s/%d\n", nm_ip_address_get_address(a), nm_ip_address_get_prefix(a)); } p = nm_ip_config_get_routes(ip); @@ -1449,7 +1450,7 @@ ac_overview(NmCli *nmc, NMActiveConnection *ac) nm_str_buf_reset(&str); _nm_ip_route_to_string(a, &str); - g_print("\troute4 %s\n", nm_str_buf_get_str(&str)); + nmc_print("\troute4 %s\n", nm_str_buf_get_str(&str)); } } @@ -1461,7 +1462,7 @@ ac_overview(NmCli *nmc, NMActiveConnection *ac) p = nm_ip_config_get_addresses(ip); for (i = 0; i < p->len; i++) { NMIPAddress *a = p->pdata[i]; - g_print("\tinet6 %s/%d\n", nm_ip_address_get_address(a), nm_ip_address_get_prefix(a)); + nmc_print("\tinet6 %s/%d\n", nm_ip_address_get_address(a), nm_ip_address_get_prefix(a)); } p = nm_ip_config_get_routes(ip); @@ -1471,7 +1472,7 @@ ac_overview(NmCli *nmc, NMActiveConnection *ac) nm_str_buf_reset(&str); _nm_ip_route_to_string(a, &str); - g_print("\troute6 %s\n", nm_str_buf_get_str(&str)); + nmc_print("\troute6 %s\n", nm_str_buf_get_str(&str)); } } @@ -1509,11 +1510,11 @@ nmc_command_func_overview(const NMCCommand *cmd, NmCli *nmc, int argc, const cha color, _("%s VPN connection"), nm_active_connection_get_id(ac)); - g_print("%s\n", tmp); + nmc_print("%s\n", tmp); g_free(tmp); ac_overview(nmc, ac); - g_print("\n"); + nmc_print("\n"); } devices = nmc_get_devices_sorted(nmc->client); @@ -1541,16 +1542,16 @@ nmc_command_func_overview(const NMCCommand *cmd, NmCli *nmc, int argc, const cha nm_device_get_iface(device), gettext(nmc_device_state_to_string_with_external(device))); } - g_print("%s\n", tmp); + nmc_print("%s\n", tmp); g_free(tmp); if (nm_device_get_description(device) && strcmp(nm_device_get_description(device), "")) - g_print("\t\"%s\"\n", nm_device_get_description(device)); + nmc_print("\t\"%s\"\n", nm_device_get_description(device)); device_overview(nmc, device); if (ac) ac_overview(nmc, ac); - g_print("\n"); + nmc_print("\n"); } g_free(devices); @@ -1566,31 +1567,32 @@ nmc_command_func_overview(const NMCCommand *cmd, NmCli *nmc, int argc, const cha } if (i == 0) - g_print("DNS configuration:\n"); + nmc_print("DNS configuration:\n"); tmp = g_strjoinv(" ", (char **) strv); - g_print("\tservers: %s\n", tmp); + nmc_print("\tservers: %s\n", tmp); g_free(tmp); strv = nm_dns_entry_get_domains(dns); if (strv && strv[0]) { tmp = g_strjoinv(" ", (char **) strv); - g_print("\tdomains: %s\n", tmp); + nmc_print("\tdomains: %s\n", tmp); g_free(tmp); } if (nm_dns_entry_get_interface(dns)) - g_print("\tinterface: %s\n", nm_dns_entry_get_interface(dns)); + nmc_print("\tinterface: %s\n", nm_dns_entry_get_interface(dns)); if (nm_dns_entry_get_vpn(dns)) - g_print("\ttype: vpn\n"); - g_print("\n"); + nmc_print("\ttype: vpn\n"); + nmc_print("\n"); } - g_print(_("Use \"nmcli device show\" to get complete information about known devices and\n" - "\"nmcli connection show\" to get an overview on active connection profiles.\n" - "\n" - "Consult nmcli(1) and nmcli-examples(7) manual pages for complete usage details.\n")); + nmc_print( + _("Use \"nmcli device show\" to get complete information about known devices and\n" + "\"nmcli connection show\" to get an overview on active connection profiles.\n" + "\n" + "Consult nmcli(1) and nmcli-examples(7) manual pages for complete usage details.\n")); } void diff --git a/src/nmcli/nmcli.c b/src/nmcli/nmcli.c index bc37a7f0f8..ff496874b4 100644 --- a/src/nmcli/nmcli.c +++ b/src/nmcli/nmcli.c @@ -166,13 +166,13 @@ complete_one(gpointer key, gpointer value, gpointer user_data) /* value prefix was not a standalone argument, * it was part of --option=<value> argument. * Repeat the part leading to "=". */ - g_print("%s=", option); + nmc_print("%s=", option); } - g_print("%.*s%s%s\n", - (int) (last - prefix), - prefix, - name, - strcmp(last, name) == 0 ? "," : ""); + nmc_print("%.*s%s%s\n", + (int) (last - prefix), + prefix, + name, + strcmp(last, name) == 0 ? "," : ""); } } @@ -228,9 +228,9 @@ complete_option_with_value(const char *option, const char *prefix, ...) /* value prefix was not a standalone argument, * it was part of --option=<value> argument. * Repeat the part leading to "=". */ - g_print("%s=", option); + nmc_print("%s=", option); } - g_print("%s\n", candidate); + nmc_print("%s\n", candidate); } } va_end(args); @@ -239,7 +239,7 @@ complete_option_with_value(const char *option, const char *prefix, ...) static void usage(void) { - g_printerr(_( + nmc_printerr(_( "Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }\n" "\n" "OPTIONS\n" @@ -889,7 +889,7 @@ process_command_line(NmCli *nmc, int argc, char **argv_orig) nmc->timeout = (int) timeout; } else if (matches_arg(nmc, &argc, &argv, "-version", NULL)) { if (!nmc->complete) - g_print(_("nmcli tool, version %s\n"), NMCLI_VERSION); + nmc_print(_("nmcli tool, version %s\n"), NMCLI_VERSION); return NMC_RESULT_SUCCESS; } else if (matches_arg(nmc, &argc, &argv, "-help", NULL)) { if (!nmc->complete) @@ -1047,7 +1047,7 @@ main(int argc, char *argv[]) nm_cli.return_value = NMC_RESULT_SUCCESS; } else if (nm_cli.return_value != NMC_RESULT_SUCCESS) { /* Print result descripting text */ - g_printerr("%s\n", nm_cli.return_text->str); + nmc_printerr("%s\n", nm_cli.return_text->str); } nmc_cleanup(&nm_cli); diff --git a/src/nmcli/polkit-agent.c b/src/nmcli/polkit-agent.c index 41567023d3..8b74b338a4 100644 --- a/src/nmcli/polkit-agent.c +++ b/src/nmcli/polkit-agent.c @@ -13,6 +13,7 @@ #include "libnmc-base/nm-polkit-listener.h" #include "common.h" +#include "utils.h" static char * polkit_read_passwd(gpointer instance, @@ -23,8 +24,8 @@ polkit_read_passwd(gpointer instance, { NmCli *nmc = user_data; - g_print("%s\n", message); - g_print("(action_id: %s)\n", action_id); + nmc_print("%s\n", message); + nmc_print("(action_id: %s)\n", action_id); /* Ask user for polkit authorization password */ if (user) { @@ -36,7 +37,7 @@ polkit_read_passwd(gpointer instance, static void polkit_error(gpointer instance, const char *error, gpointer user_data) { - g_printerr(_("Error: polkit agent failed: %s\n"), error); + nmc_printerr(_("Error: polkit agent failed: %s\n"), error); } gboolean @@ -89,7 +90,7 @@ nmc_start_polkit_agent_start_try(NmCli *nmc) return TRUE; if (!nmc_polkit_agent_init(nmc, FALSE, &error)) { - g_printerr(_("Warning: polkit agent initialization failed: %s\n"), error->message); + nmc_printerr(_("Warning: polkit agent initialization failed: %s\n"), error->message); return FALSE; } return TRUE; diff --git a/src/nmcli/settings.c b/src/nmcli/settings.c index 3eebb17f3f..3c1f3c38ff 100644 --- a/src/nmcli/settings.c +++ b/src/nmcli/settings.c @@ -246,10 +246,10 @@ wireless_band_channel_changed_cb(GObject *object, GParamSpec *pspec, gpointer us mode = nm_setting_wireless_get_mode(NM_SETTING_WIRELESS(object)); if (!mode || !*mode || strcmp(mode, NM_SETTING_WIRELESS_MODE_INFRA) == 0) { - g_print(_("Warning: %s.%s set to '%s', but it might be ignored in infrastructure mode\n"), - nm_setting_get_name(NM_SETTING(s_wireless)), - g_param_spec_get_name(pspec), - value); + nmc_print(_("Warning: %s.%s set to '%s', but it might be ignored in infrastructure mode\n"), + nm_setting_get_name(NM_SETTING(s_wireless)), + g_param_spec_get_name(pspec), + value); } } @@ -266,9 +266,9 @@ connection_master_changed_cb(GObject *object, GParamSpec *pspec, gpointer user_d s_ipv4 = nm_connection_get_setting_by_name(connection, NM_SETTING_IP4_CONFIG_SETTING_NAME); s_ipv6 = nm_connection_get_setting_by_name(connection, NM_SETTING_IP6_CONFIG_SETTING_NAME); if (s_ipv4 || s_ipv6) { - g_print(_("Warning: setting %s.%s requires removing ipv4 and ipv6 settings\n"), - nm_setting_get_name(NM_SETTING(s_con)), - g_param_spec_get_name(pspec)); + nmc_print(_("Warning: setting %s.%s requires removing ipv4 and ipv6 settings\n"), + nm_setting_get_name(NM_SETTING(s_con)), + g_param_spec_get_name(pspec)); tmp_str = nmc_get_user_input(_("Do you want to remove them? [yes] ")); if (!tmp_str || matches(tmp_str, "yes")) { if (s_ipv4) @@ -373,8 +373,8 @@ _set_fcn_precheck_connection_secondaries(NMClient *client, if (nm_utils_is_uuid(*iter)) { con = nmc_find_connection(connections, "uuid", *iter, NULL, FALSE); if (!con) { - g_print(_("Warning: %s is not an UUID of any existing connection profile\n"), - *iter); + nmc_print(_("Warning: %s is not an UUID of any existing connection profile\n"), + *iter); } else { /* Currently, NM only supports VPN connections as secondaries */ if (!nm_connection_is_type(con, NM_SETTING_VPN_SETTING_NAME)) { @@ -431,13 +431,13 @@ _env_warn_fcn_handle( switch (warn_level) { case NM_META_ENV_WARN_LEVEL_WARN: - g_print(_("Warning: %s\n"), m); + nmc_print(_("Warning: %s\n"), m); return; case NM_META_ENV_WARN_LEVEL_INFO: - g_print(_("Info: %s\n"), m); + nmc_print(_("Info: %s\n"), m); return; } - g_print(_("Error: %s\n"), m); + nmc_print(_("Error: %s\n"), m); } static NMDevice *const * diff --git a/src/nmcli/utils.c b/src/nmcli/utils.c index 3e9674ea6a..2c155fff24 100644 --- a/src/nmcli/utils.c +++ b/src/nmcli/utils.c @@ -346,7 +346,7 @@ ssid_to_hex(const char *str, gsize len) void nmc_terminal_erase_line(void) { - /* We intentionally use printf(), not g_print() here, to ensure that + /* We intentionally use printf(), not nmc_print() here, to ensure that * GLib doesn't mistakenly try to convert the string. */ printf("\33[2K\r"); @@ -365,7 +365,7 @@ nmc_terminal_show_progress(const char *str) const char slashes[4] = {'|', '/', '-', '\\'}; nmc_terminal_erase_line(); - g_print("%c %s", slashes[idx++], str ?: ""); + nmc_print("%c %s", slashes[idx++], str ?: ""); fflush(stdout); if (idx == 4) idx = 0; @@ -467,7 +467,7 @@ nmc_get_user_input(const char *ask_str) size_t line_ln = 0; ssize_t num; - g_print("%s", ask_str); + nmc_print("%s", ask_str); num = getline(&line, &line_ln, stdin); /* Remove newline from the string */ @@ -1251,9 +1251,9 @@ _print_do(const NmcConfig *nmc_config, width1 = strlen(header_name); width2 = nmc_string_screen_width(header_name, NULL); - g_print("%s\n", line); - g_print("%*s\n", (table_width + width2) / 2 + width1 - width2, header_name); - g_print("%s\n", line); + nmc_print("%s\n", line); + nmc_print("%*s\n", (table_width + width2) / 2 + width1 - width2, header_name); + nmc_print("%s\n", line); } str = !nmc_config->multiline_output ? g_string_sized_new(100) : NULL; @@ -1283,14 +1283,14 @@ _print_do(const NmcConfig *nmc_config, if (str->len) g_string_truncate(str, str->len - 1); /* Chop off last column separator */ - g_print("%s\n", str->str); + nmc_print("%s\n", str->str); g_string_truncate(str, 0); /* Print horizontal separator */ if (nmc_config->print_output == NMC_PRINT_PRETTY) { gs_free char *line = NULL; - g_print("%s\n", (line = g_strnfill(table_width, '-'))); + nmc_print("%s\n", (line = g_strnfill(table_width, '-'))); } } @@ -1332,12 +1332,12 @@ _print_do(const NmcConfig *nmc_config, prefix = g_strdup_printf("%s:", cell->header_cell->title); width1 = strlen(prefix); width2 = nmc_string_screen_width(prefix, NULL); - g_print("%-*s%s\n", - (int) (nmc_config->print_output == NMC_PRINT_TERSE - ? 0 - : ML_VALUE_INDENT + width1 - width2), - prefix, - text); + nmc_print("%-*s%s\n", + (int) (nmc_config->print_output == NMC_PRINT_TERSE + ? 0 + : ML_VALUE_INDENT + width1 - width2), + prefix, + text); } else { nm_assert(str); if (nmc_config->print_output == NMC_PRINT_TERSE) { @@ -1373,7 +1373,7 @@ _print_do(const NmcConfig *nmc_config, if (!nmc_config->multiline_output) { if (str->len) g_string_truncate(str, str->len - 1); /* Chop off last column separator */ - g_print("%s\n", str->str); + nmc_print("%s\n", str->str); g_string_truncate(str, 0); } @@ -1381,7 +1381,7 @@ _print_do(const NmcConfig *nmc_config, if (nmc_config->print_output == NMC_PRINT_PRETTY && nmc_config->multiline_output) { gs_free char *line = NULL; - g_print("%s\n", (line = g_strnfill(ML_HEADER_WIDTH, '-'))); + nmc_print("%s\n", (line = g_strnfill(ML_HEADER_WIDTH, '-'))); } } } @@ -1458,7 +1458,7 @@ nmc_terminal_spawn_pager(const NmcConfig *nmc_config) if (pipe(fd) == -1) { errsv = errno; - g_printerr(_("Failed to create pager pipe: %s\n"), nm_strerror_native(errsv)); + nmc_printerr(_("Failed to create pager pipe: %s\n"), nm_strerror_native(errsv)); return 0; } @@ -1471,7 +1471,7 @@ nmc_terminal_spawn_pager(const NmcConfig *nmc_config) pager_pid = fork(); if (pager_pid == -1) { errsv = errno; - g_printerr(_("Failed to fork pager: %s\n"), nm_strerror_native(errsv)); + nmc_printerr(_("Failed to fork pager: %s\n"), nm_strerror_native(errsv)); nm_close(fd[0]); nm_close(fd[1]); return 0; @@ -1515,11 +1515,11 @@ nmc_terminal_spawn_pager(const NmcConfig *nmc_config) /* Return in the parent */ if (dup2(fd[1], STDOUT_FILENO) < 0) { errsv = errno; - g_printerr(_("Failed to duplicate pager pipe: %s\n"), nm_strerror_native(errsv)); + nmc_printerr(_("Failed to duplicate pager pipe: %s\n"), nm_strerror_native(errsv)); } if (dup2(fd[1], STDERR_FILENO) < 0) { errsv = errno; - g_printerr(_("Failed to duplicate pager pipe: %s\n"), nm_strerror_native(errsv)); + nmc_printerr(_("Failed to duplicate pager pipe: %s\n"), nm_strerror_native(errsv)); } nm_close(fd[0]); @@ -1608,9 +1608,9 @@ print_required_fields(const NmcConfig *nmc_config, width1 = strlen(header_name); width2 = nmc_string_screen_width(header_name, NULL); - g_print("%s\n", line); - g_print("%*s\n", (table_width + width2) / 2 + width1 - width2, header_name); - g_print("%s\n", line); + nmc_print("%s\n", line); + nmc_print("%*s\n", (table_width + width2) / 2 + width1 - width2, header_name); + nmc_print("%s\n", line); } if (main_header_only) @@ -1656,12 +1656,12 @@ print_required_fields(const NmcConfig *nmc_config, j); width1 = strlen(tmp); width2 = nmc_string_screen_width(tmp, NULL); - g_print("%-*s%s\n", - (int) (nmc_config->print_output == NMC_PRINT_TERSE - ? 0 - : ML_VALUE_INDENT + width1 - width2), - tmp, - print_val); + nmc_print("%-*s%s\n", + (int) (nmc_config->print_output == NMC_PRINT_TERSE + ? 0 + : ML_VALUE_INDENT + width1 - width2), + tmp, + print_val); } } else { gs_free char *val_to_free = NULL; @@ -1681,18 +1681,18 @@ print_required_fields(const NmcConfig *nmc_config, nm_meta_abstract_info_get_name(field_values[idx].info, FALSE)); width1 = strlen(tmp); width2 = nmc_string_screen_width(tmp, NULL); - g_print("%-*s%s\n", - (int) (nmc_config->print_output == NMC_PRINT_TERSE - ? 0 - : ML_VALUE_INDENT + width1 - width2), - tmp, - print_val); + nmc_print("%-*s%s\n", + (int) (nmc_config->print_output == NMC_PRINT_TERSE + ? 0 + : ML_VALUE_INDENT + width1 - width2), + tmp, + print_val); } } if (nmc_config->print_output == NMC_PRINT_PRETTY) { gs_free char *line = NULL; - g_print("%s\n", (line = g_strnfill(ML_HEADER_WIDTH, '-'))); + nmc_print("%s\n", (line = g_strnfill(ML_HEADER_WIDTH, '-'))); } return; @@ -1749,13 +1749,13 @@ print_required_fields(const NmcConfig *nmc_config, g_string_prepend(str, (indent_str = g_strnfill(indent, ' '))); } - g_print("%s\n", str->str); + nmc_print("%s\n", str->str); /* Print horizontal separator */ if (nmc_config->print_output == NMC_PRINT_PRETTY && field_names) { gs_free char *line = NULL; - g_print("%s\n", (line = g_strnfill(table_width, '-'))); + nmc_print("%s\n", (line = g_strnfill(table_width, '-'))); } } } |