5751032 [rkeene@sledge /home/rkeene/devel/old/kbauthd]$ cat -n kbcheck.c
 1 /*
 2 
 3 */
 4 
 5 #include <stdio.h>
 6 #include <unistd.h>
 7 #include "kbd.h"
 8 #include "serial.h"
 9 #include "timefn.h"
10 
11 int COMBASE=0x2f8;
12 
13 
14 void exitcode(int code) {
15   switch (code) {
16   case 1:
17     printf("Unable to access serial port.\nYou must be \033[1mroot\033[0m to run this program.\n");
18     break;
19   case 2:
20     printf("Unable to access keyboard port.\nYou must be \033[1mroot\033[0m to run this program.\n");
21     break;
22   default:
23     printf("Error (%5i) occured, exiting...\n",code);
24   }
25   exit(code);
26 }
27 
28 
29 int main(void) {
30   if (ioperm(COMBASE, 16, 1)) exitcode(1);
31   if (ioperm(KBDBASE, 16, 1)) exitcode(2);
32   while(1) {
33     printf("%i\n",!checkplug());
34     usleep(500);
35   }
36   return(0);
37 }
5751033 [rkeene@sledge /home/rkeene/devel/old/kbauthd]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 1999-11-17 03:47:52