+ else /* We want the switch to not be in the args. */
+ {
+ int i;
+ for (i = 0; saved_argv[i]; i++)
+ while (!strcmp (saved_argv [i], demo_mode_switch))
+ {
+ int j;
+ for (j = i; saved_argv[j]; j++)
+ saved_argv [j] = saved_argv [j+1];
+ }
+ }
+}
+
+
+/* Re-execs the process with the arguments in saved_argv.
+ Does not return unless there was an error.
+ */
+static void
+restart_process_1 (saver_info *si)
+{
+ fflush (real_stdout);
+ fflush (real_stderr);
+ execvp (saved_argv [0], saved_argv); /* shouldn't return */
+ {
+ char buf [512];
+ sprintf (buf, "%s: could not restart process", blurb());
+ perror(buf);
+ fflush(stderr);
+ }
+ XBell(si->dpy, 0);
+}
+
+
+/* Re-execs the process with the arguments in saved_argv,
+ minus -initial-demo-mode.
+ Does not return unless there was an error.
+ */
+void
+restart_process (saver_info *si)
+{
+ hack_saved_argv (True);
+ restart_process_1 (si);
+}
+
+/* Re-execs the process with the arguments in saved_argv,
+ plus -initial-demo-mode.
+ Does not return unless there was an error.
+ */
+void
+demo_mode_restart_process (saver_info *si)
+{
+ hack_saved_argv (False);
+ restart_process_1 (si);