2 * Copyright (C) 2000 Lennert Buytenhek
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <sys/errno.h>
25 #include "libbridge.h"
32 printf("Usage: brctl [commands]\n");
33 printf("commands:\n");
37 int main(int argc
, char *const* argv
)
39 const struct command
*cmd
;
41 static const struct option options
[] = {
42 { .name
= "help", .val
= 'h' },
43 { .name
= "version", .val
= 'V' },
47 while ((f
= getopt_long(argc
, argv
, "Vh", options
, NULL
)) != EOF
)
53 printf("%s, %s\n", PACKAGE_NAME
, PACKAGE_VERSION
);
56 fprintf(stderr
, "Unknown option '%c'\n", f
);
64 fprintf(stderr
, "can't setup bridge control: %s\n",
71 if ((cmd
= command_lookup(*argv
)) == NULL
) {
72 fprintf(stderr
, "never heard of command [%s]\n", argv
[1]);
76 if (argc
< cmd
->nargs
+ 1) {
77 printf("Incorrect number of arguments for command\n");
78 printf("Usage: brctl %s %s\n", cmd
->name
, cmd
->help
);
82 return cmd
->func(argc
, argv
);