This patch documents the changes needed in djdev203 to resolve the name-clash
existing between the GNU gettext and the BORLAND-compatibility gettext functions.
This issue has been fixed in djdev204 so this patch is not required for
DJGPP 2.04 at all.
Apply the patch running the command:
   patch -p1 < conio.diffs
from the top srcdir.
The GNU gettext function is declared in libintl.h and the BORLAND-compatibility
gettext function is declared in conio.h. To resolve this name-clash, the gettext
function from conio.h and conio.c has been renamed into _conio_gettext.
In conio.h, a macro gettext, that will expand into _conio_gettext, has been
introduced. This macro expansion will be supressed if libintl.h is included
by the same source file. In this case, the BORLAND-compatibility function will
only be available as _conio_gettext.

This has the following concequences for the user:
1) The user wants to use BORLAND-compatibility gettext from conio.h only.
   In this case the user must include conio.h in the source file and the
   gettext keyword makes *always* reference to BORLAND-compatibility gettext.
   There are no user visible changes at all.
2) The user wants to use GNU gettext from libintl.h only.
   In this case the user must include libintl.h in the source file and the
   gettext keyword makes *always* reference to GNU gettext.
   There are no user visible changes at all.
3) The user wants to use both gettext functions in the same source file.
   In this case both headers, libintl.h and conio.h, must be included in the
   source file and the keyword gettext makes **always** reference to
   GNU gettext and **never** to BORLAND-compatibility gettext.
   To use the BORLAND-compatibility gettext in this case the user must use
   the keyword: _conio_gettext instead of gettext.

Regards,
Guerrero, Juan Manuel






diff -aprNU5 djgpp-2.03.orig/include/conio.h djgpp-2.03/include/conio.h
--- djgpp-2.03.orig/include/conio.h	1998-07-12 12:16:24 +0200
+++ djgpp-2.03/include/conio.h	2012-09-23 07:49:08 +0200
@@ -1,5 +1,7 @@
+/* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
+/* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #ifndef __dj_include_conio_h_
 #define __dj_include_conio_h_
 
@@ -7,10 +9,15 @@
 extern "C" {
 #endif
 
 #ifndef __dj_ENFORCE_ANSI_FREESTANDING
 
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
+  || !defined(__STRICT_ANSI__) || defined(__cplusplus)
+
+#endif /* (__STDC_VERSION__ >= 199901L) || !__STRICT_ANSI__ */
+
 #ifndef __STRICT_ANSI__
 
 #ifndef _POSIX_SOURCE
 
 
@@ -69,11 +76,11 @@ int     cprintf(const char *_format, ...
 int     cputs(const char *_str);
 int     cscanf(const char *_format, ...) __attribute__((format(scanf,1,2)));
 void    delline(void);
 int     getch(void);
 int     getche(void);
-int     gettext(int _left, int _top, int _right, int _bottom, void *_destin);
+int     _conio_gettext(int _left, int _top, int _right, int _bottom, void *_destin);
 void    gettextinfo(struct text_info *_r);
 void    gotoxy(int _x, int _y);
 void    gppconio_init(void);
 void    highvideo(void);
 void    insline(void);
@@ -96,10 +103,23 @@ void    window(int _left, int _top, int
 
 #define kbhit _conio_kbhit /* Who ever includes gppconio.h probably
                               also wants _conio_kbhit and not kbhit
                               from libc */
 
+/* This is to resolve the name clash between
+   gettext from conio.h and gettext from libintl.h.
+   IMPORTANT:
+   If both headers are included, the gettext keyword will always
+   make reference to the GNU gettext function declared in libintl.h
+   and never to the BORLAND-compatibility gettext function declared
+   in conio.h. In this case, BORLAND-compatibility gettext function
+   will only be available as _conio_gettext. */
+#ifndef __USE_GNU_GETTEXT
+# undef  gettext
+# define gettext _conio_gettext
+#endif
+
 #endif /* !_POSIX_SOURCE */
 #endif /* !__STRICT_ANSI__ */
 #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
 
 #ifndef __dj_ENFORCE_FUNCTION_CALLS
diff -aprNU5 djgpp-2.03.orig/src/libc/pc_hw/co80/conio.c djgpp-2.03/src/libc/pc_hw/co80/conio.c
--- djgpp-2.03.orig/src/libc/pc_hw/co80/conio.c	1999-06-03 13:27:36 +0200
+++ djgpp-2.03/src/libc/pc_hw/co80/conio.c	2014-01-09 19:35:42 +0100
@@ -88,11 +88,11 @@ puttext(int c, int r, int c2, int r2, vo
   }
   return 1;
 }
 
 int
-gettext(int c, int r, int c2, int r2, void *buf)
+_conio_gettext(int c, int r, int c2, int r2, void *buf)
 {
   short *cbuf = (short *)buf;
   /* we should check for valid parameters, and maybe return 0 */
   r--, r2--, c--, c2--;
   for (; r <= r2; r++)
@@ -729,11 +729,11 @@ cscanf(const char *fmt, ...)
 int
 movetext(int left, int top, int right, int bottom, int dleft, int dtop)
 {
   char    *buf = alloca((right - left + 1) * (bottom - top + 1) * 2);
   
-  gettext(left, top, right, bottom, buf);
+  _conio_gettext(left, top, right, bottom, buf);
   puttext(dleft, dtop, dleft + right - left, dtop + bottom - top, buf);
   return 1;
 }
 
 static void
