22 |
#include <config.h> |
#include <config.h> |
23 |
#endif |
#endif |
24 |
|
|
25 |
|
#include <stdlib.h> |
26 |
#include <stdarg.h> |
#include <stdarg.h> |
27 |
#include <string.h> |
#include <string.h> |
28 |
|
|
42 |
putchar or any other output routine. Returns 0 if NAME is not a |
putchar or any other output routine. Returns 0 if NAME is not a |
43 |
valid output driver name, otherwise 1 on success. */ |
valid output driver name, otherwise 1 on success. */ |
44 |
int |
int |
45 |
output_init (char *name) |
output_init (const char *driver) |
46 |
{ |
{ |
47 |
|
const char *driver_cfg = NULL; |
48 |
|
|
49 |
if (output) |
if (output) |
50 |
{ |
{ |
51 |
output_deinit (); |
output_deinit (); |
52 |
output = 0; |
output = 0; |
53 |
} |
} |
54 |
|
|
55 |
if (name) |
if (driver) |
56 |
{ |
{ |
57 |
struct output_driver **out = &output_drivers[0]; |
struct output_driver **out = &output_drivers[0]; |
58 |
while (*out) |
while (*out) |
59 |
{ |
{ |
60 |
if (!strcmp (name, (*out)->name)) |
unsigned int name_len = strlen ((*out)->name); |
61 |
|
if (!strncmp (driver, (*out)->name, name_len)) |
62 |
{ |
{ |
63 |
output = *out; |
const char *cfg = driver + name_len; |
64 |
break; |
if (!*cfg || *cfg == ',') |
65 |
|
{ |
66 |
|
if (*cfg) |
67 |
|
driver_cfg = cfg + 1; |
68 |
|
output = *out; |
69 |
|
break; |
70 |
|
} |
71 |
} |
} |
72 |
out++; |
out++; |
73 |
} |
} |
78 |
output = output_drivers[0]; |
output = output_drivers[0]; |
79 |
|
|
80 |
if (output->init) |
if (output->init) |
81 |
(*output->init) (); |
(*output->init) (driver_cfg); |
82 |
|
|
83 |
return 1; |
return 1; |
84 |
} |
} |