~cyphermox/ubuntu/natty/connman/release-0.64

« back to all changes in this revision

Viewing changes to src/plugin.c

  • Committer: Mathieu Trudel-Lapierre
  • Date: 2010-11-30 15:51:10 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: mathieu.trudel-lapierre@canonical.com-20101130155110-32g0usyc4jbl131x
New upstream release 0.64.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
}
87
87
 
88
88
static gboolean check_plugin(struct connman_plugin_desc *desc,
89
 
                                const char *pattern, const char *exclude)
 
89
                                char **patterns, char **excludes)
90
90
{
91
 
        if (exclude != NULL &&
92
 
                        g_pattern_match_simple(exclude, desc->name) == TRUE) {
93
 
                connman_info("Excluding %s", desc->description);
94
 
                return FALSE;
 
91
        if (excludes) {
 
92
                for (; *excludes; excludes++)
 
93
                        if (g_pattern_match_simple(*excludes, desc->name))
 
94
                                break;
 
95
                if (*excludes) {
 
96
                        connman_info("Excluding %s", desc->description);
 
97
                        return FALSE;
 
98
                }
95
99
        }
96
100
 
97
 
        if (pattern != NULL &&
98
 
                        g_pattern_match_simple(pattern, desc->name) == FALSE) {
99
 
                connman_info("Ignoring %s", desc->description);
100
 
                return FALSE;
 
101
        if (patterns) {
 
102
                for (; *patterns; patterns++)
 
103
                        if (g_pattern_match_simple(*patterns, desc->name))
 
104
                                break;
 
105
                if (!*patterns) {
 
106
                        connman_info("Ignoring %s", desc->description);
 
107
                        return FALSE;
 
108
                }
101
109
        }
102
110
 
103
111
        return TRUE;
107
115
 
108
116
int __connman_plugin_init(const char *pattern, const char *exclude)
109
117
{
 
118
        gchar **patterns = NULL;
 
119
        gchar **excludes = NULL;
110
120
        GSList *list;
111
121
        GDir *dir;
112
122
        const gchar *file;
115
125
 
116
126
        DBG("");
117
127
 
 
128
        if (pattern)
 
129
                patterns = g_strsplit_set(pattern, ", ", -1);
 
130
 
 
131
        if (exclude)
 
132
                excludes = g_strsplit_set(exclude, ", ", -1);
 
133
 
118
134
        for (i = 0; __connman_builtin[i]; i++) {
119
135
                if (check_plugin(__connman_builtin[i],
120
 
                                                pattern, exclude) == FALSE)
 
136
                                                patterns, excludes) == FALSE)
121
137
                        continue;
122
138
 
123
139
                add_plugin(NULL, __connman_builtin[i]);
153
169
                                continue;
154
170
                        }
155
171
 
156
 
                        if (check_plugin(desc, pattern, exclude) == FALSE) {
 
172
                        if (check_plugin(desc, patterns, excludes) == FALSE) {
157
173
                                dlclose(handle);
158
174
                                continue;
159
175
                        }
174
190
                plugin->active = TRUE;
175
191
        }
176
192
 
 
193
        g_strfreev(patterns);
 
194
        g_strfreev(excludes);
 
195
 
177
196
        return 0;
178
197
}
179
198