summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner LEMBERG <wl@gnu.org>2000-11-13 16:51:32 +0000
committerWerner LEMBERG <wl@gnu.org>2000-11-13 16:51:32 +0000
commit07f95f1674217275ed4612f1dcaa95a88435c6a7 (patch)
tree250ed3c7acd72939953029a037f74b11c5ec291c
parent27ab6f3035b996e0c81cdb35dc2dcca1be8055db (diff)
downloadgroff-git-07f95f1674217275ed4612f1dcaa95a88435c6a7.tar.gz
For security reasons, don't use the current directory but the home
directory while searching and scanning troffrc and troffrc-end. Similarly, replace the current directory with the home directory in the font path. * Makefile.in (fontpath, tmacpath): Remove current directory. * src/libs/libgroff/searchpath.cc (search_path::search_path): Add two parameters `add_home' and `add_current'. (search_path::~search_path, search_path::command_line_dir, search_path::open_file): Remove tests for `dirs' being zero. * src/include/searchpath.h: Adjust. * src/libs/libgroff/macropath.cc, src/include/macropath.h: Add `safer_macro_path'. * src/libs/libgroff/fontfile.cc: Adjust `font_path'. * src/roff/troff/troff.h: Add `searchpath.h' and `mac_path'. * src/roff/troff/input.cc: Use `mac_path', initialized with `macro_path'. (process_startup_file): Set `mac_path' to `safer_macro_path'. * src/roff/troff/env.cc: Use `mac_path'. * src/preproc/eqn/main.cc (main): Use `safer_macro_path'. * NEWS, man/roff.man, src/roff/troff/troff.man, src/rof/groff/groff.man, tmac/groff_tmac.man, arch/djgpp/README: Updated. * src/include/lib.h: Don't include groff-getopt.h for OSF/1. * aclocal.m4 (GROFF_SYS_ERRLIST): Do test in C, not in C++. * configure.in: Fix typo in comment. * configure: Regenerated. * src/libgroff/*, src/include/*, src/roff/troff/*: Fixing copyright dates.
-rw-r--r--ChangeLog41
-rw-r--r--Makefile.in7
-rw-r--r--NEWS16
-rw-r--r--aclocal.m47
-rw-r--r--arch/djgpp/README4
-rwxr-xr-xconfigure121
-rwxr-xr-xconfigure.in2
-rw-r--r--man/roff.man9
-rw-r--r--src/include/driver.h2
-rw-r--r--src/include/lib.h4
-rw-r--r--src/include/macropath.h3
-rw-r--r--src/include/searchpath.h5
-rw-r--r--src/libs/libgroff/errarg.cc2
-rw-r--r--src/libs/libgroff/font.cc2
-rw-r--r--src/libs/libgroff/fontfile.cc2
-rw-r--r--src/libs/libgroff/getcwd.c19
-rwxr-xr-xsrc/libs/libgroff/htmlindicate.cc2
-rw-r--r--src/libs/libgroff/iftoa.c2
-rwxr-xr-xsrc/libs/libgroff/illegal.cc19
-rw-r--r--src/libs/libgroff/itoa.c2
-rw-r--r--src/libs/libgroff/macropath.cc5
-rw-r--r--src/libs/libgroff/nametoindex.cc2
-rw-r--r--src/libs/libgroff/searchpath.cc82
-rw-r--r--src/libs/libgroff/strtol.c2
-rw-r--r--src/libs/libgroff/tmpfile.cc2
-rw-r--r--src/preproc/eqn/main.cc2
-rw-r--r--src/roff/groff/groff.man6
-rw-r--r--src/roff/troff/column.cc2
-rw-r--r--src/roff/troff/div.cc2
-rw-r--r--src/roff/troff/env.cc5
-rw-r--r--src/roff/troff/env.h2
-rw-r--r--src/roff/troff/input.cc20
-rw-r--r--src/roff/troff/node.cc2
-rw-r--r--src/roff/troff/node.h2
-rw-r--r--src/roff/troff/reg.cc2
-rw-r--r--src/roff/troff/reg.h2
-rw-r--r--src/roff/troff/request.h2
-rw-r--r--src/roff/troff/troff.h5
-rw-r--r--src/roff/troff/troff.man49
-rwxr-xr-xtmac/groff_tmac.man49
40 files changed, 316 insertions, 200 deletions
diff --git a/ChangeLog b/ChangeLog
index c7232b5ea..815499fcc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,44 @@
+2000-11-13 Werner LEMBERG <wl@gnu.org>
+
+ For security reasons, don't use the current directory but the home
+ directory while searching and scanning troffrc and troffrc-end.
+ Similarly, replace the current directory with the home directory
+ in the font path.
+
+ * Makefile.in (fontpath, tmacpath): Remove current directory.
+
+ * src/libs/libgroff/searchpath.cc (search_path::search_path): Add
+ two parameters `add_home' and `add_current'.
+ (search_path::~search_path, search_path::command_line_dir,
+ search_path::open_file): Remove tests for `dirs' being zero.
+ * src/include/searchpath.h: Adjust.
+ * src/libs/libgroff/macropath.cc, src/include/macropath.h: Add
+ `safer_macro_path'.
+ * src/libs/libgroff/fontfile.cc: Adjust `font_path'.
+
+ * src/roff/troff/troff.h: Add `searchpath.h' and `mac_path'.
+ * src/roff/troff/input.cc: Use `mac_path', initialized with
+ `macro_path'.
+ (process_startup_file): Set `mac_path' to `safer_macro_path'.
+ * src/roff/troff/env.cc: Use `mac_path'.
+
+ * src/preproc/eqn/main.cc (main): Use `safer_macro_path'.
+
+ * NEWS, man/roff.man, src/roff/troff/troff.man,
+ src/rof/groff/groff.man, tmac/groff_tmac.man, arch/djgpp/README:
+ Updated.
+
+2000-11-12 Werner LEMBERG <wl@gnu.org>
+
+ * src/include/lib.h: Don't include groff-getopt.h for OSF/1.
+
+ * aclocal.m4 (GROFF_SYS_ERRLIST): Do test in C, not in C++.
+ * configure.in: Fix typo in comment.
+ * configure: Regenerated.
+
+ * src/libgroff/*, src/include/*, src/roff/troff/*: Fixing copyright
+ dates.
+
2000-11-08 Werner LEMBERG <wl@gnu.org>
Add system tmac directory (/usr/local/lib/groff/site-tmac).
diff --git a/Makefile.in b/Makefile.in
index 616907964..e43b06869 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -98,7 +98,8 @@ datasubdir=$(dataprogramdir)/$(version)$(revision)
fontdir=$(datasubdir)/font
# fontpath says where to look for dev*/*.
-fontpath=.:$(fontdir):/usr/lib/font
+# $HOME will be always prepended.
+fontpath=$(fontdir):/usr/lib/font
# tmacdir says where to install macros.
tmacdir=$(datasubdir)/tmac
@@ -110,7 +111,9 @@ systemtmacdir=$(libprogramdir)/site-tmac
localtmacdir=$(dataprogramdir)/site-tmac
# tmacpath says where to look for macro files.
-tmacpath=.:$(systemtmacdir):$(localtmacdir):$(tmacdir)
+# The current directory will always be prepended except for searching and
+# scanning troffrc and troffrc-end which prepend the home directory instead.
+tmacpath=$(systemtmacdir):$(localtmacdir):$(tmacdir)
# sys_tmac_prefix is prefix (if any) for system macro packages
sys_tmac_prefix=@sys_tmac_prefix@
diff --git a/NEWS b/NEWS
index 4335f59e5..343843f5c 100644
--- a/NEWS
+++ b/NEWS
@@ -58,10 +58,18 @@ Miscellaneous
For security reasons the following changes have been done:
- . The tmac.safer file has been replaced with a built-in solution;
- .open, .opena, .pso, .sy, and .pi are completely disabled in
- safer mode (which is the default); to enable these requests the `-U'
- command line flag must be used.
+ . The tmac.safer file has been replaced with a built-in solution; .open,
+ .opena, .pso, .sy, and .pi are completely disabled in safer mode (which
+ is the default); to enable these requests the `-U' command line flag
+ must be used.
+
+ . The files troffrc, troffrc-end, and eqnrc are no longer searched in the
+ current directory (besides the usual tmac path). Instead, the home
+ directory is used. While scanning these files, the same secure macro
+ path is active.
+
+ . Similarly, the current directory is no longer part of the font path; it
+ has been replaced with the home directory.
groff will now install its data files into /usr/local/share/groff/<version>
by default, following the GNU standard. Additionally, a local tmac
diff --git a/aclocal.m4 b/aclocal.m4
index f7cc11ac7..35cad8e90 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -129,15 +129,12 @@ AC_LANG_RESTORE])dnl
dnl
dnl
AC_DEFUN(GROFF_SYS_ERRLIST,
-[AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-AC_MSG_CHECKING([for sys_errlist[] in <errno.h> or <stdio.h>])
+[AC_MSG_CHECKING([for sys_errlist[] in <errno.h> or <stdio.h>])
AC_TRY_COMPILE([#include <errno.h>
#include <stdio.h>],
[int k; k = (int)sys_errlist[0];],
AC_MSG_RESULT(yes);AC_DEFINE(HAVE_SYS_ERRLIST),
-AC_MSG_RESULT(no))
-AC_LANG_RESTORE])dnl
+AC_MSG_RESULT(no))])dnl
dnl
dnl
AC_DEFUN(GROFF_OSFCN_H,
diff --git a/arch/djgpp/README b/arch/djgpp/README
index 89a10f776..49b798e1c 100644
--- a/arch/djgpp/README
+++ b/arch/djgpp/README
@@ -24,9 +24,9 @@ I. Installing the pre-compiled binary package
where you unzip Groff. In this latter case, you will need to
set additional environment variables:
- GROFF_TMAC_PATH=.;%DJDIR%/share/groff/<version>/tmac:%DJDIR%/share/groff/site-tmac
+ GROFF_TMAC_PATH=%DJDIR%/share/groff/<version>/tmac:%DJDIR%/share/groff/site-tmac
GROFF_TYPESETTER=ascii
- GROFF_FONT_PATH=.;%DJDIR%/share/groff/<version>/font
+ GROFF_FONT_PATH=%DJDIR%/share/groff/<version>/font
<version> is something like `1.16.1' or `1.17'.
diff --git a/configure b/configure
index 48ecc4823..061a6581f 100755
--- a/configure
+++ b/configure
@@ -1963,18 +1963,10 @@ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
-
-ac_ext=C
-# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cxx_cross
-
echo $ac_n "checking for sys_errlist in <errno.h> or <stdio.h>""... $ac_c" 1>&6
-echo "configure:1976: checking for sys_errlist in <errno.h> or <stdio.h>" >&5
+echo "configure:1968: checking for sys_errlist in <errno.h> or <stdio.h>" >&5
cat > conftest.$ac_ext <<EOF
-#line 1978 "configure"
+#line 1970 "configure"
#include "confdefs.h"
#include <errno.h>
#include <stdio.h>
@@ -1982,7 +1974,7 @@ int main() {
int k; k = (int)sys_errlist[0];
; return 0; }
EOF
-if { (eval echo configure:1986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1978: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF
#define HAVE_SYS_ERRLIST 1
@@ -1995,13 +1987,6 @@ else
echo "$ac_t""no" 1>&6
fi
rm -f conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2011,16 +1996,16 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking C++ <osfcn.h>""... $ac_c" 1>&6
-echo "configure:2015: checking C++ <osfcn.h>" >&5
+echo "configure:2000: checking C++ <osfcn.h>" >&5
cat > conftest.$ac_ext <<EOF
-#line 2017 "configure"
+#line 2002 "configure"
#include "confdefs.h"
#include <osfcn.h>
int main() {
read(0, 0, 0); open(0, 0);
; return 0; }
EOF
-if { (eval echo configure:2024: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2009: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF
#define HAVE_CC_OSFCN_H 1
@@ -2049,16 +2034,16 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking C++ <limits.h>""... $ac_c" 1>&6
-echo "configure:2053: checking C++ <limits.h>" >&5
+echo "configure:2038: checking C++ <limits.h>" >&5
cat > conftest.$ac_ext <<EOF
-#line 2055 "configure"
+#line 2040 "configure"
#include "confdefs.h"
#include <limits.h>
int main() {
int x = INT_MIN; int y = INT_MAX; int z = UCHAR_MAX;
; return 0; }
EOF
-if { (eval echo configure:2062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2047: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF
#define HAVE_CC_LIMITS_H 1
@@ -2087,16 +2072,16 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking for declaration of time_t""... $ac_c" 1>&6
-echo "configure:2091: checking for declaration of time_t" >&5
+echo "configure:2076: checking for declaration of time_t" >&5
cat > conftest.$ac_ext <<EOF
-#line 2093 "configure"
+#line 2078 "configure"
#include "confdefs.h"
#include <time.h>
int main() {
time_t t = time(0); struct tm *p = localtime(&t);
; return 0; }
EOF
-if { (eval echo configure:2100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
else
@@ -2117,12 +2102,12 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2121: checking return type of signal handlers" >&5
+echo "configure:2106: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2126 "configure"
+#line 2111 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -2139,7 +2124,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:2143: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2128: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -2158,16 +2143,16 @@ EOF
echo $ac_n "checking struct exception""... $ac_c" 1>&6
-echo "configure:2162: checking struct exception" >&5
+echo "configure:2147: checking struct exception" >&5
cat > conftest.$ac_ext <<EOF
-#line 2164 "configure"
+#line 2149 "configure"
#include "confdefs.h"
#include <math.h>
int main() {
struct exception e;
; return 0; }
EOF
-if { (eval echo configure:2171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF
#define HAVE_STRUCT_EXCEPTION 1
@@ -2181,7 +2166,7 @@ else
fi
rm -f conftest*
echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6
-echo "configure:2185: checking for sin in -lm" >&5
+echo "configure:2170: checking for sin in -lm" >&5
ac_lib_var=`echo m'_'sin | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2189,7 +2174,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2193 "configure"
+#line 2178 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2200,7 +2185,7 @@ int main() {
sin()
; return 0; }
EOF
-if { (eval echo configure:2204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2225,17 +2210,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2229: checking for $ac_hdr" >&5
+echo "configure:2214: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2234 "configure"
+#line 2219 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2239: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2224: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2264,12 +2249,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2268: checking for $ac_func" >&5
+echo "configure:2253: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2273 "configure"
+#line 2258 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2292,7 +2277,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2317,7 +2302,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:2321: checking for working mmap" >&5
+echo "configure:2306: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2325,7 +2310,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 2329 "configure"
+#line 2314 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -2465,7 +2450,7 @@ main()
}
EOF
-if { (eval echo configure:2469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -2492,12 +2477,12 @@ LIBS="$LIBS -lc $LIBM"
for ac_func in fmod strtol getcwd strerror putenv
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2496: checking for $ac_func" >&5
+echo "configure:2481: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2501 "configure"
+#line 2486 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2520,7 +2505,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2550,12 +2535,12 @@ LIBS="$saved_libs"
for ac_func in rename mkstemp strcasecmp strncasecmp strsep strdup
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2554: checking for $ac_func" >&5
+echo "configure:2539: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2559 "configure"
+#line 2544 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2578,7 +2563,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2603,12 +2588,12 @@ fi
done
echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6
-echo "configure:2607: checking for sys_siglist declaration in signal.h or unistd.h" >&5
+echo "configure:2592: checking for sys_siglist declaration in signal.h or unistd.h" >&5
if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2612 "configure"
+#line 2597 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -2620,7 +2605,7 @@ int main() {
char *msg = *(sys_siglist + 1);
; return 0; }
EOF
-if { (eval echo configure:2624: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_decl_sys_siglist=yes
else
@@ -2649,16 +2634,16 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking whether ANSI array delete syntax supported""... $ac_c" 1>&6
-echo "configure:2653: checking whether ANSI array delete syntax supported" >&5
+echo "configure:2638: checking whether ANSI array delete syntax supported" >&5
cat > conftest.$ac_ext <<EOF
-#line 2655 "configure"
+#line 2640 "configure"
#include "confdefs.h"
int main() {
char *p = new char[5]; delete [] p;
; return 0; }
EOF
-if { (eval echo configure:2662: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
else
@@ -2687,16 +2672,16 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking traditional preprocessor""... $ac_c" 1>&6
-echo "configure:2691: checking traditional preprocessor" >&5
+echo "configure:2676: checking traditional preprocessor" >&5
cat > conftest.$ac_ext <<EOF
-#line 2693 "configure"
+#line 2678 "configure"
#include "confdefs.h"
#define name2(a,b) a/**/b
int main() {
int name2(foo,bar);
; return 0; }
EOF
-if { (eval echo configure:2700: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF
#define TRADITIONAL_CPP 1
@@ -2717,12 +2702,12 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking w_coredump""... $ac_c" 1>&6
-echo "configure:2721: checking w_coredump" >&5
+echo "configure:2706: checking w_coredump" >&5
if test "$cross_compiling" = yes; then
echo "$ac_t""no" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2726 "configure"
+#line 2711 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -2737,7 +2722,7 @@ main()
#endif
}
EOF
-if { (eval echo configure:2741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "$ac_t""yes" 1>&6;cat >> confdefs.h <<\EOF
#define WCOREFLAG 0200
@@ -2753,12 +2738,12 @@ rm -fr conftest*
fi
echo $ac_n "checking default value for grops -b option""... $ac_c" 1>&6
-echo "configure:2757: checking default value for grops -b option" >&5
+echo "configure:2742: checking default value for grops -b option" >&5
test -n "${BROKEN_SPOOLER_FLAGS}" || BROKEN_SPOOLER_FLAGS=7
echo "$ac_t""$BROKEN_SPOOLER_FLAGS" 1>&6
echo $ac_n "checking default paper size""... $ac_c" 1>&6
-echo "configure:2762: checking default paper size" >&5
+echo "configure:2747: checking default paper size" >&5
if test -z "$PAGE"; then
descfile=
if test -r $prefix/share/groff/font/devps/DESC; then
@@ -2800,7 +2785,7 @@ test -n "$PAGE" || PAGE=letter
echo "$ac_t""$PAGE" 1>&6
echo $ac_n "checking for existing troff installation""... $ac_c" 1>&6
-echo "configure:2804: checking for existing troff installation" >&5
+echo "configure:2789: checking for existing troff installation" >&5
if test "x`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) 2>/dev/null`" = x0; then
echo "$ac_t""yes" 1>&6
g=g
@@ -2810,7 +2795,7 @@ else
fi
echo $ac_n "checking for prefix of system macro packages""... $ac_c" 1>&6
-echo "configure:2814: checking for prefix of system macro packages" >&5
+echo "configure:2799: checking for prefix of system macro packages" >&5
sys_tmac_prefix=
sys_tmac_file_prefix=
for d in /usr/share/lib/tmac /usr/lib/tmac; do
@@ -2830,7 +2815,7 @@ echo "$ac_t""$sys_tmac_prefix" 1>&6
tmac_wrap=
echo $ac_n "checking which system macro packages should be made available""... $ac_c" 1>&6
-echo "configure:2834: checking which system macro packages should be made available" >&5
+echo "configure:2819: checking which system macro packages should be made available" >&5
if test "x$sys_tmac_file_prefix" = "xtmac."; then
for f in $sys_tmac_prefix*; do
suff=`echo $f | sed -e "s;$sys_tmac_prefix;;"`
diff --git a/configure.in b/configure.in
index ef9e31d31..92024e039 100755
--- a/configure.in
+++ b/configure.in
@@ -15,7 +15,7 @@ AC_PROG_RANLIB
GROFF_INSTALL_SH
AC_PROG_INSTALL
AC_PROG_LN_S
-dnl use a dummy sustitution if no csh hack is necessary to avoid errors
+dnl use a dummy substitution if no csh hack is necessary to avoid errors
dnl with non-GNU sed programs
GROFF_CSH_HACK(SH_SCRIPT_SED_CMD='1s/.*/:/', SH_SCRIPT_SED_CMD='1s/a/a/')
AC_SUBST(SH_SCRIPT_SED_CMD)
diff --git a/man/roff.man b/man/roff.man
index 01cff2d6d..21962c172 100644
--- a/man/roff.man
+++ b/man/roff.man
@@ -391,11 +391,12 @@ A colon separated list of directories in which to search for the
.BI dev name
directory.
.B troff
-will search in directories given in the
+will first search in directories given with the
.option \-F
-option before these, and in standard directories
-.RB ( @FONTPATH@ )
-after these.
+command line option, then in the home directory, then in
+.BR GROFF_FONT_PATH ,
+and finally in the standard directories
+.RB ( @FONTPATH@ ).
.\" --------------------------------------------------------------------
.SH FILES
.\" --------------------------------------------------------------------
diff --git a/src/include/driver.h b/src/include/driver.h
index 300a403b2..97eb89125 100644
--- a/src/include/driver.h
+++ b/src/include/driver.h
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/include/lib.h b/src/include/lib.h
index 987778864..6d6f3fa30 100644
--- a/src/include/lib.h
+++ b/src/include/lib.h
@@ -26,9 +26,9 @@ extern "C" {
const char *if_to_a(int, int);
}
-/* stdio.h on IRIX includes getopt.h */
+/* stdio.h on IRIX and OSF/1 include getopt.h */
-#ifndef __sgi
+#if !(defined(__sgi) || (defined(__osf__) && defined(__ALPHA)))
#include <groff-getopt.h>
#endif
diff --git a/src/include/macropath.h b/src/include/macropath.h
index 4aa2f00c5..8db78f35d 100644
--- a/src/include/macropath.h
+++ b/src/include/macropath.h
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -19,3 +19,4 @@ with groff; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
extern search_path macro_path;
+extern search_path safer_macro_path;
diff --git a/src/include/searchpath.h b/src/include/searchpath.h
index d1cb2eeee..4d89a8d04 100644
--- a/src/include/searchpath.h
+++ b/src/include/searchpath.h
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -22,7 +22,8 @@ class search_path {
char *dirs;
unsigned init_len;
public:
- search_path(const char *envvar, const char *standard);
+ search_path(const char *envvar, const char *standard,
+ int add_home, int add_current);
~search_path();
void command_line_dir(const char *);
FILE *open_file(const char *, char **);
diff --git a/src/libs/libgroff/errarg.cc b/src/libs/libgroff/errarg.cc
index be4d3dc9d..f8075ea71 100644
--- a/src/libs/libgroff/errarg.cc
+++ b/src/libs/libgroff/errarg.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/libs/libgroff/font.cc b/src/libs/libgroff/font.cc
index c3bfa23ea..8e1b97dc1 100644
--- a/src/libs/libgroff/font.cc
+++ b/src/libs/libgroff/font.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/libs/libgroff/fontfile.cc b/src/libs/libgroff/fontfile.cc
index fa87b861f..5846a8dc5 100644
--- a/src/libs/libgroff/fontfile.cc
+++ b/src/libs/libgroff/fontfile.cc
@@ -31,7 +31,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
const char *const FONT_ENV_VAR = "GROFF_FONT_PATH";
-static search_path font_path(FONT_ENV_VAR, FONTPATH);
+static search_path font_path(FONT_ENV_VAR, FONTPATH, 1, 0);
int font::res = 0;
int font::hor = 1;
diff --git a/src/libs/libgroff/getcwd.c b/src/libs/libgroff/getcwd.c
index ed1642fe0..7a769ffc5 100644
--- a/src/libs/libgroff/getcwd.c
+++ b/src/libs/libgroff/getcwd.c
@@ -1,3 +1,22 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ Written by James Clark (jjc@jclark.com)
+
+This file is part of groff.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License along
+with groff; see the file COPYING. If not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
/* Partial emulation of getcwd in terms of getwd. */
#include <sys/param.h>
diff --git a/src/libs/libgroff/htmlindicate.cc b/src/libs/libgroff/htmlindicate.cc
index 1ebfb769a..6b5913f33 100755
--- a/src/libs/libgroff/htmlindicate.cc
+++ b/src/libs/libgroff/htmlindicate.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 2000 Free Software Foundation, Inc.
Written by Gaius Mulley (gaius@glam.ac.uk)
This file is part of groff.
diff --git a/src/libs/libgroff/iftoa.c b/src/libs/libgroff/iftoa.c
index fa1083370..29a3d894c 100644
--- a/src/libs/libgroff/iftoa.c
+++ b/src/libs/libgroff/iftoa.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/libs/libgroff/illegal.cc b/src/libs/libgroff/illegal.cc
index c1bdbc507..bacd891fd 100755
--- a/src/libs/libgroff/illegal.cc
+++ b/src/libs/libgroff/illegal.cc
@@ -1,3 +1,22 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ Written by James Clark (jjc@jclark.com)
+
+This file is part of groff.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License along
+with groff; see the file COPYING. If not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
#include "lib.h"
// Table of illegal input characters.
diff --git a/src/libs/libgroff/itoa.c b/src/libs/libgroff/itoa.c
index c811c7655..72826b748 100644
--- a/src/libs/libgroff/itoa.c
+++ b/src/libs/libgroff/itoa.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/libs/libgroff/macropath.cc b/src/libs/libgroff/macropath.cc
index 4fd22a30a..3a11bdfa1 100644
--- a/src/libs/libgroff/macropath.cc
+++ b/src/libs/libgroff/macropath.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -25,4 +25,5 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define MACROPATH_ENVVAR "GROFF_TMAC_PATH"
-search_path macro_path(MACROPATH_ENVVAR, MACROPATH);
+search_path macro_path(MACROPATH_ENVVAR, MACROPATH, 0, 1);
+search_path safer_macro_path(MACROPATH_ENVVAR, MACROPATH, 1, 0);
diff --git a/src/libs/libgroff/nametoindex.cc b/src/libs/libgroff/nametoindex.cc
index 39a7b697a..578ff349d 100644
--- a/src/libs/libgroff/nametoindex.cc
+++ b/src/libs/libgroff/nametoindex.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/libs/libgroff/searchpath.cc b/src/libs/libgroff/searchpath.cc
index a857c2581..f4e2b90d3 100644
--- a/src/libs/libgroff/searchpath.cc
+++ b/src/libs/libgroff/searchpath.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -27,56 +27,70 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "searchpath.h"
#include "nonposix.h"
-search_path::search_path(const char *envvar, const char *standard)
+search_path::search_path(const char *envvar, const char *standard,
+ int add_home, int add_current)
{
- char *e = envvar ? getenv(envvar) : 0;
- if (e && standard) {
- dirs = new char[strlen(e) + strlen(standard) + 2];
- strcpy(dirs, e);
+ char *home = 0;
+ if (add_home)
+ home = getenv("HOME");
+ char *e = 0;
+ if (envvar)
+ e = getenv(envvar);
+ dirs = new char[((e && *e) ? strlen(e) + 1 : 0)
+ + (add_current ? 1 + 1 : 0)
+ + ((home && *home) ? strlen(home) + 1 : 0)
+ + ((standard && *standard) ? strlen(standard) : 0)
+ + 1];
+ *dirs = '\0';
+ if (e && *e) {
+ strcat(dirs, e);
+ strcat(dirs, PATH_SEP);
+ }
+ if (add_current) {
+ strcat(dirs, ".");
+ strcat(dirs, PATH_SEP);
+ }
+ if (home && *home) {
+ strcat(dirs, home);
strcat(dirs, PATH_SEP);
- strcat(dirs, standard);
}
- else
- dirs = strsave(e ? e : standard);
- init_len = dirs ? strlen(dirs) : 0;
+ if (standard && *standard)
+ strcat(dirs, standard);
+ init_len = strlen(dirs);
}
search_path::~search_path()
{
- if (dirs)
- a_delete dirs;
+ // dirs is always allocated
+ a_delete dirs;
}
void search_path::command_line_dir(const char *s)
{
- if (!dirs)
- dirs = strsave(s);
- else {
- char *old = dirs;
- unsigned old_len = strlen(old);
- unsigned slen = strlen(s);
- dirs = new char[old_len + 1 + slen + 1];
- memcpy(dirs, old, old_len - init_len);
- char *p = dirs;
- p += old_len - init_len;
- if (init_len == 0)
- *p++ = PATH_SEP[0];
- memcpy(p, s, slen);
- p += slen;
- if (init_len > 0) {
- *p++ = PATH_SEP[0];
- memcpy(p, old + old_len - init_len, init_len);
- p += init_len;
- }
- *p++ = '\0';
- a_delete old;
+ char *old = dirs;
+ unsigned old_len = strlen(old);
+ unsigned slen = strlen(s);
+ dirs = new char[old_len + 1 + slen + 1];
+ memcpy(dirs, old, old_len - init_len);
+ char *p = dirs;
+ p += old_len - init_len;
+ if (init_len == 0)
+ *p++ = PATH_SEP[0];
+ memcpy(p, s, slen);
+ p += slen;
+ if (init_len > 0) {
+ *p++ = PATH_SEP[0];
+ memcpy(p, old + old_len - init_len, init_len);
+ p += init_len;
}
+ *p++ = '\0';
+ a_delete old;
}
FILE *search_path::open_file(const char *name, char **pathp)
{
assert(name != 0);
- if (IS_ABSOLUTE(name) || dirs == 0 || *dirs == '\0') {
+ if (IS_ABSOLUTE(name) || *dirs == '\0') {
FILE *fp = fopen(name, "r");
if (fp) {
if (pathp)
diff --git a/src/libs/libgroff/strtol.c b/src/libs/libgroff/strtol.c
index 7858ba5c6..61ce70e98 100644
--- a/src/libs/libgroff/strtol.c
+++ b/src/libs/libgroff/strtol.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/libs/libgroff/tmpfile.cc b/src/libs/libgroff/tmpfile.cc
index c839f7e07..cb192e38c 100644
--- a/src/libs/libgroff/tmpfile.cc
+++ b/src/libs/libgroff/tmpfile.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/preproc/eqn/main.cc b/src/preproc/eqn/main.cc
index c51bcfa88..e475eb9d3 100644
--- a/src/preproc/eqn/main.cc
+++ b/src/preproc/eqn/main.cc
@@ -257,7 +257,7 @@ int main(int argc, char **argv)
load_startup_file = 0;
break;
case 'M':
- macro_path.command_line_dir(optarg);
+ safer_macro_path.command_line_dir(optarg);
break;
case 'v':
{
diff --git a/src/roff/groff/groff.man b/src/roff/groff/groff.man
index 16bc7ef43..8fa2377ae 100644
--- a/src/roff/groff/groff.man
+++ b/src/roff/groff/groff.man
@@ -347,6 +347,9 @@ and
.B GROFF_TMAC_PATH
A colon separated list of directories in which to search for
macro files in addition to the default directories.
+See
+.BR troff (1)
+for more details.
.TP
.SM
.B GROFF_TYPESETTER
@@ -357,6 +360,9 @@ Default device.
A colon separated list of directories in which to search for the
.BI dev name
directory in addition to the default one.
+See
+.BR troff (1)
+for more details.
.TP
.SM
.B GROFF_BIN_PATH
diff --git a/src/roff/troff/column.cc b/src/roff/troff/column.cc
index 096f3811d..8d6a6ebe5 100644
--- a/src/roff/troff/column.cc
+++ b/src/roff/troff/column.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/roff/troff/div.cc b/src/roff/troff/div.cc
index 8566cd0f2..01ee2c612 100644
--- a/src/roff/troff/div.cc
+++ b/src/roff/troff/div.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/roff/troff/env.cc b/src/roff/troff/env.cc
index cd5c45c9f..378cfffdd 100644
--- a/src/roff/troff/env.cc
+++ b/src/roff/troff/env.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -29,7 +29,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "div.h"
#include "reg.h"
#include "charinfo.h"
-#include "searchpath.h"
#include "macropath.h"
#include <math.h>
@@ -3114,7 +3113,7 @@ void hyphen_trie::read_patterns_file(const char *name)
int num[WORD_MAX+1];
errno = 0;
char *path = 0;
- FILE *fp = macro_path.open_file(name, &path);
+ FILE *fp = mac_path->open_file(name, &path);
if (fp == 0) {
error("can't find hyphenation patterns file `%1'", name);
return;
diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h
index d2a1fb345..6792ea63c 100644
--- a/src/roff/troff/env.h
+++ b/src/roff/troff/env.h
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc
index 125b3272b..b9cd5c849 100644
--- a/src/roff/troff/input.cc
+++ b/src/roff/troff/input.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -31,7 +31,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "charinfo.h"
#include "stringclass.h"
#include "font.h"
-#include "searchpath.h"
#include "macropath.h"
#include "defs.h"
@@ -114,6 +113,8 @@ int is_html2 = 0;
int tcommand_flag = 0;
int safer_flag = 1; // safer by default
+search_path *mac_path = &macro_path;
+
static int get_copy(node**, int = 0);
static void copy_mode_error(const char *,
const errarg & = empty_errarg,
@@ -5641,13 +5642,13 @@ static FILE *open_mac_file(const char *mac, char **path)
char *s1 = new char[strlen(mac)+strlen(MACRO_POSTFIX)+1];
strcpy(s1, mac);
strcat(s1, MACRO_POSTFIX);
- FILE *fp = macro_path.open_file(s1, path);
+ FILE *fp = mac_path->open_file(s1, path);
a_delete s1;
if (!fp) {
char *s2 = new char[strlen(mac)+strlen(MACRO_PREFIX)+1];
strcpy(s2, MACRO_PREFIX);
strcat(s2, mac);
- fp = macro_path.open_file(s2, path);
+ fp = mac_path->open_file(s2, path);
a_delete s2;
}
return fp;
@@ -5669,13 +5670,16 @@ static void process_macro_file(const char *mac)
static void process_startup_file(char *filename)
{
char *path;
- FILE *fp = macro_path.open_file(filename, &path);
+ // restrict path for security reasons
+ mac_path = &safer_macro_path;
+ FILE *fp = mac_path->open_file(filename, &path);
if (fp) {
input_stack::push(new file_iterator(fp, symbol(path).contents()));
a_delete path;
tok.next();
process_input_stack();
}
+ mac_path = &macro_path;
}
void macro_source()
@@ -5687,7 +5691,7 @@ void macro_source()
while (!tok.newline() && !tok.eof())
tok.next();
char *path;
- FILE *fp = macro_path.open_file(nm.contents(), &path);
+ FILE *fp = mac_path->open_file(nm.contents(), &path);
// .mso doesn't (and cannot) go through open_mac_file, so we
// need to do it here manually: If we have tmac.FOOBAR, try
// FOOBAR.tmac and vice versa
@@ -5697,7 +5701,7 @@ void macro_source()
char *s = new char[strlen(fn) + sizeof(MACRO_POSTFIX)];
strcpy(s, fn + sizeof(MACRO_PREFIX) - 1);
strcat(s, MACRO_POSTFIX);
- fp = macro_path.open_file(s, &path);
+ fp = mac_path->open_file(s, &path);
a_delete s;
}
if (!fp) {
@@ -5706,7 +5710,7 @@ void macro_source()
char *s = new char[strlen(fn) + sizeof(MACRO_PREFIX)];
strcpy(s, MACRO_PREFIX);
strncat(s, fn, strlen(fn) - sizeof(MACRO_POSTFIX) + 1);
- fp = macro_path.open_file(s, &path);
+ fp = mac_path->open_file(s, &path);
a_delete s;
}
}
diff --git a/src/roff/troff/node.cc b/src/roff/troff/node.cc
index a114a40e1..f5585512c 100644
--- a/src/roff/troff/node.cc
+++ b/src/roff/troff/node.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h
index 21e585dc1..6a602dc37 100644
--- a/src/roff/troff/node.h
+++ b/src/roff/troff/node.h
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/roff/troff/reg.cc b/src/roff/troff/reg.cc
index 79e780627..254b0ff43 100644
--- a/src/roff/troff/reg.cc
+++ b/src/roff/troff/reg.cc
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/roff/troff/reg.h b/src/roff/troff/reg.h
index b983b875d..fe04f2ab1 100644
--- a/src/roff/troff/reg.h
+++ b/src/roff/troff/reg.h
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/roff/troff/request.h b/src/roff/troff/request.h
index 7b3ad0145..a26ebf483 100644
--- a/src/roff/troff/request.h
+++ b/src/roff/troff/request.h
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
diff --git a/src/roff/troff/troff.h b/src/roff/troff/troff.h
index 1f1e612b6..5702d24e4 100644
--- a/src/roff/troff/troff.h
+++ b/src/roff/troff/troff.h
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -30,6 +30,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "lib.h"
#include "assert.h"
#include "device.h"
+#include "searchpath.h"
void cleanup_and_exit(int n);
@@ -48,6 +49,8 @@ extern int vresolution;
extern int hresolution;
extern int sizescale;
+extern search_path *mac_path;
+
#include "cset.h"
#include "cmap.h"
#include "errarg.h"
diff --git a/src/roff/troff/troff.man b/src/roff/troff/troff.man
index 0b883b88d..c7bd2a71f 100644
--- a/src/roff/troff/troff.man
+++ b/src/roff/troff/troff.man
@@ -147,8 +147,13 @@ Read in the file
If it isn't found, try
.BI tmac. name
instead.
-Normally this will be searched for in the current directory, @LOCALMACRODIR@,
-@SYSTEMMACRODIR@, or @MACRODIR@.
+It will be first searched for in directories given with the
+.B \-M
+command line option, then in the current directory, then in directories given
+in the
+.B GROFF_MACRO_PATH
+environment variable, then in @LOCALMACRODIR@, @SYSTEMMACRODIR@, and
+@MACRODIR@.
.TP
.B \-U
Unsafe mode.
@@ -214,25 +219,22 @@ rather than the default
.BR @DEVICE@ .
.TP
.BI \-F dir
-Search
+Search in directory (or directory path)
.I dir
for subdirectories
.BI dev name
.RI ( name
-is the name of the device)
-for the
+is the name of the device) and there for the
.B DESC
-file and font files before the normal
-.BR @FONTDIR@ .
+file and font files.
+.I dir
+is scanned before all other font directories.
.TP
.BI \-M dir
-Search directory
+Search directory (or directory path)
.I dir
-for macro files before the normal
-.BR @LOCALMACRODIR@ ,
-.BR @SYSTEMMACRODIR@ ,
-and
-.BR @MACRODIR@ .
+for macro files.
+This is scanned before all other macro directories.
.SH USAGE
Only the features not in Unix troff are described here.
.SS Long names
@@ -2194,10 +2196,13 @@ escape sequence.
A colon separated list of directories in which to search for
macro files.
.B troff
-will search in directories given in the
+will scan directories given in
+the
.B \-M
-option before these, and in standard directories
-.RB ( @MACROPATH@ )
+option before these, and in standard directories (home directory,
+.BR @LOCALMACRODIR@ ,
+.BR @SYSTEMMACRODIR@ ,
+.BR @MACRODIR@ )
after these.
.TP
.SM
@@ -2210,10 +2215,11 @@ A colon separated list of directories in which to search for the
.BI dev name
directory.
.B troff
-will search in directories given in the
+will scan directories given in the
.B \-F
option before these, and in standard directories
-.RB ( @FONTPATH@ )
+(home directory,
+.BR @FONTPATH@ )
after these.
.SH FILES
.Tp \w'@FONTDIR@/devname/DESC'u+3n
@@ -2237,6 +2243,13 @@ Font file for font
.I F
of device
.IR name .
+.LP
+While searching for and scanning the initialization files
+.B troffrc
+and
+.BR troffrc-end ,
+a special search path is used for security reasons: The current directory
+is replaced with the home directory in the search path.
.SH "SEE ALSO"
.BR groff (@MAN1EXT@),
.BR @g@tbl (@MAN1EXT@),
diff --git a/tmac/groff_tmac.man b/tmac/groff_tmac.man
index 00a941bb1..8234b6b68 100755
--- a/tmac/groff_tmac.man
+++ b/tmac/groff_tmac.man
@@ -152,7 +152,7 @@ macro package may be specified as
.RE
.LP
The easiest way to find out which macro packages are available on a
-system is to check the content of the
+system is to check the contents of the
.I tmac
directories.
For example, a file called
@@ -363,34 +363,35 @@ The macro files are kept in the
all of which constitute the
.B tmac
.BR path.
-In accordance with the Filesystem Hierarchy Standard (FHS), the standard
-tmac directory location for groff is
-.IB /usr/share/groff/ <version> /tmac\c
-, a local installation will use
-.IB /usr/local/share/groff/ <version> /tmac\c
-\&.
-An additional directory for site-specific files which will be searched by
-default (before the standard tmac directory) is
-.I /usr/share/groff/site-tmac
-(resp.\&
-.IR /usr/local/share/groff/site-tmac ).
-Older systems used a subdirectory of
-.IR /usr/lib .
-Independently of the default tmac path, the tmac path actually used by a
-document can always be set by a shell environment variable, cf. section
-.BR ENVIRONMENT .
+.LP
+The elements of the search path for macro files are (in that order):
+.IP \(bu 4
+the directories specified with troff's resp. groff's
+.B \-M
+command line option
+.IP \(bu 4
+the directories given in the
+.B GROFF_TMAC_PATH
+environment variable
+.IP \(bu 4
+the current directory
+.IP \(bu 4
+a site-specific (platform-independent) directory, a platform-specific
+directory, and the main tmac directory:
+.IP "" 6
+@LOCALMACRODIR@
+.br
+@SYSTEMMACRODIR@
+.br
+@MACRODIR@
.\" --------------------------------------------------------------------
.SH ENVIRONMENT
.\" --------------------------------------------------------------------
.TP
.B GROFF_TMAC_PATH
-A colon separated list of tmac directories in which to search for macro
-files, the
-.B tmac
-.BR path .
-If unset a default path is used as is outlined in the
-.B FILES
-section.
+A colon separated list of additional tmac directories in which to search
+for macro files.
+See the previous section for a detailed description.
.\" --------------------------------------------------------------------
.SH BUGS
.\" --------------------------------------------------------------------