[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <8a6d045c9214a4af84e7a3f186abe3e7af3fd3d4.1308547654.git.mfm@muteddisk.com>
Date: Sun, 19 Jun 2011 22:44:36 -0700
From: matt mooney <mfm@...eddisk.com>
To: Greg KH <greg@...ah.com>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 06/22] 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 <mfm@...eddisk.com>
---
drivers/staging/usbip/userspace/src/usbip.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/usbip/userspace/src/usbip.c b/drivers/staging/usbip/userspace/src/usbip.c
index 8940cd0..cdfe4c2 100644
--- a/drivers/staging/usbip/userspace/src/usbip.c
+++ b/drivers/staging/usbip/userspace/src/usbip.c
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <getopt.h>
+#include <syslog.h>
#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] <command> <args>\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;
--
1.7.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists