+2006-10-02 Thiago Macieira <thiago@kde.org>
+
+ * tools/dbus-launch.c (main): make it complain and abort
+ execution in case an unknown option is given. Also, process
+ the '--' argument as the end of arguments.
+
2006-10-01 Havoc Pennington <hp@redhat.com>
* tools/dbus-launch.c (print_variables): if no syntax is given,
int bourne_shell_syntax = FALSE;
int auto_shell_syntax = FALSE;
int autolaunch = FALSE;
+ int requires_arg = FALSE;
int i;
int ret;
int bus_pid_to_launcher_pipe[2];
while (i < argc)
{
const char *arg = argv[i];
-
+
if (strcmp (arg, "--help") == 0 ||
strcmp (arg, "-h") == 0 ||
strcmp (arg, "-?") == 0)
else if (strcmp (arg, "--auto-syntax") == 0)
auto_shell_syntax = TRUE;
else if (strcmp (arg, "-c") == 0 ||
- strcmp (arg, "--csh-syntax") == 0)
+ strcmp (arg, "--csh-syntax") == 0)
c_shell_syntax = TRUE;
else if (strcmp (arg, "-s") == 0 ||
- strcmp (arg, "--sh-syntax") == 0)
+ strcmp (arg, "--sh-syntax") == 0)
bourne_shell_syntax = TRUE;
else if (strcmp (arg, "--binary-syntax") == 0)
- binary_syntax = TRUE;
+ binary_syntax = TRUE;
else if (strcmp (arg, "--version") == 0)
version ();
else if (strcmp (arg, "--exit-with-session") == 0)
autolaunch = TRUE;
save_machine_uuid (arg);
+ requires_arg = FALSE;
}
else if (strcmp (arg, "--autolaunch") == 0)
- ; /* wait for next arg */
+ requires_arg = TRUE;
else if (strstr (arg, "--config-file=") == arg)
{
const char *file;
}
config_file = xstrdup (arg);
+ requires_arg = FALSE;
}
else if (strcmp (arg, "--config-file") == 0)
- ; /* wait for next arg */
+ requires_arg = TRUE;
+ else if (arg[0] == '-')
+ {
+ if (strcmp (arg, "--") != 0)
+ {
+ fprintf (stderr, "Option `%s' is unknown.\n", arg);
+ exit (1);
+ }
+ else
+ {
+ runprog = argv[i+1];
+ remaining_args = i+2;
+ break;
+ }
+ }
else
{
runprog = arg;
++i;
}
+ if (requires_arg)
+ {
+ fprintf (stderr, "Option `%s' requires an argument.\n", prev_arg);
+ exit (1);
+ }
if (auto_shell_syntax)
{