File: aaregist.c

package info (click to toggle)
aalib 1.4p5-50
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,504 kB
  • sloc: ansic: 10,394; sh: 7,789; makefile: 90
file content (56 lines) | stat: -rw-r--r-- 1,105 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <malloc.h>
#include "config.h"
#include "aalib.h"
#include "aaint.h"
__AA_CONST struct aa_driver * __AA_CONST aa_drivers[] =
{
#ifdef DJGPP
    &dos_d,
#else
#ifdef X11_DRIVER
    &X11_d,
#endif
#ifdef LINUX_DRIVER
    &linux_d,
#endif
#ifdef SLANG_DRIVER
    &slang_d,
#endif
#ifdef CURSES_DRIVER
    &curses_d,
#endif
#ifdef OS2_DRIVER
    &os2vio_d,
#endif
#endif
    &stdout_d,
    &stderr_d,
    NULL
};
aa_context *aa_autoinit(__AA_CONST struct aa_hardware_params *params)
{
    aa_context *context = NULL;
    int i = 0;
    char *t;
    while ((t = aa_getfirst(&aa_displayrecommended)) != NULL) {
	if (context == NULL) {
	    for (i = 0; aa_drivers[i] != NULL; i++) {
		if (!strcmp(t, aa_drivers[i]->name) || !strcmp(t, aa_drivers[i]->shortname)) {
		    context = aa_init(aa_drivers[i], params, NULL);
		    break;
		}
	    }
	    if (aa_drivers[i] == NULL)
		printf("Driver %s unknown", t);
	    free(t);
	}
    }
    i = 0;
    while (context == NULL) {
	if (aa_drivers[i] == NULL)
	    return NULL;
	context = aa_init(aa_drivers[i], params, NULL);
	i++;
    }
    return (context);
}