diff --git a/ChangeLog b/ChangeLog index 60c57c4e36c420b9087d546b0fbf6fe8b8d514bd..0b565397588db6ca5ff98860b6ae9370dd710bbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ CVS code - use a flag instead (just as messy?) - --enable-tiny now leaves out the Auto Indent code, do you really need that on a bootdisk? =-) + - New flag -o, --operatingdir, similar to Pico's -o mode. New + function check_operating_dir(), changes to load_file (arg), + open_file_dup_search (arg), new function do_gotopos for -F. - nano.c: main() - Added vars oldcurrent and oldcurrent_x to check whether cursor diff --git a/acconfig.h b/acconfig.h index bdcb3c5b1c9404ca9e5ceefa02f1af21645b6168..ac28286863446eb79609c823ce29c944b490dd26 100644 --- a/acconfig.h +++ b/acconfig.h @@ -54,7 +54,10 @@ /* Define this to disable the mouse functions */ #undef DISABLE_MOUSE -/* Define this to load files upon inserting them, and allow switching between them; this is disabled if NANO_SMALL is defined */ +/* Define this to disable setting of the operating directory (chroot of sorts) */ +#undef DISABLE_OPERATINGDIR + +/* Define this to enable multiple file buffers; this is disabled if NANO_SMALL is defined */ #undef ENABLE_MULTIBUFFER /* Define this to use the .nanorc file */ diff --git a/config.h.in b/config.h.in index 5a66acc0a4c4bce2a23e98d69a485f6128949a7e..02ba1537cee5270db11b3f348f51d9db07b6e346 100644 --- a/config.h.in +++ b/config.h.in @@ -88,7 +88,10 @@ /* Define this to disable the mouse functions */ #undef DISABLE_MOUSE -/* Define this to load files upon inserting them, and allow switching between them; this is disabled if NANO_SMALL is defined */ +/* Define this to disable setting of the operating directory (chroot of sorts) */ +#undef DISABLE_OPERATINGDIR + +/* Define this to enable multiple file buffers; this is disabled if NANO_SMALL is defined */ #undef ENABLE_MULTIBUFFER /* Define this to use the .nanorc file */ diff --git a/configure b/configure index 1430e57b9fc973a4b592f10b34aa068742edaee0..0b5dc6e7131d9e84fd9b06c9b44bc0230e1dedaa 100755 --- a/configure +++ b/configure @@ -21,7 +21,7 @@ ac_help="$ac_help ac_help="$ac_help --enable-undo Enable undo support" ac_help="$ac_help - --enable-multibuffer Enable use of file loading on insertion, and switching between loaded files; this is disabled if --enable-tiny is used" + --enable-multibuffer Enable multiple file buffers; this is disabled if --enable-tiny is used" ac_help="$ac_help --enable-nanorc Enable use of .nanorc file" ac_help="$ac_help @@ -40,6 +40,8 @@ ac_help="$ac_help --disable-wrapping Disable all wrapping of text (and -w flag)" ac_help="$ac_help --disable-mouse Disable mouse support (and -m flag)" +ac_help="$ac_help + --disable-operatingdir Disable setting of operating directory (chroot of sorts)" ac_help="$ac_help --with-slang[=DIR] Use the slang library instead of curses" ac_help="$ac_help @@ -601,7 +603,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:605: checking for a BSD compatible install" >&5 +echo "configure:607: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -654,7 +656,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:658: checking whether build environment is sane" >&5 +echo "configure:660: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -711,7 +713,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:715: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:717: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -757,7 +759,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:761: checking for working aclocal" >&5 +echo "configure:763: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -770,7 +772,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:774: checking for working autoconf" >&5 +echo "configure:776: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -783,7 +785,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:787: checking for working automake" >&5 +echo "configure:789: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -796,7 +798,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:800: checking for working autoheader" >&5 +echo "configure:802: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -809,7 +811,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:813: checking for working makeinfo" >&5 +echo "configure:815: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -830,7 +832,7 @@ ALL_LINGUAS="es de fr it id fi hu ca cs gl uk ru sv no nl da" # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:834: checking for $ac_word" >&5 +echo "configure:836: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -860,7 +862,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:864: checking for $ac_word" >&5 +echo "configure:866: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -911,7 +913,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:915: checking for $ac_word" >&5 +echo "configure:917: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -943,7 +945,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:947: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:949: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -954,12 +956,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 958 "configure" +#line 960 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -985,12 +987,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:989: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:991: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:994: checking whether we are using GNU C" >&5 +echo "configure:996: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -999,7 +1001,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1003: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1005: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1018,7 +1020,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1022: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1024: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1051,7 +1053,7 @@ fi echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6 -echo "configure:1055: checking for strerror in -lcposix" >&5 +echo "configure:1057: checking for strerror in -lcposix" >&5 ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1059,7 +1061,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcposix $LIBS" cat > conftest.$ac_ext <<EOF -#line 1063 "configure" +#line 1065 "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 @@ -1070,7 +1072,7 @@ int main() { strerror() ; return 0; } EOF -if { (eval echo configure:1074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1076: \"$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 @@ -1102,7 +1104,7 @@ fi if test "$enable_largefile" != no; then echo $ac_n "checking for special C compiler options needed for large files""... $ac_c" 1>&6 -echo "configure:1106: checking for special C compiler options needed for large files" >&5 +echo "configure:1108: checking for special C compiler options needed for large files" >&5 if eval "test \"`echo '$''{'ac_cv_sys_largefile_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1111,7 +1113,7 @@ else # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat > conftest.$ac_ext <<EOF -#line 1115 "configure" +#line 1117 "configure" #include "confdefs.h" #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. @@ -1127,7 +1129,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1131: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 @@ -1136,7 +1138,7 @@ else ac_save_CC="$CC" CC="$CC -n32" cat > conftest.$ac_ext <<EOF -#line 1140 "configure" +#line 1142 "configure" #include "confdefs.h" #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. @@ -1152,7 +1154,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sys_largefile_CC=' -n32' else @@ -1172,13 +1174,13 @@ echo "$ac_t""$ac_cv_sys_largefile_CC" 1>&6 fi echo $ac_n "checking for _FILE_OFFSET_BITS value needed for large files""... $ac_c" 1>&6 -echo "configure:1176: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +echo "configure:1178: checking for _FILE_OFFSET_BITS value needed for large files" >&5 if eval "test \"`echo '$''{'ac_cv_sys_file_offset_bits'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_sys_file_offset_bits=no cat > conftest.$ac_ext <<EOF -#line 1182 "configure" +#line 1184 "configure" #include "confdefs.h" #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. @@ -1194,14 +1196,14 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1200: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 1205 "configure" +#line 1207 "configure" #include "confdefs.h" #define _FILE_OFFSET_BITS 64 #include <sys/types.h> @@ -1219,7 +1221,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1223: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1225: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sys_file_offset_bits=64 else @@ -1239,13 +1241,13 @@ EOF fi echo $ac_n "checking for _LARGE_FILES value needed for large files""... $ac_c" 1>&6 -echo "configure:1243: checking for _LARGE_FILES value needed for large files" >&5 +echo "configure:1245: checking for _LARGE_FILES value needed for large files" >&5 if eval "test \"`echo '$''{'ac_cv_sys_large_files'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_sys_large_files=no cat > conftest.$ac_ext <<EOF -#line 1249 "configure" +#line 1251 "configure" #include "confdefs.h" #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. @@ -1261,14 +1263,14 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1265: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1267: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 1272 "configure" +#line 1274 "configure" #include "confdefs.h" #define _LARGE_FILES 1 #include <sys/types.h> @@ -1286,7 +1288,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1290: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1292: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sys_large_files=1 else @@ -1309,7 +1311,7 @@ EOF echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1313: checking how to run the C preprocessor" >&5 +echo "configure:1315: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1324,13 +1326,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1328 "configure" +#line 1330 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1334: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1336: \"$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 : @@ -1341,13 +1343,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1345 "configure" +#line 1347 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1351: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1353: \"$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 : @@ -1358,13 +1360,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1362 "configure" +#line 1364 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1368: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1370: \"$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 : @@ -1389,12 +1391,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1393: checking for ANSI C header files" >&5 +echo "configure:1395: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1398 "configure" +#line 1400 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1402,7 +1404,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1406: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1408: \"$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* @@ -1419,7 +1421,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1423 "configure" +#line 1425 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1437,7 +1439,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1441 "configure" +#line 1443 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1458,7 +1460,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1462 "configure" +#line 1464 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1469,7 +1471,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1496,17 +1498,17 @@ for ac_hdr in fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h reg do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1500: checking for $ac_hdr" >&5 +echo "configure:1502: 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 1505 "configure" +#line 1507 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1510: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1512: \"$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* @@ -1565,6 +1567,10 @@ EOF #define DISABLE_MOUSE 1 EOF + cat >> confdefs.h <<\EOF +#define DISABLE_OPERATINGDIR 1 +EOF + fi fi @@ -1732,8 +1738,20 @@ EOF fi +# Check whether --enable-operatingdir or --disable-operatingdir was given. +if test "${enable_operatingdir+set}" = set; then + enableval="$enable_operatingdir" + if test x$enableval != xyes; then + cat >> confdefs.h <<\EOF +#define DISABLE_OPERATINGDIR 1 +EOF + + fi +fi + + echo $ac_n "checking whether to use slang""... $ac_c" 1>&6 -echo "configure:1737: checking whether to use slang" >&5 +echo "configure:1755: checking whether to use slang" >&5 CURSES_LIB_NAME="" # Check whether --with-slang or --without-slang was given. if test "${with_slang+set}" = set; then @@ -1753,17 +1771,17 @@ if test "${with_slang+set}" = set; then ac_safe=`echo "slcurses.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for slcurses.h""... $ac_c" 1>&6 -echo "configure:1757: checking for slcurses.h" >&5 +echo "configure:1775: checking for slcurses.h" >&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 1762 "configure" +#line 1780 "configure" #include "confdefs.h" #include <slcurses.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1767: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1785: \"$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* @@ -1780,21 +1798,21 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for SLtt_initialize in -lslang""... $ac_c" 1>&6 -echo "configure:1784: checking for SLtt_initialize in -lslang" >&5 +echo "configure:1802: checking for SLtt_initialize in -lslang" >&5 _libs=$LIBS LIBS="$LIBS -lslang" if test "$cross_compiling" = yes; then echo "configure: warning: *** Can not use slang when cross-compiling" 1>&2 else cat > conftest.$ac_ext <<EOF -#line 1791 "configure" +#line 1809 "configure" #include "confdefs.h" #include <stdio.h> #include <slcurses.h> int main () { SLtt_initialize (NULL); return 0; } EOF -if { (eval echo configure:1798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1816: \"$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 @@ -1817,7 +1835,7 @@ else # We might need the term library for termlib in ncurses curses termcap terminfo termlib; do echo $ac_n "checking for tputs in -l${termlib}""... $ac_c" 1>&6 -echo "configure:1821: checking for tputs in -l${termlib}" >&5 +echo "configure:1839: checking for tputs in -l${termlib}" >&5 ac_lib_var=`echo ${termlib}'_'tputs | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1825,7 +1843,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${termlib} $LIBS" cat > conftest.$ac_ext <<EOF -#line 1829 "configure" +#line 1847 "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 @@ -1836,7 +1854,7 @@ int main() { tputs() ; return 0; } EOF -if { (eval echo configure:1840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1858: \"$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 @@ -1860,20 +1878,20 @@ fi done echo $ac_n "checking for SLtt_initialize in -lslang $tcap""... $ac_c" 1>&6 -echo "configure:1864: checking for SLtt_initialize in -lslang $tcap" >&5 +echo "configure:1882: checking for SLtt_initialize in -lslang $tcap" >&5 LIBS="$LIBS $tcap" if test "$cross_compiling" = yes; then echo "configure: warning: *** Can not use slang when cross-compiling" 1>&2 else cat > conftest.$ac_ext <<EOF -#line 1870 "configure" +#line 1888 "configure" #include "confdefs.h" #include <stdio.h> #include <slcurses.h> int main () { SLtt_initialize (NULL); return 0; } EOF -if { (eval echo configure:1877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1895: \"$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 @@ -1895,20 +1913,20 @@ else echo "$ac_t""no" 1>&6 # We might need the math library echo $ac_n "checking for SLtt_initialize in -lslang $tcap -lm""... $ac_c" 1>&6 -echo "configure:1899: checking for SLtt_initialize in -lslang $tcap -lm" >&5 +echo "configure:1917: checking for SLtt_initialize in -lslang $tcap -lm" >&5 LIBS="$LIBS -lm" if test "$cross_compiling" = yes; then echo "configure: warning: *** Can not use slang when cross-compiling" 1>&2 else cat > conftest.$ac_ext <<EOF -#line 1905 "configure" +#line 1923 "configure" #include "confdefs.h" #include <stdio.h> #include <slcurses.h> int main () { SLtt_initialize (NULL); return 0; } EOF -if { (eval echo configure:1912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1930: \"$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 @@ -1965,12 +1983,12 @@ fi for ac_func in snprintf vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1969: checking for $ac_func" >&5 +echo "configure:1987: 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 1974 "configure" +#line 1992 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1993,7 +2011,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2015: \"$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 @@ -2072,7 +2090,7 @@ fi # Extract the first word of "glib-config", so it can be a program name with args. set dummy glib-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2076: checking for $ac_word" >&5 +echo "configure:2094: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GLIB_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2107,7 +2125,7 @@ fi min_glib_version=1.2.4 echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6 -echo "configure:2111: checking for GLIB - version >= $min_glib_version" >&5 +echo "configure:2129: checking for GLIB - version >= $min_glib_version" >&5 no_glib="" if test "$GLIB_CONFIG" = "no" ; then no_glib=yes @@ -2130,7 +2148,7 @@ echo "configure:2111: checking for GLIB - version >= $min_glib_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext <<EOF -#line 2134 "configure" +#line 2152 "configure" #include "confdefs.h" #include <glib.h> @@ -2206,7 +2224,7 @@ main () } EOF -if { (eval echo configure:2210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2240,7 +2258,7 @@ fi CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" cat > conftest.$ac_ext <<EOF -#line 2244 "configure" +#line 2262 "configure" #include "confdefs.h" #include <glib.h> @@ -2250,7 +2268,7 @@ int main() { return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ; return 0; } EOF -if { (eval echo configure:2254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GLIB or finding the wrong" @@ -2297,12 +2315,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2301: checking return type of signal handlers" >&5 +echo "configure:2319: 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 2306 "configure" +#line 2324 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -2319,7 +2337,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2323: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2341: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2338,12 +2356,12 @@ EOF echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:2342: checking for vprintf" >&5 +echo "configure:2360: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2347 "configure" +#line 2365 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vprintf(); below. */ @@ -2366,7 +2384,7 @@ vprintf(); ; return 0; } EOF -if { (eval echo configure:2370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -2390,12 +2408,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:2394: checking for _doprnt" >&5 +echo "configure:2412: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2399 "configure" +#line 2417 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt(); below. */ @@ -2418,7 +2436,7 @@ _doprnt(); ; return 0; } EOF -if { (eval echo configure:2422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -2445,12 +2463,12 @@ fi for ac_func in getopt_long do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2449: checking for $ac_func" >&5 +echo "configure:2467: 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 2454 "configure" +#line 2472 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2473,7 +2491,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2495: \"$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 @@ -2506,17 +2524,17 @@ then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2510: checking for $ac_hdr" >&5 +echo "configure:2528: 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 2515 "configure" +#line 2533 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2520: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2538: \"$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* @@ -2543,7 +2561,7 @@ fi done echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6 -echo "configure:2547: checking for tgetent in -lncurses" >&5 +echo "configure:2565: checking for tgetent in -lncurses" >&5 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2551,7 +2569,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 2555 "configure" +#line 2573 "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 @@ -2562,7 +2580,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:2566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2584: \"$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 @@ -2587,7 +2605,7 @@ fi if eval "test x$CURSES_LIB_NAME = x" then echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6 -echo "configure:2591: checking for tgetent in -lcurses" >&5 +echo "configure:2609: checking for tgetent in -lcurses" >&5 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2595,7 +2613,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 2599 "configure" +#line 2617 "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 @@ -2606,7 +2624,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:2610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2628: \"$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 @@ -2632,7 +2650,7 @@ fi if eval "test x$CURSES_LIB_NAME = x" then echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6 -echo "configure:2636: checking for initscr in -lcurses" >&5 +echo "configure:2654: checking for initscr in -lcurses" >&5 ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2640,7 +2658,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 2644 "configure" +#line 2662 "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 @@ -2651,7 +2669,7 @@ int main() { initscr() ; return 0; } EOF -if { (eval echo configure:2655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2673: \"$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 @@ -2676,7 +2694,7 @@ fi if eval "test x$CURSES_LIB_NAME = x" then echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:2680: checking for tgetent in -ltermcap" >&5 +echo "configure:2698: checking for tgetent in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2684,7 +2702,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 2688 "configure" +#line 2706 "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 @@ -2695,7 +2713,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:2699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2717: \"$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 @@ -2729,7 +2747,7 @@ fi echo $ac_n "checking for use_default_colors in -l$CURSES_LIB_NAME""... $ac_c" 1>&6 -echo "configure:2733: checking for use_default_colors in -l$CURSES_LIB_NAME" >&5 +echo "configure:2751: checking for use_default_colors in -l$CURSES_LIB_NAME" >&5 ac_lib_var=`echo $CURSES_LIB_NAME'_'use_default_colors | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2737,7 +2755,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$CURSES_LIB_NAME $LIBS" cat > conftest.$ac_ext <<EOF -#line 2741 "configure" +#line 2759 "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 @@ -2748,7 +2766,7 @@ int main() { use_default_colors() ; return 0; } EOF -if { (eval echo configure:2752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2770: \"$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 @@ -2773,7 +2791,7 @@ fi if test x$slang_support != xyes; then echo $ac_n "checking for wresize in -l$CURSES_LIB_NAME""... $ac_c" 1>&6 -echo "configure:2777: checking for wresize in -l$CURSES_LIB_NAME" >&5 +echo "configure:2795: checking for wresize in -l$CURSES_LIB_NAME" >&5 ac_lib_var=`echo $CURSES_LIB_NAME'_'wresize | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2781,7 +2799,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$CURSES_LIB_NAME $LIBS" cat > conftest.$ac_ext <<EOF -#line 2785 "configure" +#line 2803 "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 @@ -2792,7 +2810,7 @@ int main() { wresize() ; return 0; } EOF -if { (eval echo configure:2796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2814: \"$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 @@ -2816,7 +2834,7 @@ else fi echo $ac_n "checking for resizeterm in -l$CURSES_LIB_NAME""... $ac_c" 1>&6 -echo "configure:2820: checking for resizeterm in -l$CURSES_LIB_NAME" >&5 +echo "configure:2838: checking for resizeterm in -l$CURSES_LIB_NAME" >&5 ac_lib_var=`echo $CURSES_LIB_NAME'_'resizeterm | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2824,7 +2842,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$CURSES_LIB_NAME $LIBS" cat > conftest.$ac_ext <<EOF -#line 2828 "configure" +#line 2846 "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 @@ -2835,7 +2853,7 @@ int main() { resizeterm() ; return 0; } EOF -if { (eval echo configure:2839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2857: \"$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 @@ -2861,12 +2879,12 @@ fi # Taken from aumix (can't tell form the variable name?) echo $ac_n "checking for private member _use_keypad in WINDOW""... $ac_c" 1>&6 -echo "configure:2865: checking for private member _use_keypad in WINDOW" >&5 +echo "configure:2883: checking for private member _use_keypad in WINDOW" >&5 if eval "test \"`echo '$''{'aumix_cv_struct_window_usekeypad'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2870 "configure" +#line 2888 "configure" #include "confdefs.h" #ifdef HAVE_NCURSES_H #include <ncurses.h> @@ -2877,7 +2895,7 @@ int main() { WINDOW w; w._use_keypad; ; return 0; } EOF -if { (eval echo configure:2881: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* aumix_cv_struct_window_usekeypad=yes else @@ -2923,7 +2941,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2927: checking for $ac_word" >&5 +echo "configure:2945: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2951,12 +2969,12 @@ else fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2955: checking for working const" >&5 +echo "configure:2973: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2960 "configure" +#line 2978 "configure" #include "confdefs.h" int main() { @@ -3005,7 +3023,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:3009: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3027: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3026,21 +3044,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:3030: checking for inline" >&5 +echo "configure:3048: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 3037 "configure" +#line 3055 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:3044: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -3066,12 +3084,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:3070: checking for off_t" >&5 +echo "configure:3088: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3075 "configure" +#line 3093 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3099,12 +3117,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3103: checking for size_t" >&5 +echo "configure:3121: 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 <<EOF -#line 3108 "configure" +#line 3126 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3134,19 +3152,19 @@ 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:3138: checking for working alloca.h" >&5 +echo "configure:3156: 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 <<EOF -#line 3143 "configure" +#line 3161 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3168: \"$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 @@ -3167,12 +3185,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3171: checking for alloca" >&5 +echo "configure:3189: 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 <<EOF -#line 3176 "configure" +#line 3194 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -3200,7 +3218,7 @@ int main() { char *p = (char *) alloca(1); ; 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:3222: \"$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 @@ -3232,12 +3250,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3236: checking whether alloca needs Cray hooks" >&5 +echo "configure:3254: 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 <<EOF -#line 3241 "configure" +#line 3259 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -3262,12 +3280,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3266: checking for $ac_func" >&5 +echo "configure:3284: 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 3271 "configure" +#line 3289 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3290,7 +3308,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3294: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3312: \"$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 @@ -3317,7 +3335,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3321: checking stack direction for C alloca" >&5 +echo "configure:3339: 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 @@ -3325,7 +3343,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 3329 "configure" +#line 3347 "configure" #include "confdefs.h" find_stack_direction () { @@ -3344,7 +3362,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:3348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3366: \"$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 @@ -3369,17 +3387,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:3373: checking for $ac_hdr" >&5 +echo "configure:3391: 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 3378 "configure" +#line 3396 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3401: \"$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* @@ -3408,12 +3426,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3412: checking for $ac_func" >&5 +echo "configure:3430: 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 3417 "configure" +#line 3435 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3436,7 +3454,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3458: \"$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 @@ -3461,7 +3479,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3465: checking for working mmap" >&5 +echo "configure:3483: 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 @@ -3469,7 +3487,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 3473 "configure" +#line 3491 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -3609,7 +3627,7 @@ main() } EOF -if { (eval echo configure:3613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3631: \"$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 @@ -3637,17 +3655,17 @@ unistd.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3641: checking for $ac_hdr" >&5 +echo "configure:3659: 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 3646 "configure" +#line 3664 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3651: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3669: \"$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* @@ -3677,12 +3695,12 @@ done strdup __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3681: checking for $ac_func" >&5 +echo "configure:3699: 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 3686 "configure" +#line 3704 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3705,7 +3723,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3727: \"$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 @@ -3734,12 +3752,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3738: checking for $ac_func" >&5 +echo "configure:3756: 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 3743 "configure" +#line 3761 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3762,7 +3780,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3784: \"$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 @@ -3796,19 +3814,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3800: checking for LC_MESSAGES" >&5 +echo "configure:3818: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3805 "configure" +#line 3823 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -3829,7 +3847,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3833: checking whether NLS is requested" >&5 +echo "configure:3851: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -3867,7 +3885,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3871: checking whether included gettext is requested" >&5 +echo "configure:3889: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -3886,17 +3904,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3890: checking for libintl.h" >&5 +echo "configure:3908: checking for libintl.h" >&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 3895 "configure" +#line 3913 "configure" #include "confdefs.h" #include <libintl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3900: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3918: \"$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* @@ -3913,19 +3931,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:3917: checking for gettext in libc" >&5 +echo "configure:3935: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3922 "configure" +#line 3940 "configure" #include "confdefs.h" #include <libintl.h> int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:3929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -3941,7 +3959,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:3945: checking for bindtextdomain in -lintl" >&5 +echo "configure:3963: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3949,7 +3967,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3953 "configure" +#line 3971 "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 @@ -3960,7 +3978,7 @@ int main() { bindtextdomain() ; return 0; } EOF -if { (eval echo configure:3964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3982: \"$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 @@ -3976,7 +3994,7 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6 -echo "configure:3980: checking for gettext in -lintl" >&5 +echo "configure:3998: checking for gettext in -lintl" >&5 ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3984,7 +4002,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3988 "configure" +#line 4006 "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 @@ -3995,7 +4013,7 @@ int main() { gettext() ; return 0; } EOF -if { (eval echo configure:3999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4017: \"$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 @@ -4037,7 +4055,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4041: checking for $ac_word" >&5 +echo "configure:4059: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4071,12 +4089,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4075: checking for $ac_func" >&5 +echo "configure:4093: 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 4080 "configure" +#line 4098 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4099,7 +4117,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4121: \"$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 @@ -4126,7 +4144,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4130: checking for $ac_word" >&5 +echo "configure:4148: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4162,7 +4180,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4166: checking for $ac_word" >&5 +echo "configure:4184: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4194,7 +4212,7 @@ else fi cat > conftest.$ac_ext <<EOF -#line 4198 "configure" +#line 4216 "configure" #include "confdefs.h" int main() { @@ -4202,7 +4220,7 @@ extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:4206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -4225,7 +4243,7 @@ fi if test "$CATOBJEXT" = "NONE"; then echo $ac_n "checking whether catgets can be used""... $ac_c" 1>&6 -echo "configure:4229: checking whether catgets can be used" >&5 +echo "configure:4247: checking whether catgets can be used" >&5 # Check whether --with-catgets or --without-catgets was given. if test "${with_catgets+set}" = set; then withval="$with_catgets" @@ -4238,7 +4256,7 @@ fi if test "$nls_cv_use_catgets" = "yes"; then echo $ac_n "checking for main in -li""... $ac_c" 1>&6 -echo "configure:4242: checking for main in -li" >&5 +echo "configure:4260: checking for main in -li" >&5 ac_lib_var=`echo i'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4246,14 +4264,14 @@ else ac_save_LIBS="$LIBS" LIBS="-li $LIBS" cat > conftest.$ac_ext <<EOF -#line 4250 "configure" +#line 4268 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:4257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4275: \"$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 @@ -4281,12 +4299,12 @@ else fi echo $ac_n "checking for catgets""... $ac_c" 1>&6 -echo "configure:4285: checking for catgets" >&5 +echo "configure:4303: checking for catgets" >&5 if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4290 "configure" +#line 4308 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char catgets(); below. */ @@ -4309,7 +4327,7 @@ catgets(); ; return 0; } EOF -if { (eval echo configure:4313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_catgets=yes" else @@ -4331,7 +4349,7 @@ EOF # Extract the first word of "gencat", so it can be a program name with args. set dummy gencat; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4335: checking for $ac_word" >&5 +echo "configure:4353: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GENCAT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4367,7 +4385,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4371: checking for $ac_word" >&5 +echo "configure:4389: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4404,7 +4422,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4408: checking for $ac_word" >&5 +echo "configure:4426: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4439,7 +4457,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4443: checking for $ac_word" >&5 +echo "configure:4461: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4497,7 +4515,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4501: checking for $ac_word" >&5 +echo "configure:4519: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4531,7 +4549,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4535: checking for $ac_word" >&5 +echo "configure:4553: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4567,7 +4585,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4571: checking for $ac_word" >&5 +echo "configure:4589: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4664,7 +4682,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4668: checking for catalogs to be installed" >&5 +echo "configure:4686: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -4692,17 +4710,17 @@ echo "configure:4668: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:4696: checking for linux/version.h" >&5 +echo "configure:4714: checking for linux/version.h" >&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 4701 "configure" +#line 4719 "configure" #include "confdefs.h" #include <linux/version.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4706: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4724: \"$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 --git a/configure.in b/configure.in index 9945bb5d4a34cc40a7929fd79635bd9044df740a..b9ab449f2ca0c9095eb08226e31c803d277e3862 100644 --- a/configure.in +++ b/configure.in @@ -26,6 +26,7 @@ AC_ARG_ENABLE(tiny, AC_DEFINE(DISABLE_JUSTIFY) AC_DEFINE(DISABLE_BROWSER) AC_DEFINE(DISABLE_MOUSE) + AC_DEFINE(DISABLE_OPERATINGDIR) fi]) AC_ARG_ENABLE(extra, @@ -43,7 +44,7 @@ AC_ARG_ENABLE(undo, fi]) AC_ARG_ENABLE(multibuffer, -[ --enable-multibuffer Enable use of file loading on insertion, and switching between loaded files; this is disabled if --enable-tiny is used], +[ --enable-multibuffer Enable multiple file buffers; this is disabled if --enable-tiny is used], [if test x$enableval = xyes && test x$tiny_support != xyes; then AC_DEFINE(ENABLE_MULTIBUFFER) multibuffer_support=yes fi]) @@ -110,6 +111,12 @@ AC_ARG_ENABLE(mouse, AC_DEFINE(DISABLE_MOUSE) fi]) +AC_ARG_ENABLE(operatingdir, +[ --disable-operatingdir Disable setting of operating directory (chroot of sorts)], + [if test x$enableval != xyes; then + AC_DEFINE(DISABLE_OPERATINGDIR) + fi]) + AC_MSG_CHECKING([whether to use slang]) CURSES_LIB_NAME="" AC_ARG_WITH(slang, diff --git a/files.c b/files.c index f5bef06910ca8ea6ecc18e3100d19bb78c308633..eaedd47144f5d3e4ce252bcb60ab1348b1283499 100644 --- a/files.c +++ b/files.c @@ -44,16 +44,20 @@ #endif /* Load file into edit buffer - takes data from file struct */ -void load_file(void) +void load_file(int quiet) { current = fileage; #ifdef ENABLE_MULTIBUFFER - /* add a new entry to the open_files structure, and check for - duplicate entries; if a duplicate entry was found, reload the - currently open file (it may have been changed during duplicate - handling) */ - if (add_open_file(0, 1) == 2) + /* if quiet is zero, add a new entry to the open_files structure, and + do duplicate checking; otherwise, update the current entry and + don't do duplicate checking (the latter is needed in the case of + the alternate spell checker); if a duplicate entry was found, + reload the currently open file (it may have been changed during + duplicate handling) */ + if (quiet != 0) + quiet = 1; + if (add_open_file(quiet, 1 - quiet) == 2) load_open_file(); #endif @@ -79,8 +83,8 @@ void new_file(void) /* if there aren't any entries in open_files, create the entry for this new file, and, of course, don't bother checking for duplicates; without this, if nano is started without a filename on - the command line, a new file with no name will be created, but it - will be given no open_files entry, leading to problems later on */ + the command line, a new file will be created, but it will be given + no open_files entry, leading to problems later on */ if (!open_files) add_open_file(0, 0); #endif @@ -149,7 +153,7 @@ filestruct *read_line(char *buf, filestruct * prev, int *line1ins) } -int read_file(int fd, char *filename) +int read_file(int fd, char *filename, int quiet) { long size, num_lines = 0, linetemp = 0; char input[2]; /* buffer */ @@ -220,7 +224,7 @@ int read_file(int fd, char *filename) totsize--; /* Update the edit buffer */ - load_file(); + load_file(quiet); } statusbar(_("Read %d lines"), num_lines); totlines += num_lines; @@ -262,13 +266,14 @@ int open_file(char *filename, int insert, int quiet) /* Don't open character or block files. Sorry, /dev/sndstat! */ statusbar(_("File \"%s\" is a device file"), filename); + if (!insert) new_file(); return -1; } if (!quiet) statusbar(_("Reading File")); - read_file(fd, filename); + read_file(fd, filename, quiet); } return 1; @@ -319,6 +324,15 @@ int do_insertfile(int loading_file) } #endif +#ifndef DISABLE_OPERATINGDIR + if (operating_dir) { + if (check_operating_dir(realname, 0)) { + statusbar(_("Can't insert file from outside of %s"), operating_dir); + return 0; + } + } +#endif + #ifdef ENABLE_MULTIBUFFER if (loading_file) { @@ -346,7 +360,7 @@ int do_insertfile(int loading_file) #ifdef ENABLE_MULTIBUFFER if (loading_file) - load_file(); + load_file(0); else #endif @@ -475,9 +489,7 @@ int add_open_file(int update, int dup_fix) while (current->prev) current = current->prev; open_files->file = copy_filestruct(current); - do_gotoline(open_files->lineno, 1); - placewewant = open_files->file_placewewant; - update_line(current, current_x); + do_gotopos(open_files->lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant); /* save current modification status */ open_files->file_modified = ISSET(MODIFIED); @@ -525,13 +537,9 @@ int load_open_file(void) totlines = open_files->file_totlines; totsize = open_files->file_totsize; - /* since do_gotoline() resets the x-coordinate but not the - y-coordinate, set all coordinates up this way */ - current_y = open_files->file_current_y; - do_gotoline(open_files->lineno, 1); - current_x = open_files->file_current_x; - placewewant = open_files->file_placewewant; - update_line(current, current_x); + /* restore full file position: line number, x-coordinate, y- + coordinate, place we want */ + do_gotopos(open_files->lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant); /* set up modification status and update the titlebar */ if (open_files->file_modified) @@ -556,7 +564,7 @@ int load_open_file(void) * * Note: This should only be called inside open_file_dup_fix(). */ -filestruct *open_file_dup_search(void) +filestruct *open_file_dup_search(int update) { filestruct *tmp; char *path; @@ -582,9 +590,18 @@ filestruct *open_file_dup_search(void) if (!strcmp(tmp->file_path, path)) { - /* if it's not the current entry, we've found a duplicate */ - if (tmp != open_files) + if (!update) + /* if we're making a new entry and there's an entry with + the same full path, we've found a duplicate */ return tmp; + else { + + /* if we're updating an existing entry and there's an + entry with the same full path that isn't the current + entry, we've found a duplicate */ + if (tmp != open_files) + return tmp; + } } /* go to the next entry */ @@ -602,7 +619,7 @@ filestruct *open_file_dup_search(void) */ int open_file_dup_fix(int update) { - filestruct *tmp = open_file_dup_search(); + filestruct *tmp = open_file_dup_search(update); if (!tmp) return 0; @@ -766,17 +783,25 @@ int close_open_file(void) display_main_list(); return 0; } +#endif +#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_OPERATINGDIR) /* - * When passed "[relative path][filename]" in origpath, return "[full - * path][filename]" on success, or NULL on error. + * When passed "[relative path]" or "[relative path][filename]" in + * origpath, return "[full path]" or "[full path][filename]" on success, + * or NULL on error. This is still done if the file doesn't exist but + * the relative path does (since the file could exist in memory but not + * yet on disk); it is not done if the relative path doesn't exist (since + * the first call to chdir() will fail then). */ -char *get_full_path(const char *origpath) +char *get_full_path(char *origpath) { - char *newpath = NULL, *last_slash, *d_here, *d_there, *d_there_file; - int last_slash_index; + char *newpath = NULL, *last_slash, *d_here, *d_there, *d_there_file, tmp; + int path_only, last_slash_index; + struct stat fileinfo; - /* first, get the current directory */ + /* first, get the current directory, and tack a slash onto the end of + it */ #ifdef PATH_MAX d_here = getcwd(NULL, PATH_MAX + 1); @@ -787,14 +812,42 @@ char *get_full_path(const char *origpath) if (d_here) { align(&d_here); + d_here = nrealloc(d_here, strlen(d_here) + 2); + strcat(d_here, "/"); + + /* stat origpath; if stat() fails, assume that origpath refers to + a new file that hasn't been saved to disk yet (i. e. set + path_only to 0); if stat() succeeds, set path_only to 0 if + origpath doesn't refer to a directory, or to 1 if it does */ + path_only = stat(origpath, &fileinfo); + if (path_only == -1) + path_only = 0; + else { + if (S_ISDIR(fileinfo.st_mode)) + path_only = 1; + else + path_only = 0; + } - /* get the filename (with path included) and save it in both - d_there and d_there_file */ + /* save the value of origpath in both d_there and d_there_file */ d_there = charalloc(strlen(origpath) + 1); d_there_file = charalloc(strlen(origpath) + 1); strcpy(d_there, origpath); strcpy(d_there_file, origpath); + /* if we have a path but no filename, tack slashes onto the ends + of both d_there and d_there_file, if they don't end in slashes + already */ + if (path_only) { + tmp = d_there[strlen(d_there) - 1]; + if (tmp != '/') { + d_there = nrealloc(d_there, strlen(d_there) + 2); + strcat(d_there, "/"); + d_there_file = nrealloc(d_there_file, strlen(d_there_file) + 2); + strcat(d_there_file, "/"); + } + } + /* search for the last slash in d_there */ last_slash = strrchr(d_there, '/'); @@ -807,19 +860,27 @@ char *get_full_path(const char *origpath) else { - /* otherwise, remove all non-path elements from d_there */ + /* otherwise, remove all non-path elements from d_there + (i. e. everything after the last slash) */ last_slash_index = strlen(d_there) - strlen(last_slash); - null_at(d_there, last_slash_index); - - /* and remove all non-file elements from d_there_file */ - last_slash++; - d_there_file = nrealloc(d_there_file, strlen(last_slash) + 1); - strcpy(d_there_file, last_slash); + null_at(d_there, last_slash_index + 1); + + /* and remove all non-file elements from d_there_file (i. e. + everything before and including the last slash); if we + have a path but no filename, don't do anything */ + if (!path_only) { + last_slash = strrchr(d_there_file, '/'); + last_slash++; + strcpy(d_there_file, last_slash); + align(&d_there_file); + } /* now go to the path specified in d_there */ if (chdir(d_there) != -1) { - /* get the full pathname, and save it back in d_there */ + /* get the full pathname, and save it back in d_there, + tacking a slash on the end if we have a path but no + filename; if the saving fails, get out */ free(d_there); @@ -830,6 +891,12 @@ char *get_full_path(const char *origpath) #endif align(&d_there); + if (d_there) { + d_there = nrealloc(d_there, strlen(d_there) + 2); + strcat(d_there, "/"); + } + else + return NULL; } /* finally, go back to where we were before, d_here (no error @@ -840,11 +907,17 @@ char *get_full_path(const char *origpath) /* all data is set up; fill in newpath */ - /* newpath = d_there + "/" + d_there_file */ - newpath = charalloc(strlen(d_there) + strlen(d_there_file) + 2); - strcpy(newpath, d_there); - strcat(newpath, "/"); - strcat(newpath, d_there_file); + /* if we have a path and a filename, newpath = d_there + + d_there_file; otherwise, newpath = d_there */ + if (!path_only) { + newpath = charalloc(strlen(d_there) + strlen(d_there_file) + 1); + strcpy(newpath, d_there); + strcat(newpath, d_there_file); + } + else { + newpath = charalloc(strlen(d_there) + 1); + strcpy(newpath, d_there); + } /* finally, clean up */ free(d_there_file); @@ -854,6 +927,72 @@ char *get_full_path(const char *origpath) return newpath; } +#endif /* ENABLE_MULTIBUFFER || !DISABLE_OPERATINGDIR */ + +#ifndef DISABLE_OPERATINGDIR +/* + * Check to see if we're inside the operating directory. Return 0 if we + * are, or 1 otherwise. If allow_tabcomp is nonzero, allow incomplete + * names that would be matches for the operating directory, so that tab + * completion will work. + */ +int check_operating_dir(char *currpath, int allow_tabcomp) +{ + /* this is static so that we only need to get it the first time this + function is called; also, a relative operating directory path will + only be handled properly if this is done */ + static char *full_operating_dir = NULL; + + char *fullpath, *whereami1, *whereami2 = NULL; + + /* if no operating directory is set, don't bother doing anything */ + if (!operating_dir) + return 0; + + /* if the operating directory is "/", that's the same as having no + operating directory, so discard it and get out */ + if (!strcmp(operating_dir, "/")) { + operating_dir = NULL; + return 0; + } + + /* get the full operating (if we don't have it already) and current + directories, and then search the current for the operating (for + normal usage) and the operating for the current (for tab + completion, if we're allowing it); if the current directory's path + doesn't exist, assume we're outside the operating directory */ + if (!full_operating_dir) { + full_operating_dir = get_full_path(operating_dir); + + /* if get_full_path() failed, discard the operating directory */ + if (!full_operating_dir) { + operating_dir = NULL; + return 0; + } + } + + fullpath = get_full_path(currpath); + if (!fullpath) + return 1; + + whereami1 = strstr(fullpath, full_operating_dir); + if (allow_tabcomp) + whereami2 = strstr(full_operating_dir, fullpath); + + /* if both searches failed, we're outside the operating directory */ + if (!whereami1 && !whereami2) + return 1; + + /* check the search results; if the full operating directory path is + not at the beginning of the full current path (for normal usage) + and vice versa (for tab completion, if we're allowing it), we're + outside the operating directory */ + if (whereami1 != fullpath && whereami2 != full_operating_dir) + return 1; + + /* otherwise, we're still inside it */ + return 0; +} #endif /* @@ -898,6 +1037,18 @@ int write_file(char *name, int tmp, int append, int nonamechange) realname = mallocstrcpy(realname, name); #endif +#ifndef DISABLE_OPERATINGDIR + if (!tmp && operating_dir) { + /* if we're writing a temporary file, we're going outside the + operating directory, so skip the operating directory test */ + if (check_operating_dir(realname, 0)) { + statusbar(_("Can't write outside of %s"), operating_dir); + + return -1; + } + } +#endif + /* Save the state of file at the end of the symlink (if there is one) */ realexists = stat(realname, &st); @@ -1325,6 +1476,16 @@ char **username_tab_completion(char *buf, int *num_matches) * This makes a lot more sense to me (Chris) this way... */ +#ifndef DISABLE_OPERATINGDIR + /* ...unless the match exists outside the operating + directory, in which case just go to the next match */ + + if (operating_dir) { + if (check_operating_dir(userdata->pw_dir, 1)) + continue; + } +#endif + matchline = charalloc(strlen(userdata->pw_name) + 2); sprintf(matchline, "~%s", userdata->pw_name); matches[*num_matches] = matchline; @@ -1415,6 +1576,27 @@ char **cwd_tab_completion(char *buf, int *num_matches) /* Cool, found a match. Add it to the list * This makes a lot more sense to me (Chris) this way... */ + +#ifndef DISABLE_OPERATINGDIR + /* ...unless the match exists outside the operating + directory, in which case just go to the next match; to + properly do operating directory checking, we have to add the + directory name to the beginning of the proposed match + before we check it */ + + if (operating_dir) { + tmp2 = charalloc(strlen(dirName) + strlen(next->d_name) + 2); + strcpy(tmp2, dirName); + strcat(tmp2, "/"); + strcat(tmp2, next->d_name); + if (check_operating_dir(tmp2, 1)) { + free(tmp2); + continue; + } + free(tmp2); + } +#endif + tmp2 = NULL; tmp2 = charalloc(strlen(next->d_name) + 1); strcpy(tmp2, next->d_name); @@ -1518,6 +1700,13 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace) strncpy(copyto, matches[0], strlen(matches[0]) + 1); *newplace += strlen(matches[0]) - pos; + /* if an exact match is typed in and Tab is pressed, + *newplace will now be negative; in that case, make it + zero, so that the cursor will stay where it is instead of + moving backward */ + if (*newplace < 0) + *newplace = 0; + /* Is it a directory? */ append_slash_if_dir(buf, lastWasTab, newplace); @@ -1925,6 +2114,19 @@ char *do_browser(char *inpath) path = mallocstrcpy(path, filelist[selected]); +#ifndef DISABLE_OPERATINGDIR + /* Note: The case of the user's being completely outside the + operating directory is handled elsewhere, before this + point */ + if (operating_dir) { + if (check_operating_dir(path, 0)) { + statusbar(_("Can't visit parent in restricted mode")); + beep(); + break; + } + } +#endif + st = filestat(path); if (S_ISDIR(st.st_mode)) { if ((test_dir = opendir(path)) == NULL) { @@ -1961,6 +2163,15 @@ char *do_browser(char *inpath) bottombars(browser_list, BROWSER_LIST_LEN); curs_set(0); +#ifndef DISABLE_OPERATINGDIR + if (operating_dir) { + if (check_operating_dir(answer, 0)) { + statusbar(_("Can't go outside of %s in restricted mode"), operating_dir); + break; + } + } +#endif + if (j < 0) { statusbar(_("Goto Cancelled")); break; diff --git a/global.c b/global.c index 8f5d9642a4c0a31dcf69ff213af55eac26dea5fc..0c0de3ff8bbc7afdc4cee3d597a685f4809c75a3 100644 --- a/global.c +++ b/global.c @@ -75,6 +75,11 @@ char *help_text; /* The text in the help window */ filestruct *mark_beginbuf; /* the begin marker buffer */ int mark_beginx; /* X value in the string to start */ +#ifndef DISABLE_OPERATINGDIR +char *operating_dir = NULL; /* Operating directory, which we can't go + higher than */ +#endif + #ifndef DISABLE_SPELLER char *alt_speller; /* Alternative spell command */ #endif diff --git a/nano.c b/nano.c index a27ea5cb4b2a43ac542b4c2a800950fc1aaead97..4c960664c6c4ba9aa52dadafdcb37e584e206cb9 100644 --- a/nano.c +++ b/nano.c @@ -434,8 +434,12 @@ void usage(void) printf(_(" -m --mouse Enable mouse\n")); #endif #endif +#ifndef DISABLE_OPERATINGDIR printf(_ - (" -p --pico Emulate Pico as closely as possible\n")); + (" -o [dir] --operatingdir Set operating directory\n")); +#endif + printf(_ + (" -p --pico Emulate Pico as closely as possible\n")); #ifndef DISABLE_WRAPJUSTIFY printf @@ -481,6 +485,9 @@ void usage(void) #ifdef NCURSES_MOUSE_VERSION printf(_(" -m Enable mouse\n")); #endif +#endif +#ifndef DISABLE_OPERATINGDIR + printf(_(" -o [dir] Set operating directory\n")); #endif printf(_(" -p Emulate Pico as closely as possible\n")); @@ -547,6 +554,9 @@ void version(void) #ifdef DISABLE_MOUSE printf(" --disable-mouse"); #endif +#ifdef DISABLE_OPERATINGDIR + printf(" --disable-operatingdir"); +#endif #endif /* NANO_SMALL */ #ifdef DISABLE_WRAPPING @@ -1533,16 +1543,12 @@ int do_alt_speller(char *file_name) global_init(); open_file(file_name, 0, 1); - do_gotoline(lineno_cur, 0); + /* go back to the old line while keeping the same position, mark the + file as modified, and make sure that the titlebar is refreshed */ + do_gotoline(lineno_cur, 1); set_modified(); - -#ifdef ENABLE_MULTIBUFFER - /* if we have multiple files open, the spell-checked (current) file - is now stored after the un-spell-checked file in the open_files - structure, so go back to the un-spell-checked file and close it */ - open_prevfile(0); - close_open_file(); -#endif + clearok(topwin, FALSE); + titlebar(NULL); return TRUE; } @@ -1569,6 +1575,14 @@ int do_spell(void) return 0; } +#ifdef ENABLE_MULTIBUFFER + /* update the current open_files entry before spell-checking, in case + any problems occur; the case of there being no open_files entries + is handled elsewhere (before we reach this point); no duplicate + checking is needed here */ + add_open_file(1, 0); +#endif + if (alt_speller) spell_res = do_alt_speller(temp); else @@ -2400,6 +2414,9 @@ int main(int argc, char *argv[]) {"fill", 1, 0, 'r'}, #endif {"mouse", 0, 0, 'm'}, +#ifndef DISABLE_OPERATINGDIR + {"operatingdir", 1, 0, 'o'}, +#endif {"pico", 0, 0, 'p'}, {"nofollow", 0, 0, 'l'}, {"tabsize", 1, 0, 'T'}, @@ -2428,11 +2445,11 @@ int main(int argc, char *argv[]) #endif /* ENABLE_NANORC */ #ifdef HAVE_GETOPT_LONG - while ((optchr = getopt_long(argc, argv, "h?FT:RVbcefgijklmpr:s:tvwxz", + while ((optchr = getopt_long(argc, argv, "h?FT:RVabcefgijklmo:pr:s:tvwxz", long_options, &option_index)) != EOF) { #else while ((optchr = - getopt(argc, argv, "h?FT:RVbcefgijklmpr:s:tvwxz")) != EOF) { + getopt(argc, argv, "h?FT:RVabcefgijklmo:pr:s:tvwxz")) != EOF) { #endif switch (optchr) { @@ -2458,6 +2475,7 @@ int main(int argc, char *argv[]) case 'V': version(); exit(0); + case 'a': case 'b': case 'e': case 'f': @@ -2486,6 +2504,20 @@ int main(int argc, char *argv[]) case 'm': SET(USE_MOUSE); break; +#ifndef DISABLE_OPERATINGDIR + case 'o': + operating_dir = charalloc(strlen(optarg) + 1); + strcpy(operating_dir, optarg); + + /* make sure we're inside the operating directory */ + if (check_operating_dir(".", 0)) { + if (chdir(operating_dir) == -1) { + free(operating_dir); + operating_dir = NULL; + } + } + break; +#endif case 'p': SET(PICO_MODE); break; diff --git a/nanorc.sample b/nanorc.sample index fc323cdd8e2770b5ec68e54e3c0f39bbc812251c..3ca2b895ea692b5cde655aef2ecc4446a1889348 100644 --- a/nanorc.sample +++ b/nanorc.sample @@ -17,6 +17,9 @@ # Don't follow symlinks when writing files # set nofollow +# Set operating directory (chroot of sorts) +# set operatingdir "~" + # Use Pico Compatibility mode for the shortcut lists and search text # set pico diff --git a/proto.h b/proto.h index dcc962f04d956815d38aae2d507a6a387d4cbee7..f112d0f13b617ec9aa42331a7c767d2871bc2dd9 100644 --- a/proto.h +++ b/proto.h @@ -44,6 +44,9 @@ extern char *answer; extern char *hblank, *help_text; extern char *last_search; extern char *last_replace; +#ifndef DISABLE_OPERATINGDIR +extern char *operating_dir; +#endif #ifndef DISABLE_SPELLER extern char *alt_speller; #endif @@ -100,10 +103,19 @@ int do_insertfile(int loading_file); int add_open_file(int update, int dup_fix); #endif +#ifndef DISABLE_OPERATINGDIR +int check_operating_dir(char *currpath, int allow_tabcomp); +#endif + int do_writeout(char *path, int exiting, int append); int do_gotoline(long line, int save_pos); int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx, int wholewords, int *i); + +#ifdef ENABLE_MULTIBUFFER +void do_gotopos(long line, int pos_x, int pos_y, int pos_placewewant); +#endif + /* Now in move.c */ int do_up(void); int do_down(void); @@ -198,8 +210,8 @@ int open_prevfile(int closing_file), open_nextfile(int closing_file); char *charalloc (size_t howmuch); -#ifdef ENABLE_MULTIBUFFER -char *get_full_path(const char *origpath); +#if defined (ENABLE_MULTIBUFFER) || !defined (ENABLE_OPERATINGDIR) +char *get_full_path(char *origpath); #endif #ifndef DISABLE_BROWSER @@ -225,5 +237,5 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx, char *needle); #ifdef ENABLE_MULTIBUFFER -filestruct *open_file_dup_search(void); +filestruct *open_file_dup_search(int update); #endif diff --git a/rcfile.c b/rcfile.c index d659a92555dbbd83576a9f85d7ff2fc9f5fdc673..85eedc7d5158b4d9b7ff5edc687be44fd7355656 100644 --- a/rcfile.c +++ b/rcfile.c @@ -39,7 +39,7 @@ #define _(string) (string) #endif -#define NUM_RCOPTS 15 +#define NUM_RCOPTS 16 /* Static stuff for the nanorc file */ rcoption rcopts[NUM_RCOPTS] = { @@ -49,6 +49,7 @@ rcoption rcopts[NUM_RCOPTS] = {"cut", CUT_TO_END}, {"nofollow", FOLLOW_SYMLINKS}, {"mouse", USE_MOUSE}, +{"operatingdir", 0}, {"pico", PICO_MODE}, #ifndef DISABLE_WRAPJUSTIFY @@ -166,6 +167,7 @@ void parse_rcfile(FILE *rcstream, char *filename) #endif if (set == 1 || rcopts[i].flag == FOLLOW_SYMLINKS) { if ( + !strcasecmp(rcopts[i].name, "operatingdir") || #ifndef DISABLE_WRAPJUSTIFY !strcasecmp(rcopts[i].name, "fill") || #endif diff --git a/search.c b/search.c index 21aa6c0535b5c91c8bee97459c3ce0352e761a1a..2f16cf5eb521c0b89ebd6e2e390dd7511c9be221 100644 --- a/search.c +++ b/search.c @@ -791,3 +791,17 @@ int do_gotoline_void(void) { return do_gotoline(0, 0); } + +#ifdef ENABLE_MULTIBUFFER +void do_gotopos(long line, int pos_x, int pos_y, int pos_placewewant) +{ + + /* since do_gotoline() resets the x-coordinate but not the + y-coordinate, set the coordinates up this way */ + current_y = pos_y; + do_gotoline(line, 1); + current_x = pos_x; + placewewant = pos_placewewant; + update_line(current, pos_x); +} +#endif