-.\" $OpenBSD: wsmoused.8,v 1.19 2013/07/16 11:13:34 schwarze Exp $
+.\" $OpenBSD: wsmoused.8,v 1.20 2015/10/26 09:58:18 deraadt Exp $
.\"
.\" Copyright (c) 2001 Jean-Baptiste Marchand
.\" All rights reserved.
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: July 16 2013 $
+.Dd $Mdocdate: October 26 2015 $
.Dt WSMOUSED 8 i386
.Os
.Sh NAME
.Op Fl 2dfi
.Op Fl C Ar thresh
.Op Fl D Ar device
-.Op Fl I Ar file
.Oo
.Fl M
.Ar N Ns = Ns Ar M
.It Fl f
Do not become a daemon and instead run as a foreground process.
Useful for testing and debugging.
-.It Fl I Ar file
-Write the process ID of
-.Nm
-to the specified
-.Ar file .
.It Fl i
Print the type and the protocol of the mouse and exit.
.It Fl M Ar N Ns = Ns Ar M
-/* $OpenBSD: wsmoused.c,v 1.35 2014/12/23 10:24:22 shadchin Exp $ */
+/* $OpenBSD: wsmoused.c,v 1.36 2015/10/26 09:58:18 deraadt Exp $ */
/*
* Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon
#include "wsmoused.h"
#define DEFAULT_TTY "/dev/ttyCcfg"
-#define DEFAULT_PIDFILE "/var/run/wsmoused.pid"
extern char *__progname;
extern char *mouse_names[];
int background = FALSE;
int nodaemon = FALSE;
int identify = FALSE;
-char *pidfile = NULL;
mouse_t mouse = {
.flags = 0,
close(mouse.mfd);
mouse.mfd = -1;
}
- if (pidfile != NULL)
- unlink(pidfile);
_exit(0);
}
static void
usage(void)
{
- fprintf(stderr, "usage: %s [-2dfi] [-C thresh] [-D device] [-I file]"
+ fprintf(stderr, "usage: %s [-2dfi] [-C thresh] [-D device]"
" [-M N=M]\n\t[-p device] [-t type]\n", __progname);
exit(1);
}
int
main(int argc, char **argv)
{
- FILE *fp;
unsigned int type;
int opt;
int i;
-#define GETOPT_STRING "2dfhip:t:C:D:I:M:"
+#define GETOPT_STRING "2dfhip:t:C:D:M:"
while ((opt = (getopt(argc, argv, GETOPT_STRING))) != -1) {
switch (opt) {
case '2':
if ((mouse.ttyname = strdup(optarg)) == NULL)
logerr(1, "out of memory");
break;
- case 'I':
- pidfile = optarg;
- break;
case 'M':
if (!mouse_installmap(optarg)) {
warnx("invalid mapping `%s'", optarg);
logerr(1, "failed to become a daemon");
} else {
background = TRUE;
- if (pidfile != NULL) {
- fp = fopen(pidfile, "w");
- if (fp != NULL) {
- fprintf(fp, "%ld\n", (long)getpid());
- fclose(fp);
- }
- }
}
}
-/* $OpenBSD: wsmoused.h,v 1.11 2014/05/14 18:23:22 shadchin Exp $ */
+/* $OpenBSD: wsmoused.h,v 1.12 2015/10/26 09:58:18 deraadt Exp $ */
/*
* Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon
/* Logging macros */
-extern char *pidfile;
-
#define debug(fmt, ...) \
if (debug&&nodaemon) printf(fmt, __VA_ARGS__)
#define logerr(e, ...) \
do { \
- if (pidfile != NULL) \
- unlink(pidfile); \
if (background) { \
syslog(LOG_ERR, __VA_ARGS__); \
exit(e); \