Don't use a compiler trick to initialize the conio library, because
authorEric S. Raymond <esr@thyrsus.com>
Fri, 4 Feb 2005 17:31:03 +0000 (17:31 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 4 Feb 2005 17:31:03 +0000 (17:31 +0000)
later we'll need to make the choice about whether or not to use it
at runtime.

conio.c
io.c

diff --git a/conio.c b/conio.c
index 27c38c3842786bcbe93d2aeb9134a649e4fc9bc4..9f51c31987f2ddd65d2ad7137a7a2bdc6bfdac87 100644 (file)
--- a/conio.c
+++ b/conio.c
@@ -31,7 +31,6 @@ char color_warning=1;
 int directvideo;
 WINDOW *conio_scr;
 
 int directvideo;
 WINDOW *conio_scr;
 
-#ifdef SERGEEV 
 /* Some internals... */
 static int colortab(int a) /* convert LINUX Color code to DOS-standard */
 {
 /* Some internals... */
 static int colortab(int a) /* convert LINUX Color code to DOS-standard */
 {
@@ -47,7 +46,6 @@ static int colortab(int a) /* convert LINUX Color code to DOS-standard */
    }
    return COLOR_BLACK;
 } 
    }
    return COLOR_BLACK;
 } 
-#endif /* SERGEEV */
 
 static void docolor (int color) /* Set DOS-like text mode colors */
 {
 
 static void docolor (int color) /* Set DOS-like text mode colors */
 {
@@ -61,9 +59,8 @@ static void docolor (int color) /* Set DOS-like text mode colors */
    wattron(conio_scr,COLOR_PAIR(1+(color&7)+((color&112)>>1))); 
 }
 
    wattron(conio_scr,COLOR_PAIR(1+(color&7)+((color&112)>>1))); 
 }
 
-#ifdef SERGEEV
 /* Call this before any call to linux conio - except the port functions ! */
 /* Call this before any call to linux conio - except the port functions ! */
-void __attribute__((constructor)) initconio (void) /* This is needed, because ncurses needs to be initialized */
+void initconio (void)
 {
    int x,y;
    short pair;
 {
    int x,y;
    short pair;
@@ -93,7 +90,6 @@ void __attribute__((constructor)) initconio (void) /* This is needed, because nc
    textcolor(7);
    textbackground(0);
 }
    textcolor(7);
    textbackground(0);
 }
-#endif /* SERGEEV */
 
 /* Call this on exiting your program */
 void doneconio (void)
 
 /* Call this on exiting your program */
 void doneconio (void)
diff --git a/io.c b/io.c
index e9cc3d7c102c77aa17f151ede5d81b33dbed86ce..9e66eb63034f8ed8635b6acbe2a2ce774c20b7d2 100644 (file)
--- a/io.c
+++ b/io.c
@@ -53,6 +53,7 @@ static void fastexit(int sig) {
 
 void iostart(int usecurses) {
 #ifdef SERGEEV
 
 void iostart(int usecurses) {
 #ifdef SERGEEV
+       initconio();
         textattr(7);
         clrscr();
         setwnd(FULLSCREEN_WINDOW);
         textattr(7);
         clrscr();
         setwnd(FULLSCREEN_WINDOW);