From: matt mooney Date: Mon, 20 Jun 2011 05:44:36 +0000 (-0700) Subject: staging: usbip: userspace: usbip.c: add log option X-Git-Tag: Ubuntu-5.13.0-19.19~26717^2~111 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=c93be5b178ca7f3f4599da7a26a5828ab36aafb4;p=mirror_ubuntu-jammy-kernel.git staging: usbip: userspace: usbip.c: add log option Add option for logging with syslog, and default to use stderr for error and info messages. Signed-off-by: matt mooney Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/usbip/userspace/src/usbip.c b/drivers/staging/usbip/userspace/src/usbip.c index 8940cd0ae6b7..cdfe4c2d9cbe 100644 --- a/drivers/staging/usbip/userspace/src/usbip.c +++ b/drivers/staging/usbip/userspace/src/usbip.c @@ -23,6 +23,7 @@ #include #include +#include #include "usbip_common.h" #include "usbip.h" @@ -33,7 +34,7 @@ static int usbip_version(int argc, char *argv[]); static const char usbip_version_string[] = PACKAGE_STRING; static const char usbip_usage_string[] = - "usbip [--debug] [version]\n" + "usbip [--debug] [--log] [version]\n" " [help] \n"; static void usbip_usage(void) @@ -138,12 +139,15 @@ int main(int argc, char *argv[]) { static const struct option opts[] = { { "debug", no_argument, NULL, 'd' }, - { NULL, 0, NULL, 0 } + { "log", no_argument, NULL, 'l' }, + { NULL, 0, NULL, 0 } }; + char *cmd; int opt; int i, rc = -1; + usbip_use_stderr = 1; opterr = 0; for (;;) { opt = getopt_long(argc, argv, "+d", opts, NULL); @@ -154,7 +158,10 @@ int main(int argc, char *argv[]) switch (opt) { case 'd': usbip_use_debug = 1; - usbip_use_stderr = 1; + break; + case 'l': + usbip_use_syslog = 1; + openlog("", LOG_PID, LOG_USER); break; default: goto err_out;