+static void remove_args(gint *argc, gchar ***argv, gint index, gint num)
+{
+ gint i;
+
+ for (i = index; i < index + num; ++i)
+ (*argv)[i] = (*argv)[i+num];
+ *argc -= num;
+}
+
+static void parse_args(gint *argc, gchar ***argv)
+{
+ gint i;
+
+ for (i = 1; i < *argc; ++i) {
+ if (!strcmp((*argv)[i], "--sm-client-id")) {
+ if (i == *argc - 1) /* no args left */
+ g_printerr(_("--sm-client-id requires an argument\n"));
+ else {
+ sm_id = g_strdup((*argv)[i+1]);
+ remove_args(argc, argv, i, 2);
+ ++i;
+ }
+ } else if (!strcmp((*argv)[i], "--sm-save-file")) {
+ if (i == *argc - 1) /* no args left */
+ g_printerr(_("--sm-save-file requires an argument\n"));
+ else {
+ save_file = g_strdup((*argv)[i+1]);
+ remove_args(argc, argv, i, 2);
+ ++i;
+ }
+ } else if (!strcmp((*argv)[i], "--sm-disable")) {
+ sm_disable = TRUE;
+ remove_args(argc, argv, i, 1);
+ }
+ }
+}
+
+void session_startup(gint argc, gchar **argv)