1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-test-tool - D-Bus swiss army knife
4 * Copyright © 2003 Philip Blundell <philb@gnu.org>
5 * Copyright © 2011 Nokia Corporation
6 * Copyright © 2014 Collabora Ltd.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #include "test-tool.h"
31 #include <dbus/dbus.h>
35 int (*callback) (int, char **);
37 { "black-hole", dbus_test_tool_black_hole },
38 { "echo", dbus_test_tool_echo },
39 { "spam", dbus_test_tool_spam },
43 static void usage (int exit_with) _DBUS_GNUC_NORETURN;
51 "Usage: dbus-test-tool SUBCOMMAND [OPTIONS]\n"
53 "Known SUBCOMMANDs are:\n"
57 for (i = 0; subcommands[i].name != NULL; i++)
59 fprintf (stderr, "- %s\n", subcommands[i].name);
64 "For more information: dbus-test-tool SUBCOMMAND --help\n"
71 main (int argc, char **argv)
80 for (i = 0; subcommands[i].name != NULL; i++)
82 if (!strcmp (argv[1], subcommands[i].name))
83 return subcommands[i].callback (argc, argv);