-/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager -- Network link manager
*
* Tom Parker <palfrey@tevp.net>
last = ret;
}
last_data = NULL;
- //printf("added block '%s' with type '%s'\n",name,type);
}
void add_data(const char *key,const char *data)
if_data *ret;
char *idx;
- // Check if there is a block where we can attach our data
+ /* Check if there is a block where we can attach our data */
if (first == NULL)
return;
ret = (if_data*) calloc(1,sizeof(struct _if_data));
ret->key = g_strdup(key);
- // Normalize keys. Convert '_' to '-', as ifupdown accepts both variants.
- // When querying keys via ifparser_getkey(), use '-'.
+
+ /* Normalize keys. Convert '_' to '-', as ifupdown accepts both variants.
+ * When querying keys via ifparser_getkey(), use '-'. */
while ((idx = strrchr(ret->key, '_'))) {
*idx = '-';
}
last_data->next = ret;
last_data = last_data->next;
}
- //printf("added data '%s' with key '%s'\n",data,key);
}
-// join values in src with spaces into dst; dst needs to be large enough
+/* join values in src with spaces into dst; dst needs to be large enough */
static char *join_values_with_spaces(char *dst, char **src)
{
if (dst != NULL) {
int skip_long_line = 0;
int offs = 0;
- // Check if interfaces file exists and open it
+ /* Check if interfaces file exists and open it */
if (!g_file_test (eni_file, G_FILE_TEST_EXISTS)) {
if (!quiet)
nm_log_warn (LOGD_SETTINGS, "interfaces file %s doesn't exist\n", eni_file);
while (!feof(inp))
{
- char *token[128]; // 255 chars can only be split into 127 tokens
- char value[255]; // large enough to join previously split tokens
+ char *token[128]; /* 255 chars can only be split into 127 tokens */
+ char value[255]; /* large enough to join previously split tokens */
char *safeptr;
int toknum;
int len = 0;
break;
len = strlen(line);
- // skip over-long lines
+ /* skip over-long lines */
if (!feof(inp) && len > 0 && line[len-1] != '\n') {
if (!skip_long_line) {
if (!quiet)
continue;
}
- // trailing '\n' found: remove it & reset offset to 0
+ /* trailing '\n' found: remove it & reset offset to 0 */
if (len > 0 && line[len-1] == '\n') {
line[--len] = '\0';
offs = 0;
}
- // if we're in long_line_skip mode, terminate it for real next line
+ /* if we're in long_line_skip mode, terminate it for real next line */
if (skip_long_line) {
if (len == 0 || line[len-1] != '\\')
skip_long_line = 0;
continue;
}
- // unwrap wrapped lines
+ /* unwrap wrapped lines */
if (len > 0 && line[len-1] == '\\') {
offs = len - 1;
continue;
}
- //printf(">>%s<<\n", line);
-
#define SPACES " \t"
- // tokenize input;
+ /* tokenize input; */
for (toknum = 0, token[toknum] = strtok_r(line, SPACES, &safeptr);
token[toknum] != NULL;
toknum++, token[toknum] = strtok_r(NULL, SPACES, &safeptr))
;
- // ignore comments and empty lines
+ /* ignore comments and empty lines */
if (toknum == 0 || *token[0]=='#')
continue;
continue;
}
- // There are five different stanzas:
- // iface, mapping, auto, allow-* and source.
- // Create a block for each of them except source.
+ /* There are five different stanzas:
+ * iface, mapping, auto, allow-* and source.
+ * Create a block for each of them except source. */
- // iface stanza takes at least 3 parameters
+ /* iface stanza takes at least 3 parameters */
if (strcmp(token[0], "iface") == 0) {
if (toknum < 4) {
if (!quiet) {
skip_to_block = 0;
add_data(token[2], join_values_with_spaces(value, token + 3));
}
- // auto and allow-auto stanzas are equivalent,
- // both can take multiple interfaces as parameters: add one block for each
+ /* auto and allow-auto stanzas are equivalent,
+ * both can take multiple interfaces as parameters: add one block for each */
else if (strcmp(token[0], "auto") == 0 ||
strcmp(token[0], "allow-auto") == 0) {
int i;
add_block(token[0], join_values_with_spaces(value, token + 1));
skip_to_block = 0;
}
- // allow-* can take multiple interfaces as parameters: add one block for each
+ /* allow-* can take multiple interfaces as parameters: add one block for each */
else if (strncmp(token[0],"allow-",6) == 0) {
int i;
for (i = 1; i < toknum; i++)
add_block(token[0], token[i]);
skip_to_block = 0;
}
- // source stanza takes one or more filepaths as parameters
+ /* source stanza takes one or more filepaths as parameters */
else if (strcmp(token[0], "source") == 0) {
int i;
char *en_dir;
settings_plugin_ifupdown_class_init (SettingsPluginIfupdownClass *req_class);
static void
-SettingsPluginIfupdown_init (NMSettingsPlugin *config);
+init (NMSettingsPlugin *config);
/* Returns the plugins currently known list of connections. The returned
* list is freed by the system settings service.
*/
static GSList*
-SettingsPluginIfupdown_get_connections (NMSettingsPlugin *config);
+get_connections (NMSettingsPlugin *config);
/*
* Return a list of device specifications which NetworkManager should not
* each element must be allocated using g_malloc() or its variants.
*/
static GSList*
-SettingsPluginIfupdown_get_unmanaged_specs (NMSettingsPlugin *config);
+get_unmanaged_specs (NMSettingsPlugin *config);
/* GObject */
static void
-GObject__get_property (GObject *object, guint prop_id,
+get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec);
static void
-GObject__set_property (GObject *object, guint prop_id,
+set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec);
static void
-GObject__dispose (GObject *object);
+dispose (GObject *object);
static void
settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface)
{
- plugin_iface->init = SettingsPluginIfupdown_init;
- plugin_iface->get_connections = SettingsPluginIfupdown_get_connections;
- plugin_iface->get_unmanaged_specs = SettingsPluginIfupdown_get_unmanaged_specs;
+ plugin_iface->init = init;
+ plugin_iface->get_connections = get_connections;
+ plugin_iface->get_unmanaged_specs = get_unmanaged_specs;
}
static void
g_type_class_add_private (req_class, sizeof (SettingsPluginIfupdownPrivate));
- object_class->dispose = GObject__dispose;
- object_class->get_property = GObject__get_property;
- object_class->set_property = GObject__set_property;
+ object_class->dispose = dispose;
+ object_class->get_property = get_property;
+ object_class->set_property = set_property;
g_object_class_override_property (object_class,
NM_SETTINGS_PLUGIN_PROP_NAME,
}
static void
-SettingsPluginIfupdown_init (NMSettingsPlugin *config)
+init (NMSettingsPlugin *config)
{
SettingsPluginIfupdown *self = SETTINGS_PLUGIN_IFUPDOWN (config);
SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (self);
* list is freed by the system settings service.
*/
static GSList*
-SettingsPluginIfupdown_get_connections (NMSettingsPlugin *config)
+get_connections (NMSettingsPlugin *config)
{
SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (config);
GSList *connections;
* each element must be allocated using g_malloc() or its variants.
*/
static GSList*
-SettingsPluginIfupdown_get_unmanaged_specs (NMSettingsPlugin *config)
+get_unmanaged_specs (NMSettingsPlugin *config)
{
SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (config);
GSList *specs = NULL;
}
static void
-GObject__get_property (GObject *object, guint prop_id,
+get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
switch (prop_id) {
}
static void
-GObject__set_property (GObject *object, guint prop_id,
+set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
{
switch (prop_id) {
}
static void
-GObject__dispose (GObject *object)
+dispose (GObject *object)
{
SettingsPluginIfupdown *plugin = SETTINGS_PLUGIN_IFUPDOWN (object);
SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (plugin);