+ if ( dev_module ) {
+ GList * walker = arguments;
+
+ GRegex * regex_name = g_regex_new ("[-]+", (GRegexCompileFlags) 0, (GRegexMatchFlags) 0, NULL );
+ GRegex * regex_ifname = g_regex_new ("(?![a-zA-Z1-9_]).", (GRegexCompileFlags) 0, (GRegexMatchFlags) 0, NULL );
+ if (regex_name && regex_ifname) {
+ while ( walker != NULL ) {
+ extcap_arg * arg = (extcap_arg *)walker->data;
+ arg->device_name = g_strdup(ifname);
+
+ if ( arg->save ) {
+ struct preference * pref = NULL;
+
+ gchar * pref_name = g_regex_replace(regex_name, arg->call, strlen(arg->call), 0, "", (GRegexMatchFlags) 0, NULL );
+ gchar * ifname_underscore = g_regex_replace(regex_ifname, ifname, strlen(ifname), 0, "_", (GRegexMatchFlags) 0, NULL );
+ gchar * ifname_lowercase = g_ascii_strdown(ifname_underscore, -1);
+ gchar * pref_ifname = g_strconcat(ifname_lowercase, ".", pref_name, NULL);
+
+ if ( ( pref = prefs_find_preference(dev_module, pref_ifname) ) == NULL ) {
+ /* Set an initial value */
+ if ( ! arg->storeval && arg->default_complex )
+ {
+ arg->storeval = extcap_prefs_dynamic_valptr(pref_ifname);
+ g_snprintf(arg->storeval, EXTCAP_PREF_SIZE, "%s", arg->default_complex->_val);
+ }
+
+ prefs_register_string_preference(dev_module, g_strdup(pref_ifname),
+ arg->display, arg->display, (const gchar **)&(arg->storeval));
+ } else {
+ /* Been here before, restore stored value */
+ if (! arg->storeval && pref->varp.string)
+ {
+ arg->storeval = extcap_prefs_dynamic_valptr(pref_ifname);
+ g_snprintf(arg->storeval, EXTCAP_PREF_SIZE, "%s", *(pref->varp.string));
+ }
+ }
+
+ g_free(pref_name);
+ g_free(ifname_underscore);
+ g_free(ifname_lowercase);
+ g_free(pref_ifname);
+ }
+
+ walker = g_list_next(walker);
+ }
+ }
+ if (regex_name) {
+ g_regex_unref(regex_name);
+ }
+ if (regex_ifname) {
+ g_regex_unref(regex_ifname);
+ }
+ }