Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/usbhidaction Add an optional '-p pidfil...



details:   https://anonhg.NetBSD.org/src/rev/39fa8c7cb29e
branches:  trunk
changeset: 319065:39fa8c7cb29e
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue May 15 01:41:29 2018 +0000
description:
Add an optional '-p pidfile' parameter.

diffstat:

 usr.bin/usbhidaction/usbhidaction.1 |  13 +++++++++++--
 usr.bin/usbhidaction/usbhidaction.c |  14 +++++++++-----
 2 files changed, 20 insertions(+), 7 deletions(-)

diffs (103 lines):

diff -r ca38b4a8162d -r 39fa8c7cb29e usr.bin/usbhidaction/usbhidaction.1
--- a/usr.bin/usbhidaction/usbhidaction.1       Tue May 15 01:26:45 2018 +0000
+++ b/usr.bin/usbhidaction/usbhidaction.1       Tue May 15 01:41:29 2018 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: usbhidaction.1,v 1.15 2008/04/30 13:11:01 martin Exp $
+.\" $NetBSD: usbhidaction.1,v 1.16 2018/05/15 01:41:29 jmcneill Exp $
 .\"
 .\" Copyright (c) 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 20, 2004
+.Dd May 14, 2018
 .Dt USBHIDACTION 1
 .Os
 .Sh NAME
@@ -39,6 +39,7 @@
 .Op Fl d
 .Op Fl i
 .Fl f Ar device
+.Op Fl p Ar pidfile
 .Op Fl t Ar table
 .Op Fl v
 .Op Ar arg ...
@@ -69,6 +70,14 @@
 path, it is taken to be the name of the device under
 .Pa /dev .
 An absolute path is taken to be the literal device pathname.
+.It Fl p Ar pidfile
+Writes a file containing the process ID of the program.
+The file name has the form
+.Pa /var/run/usbhidaction.pid .
+If the option is not given,
+.Ar pidfile
+defaults to
+.Pa usbhidaction .
 .It Fl t Ar table
 Specify a path name for the HID usage table file.
 .It Fl v
diff -r ca38b4a8162d -r 39fa8c7cb29e usr.bin/usbhidaction/usbhidaction.c
--- a/usr.bin/usbhidaction/usbhidaction.c       Tue May 15 01:26:45 2018 +0000
+++ b/usr.bin/usbhidaction/usbhidaction.c       Tue May 15 01:41:29 2018 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: usbhidaction.c,v 1.28 2017/12/10 20:38:14 bouyer Exp $ */
+/*      $NetBSD: usbhidaction.c,v 1.29 2018/05/15 01:41:29 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: usbhidaction.c,v 1.28 2017/12/10 20:38:14 bouyer Exp $");
+__RCSID("$NetBSD: usbhidaction.c,v 1.29 2018/05/15 01:41:29 jmcneill Exp $");
 #endif
 
 #include <stdio.h>
@@ -95,13 +95,14 @@
        struct command *cmd;
        int reportid;
        const char *table = NULL;
+       const char *pidfn = NULL;
 
        setprogname(argv[0]);
        (void)setlinebuf(stdout);
 
        demon = 1;
        ignore = 0;
-       while ((ch = getopt(argc, argv, "c:df:it:v")) != -1) {
+       while ((ch = getopt(argc, argv, "c:df:ip:t:v")) != -1) {
                switch(ch) {
                case 'c':
                        conf = optarg;
@@ -115,6 +116,9 @@
                case 'f':
                        dev = optarg;
                        break;
+               case 'p':
+                       pidfn = optarg;
+                       break;
                case 't':
                        table = optarg;
                        break;
@@ -169,7 +173,7 @@
        if (demon) {
                if (daemon(0, 0) < 0)
                        err(EXIT_FAILURE, "daemon()");
-               (void)pidfile(NULL);
+               (void)pidfile(pidfn);
                isdemon = 1;
        }
 
@@ -214,7 +218,7 @@
 {
 
        (void)fprintf(stderr, "usage: %s -c config_file [-d] -f hid_dev "
-               "[-i] [-t table] [-v]\n", getprogname());
+               "[-i] [-p pidfile] [-t table] [-v]\n", getprogname());
        exit(EXIT_FAILURE);
 }
 



Home | Main Index | Thread Index | Old Index