1 #include <u.h> 2 #include <libc.h> 3 4 void usage(void)5usage(void) 6 { 7 fprint(2, "usage: aux/vmmousepoll [/mnt/vmware/mouse]\n"); 8 exits("usage"); 9 } 10 11 void main(int argc,char ** argv)12main(int argc, char **argv) 13 { 14 int fd; 15 char *file; 16 char buf[50]; 17 18 quotefmtinstall(); 19 ARGBEGIN{ 20 default: 21 usage(); 22 }ARGEND 23 24 switch(argc){ 25 default: 26 usage(); 27 case 0: 28 file = "/mnt/vmware/mouse"; 29 break; 30 case 1: 31 file = argv[0]; 32 break; 33 } 34 35 if((fd = open(file, OREAD)) < 0) 36 sysfatal("open %q: %r", file); 37 38 for(;;){ 39 sleep(250); 40 if(pread(fd, buf, sizeof buf, 0) < 0) 41 break; 42 } 43 exits(nil); 44 } 45