2007-08-29 Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	Replace the actual hard coded default man paths with paths that reflect
	the current version of the DJGPP installation tree layout.

	* Makefile: Add install target and the required directores and prefix.

	* man.c: [__DJGPP__]: New macros MANPATH1, MANPATH2 and MANPATH3.
	If compiling with djdev203 or later use the "/dev/env" functionality
	to define the default prefixes for the man path.
	(main) [__DJGPP__]:  Construct the man path using the defaults given
	by MANPATH1, MANPATH2 and MANPATH3.
	If the MANPATH environment variable does not point to all standard man
	directories add the missing ones.




diff -aprNU5 man-1.3.orig/ChangeLog man-1.3/ChangeLog
--- man-1.3.orig/ChangeLog	2000-02-19 13:07:02 +0000
+++ man-1.3/ChangeLog	2007-08-29 22:59:14 +0000
@@ -1,5 +1,21 @@
+2007-08-29 Juan Manuel Guerrero  <juan.guerrero@gmx.de>
+
+	Replace the actual hard coded default man paths with paths that reflect
+	the current version of the DJGPP installation tree layout.
+
+	* Makefile: Add install target and the required directores and prefix.
+
+	* man.c: [__DJGPP__]: New macros MANPATH1, MANPATH2 and MANPATH3.
+	If compiling with djdev203 or later use the "/dev/env" functionality
+	to define the default prefixes for the man path.
+	(main) [__DJGPP__]:  Construct the man path using the defaults given
+	by MANPATH1, MANPATH2 and MANPATH3.
+	If the MANPATH environment variable does not point to all standard man
+	directories add the missing ones.
+
+
 2000-02-19  Eli Zaretskii  <eliz@is.elta.co.il>
 
 	Version 1.3:
 
 	* man.nro: New file.
diff -aprNU5 man-1.3.orig/Makefile man-1.3/Makefile
--- man-1.3.orig/Makefile	1997-10-19 18:04:02 +0000
+++ man-1.3/Makefile	2007-08-29 22:59:14 +0000
@@ -1,8 +1,24 @@
 # Makefile to build the man clone.
 
+SHELL = /bin/sh
+
+prefix = /dev/env/DJDIR
+bindir = ${prefix}/bin
+mandir = ${prefix}/share/man/man1
+
+INSTALL_PROGRAM = /dev/env/DJDIR/bin/install.exe
+
+exeext = .exe
+
 CC = gcc
 CFLAGS = -Wall -O2 -g
 
 default: man
 
 man: man.c
+
+install: man
+	${INSTALL_PROGRAM} -d ${bindir}
+	${INSTALL_PROGRAM} man${exeext} ${bindir}/man${exeext}
+	${INSTALL_PROGRAM} -d ${mandir}
+	${INSTALL_PROGRAM} man.1 ${mandir}/man.1
diff -aprNU5 man-1.3.orig/man.c man-1.3/man.c
--- man-1.3.orig/man.c	2000-02-19 12:57:44 +0000
+++ man-1.3/man.c	2007-08-29 22:59:14 +0000
@@ -91,11 +91,20 @@ static const char *version = "1.3";
 /* The .exe suffix in program names is so we get better diagnostics
    from `system' library function when the shell is COMMAND.COM.  */
 static char *pager    = "less.exe -c";
 static char *groff    = "groff.exe -man -Tascii";
 # ifdef __DJGPP__
-static char *manpath  = "c:/djgpp/man;c:/djgpp/info;/usr/man";
+#  if __DJGPP__ == 2 && __DJGPP_MINOR__ >= 3
+#   define MANPATH1     "/share/man;"
+#   define MANPATH2     "/man;"
+#   define MANPATH3     "/info"
+static char *manpath  = "/dev/env/DJDIR"MANPATH1 \
+                        "/dev/env/DJDIR"MANPATH2 \
+                        "/dev/env/DJDIR"MANPATH3;
+#  else
+static char *manpath  = "c:/djgpp/share/man;c:/djgpp/man;c:/djgpp/info;/usr/man";
+#  endif
 # else
 static char *manpath  = "/man;/usr/man";
 # endif
 # define PATH_SEP	';'
 # define IS_DIR_SEP(x)	((x) == '/' || (x) == '\\')
@@ -777,28 +786,43 @@ The path to look for man pages is:\n\
 int
 main (int argc, char *argv[])
 {
   char *use_pager = getenv ("PAGER");
   char *use_manpath = getenv ("MANPATH");
+#ifdef __DJGPP__
+  char *djdir = getenv ("DJDIR");
+  int   djdir_exists = djdir && __file_exists (djdir) ? 1 : 0;
+#endif
 
   if (use_pager)
     pager = use_pager;
   if (use_manpath)
-    manpath = use_manpath;
+    {
+      manpath = use_manpath;
+#ifdef __DJGPP__
+      if ((strstr (manpath, MANPATH1) == NULL) && djdir_exists)
+        {
+          char *djmanpath = xmalloc (strlen (djdir) + sizeof(MANPATH1) + strlen (manpath) + 1);
+      
+          strcat (strcpy (djmanpath, djdir), MANPATH1);
+          strcat (djmanpath, manpath);
+          manpath = djmanpath;
+        }
+#endif
+    }
 #ifdef __DJGPP__
   else
     {
-      char *djdir = getenv ("DJDIR");
-
-      if (djdir && __file_exists (djdir))
-	{
-	  char *djmanpath = (char *)xmalloc (2*strlen (djdir) + 10 + 1);
-
-	  strcat (strcpy (djmanpath, djdir), "/man;");
-	  strcat (strcat (djmanpath, djdir), "/info");
-	  manpath = djmanpath;
-	}
+      if (djdir_exists)
+        {
+          char *djmanpath = xmalloc (3 * strlen (djdir) + sizeof(MANPATH1) + sizeof(MANPATH2) + sizeof(MANPATH3) + 1);
+
+          strcat (strcpy (djmanpath, djdir), MANPATH1);
+          strcat (strcat (djmanpath, djdir), MANPATH2);
+          strcat (strcat (djmanpath, djdir), MANPATH3);
+          manpath = djmanpath;
+        }
     }
 #endif
   progname = argv[0];
   if (argc == 1)
     return usage ();
