diff --git a/clients/cli/utils.c b/clients/cli/utils.c index 87b37bb1a5..a406eee459 100644 --- a/clients/cli/utils.c +++ b/clients/cli/utils.c @@ -181,60 +181,6 @@ ssid_to_hex (const char *str, gsize len) return printable_str; } -/* - * Converts IPv4 address from guint32 in network-byte order to text representation. - * Returns: text form of the IP or NULL (then error is set) - */ -char * -nmc_ip4_address_as_string (guint32 ip, GError **error) -{ - guint32 tmp_addr; - char buf[INET_ADDRSTRLEN]; - - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - - memset (&buf, '\0', sizeof (buf)); - tmp_addr = ip; - - if (inet_ntop (AF_INET, &tmp_addr, buf, INET_ADDRSTRLEN)) { - return g_strdup (buf); - } else { - g_set_error (error, NMCLI_ERROR, 0, _("Error converting IP4 address '0x%X' to text form"), - ntohl (tmp_addr)); - return NULL; - } -} - -/* - * Converts IPv6 address in in6_addr structure to text representation. - * Returns: text form of the IP or NULL (then error is set) - */ -char * -nmc_ip6_address_as_string (const struct in6_addr *ip, GError **error) -{ - char buf[INET6_ADDRSTRLEN]; - - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - - memset (&buf, '\0', sizeof (buf)); - - if (inet_ntop (AF_INET6, ip, buf, INET6_ADDRSTRLEN)) { - return g_strdup (buf); - } else { - if (error) { - int j; - GString *ip6_str = g_string_new (NULL); - g_string_append_printf (ip6_str, "%02X", ip->s6_addr[0]); - for (j = 1; j < 16; j++) - g_string_append_printf (ip6_str, " %02X", ip->s6_addr[j]); - g_set_error (error, NMCLI_ERROR, 0, _("Error converting IP6 address '%s' to text form"), - ip6_str->str); - g_string_free (ip6_str, TRUE); - } - return NULL; - } -} - /* * Erase terminal line using ANSI escape sequences. * It prints [2K sequence to erase the line and then \r to return back @@ -706,23 +652,6 @@ finish: return ret; } -/* - * Convert string array (char **) to GSList. - * - * Returns: pointer to newly created GSList. Caller should free it. - */ -GSList * -nmc_util_strv_to_slist (char **strv) -{ - GSList *list = NULL; - guint i = 0; - - while (strv && strv[i]) - list = g_slist_prepend (list, g_strdup (strv[i++])); - - return g_slist_reverse (list); -} - /* * Convert string array (char **) to description string in the form of: * "[string1, string2, ]" diff --git a/clients/cli/utils.h b/clients/cli/utils.h index 224acb0cb3..eab60d3a10 100644 --- a/clients/cli/utils.h +++ b/clients/cli/utils.h @@ -69,8 +69,6 @@ gboolean nmc_string_to_uint (const char *str, unsigned long int *value); gboolean nmc_string_to_bool (const char *str, gboolean *val_bool, GError **error); gboolean nmc_string_to_tristate (const char *str, NMCTriStateValue *val, GError **error); -char *nmc_ip4_address_as_string (guint32 ip, GError **error); -char *nmc_ip6_address_as_string (const struct in6_addr *ip, GError **error); void nmc_terminal_erase_line (void); void nmc_terminal_show_progress (const char *str); const char *nmc_term_color_sequence (NmcTermColor color); @@ -83,7 +81,6 @@ char *nmc_get_user_input (const char *ask_str); int nmc_string_to_arg_array (const char *line, const char *delim, gboolean unquote, char ***argv, int *argc); const char *nmc_string_is_valid (const char *input, const char **allowed, GError **error); -GSList *nmc_util_strv_to_slist (char **strv); char * nmc_util_strv_for_display (const char **strv, gboolean brackets); char **nmc_strsplit_set (const char *str, const char *delimiter, int max_tokens); int nmc_string_screen_width (const char *start, const char *end);