diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/acconfig.h xdvik-22.40j/texk/xdvik/acconfig.h --- xdvik-22.40i/texk/xdvik/acconfig.h Sun Jul 15 21:14:43 2001 +++ xdvik-22.40j/texk/xdvik/acconfig.h Tue Apr 9 21:14:48 2002 @@ -116,4 +116,12 @@ #undef HAVE_VSNPRINTF +#undef HAVE_REALPATH + +#undef HAVE_FCHDIR + +#undef HAVE_GETCWD + +#undef HAVE_LSTAT + #undef NOTOOL diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/aclocal.m4 xdvik-22.40j/texk/xdvik/aclocal.m4 --- xdvik-22.40i/texk/xdvik/aclocal.m4 Mon Apr 30 09:12:24 2001 +++ xdvik-22.40j/texk/xdvik/aclocal.m4 Tue Apr 9 21:14:48 2002 @@ -95,3 +95,14 @@ AC_DEFINE(HAVE_VSNPRINTF) fi]) +dnl ### Check for realpath() added by SU 2002/04/10 +AC_DEFUN(AC_FUNC_REALPATH, +[AC_CACHE_CHECK([for realpath], xdvi_cv_realpath, +[AC_TRY_LINK( +[#include +], [(void)realpath((const char *)NULL, NULL);], +xdvi_cv_realpath=yes, xdvi_cv_realpath=no)]) +if test $xdvi_cv_realpath = yes; then + AC_DEFINE(HAVE_REALPATH) +fi]) + diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/c-auto.in xdvik-22.40j/texk/xdvik/c-auto.in --- xdvik-22.40i/texk/xdvik/c-auto.in Mon Mar 4 15:03:40 2002 +++ xdvik-22.40j/texk/xdvik/c-auto.in Tue Apr 9 21:14:48 2002 @@ -107,6 +107,14 @@ #undef HAVE_VSNPRINTF +#undef HAVE_REALPATH + +#undef HAVE_FCHDIR + +#undef HAVE_GETCWD + +#undef HAVE_LSTAT + #undef NOTOOL /* Define if you have the isinf function. */ diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/configure xdvik-22.40j/texk/xdvik/configure --- xdvik-22.40i/texk/xdvik/configure Mon Mar 4 15:03:40 2002 +++ xdvik-22.40j/texk/xdvik/configure Tue Apr 9 21:14:48 2002 @@ -29,7 +29,7 @@ ac_help="$ac_help --with-x use the X Window System" ac_help="$ac_help - --with-x-toolkit=KIT use a toolkit (KIT=no/yes/xt/athena/xaw3d/neXtaw)" + --with-x-toolkit=KIT use a toolkit (KIT=xaw/xaw3d/neXtaw)" ac_help="$ac_help --with-ps=PS use PostScript; default gs (PS=no/yes/gs/dps/news)" ac_help="$ac_help @@ -1722,22 +1722,55 @@ EOF fi +echo $ac_n "checking for realpath""... $ac_c" 1>&6 +echo "configure:1727: checking for realpath" >&5 +if eval "test \"`echo '$''{'xdvi_cv_realpath'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < + +int main() { +(void)realpath((const char *)NULL, NULL); +; return 0; } +EOF +if { (eval echo configure:1740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + xdvi_cv_realpath=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + xdvi_cv_realpath=no +fi +rm -f conftest* +fi + +echo "$ac_t""$xdvi_cv_realpath" 1>&6 +if test $xdvi_cv_realpath = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_REALPATH 1 +EOF + +fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1729: checking for working alloca.h" >&5 +echo "configure:1762: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1758,12 +1791,12 @@ fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1762: checking for alloca" >&5 +echo "configure:1795: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1823,12 +1856,12 @@ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1827: checking whether alloca needs Cray hooks" >&5 +echo "configure:1860: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:1857: checking for $ac_func" >&5 +echo "configure:1890: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1918: \"$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 @@ -1908,7 +1941,7 @@ fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1912: checking stack direction for C alloca" >&5 +echo "configure:1945: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1916,7 +1949,7 @@ ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -1958,7 +1991,7 @@ # end additions SU echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:1962: checking for 8-bit clean memcmp" >&5 +echo "configure:1995: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1966,7 +1999,7 @@ ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -1994,12 +2027,12 @@ test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1998: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:2031: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2015,7 +2048,7 @@ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:2019: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -2036,12 +2069,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2040: checking return type of signal handlers" >&5 +echo "configure:2073: 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 < #include @@ -2058,7 +2091,7 @@ int i; ; return 0; } EOF -if { (eval echo configure:2062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2077,14 +2110,14 @@ echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:2081: checking whether byte ordering is bigendian" >&5 +echo "configure:2114: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -2095,11 +2128,11 @@ #endif ; return 0; } EOF -if { (eval echo configure:2099: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -2110,7 +2143,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:2114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2147: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -2130,7 +2163,7 @@ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -2173,7 +2206,7 @@ # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:2177: checking for X" >&5 +echo "configure:2210: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -2235,12 +2268,12 @@ # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2244: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2277: \"$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* @@ -2309,14 +2342,14 @@ ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -2424,17 +2457,17 @@ case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:2428: checking whether -R must be followed by a space" >&5 +echo "configure:2461: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -2450,14 +2483,14 @@ else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -2495,7 +2528,7 @@ # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:2499: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:2532: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2503,7 +2536,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2551: \"$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 @@ -2536,7 +2569,7 @@ if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:2540: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:2573: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2544,7 +2577,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2592: \"$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 @@ -2584,12 +2617,12 @@ # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:2588: checking for gethostbyname" >&5 +echo "configure:2621: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -2633,7 +2666,7 @@ if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:2637: checking for gethostbyname in -lnsl" >&5 +echo "configure:2670: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2641,7 +2674,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2689: \"$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 @@ -2682,12 +2715,12 @@ # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:2686: checking for connect" >&5 +echo "configure:2719: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -2731,7 +2764,7 @@ if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:2735: checking for connect in -lsocket" >&5 +echo "configure:2768: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2739,7 +2772,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2787: \"$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 @@ -2774,12 +2807,12 @@ # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:2778: checking for remove" >&5 +echo "configure:2811: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -2823,7 +2856,7 @@ if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:2827: checking for remove in -lposix" >&5 +echo "configure:2860: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2831,7 +2864,7 @@ ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2879: \"$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 @@ -2866,12 +2899,12 @@ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:2870: checking for shmat" >&5 +echo "configure:2903: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -2915,7 +2948,7 @@ if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:2919: checking for shmat in -lipc" >&5 +echo "configure:2952: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2923,7 +2956,7 @@ ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2971: \"$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 @@ -2967,7 +3000,7 @@ # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:2971: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:3004: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2975,7 +3008,7 @@ ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3023: \"$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 @@ -3011,12 +3044,12 @@ fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3015: checking for size_t" >&5 +echo "configure:3048: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3046,12 +3079,12 @@ # XDVI checks by Paul Vojta echo $ac_n "checking whether C compiler supports string concatenation""... $ac_c" 1>&6 -echo "configure:3050: checking whether C compiler supports string concatenation" >&5 +echo "configure:3083: checking whether C compiler supports string concatenation" >&5 if eval "test \"`echo '$''{'xdvi_cc_concat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3060,7 +3093,7 @@ ; return 0; } EOF -if { (eval echo configure:3064: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3097: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* xdvi_cc_concat=yes else @@ -3080,7 +3113,7 @@ fi echo $ac_n "checking for integer type to use in bitmaps""... $ac_c" 1>&6 -echo "configure:3084: checking for integer type to use in bitmaps" >&5 +echo "configure:3117: checking for integer type to use in bitmaps" >&5 if eval "test \"`echo '$''{'xdvi_cv_bitmap_type'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3088,7 +3121,7 @@ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -3106,7 +3139,7 @@ exit(0); } EOF -if { (eval echo configure:3110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then xdvi_cv_bitmap_type="`cat conftestval`" else @@ -3131,12 +3164,12 @@ echo "$ac_t""unsigned $BMTYPE, size = $BMBYTES" 1>&6 echo $ac_n "checking for stropts.h and isastream()""... $ac_c" 1>&6 -echo "configure:3135: checking for stropts.h and isastream()" >&5 +echo "configure:3168: checking for stropts.h and isastream()" >&5 if eval "test \"`echo '$''{'xdvi_cv_sys_streams'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3148,7 +3181,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:3152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* xdvi_cv_sys_streams=yes else @@ -3168,7 +3201,7 @@ fi echo $ac_n "checking for SunOS 4""... $ac_c" 1>&6 -echo "configure:3172: checking for SunOS 4" >&5 +echo "configure:3205: checking for SunOS 4" >&5 if eval "test \"`echo '$''{'xdvi_cv_sys_sunos_4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3187,12 +3220,12 @@ fi echo $ac_n "checking for poll.h and poll()""... $ac_c" 1>&6 -echo "configure:3191: checking for poll.h and poll()" >&5 +echo "configure:3224: checking for poll.h and poll()" >&5 if eval "test \"`echo '$''{'xdvi_cv_func_poll'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3200,7 +3233,7 @@ poll((struct pollfd *) 0, 0, 0); ; return 0; } EOF -if { (eval echo configure:3204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* xdvi_cv_func_poll=yes else @@ -3223,17 +3256,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3227: checking for $ac_hdr" >&5 +echo "configure:3260: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3237: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3270: \"$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* @@ -3266,15 +3299,15 @@ # AC_TYPE_OFF_T # AC_HEADER_TIME -for ac_func in mkstemp memcpy strerror waitpid sigaction strchr setenv ulltostr +for ac_func in mkstemp memcpy strerror waitpid sigaction strchr setenv ulltostr fchdir getcwd lstat do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3273: checking for $ac_func" >&5 +echo "configure:3306: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3334: \"$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 @@ -3327,17 +3360,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3331: checking for $ac_hdr" >&5 +echo "configure:3364: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3341: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3374: \"$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* @@ -3378,15 +3411,12 @@ if test "${with_x_toolkit+set}" = set; then withval="$with_x_toolkit" case "${withval}" in - y | ye | yes ) val=yes ;; - xt ) val=xt ;; neXtaw ) val=neXtaw ;; xaw3d ) val=xaw3d ;; - n | no ) val=no ;; - a | at | ath | athe | athena ) val=athena ;; + x | xa | xaw ) val=xaw ;; * ) -echo "configure: warning: unknown --with-x-toolkit argument \`$withval'; using yes." 1>&2 - val=yes;; +echo "configure: warning: unknown --with-x-toolkit argument \`$withval'; using xaw." 1>&2 + val=xaw;; esac with_x_toolkit=$val @@ -3394,7 +3424,6 @@ - # Check if the user wants to use Ghostscript, DPS or NeWS to # display PostScript. # Check whether --with-ps or --without-ps was given. @@ -3551,7 +3580,7 @@ # Extract the first word of "pwd", so it can be a program name with args. set dummy pwd; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3555: checking for $ac_word" >&5 +echo "configure:3584: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_BINPWD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3701,17 +3730,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3705: checking for $ac_hdr" >&5 +echo "configure:3734: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3715: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3744: \"$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* @@ -3758,7 +3787,7 @@ LDLIBWWW=-lwww libwww_libdir_found=yes echo $ac_n "checking for HTParse in -lwww""... $ac_c" 1>&6 -echo "configure:3762: checking for HTParse in -lwww" >&5 +echo "configure:3791: checking for HTParse in -lwww" >&5 ac_lib_var=`echo www'_'HTParse | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3766,7 +3795,7 @@ ac_save_LIBS="$LIBS" LIBS="-lwww $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3810: \"$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 @@ -3839,7 +3868,7 @@ XLFLAG= fi echo $ac_n "checking for XextCreateExtension in -lXext""... $ac_c" 1>&6 -echo "configure:3843: checking for XextCreateExtension in -lXext" >&5 +echo "configure:3872: checking for XextCreateExtension in -lXext" >&5 ac_lib_var=`echo Xext'_'XextCreateExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3847,7 +3876,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXext -lX11 $X_EXTRA_LIBS $XLFLAG $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3891: \"$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 @@ -3914,7 +3943,7 @@ echo "$ac_t""adding DPS includes and libraries for Solaris" 1>&6 X_CFLAGS="$X_CFLAGS -I/usr/openwin/include/X11" echo $ac_n "checking for isinf in -lsunmath""... $ac_c" 1>&6 -echo "configure:3918: checking for isinf in -lsunmath" >&5 +echo "configure:3947: checking for isinf in -lsunmath" >&5 ac_lib_var=`echo sunmath'_'isinf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3922,7 +3951,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsunmath $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3966: \"$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 @@ -3960,12 +3989,12 @@ for ac_func in isinf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3964: checking for $ac_func" >&5 +echo "configure:3993: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4021: \"$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 @@ -4016,17 +4045,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4020: checking for $ac_hdr" >&5 +echo "configure:4049: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4030: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4059: \"$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* diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/configure.in xdvik-22.40j/texk/xdvik/configure.in --- xdvik-22.40i/texk/xdvik/configure.in Mon Mar 4 15:03:41 2002 +++ xdvik-22.40j/texk/xdvik/configure.in Tue Apr 9 21:14:49 2002 @@ -15,6 +15,7 @@ AC_FUNC_VPRINTF # begin additions SU, 2000/03/07 AC_FUNC_VSNPRINTF +AC_FUNC_REALPATH AC_FUNC_ALLOCA # end additions SU AC_FUNC_MEMCMP @@ -38,7 +39,7 @@ # AC_TYPE_OFF_T # AC_HEADER_TIME -AC_CHECK_FUNCS(mkstemp memcpy strerror waitpid sigaction strchr setenv ulltostr) +AC_CHECK_FUNCS(mkstemp memcpy strerror waitpid sigaction strchr setenv ulltostr fchdir getcwd lstat) # is for ISC 4.0, to define fd_set in psgs.c. AC_CHECK_HEADERS(netdb.h sys/bsdtypes.h X11/Xosdefs.h sys/fcntl.h) diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/dvi-draw.c xdvik-22.40j/texk/xdvik/dvi-draw.c --- xdvik-22.40i/texk/xdvik/dvi-draw.c Mon Mar 4 15:03:41 2002 +++ xdvik-22.40j/texk/xdvik/dvi-draw.c Tue Apr 30 14:50:17 2002 @@ -716,10 +716,10 @@ #ifdef GRID /* drawing grid */ void -put_grid(x, y, width, height, unit, gc1, gc2, gc3) +put_grid(x, y, width, height, unit, gc) int x, y; unsigned int width, height, unit; - GC gc1, gc2, gc3; + GC gc; { int i; /* looping variable */ float sep; /* grid separation */ @@ -744,20 +744,20 @@ if (grid_mode > 2) { /* third level grid */ sep = (float)unit / 4.0; - DRAWGRID_VER(gc3); /* vertical grid */ - DRAWGRID_HOR(gc3); /* horizontal grid */ + DRAWGRID_VER(gc); /* vertical grid */ + DRAWGRID_HOR(gc); /* horizontal grid */ } if (grid_mode > 1) { /* second */ sep = (float)unit / 2.0; - DRAWGRID_VER(gc2); /* vertical grid */ - DRAWGRID_HOR(gc2); /* horizontal grid */ + DRAWGRID_VER(gc); /* vertical grid */ + DRAWGRID_HOR(gc); /* horizontal grid */ } if (grid_mode > 0) { /* first level */ sep = (float)unit; - DRAWGRID_VER(gc1); /* vertical grid */ - DRAWGRID_HOR(gc1); /* horizontal grid */ + DRAWGRID_VER(gc); /* vertical grid */ + DRAWGRID_HOR(gc); /* horizontal grid */ } } @@ -777,8 +777,7 @@ ++currinf.pos; return EOP; } - currinf.end = dvi_buffer + - read(fileno(dvi_file), (char *)(currinf.pos = dvi_buffer), + currinf.end = dvi_buffer + read(fileno(dvi_file), (char *)(currinf.pos = dvi_buffer), DVI_BUFFER_LEN); return currinf.end > dvi_buffer ? *(currinf.pos)++ : EOF; } @@ -1187,7 +1186,7 @@ } } if (currinf.fontp == NULL) - tell_oops("non-existent font #%d", n); + tell_oops("non-existent font #%lu", n); if (currinf.fontp->set_char_p == NULL) tell_oops("No procedure to set font #%d", n, currinf.fontp->fontname); maxchar = currinf.fontp->maxchar; @@ -1310,12 +1309,13 @@ for (;;) { ch = xone(); n = scantable[ch]; + if (n < MM) while (n-- != 0) (void)xone(); else if (n == M1) break; /* end of page */ - else + else { switch (n) { case M2: /* special */ a = xnum(ch - XXX1 + 1); @@ -1336,6 +1336,7 @@ break; } } + } } #if PS @@ -1364,6 +1365,10 @@ } nextreportpage = scanned_page; ++scanned_page; + if (page_offset == NULL) { +/* dvi_time--; */ + return; + } (void)lseek(fileno(dvi_file), page_offset[scanned_page], SEEK_SET); currinf.pos = currinf.end = dvi_buffer; for (;;) { @@ -1663,9 +1668,9 @@ ubyte ch; #ifdef TEXXET struct drawinf oldinfo; - ubyte oldmaxchar; - off_t file_pos; - int refl_count; + ubyte oldmaxchar = 0; + off_t file_pos = 0; + int refl_count = 0; #endif currinf.fontp = NULL; @@ -1676,6 +1681,7 @@ #endif for (;;) { ch = xone(); + if (debug & DBG_DVI) print_dvi(ch); if (ch <= (ubyte) (SETCHAR0 + 127)) { @@ -1688,6 +1694,12 @@ else if (FNTNUM0 <= ch && ch <= (ubyte) (FNTNUM0 + 63)) { change_font((unsigned long)(ch - FNTNUM0)); } + else if (ch == 255) { + /* FIXME: we sometimes arrive here when doing a + forward search on a corrupted DVI file. */ + fprintf(stderr, "shouldn't happen: op-code 255 (trying to recover ...)\n"); + return; + } else { long a, b; @@ -1941,11 +1953,14 @@ #undef xspell_conv + void draw_page P1C(void,) { - if (dvi_file_changed()) + if (dvi_file_changed() || page_offset == NULL) { + dvi_time--; return; + } #if PS if (scanned_page < current_page) @@ -1961,7 +1976,7 @@ ROUNDUP(unshrunk_paper_w, shrink_factor) + 2, ROUNDUP(unshrunk_paper_h, shrink_factor) + 2, ROUNDUP(unshrunk_paper_unit, shrink_factor), - grid1GC, grid2GC, grid3GC); + rulerGC); #endif /* GRID */ (void)lseek(fileno(dvi_file), page_offset[current_page], SEEK_SET); @@ -2024,8 +2039,10 @@ { if (debug & DBG_HYPER) fprintf(stderr, "htex_parse_page called for %d\n", i); - if (dvi_file_changed()) + if (dvi_file_changed() || page_offset == NULL) { +/* dvi_time--; */ return False; + } /* Skip to beginning of page i */ /* Stuff from draw_page in dvi_draw.c: */ @@ -2034,7 +2051,7 @@ currinf.tn_head = tn_head; currinf.pos = currinf.end = dvi_buffer; if (debug & DBG_HYPER) - fprintf(stderr, "setting currinf pos: %d\n", currinf.pos); + fprintf(stderr, "setting currinf pos: %d\n", *(currinf.pos)); currinf.virtual = NULL; htex_initpage(); psfig_begun = False; @@ -2394,6 +2411,7 @@ oops("internal error -- currinf.set_char_p = 0x%x", currinf.set_char_p); } /* NOTREACHED */ + return 0; } /* @@ -2437,9 +2455,9 @@ ubyte ch; #ifdef TEXXET struct drawinf oldinfo; - ubyte oldmaxchar; - off_t file_pos; - int refl_count; + ubyte oldmaxchar = 0; + off_t file_pos = 0; + int refl_count = 0; #endif currinf.fontp = NULL; @@ -2698,10 +2716,14 @@ geom_scan(g_info) struct geom_info *g_info; { - off_t pos_save; + off_t pos_save = 0; struct drawinf currinf_save; ubyte maxchar_save; + if (page_offset == NULL) { +/* dvi_time--; */ + return; + } #if PS if (scanned_page < current_page) return; /* should not happen */ @@ -3050,7 +3072,6 @@ char **argv; _Xconst char *p, *p1; char *q; - FILE *f; int i; /* Used to store argv[] text. */ @@ -3233,8 +3254,10 @@ struct src_spec_data data; struct src_parsed_special *foundp; - if (dvi_file_changed()) + if (dvi_file_changed() || page_offset == NULL) { +/* dvi_time--; */ return; + } g_info.geom_box = src_spec_box; g_info.geom_special = src_spec_special; @@ -3255,7 +3278,7 @@ * scan next and previous pages with increasing offset */ int upper, lower; - off_t pos_save; + off_t pos_save = 0; struct drawinf currinf_save; ubyte maxchar_save; @@ -3608,7 +3631,7 @@ source_forward_search(str) _Xconst char *str; { - off_t pos_save; + off_t pos_save = 0; struct drawinf currinf_save; ubyte maxchar_save; struct geom_info g_info; @@ -3649,6 +3672,10 @@ if (dvi_pointer_frame != NULL) pos_save = lseek(fileno(dvi_file), 0L, SEEK_CUR) - (dvi_pointer_frame->end - dvi_pointer_frame->pos); + if (page_offset == NULL) { + dvi_time--; + return; + } (void)lseek(fileno(dvi_file), page_offset[0], SEEK_SET); currinf_save = currinf; @@ -4404,7 +4431,7 @@ GLYPH *G; /* t1lib glyph */ struct glyph *g; /* xdvi glyph */ - TRACE_T1((stderr, "scale: %d, ppi %d, sf: %d, size: %f", + TRACE_T1((stderr, "scale: %ld, ppi %d, sf: %d, size: %f", currinf.fontp->scale, pixels_per_inch, shrink_factor, size)); @@ -4534,8 +4561,7 @@ PUBLIC void init_t1 P1C(void,) { - unsigned long value_arr[20]; - int i, factor = 5; + int i; /* Atempt to set needed padding. diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/dvi-init.c xdvik-22.40j/texk/xdvik/dvi-init.c --- xdvik-22.40i/texk/xdvik/dvi-init.c Mon Mar 4 15:03:41 2002 +++ xdvik-22.40j/texk/xdvik/dvi-init.c Tue Apr 30 14:50:17 2002 @@ -130,7 +130,6 @@ reset_fonts() { struct font *f; - struct glyph *g; for (f = font_head; f != NULL; f = f->next) { if ((f->flags & FONT_LOADED) && !(f->flags & FONT_VIRTUAL)) { @@ -520,6 +519,9 @@ { ubyte k; + if (dvi_file == NULL) { + return; + } if (one(dvi_file) != PRE) dvi_oops("Not a DVI file."); if (one(dvi_file) != 2) @@ -555,17 +557,22 @@ if (pos < 0) pos = 0; Fseek(dvi_file, pos, 0); + p = temp + fread((char *)temp, sizeof(char), TMPSIZ, dvi_file); for (;;) { p1 = p; - while (p1 > temp && *(--p1) != TRAILER); + while (p1 > temp && *(--p1) != TRAILER) + ; /* do nothing */ p = p1; - while (p > temp && *(--p) == TRAILER); - if (p <= p1 - 4) + while (p > temp && *(--p) == TRAILER) + ; /* do nothing */ + if (p <= p1 - 4) { break; /* found 4 TRAILER bytes */ - if (p <= temp) + } + if (p <= temp) { dvi_oops("DVI file corrupted"); } + } pos += p - temp; byte = *p; while (byte == TRAILER) { @@ -576,6 +583,7 @@ dvi_oops("Wrong version of DVI output for this program"); Fseek(dvi_file, pos - 4, 0); Fseek(dvi_file, sfour(dvi_file), 0); + return; } @@ -733,7 +741,6 @@ form_dvi_property() { size_t len; - char *p; unsigned long ino; int i; @@ -793,7 +800,6 @@ extern FILE *XsraSelFile(); FILE *dummy_file; static char *dummy_name = NULL; - extern Atom SRC_DATA; dummy_file = XsraSelFile(top_level, "Select a dvi file: ", "Ok", "Cancel", @@ -878,7 +884,7 @@ **/ Boolean -dvi_file_changed() +dvi_file_changed(void) { struct font *fontp; unsigned int old_page_w, old_page_h; @@ -892,21 +898,24 @@ Putchar('\n'); dvi_file = NULL; } - if (page_offset != (long *)NULL) { - free((char *)page_offset); - page_offset = (long *)NULL; + if (page_offset != NULL) { + free(page_offset); + page_offset = NULL; } - bzero((char *)tn_table, (int)sizeof(tn_table)); + bzero(tn_table, sizeof tn_table); free_vf_chain(tn_head); tn_head = NULL; - for (fontp = font_head; fontp != NULL; fontp = fontp->next) + for (fontp = font_head; fontp != NULL; fontp = fontp->next) { fontp->flags &= ~FONT_IN_USE; + } + if (!setjmp(dvi_env)) { old_page_w = page_w; old_page_h = page_h; #ifdef SELFILE if ((dvi_time > fstatbuf.st_mtime) && /* choose a new file */ - (dvi_file = select_filename(True, True)) == NULL) + (dvi_file = select_filename(True, True)) == NULL) { dvi_oops("Cannot open new dvi file."); + } else #endif /* SELFILE */ if (!internal_open_dvi(dvi_name)) { @@ -919,13 +928,20 @@ form_dvi_property(); set_dvi_property(); } - if (page_w != old_page_w || page_h != old_page_h) + if (page_w != old_page_w || page_h != old_page_h) { reconfig(); + } #ifdef HTEX htex_reinit(); #endif /* HTEX */ redraw_page(); return True; + } + else { + print_statusline(STATUS_MEDIUM, "DVI file corrupted"); + XClearWindow(DISP, mane.win); + return True; + } } return False; } diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/events.c xdvik-22.40j/texk/xdvik/events.c --- xdvik-22.40i/texk/xdvik/events.c Mon Mar 4 15:03:41 2002 +++ xdvik-22.40j/texk/xdvik/events.c Tue Apr 30 14:50:17 2002 @@ -946,17 +946,18 @@ /* FIXME: toplevel yet realized? */ do_popup_message(MSG_WARN, /* helptext */ - "You can either restart xdvi with the \"-install\" option \ + "Greyscaling is running in copy mode: your display can only display \ +a limited number of colors at a time (typically 256), and other applications\ + (such as netscape) are using many of them. Running in copy mode will \ +cause overstrike characters to appear incorrectly, and may result in \ +poor display quality. \n\ +You can either restart xdvi with the \"-install\" option \ to allow it to install its own color map, \ or terminate other color-hungry applications before restarting xdvi. \ Please see the section ``GREYSCALING AND COLORMAPS'' in the xdvi manual page \ for more details.", /* text */ - "Greyscaling is running in copy mode: your display can only display \ -a limited number of colors at a time (typically 256), and other applications \ -(such as netscape) are using many of them. Running in copy mode will \ -cause overstrike characters to appear incorrectly, and may result in \ -poor display quality."); + "Couldn't allocate enough colors - expect low display quality."); } } @@ -1029,17 +1030,18 @@ if (!resource.copy) do_popup_message(MSG_WARN, /* helptext */ - "You can either restart xdvi with the \"-install\" option \ + "Greyscaling is running in copy mode: your display can only display \ +a limited number of colors at a time (typically 256), and other applications\ + (such as netscape) are using many of them. Running in copy mode will \ +cause overstrike characters to appear incorrectly, and may result in \ +poor display quality. \n\ +You can either restart xdvi with the \"-install\" option \ to allow it to install its own color map, \ or terminate other color-hungry applications before restarting xdvi. \ Please see the section ``GREYSCALING AND COLORMAPS'' in the xdvi manual page \ for more details.", /* text */ - "Greyscaling is running in copy mode: your display can only display \ -a limited number of colors at a time (typically 256), and other applications \ -(such as netscape) are using many of them. Running in copy mode will \ -cause overstrike characters to appear incorrectly, and may result in \ -poor display quality."); + "Couldn't allocate enough colors - expect low display quality."); } else { if (set_bits) @@ -3122,7 +3124,7 @@ alt.base_x = (mag_x + mane_base_x) * mane.shrinkfactor - alt.width / 2; alt.base_y = (mag_y + mane_base_y) * mane.shrinkfactor - alt.height / 2; attr.save_under = True; - attr.border_pixel = brdr_Pixel; + attr.border_pixel = resource.rule_pixel; attr.background_pixel = back_Pixel; attr.override_redirect = True; #ifdef GREY @@ -3151,7 +3153,7 @@ helping to distinguish ruler ticks from normal typeset text. *****************************************************************/ if (!delay_rulers) - draw_rulers(alt.width, alt.height, highGC); + draw_rulers(alt.width, alt.height, rulerGC); alt_stat = 1; /* waiting for exposure */ mouse_motion = mag_motion; @@ -3203,7 +3205,7 @@ scrollwindow(&alt, (x + mane_base_x) * mane.shrinkfactor - (int)alt.width / 2, (y + mane_base_y) * mane.shrinkfactor - (int)alt.height / 2); - draw_rulers(alt.width, alt.height, highGC); + draw_rulers(alt.width, alt.height, rulerGC); } @@ -4126,6 +4128,15 @@ terminate_flag = True; } +/* ARGSUSED */ +static RETSIGTYPE +handle_sigsegv(signo) + int signo; +{ + fprintf(stderr, "xdvik: caught segmentation fault - trying to clean up and aborting ...\n"); + xdvi_abort(); +} + void enable_intr() { @@ -4210,10 +4221,16 @@ sigaction(SIGINT, &a, NULL); sigaction(SIGQUIT, &a, NULL); sigaction(SIGTERM, &a, NULL); + a.sa_handler = handle_sigsegv; + (void)sigemptyset(&a.sa_mask); + (void)sigaddset(&a.sa_mask, SIGSEGV); + a.sa_flags = 0; + sigaction(SIGSEGV, &a, NULL); #else /* not HAVE_SIGACTION */ (void)signal(SIGINT, handle_sigterm); (void)signal(SIGQUIT, handle_sigterm); (void)signal(SIGTERM, handle_sigterm); + (void)signal(SIGSEGV, handle_sigsegv); #endif /* not HAVE_SIGACTION */ #ifndef FLAKY_SIGPOLL @@ -4225,6 +4242,7 @@ (void)sigaddset(&all_signals, SIGINT); (void)sigaddset(&all_signals, SIGQUIT); (void)sigaddset(&all_signals, SIGTERM); + (void)sigaddset(&all_signals, SIGSEGV); #endif @@ -4279,7 +4297,10 @@ canit = False; can_exposures(&mane); can_exposures(&alt); + if (dvi_file != NULL) redraw_page(); + else + (void)dvi_file_changed(); } else if (mag_moved) { if (alt.win == (Window) 0) @@ -4291,10 +4312,12 @@ else movemag(new_mag_x, new_mag_y); } - else if (alt.min_x < MAXDIM) + else if (alt.min_x < MAXDIM) { redraw(&alt); - else if (mane.min_x < MAXDIM) + } + else if (mane.min_x < MAXDIM) { redraw(&mane); + } XFlush(DISP); } } diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/hypertex.c xdvik-22.40j/texk/xdvik/hypertex.c --- xdvik-22.40i/texk/xdvik/hypertex.c Thu Mar 21 19:51:10 2002 +++ xdvik-22.40j/texk/xdvik/hypertex.c Mon Apr 29 16:24:19 2002 @@ -122,8 +122,8 @@ static char *anchor_name; #define HTeX_AnchorSTEP 20 /* new memory for anchors is allocated in these steps */ static HTeX_Anchor **HTeX_anchorlist; /* array containing the anchors */ -static int *nHTeX_anchors, *nHTeX_src; /* array of numbers of anchors per page */ -static int *maxHTeX_anchors, *maxHTeX_src; /* array of anchors entered so far per page */ +static int *nHTeX_anchors; /* array of numbers of anchors per page */ +static int *maxHTeX_anchors; /* array of anchors entered so far per page */ static Anchors *HTeX_visited = NULL; /* list of anchors visited, for the `BACK' functionality */ @@ -1472,8 +1472,11 @@ make_absolute(fullpathname, URLbase, 1024); if (invokeviewer(fullpathname) != 1) { do_popup_message(MSG_ERR, - NULL, - "Don't know how to deal with \n", + /* TODO: prompt user for a viewer name here!! */ + "You can assign a viewer for the image type \ + by editing the files \"mime.types\" or \ + \"mailcap\".", + "No appropriate viewer found for image \"%s\"", fullpathname); } } diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/mksedscript xdvik-22.40j/texk/xdvik/mksedscript --- xdvik-22.40i/texk/xdvik/mksedscript Mon Mar 4 12:35:11 2002 +++ xdvik-22.40j/texk/xdvik/mksedscript Tue Apr 30 13:35:57 2002 @@ -9,6 +9,7 @@ mk_GS_PATH='gs' mk_PS_DPS= mk_PS_NEWS= +mk_NOGRID= mk_A4= # HyperTeX: There appears to be no (easy) way to disable this diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/my-vsnprintf.h xdvik-22.40j/texk/xdvik/my-vsnprintf.h --- xdvik-22.40i/texk/xdvik/my-vsnprintf.h Wed Apr 18 10:24:44 2001 +++ xdvik-22.40j/texk/xdvik/my-vsnprintf.h Mon Apr 22 19:05:52 2002 @@ -1,7 +1,7 @@ #ifndef MY_VSNPRINTF_H__ #define MY_VSNPRINTF_H__ -#ifdef HAVE_VSNPRINTF +#if HAVE_VSNPRINTF #include #include #define VSNPRINTF(buf, len, format, args) vsnprintf(buf, len, format, args) diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/psgs.c xdvik-22.40j/texk/xdvik/psgs.c --- xdvik-22.40i/texk/xdvik/psgs.c Mon Mar 4 15:03:41 2002 +++ xdvik-22.40j/texk/xdvik/psgs.c Mon Apr 29 16:24:22 2002 @@ -21,7 +21,7 @@ \*========================================================================*/ -#ifdef PS_GS /* whole file */ +#ifdef PS_GS /* entire file */ #include "xdvi-config.h" #include "kpathsea/c-pathmx.h" @@ -32,6 +32,8 @@ #include /* this defines FASYNC */ #include /* this defines SIOCSPGRP and FIOASYNC */ +#include "xdvi.h" + /* if POSIX O_NONBLOCK is not available, use O_NDELAY */ #if !defined(O_NONBLOCK) && defined(O_NDELAY) #define O_NONBLOCK O_NDELAY @@ -127,10 +129,11 @@ static char arg4[] = "-dDEVICEWIDTH=xxxxxxxxxx"; static char arg5[] = "-dDEVICEHEIGHT=xxxxxxxxxx"; -static _Xconst char *argv[] = { NULL, NULL, "-dNOPAUSE", "-q", arg4, arg5, +static _Xconst char *argv[] = { + NULL, NULL, "-dNOPAUSE", "-q", arg4, arg5, "-dDEVICEXRESOLUTION=72", "-dDEVICEYRESOLUTION=72", - NULL, NULL, NULL + "-dNOSAFER", NULL, NULL, NULL }; static pid_t GS_pid; @@ -506,6 +509,16 @@ * events is that otherwise ghostview doesn't know when a non-conforming * postscript program calls showpage. That doesn't affect us here, * since in fact we disable showpage. + * + * SAFER mode is handled by providing both the -dNOSAFER and -dSAFER + * options. Ghostscript versions 7.04 and earlier ignore -dNOSAFER and use + * -dSAFER; the code in strsafe is ignored since .locksafe is not present. + * In versions 7.04 and higher, -dNOSAFER overrides -dSAFER; SAFER mode is + * optionally turned on by sending the strsafe string. It is possible in some + * versions of gs prior to 7.04 to use -dDELAYSAFER instead of -dNOSAFER, but + * there's no point in doing that since .locksafe is not defined in those + * versions. I don't know where 7.03 fits in on all of this (but it works with + * that version as well). */ Boolean initGS() @@ -520,6 +533,11 @@ * header; i.e., no save/restore. * `execute' is unique to ghostscript. */ + static _Xconst char strsafe[] = "\ + { << /PermitFileReading [ (*) ] /PermitFileWriting [ ] /PermitFileControl [ ] \ + >> setuserparams .locksafe \ + } stopped pop\n"; + static _Xconst char str1[] = "\ /xdvi$run {$error /newerror false put {currentfile cvx execute} stopped pop} \ def \ @@ -568,13 +586,14 @@ Fflush(stderr); /* to avoid double flushing */ GS_pid = vfork(); if (GS_pid == 0) { /* child */ - _Xconst char **argvp = argv + 8; + _Xconst char **argvp = argv + 9; argv[1] = resource.gs_alpha ? "-sDEVICE=x11alpha" : "-sDEVICE=x11"; Sprintf(arg4 + 14, "%u", GS_page_w); Sprintf(arg5 + 15, "%u", GS_page_h); if (resource.gs_safer) *argvp++ = "-dSAFER"; + *argvp = "-"; (void)close(std_in[1]); (void)dup2(std_in[0], 0); @@ -627,6 +646,8 @@ GS_pending = 1; GS_mag = GS_shrink = -1; + if (resource.gs_safer) + gs_io(strsafe, sizeof(strsafe) - 1); gs_io(str1, sizeof(str1) - 1); gs_io(psheader, psheaderlen); gs_io(str2, sizeof(str2) - 1); @@ -839,6 +860,9 @@ _Xconst char *cp; FILE *f; { + char canonical_path[MAXPATHLEN + 1]; + char *ret; + Fclose(f); /* don't need it */ ++n_files_left; @@ -846,7 +870,21 @@ return; if (debug & DBG_PS) - Printf("printing file %s\n", cp); + Printf("original path: |%s|\n", cp); +#if 0 + /* if expand_symlinks and remove_dots from kpathsea were public, + we could use the following: */ + ret = remove_dots(expand_symlinks(cp)); +#endif + + ret = REALPATH(cp, canonical_path); + if (ret == NULL) + fprintf(stderr, "Couldn't canonicalize path \"%s\" (%s) - sending to gs unchanged\n", cp, strerror(errno)); + else + cp = canonical_path; + + if (debug & DBG_PS) + Printf("expanded path: |%s|\n", cp); gs_io("(", 1); gs_io(cp, strlen(cp)); diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/sfSelFile.c xdvik-22.40j/texk/xdvik/sfSelFile.c --- xdvik-22.40i/texk/xdvik/sfSelFile.c Mon May 21 10:19:25 2001 +++ xdvik-22.40j/texk/xdvik/sfSelFile.c Tue Apr 9 21:14:49 2002 @@ -65,8 +65,12 @@ #include "sfinternal.h" #ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif /* ndef MAXPATHLEN */ +# ifdef PATH_MAX +# define MAXPATHLEN PATH_MAX +# else +# define MAXPATHLEN 1024 +# endif +#endif extern int SFchdir(); diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/special.c xdvik-22.40j/texk/xdvik/special.c --- xdvik-22.40i/texk/xdvik/special.c Mon Mar 4 15:03:41 2002 +++ xdvik-22.40j/texk/xdvik/special.c Sat Apr 13 13:37:44 2002 @@ -1036,7 +1036,7 @@ } /* Success! */ - psp.drawfile(bufp, f); /* this is supposed to close the file */ + psp.drawfile(bufp, f); /* this is supposed to fclose f */ } diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/startxdvi xdvik-22.40j/texk/xdvik/startxdvi --- xdvik-22.40i/texk/xdvik/startxdvi Sun May 20 14:32:50 2001 +++ xdvik-22.40j/texk/xdvik/startxdvi Mon Apr 29 16:24:26 2002 @@ -3,7 +3,7 @@ ### customizable variables ### ### name of xdvi executable -XDVI_EXEC="$HOME/add-ons/xdvi/xdvi-22.38/xdvi" +XDVI_EXEC="xdvi" ### set this to /dev/null if you don't want to see the xdvi output: XDVI_LOG="$HOME/xdvi-log" ### end of customizable variables diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/statusline.c xdvik-22.40j/texk/xdvik/statusline.c --- xdvik-22.40i/texk/xdvik/statusline.c Mon Nov 5 18:17:38 2001 +++ xdvik-22.40j/texk/xdvik/statusline.c Mon Apr 22 15:03:37 2002 @@ -286,15 +286,15 @@ char buf[MAX_LEN + 1]; #ifdef STATUSLINE - if (!initialized || (!resource.statusline && !resource._hush_stdout)) { - if (strlen(fmt) > 0) { + if (!XtIsRealized(top_level) || !initialized || !resource.statusline) { + if (!resource._hush_stdout && strlen(fmt) > 0) { fprintf(stdout, "xdvi: "); (void)vfprintf(stdout, fmt, argp); fprintf(stdout, "\n"); fflush(stdout); } } - else if (resource.statusline && initialized) { + else { VSNPRINTF(buf, MAX_LEN, fmt, argp); /* just trow away strings longer than MAX_LEN */ /* * save current contents of statusline so that toggling the statusline diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/texmf/lucida.map xdvik-22.40j/texk/xdvik/texmf/lucida.map --- xdvik-22.40i/texk/xdvik/texmf/lucida.map Wed Apr 18 10:24:49 2001 +++ xdvik-22.40j/texk/xdvik/texmf/lucida.map Sat Apr 13 11:28:14 2002 @@ -18,8 +18,8 @@ hlcrf8r LucidaBlackletter "TeXBase1Encoding ReEncodeFont" <8r.enc #endif /* VMS */ + #ifdef X_NOT_STDC_ENV extern int errno; extern void *malloc(); @@ -68,6 +69,14 @@ #define vfprintf(stream, message, args) _doprnt(message, args, stream) #endif +#include +#include +#include + +#ifndef MAXSYMLINKS /* Workaround for Linux libc 4.x/5.x */ +#define MAXSYMLINKS 5 +#endif + /* * General utility routines. */ @@ -95,7 +104,6 @@ window_list_len = property_get_data(DefaultRootWindow(DISP), ATOM_XDVI_WINDOWS, &window_list, XGetWindowProperty); - if (window_list_len == 0) return; @@ -111,8 +119,6 @@ for (wp = window_list; wp < window_list_end; wp += 4) { if (debug & DBG_CLIENT) { Window w; - unsigned char *buf_ret; - size_t len; #ifndef WORD64 w = *((xuint32 *) wp); #else @@ -127,6 +133,7 @@ TRACE_CLIENT((stderr, "Window list pos %d: 0x%x", wp - window_list, w)); } if (W(wp) == XtWindow(top_level)) { + TRACE_CLIENT((stderr, "wp == top_level; len: %d, end: %p\n", window_list_len, window_list_end)); window_list_len -= 4; window_list_end -= 4; bcopy(wp + 4, wp, window_list_end - wp); @@ -173,6 +180,28 @@ exit(status); } + +/* + * invoked on SIGSEGV: try to stop gs before aborting, to prevent gs + * running on with 100% CPU consumption - this can be annoying during + * testing. + */ + +NORETURN void +xdvi_abort() +{ + /* Clean up the "xdvi windows" property in the root window. */ + if (top_level) + exit_clean_windows(); +#if PS + ps_destroy(); +#endif +#ifdef HTEX + htex_cleanup(); +#endif + abort(); +} + /* * Print error message and quit. */ @@ -190,6 +219,158 @@ xdvi_exit(1); }} +#undef MAXPATHLEN +#define MAXPATHLEN 55 + +/* realpath implementation if no implementation available. + Try to canonicalize path, removing `.' and `..' and expanding symlinks. + Adopted from wu-ftpd's fb_realpath (in realpath.c), but without the + seteuid(0) stuff (which we don't need, since we never change into + directories or read files the user has no permissions for). + + resolved should be a buffer of size PATH_MAX. +*/ + +char * +my_realpath(const char *path, char *resolved) +{ + struct stat sb; + int n; + char *base; + char tmpbuf[MAXPATHLEN]; + int symlinks = 0; +#ifdef HAVE_FCHDIR + int fd; +#else + char cwd[MAXPATHLEN]; +#endif + + /* Save cwd for going back later */ +#ifdef HAVE_FCHDIR + if ((fd = open(".", O_RDONLY)) < 0) + return NULL; +#else /* HAVE_FCHDIR */ + if ( +# ifdef HAVE_GETCWD + getcwd(cwd, MAXPATHLEN) +# else + getwd(cwd) +# endif + == NULL) + return NULL; +#endif /* HAVE_FCHDIR */ + + if (strlen(path) + 1 > MAXPATHLEN) { + errno = ENAMETOOLONG; + return NULL; + } + strcpy(resolved, path); + + for (;;) { /* loop for resolving symlinks in base name */ + /* get base name and dir name components */ + char *p = strrchr(resolved, '/'); + if (p != NULL) { + base = p + 1; + if (p == resolved) { + /* resolved is in root dir; this must be treated as a special case, + since we can't chop off at `/'; instead, just use the `/': + */ + p = "/"; + } + else { + /* not in root dir; chop off path name at slash */ + while (p > resolved && *p == '/') /* for multiple trailing slashes */ + p--; + *(p + 1) = '\0'; + p = resolved; + } + + /* change into that dir */ + if (chdir(p) != 0) + break; + } + else /* no directory component */ + base = resolved; + + /* resolve symlinks or directory names (not used in our case) in basename */ + if (*base != '\0') { + if ( +#ifdef HAVE_LSTAT + lstat(base, &sb) +#else + stat(base, &sb) +#endif + == 0) { +#ifdef HAVE_LSTAT + if (S_ISLNK(sb.st_mode)) { /* if it's a symlink, iterate for what it links to */ + if (++symlinks > MAXSYMLINKS) { + errno = ELOOP; + break; + } + + if ((n = readlink(base, resolved, MAXPATHLEN)) < 0) + break; + + resolved[n] = '\0'; + continue; + } +#endif /* HAVE_LSTAT */ + if (S_ISDIR(sb.st_mode)) { /* if it's a directory, go there */ + if (chdir(base) != 0) + break; + + base = ""; + } + } + } + + /* Now get full pathname of current directory and concatenate it with saved copy of base name */ + strcpy(tmpbuf, base); /* cannot overrun, since strlen(base) <= strlen(path) < MAXPATHLEN */ + if ( +#ifdef HAVE_GETCWD + getcwd(resolved, MAXPATHLEN) +#else + getwd(resolved) +#endif + == NULL) + break; + + /* need to append a slash if resolved is not the root dir */ + if (!(resolved[0] == '/' && resolved[1] == '\0')) { + if (strlen(resolved) + 2 > MAXPATHLEN) { + errno = ENAMETOOLONG; + break; + } + strcat(resolved, "/"); + } + + if (*tmpbuf) { + if (strlen(resolved) + strlen(tmpbuf) + 1 > MAXPATHLEN) { + errno = ENAMETOOLONG; + break; + } + strcat(resolved, tmpbuf); + } + + /* go back to where we came from */ +#ifdef HAVE_FCHDIR + fchdir(fd); + close(fd); +#else + chdir(cwd); +#endif + return resolved; + } + + /* arrive here in case of error: go back to where we came from, and return NULL */ +#ifdef HAVE_FCHDIR + fchdir(fd); + close(fd); +#else + chdir(cwd); +#endif + return NULL; +} #ifndef KPATHSEA @@ -688,7 +869,7 @@ unsigned long *, unsigned char **)); { /* all of these are in 8-bit units */ - unsigned long byte_offset = 0; + long byte_offset = 0; Atom type_ret; int format_ret; unsigned long nitems_ret; @@ -922,7 +1103,7 @@ void print_child_error() { - int retval, bytes; + int bytes; int buf_old_size = 0, buf_new_size = 0; char tmp_buf[BUF_SIZE]; char *err_buf = NULL; diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/version.h xdvik-22.40j/texk/xdvik/version.h --- xdvik-22.40i/texk/xdvik/version.h Tue Apr 9 14:53:50 2002 +++ xdvik-22.40j/texk/xdvik/version.h Mon Apr 29 16:24:32 2002 @@ -1,4 +1,4 @@ -#define XDVERSION "22.40i" +#define XDVERSION "22.40j" #ifdef Omega #define TVERSION XDVERSION" for Omega" #else diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/wwwfetch.c xdvik-22.40j/texk/xdvik/wwwfetch.c --- xdvik-22.40i/texk/xdvik/wwwfetch.c Thu Oct 11 15:38:22 2001 +++ xdvik-22.40j/texk/xdvik/wwwfetch.c Sat Apr 13 13:37:44 2002 @@ -338,7 +338,7 @@ do_popup_message(MSG_ERR, "This is serious. Either you've run out of file \ descriptors, or your disk is full. Sorry, you'll need to resolve this first ...", - "Cannot create temporary file"); + "Couldn't create temporary file"); return -1; } else { diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/xdvi.c xdvik-22.40j/texk/xdvik/xdvi.c --- xdvik-22.40i/texk/xdvik/xdvi.c Mon Mar 4 15:03:41 2002 +++ xdvik-22.40j/texk/xdvik/xdvi.c Tue Apr 30 13:35:57 2002 @@ -341,19 +341,12 @@ #define brdr_Pixel resource._brdr_Pixel #define hl_Pixel resource._hl_Pixel #define cr_Pixel resource._cr_Pixel -#ifdef GRID -#define grid1_Pixel resource._grid1_Pixel -#define grid2_Pixel resource._grid2_Pixel -#define grid3_Pixel resource._grid3_Pixel -#endif /* GRID */ #else /* not TOOLKIT */ static _Xconst char *brdr_color; static _Xconst char *high_color; static _Xconst char *curs_color; static Pixel hl_Pixel, cr_Pixel; -#ifdef GRID -static Pixel grid1_Pixel, grid2_Pixel, grid3_Pixel; -#endif /* GRID */ +static Pixel rule_pixel; #endif /* not TOOLKIT */ struct mg_size_rec mg_size[5] = { {200, 150}, {400, 250}, {700, 500}, @@ -421,11 +414,7 @@ {"-install", ".install", XrmoptionNoArg, (XPointer) "on"}, {"-noinstall", ".install", XrmoptionNoArg, (XPointer) "off"}, #endif -#ifdef GRID - {"-grid1", ".grid1Color", XrmoptionSepArg, (XPointer) NULL}, - {"-grid2", ".grid2Color", XrmoptionSepArg, (XPointer) NULL}, - {"-grid3", ".grid3Color", XrmoptionSepArg, (XPointer) NULL}, -#endif /* GRID */ + {"-rulecolor", ".ruleColor", XrmoptionSepArg, (XPointer) NULL}, {"-p", ".pixelsPerInch", XrmoptionSepArg, (XPointer) NULL}, {"-margins", ".Margin", XrmoptionSepArg, (XPointer) NULL}, {"-sidemargin", ".sideMargin", XrmoptionSepArg, (XPointer) NULL}, @@ -573,7 +562,9 @@ "osfBackSpace:up-or-previous()\n" #endif "\"P\":declare-page-number()\n" +#ifdef GRID "\"D\":toggle-grid-mode()\n" +#endif "\"g\":goto-page()\n" "\">\":goto-page()\n" "\"<\":goto-page(1)\n" @@ -842,20 +833,10 @@ {"install", "Install", XtRBool3, sizeof(Bool3), offset(install), XtRString, "maybe"}, #endif -#ifdef GRID - {"grid1Color", "Grid1Color", XtRPixel, sizeof(Pixel), - offset(_grid1_Pixel), XtRPixel, (XtPointer) & resource._grid1_Pixel}, - {"grid1Color", "Grid1Color", XtRString, sizeof(char *), - offset(grid1_color), XtRString, (XtPointer) NULL}, - {"grid2Color", "Grid2Color", XtRPixel, sizeof(Pixel), - offset(_grid2_Pixel), XtRPixel, (XtPointer) & resource._grid2_Pixel}, - {"grid2Color", "Grid2Color", XtRString, sizeof(char *), - offset(grid2_color), XtRString, (XtPointer) NULL}, - {"grid3Color", "Grid3Color", XtRPixel, sizeof(Pixel), - offset(_grid3_Pixel), XtRPixel, (XtPointer) & resource._grid3_Pixel}, - {"grid3Color", "Grid3Color", XtRString, sizeof(char *), - offset(grid3_color), XtRString, (XtPointer) NULL}, -#endif /* GRID */ + {"ruleColor", "RuleColor", XtRPixel, sizeof(Pixel), + offset(rule_pixel), XtRPixel, (XtPointer)&resource.rule_pixel}, + {"ruleColor", "RuleColor", XtRString, sizeof(char *), + offset(rule_color), XtRString, (XtPointer)NULL}, #ifdef HTEX {"underLink", "UnderLink", XtRBoolean, sizeof(Boolean), offset(_underline_link), XtRString, (XtPointer) "true"}, @@ -919,11 +900,7 @@ #ifdef GREY /* gamma */ "g", #endif -#ifdef GRID - /* grid1 */ "color", - /* grid2 */ "color", - /* grid3 */ "color", -#endif /* GRID */ + /* rule */ "color", /* p */ "pixels", /* margins */ "dimen", /* sidemargin */ "dimen", @@ -1140,11 +1117,7 @@ { "-install", NULL, TrueArg, Bool3Arg, 2, NULL, ADDR(install)}, { "-noinstall", "install", FalseArg, Bool3Arg, 1, NULL, ADDR(install)}, #endif -#ifdef GRID - { "-grid1", "grid1Color", SepArg, StringArg, 1, "color", ADDR(grid1_color)}, - { "-grid2", "grid2Color", SepArg, StringArg, 1, "color", ADDR(grid2_color)}, - { "-grid3", "grid3Color", SepArg, StringArg, 1, "color", ADDR(grid3_color)}, -#endif /* GRID */ + { "-rulecolor", "ruleColor", SepArg, StringArg, 1, "color", ADDR(rule_color)}, { "-p", "pixelsPerInch", SepArg, NumberArg, 1, "pixels", ADDR(_pixels_per_inch)}, { "-margins", "Margin", SepArg, StringArg, 3, "dimen", (XPointer) & margins}, { "-sidemargin", "sideMargin", SepArg, StringArg, 1, "dimen", ADDR(sidemargin)}, @@ -1699,10 +1672,8 @@ #endif #ifdef GRID /* grid_mode */ 0, - /* grid1_color */ NULL, - /* grid2_color */ NULL, - /* grid3_color */ NULL, #endif /* GRID */ + /* rule_color */ NULL, #ifdef HTEX /* _underline_link */ True, /* _browser */ (char *)NULL, @@ -2674,6 +2645,16 @@ for (list1 = list; list1 < list + nitems_return; ++list1) if (list1->depth > our_depth +# if PS_GS + /* patch by Toni Ronkko , fixes bug #458057: + * Not all depths are supported by ghostscript; see + * xdev->vinfo->depth in gdevxcmp.c (ghostscript-6.51). + * SGI supports additional depths of 12 and 30. */ + && (list1->depth == 1 || list1->depth == 2 + || list1->depth == 4 || list1->depth == 8 + || list1->depth == 15 || list1->depth == 16 + || list1->depth == 24 || list1->depth == 32) +# endif && (best == NULL || list1->depth > best->depth)) best = list1; if (best != NULL) { @@ -2746,14 +2727,8 @@ hl_Pixel = (high_color ? string_to_pixel(&high_color) : fore_Pixel); cr_Pixel = (curs_color ? string_to_pixel(&curs_color) : fore_Pixel); -#ifdef GRID - if (resource.grid1_color) - grid1_Pixel = string_to_pixel(&resource.grid1_color); - if (resource.grid2_color) - grid2_Pixel = string_to_pixel(&resource.grid2_color); - if (resource.grid3_color) - grid3_Pixel = string_to_pixel(&resource.grid3_color); -#endif /* GRID */ + if (resource.rule_color) + rule_pixel = string_to_pixel(&resource.rule_color); #endif /* not TOOLKIT */ @@ -3330,14 +3305,8 @@ XCreateGC(DISP, XtWindow(top_level), \ GCFunction | GCForeground | GCBackground, &values)) -#ifdef GRID - if (!resource.grid1_color) - grid1_Pixel = fore_Pixel; - if (!resource.grid2_color) - grid2_Pixel = grid1_Pixel; - if (!resource.grid3_color) - grid3_Pixel = grid1_Pixel; -#endif /* GRID */ + if (!resource.rule_color) + resource.rule_pixel = fore_Pixel; #ifdef GREY @@ -3364,17 +3333,18 @@ if (!resource.copy) do_popup_message(MSG_WARN, /* helptext */ - "You can either restart xdvi with the \"-install\" option \ + "Greyscaling is running in copy mode: your display can only display \ +a limited number of colors at a time (typically 256), and other applications\ + (such as netscape) are using many of them. Running in copy mode will \ +cause overstrike characters to appear incorrectly, and may result in \ +poor display quality. \n\ +You can either restart xdvi with the \"-install\" option \ to allow it to install its own color map, \ or terminate other color-hungry applications before restarting xdvi. \ Please see the section ``GREYSCALING AND COLORMAPS'' in the xdvi manual page \ for more details.", /* text */ - "Greyscaling is running in copy mode: your display can \ -only display a limited number of colors at a time (typically 256), \ -and other applications (such as netscape) are using many of them. \ -Running in copy mode will cause overstrike characters to appear \ -incorrectly, and may result in poor display quality."); + "Couldn't allocate enough colors - expect low display quality."); } else { if (set_bits) @@ -3398,11 +3368,7 @@ ) highGC = MakeGC(GXcopy, hl_Pixel, back_Pixel); -#ifdef GRID - grid1GC = MakeGC(GXcopy, grid1_Pixel, fore_Pixel); - grid2GC = MakeGC(GXcopy, grid2_Pixel, fore_Pixel); - grid3GC = MakeGC(GXcopy, grid3_Pixel, fore_Pixel); -#endif /* GRID */ + rulerGC = MakeGC(GXcopy, resource.rule_pixel, fore_Pixel); } diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/xdvi.h xdvik-22.40j/texk/xdvik/xdvi.h --- xdvik-22.40i/texk/xdvik/xdvi.h Mon Mar 4 12:35:11 2002 +++ xdvik-22.40j/texk/xdvik/xdvi.h Tue Apr 30 13:35:58 2002 @@ -122,6 +122,16 @@ #endif /* NOTOOL */ + +#ifndef MAXPATHLEN +# ifdef PATH_MAX +# define MAXPATHLEN PATH_MAX +# else +# define MAXPATHLEN 1024 +# endif +#endif + + #if defined(CFG2RES) && !defined(SELFAUTO) #define SELFAUTO 1 #endif @@ -644,6 +654,7 @@ Pixel _fore_Pixel; Pixel _back_Pixel; #ifdef TOOLKIT + Pixel rule_Pixel; Pixel _brdr_Pixel; Pixel _hl_Pixel; Pixel _cr_Pixel; @@ -692,11 +703,11 @@ #endif #ifdef GRID int _grid_mode; - char *grid1_color, *grid2_color, *grid3_color; +#endif /* GRID */ + char *rule_color; #ifdef TOOLKIT - Pixel _grid1_Pixel, _grid2_Pixel, _grid3_Pixel; + Pixel rule_pixel; #endif /* TOOLKIT */ -#endif /* GRID */ #ifdef HTEX Boolean _underline_link; char *_browser; @@ -748,9 +759,7 @@ #ifndef TOOLKIT EXTERN Pixel brdr_Pixel; #ifdef GRID -EXTERN Pixel grid1_Pixel; -EXTERN Pixel grid2_Pixel; -EXTERN Pixel grid3_Pixel; +EXTERN Pixel rule_Pixel; #endif /* GRID */ #endif @@ -875,9 +884,7 @@ EXTERN GC foreGC, highGC; EXTERN GC foreGC2; EXTERN GC copyGC; -#ifdef GRID -EXTERN GC grid1GC, grid2GC, grid3GC; -#endif /* GRID */ +EXTERN GC rulerGC; EXTERN Boolean copy; EXTERN Cursor redraw_cursor, ready_cursor, link_cursor, drag_cursor[3]; @@ -1099,7 +1106,7 @@ extern void set_dvi_property ARGS((void)); extern Boolean dvi_file_changed ARGS((void)); #ifdef GRID -extern void put_grid ARGS((int, int, unsigned int, unsigned int, unsigned int, GC, GC, GC)); +extern void put_grid ARGS((int, int, unsigned int, unsigned int, unsigned int, GC)); #endif /* GRID */ #ifndef TEXXET extern long set_char ARGS((wide_ubyte)); @@ -1164,11 +1171,23 @@ extern void applicationDoSpecial ARGS((char *)); extern NORETURN void xdvi_exit ARGS((int)); +extern NORETURN void xdvi_abort ARGS((void)); extern void geom_do_special ARGS((struct geom_info *, _Xconst char *, double)); extern NORETURN void oops PVAR1H(_Xconst char *); + +extern char *my_realpath(const char *path, char *real); +#if HAVE_REALPATH +#include +#include +# define REALPATH realpath +#else +# define REALPATH my_realpath +#endif + + #ifndef KPATHSEA extern void *xmalloc ARGS((unsigned)); extern void *xrealloc ARGS((void *, unsigned)); @@ -1220,6 +1239,7 @@ extern int HTeXreflevel; /* flag for whether we are inside an href */ extern int global_x_marker, global_y_marker, global_marker_page; +extern void htex_draw_anchormarker ARGS((int, int)); extern char *htex_file_at_index ARGS((int)); extern char *htex_url_at_index ARGS((int)); extern void search_callback ARGS((Widget, XtPointer, XtPointer)); diff -urb --exclude=CVS xdvik-22.40i/texk/xdvik/xdvi.man xdvik-22.40j/texk/xdvik/xdvi.man --- xdvik-22.40i/texk/xdvik/xdvi.man Mon Mar 4 12:35:11 2002 +++ xdvik-22.40j/texk/xdvik/xdvi.man Tue Apr 30 13:46:13 2002 @@ -95,11 +95,7 @@ [\fB\-fg\fP \fIcolor\fP] [\fB\-bg\fP \fIcolor\fP] [\fB\-hl\fP \fIcolor\fP] [\fB\-bd\fP \fIcolor\fP] [\fB\-cr\fP \fIcolor\fP] [\fB\-bw\fP \fIwidth\fP] -#ifgrif -[\fB\-grid1\fP \fIcolor\fP] -[\fB\-grid2\fP \fIcolor\fP] -[\fB\-grid3\fP \fIcolor\fP] -#endif +[\fB\-rulecolor\fP \fIcolor\fP] [\fB\-bw\fP \fIwidth\fP] [\fB\-display\fP \fIhost:display\fP] [\fB\-geometry\fP \fIgeometry\fP] [\fB\-icongeometry\fP \fIgeometry\fP] [\fB\-iconic\fP] @@ -459,22 +455,16 @@ .BR \-density . See also the .RB ` S ' -keystroke +keystroke. #endif -#ifgrid .TP -.BI \-grid1 " color" -.RB ( .grid1Color ) -Determines the color of level 1 grid (default as foreground) -.TP -.BI \-grid2 " color" -.RB ( .grid2Color ) -Determines the color of level 2 grid (default as foreground) -.TP -.BI \-grid3 " color" -.RB ( .grid3Color ) -Determines the color of level 3 grid (default as foreground) +.BI \-rulecolor " color" +.RB ( .ruleColor ) +Determines the color of the rules used for the the magnifier +#ifgrid +and the `grid' #endif +(default: foreground color). .TP .BI \-geometry " geometry" .RB ( *geometry ) @@ -1349,12 +1339,9 @@ This key toggles the use of grid over the document. If no number is given, the grid mode toggles. By prepending number, 3 grid levels can be set. -The grid in each level is drawn in the colour specified. See also the -.B \-grid1, \-grid2, -and -.B \-grid3 -options. +.B \-rulecolor +option. #endif #ifps .TP