Deleted Added
full compact
moused.c (122605) moused.c (122630)
1/**
2 ** Copyright (c) 1995 Michael Smith, All rights reserved.
3 **
4 ** Redistribution and use in source and binary forms, with or without
5 ** modification, are permitted provided that the following conditions
6 ** are met:
7 ** 1. Redistributions of source code must retain the above copyright
8 ** notice, this list of conditions and the following disclaimer as

--- 32 unchanged lines hidden (view full) ---

41 ** The mouse interface functions are derived closely from the mouse
42 ** handler in the XFree86 X server. Many thanks to the XFree86 people
43 ** for their great work!
44 **
45 **/
46
47#ifndef lint
48static const char rcsid[] =
1/**
2 ** Copyright (c) 1995 Michael Smith, All rights reserved.
3 **
4 ** Redistribution and use in source and binary forms, with or without
5 ** modification, are permitted provided that the following conditions
6 ** are met:
7 ** 1. Redistributions of source code must retain the above copyright
8 ** notice, this list of conditions and the following disclaimer as

--- 32 unchanged lines hidden (view full) ---

41 ** The mouse interface functions are derived closely from the mouse
42 ** handler in the XFree86 X server. Many thanks to the XFree86 people
43 ** for their great work!
44 **
45 **/
46
47#ifndef lint
48static const char rcsid[] =
49 "$FreeBSD: head/usr.sbin/moused/moused.c 122605 2003-11-13 08:26:29Z des $";
49 "$FreeBSD: head/usr.sbin/moused/moused.c 122630 2003-11-13 21:25:12Z des $";
50#endif /* not lint */
51
52#include <ctype.h>
53#include <err.h>
54#include <errno.h>
55#include <fcntl.h>
56#include <limits.h>
57#include <stdio.h>

--- 438 unchanged lines hidden (view full) ---

496static int kidspad(u_char rxc, mousestatus_t *act);
497
498int
499main(int argc, char *argv[])
500{
501 int c;
502 int i;
503 int j;
50#endif /* not lint */
51
52#include <ctype.h>
53#include <err.h>
54#include <errno.h>
55#include <fcntl.h>
56#include <limits.h>
57#include <stdio.h>

--- 438 unchanged lines hidden (view full) ---

496static int kidspad(u_char rxc, mousestatus_t *act);
497
498int
499main(int argc, char *argv[])
500{
501 int c;
502 int i;
503 int j;
504 int retry;
504
505 for (i = 0; i < MOUSE_MAXBUTTON; ++i)
506 mstate[i] = &bstate[i];
507
508 while((c = getopt(argc,argv,"3C:DE:F:I:PRS:a:cdfhi:l:m:p:r:st:w:z:")) != -1)
509 switch(c) {
510
511 case '3':

--- 234 unchanged lines hidden (view full) ---

746
747 default:
748 if (rodent.portname)
749 break;
750 warnx("no port name specified");
751 usage();
752 }
753
505
506 for (i = 0; i < MOUSE_MAXBUTTON; ++i)
507 mstate[i] = &bstate[i];
508
509 while((c = getopt(argc,argv,"3C:DE:F:I:PRS:a:cdfhi:l:m:p:r:st:w:z:")) != -1)
510 switch(c) {
511
512 case '3':

--- 234 unchanged lines hidden (view full) ---

747
748 default:
749 if (rodent.portname)
750 break;
751 warnx("no port name specified");
752 usage();
753 }
754
755 retry = 1;
756 if (strncmp(rodent.portname, "/dev/ums", 8) == 0) {
757 if (kldload("ums") == -1 && errno != EEXIST)
758 logerr(1, "unable to load USB mouse driver");
759 retry = 5;
760 }
761
754 for (;;) {
755 if (setjmp(env) == 0) {
756 signal(SIGHUP, hup);
757 signal(SIGINT , cleanup);
758 signal(SIGQUIT, cleanup);
759 signal(SIGTERM, cleanup);
762 for (;;) {
763 if (setjmp(env) == 0) {
764 signal(SIGHUP, hup);
765 signal(SIGINT , cleanup);
766 signal(SIGQUIT, cleanup);
767 signal(SIGTERM, cleanup);
760 if ((rodent.mfd = open(rodent.portname, O_RDWR | O_NONBLOCK, 0))
761 == -1)
768 for (i = 0; i < retry; ++i) {
769 rodent.mfd = open(rodent.portname, O_RDWR | O_NONBLOCK);
770 if (rodent.mfd != -1 || errno != ENOENT)
771 break;
772 sleep(2);
773 }
774 if (rodent.mfd == -1)
762 logerr(1, "unable to open %s", rodent.portname);
763 if (r_identify() == MOUSE_PROTO_UNKNOWN) {
764 logwarnx("cannot determine mouse type on %s", rodent.portname);
765 close(rodent.mfd);
766 rodent.mfd = -1;
767 }
768
769 /* print some information */

--- 2205 unchanged lines hidden ---
775 logerr(1, "unable to open %s", rodent.portname);
776 if (r_identify() == MOUSE_PROTO_UNKNOWN) {
777 logwarnx("cannot determine mouse type on %s", rodent.portname);
778 close(rodent.mfd);
779 rodent.mfd = -1;
780 }
781
782 /* print some information */

--- 2205 unchanged lines hidden ---