more overzealous refactoring undone
This commit is contained in:
41
src/lpt.c
41
src/lpt.c
@@ -17,36 +17,27 @@
|
|||||||
lpt_port_t lpt_ports[PARALLEL_MAX];
|
lpt_port_t lpt_ports[PARALLEL_MAX];
|
||||||
|
|
||||||
|
|
||||||
static const device_t lpt_none_device = {
|
|
||||||
"None",
|
|
||||||
"lpt_none",
|
|
||||||
0, 0,
|
|
||||||
NULL, NULL, NULL,
|
|
||||||
{ NULL }, NULL, NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
|
const char *internal_name;
|
||||||
const lpt_device_t *device;
|
const lpt_device_t *device;
|
||||||
} lpt_devices[] = {
|
} lpt_devices[] = {
|
||||||
{&lpt_none_device},
|
{"none", NULL},
|
||||||
{&dss_device},
|
{"dss", &dss_device},
|
||||||
{&lpt_dac_device},
|
{"lpt_dac", &lpt_dac_device},
|
||||||
{&lpt_dac_stereo_device},
|
{"lpt_dac_stereo", &lpt_dac_stereo_device},
|
||||||
{&lpt_prt_text_device},
|
{"text_prt", &lpt_prt_text_device},
|
||||||
{&lpt_prt_escp_device},
|
{"dot_matrix", &lpt_prt_escp_device},
|
||||||
{&lpt_prt_ps_device},
|
{"postscript", &lpt_prt_ps_device},
|
||||||
{&lpt_plip_device},
|
{"plip", &lpt_plip_device},
|
||||||
{&lpt_hasp_savquest_device},
|
{"dongle_savquest", &lpt_hasp_savquest_device},
|
||||||
{NULL}
|
{"", NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
lpt_device_get_name(int id)
|
lpt_device_get_name(int id)
|
||||||
{
|
{
|
||||||
if (strlen((char *) lpt_devices[id].device->internal_name) == 0)
|
if (strlen((char *) lpt_devices[id].internal_name) == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!lpt_devices[id].device)
|
if (!lpt_devices[id].device)
|
||||||
return "None";
|
return "None";
|
||||||
@@ -57,9 +48,9 @@ lpt_device_get_name(int id)
|
|||||||
char *
|
char *
|
||||||
lpt_device_get_internal_name(int id)
|
lpt_device_get_internal_name(int id)
|
||||||
{
|
{
|
||||||
if (strlen((char *) lpt_devices[id].device->internal_name) == 0)
|
if (strlen((char *) lpt_devices[id].internal_name) == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
return (char *) lpt_devices[id].device->internal_name;
|
return (char *) lpt_devices[id].internal_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -68,8 +59,8 @@ lpt_device_get_from_internal_name(char *s)
|
|||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
while (strlen((char *) lpt_devices[c].device->internal_name) != 0) {
|
while (strlen((char *) lpt_devices[c].internal_name) != 0) {
|
||||||
if (strcmp(lpt_devices[c].device->internal_name, s) == 0)
|
if (strcmp(lpt_devices[c].internal_name, s) == 0)
|
||||||
return c;
|
return c;
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user