diff -u3r grx232.orig/chr/addfonts.sh grx232/chr/addfonts.sh
--- grx232.orig/chr/addfonts.sh	Tue Dec  5 17:50:18 2000
+++ grx232/chr/addfonts.sh	Tue Dec  5 17:43:44 2000
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+rm -f *.o
+gcc -O2 ../src/bgi/bin2c.c -o bin2c.exe 
+for x in *.chr; do
+	name=`basename $x | sed -e 's,\.chr,,g'`
+	./bin2c $x _${name}_font $name.c
+	gcc -c -O2 $name.c
+	rm $name.c
+done
+
+ar rc ../lib/dj2/libgrx20.a *.o
+rm -f *.o
diff -u3r grx232.orig/include/libbcc.h grx232/include/libbcc.h
--- grx232.orig/include/libbcc.h	Thu Jun 22 00:11:28 2000
+++ grx232/include/libbcc.h	Thu Nov 30 15:16:36 2000
@@ -370,6 +370,7 @@
 
 void     detectgraph(int *graphdriver,int *graphmode);
 void     initgraph(int *graphdriver, int *graphmode, char *pathtodriver);
+void     closegraph(void);
 void     setgraphmode(int mode);
 char    *getmodename( int mode_number );
 void     graphdefaults(void);
@@ -402,13 +403,13 @@
 void     setrgbpalette(int color, int red, int green, int blue);
 void     setusercharsize(int multx, int divx, int multy, int divy);
 void     setwritemode( int mode );
-void     outtext(char *textstring);
-void     outtextxy(int x, int y, char *textstring);
-int      textheight( char *textstring);
-int      textwidth( char  *textstring);
+void     outtext(const char *textstring);
+void     outtextxy(int x, int y, const char *textstring);
+int      textheight(const char *textstring);
+int      textwidth(const char  *textstring);
 
 int      registerbgifont(void *font);
-int      installuserfont(char *name);
+int      installuserfont(const char *name);
 
 int      getpalettesize(void);
 void     getpalette(struct palettetype  *palette);
@@ -427,6 +428,20 @@
 void     set_BGI_mode(int *graphdriver, int *graphmode);
 /*void   set_BGI_mode_whc() declared inline */
 void     __getrgbpalette(int color, int *red, int *green, int *blue);
+
+
+void     __gr_set_libbcc_init_hooks (
+                      int (*init) (void) ,
+                      int (*close) (void) );
+
+
+int     set_BGI_print_mode ( int mode , char * dest );
+
+extern unsigned char _dac_g256[][3];    /* 256 shading dac values */
+extern unsigned char _dac_normal[][3];  /* 256 standard colors    */
+
+extern void setrgbdefaults(void);
+extern void setrgbgray256(void);
 int      _ega_color(int egacol);
 
 
@@ -513,12 +528,6 @@
 }
 
 /* ----------------------------------------------------------------- */
-__inline__ static void closegraph(void) {
-  restorecrtmode();
-  __gr_INIT = FALSE;
-}
-
-/* ----------------------------------------------------------------- */
 __inline__ static int getgraphmode(void) {
   return (__gr_INIT ? __gr_Mode : (__gr_Result=grNoInitGraph));
 }
diff -u3r grx232.orig/src/bgi/bccgrx.c grx232/src/bgi/bccgrx.c
--- grx232.orig/src/bgi/bccgrx.c	Thu Jun 22 00:11:28 2000
+++ grx232/src/bgi/bccgrx.c	Thu Nov 30 14:47:16 2000
@@ -62,6 +62,10 @@
 int           __gr_TextLineStyle = 0;           /* use setlinestyle() while
 						   plotting .chr fonts      */
 
+int          (*__gr_initgraph_hook)(void)=NULL;  /* hook for overriding mode */
+                                                /* setting in initgraph     */
+int          (*__gr_closegraph_hook)(void)=NULL;
+
 GrPattern      __gr_fillpattern;                /* GRX filling settings     */
 GrLineOption   __gr_Line;                       /* GRX line settings        */
 
@@ -416,7 +420,13 @@
 /* ----------------------------------------------------------------- */
 void __gr_initgraph(int *graphdriver, int *graphmode) {
   ERR = grOk;
-  if (!__gr_INIT) {
+  if (__gr_initgraph_hook) {
+    (*__gr_initgraph_hook) ();
+    if (ERR != grOk) {
+      __gr_INIT = FALSE;
+      return;
+    }
+  } else if (!__gr_INIT) {
     __gr_set_up_modes();
     if (ERR != grOk) return;
     if ( *graphdriver != NATIVE_GRX || *graphmode < 0 || *graphmode > MM)
@@ -432,6 +442,31 @@
 		  else *graphdriver = NATIVE_GRX;
 }
 
+
+
+void closegraph(void)
+{
+  if (__gr_closegraph_hook) {
+    (*__gr_closegraph_hook) ();
+    __gr_initgraph_hook = NULL;
+    __gr_closegraph_hook = NULL;
+  } else
+  restorecrtmode();
+  __gr_INIT = FALSE;
+}
+
+
+
+void  __gr_set_libbcc_init_hooks (
+                      int (*init) (void) ,
+                      int (*close) (void) )
+{
+   __gr_initgraph_hook  = init;
+   __gr_closegraph_hook = close;
+}
+
+
+
 void initgraph(int *graphdriver, int *graphmode, char *pathtodriver) {
   __gr_initgraph(graphdriver, graphmode);
   strcpy(__gr_BGICHR, NULL_IS_EMPTY(pathtodriver));
diff -u3r grx232.orig/src/bgi/linkall.c grx232/src/bgi/linkall.c
--- grx232.orig/src/bgi/linkall.c	Thu Jun 22 00:11:30 2000
+++ grx232/src/bgi/linkall.c	Thu Nov 30 14:50:54 2000
@@ -1,5 +1,6 @@
 #include "libbcc.h"
 
-void main(void) {
+int main(void) {
   printf("Do nothing DUMMY !\n");
+  return 0;
 }
diff -u3r grx232.orig/src/bgi/palette.c grx232/src/bgi/palette.c
--- grx232.orig/src/bgi/palette.c	Thu Jun 22 00:11:30 2000
+++ grx232/src/bgi/palette.c	Thu Nov 30 15:31:46 2000
@@ -46,6 +46,7 @@
 {
 #ifdef __GO32__
 # include <dpmi.h>
+# include <go32.h>
   _go32_dpmi_registers regs;
 
   _DO_INIT_CHECK;
diff -u3r grx232.orig/src/bgi/polygonb.c grx232/src/bgi/polygonb.c
--- grx232.orig/src/bgi/polygonb.c	Thu Jun 22 00:11:30 2000
+++ grx232/src/bgi/polygonb.c	Thu Nov 30 14:55:52 2000
@@ -61,8 +61,10 @@
 	break;
     }
     if ( close && (x != sx || y != sy))
+    {
       if (fast) GrLine( x, y, sx, sy, LNE.lno_color);
 	   else GrCustomLine( x, y, sx, sy, &LNE);
+    }
   }
 }
 
diff -u3r grx232.orig/src/bgi/text.h grx232/src/bgi/text.h
--- grx232.orig/src/bgi/text.h	Thu Jun 22 00:11:30 2000
+++ grx232/src/bgi/text.h	Thu Nov 30 15:14:46 2000
@@ -117,9 +117,9 @@
 extern void __gr_text_bit(GrFont *fnt, int *xx, int *yy, int XX, int YY, int len, uchar *txt);
 extern int  __gr_text_ChrFontInfo(void *Font, CharInfo *fntptr, int *height);
 extern int  __gr_text_registerfont( int start, int stop, void *font);
-extern int  __gr_text_installfont( int start, int stop, char *name);
+extern int  __gr_text_installfont( int start, int stop, const char *name);
 
-extern int __gr_text_Width(int len, char  *txt);
-extern int __gr_text_Height(int len, char *txt);
+extern int __gr_text_Width(int len, const char  *txt);
+extern int __gr_text_Height(int len, const char *txt);
 
 #endif
diff -u3r grx232.orig/src/bgi/text1.c grx232/src/bgi/text1.c
--- grx232.orig/src/bgi/text1.c	Thu Jun 22 00:11:30 2000
+++ grx232/src/bgi/text1.c	Thu Nov 30 14:58:24 2000
@@ -67,7 +67,7 @@
   return i;
 }
 
-int __gr_text_installfont( int start, int stop, char *name)
+int __gr_text_installfont( int start, int stop, const char *name)
 {
   FILE *ff;
   long  size;
@@ -95,10 +95,10 @@
       ++temp;
     }
     if (!have_ext)
-      strcat(name, ".chr");
+      strcat(temp, ".chr");
   }
 
-  ff = fopen( name, "rb");
+  ff = fopen(temp, "rb");
   if (ff == NULL)
     return grFileNotFound;
   fseek( ff, 0, SEEK_END);
diff -u3r grx232.orig/src/bgi/text2.c grx232/src/bgi/text2.c
--- grx232.orig/src/bgi/text2.c	Thu Jun 22 00:11:30 2000
+++ grx232/src/bgi/text2.c	Thu Nov 30 15:01:08 2000
@@ -39,25 +39,25 @@
 
 /* ----------------------------------------------------------------- */
 
-int textheight(char *textstring)
+int textheight(const char *textstring)
 {
   _DO_INIT_CHECK_RV(0);
   __gr_text_init();
   if (TXT.font == DEFAULT_FONT)
     return 8*ZERO2ONE(TXT.charsize);
   if (TXT.font >= FirstGrxFont && TXT.font <= LastGrxFont)
-    return GRX_textheight(strlen(textstring), textstring);
+    return GRX_textheight(strlen(textstring), (char *) textstring);
   return __gr_text_height * __gr_text_multy / __gr_text_divy;
 }
 
 /* ----------------------------------------------------------------- */
 
-int __gr_text_Height(int len, char *txt) {
+int __gr_text_Height(int len, const char *txt) {
   _DO_INIT_CHECK_RV(0);
   __gr_text_init();
   if (TXT.font == DEFAULT_FONT)
     return 8*ZERO2ONE(TXT.charsize);
   if (TXT.font >= FirstGrxFont && TXT.font <= LastGrxFont)
-    return GRX_textheight(len, txt);
+    return GRX_textheight(len, (char *) txt);
   return __gr_text_height * __gr_text_multy / __gr_text_divy;
 }
diff -u3r grx232.orig/src/bgi/text3.c grx232/src/bgi/text3.c
--- grx232.orig/src/bgi/text3.c	Thu Jun 22 00:11:30 2000
+++ grx232/src/bgi/text3.c	Thu Nov 30 15:02:18 2000
@@ -32,7 +32,7 @@
 #include "text.h"
 
 /* ----------------------------------------------------------------- */
-int __gr_text_Width(int len, char  *txt) {
+int __gr_text_Width(int len, const char  *txt) {
   int sum;
 
   _DO_INIT_CHECK_RV(0);
@@ -42,7 +42,7 @@
   if (TXT.font >= FirstGrxFont && TXT.font <= LastGrxFont) {
     Style.txo_font = (GrFont *)Fonts[TXT.font];
     Style.txo_direct = GR_TEXT_RIGHT;
-    return GrStringWidth(txt, len, &Style);
+    return GrStringWidth((char *) txt, len, &Style);
   }
   sum = 0;
   while (len-- > 0)
@@ -52,7 +52,7 @@
 
 /* ----------------------------------------------------------------- */
 
-int textwidth( char *textstring) {
+int textwidth( const char *textstring) {
   return __gr_text_Width(strlen(textstring), textstring);
 }
 
diff -u3r grx232.orig/src/bgi/text7.c grx232/src/bgi/text7.c
--- grx232.orig/src/bgi/text7.c	Thu Jun 22 00:11:30 2000
+++ grx232/src/bgi/text7.c	Thu Nov 30 15:15:48 2000
@@ -33,7 +33,7 @@
 
 /* ----------------------------------------------------------------- */
 static void _outtextxy(int *xx, int *yy, int XX, int YY,
-				      int len, uchar *textstring)
+				      int len, const uchar *textstring)
 {
   _DO_INIT_CHECK;
   __gr_text_init();
@@ -47,23 +47,23 @@
 	  8*ZERO2ONE(TXT.charsize),
 	  8*ZERO2ONE(TXT.charsize),
 	  0, 0);
-    __gr_text_bit(DefaultFonts[TXT.charsize],xx,yy,XX,YY,len,textstring);
+    __gr_text_bit(DefaultFonts[TXT.charsize],xx,yy,XX,YY,len,(char *) textstring);
   } else
 #endif
   if (BITMAP(TXT.font))
-    __gr_text_bit((GrFont *)Fonts[TXT.font],xx,yy,XX,YY,len,textstring);
+    __gr_text_bit((GrFont *)Fonts[TXT.font],xx,yy,XX,YY,len,(char *) textstring);
   else
-    __gr_text_vec(xx,yy,XX,YY,len,textstring);
+    __gr_text_vec(xx,yy,XX,YY,len,(char *) textstring);
 }
 
 /* ----------------------------------------------------------------- */
-void outtext( char *textstring)
+void outtext(const char *textstring)
 {
   _outtextxy(&X, &Y, X+VL, Y+VT+PY, strlen(textstring), (uchar *)textstring);
 }
 
 /* ----------------------------------------------------------------- */
-void outtextxy(int x, int y, char *textstring)
+void outtextxy(int x, int y, const char *textstring)
 {
   _outtextxy( &x, &y, x+VL, y+VT+PY, strlen(textstring), (uchar *)textstring);
 }
diff -u3r grx232.orig/src/bgi/textd.c grx232/src/bgi/textd.c
--- grx232.orig/src/bgi/textd.c	Thu Jun 22 00:11:30 2000
+++ grx232/src/bgi/textd.c	Thu Nov 30 15:32:16 2000
@@ -32,7 +32,7 @@
 #include "text.h"
 
 #include <ctype.h>
-static void StrLwrCpy(char *d, char *s, int n)
+static void StrLwrCpy(char *d, const char *s, int n)
 {
   while (n-- > 0) {
     *(d++) = tolower(*s);
@@ -41,7 +41,7 @@
   *d = '\0';
 }
 
-static int _installgrxfont(int start, int stop, char *name)
+static int _installgrxfont(int start, int stop, const char *name)
 {
   __gr_text_init();
   while (start < stop && Fonts[start] != NULL) ++start;
@@ -51,23 +51,23 @@
   if ( name[0] == '@' && name[1] == ':')
     name += 2;
 #endif
-  Fonts[start] = (void *) GrLoadFont(name);
+  Fonts[start] = (void *) GrLoadFont((char *) name);
   if (Fonts[start] == NULL)
     return grFontNotFound;
   return start;
 }
 
-static int _installuserfont(int len, char *name)
+static int _installuserfont(int len, const char *name)
 {
   char loc_name[len+5];
 
   StrLwrCpy(loc_name, name, len);
   if (strstr(loc_name, ".fnt") != NULL)
-    return _installgrxfont( FirstGrxFont, LastGrxFont, name);
+    return _installgrxfont( FirstGrxFont, LastGrxFont, (char *) name);
   return __gr_text_installfont( FirstUserFont, LastUserFont, loc_name);
 }
 
-int installuserfont(char *name)
+int installuserfont(const char *name)
 {
   return _installuserfont(strlen(name), name);
 }
diff -u3r grx232.orig/src/include/libgrx.h grx232/src/include/libgrx.h
--- grx232.orig/src/include/libgrx.h	Wed May 20 13:11:44 1998
+++ grx232/src/include/libgrx.h	Thu Nov 30 14:30:40 2000
@@ -16,6 +16,10 @@
 #  define __USE_MISC
 #endif
 
+#ifdef _AIX
+#define _BIG_ENDIAN
+#endif
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff -u3r grx232.orig/src/makebase.dj grx232/src/makebase.dj
--- grx232.orig/src/makebase.dj	Thu Jun 22 16:07:08 2000
+++ grx232/src/makebase.dj	Tue Dec  5 17:38:48 2000
@@ -88,6 +88,8 @@
 
 ALL_O = $(STD_Oa) $(STD_Ob) $(BGI_Oa) $(BGI_Ob) $(DJ_O)
 
+VPATH=../chr
+
 all:    $(GRX20ST) ../bin/vesainfo.exe
 
 clean:
@@ -155,6 +157,7 @@
 $(ALL_O:.o=.dm) : %.dm : %.c
 	$(CC) -dM -E $(CCOPT) $(INCDIR) $*.c > $*.dm
 
+
 .c.s:
 	$(CC) -S $(CCOPT) $(INCDIR) $*.c -o $*.s
 
diff -u3r grx232.orig/src/makefile.lnx grx232/src/makefile.lnx
--- grx232.orig/src/makefile.lnx	Thu Jun 22 00:11:30 2000
+++ grx232/src/makefile.lnx	Tue Dec  5 17:53:24 2000
@@ -8,12 +8,16 @@
 INCDIR= -I. -I./include -I../include
 CCOPT += -DLFB_BY_NEAR_POINTER -pipe
 
+ifdef GRX_DEFAULT_FONT_PATH
+CCOPT += -DGRX_DEFAULT_FONT_PATH=$(GRX_DEFAULT_FONT_PATH)
+endif
+
 ifndef DEBUG
 CCOPT += -fomit-frame-pointer
 endif
 
-GRX20SHli = ../lib/$(GRX_LIB_SUBDIR)/libgrx20.so
-GRX20SHna = $(GRX20SHli).2.2.8
+GRX20SHli = ../lib/$(GRX_LIB_SUBDIR)/libgrx20.so.2
+GRX20SHna = $(GRX20SHli).2.3.2
 
 GRX20ST   = ../lib/$(GRX_LIB_SUBDIR)/libgrx20.a
 
diff -u3r grx232.orig/src/makefile.x11 grx232/src/makefile.x11
--- grx232.orig/src/makefile.x11	Sat Jun 24 16:50:14 2000
+++ grx232/src/makefile.x11	Tue Dec  5 17:53:18 2000
@@ -11,11 +11,15 @@
 
 INCDIR= -I. -I./include -I../include $(X11INCS)
 
-GRX20SHli = ../lib/$(GRX_LIB_SUBDIR)/libgrx20X.so
-GRX20SHna = $(GRX20SHli).2.2.8
+GRX20SHli = ../lib/$(GRX_LIB_SUBDIR)/libgrx20X.so.2
+GRX20SHna = $(GRX20SHli).2.3.2
 
 GRX20ST   = ../lib/$(GRX_LIB_SUBDIR)/libgrx20X.a
 
+ifdef GRX_DEFAULT_FONT_PATH
+CCOPT += -DGRX_DEFAULT_FONT_PATH=$(GRX_DEFAULT_FONT_PATH)
+endif
+
 ifdef SHARED
 CCOPT += -fPIC -D__SHARED__
 endif
diff -u3r grx232.orig/src/stdobjs.mak grx232/src/stdobjs.mak
--- grx232.orig/src/stdobjs.mak	Thu Jun 22 00:25:44 2000
+++ grx232/src/stdobjs.mak	Thu Nov 30 14:53:48 2000
@@ -220,6 +220,7 @@
 	$(OP)bgi/bar3d$(OX)	\
 	$(OP)bgi/bccgrx$(OX)	\
 	$(OP)bgi/bgimode$(OX)	\
+	$(OP)bgi/bgiprint$(OX)  \
 	$(OP)bgi/circle$(OX)	\
 	$(OP)bgi/clearvp$(OX)	\
 	$(OP)bgi/closegra$(OX)	\
diff -u3r grx232.orig/test/bgilink.c grx232/test/bgilink.c
--- grx232.orig/test/bgilink.c	Thu Jun 22 00:11:30 2000
+++ grx232/test/bgilink.c	Thu Nov 30 15:33:02 2000
@@ -39,7 +39,7 @@
     }
 }
 
-void main(void) {
+int main(void) {
    check_linked(restorecrtmode);
    check_linked(closegraph);
    check_linked(getgraphmode);
@@ -87,4 +87,5 @@
    check_linked(getactivepage);
    check_linked(setvisualpage);
    check_linked(getvisualpage);
+   return 0;
 }
diff -u3r grx232.orig/test/colortst.c grx232/test/colortst.c
--- grx232.orig/test/colortst.c	Thu Jun 22 00:11:30 2000
+++ grx232/test/colortst.c	Thu Nov 30 15:34:12 2000
@@ -98,7 +98,7 @@
 	  setgraphmode(oldmode);
 }
 
-void main(void)
+int main(void)
 {
   int gd, gm;
   int err;
@@ -120,4 +120,5 @@
   for ( ; gm <= himode; ++gm)
     testmode(gm);
   closegraph();
+  return 0;
 }
diff -u3r grx232.orig/test/tellipse.c grx232/test/tellipse.c
--- grx232.orig/test/tellipse.c	Thu Jun 22 00:11:30 2000
+++ grx232/test/tellipse.c	Thu Nov 30 15:34:36 2000
@@ -15,7 +15,7 @@
 #  include <conio.h>
 #endif
 
-void main(void)
+int main(void)
 {
   int  gd, gm;
   int  err;
@@ -43,4 +43,5 @@
     getch();
   }
   closegraph();
+  return 0;
 }
diff -u3r grx232.orig/test/tfill.c grx232/test/tfill.c
--- grx232.orig/test/tfill.c	Thu Jun 22 00:11:30 2000
+++ grx232/test/tfill.c	Thu Nov 30 15:34:50 2000
@@ -14,7 +14,7 @@
 #  include <conio.h>
 #endif
 
-void main(void)
+int main(void)
 {
   int gd, gm;
   int err;
@@ -35,4 +35,5 @@
   floodfill( 10, 10, WHITE);
   getch();
   closegraph();
+  return 0;
 }
diff -u3r grx232.orig/test/tmodes.c grx232/test/tmodes.c
--- grx232.orig/test/tmodes.c	Thu Jun 22 00:11:30 2000
+++ grx232/test/tmodes.c	Thu Nov 30 15:35:12 2000
@@ -26,7 +26,7 @@
 		      ETEST(drv,#drv,RES1024x768); \
 		      ETEST(drv,#drv,RES1280x1024)
 
-void main(void)
+int main(void)
 {
   int i;
 
@@ -98,4 +98,5 @@
   extended(VIDEO7II);
   extended(S3);
   extended(ATIGUP);
+  return 0;
 }
diff -u3r grx232.orig/test/ttext.c grx232/test/ttext.c
--- grx232.orig/test/ttext.c	Thu Jun 22 00:11:30 2000
+++ grx232/test/ttext.c	Thu Nov 30 15:35:34 2000
@@ -83,7 +83,7 @@
   user_info(fnt, sze);
 }
 
-void main(void)
+int main(void)
 {
   int gd, gm, x, y;
   int err;
@@ -149,4 +149,5 @@
 
   getch();
   closegraph();
+  return 0;
 }
