Removed lcddriver.c (doesn't do anything, isn't in any makefiles, etc.).

Passed *every* piece of source in this project through indent. I'm setting
things up with ctags soon and am actually going to *gasp* use a nice
programming environment to continue development in. :)
This commit is contained in:
William Ferrell
2000-03-30 20:20:41 +00:00
parent 2222adcfbe
commit f5a5e9653b
88 changed files with 8207 additions and 8723 deletions
+97 -109
View File
@@ -32,34 +32,34 @@
char *progname = "irmanin";
char *codes[] = {
/* dummy */ NULL,
/* KeyToLcd */ "lcdproc-A",
/* KeyToLcd */ "lcdproc-B",
/* KeyToLcd */ "lcdproc-C",
/* KeyToLcd */ "lcdproc-D",
/* KeyToLcd */ "lcdproc-E",
/* KeyToLcd */ "lcdproc-F",
/* KeyToLcd */ "lcdproc-G",
/* KeyToLcd */ "lcdproc-H",
/* KeyToLcd */ "lcdproc-I",
/* KeyToLcd */ "lcdproc-J",
/* KeyToLcd */ "lcdproc-K",
/* KeyToLcd */ "lcdproc-L",
/* KeyToLcd */ "lcdproc-M",
/* KeyToLcd */ "lcdproc-N",
/* KeyToLcd */ "lcdproc-O",
/* KeyToLcd */ "lcdproc-P",
/* KeyToLcd */ "lcdproc-Q",
/* KeyToLcd */ "lcdproc-R",
/* KeyToLcd */ "lcdproc-S",
/* KeyToLcd */ "lcdproc-T",
/* KeyToLcd */ "lcdproc-U",
/* KeyToLcd */ "lcdproc-V",
/* KeyToLcd */ "lcdproc-W",
/* KeyToLcd */ "lcdproc-X",
/* KeyToLcd */ "lcdproc-Y",
/* KeyToLcd */ "lcdproc-Z",
/* end */ NULL
/* dummy */ NULL,
/* KeyToLcd */ "lcdproc-A",
/* KeyToLcd */ "lcdproc-B",
/* KeyToLcd */ "lcdproc-C",
/* KeyToLcd */ "lcdproc-D",
/* KeyToLcd */ "lcdproc-E",
/* KeyToLcd */ "lcdproc-F",
/* KeyToLcd */ "lcdproc-G",
/* KeyToLcd */ "lcdproc-H",
/* KeyToLcd */ "lcdproc-I",
/* KeyToLcd */ "lcdproc-J",
/* KeyToLcd */ "lcdproc-K",
/* KeyToLcd */ "lcdproc-L",
/* KeyToLcd */ "lcdproc-M",
/* KeyToLcd */ "lcdproc-N",
/* KeyToLcd */ "lcdproc-O",
/* KeyToLcd */ "lcdproc-P",
/* KeyToLcd */ "lcdproc-Q",
/* KeyToLcd */ "lcdproc-R",
/* KeyToLcd */ "lcdproc-S",
/* KeyToLcd */ "lcdproc-T",
/* KeyToLcd */ "lcdproc-U",
/* KeyToLcd */ "lcdproc-V",
/* KeyToLcd */ "lcdproc-W",
/* KeyToLcd */ "lcdproc-X",
/* KeyToLcd */ "lcdproc-Y",
/* KeyToLcd */ "lcdproc-Z",
/* end */ NULL
};
@@ -80,7 +80,8 @@ lcd_logical_driver *irmanin;
////////////////////////////////////////////////////////////
// init() should set up any device-specific stuff, and
// point all the function pointers.
int irmanin_init(struct lcd_logical_driver *driver, char *args)
int
irmanin_init (struct lcd_logical_driver *driver, char *args)
{
char device[256];
char *ptrdevice;
@@ -93,99 +94,85 @@ int irmanin_init(struct lcd_logical_driver *driver, char *args)
int argc, i, j;
char *filename;
ptrconfig=NULL;
ptrdevice=NULL;
ptrconfig = NULL;
ptrdevice = NULL;
irmanin = driver;
argc = get_args(argv, args, 64);
argc = get_args (argv, args, 64);
for(i=0; i<argc; i++)
{
for (i = 0; i < argc; i++) {
//printf("Arg(%i): %s\n", i, argv[i]);
if(0 == strcmp(argv[i], "-d") ||
0 == strcmp(argv[i], "--device"))
{
if(i + 1 > argc) {
fprintf(stderr, "irmanin_init: %s requires an argument\n",
argv[i]);
if (0 == strcmp (argv[i], "-d") || 0 == strcmp (argv[i], "--device")) {
if (i + 1 > argc) {
fprintf (stderr, "irmanin_init: %s requires an argument\n", argv[i]);
return -1;
}
strcpy(device, argv[++i]);
ptrdevice=device;
}
else if(0 == strcmp(argv[i], "-c") ||
0 == strcmp(argv[i], "--config"))
{
if(i + 1 > argc) {
fprintf(stderr, "irmanin_init: %s requires an argument\n",
argv[i]);
strcpy (device, argv[++i]);
ptrdevice = device;
} else if (0 == strcmp (argv[i], "-c") || 0 == strcmp (argv[i], "--config")) {
if (i + 1 > argc) {
fprintf (stderr, "irmanin_init: %s requires an argument\n", argv[i]);
return -1;
}
strcpy(config, argv[++i]);
ptrconfig=config;
}
else if(0 == strcmp(argv[i], "-h") ||
0 == strcmp(argv[i], "--help"))
{
printf("LCDproc IrMan input driver\n"
"\t-d\t--device\tSelect the input device to use\n"
"\t-d\t--config\tSelect the configuration file to use\n"
"\t-h\t--help\t\tShow this help information\n");
strcpy (config, argv[++i]);
ptrconfig = config;
} else if (0 == strcmp (argv[i], "-h") || 0 == strcmp (argv[i], "--help")) {
printf ("LCDproc IrMan input driver\n" "\t-d\t--device\tSelect the input device to use\n" "\t-d\t--config\tSelect the configuration file to use\n" "\t-h\t--help\t\tShow this help information\n");
return -1;
} else {
printf ("Invalid parameter: %s\n", argv[i]);
}
else
{
printf("Invalid parameter: %s\n", argv[i]);
}
}
if (ir_init_commands(ptrconfig, 1) < 0) {
fprintf(stderr, "error initialising commands: %s\n", strerror(errno));
exit(1);
}
portname = ir_default_portname();
if(portname==NULL){
if(ptrdevice==NULL){
portname=ptrdevice;
}else{
fprintf(stderr, "error no device defined\n");
exit(1);
}
if (ir_init_commands (ptrconfig, 1) < 0) {
fprintf (stderr, "error initialising commands: %s\n", strerror (errno));
exit (1);
}
portname = ir_default_portname ();
if (portname == NULL) {
if (ptrdevice == NULL) {
portname = ptrdevice;
} else {
fprintf (stderr, "error no device defined\n");
exit (1);
}
}
driver->getkey = irmanin_getkey;
driver->close = irmanin_close;
for (i=1; codes[i] != NULL; i++) {
if (ir_register_command(codes[i], i) < 0) {
if (errno == ENOENT) {
fprintf(stderr, "%s: no code set for `%s'\n", progname, codes[i]);
} else {
fprintf(stderr, "error registering `%s': `%s'\n", codes[i], strerror(errno));
}
}
for (i = 1; codes[i] != NULL; i++) {
if (ir_register_command (codes[i], i) < 0) {
if (errno == ENOENT) {
fprintf (stderr, "%s: no code set for `%s'\n", progname, codes[i]);
} else {
fprintf (stderr, "error registering `%s': `%s'\n", codes[i], strerror (errno));
}
}
}
errno = 0;
if (ir_init(portname) < 0) {
fprintf(stderr, "%s: error initialising Irman: `%s'\n", strerror(errno), portname);
exit(1);
errno = 0;
if (ir_init (portname) < 0) {
fprintf (stderr, "%s: error initialising Irman: `%s'\n", strerror (errno), portname);
exit (1);
}
return 1; // 200 is arbitrary. (must be 1 or more)
return 1; // 200 is arbitrary. (must be 1 or more)
}
void irmanin_close()
void
irmanin_close ()
{
if(irmanin->framebuf != NULL) free(irmanin->framebuf);
irmanin->framebuf = NULL;
if (irmanin->framebuf != NULL)
free (irmanin->framebuf);
ir_free_commands();
ir_finish();
irmanin->framebuf = NULL;
ir_free_commands ();
ir_finish ();
}
@@ -194,25 +181,26 @@ void irmanin_close()
//
// Return 0 for "nothing available".
//
char irmanin_getkey()
char
irmanin_getkey ()
{
int i;
int cmd;
char key;
int i;
int cmd;
char key;
key=(char)0;
switch (cmd=ir_poll_command()) {
case IR_CMD_ERROR:
fprintf(stderr, "%s: error reading command: %s\n", progname, strerror(errno));
key = (char) 0;
switch (cmd = ir_poll_command ()) {
case IR_CMD_ERROR:
fprintf (stderr, "%s: error reading command: %s\n", progname, strerror (errno));
break;
case IR_CMD_UNKNOWN:
case IR_CMD_UNKNOWN:
break;
default:
key=(char)('A'-1+cmd);
default:
key = (char) ('A' - 1 + cmd);
break;
}
}
return key;
return key;
}
/* end of irmanin.c */