+static int
+load_modules(struct ivi_compositor *ivi, const char *modules,
+ int *argc, char *argv[], bool *xwayland)
+{
+ const char *p, *end;
+ char buffer[256];
+ int (*module_init)(struct weston_compositor *wc, int argc, char *argv[]);
+
+ if (modules == NULL)
+ return 0;
+
+ p = modules;
+ while (*p) {
+ end = strchrnul(p, ',');
+ snprintf(buffer, sizeof buffer, "%.*s", (int) (end - p), p);
+
+ if (strstr(buffer, "xwayland.so")) {
+ weston_log("Xwayland plug-in not supported!\n");
+ p = end;
+ while (*p == ',')
+ p++;
+ continue;
+ }
+
+ module_init = weston_load_module(buffer, "wet_module_init");
+ if (!module_init)
+ return -1;
+
+ if (module_init(ivi->compositor, *argc, argv) < 0)
+ return -1;
+
+ p = end;
+ while (*p == ',')
+ p++;
+ }
+
+ return 0;
+}
+
+