diff options
Diffstat (limited to 'src/settings/plugins/ifnet/net_utils.c')
| -rw-r--r-- | src/settings/plugins/ifnet/net_utils.c | 50 |
1 files changed, 4 insertions, 46 deletions
diff --git a/src/settings/plugins/ifnet/net_utils.c b/src/settings/plugins/ifnet/net_utils.c index adb23c43..1c72e0b2 100644 --- a/src/settings/plugins/ifnet/net_utils.c +++ b/src/settings/plugins/ifnet/net_utils.c @@ -26,11 +26,10 @@ #include <string.h> #include <errno.h> #include <nm-utils.h> -#include <NetworkManagerUtils.h> -#include <nm-system-config-interface.h> -#include <nm-logging.h> -#include <nm-config.h> -#include <gio/gio.h> +#include "NetworkManagerUtils.h" +#include <nm-settings-plugin.h> +#include "nm-config.h" +#include "nm-default.h" #include "net_utils.h" #include "wpa_parser.h" #include "net_parser.h" @@ -136,47 +135,6 @@ reload_parsers (void) return TRUE; } -gchar * -read_hostname (const char *path) -{ - gchar *contents = NULL, *result = NULL, *tmp; - gchar **all_lines = NULL; - guint line_num, i; - - if (!g_file_get_contents (path, &contents, NULL, NULL)) - return NULL; - all_lines = g_strsplit (contents, "\n", 0); - line_num = g_strv_length (all_lines); - for (i = 0; i < line_num; i++) { - g_strstrip (all_lines[i]); - if (all_lines[i][0] == '#' || all_lines[i][0] == '\0') - continue; - if (g_str_has_prefix (all_lines[i], "hostname")) { - tmp = strstr (all_lines[i], "="); - tmp++; - result = g_shell_unquote (tmp, NULL); - break; - } - - } - g_strfreev (all_lines); - g_free (contents); - return result; -} - -gboolean -write_hostname (const char *path, const gchar *hostname) -{ - gboolean result; - char *contents; - - contents = g_strdup_printf ("#Generated by NetworkManager\n" - "hostname=\"%s\"\n", hostname); - result = g_file_set_contents (path, contents, -1, NULL); - g_free (contents); - return result; -} - gboolean is_static_ip4 (const char *conn_name) { |