summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1998-03-07 09:03:43 +0000
committerjkh <jkh@FreeBSD.org>1998-03-07 09:03:43 +0000
commit6617de6e25a6a575dab0e042bbc578d6ed399904 (patch)
treef8d39b2fa29cc35954a9714423851f07a14a7375 /usr.sbin
parent9e870e747ef0838534372a27df4565a3a85a199f (diff)
downloadFreeBSD-src-6617de6e25a6a575dab0e042bbc578d6ed399904.zip
FreeBSD-src-6617de6e25a6a575dab0e042bbc578d6ed399904.tar.gz
Add -I flag.
Submitted by: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/moused/moused.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/usr.sbin/moused/moused.c b/usr.sbin/moused/moused.c
index 2acf487..0b74614 100644
--- a/usr.sbin/moused/moused.c
+++ b/usr.sbin/moused/moused.c
@@ -46,7 +46,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: moused.c,v 1.15 1998/02/04 06:46:33 ache Exp $";
+ "$Id: moused.c,v 1.16 1998/03/06 03:09:31 yokota Exp $";
#endif /* not lint */
#include <err.h>
@@ -155,6 +155,7 @@ int nodaemon = FALSE;
int background = FALSE;
int identify = ID_NONE;
int extioctl = FALSE;
+char *pidfile = "/var/run/moused.pid";
/* local variables */
@@ -392,7 +393,7 @@ main(int argc, char *argv[])
int c;
int i;
- while((c = getopt(argc,argv,"3C:DF:PRS:cdfhi:l:m:p:r:st:z:")) != -1)
+ while((c = getopt(argc,argv,"3C:DF:I:PRS:cdfhi:l:m:p:r:st:z:")) != -1)
switch(c) {
case '3':
@@ -512,6 +513,10 @@ main(int argc, char *argv[])
}
break;
+ case 'I':
+ pidfile = optarg;
+ break;
+
case 'P':
rodent.flags |= NoPnP;
break;
@@ -645,6 +650,7 @@ moused(void)
mousestatus_t action2; /* mapped action */
fd_set fds;
u_char b;
+ FILE *fp;
if ((rodent.cfd = open("/dev/consolectl", O_RDWR, 0)) == -1)
logerr(1, "cannot open /dev/consolectl", 0);
@@ -654,6 +660,11 @@ moused(void)
logerr(1, "failed to become a daemon", 0);
} else {
background = TRUE;
+ fp = fopen(pidfile, "w");
+ if (fp != NULL) {
+ fprintf(fp, "%d\n", getpid());
+ fclose(fp);
+ }
}
/* clear mouse data */
OpenPOWER on IntegriCloud