"Fossies" - the Fresh Open Source Software Archive 
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #include "gui.h"
2 #include "xlib.h"
3
4 #include <stdlib.h>
5 #include <string.h>
6
7 extern GUI *gui_text_description;
8 extern GUI *gui_gtk_description;
9
10 int gui_init(int *argc, char ***argv, const char *name) {
11 const GUI *g = NULL;
12
13 if(name) {
14 if(!strcasecmp(name, "text"))
15 g = gui_text_description;
16 else if(!strcasecmp(name, "gtk"))
17 g = gui_gtk_description;
18 else {
19 xerror("Error! Unknown interface: %s", gui);
20 xerror("Halting...");
21 return -1;
22 }
23 }
24
25 if(!g) {
26 char *disp;
27
28 /* If there's no display, we always go with text. */
29 disp = getenv("DISPLAY");
30 if(!disp) {
31 if(!gui_text_description) {
32 xerror("Error! No DISPLAY is set and no text support was compiled in!");
33 xerror("Halting...");
34 return -1;
35 }
36 g = gui_text_description;
37 }
38 else {
39 if(gui_gtk_description)
40 g = gui_gtk_description;
41 else if(gui_text_description)
42 g = gui_text_description;
43 else {
44 xerror("Error! No interface support was compiled in!");
45 xerror("Halting...");
46 return -1;
47 }
48 }
49 }
50 gui = *g;
51 gui.init(argc, argv);
52 return 0;
53 }
54