X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=utilities%2Fovs-appctl.c;h=cd059bf1cffa9bbfa995deb734f8805f2d045e4a;hb=6da1e8091eb2e19de7ba5e0c73ac3e7dd437743d;hp=7a3d91e5a01425e12501fa27882a1093ead502d0;hpb=65f92a50690e6f1dddbc11e95db7301343f1c018;p=sliver-openvswitch.git diff --git a/utilities/ovs-appctl.c b/utilities/ovs-appctl.c index 7a3d91e5a..cd059bf1c 100644 --- a/utilities/ovs-appctl.c +++ b/utilities/ovs-appctl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010 Nicira Networks. + * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,6 @@ main(int argc, char *argv[]) int i; set_program_name(argv[0]); - time_init(); /* Parse command line and connect to target. */ target = parse_command_line(argc, argv); @@ -66,6 +65,7 @@ main(int argc, char *argv[]) ovs_fatal(error, "%s: transaction error", target); } if (code / 100 != 2) { + fputs(reply, stderr); ovs_error(0, "%s: server returned reply code %03d", target, code); exit(2); } @@ -81,22 +81,23 @@ main(int argc, char *argv[]) static void usage(void) { - printf("%s, for querying and controlling Open vSwitch daemon\n" - "usage: %s [TARGET] COMMAND [ARG...]\n" - "Targets:\n" - " -t, --target=TARGET pidfile or socket to contact\n" - "Common commands:" - " help List commands supported by the target\n" - " vlog/list List current logging levels\n" - " vlog/set MODULE[:FACILITY[:LEVEL]]\n" - " Set MODULE and FACILITY log level to LEVEL\n" - " MODULE may be any valid module name or 'ANY'\n" - " FACILITY may be 'syslog', 'console', 'file', or 'ANY' (default)\n" - " LEVEL may be 'emer', 'err', 'warn', 'info', or 'dbg' (default)\n" - " vlog/reopen Make the program reopen its log file\n" - "Other options:\n" - " -h, --help Print this helpful information\n" - " -V, --version Display version information\n", + printf("\ +%s, for querying and controlling Open vSwitch daemon\n\ +usage: %s [TARGET] COMMAND [ARG...]\n\ +Targets:\n\ + -t, --target=TARGET pidfile or socket to contact\n\ +Common commands:\n\ + help List commands supported by the target\n\ + vlog/list List current logging levels\n\ + vlog/set MODULE[:FACILITY[:LEVEL]]\n\ + Set MODULE and FACILITY log level to LEVEL\n\ + MODULE may be any valid module name or 'ANY'\n\ + FACILITY may be 'syslog', 'console', 'file', or 'ANY' (default)\n\ + LEVEL may be 'off', 'emer', 'err', 'warn', 'info', or 'dbg' (default)\n\ + vlog/reopen Make the program reopen its log file\n\ +Other options:\n\ + -h, --help Print this helpful information\n\ + -V, --version Display version information\n", program_name, program_name); exit(EXIT_SUCCESS); } @@ -109,7 +110,7 @@ parse_command_line(int argc, char *argv[]) {"execute", no_argument, NULL, 'e'}, {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'V'}, - {0, 0, 0, 0}, + {NULL, 0, NULL, 0}, }; const char *target; int e_options; @@ -176,14 +177,14 @@ connect_to_target(const char *target) char *pidfile_name; pid_t pid; - pidfile_name = xasprintf("%s/%s.pid", ovs_rundir, target); + pidfile_name = xasprintf("%s/%s.pid", ovs_rundir(), target); pid = read_pidfile(pidfile_name); if (pid < 0) { ovs_fatal(-pid, "cannot read pidfile \"%s\"", pidfile_name); } free(pidfile_name); socket_name = xasprintf("%s/%s.%ld.ctl", - ovs_rundir, target, (long int) pid); + ovs_rundir(), target, (long int) pid); } else { socket_name = xstrdup(target); }