X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ovsdb%2Fovsdb-client.c;h=67d09cbdc209908b6b83830b27c8c3608532ddfd;hb=a91da17ea6f910863c2a771ebfa4100bbad3f481;hp=d5d2189ed7e88091fe9b4a9a7415960d01807eb6;hpb=91ae5bece01cfe69741f9e284d0ccf78fce87eb0;p=sliver-openvswitch.git diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index d5d2189ed..67d09cbdc 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ #include -#include #include #include #include @@ -70,7 +69,7 @@ static bool timestamp; /* Format for table output. */ static struct table_style table_style = TABLE_STYLE_DEFAULT; -static const struct ovsdb_client_command all_commands[]; +static const struct ovsdb_client_command *get_all_commands(void); static void usage(void) NO_RETURN; static void parse_options(int argc, char *argv[]); @@ -93,7 +92,7 @@ main(int argc, char *argv[]) ovs_fatal(0, "missing command name; use --help for help"); } - for (command = all_commands; ; command++) { + for (command = get_all_commands(); ; command++) { if (!command->name) { VLOG_FATAL("unknown command '%s'; use --help for help", argv[optind]); @@ -167,7 +166,7 @@ parse_options(int argc, char *argv[]) DAEMON_OPTION_ENUMS, TABLE_OPTION_ENUMS }; - static struct option long_options[] = { + static const struct option long_options[] = { {"verbose", optional_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'V'}, @@ -393,6 +392,7 @@ fetch_dbs(struct jsonrpc *rpc, struct svec *dbs) svec_add(dbs, name->u.string); } jsonrpc_msg_destroy(reply); + svec_sort(dbs); } static void @@ -405,7 +405,6 @@ do_list_dbs(struct jsonrpc *rpc, const char *database OVS_UNUSED, svec_init(&dbs); fetch_dbs(rpc, &dbs); - svec_sort(&dbs); SVEC_FOR_EACH (i, db_name, &dbs) { puts(db_name); } @@ -998,3 +997,8 @@ static const struct ovsdb_client_command all_commands[] = { { NULL, 0, 0, 0, NULL }, }; + +static const struct ovsdb_client_command *get_all_commands(void) +{ + return all_commands; +}