Remove unused function
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3545 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -343,154 +343,6 @@ void nm_system_device_add_ip6_link_address (NMDevice *dev)
|
|||||||
nm_generic_device_add_ip6_link_address (dev);
|
nm_generic_device_add_ip6_link_address (dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* ArchReadConfig
|
|
||||||
*
|
|
||||||
* Read platform dependant config file and fill hash with relevant info
|
|
||||||
*/
|
|
||||||
|
|
||||||
static GHashTable * ArchReadConfig(const char* file, const char* dev)
|
|
||||||
{
|
|
||||||
gchar *contents=NULL;
|
|
||||||
gchar **split_contents=NULL;
|
|
||||||
GHashTable *cfg,*ifs;
|
|
||||||
guint len;
|
|
||||||
gint i;
|
|
||||||
gpointer val;
|
|
||||||
|
|
||||||
if (!g_file_get_contents (file, &contents, NULL, NULL) || (contents == NULL))
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(split_contents = g_strsplit (contents, "\n", 0)))
|
|
||||||
{
|
|
||||||
g_free(contents);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg=g_hash_table_new_full(g_str_hash,g_str_equal,g_free,g_free);
|
|
||||||
if (cfg==NULL)
|
|
||||||
{
|
|
||||||
g_free(contents);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ifs=g_hash_table_new_full(g_str_hash,g_str_equal,g_free,g_free);
|
|
||||||
if (ifs==NULL)
|
|
||||||
{
|
|
||||||
g_free(contents);
|
|
||||||
g_hash_table_destroy(cfg);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load hash with key value pairs from config file */
|
|
||||||
len = g_strv_length (split_contents);
|
|
||||||
for (i = 0; i < len; i++)
|
|
||||||
{
|
|
||||||
char *line = split_contents[i];
|
|
||||||
gchar** splt;
|
|
||||||
|
|
||||||
/* Ignore comments */
|
|
||||||
if (!line || (line[0] == ';') || (line[0] == '#'))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
line = g_strstrip(line);
|
|
||||||
|
|
||||||
splt=g_strsplit(line,"=",0);
|
|
||||||
if (g_strv_length(splt)==2)
|
|
||||||
{
|
|
||||||
g_hash_table_insert(cfg,g_strstrip(splt[0]),g_strstrip(splt[1]));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_strfreev(splt);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find our network device */
|
|
||||||
if ((val=g_hash_table_lookup(cfg,dev)))
|
|
||||||
{
|
|
||||||
char hit[128];
|
|
||||||
gchar** splt;
|
|
||||||
gint hits;
|
|
||||||
|
|
||||||
if (sscanf(val,"\"%[0-9a-zA-Z .]\"",hit))
|
|
||||||
{
|
|
||||||
|
|
||||||
splt=g_strsplit(hit," ",0);
|
|
||||||
|
|
||||||
hits=g_strv_length(splt);
|
|
||||||
if (hits>1)
|
|
||||||
{
|
|
||||||
guint j=0;
|
|
||||||
while ((hits-=2)>=0)
|
|
||||||
{
|
|
||||||
g_hash_table_insert(ifs,splt[j],splt[j+1]);
|
|
||||||
j+=2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* This interface is probably using DHCP - check this */
|
|
||||||
if (!g_ascii_strcasecmp(splt[0],"dhcp"))
|
|
||||||
{
|
|
||||||
g_hash_table_insert(ifs,g_strdup("dhcp"),g_strdup("true"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find out any default route */
|
|
||||||
if ((val=g_hash_table_lookup(cfg,"ROUTES")))
|
|
||||||
{
|
|
||||||
char hit[128];
|
|
||||||
gchar** splt;
|
|
||||||
gint hits,j;
|
|
||||||
|
|
||||||
if (sscanf(val,"( %[!0-9a-zA-z ] )",hit))
|
|
||||||
{
|
|
||||||
|
|
||||||
splt=g_strsplit(hit," ",0);
|
|
||||||
|
|
||||||
hits=g_strv_length(splt);
|
|
||||||
for (j=0;j<hits;j++)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (splt[j][0]=='!')
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((val=g_hash_table_lookup(cfg,splt[j])))
|
|
||||||
{
|
|
||||||
|
|
||||||
if (sscanf(val," \" default gw %[0-9a-zA-Z.-_] \"",hit))
|
|
||||||
{
|
|
||||||
g_hash_table_insert(ifs,g_strdup("gateway"),g_strdup(hit));
|
|
||||||
break; /* Only one default gw */
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_strfreev(splt);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
g_hash_table_destroy(cfg);
|
|
||||||
g_strfreev (split_contents);
|
|
||||||
g_free(contents);
|
|
||||||
|
|
||||||
return ifs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_activate_nis
|
* nm_system_activate_nis
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user