diff --git a/ChangeLog b/ChangeLog index 6ea09748..0f37efe6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -51,6 +51,14 @@ Cvs code - - New macro TOGGLE which just toggles, no more silly checking ISSET and then using SET or UNSET when we want a simple toggle for a flag. + - Added multiple buffer capability (God help us). New configure + option --enable-loadoninsert (-L), changes to do_insertfile(), + do_insertfile_void(), toggle_init(), do_gotoline(), edit_update(), + and write_file(), new functions add_open_file(), + open_file_change_name(), load_open_file(), open_file_dup_search(), + open_file_dup_fix(), open_prevfile(), open_nextfile(), + close_open_file(), get_full_path(), die_save_file(), etc. + (David Lawrence Ramsey). - Makefile.am: - Include ABOUT-NLS and the new THANKS files to the distributed list. - THANKS: diff --git a/Makefile.in b/Makefile.in index 6955bd4d..887518ef 100644 --- a/Makefile.in +++ b/Makefile.in @@ -57,24 +57,27 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CURSES_LIB = @CURSES_LIB@ DATADIRNAME = @DATADIRNAME@ GENCAT = @GENCAT@ +GLIBC21 = @GLIBC21@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_CONFIG = @GLIB_CONFIG@ GLIB_LIBS = @GLIB_LIBS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ -GT_NO = @GT_NO@ -GT_YES = @GT_YES@ -INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ INSTOBJEXT = @INSTOBJEXT@ -INTLDEPS = @INTLDEPS@ +INTLBISON = @INTLBISON@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ +INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ +LIBICONV = @LIBICONV@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ PACKAGE = @PACKAGE@ @@ -84,7 +87,6 @@ RANLIB = @RANLIB@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ -l = @l@ bin_PROGRAMS = nano nano_SOURCES = color.c cut.c files.c global.c move.c nano.c nano.h proto.h rcfile.c search.c utils.c winio.c diff --git a/acconfig.h b/acconfig.h index be307ea3..fcf08226 100644 --- a/acconfig.h +++ b/acconfig.h @@ -54,6 +54,9 @@ /* 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 */ +#undef ENABLE_LOADONINSERT + /* Define this to use the .nanorc file */ #undef ENABLE_NANORC diff --git a/aclocal.m4 b/aclocal.m4 index efced845..485d7430 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -125,6 +125,24 @@ for am_file in <<$1>>; do done<<>>dnl>>) changequote([,]))]) +#serial 1 +# This test replaces the one in autoconf. +# Currently this macro should have the same name as the autoconf macro +# because gettext's gettext.m4 (distributed in the automake package) +# still uses it. Otherwise, the use in gettext.m4 makes autoheader +# give these diagnostics: +# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX +# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX + +undefine([AC_ISC_POSIX]) + +AC_DEFUN([AC_ISC_POSIX], + [ + dnl This test replaces the obsolescent AC_ISC_POSIX kludge. + AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) + ] +) + # Configure paths for GLIB # Owen Taylor 97-11-3 @@ -330,9 +348,37 @@ main () # but which still want to provide support for the GNU gettext functionality. # Please note that the actual code is *not* freely available. -# serial 5 +# serial 9 -AC_DEFUN(AM_WITH_NLS, +dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]). +dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library +dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, +dnl depending on --{enable,disable}-{shared,static} and on the presence of +dnl AM-DISABLE-SHARED). Otherwise, a static library +dnl $(top_builddir)/intl/libintl.a will be created. +dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext +dnl implementations (in libc or libintl) without the ngettext() function +dnl will be ignored. +dnl LIBDIR is used to find the intl libraries. If empty, +dnl the value `$(top_builddir)/intl/' is used. +dnl +dnl The result of the configuration is one of three cases: +dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled +dnl and used. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 2) GNU gettext has been found in the system's C library. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 3) No internationalization, always use English msgid. +dnl Catalog format: none +dnl Catalog extension: none +dnl The use of .gmo is historical (it was needed to avoid overwriting the +dnl GNU format catalogs when building on a platform with an X/Open gettext), +dnl but we keep it in order not to force irrelevant filename changes on the +dnl maintainers. +dnl +AC_DEFUN([AM_WITH_NLS], [AC_MSG_CHECKING([whether NLS is requested]) dnl Default is enabled NLS AC_ARG_ENABLE(nls, @@ -341,11 +387,15 @@ AC_DEFUN(AM_WITH_NLS, AC_MSG_RESULT($USE_NLS) AC_SUBST(USE_NLS) + BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no + INTLLIBS= dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then - AC_DEFINE(ENABLE_NLS) + AC_DEFINE(ENABLE_NLS, 1, + [Define to 1 if translation of program messages to the user's native language + is requested.]) AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH(included-gettext, [ --with-included-gettext use the GNU gettext library included here], @@ -356,86 +406,74 @@ AC_DEFUN(AM_WITH_NLS, nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then dnl User does not insist on using GNU NLS library. Figure out what - dnl to use. If gettext or catgets are available (in this order) we - dnl use this. Else we have to fall back to GNU NLS library. - dnl catgets is only used if permitted by option --with-catgets. - nls_cv_header_intl= - nls_cv_header_libgt= + dnl to use. If GNU gettext is available we use this. Else we have + dnl to fall back to GNU NLS library. CATOBJEXT=NONE - AC_CHECK_HEADER(libintl.h, - [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, - [AC_TRY_LINK([#include ], [return (int) gettext ("")], - gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) + dnl Add a version number to the cache macros. + define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc]) + define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl]) - if test "$gt_cv_func_gettext_libc" != "yes"; then - AC_CHECK_LIB(intl, bindtextdomain, - [AC_CACHE_CHECK([for gettext in libintl], - gt_cv_func_gettext_libintl, - [AC_CHECK_LIB(intl, gettext, - gt_cv_func_gettext_libintl=yes, - gt_cv_func_gettext_libintl=no)], - gt_cv_func_gettext_libintl=no)]) + AC_CHECK_HEADER(libintl.h, + [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, + [AC_TRY_LINK([#include +extern int _nl_msg_cat_cntr;], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], + gt_cv_func_gnugettext_libc=yes, + gt_cv_func_gnugettext_libc=no)]) + + if test "$gt_cv_func_gnugettext_libc" != "yes"; then + AC_CACHE_CHECK([for GNU gettext in libintl], + gt_cv_func_gnugettext_libintl, + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -lintl $LIBICONV" + AC_TRY_LINK([#include +extern int _nl_msg_cat_cntr;], + [bindtextdomain ("", ""); +return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr], + gt_cv_func_gnugettext_libintl=yes, + gt_cv_func_gnugettext_libintl=no) + LIBS="$gt_save_LIBS"]) fi - if test "$gt_cv_func_gettext_libc" = "yes" \ - || test "$gt_cv_func_gettext_libintl" = "yes"; then - AC_DEFINE(HAVE_GETTEXT) - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl - if test "$MSGFMT" != "no"; then - AC_CHECK_FUNCS(dcgettext) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) - AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; - return _nl_msg_cat_cntr], - [CATOBJEXT=.gmo - DATADIRNAME=share], - [CATOBJEXT=.mo - DATADIRNAME=lib]) - INSTOBJEXT=.mo - fi - fi + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if test "$gt_cv_func_gnugettext_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ + && test "$PACKAGE" != gettext; }; then + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + + if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + dnl If iconv() is in a separate libiconv library, then anyone + dnl linking with libintl{.a,.so} also needs to link with + dnl libiconv. + INTLLIBS="-lintl $LIBICONV" + fi + + gt_save_LIBS="$LIBS" + LIBS="$LIBS $INTLLIBS" + AC_CHECK_FUNCS(dcgettext) + LIBS="$gt_save_LIBS" + + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl + if test "$MSGFMT" != "no"; then + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + fi + + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + + CATOBJEXT=.gmo + fi ]) if test "$CATOBJEXT" = "NONE"; then - AC_MSG_CHECKING([whether catgets can be used]) - AC_ARG_WITH(catgets, - [ --with-catgets use catgets functions if available], - nls_cv_use_catgets=$withval, nls_cv_use_catgets=no) - AC_MSG_RESULT($nls_cv_use_catgets) - - if test "$nls_cv_use_catgets" = "yes"; then - dnl No gettext in C library. Try catgets next. - AC_CHECK_LIB(i, main) - AC_CHECK_FUNC(catgets, - [AC_DEFINE(HAVE_CATGETS) - INTLOBJS="\$(CATOBJS)" - AC_PATH_PROG(GENCAT, gencat, no)dnl - if test "$GENCAT" != "no"; then - AC_PATH_PROG(GMSGFMT, gmsgfmt, no) - if test "$GMSGFMT" = "no"; then - AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) - fi - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.cat - INSTOBJEXT=.cat - DATADIRNAME=lib - INTLDEPS='$(top_builddir)/intl/libintl.a' - INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h - fi]) - fi - fi - - if test "$CATOBJEXT" = "NONE"; then - dnl Neither gettext nor catgets in included in the C library. + dnl GNU gettext is not found in the C library. dnl Fall back on GNU gettext library. nls_cv_use_gnu_gettext=yes fi @@ -450,15 +488,11 @@ AC_DEFUN(AM_WITH_NLS, AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) AC_SUBST(MSGFMT) + BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes CATOBJEXT=.gmo - INSTOBJEXT=.mo - DATADIRNAME=share - INTLDEPS='$(top_builddir)/intl/libintl.a' - INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h + INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi dnl Test whether we really found GNU xgettext. @@ -474,25 +508,74 @@ AC_DEFUN(AM_WITH_NLS, fi fi - # We need to process the po/ directory. + dnl We need to process the po/ directory. POSUB=po - else - DATADIRNAME=share - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h fi - AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) AC_OUTPUT_COMMANDS( - [case "$CONFIG_FILES" in *po/Makefile.in*) - sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile - esac]) + [for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + fi + ;; + esac + done]) - # If this is used in GNU gettext we have to set USE_NLS to `yes' - # because some of the sources are only built for this goal. + dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL + dnl to 'yes' because some of the testsuite requires it. if test "$PACKAGE" = gettext; then - USE_NLS=yes - USE_INCLUDED_LIBINTL=yes + BUILD_INCLUDED_LIBINTL=yes + fi + + dnl intl/plural.c is generated from intl/plural.y. It requires bison, + dnl because plural.y uses bison specific features. It requires at least + dnl bison-1.26 because earlier versions generate a plural.c that doesn't + dnl compile. + dnl bison is only needed for the maintainer (who touches plural.y). But in + dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put + dnl the rule in general Makefile. Now, some people carelessly touch the + dnl files or have a broken "make" program, hence the plural.c rule will + dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not + dnl present or too old. + AC_CHECK_PROGS([INTLBISON], [bison]) + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + dnl Found it, now check the version. + AC_MSG_CHECKING([version of bison]) +changequote(<<,>>)dnl + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) +changequote([,])dnl + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + AC_MSG_RESULT([$ac_prog_version]) + fi + if test $ac_verc_fail = yes; then + INTLBISON=: fi dnl These rules are solely for the distribution goal. While doing this @@ -504,22 +587,38 @@ AC_DEFUN(AM_WITH_NLS, done dnl Make all variables we use known to autoconf. + AC_SUBST(BUILD_INCLUDED_LIBINTL) AC_SUBST(USE_INCLUDED_LIBINTL) AC_SUBST(CATALOGS) AC_SUBST(CATOBJEXT) - AC_SUBST(DATADIRNAME) AC_SUBST(GMOFILES) - AC_SUBST(INSTOBJEXT) - AC_SUBST(INTLDEPS) AC_SUBST(INTLLIBS) AC_SUBST(INTLOBJS) AC_SUBST(POFILES) AC_SUBST(POSUB) + + dnl For backward compatibility. Some configure.ins may be using this. + nls_cv_header_intl= + nls_cv_header_libgt= + + dnl For backward compatibility. Some Makefiles may be using this. + DATADIRNAME=share + AC_SUBST(DATADIRNAME) + + dnl For backward compatibility. Some Makefiles may be using this. + INSTOBJEXT=.mo + AC_SUBST(INSTOBJEXT) + + dnl For backward compatibility. Some Makefiles may be using this. + GENCAT=gencat + AC_SUBST(GENCAT) ]) -AC_DEFUN(AM_GNU_GETTEXT, +dnl Usage: Just like AM_WITH_NLS, which see. +AC_DEFUN([AM_GNU_GETTEXT], [AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_ISC_POSIX])dnl AC_REQUIRE([AC_HEADER_STDC])dnl @@ -529,21 +628,18 @@ AC_DEFUN(AM_GNU_GETTEXT, AC_REQUIRE([AC_TYPE_SIZE_T])dnl AC_REQUIRE([AC_FUNC_ALLOCA])dnl AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([jm_GLIBC21])dnl - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ -unistd.h sys/param.h]) - AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ -strdup __argz_count __argz_stringify __argz_next]) - - if test "${ac_cv_func_stpcpy+set}" != "set"; then - AC_CHECK_FUNCS(stpcpy) - fi - if test "${ac_cv_func_stpcpy}" = "yes"; then - AC_DEFINE(HAVE_STPCPY) - fi + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +stdlib.h string.h unistd.h sys/param.h]) + AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \ +getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ +strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) + AM_ICONV + AM_LANGINFO_CODESET AM_LC_MESSAGES - AM_WITH_NLS + AM_WITH_NLS([$1],[$2],[$3]) if test "x$CATOBJEXT" != "x"; then if test "x$ALL_LINGUAS" = "x"; then @@ -551,10 +647,21 @@ strdup __argz_count __argz_stringify __argz_next]) else AC_MSG_CHECKING(for catalogs to be installed) NEW_LINGUAS= - for lang in ${LINGUAS=$ALL_LINGUAS}; do - case "$ALL_LINGUAS" in - *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; - esac + for presentlang in $ALL_LINGUAS; do + useit=no + for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + NEW_LINGUAS="$NEW_LINGUAS $presentlang" + fi done LINGUAS=$NEW_LINGUAS AC_MSG_RESULT($LINGUAS) @@ -566,47 +673,8 @@ strdup __argz_count __argz_stringify __argz_next]) fi fi - dnl The reference to in the installed file - dnl must be resolved because we cannot expect the users of this - dnl to define HAVE_LOCALE_H. - if test $ac_cv_header_locale_h = yes; then - INCLUDE_LOCALE_H="#include " - else - INCLUDE_LOCALE_H="\ -/* The system does not provide the header . Take care yourself. */" - fi - AC_SUBST(INCLUDE_LOCALE_H) - - dnl Determine which catalog format we have (if any is needed) - dnl For now we know about two different formats: - dnl Linux libc-5 and the normal X/Open format - test -d intl || mkdir intl - if test "$CATOBJEXT" = ".cat"; then - AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) - - dnl Transform the SED scripts while copying because some dumb SEDs - dnl cannot handle comments. - sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed - fi - dnl po2tbl.sed is always needed. - sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ - $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed - - dnl In the intl/Makefile.in we have a special dependency which makes - dnl only sense for gettext. We comment this out for non-gettext - dnl packages. - if test "$PACKAGE" = "gettext"; then - GT_NO="#NO#" - GT_YES= - else - GT_NO= - GT_YES="#YES#" - fi - AC_SUBST(GT_NO) - AC_SUBST(GT_YES) - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly - dnl find the mkinstalldirs script in another subdir but ($top_srcdir). + dnl find the mkinstalldirs script in another subdir but $(top_srcdir). dnl Try to locate is. MKINSTALLDIRS= if test -n "$ac_aux_dir"; then @@ -617,25 +685,9 @@ strdup __argz_count __argz_stringify __argz_next]) fi AC_SUBST(MKINSTALLDIRS) - dnl *** For now the libtool support in intl/Makefile is not for real. - l= - AC_SUBST(l) - - dnl Generate list of files to be processed by xgettext which will - dnl be included in po/Makefile. - test -d po || mkdir po - if test "x$srcdir" != "x."; then - if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then - posrcprefix="$srcdir/" - else - posrcprefix="../$srcdir/" - fi - else - posrcprefix="../" - fi - rm -f po/POTFILES - sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ - < $srcdir/po/POTFILES.in > po/POTFILES + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], []) + AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) ]) # Search path for a program which passes the given test. @@ -650,7 +702,7 @@ strdup __argz_count __argz_stringify __argz_next]) dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) -AC_DEFUN(AM_PATH_PROG_WITH_TEST, +AC_DEFUN([AM_PATH_PROG_WITH_TEST], [# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) @@ -686,6 +738,121 @@ fi AC_SUBST($1)dnl ]) +#serial 2 + +# Test for the GNU C Library, version 2.1 or newer. +# From Bruno Haible. + +AC_DEFUN([jm_GLIBC21], + [ + AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, + ac_cv_gnu_library_2_1, + [AC_EGREP_CPP([Lucky GNU user], + [ +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + ], + ac_cv_gnu_library_2_1=yes, + ac_cv_gnu_library_2_1=no) + ] + ) + AC_SUBST(GLIBC21) + GLIBC21="$ac_cv_gnu_library_2_1" + ] +) + +#serial AM2 + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + AC_ARG_WITH([libiconv-prefix], +[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ + for dir in `echo "$withval" | tr : ' '`; do + if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi + if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi + done + ]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi + LIBICONV= + if test "$am_cv_lib_iconv" = yes; then + LIBICONV="-liconv" + fi + AC_SUBST(LIBICONV) +]) + +#serial AM1 + +dnl From Bruno Haible. + +AC_DEFUN([AM_LANGINFO_CODESET], +[ + AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + [AC_TRY_LINK([#include ], + [char* cs = nl_langinfo(CODESET);], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have and nl_langinfo(CODESET).]) + fi +]) + # Check whether LC_MESSAGES is available in . # Ulrich Drepper , 1995. # @@ -694,15 +861,16 @@ AC_SUBST($1)dnl # but which still want to provide support for the GNU gettext functionality. # Please note that the actual code is *not* freely available. -# serial 1 +# serial 2 -AC_DEFUN(AM_LC_MESSAGES, +AC_DEFUN([AM_LC_MESSAGES], [if test $ac_cv_header_locale_h = yes; then AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) if test $am_cv_val_LC_MESSAGES = yes; then - AC_DEFINE(HAVE_LC_MESSAGES) + AC_DEFINE(HAVE_LC_MESSAGES, 1, + [Define if your file defines LC_MESSAGES.]) fi fi]) diff --git a/config.h.in b/config.h.in index fb264c00..a9e03bb5 100644 --- a/config.h.in +++ b/config.h.in @@ -31,9 +31,6 @@ /* Define to `long' if doesn't define. */ #undef off_t -/* Define if you need to in order for stat and other things to work. */ -#undef _POSIX_SOURCE - /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE @@ -61,21 +58,6 @@ /* Define this if your curses lib has the _use_keypad flag */ #undef HAVE_USEKEYPAD -/* Define this if you have NLS */ -#undef ENABLE_NLS - -/* Define this is you have the catgets command */ -#undef HAVE_CATGETS - -/* Define this is you have GNU gettext */ -#undef HAVE_GETTEXT - -/* Define this for HAVE_LC_MESSAGES */ -#undef HAVE_LC_MESSAGES - -/* Define this if you have the stpcpy function (cool) */ -#undef HAVE_STPCPY - /* Define this to make the nano executable as small as possible */ #undef NANO_SMALL @@ -106,6 +88,9 @@ /* 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 */ +#undef ENABLE_LOADONINSERT + /* Define this to use the .nanorc file */ #undef ENABLE_NANORC @@ -127,15 +112,36 @@ /* Define if you have the dcgettext function. */ #undef HAVE_DCGETTEXT +/* Define if you have the feof_unlocked function. */ +#undef HAVE_FEOF_UNLOCKED + +/* Define if you have the fgets_unlocked function. */ +#undef HAVE_FGETS_UNLOCKED + /* Define if you have the getcwd function. */ #undef HAVE_GETCWD +/* Define if you have the getegid function. */ +#undef HAVE_GETEGID + +/* Define if you have the geteuid function. */ +#undef HAVE_GETEUID + +/* Define if you have the getgid function. */ +#undef HAVE_GETGID + /* Define if you have the getopt_long function. */ #undef HAVE_GETOPT_LONG /* Define if you have the getpagesize function. */ #undef HAVE_GETPAGESIZE +/* Define if you have the getuid function. */ +#undef HAVE_GETUID + +/* Define if you have the mempcpy function. */ +#undef HAVE_MEMPCPY + /* Define if you have the munmap function. */ #undef HAVE_MUNMAP @@ -163,6 +169,12 @@ /* Define if you have the strdup function. */ #undef HAVE_STRDUP +/* Define if you have the strtoul function. */ +#undef HAVE_STRTOUL + +/* Define if you have the tsearch function. */ +#undef HAVE_TSEARCH + /* Define if you have the vsnprintf function. */ #undef HAVE_VSNPRINTF @@ -196,6 +208,12 @@ /* Define if you have the header file. */ #undef HAVE_REGEX_H +/* Define if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define if you have the header file. */ +#undef HAVE_STDLIB_H + /* Define if you have the header file. */ #undef HAVE_STRING_H @@ -211,12 +229,28 @@ /* Define if you have the header file. */ #undef HAVE_UNISTD_H -/* Define if you have the i library (-li). */ -#undef HAVE_LIBI - /* Name of package */ #undef PACKAGE /* Version number of package */ #undef VERSION +/* Define if you have the iconv() function. */ +#undef HAVE_ICONV + +/* Define as const if the declaration of iconv() needs const. */ +#undef ICONV_CONST + +/* Define if you have and nl_langinfo(CODESET). */ +#undef HAVE_LANGINFO_CODESET + +/* Define if your file defines LC_MESSAGES. */ +#undef HAVE_LC_MESSAGES + +/* Define to 1 if translation of program messages to the user's native language + is requested. */ +#undef ENABLE_NLS + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + diff --git a/configure b/configure index 17c54cca..a9034ad6 100755 --- a/configure +++ b/configure @@ -16,6 +16,8 @@ ac_help="$ac_help (currently disables detailed help and i18n)" ac_help="$ac_help --enable-extra Enable extra (optional) functions, including easter eggs" +ac_help="$ac_help + --enable-loadoninsert Enable use of file loading on insertion, and switching between loaded files; this is disabled if --enable-tiny is used" ac_help="$ac_help --enable-nanorc Enable use of .nanorc file" ac_help="$ac_help @@ -44,12 +46,12 @@ ac_help="$ac_help --disable-glibtest Do not try to compile and run a test GLIB program" ac_help="$ac_help --enable-debug Enable debugging (def disabled)" +ac_help="$ac_help + --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib" ac_help="$ac_help --disable-nls do not use Native Language Support" ac_help="$ac_help --with-included-gettext use the GNU gettext library included here" -ac_help="$ac_help - --with-catgets use catgets functions if available" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -591,7 +593,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:595: checking for a BSD compatible install" >&5 +echo "configure:597: 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 @@ -644,7 +646,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:648: checking whether build environment is sane" >&5 +echo "configure:650: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -701,7 +703,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:705: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:707: 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 @@ -747,7 +749,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:751: checking for working aclocal" >&5 +echo "configure:753: 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. @@ -760,7 +762,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:764: checking for working autoconf" >&5 +echo "configure:766: 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. @@ -773,7 +775,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:777: checking for working automake" >&5 +echo "configure:779: 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. @@ -786,7 +788,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:790: checking for working autoheader" >&5 +echo "configure:792: 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. @@ -799,7 +801,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:803: checking for working makeinfo" >&5 +echo "configure:805: 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. @@ -820,7 +822,7 @@ ALL_LINGUAS="es de fr it id fi hu ca cs gl uk ru sv no" # 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:824: checking for $ac_word" >&5 +echo "configure:826: 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 @@ -850,7 +852,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:854: checking for $ac_word" >&5 +echo "configure:856: 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 @@ -901,7 +903,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:905: checking for $ac_word" >&5 +echo "configure:907: 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 @@ -933,7 +935,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:937: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:939: 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. @@ -944,12 +946,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 948 "configure" +#line 950 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:955: \"$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 @@ -975,12 +977,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:979: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:981: 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:984: checking whether we are using GNU C" >&5 +echo "configure:986: 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 @@ -989,7 +991,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:993: \"$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:995: \"$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 @@ -1008,7 +1010,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:1012: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1014: 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 @@ -1039,30 +1041,52 @@ else fi fi -echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:1044: checking for POSIXized ISC" >&5 -if test -d /etc/conf/kconfig.d && - grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 -then - echo "$ac_t""yes" 1>&6 - ISC=yes # If later tests want to check for ISC. - cat >> confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - if test "$GCC" = yes; then - CC="$CC -posix" - else - CC="$CC -Xp" - fi + echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6 +echo "configure:1047: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-lcposix $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lcposix" else echo "$ac_t""no" 1>&6 - ISC= fi + + echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1066: checking how to run the C preprocessor" >&5 +echo "configure:1090: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1077,13 +1101,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1087: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1111: \"$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 : @@ -1094,13 +1118,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1104: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1128: \"$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 : @@ -1111,13 +1135,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1121: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1145: \"$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 : @@ -1142,12 +1166,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1146: checking for ANSI C header files" >&5 +echo "configure:1170: 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 < #include @@ -1155,7 +1179,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1159: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1183: \"$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* @@ -1172,7 +1196,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 @@ -1190,7 +1214,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 @@ -1211,7 +1235,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1222,7 +1246,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1249,17 +1273,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:1253: checking for $ac_hdr" >&5 +echo "configure:1277: 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:1263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1287: \"$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* @@ -1334,6 +1358,18 @@ EOF fi +# Check whether --enable-loadoninsert or --disable-loadoninsert was given. +if test "${enable_loadoninsert+set}" = set; then + enableval="$enable_loadoninsert" + if test x$enableval = xyes && test x$tiny_support != xyes; then + cat >> confdefs.h <<\EOF +#define ENABLE_LOADONINSERT 1 +EOF + loadoninsert_support=yes + fi +fi + + # Check whether --enable-nanorc or --disable-nanorc was given. if test "${enable_nanorc+set}" = set; then enableval="$enable_nanorc" @@ -1454,7 +1490,7 @@ fi echo $ac_n "checking whether to use slang""... $ac_c" 1>&6 -echo "configure:1458: checking whether to use slang" >&5 +echo "configure:1494: 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 @@ -1474,17 +1510,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:1478: checking for slcurses.h" >&5 +echo "configure:1514: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1488: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1524: \"$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* @@ -1501,21 +1537,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:1505: checking for SLtt_initialize in -lslang" >&5 +echo "configure:1541: 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 < #include int main () { SLtt_initialize (NULL); return 0; } EOF -if { (eval echo configure:1519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1555: \"$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 @@ -1538,7 +1574,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:1542: checking for tputs in -l${termlib}" >&5 +echo "configure:1578: 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 @@ -1546,7 +1582,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${termlib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1597: \"$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 @@ -1581,20 +1617,20 @@ fi done echo $ac_n "checking for SLtt_initialize in -lslang $tcap""... $ac_c" 1>&6 -echo "configure:1585: checking for SLtt_initialize in -lslang $tcap" >&5 +echo "configure:1621: 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 < #include int main () { SLtt_initialize (NULL); return 0; } EOF -if { (eval echo configure:1598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1634: \"$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 @@ -1616,20 +1652,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:1620: checking for SLtt_initialize in -lslang $tcap -lm" >&5 +echo "configure:1656: 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 < #include int main () { SLtt_initialize (NULL); return 0; } EOF -if { (eval echo configure:1633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1669: \"$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 @@ -1686,12 +1722,12 @@ fi for ac_func in snprintf vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1690: checking for $ac_func" >&5 +echo "configure:1726: 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:1754: \"$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 @@ -1793,7 +1829,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:1797: checking for $ac_word" >&5 +echo "configure:1833: 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 @@ -1828,7 +1864,7 @@ fi min_glib_version=1.2.4 echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6 -echo "configure:1832: checking for GLIB - version >= $min_glib_version" >&5 +echo "configure:1868: checking for GLIB - version >= $min_glib_version" >&5 no_glib="" if test "$GLIB_CONFIG" = "no" ; then no_glib=yes @@ -1851,7 +1887,7 @@ echo "configure:1832: checking for GLIB - version >= $min_glib_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -1927,7 +1963,7 @@ main () } EOF -if { (eval echo configure:1931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1961,7 +1997,7 @@ fi CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" cat > conftest.$ac_ext < @@ -1971,7 +2007,7 @@ int main() { return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ; return 0; } EOF -if { (eval echo configure:1975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2011: \"$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" @@ -2018,12 +2054,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2022: checking return type of signal handlers" >&5 +echo "configure:2058: 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 @@ -2040,7 +2076,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2044: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2080: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2059,12 +2095,12 @@ EOF echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:2063: checking for vprintf" >&5 +echo "configure:2099: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2127: \"$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 @@ -2111,12 +2147,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:2115: checking for _doprnt" >&5 +echo "configure:2151: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2179: \"$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 @@ -2166,12 +2202,12 @@ fi for ac_func in getopt_long do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2170: checking for $ac_func" >&5 +echo "configure:2206: 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:2234: \"$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 @@ -2227,17 +2263,17 @@ then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2231: checking for $ac_hdr" >&5 +echo "configure:2267: 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:2241: \"$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* @@ -2264,7 +2300,7 @@ fi done echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6 -echo "configure:2268: checking for tgetent in -lncurses" >&5 +echo "configure:2304: 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 @@ -2272,7 +2308,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2323: \"$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 @@ -2308,7 +2344,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:2312: checking for tgetent in -lcurses" >&5 +echo "configure:2348: 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 @@ -2316,7 +2352,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2367: \"$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 @@ -2353,7 +2389,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:2357: checking for initscr in -lcurses" >&5 +echo "configure:2393: 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 @@ -2361,7 +2397,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2412: \"$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 @@ -2397,7 +2433,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:2401: checking for tgetent in -ltermcap" >&5 +echo "configure:2437: 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 @@ -2405,7 +2441,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2456: \"$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 @@ -2450,7 +2486,7 @@ fi echo $ac_n "checking for use_default_colors in -l$CURSES_LIB_NAME""... $ac_c" 1>&6 -echo "configure:2454: checking for use_default_colors in -l$CURSES_LIB_NAME" >&5 +echo "configure:2490: 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 @@ -2458,7 +2494,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$CURSES_LIB_NAME $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2494,7 +2530,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:2498: checking for wresize in -l$CURSES_LIB_NAME" >&5 +echo "configure:2534: 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 @@ -2502,7 +2538,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$CURSES_LIB_NAME $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2553: \"$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 @@ -2537,7 +2573,7 @@ else fi echo $ac_n "checking for resizeterm in -l$CURSES_LIB_NAME""... $ac_c" 1>&6 -echo "configure:2541: checking for resizeterm in -l$CURSES_LIB_NAME" >&5 +echo "configure:2577: 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 @@ -2545,7 +2581,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$CURSES_LIB_NAME $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2596: \"$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 @@ -2582,12 +2618,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:2586: checking for private member _use_keypad in WINDOW" >&5 +echo "configure:2622: 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 < @@ -2598,7 +2634,7 @@ int main() { WINDOW w; w._use_keypad; ; return 0; } EOF -if { (eval echo configure:2602: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* aumix_cv_struct_window_usekeypad=yes else @@ -2641,10 +2677,37 @@ then LDFLAGS="$LDFLAGS $glib_libs" fi + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:2688: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + # 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:2648: checking for $ac_word" >&5 +echo "configure:2711: 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 @@ -2672,12 +2735,12 @@ else fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2676: checking for working const" >&5 +echo "configure:2739: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2747,21 +2810,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2751: checking for inline" >&5 +echo "configure:2814: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2828: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2787,12 +2850,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:2791: checking for off_t" >&5 +echo "configure:2854: 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 < #if STDC_HEADERS @@ -2820,12 +2883,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2824: checking for size_t" >&5 +echo "configure:2887: 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 @@ -2855,19 +2918,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:2859: checking for working alloca.h" >&5 +echo "configure:2922: 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:2871: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2934: \"$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 @@ -2888,12 +2951,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:2892: checking for alloca" >&5 +echo "configure:2955: 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:2988: \"$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 @@ -2953,12 +3016,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2957: checking whether alloca needs Cray hooks" >&5 +echo "configure:3020: 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 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:2987: checking for $ac_func" >&5 +echo "configure:3050: 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:3078: \"$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 @@ -3038,7 +3101,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3042: checking stack direction for C alloca" >&5 +echo "configure:3105: 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 @@ -3046,7 +3109,7 @@ else 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:3132: \"$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 @@ -3090,17 +3153,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:3094: checking for $ac_hdr" >&5 +echo "configure:3157: 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:3104: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3167: \"$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* @@ -3129,12 +3192,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3133: checking for $ac_func" >&5 +echo "configure:3196: 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:3224: \"$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 @@ -3182,7 +3245,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3186: checking for working mmap" >&5 +echo "configure:3249: 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 @@ -3190,7 +3253,7 @@ else ac_cv_func_mmap_fixed_mapped=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:3397: \"$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 @@ -3352,23 +3415,60 @@ EOF fi - - for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \ -unistd.h sys/param.h + + echo $ac_n "checking whether we are using the GNU C Library 2.1 or newer""... $ac_c" 1>&6 +echo "configure:3421: checking whether we are using the GNU C Library 2.1 or newer" >&5 +if eval "test \"`echo '$''{'ac_cv_gnu_library_2_1'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "Lucky GNU user" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_gnu_library_2_1=yes +else + rm -rf conftest* + ac_cv_gnu_library_2_1=no +fi +rm -f conftest* + + + +fi + +echo "$ac_t""$ac_cv_gnu_library_2_1" 1>&6 + + GLIBC21="$ac_cv_gnu_library_2_1" + + + + for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +stdlib.h string.h 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:3362: checking for $ac_hdr" >&5 +echo "configure:3462: 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:3372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3472: \"$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* @@ -3394,16 +3494,17 @@ else fi done - for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ -strdup __argz_count __argz_stringify __argz_next + for ac_func in feof_unlocked fgets_unlocked getcwd getegid geteuid \ +getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ +strdup strtoul tsearch __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3402: checking for $ac_func" >&5 +echo "configure:3503: 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:3531: \"$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 @@ -3451,85 +3552,184 @@ fi done - if test "${ac_cv_func_stpcpy+set}" != "set"; then - for ac_func in stpcpy -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3459: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + + + # Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then + withval="$with_libiconv_prefix" + + for dir in `echo "$withval" | tr : ' '`; do + if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi + if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi + done + +fi + + + echo $ac_n "checking for iconv""... $ac_c" 1>&6 +echo "configure:3571: checking for iconv" >&5 +if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext < conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); +#include +#include +int main() { +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); +; return 0; } +EOF +if { (eval echo configure:3589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_func_iconv=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + cat > conftest.$ac_ext < +#include +int main() { +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); +; return 0; } +EOF +if { (eval echo configure:3611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + LIBS="$am_save_LIBS" + fi + +fi + +echo "$ac_t""$am_cv_func_iconv" 1>&6 + if test "$am_cv_func_iconv" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ICONV 1 +EOF + + echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 +echo "configure:3632: checking for iconv declaration" >&5 + if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif int main() { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - ; return 0; } EOF -if { (eval echo configure:3487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3657: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" + am_cv_proto_iconv_arg1="" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_func_$ac_func=no" + am_cv_proto_iconv_arg1="const" fi rm -f conftest* + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 + cat >> confdefs.h <&6 +echo "configure:3686: checking for nl_langinfo and CODESET" >&5 +if eval "test \"`echo '$''{'am_cv_langinfo_codeset'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - echo "$ac_t""no" 1>&6 + cat > conftest.$ac_ext < +int main() { +char* cs = nl_langinfo(CODESET); +; return 0; } +EOF +if { (eval echo configure:3698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_langinfo_codeset=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + am_cv_langinfo_codeset=no +fi +rm -f conftest* + fi -done - fi - if test "${ac_cv_func_stpcpy}" = "yes"; then - cat >> confdefs.h <<\EOF -#define HAVE_STPCPY 1 +echo "$ac_t""$am_cv_langinfo_codeset" 1>&6 + if test $am_cv_langinfo_codeset = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LANGINFO_CODESET 1 EOF - fi + fi if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:3521: checking for LC_MESSAGES" >&5 +echo "configure:3721: 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 < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:3533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3733: \"$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 @@ -3550,7 +3750,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:3554: checking whether NLS is requested" >&5 +echo "configure:3754: 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" @@ -3562,7 +3762,9 @@ fi echo "$ac_t""$USE_NLS" 1>&6 + BUILD_INCLUDED_LIBINTL=no USE_INCLUDED_LIBINTL=no + INTLLIBS= if test "$USE_NLS" = "yes"; then cat >> confdefs.h <<\EOF @@ -3570,7 +3772,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:3574: checking whether included gettext is requested" >&5 +echo "configure:3776: 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" @@ -3583,23 +3785,24 @@ fi nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - nls_cv_header_intl= - nls_cv_header_libgt= - CATOBJEXT=NONE + CATOBJEXT=NONE + + + ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:3593: checking for libintl.h" >&5 +echo "configure:3796: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3603: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3806: \"$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* @@ -3615,134 +3818,144 @@ rm -f conftest* 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:3620: checking for gettext in libc" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then + echo $ac_n "checking for GNU gettext in libc""... $ac_c" 1>&6 +echo "configure:3823: checking for GNU gettext in libc" >&5 +if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < +extern int _nl_msg_cat_cntr; int main() { -return (int) gettext ("") +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:3632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - gt_cv_func_gettext_libc=yes + gt_cv_func_gnugettext1_libc=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - gt_cv_func_gettext_libc=no + gt_cv_func_gnugettext1_libc=no fi rm -f conftest* fi -echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 +echo "$ac_t""$gt_cv_func_gnugettext1_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:3648: 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 + if test "$gt_cv_func_gnugettext1_libc" != "yes"; then + echo $ac_n "checking for GNU gettext in libintl""... $ac_c" 1>&6 +echo "configure:3853: checking for GNU gettext in libintl" >&5 +if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_save_LIBS="$LIBS" -LIBS="-lintl $LIBS" -cat > conftest.$ac_ext < conftest.$ac_ext < +extern int _nl_msg_cat_cntr; int main() { -bindtextdomain() +bindtextdomain ("", ""); +return (int) gettext ("") + _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:3667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3869: \"$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" + gt_cv_func_gnugettext1_libintl=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + gt_cv_func_gnugettext1_libintl=no fi rm -f conftest* -LIBS="$ac_save_LIBS" - -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 libintl""... $ac_c" 1>&6 -echo "configure:3683: checking for gettext in libintl" >&5 -if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6 -echo "configure:3688: 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 -else - ac_save_LIBS="$LIBS" -LIBS="-lintl $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - gt_cv_func_gettext_libintl=yes -else - echo "$ac_t""no" 1>&6 -gt_cv_func_gettext_libintl=no -fi - -fi - -echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6 -else - echo "$ac_t""no" 1>&6 + LIBS="$gt_save_LIBS" fi +echo "$ac_t""$gt_cv_func_gnugettext1_libintl" 1>&6 fi - if test "$gt_cv_func_gettext_libc" = "yes" \ - || test "$gt_cv_func_gettext_libintl" = "yes"; then - cat >> confdefs.h <<\EOF + if test "$gt_cv_func_gnugettext1_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ + && test "$PACKAGE" != gettext; }; then + cat >> confdefs.h <<\EOF #define HAVE_GETTEXT 1 EOF - # Extract the first word of "msgfmt", so it can be a program name with args. + + if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then + INTLLIBS="-lintl $LIBICONV" + fi + + gt_save_LIBS="$LIBS" + LIBS="$LIBS $INTLLIBS" + for ac_func in dcgettext +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3902: 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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3930: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + LIBS="$gt_save_LIBS" + + # 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:3746: checking for $ac_word" >&5 +echo "configure:3959: 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 @@ -3772,66 +3985,11 @@ if test -n "$MSGFMT"; then else echo "$ac_t""no" 1>&6 fi - if test "$MSGFMT" != "no"; then - for ac_func in dcgettext -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3780: 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 < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:3808: \"$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 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 -fi -done - - # Extract the first word of "gmsgfmt", so it can be a program name with args. + if test "$MSGFMT" != "no"; then + # 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:3835: checking for $ac_word" >&5 +echo "configure:3993: 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 @@ -3864,10 +4022,12 @@ else echo "$ac_t""no" 1>&6 fi - # Extract the first word of "xgettext", so it can be a program name with args. + 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:3871: checking for $ac_word" >&5 +echo "configure:4031: 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 @@ -3898,300 +4058,15 @@ else echo "$ac_t""no" 1>&6 fi - cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - CATOBJEXT=.gmo - DATADIRNAME=share -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CATOBJEXT=.mo - DATADIRNAME=lib -fi -rm -f conftest* - INSTOBJEXT=.mo - fi - fi + CATOBJEXT=.gmo + fi else echo "$ac_t""no" 1>&6 fi - if test "$CATOBJEXT" = "NONE"; then - echo $ac_n "checking whether catgets can be used""... $ac_c" 1>&6 -echo "configure:3934: 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" - nls_cv_use_catgets=$withval -else - nls_cv_use_catgets=no -fi - - echo "$ac_t""$nls_cv_use_catgets" 1>&6 - - if test "$nls_cv_use_catgets" = "yes"; then - echo $ac_n "checking for main in -li""... $ac_c" 1>&6 -echo "configure:3947: 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 -else - ac_save_LIBS="$LIBS" -LIBS="-li $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo i | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 -fi - - echo $ac_n "checking for catgets""... $ac_c" 1>&6 -echo "configure:3990: 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 < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char catgets(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_catgets) || defined (__stub___catgets) -choke me -#else -catgets(); -#endif - -; return 0; } -EOF -if { (eval echo configure:4018: \"$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 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_catgets=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'catgets`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_CATGETS 1 -EOF - - INTLOBJS="\$(CATOBJS)" - # 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:4040: 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 - case "$GENCAT" in - /*) - ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GENCAT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GENCAT" && ac_cv_path_GENCAT="no" - ;; -esac -fi -GENCAT="$ac_cv_path_GENCAT" -if test -n "$GENCAT"; then - echo "$ac_t""$GENCAT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - if test "$GENCAT" != "no"; then - # 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:4076: 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 - case "$GMSGFMT" in - /*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" - ;; -esac -fi -GMSGFMT="$ac_cv_path_GMSGFMT" -if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test "$GMSGFMT" = "no"; then - # 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:4113: 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 - case "$GMSGFMT" in - /*) - ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then - ac_cv_path_GMSGFMT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" - ;; -esac -fi -GMSGFMT="$ac_cv_path_GMSGFMT" -if test -n "$GMSGFMT"; then - echo "$ac_t""$GMSGFMT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - 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:4148: 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 - case "$XGETTEXT" in - /*) - ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then - ac_cv_path_XGETTEXT="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" - ;; -esac -fi -XGETTEXT="$ac_cv_path_XGETTEXT" -if test -n "$XGETTEXT"; then - echo "$ac_t""$XGETTEXT" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.cat - INSTOBJEXT=.cat - DATADIRNAME=lib - INTLDEPS='$(top_builddir)/intl/libintl.a' - INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h - fi -else - echo "$ac_t""no" 1>&6 -fi - - fi - fi - if test "$CATOBJEXT" = "NONE"; then nls_cv_use_gnu_gettext=yes fi @@ -4202,7 +4077,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:4206: checking for $ac_word" >&5 +echo "configure:4081: 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 @@ -4236,7 +4111,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:4240: checking for $ac_word" >&5 +echo "configure:4115: 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 @@ -4272,7 +4147,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:4276: checking for $ac_word" >&5 +echo "configure:4151: 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 @@ -4304,15 +4179,11 @@ else fi + BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes CATOBJEXT=.gmo - INSTOBJEXT=.mo - DATADIRNAME=share - INTLDEPS='$(top_builddir)/intl/libintl.a' - INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h + INTLLIBS="\$(top_builddir)/intl/libintl.a $LIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi if test "$XGETTEXT" != ":"; then @@ -4324,22 +4195,65 @@ fi fi fi - # We need to process the po/ directory. - POSUB=po - else - DATADIRNAME=share - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h + POSUB=po fi - - # If this is used in GNU gettext we have to set USE_NLS to `yes' - # because some of the sources are only built for this goal. - if test "$PACKAGE" = gettext; then - USE_NLS=yes - USE_INCLUDED_LIBINTL=yes + if test "$PACKAGE" = gettext; then + BUILD_INCLUDED_LIBINTL=yes + fi + + for ac_prog in bison +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:4213: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_INTLBISON'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$INTLBISON"; then + ac_cv_prog_INTLBISON="$INTLBISON" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_INTLBISON="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +INTLBISON="$ac_cv_prog_INTLBISON" +if test -n "$INTLBISON"; then + echo "$ac_t""$INTLBISON" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$INTLBISON" && break +done + + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + echo $ac_n "checking version of bison""... $ac_c" 1>&6 +echo "configure:4246: checking version of bison" >&5 + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + echo "$ac_t""$ac_prog_version" 1>&6 + fi + if test $ac_verc_fail = yes; then + INTLBISON=: fi for lang in $ALL_LINGUAS; do @@ -4356,7 +4270,17 @@ fi + + nls_cv_header_intl= + nls_cv_header_libgt= + + DATADIRNAME=share + + INSTOBJEXT=.mo + + + GENCAT=gencat @@ -4365,12 +4289,23 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:4369: checking for catalogs to be installed" >&5 +echo "configure:4293: checking for catalogs to be installed" >&5 NEW_LINGUAS= - for lang in ${LINGUAS=$ALL_LINGUAS}; do - case "$ALL_LINGUAS" in - *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; - esac + for presentlang in $ALL_LINGUAS; do + useit=no + for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + NEW_LINGUAS="$NEW_LINGUAS $presentlang" + fi done LINGUAS=$NEW_LINGUAS echo "$ac_t""$LINGUAS" 1>&6 @@ -4381,66 +4316,6 @@ echo "configure:4369: checking for catalogs to be installed" >&5 fi fi - if test $ac_cv_header_locale_h = yes; then - INCLUDE_LOCALE_H="#include " - else - INCLUDE_LOCALE_H="\ -/* The system does not provide the header . Take care yourself. */" - fi - - - test -d intl || mkdir intl - 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:4397: 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 -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4407: \"$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* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - msgformat=linux -else - echo "$ac_t""no" 1>&6 -msgformat=xopen -fi - - - sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed - fi - sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ - $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed - - if test "$PACKAGE" = "gettext"; then - GT_NO="#NO#" - GT_YES= - else - GT_NO= - GT_YES="#YES#" - fi - - - MKINSTALLDIRS= if test -n "$ac_aux_dir"; then MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" @@ -4450,22 +4325,8 @@ fi fi - l= + INTL_LIBTOOL_SUFFIX_PREFIX= - - test -d po || mkdir po - if test "x$srcdir" != "x."; then - if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then - posrcprefix="$srcdir/" - else - posrcprefix="../$srcdir/" - fi - else - posrcprefix="../" - fi - rm -f po/POTFILES - sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ - < $srcdir/po/POTFILES.in > po/POTFILES trap '' 1 2 15 @@ -4618,29 +4479,34 @@ s%@GLIB_CONFIG@%$GLIB_CONFIG%g s%@GLIB_CFLAGS@%$GLIB_CFLAGS%g s%@GLIB_LIBS@%$GLIB_LIBS%g s%@CURSES_LIB@%$CURSES_LIB%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g s%@RANLIB@%$RANLIB%g s%@ALLOCA@%$ALLOCA%g +s%@GLIBC21@%$GLIBC21%g +s%@LIBICONV@%$LIBICONV%g s%@USE_NLS@%$USE_NLS%g s%@MSGFMT@%$MSGFMT%g s%@GMSGFMT@%$GMSGFMT%g s%@XGETTEXT@%$XGETTEXT%g -s%@GENCAT@%$GENCAT%g +s%@INTLBISON@%$INTLBISON%g +s%@BUILD_INCLUDED_LIBINTL@%$BUILD_INCLUDED_LIBINTL%g s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g s%@CATALOGS@%$CATALOGS%g s%@CATOBJEXT@%$CATOBJEXT%g -s%@DATADIRNAME@%$DATADIRNAME%g s%@GMOFILES@%$GMOFILES%g -s%@INSTOBJEXT@%$INSTOBJEXT%g -s%@INTLDEPS@%$INTLDEPS%g s%@INTLLIBS@%$INTLLIBS%g s%@INTLOBJS@%$INTLOBJS%g s%@POFILES@%$POFILES%g s%@POSUB@%$POSUB%g -s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g -s%@GT_NO@%$GT_NO%g -s%@GT_YES@%$GT_YES%g +s%@DATADIRNAME@%$DATADIRNAME%g +s%@INSTOBJEXT@%$INSTOBJEXT%g +s%@GENCAT@%$GENCAT%g s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g -s%@l@%$l%g +s%@INTL_LIBTOOL_SUFFIX_PREFIX@%$INTL_LIBTOOL_SUFFIX_PREFIX%g CEOF EOF @@ -4848,51 +4714,6 @@ cat >> $CONFIG_STATUS <<\EOF fi fi; done -EOF - -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -srcdir=$ac_given_srcdir -while test -n "$ac_sources"; do - set $ac_dests; ac_dest=$1; shift; ac_dests=$* - set $ac_sources; ac_source=$1; shift; ac_sources=$* - - echo "linking $srcdir/$ac_source to $ac_dest" - - if test ! -r $srcdir/$ac_source; then - { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; } - fi - rm -f $ac_dest - - # Make relative symlinks. - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` - if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then - # The dest file is in a subdirectory. - test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" - ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dest_dir_suffix. - ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dest_dir_suffix= ac_dots= - fi - - case "$srcdir" in - [/$]*) ac_rel_source="$srcdir/$ac_source" ;; - *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; - esac - - # Make a symlink if possible; otherwise try a hard link. - if ln -s $ac_rel_source $ac_dest 2>/dev/null || - ln $srcdir/$ac_source $ac_dest; then : - else - { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; } - fi -done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h -case "$CONFIG_FILES" in *po/Makefile.in*) - sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile - esac +for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + fi + ;; + esac + done exit 0 EOF diff --git a/configure.in b/configure.in index 1494051d..2a80053f 100644 --- a/configure.in +++ b/configure.in @@ -33,6 +33,12 @@ AC_ARG_ENABLE(extra, AC_DEFINE(NANO_EXTRA) extra_support=yes fi]) +AC_ARG_ENABLE(loadoninsert, +[ --enable-loadoninsert Enable use of file loading on insertion, and switching between loaded files; this is disabled if --enable-tiny is used], +[if test x$enableval = xyes && test x$tiny_support != xyes; then + AC_DEFINE(ENABLE_LOADONINSERT) loadoninsert_support=yes + fi]) + AC_ARG_ENABLE(nanorc, [ --enable-nanorc Enable use of .nanorc file], [if test x$enableval = xyes; then diff --git a/files.c b/files.c index 8600c0a9..938abbed 100644 --- a/files.c +++ b/files.c @@ -47,6 +47,16 @@ void load_file(void) { current = fileage; + +#ifdef ENABLE_LOADONINSERT + /* 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) + load_open_file(); +#endif + wmove(edit, current_y, current_x); } @@ -253,7 +263,7 @@ int open_file(char *filename, int insert, int quiet) return 1; } -int do_insertfile(void) +int do_insertfile(int loading_file) { int i; char *realname = NULL; @@ -270,7 +280,7 @@ int do_insertfile(void) if (i != -1) { #ifdef DEBUG - fprintf(stderr, "filename is %s", answer); + fprintf(stderr, _("filename is %s"), answer); #endif #ifndef DISABLE_TABCOMP @@ -294,19 +304,57 @@ int do_insertfile(void) if (tmp != NULL) realname = mallocstrcpy(realname, tmp); else - return do_insertfile(); + return do_insertfile(loading_file); + } +#endif + +#ifdef ENABLE_LOADONINSERT + if (loading_file) { + + /* update the current entry in the open_files structure; we + don't need to check for duplicate entries (the conditions + that could create them are taken care of elsewhere) */ + add_open_file(1, 0); + + free_filestruct(current); + new_file(); + UNSET(MODIFIED); } #endif i = open_file(realname, 1, 0); + +#ifdef ENABLE_LOADONINSERT + if (loading_file) + filename = mallocstrcpy(filename, realname); +#endif + free(realname); dump_buffer(fileage); - set_modified(); + +#ifdef ENABLE_LOADONINSERT + if (loading_file) + load_file(); + else +#endif + + set_modified(); /* Here we want to rebuild the edit window */ fix_editbot(); +#ifdef ENABLE_LOADONINSERT + /* If we've loaded another file, update the titlebar's contents */ + if (loading_file) { + clearok(topwin, FALSE); + titlebar(NULL); + + /* And re-init the shortcut list */ + shortcut_init(0); + } +#endif + /* If we've gone off the bottom, recenter; otherwise, just redraw */ if (current->lineno > editbot->lineno) edit_update(current, CENTER); @@ -324,6 +372,479 @@ int do_insertfile(void) } } +int do_insertfile_void(void) +{ + int result = 0; +#ifdef ENABLE_LOADONINSERT + result = do_insertfile(ISSET(LOADONINSERT)); +#else + result = do_insertfile(0); +#endif + + display_main_list(); + return result; +} + +#ifdef ENABLE_LOADONINSERT +/* + * Add/update an entry to the open_files filestruct. If update is + * zero, a new entry is created; otherwise, the current entry is updated. + * If dup_fix is zero, checking for and handling duplicate entries is not + * done; otherwise, it is. Return 0 on success, 1 on error, or 2 on + * finding a duplicate entry. + */ +int add_open_file(int update, int dup_fix) +{ + filestruct *tmp; + + if (!current || !filename) + return 1; + + /* first, if duplicate checking is allowed, do it */ + if (dup_fix) { + + /* if duplicates were found and handled, we're done */ + if (open_file_dup_fix(update)) + return 2; + } + + /* if no entries, make the first one */ + if (!open_files) { + open_files = make_new_node(NULL); + + /* if open_files->file is NULL at the nrealloc() below, we get a + segfault */ + open_files->file = open_files; + } + + else if (!update) { + + /* otherwise, if we're not updating, make a new entry for + open_files and splice it in after the current one */ + +#ifdef DEBUG + fprintf(stderr, _("filename is %s"), open_files->data); +#endif + + tmp = make_new_node(NULL); + splice_node(open_files, tmp, open_files->next); + open_files = open_files->next; + + /* if open_files->file is NULL at the nrealloc() below, we get a + segfault */ + open_files->file = open_files; + } + + /* save current filename */ + open_files->data = mallocstrcpy(open_files->data, filename); + + /* save the full path location */ + open_files->file_path = get_full_path(open_files->data); + + /* save current total number of lines */ + open_files->file_totlines = totlines; + + /* save current total size */ + open_files->file_totsize = totsize; + + /* save current x-coordinate position */ + open_files->file_current_x = current_x; + + /* save current y-coordinate position */ + open_files->file_current_y = current_y; + + /* save current place we want */ + open_files->file_placewewant = placewewant; + + /* save current line number */ + open_files->lineno = current->lineno; + + /* save current filestruct */ + open_files->file = nrealloc(open_files->file, sizeof(filestruct)); + 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); + + /* save current modification status */ + open_files->file_modified = ISSET(MODIFIED); + +#ifdef DEBUG + fprintf(stderr, _("filename is %s"), open_files->data); +#endif + + return 0; +} + +/* + * Update only the filename and full path stored in the current entry. + * Return 0 on success or 1 on error. + */ +int open_file_change_name(void) +{ + if (!open_files || !filename) + return 1; + + /* save current filename */ + open_files->data = mallocstrcpy(open_files->data, filename); + + /* save the full path location */ + open_files->file_path = get_full_path(open_files->data); + + return 0; +} + +/* + * Read the current entry in the open_files structure and set up the + * currently open file using that entry's information. Return 0 on + * success or 1 on error. + */ +int load_open_file(void) +{ + if (!open_files) + return 1; + + /* set up the filename, the file buffer, the total number of lines in + the file, and the total file size */ + filename = mallocstrcpy(filename, open_files->data); + fileage = copy_filestruct(open_files->file); + current = fileage; + 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); + + /* set up modification status and update the titlebar */ + if (open_files->file_modified) + SET(MODIFIED); + else + UNSET(MODIFIED); + clearok(topwin, FALSE); + titlebar(NULL); + + /* if we're constantly displaying the cursor position, update it */ + if (ISSET(CONSTUPDATE)) + do_cursorpos(); + + /* now we're done */ + return 0; +} + +/* + * Search the open_files structure for an entry with the same value for + * the file_path member as the current entry (i. e. a duplicate entry). + * If one is found, return a pointer to it; otherwise, return NULL. + * + * Note: This should only be called inside open_file_dup_fix(). + */ +filestruct *open_file_dup_search(void) +{ + filestruct *tmp; + char *path; + + if (!open_files || !filename) + return NULL; + + tmp = open_files; + path = get_full_path(filename); + + /* if there's only one entry, handle it */ + if (!tmp->prev && !tmp->next) { + if (!strcmp(tmp->file_path, path)) + return tmp; + } + + /* otherwise, go to the beginning */ + while (tmp->prev) + tmp = tmp->prev; + + /* and search the entries one by one */ + while (tmp) { + + if (!strcmp(tmp->file_path, path)) { + + /* if it's not the current entry, we've found a duplicate */ + if (tmp != open_files) + return tmp; + } + + /* go to the next entry */ + tmp = tmp->next; + + } + + return NULL; +} + +/* + * Search for duplicate entries in the open_files structure using + * open_file_dup_search(), and, if one is found, handle it properly. + * Return 0 if no duplicates were found, and 1 otherwise. + */ +int open_file_dup_fix(int update) +{ + filestruct *tmp = open_file_dup_search(); + + if (!tmp) + return 0; + + /* if there's only one entry, handle it */ + if (!tmp->prev && !tmp->next) + return 1; + + /* otherwise, if we're not updating, the user's trying to load a + duplicate; switch to the original instead */ + if (!update) { + open_files = tmp; + return 1; + } + + /* if we are updating, the filename's been changed via a save; it's + thus more recent than the original, so remove the original */ + else { + unlink_node(tmp); + free_filestruct(tmp->file); + free(tmp->file_path); + delete_node(tmp); + } + return 0; +} + +/* + * Open the previous entry in the open_files structure. If closing_file + * is zero, update the current entry before switching from it. + * Otherwise, we are about to close that entry, so don't bother doing so. + * Return 0 on success and 1 on error. + */ +int open_prevfile(int closing_file) +{ + if (!open_files) + return 1; + + /* if we're not about to close the current entry, update it before + doing anything; since we're only switching, we don't need to check + for duplicate entries */ + if (!closing_file) + add_open_file(1, 0); + + if (!open_files->prev && !open_files->next) { + + /* only one file open */ + if (!closing_file) + statusbar(_("No more open files")); + return 1; + } + + if (open_files->prev) { + open_files = open_files->prev; + +#ifdef DEBUG + fprintf(stderr, _("filename is %s"), open_files->data); +#endif + + } + + else if (open_files->next) { + + /* if we're at the beginning, wrap around to the end */ + while (open_files->next) + open_files = open_files->next; + +#ifdef DEBUG + fprintf(stderr, _("filename is %s"), open_files->data); +#endif + + } + + load_open_file(); + +#ifdef DEBUG + dump_buffer(current); +#endif + + return 0; +} + +/* + * Open the next entry in the open_files structure. If closing_file is + * zero, update the current entry before switching from it. Otherwise, we + * are about to close that entry, so don't bother doing so. Return 0 on + * success and 1 on error. + */ +int open_nextfile(int closing_file) +{ + if (!open_files) + return 1; + + /* if we're not about to close the current entry, update it before + doing anything; since we're only switching, we don't need to check + for duplicate entries */ + if (!closing_file) + add_open_file(1, 0); + + if (!open_files->prev && !open_files->next) { + + /* only one file open */ + if (!closing_file) + statusbar(_("No more open files")); + return 1; + } + + if (open_files->next) { + open_files = open_files->next; + +#ifdef DEBUG + fprintf(stderr, _("filename is %s"), open_files->data); +#endif + + } + else if (open_files->prev) { + + /* if we're at the end, wrap around to the beginning */ + while (open_files->prev) { + open_files = open_files->prev; + +#ifdef DEBUG + fprintf(stderr, _("filename is %s"), open_files->data); +#endif + + } + } + + load_open_file(); + +#ifdef DEBUG + dump_buffer(current); +#endif + + return 0; +} + +/* + * Delete an entry from the open_files filestruct. After deletion of an + * entry, the previous or next entry is opened, whichever is found first. + * Return 0 on success or 1 on error. + */ +int close_open_file(void) +{ + filestruct *tmp; + + if (!open_files) + return 1; + + tmp = open_files; + if (open_prevfile(1)) { + if (open_nextfile(1)) + return 1; + } + + unlink_node(tmp); + free_filestruct(tmp->file); + free(tmp->file_path); + delete_node(tmp); + + shortcut_init(0); + display_main_list(); + return 0; +} + +/* + * When passed "[relative path][filename]" in origpath, return "[full + * path][filename]" on success, or NULL on error. + */ +char *get_full_path(const char *origpath) +{ + char *newpath = NULL, *last_slash, *d_here, *d_there, *d_there_file; + int last_slash_index; + + /* first, get the current directory */ + +#ifdef PATH_MAX + d_here = getcwd(NULL, PATH_MAX + 1); +#else + d_here = getcwd(NULL, 0); +#endif + + if (d_here) { + + align(&d_here); + + /* get the filename (with path included) and save it 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); + + /* search for the last slash in d_there */ + last_slash = strrchr(d_there, '/'); + + /* if we didn't find one, copy d_here into d_there; all data is + then set up */ + if (!last_slash) { + d_there = nrealloc(d_there, strlen(d_here) + 1); + strcpy(d_there, d_here); + } + + else { + + /* otherwise, remove all non-path elements from d_there */ + 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); + + /* 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 */ + + free(d_there); + +#ifdef PATH_MAX + d_there = getcwd(NULL, PATH_MAX + 1); +#else + d_there = getcwd(NULL, 0); +#endif + + align(&d_there); + } + + /* finally, go back to where we were before, d_here (no error + checking is done on this chdir(), because we can do + nothing if it fails) */ + chdir(d_here); + } + + /* 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); + + /* finally, clean up */ + free(d_there_file); + free(d_there); + free(d_here); + } + + return newpath; +} +#endif + /* * Write a file out. If tmp is nonzero, we set the umask to 0600, * we don't set the global variable filename to its name, and don't @@ -637,7 +1158,29 @@ int do_writeout(char *path, int exiting, int append) } else #endif i = write_file(answer, 0, append, 0); - + +#ifdef ENABLE_LOADONINSERT + /* if we're not about to exit, update the current entry in + the open_files structure */ + if (!exiting) { + + /* first, if the filename was changed during the save, + update the filename and full path stored in the + current entry, and then update the current entry, + checking for duplicate entries */ + if (strcmp(open_files->data, filename)) { + open_file_change_name(); + add_open_file(1, 1); + } + else { + + /* otherwise, just update the current entry without + checking for duplicate entries */ + add_open_file(1, 0); + } + } +#endif + display_main_list(); return i; } else { diff --git a/global.c b/global.c index 02903200..081d1eb1 100644 --- a/global.c +++ b/global.c @@ -54,6 +54,10 @@ filestruct *editbot = NULL; /* Same for the bottom */ filestruct *filebot = NULL; /* Last node in the file struct */ filestruct *cutbuffer = NULL; /* A place to store cut text */ +#ifdef ENABLE_LOADONINSERT +filestruct *open_files = NULL; /* The list of open files */ +#endif + char *answer = NULL; /* Answer str to many questions */ int totlines = 0; /* Total number of lines in the file */ int totsize = 0; /* Total number of bytes in the file */ @@ -126,11 +130,13 @@ void sc_init_one(shortcut * s, int key, char *desc, char *help, int alt, #ifndef NANO_SMALL /* Initialize the toggles in the same manner */ -void toggle_init_one(toggle * t, int val, char *desc, int flag) +void toggle_init_one(toggle * t, int val, char *desc, int flag, + char override_ch) { t->val = val; t->desc = desc; t->flag = flag; + t->override_ch = override_ch; } #endif @@ -141,6 +147,11 @@ void toggle_init(void) *toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg, *toggle_cuttoend_msg, *toggle_wrap_msg, *toggle_case_msg, *toggle_backwards_msg; + +#ifdef ENABLE_LOADONINSERT + char *toggle_load_msg, *nano_openprev_msg, *nano_opennext_msg; +#endif + #ifdef HAVE_REGEX_H char *toggle_regexp_msg; #endif @@ -159,29 +170,45 @@ void toggle_init(void) #endif toggle_wrap_msg = _("Auto wrap"); +#ifdef ENABLE_LOADONINSERT + toggle_load_msg = _("File loading on insertion"); + nano_openprev_msg = _("Open previously loaded file"); + nano_opennext_msg = _("Open next loaded file"); +#endif + toggle_init_one(&toggles[0], TOGGLE_CONST_KEY, toggle_const_msg, - CONSTUPDATE); + CONSTUPDATE, 0); toggle_init_one(&toggles[1], TOGGLE_AUTOINDENT_KEY, - toggle_autoindent_msg, AUTOINDENT); + toggle_autoindent_msg, AUTOINDENT, 0); toggle_init_one(&toggles[2], TOGGLE_SUSPEND_KEY, toggle_suspend_msg, - SUSPEND); + SUSPEND, 0); toggle_init_one(&toggles[3], TOGGLE_NOHELP_KEY, toggle_nohelp_msg, - NO_HELP); + NO_HELP, 0); toggle_init_one(&toggles[4], TOGGLE_PICOMODE_KEY, toggle_picomode_msg, - PICO_MODE); + PICO_MODE, 0); toggle_init_one(&toggles[5], TOGGLE_WRAP_KEY, toggle_wrap_msg, - NO_WRAP); + NO_WRAP, 0); toggle_init_one(&toggles[6], TOGGLE_MOUSE_KEY, toggle_mouse_msg, - USE_MOUSE); + USE_MOUSE, 0); toggle_init_one(&toggles[7], TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, - CUT_TO_END); + CUT_TO_END, 0); toggle_init_one(&toggles[8], TOGGLE_BACKWARDS_KEY, toggle_backwards_msg, - REVERSE_SEARCH); + REVERSE_SEARCH, 0); toggle_init_one(&toggles[9], TOGGLE_CASE_KEY, toggle_case_msg, - CASE_SENSITIVE); + CASE_SENSITIVE, 0); + +#ifdef ENABLE_LOADONINSERT + toggle_init_one(&toggles[10], TOGGLE_LOAD_KEY, toggle_load_msg, + LOADONINSERT, 0); + toggle_init_one(&toggles[11], NANO_OPENPREV_KEY, nano_openprev_msg, + 0, '<'); + toggle_init_one(&toggles[12], NANO_OPENNEXT_KEY, nano_opennext_msg, + 0, '>'); +#endif + #ifdef HAVE_REGEX_H - toggle_init_one(&toggles[10], TOGGLE_REGEXP_KEY, toggle_regexp_msg, - USE_REGEXP); + toggle_init_one(&toggles[TOGGLE_LEN - 1], TOGGLE_REGEXP_KEY, + toggle_regexp_msg, USE_REGEXP, 0); #endif #endif } @@ -210,7 +237,13 @@ void shortcut_init(int unjustify) nano_help_msg = _("Invoke the help menu"); nano_writeout_msg = _("Write the current file to disk"); + +#ifdef ENABLE_LOADONINSERT + nano_exit_msg = _("Close currently loaded file/Exit from nano"); +#else nano_exit_msg = _("Exit from nano"); +#endif + nano_goto_msg = _("Goto a specific line number"); nano_justify_msg = _("Justify the current paragraph"); nano_unjustify_msg = _("Unjustify after a justify"); @@ -251,7 +284,13 @@ void shortcut_init(int unjustify) sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"), nano_help_msg, 0, NANO_HELP_FKEY, 0, VIEW, do_help); - sc_init_one(&main_list[1], NANO_EXIT_KEY, _("Exit"), +#ifdef ENABLE_LOADONINSERT + if (open_files != NULL && (open_files->prev || open_files->next)) + sc_init_one(&main_list[1], NANO_EXIT_KEY, _("Close"), + nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit); + else +#endif + sc_init_one(&main_list[1], NANO_EXIT_KEY, _("Exit"), nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit); sc_init_one(&main_list[2], NANO_WRITEOUT_KEY, _("WriteOut"), @@ -265,13 +304,13 @@ void shortcut_init(int unjustify) else sc_init_one(&main_list[3], NANO_INSERTFILE_KEY, _("Read File"), nano_insert_msg, - 0, NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile); + 0, NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void); if (ISSET(PICO_MODE)) sc_init_one(&main_list[4], NANO_INSERTFILE_KEY, _("Read File"), nano_insert_msg, - 0, NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile); + 0, NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void); else sc_init_one(&main_list[4], NANO_REPLACE_KEY, _("Replace"), nano_replace_msg, diff --git a/nano.c b/nano.c index 8492d183..e75f22db 100644 --- a/nano.c +++ b/nano.c @@ -107,26 +107,11 @@ RETSIGTYPE finish(int sigage) void die(char *msg, ...) { va_list ap; - char *name; - int i; va_start(ap, msg); vfprintf(stderr, msg, ap); va_end(ap); - /* if we can't save we have REAL bad problems, - * but we might as well TRY. */ - if (filename[0] == '\0') { - name = "nano.save"; - i = write_file(name, 1, 0, 0); - } else { - - char *buf = charalloc(strlen(filename) + 6); - strcpy(buf, filename); - strcat(buf, ".save"); - i = write_file(buf, 1, 0, 0); - name = buf; - } /* Restore the old term settings */ tcsetattr(0, TCSANOW, &oldterm); @@ -136,12 +121,62 @@ void die(char *msg, ...) endwin(); fprintf(stderr, msg); + + /* save the currently loaded file (if modified, its open_files entry + isn't up to date) */ + die_save_file(filename); + +#ifdef ENABLE_LOADONINSERT + /* then save all of the other loaded files, if any */ + if (open_files) { + filestruct *tmp; + + tmp = open_files; + + while (open_files->prev) + open_files = open_files->prev; + + while (open_files->next) { + + /* if we already saved the file above (i. e. if it was the + currently loaded file), don't save it again */ + if (tmp != open_files) { + fileage = open_files->file; + die_save_file(open_files->data); + } + + open_files = open_files->next; + } + + } +#endif + + exit(1); /* We have a problem: exit w/ errorlevel(1) */ +} + +void die_save_file(char *die_filename) +{ + char *name; + int i; + + /* if we can't save we have REAL bad problems, + * but we might as well TRY. */ + if (die_filename[0] == '\0') { + name = "nano.save"; + i = write_file(name, 1, 0, 0); + } else { + + char *buf = charalloc(strlen(die_filename) + 6); + strcpy(buf, die_filename); + strcat(buf, ".save"); + i = write_file(buf, 1, 0, 0); + name = buf; + } + if (i != -1) fprintf(stderr, _("\nBuffer written to %s\n"), name); else fprintf(stderr, _("\nNo %s written (file exists?)\n"), name); - - exit(1); /* We have a problem: exit w/ errorlevel(1) */ } /* Die with an error message that the screen was too small if, well, the @@ -225,7 +260,8 @@ void init_help_msg(void) } #endif -/* Make a copy of a node to a pointer (space will be malloc()ed) */ +/* Make a copy of a node to a pointer (space will be malloc()ed). This + does NOT copy the data members used only by open_files. */ filestruct *copy_node(filestruct * src) { filestruct *dst; @@ -252,6 +288,8 @@ void unlink_node(filestruct * fileptr) fileptr->next->prev = fileptr->prev; } +/* Delete a node from the struct. This does NOT delete the data members + used only by open_files. */ void delete_node(filestruct * fileptr) { if (fileptr == NULL) @@ -262,7 +300,8 @@ void delete_node(filestruct * fileptr) free(fileptr); } -/* Okay, now let's duplicate a whole struct! */ +/* Okay, now let's duplicate a whole struct! This does NOT duplicate the + data members used only by open_files. */ filestruct *copy_filestruct(filestruct * src) { filestruct *dst, *tmp, *head, *prev; @@ -286,6 +325,8 @@ filestruct *copy_filestruct(filestruct * src) return head; } +/* Frees a struct. This does NOT free the data members used only by + open_files. */ int free_filestruct(filestruct * src) { filestruct *fileptr = src; @@ -360,6 +401,13 @@ void usage(void) #ifdef HAVE_GETOPT_LONG printf(_("Usage: nano [GNU long option] [option] +LINE \n\n")); printf(_("Option Long option Meaning\n")); + +#ifdef ENABLE_LOADONINSERT + printf + (_ + (" -L --loadoninsert Enable file loading on insertion\n")); +#endif + printf(_ (" -T [num] --tabsize=[num] Set width of a tab to num\n")); #ifdef HAVE_REGEX_H @@ -463,6 +511,9 @@ void version(void) #ifdef NANO_EXTRA printf(" --enable-extra"); #endif +#ifdef ENABLE_LOADONINSERT + printf(" --enable-loadoninsert"); +#endif #ifdef ENABLE_NANORC printf(" --enable-nanorc"); #endif @@ -503,6 +554,8 @@ void version(void) } +/* Create a new node. This does NOT initialize the data members used + only by open_files. */ filestruct *make_new_node(filestruct * prevnode) { filestruct *newnode; @@ -519,7 +572,8 @@ filestruct *make_new_node(filestruct * prevnode) return newnode; } -/* Splice a node into an existing filestruct */ +/* Splice a node into an existing filestruct. This does NOT set the data + members used only by open_files. */ void splice_node(filestruct * begin, filestruct * newnode, filestruct * end) { @@ -1459,9 +1513,17 @@ int do_alt_speller(char *file_name) global_init(); open_file(file_name, 0, 1); - do_gotoline(lineno_cur); + do_gotoline(lineno_cur, 0); set_modified(); +#ifdef ENABLE_LOADONINSERT + /* 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 + return TRUE; } #endif @@ -1508,8 +1570,18 @@ int do_exit(void) { int i; - if (!ISSET(MODIFIED)) - finish(0); + if (!ISSET(MODIFIED)) { + +#ifdef ENABLE_LOADONINSERT + if (!close_open_file()) { + display_main_list(); + return 1; + } + else +#endif + + finish(0); + } if (ISSET(TEMP_OPT)) { i = 1; @@ -1524,11 +1596,30 @@ int do_exit(void) #endif if (i == 1) { - if (do_writeout(filename, 1, 0) > 0) + if (do_writeout(filename, 1, 0) > 0) { + +#ifdef ENABLE_LOADONINSERT + if (!close_open_file()) { + display_main_list(); + return 1; + } + else +#endif + + finish(0); + } + } else if (i == 0) { + +#ifdef ENABLE_LOADONINSERT + if (!close_open_file()) { + display_main_list(); + return 1; + } + else +#endif + finish(0); - } else if (i == 0) - finish(0); - else + } else statusbar(_("Cancelled")); display_main_list(); @@ -2139,12 +2230,21 @@ void help_init(void) /* And the toggles... */ for (i = 0; i <= TOGGLE_LEN - 1; i++) { - sofar = snprintf(buf, BUFSIZ, - "M-%c ", toggles[i].val - 32); + if (toggles[i].override_ch != 0) + sofar = snprintf(buf, BUFSIZ, + "M-%c ", toggles[i].override_ch); + else + sofar = snprintf(buf, BUFSIZ, + "M-%c ", toggles[i].val - 32); - if (toggles[i].desc != NULL) - snprintf(&buf[sofar], BUFSIZ - sofar, _("%s enable/disable"), - toggles[i].desc); + if (toggles[i].desc != NULL) { + if (toggles[i].flag != 0) + snprintf(&buf[sofar], BUFSIZ - sofar, _("%s enable/disable"), + toggles[i].desc); + else + snprintf(&buf[sofar], BUFSIZ - sofar, _("%s"), + toggles[i].desc); + } strcat(help_text, buf); strcat(help_text, "\n"); @@ -2183,21 +2283,43 @@ void do_toggle(int which) edit_refresh(); display_main_list(); break; + +#ifdef ENABLE_LOADONINSERT + case NANO_OPENPREV_KEY: + open_prevfile(0); + break; + case NANO_OPENNEXT_KEY: + open_nextfile(0); + break; +#endif + } - if (!ISSET(toggles[which].flag)) { - if (toggles[which].val == TOGGLE_NOHELP_KEY || - toggles[which].val == TOGGLE_WRAP_KEY) - statusbar("%s %s", toggles[which].desc, enabled); - else - statusbar("%s %s", toggles[which].desc, disabled); - } else { - if (toggles[which].val == TOGGLE_NOHELP_KEY || - toggles[which].val == TOGGLE_WRAP_KEY) - statusbar("%s %s", toggles[which].desc, disabled); - else - statusbar("%s %s", toggles[which].desc, enabled); +#ifdef ENABLE_LOADONINSERT + /* NANO_OPENPREV_KEY and NANO_OPENNEXT_KEY aren't really toggles, so + don't display anything on the statusbar if they're pressed */ + if (toggles[which].val != NANO_OPENPREV_KEY && + toggles[which].val != NANO_OPENNEXT_KEY) { +#endif + + if (!ISSET(toggles[which].flag)) { + if (toggles[which].val == TOGGLE_NOHELP_KEY || + toggles[which].val == TOGGLE_WRAP_KEY) + statusbar("%s %s", toggles[which].desc, enabled); + else + statusbar("%s %s", toggles[which].desc, disabled); + } else { + if (toggles[which].val == TOGGLE_NOHELP_KEY || + toggles[which].val == TOGGLE_WRAP_KEY) + statusbar("%s %s", toggles[which].desc, disabled); + else + statusbar("%s %s", toggles[which].desc, enabled); + } + +#ifdef ENABLE_LOADONINSERT } +#endif + SET(DISABLE_CURPOS); #endif @@ -2279,6 +2401,11 @@ int main(int argc, char *argv[]) {"pico", 0, 0, 'p'}, {"nofollow", 0, 0, 'l'}, {"tabsize", 1, 0, 'T'}, + +#ifdef ENABLE_LOADONINSERT + {"loadoninsert", 0, 0, 'L'}, +#endif + {0, 0, 0, 0} }; #endif @@ -2299,14 +2426,21 @@ int main(int argc, char *argv[]) #endif /* ENABLE_NANORC */ #ifdef HAVE_GETOPT_LONG - while ((optchr = getopt_long(argc, argv, "?T:RVbcefghijklmpr:s:tvwxz", + while ((optchr = getopt_long(argc, argv, "h?LT:RVbcefgijklmpr:s:tvwxz", long_options, &option_index)) != EOF) { #else while ((optchr = - getopt(argc, argv, "h?T:RVbcefgijklmpr:s:tvwxz")) != EOF) { + getopt(argc, argv, "h?LT:RVbcefgijklmpr:s:tvwxz")) != EOF) { #endif switch (optchr) { + +#ifdef ENABLE_LOADONINSERT + case 'L': + SET(LOADONINSERT); + break; +#endif + case 'T': tabsize = atoi(optarg); if (tabsize <= 0) { @@ -2483,7 +2617,7 @@ int main(int argc, char *argv[]) open_file(filename, 0, 0); if (startline > 0) - do_gotoline(startline); + do_gotoline(startline, 0); else edit_update(fileage, CENTER); @@ -2583,7 +2717,12 @@ int main(int argc, char *argv[]) break; case 126: /* Hack, make insert key do something useful, like insert file */ - do_insertfile(); +#ifdef ENABLE_LOADONINSERT + do_insertfile(ISSET(LOADONINSERT)); +#else + do_insertfile(0); +#endif + keyhandled = 1; break; #ifdef DEBUG diff --git a/nano.h b/nano.h index b381d020..4d441f1d 100644 --- a/nano.h +++ b/nano.h @@ -73,6 +73,18 @@ typedef struct filestruct { char *data; struct filestruct *next; /* Next node */ struct filestruct *prev; /* Previous node */ + +#ifdef ENABLE_LOADONINSERT + struct filestruct *file; /* Current file */ + int file_current_x; /* Current file's x-coordinate position */ + int file_current_y; /* Current file's y-coordinate position */ + int file_modified; /* Current file's modification status */ + char *file_path; /* Current file's full path location */ + int file_placewewant; /* Current file's place we want */ + int file_totlines; /* Current file's total number of lines */ + int file_totsize; /* Current file's total size */ +#endif + long lineno; /* The line number */ } filestruct; @@ -93,6 +105,8 @@ typedef struct toggle { e.g. "Pico Messages"; we'll append Enabled or Disabled */ int flag; /* What flag actually gets toggled */ + char override_ch; /* The character to display on the help screen, + if it isn't NULL */ } toggle; #ifdef ENABLE_NANORC @@ -125,6 +139,7 @@ typedef struct rcoption { #define CUT_TO_END (1<<17) #define DISABLE_CURPOS (1<<18) #define REVERSE_SEARCH (1<<19) +#define LOADONINSERT (1<<20) /* Control key sequences, changing these would be very very bad */ @@ -186,6 +201,8 @@ typedef struct rcoption { #define NANO_ALT_X 'x' #define NANO_ALT_Y 'y' #define NANO_ALT_Z 'z' +#define NANO_ALT_LCARAT ',' +#define NANO_ALT_RCARAT '.' /* Some semi-changeable keybindings; don't play with unless you're sure you know what you're doing */ @@ -241,6 +258,8 @@ know what you're doing */ #define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T #define NANO_TOFILES_KEY NANO_CONTROL_T #define NANO_APPEND_KEY NANO_ALT_A +#define NANO_OPENPREV_KEY NANO_ALT_LCARAT +#define NANO_OPENNEXT_KEY NANO_ALT_RCARAT #define TOGGLE_CONST_KEY NANO_ALT_C #define TOGGLE_AUTOINDENT_KEY NANO_ALT_I @@ -253,15 +272,28 @@ know what you're doing */ #define TOGGLE_WRAP_KEY NANO_ALT_W #define TOGGLE_BACKWARDS_KEY NANO_ALT_B #define TOGGLE_CASE_KEY NANO_ALT_A +#define TOGGLE_LOAD_KEY NANO_ALT_L /* Toggle stuff, these static lengths need to go away RSN */ #ifdef HAVE_REGEX_H + +#ifdef ENABLE_LOADONINSERT +#define TOGGLE_LEN 14 +#else #define TOGGLE_LEN 11 +#endif + #define WHEREIS_LIST_LEN 8 #define REPLACE_LIST_LEN 8 #else + +#ifdef ENABLE_LOADONINSERT +#define TOGGLE_LEN 13 +#else #define TOGGLE_LEN 10 +#endif + #define WHEREIS_LIST_LEN 7 #define REPLACE_LIST_LEN 7 #endif @@ -286,6 +318,7 @@ know what you're doing */ #define VIEW 1 #define NOVIEW 0 +#define NONE 3 #define TOP 2 #define CENTER 1 #define BOTTOM 0 diff --git a/nanorc.sample b/nanorc.sample index bb902111..319a09f5 100644 --- a/nanorc.sample +++ b/nanorc.sample @@ -41,3 +41,6 @@ # Allow nano to be suepended with ^Z # set suspend +# Load files upon inserting them, and allow switching between them +# set loadoninsert + diff --git a/proto.h b/proto.h index 766d8725..887a6c16 100644 --- a/proto.h +++ b/proto.h @@ -50,6 +50,11 @@ extern char *alt_speller; extern struct stat fileinfo; extern filestruct *current, *fileage, *edittop, *editbot, *filebot; extern filestruct *cutbuffer, *mark_beginbuf; + +#ifdef ENABLE_LOADONINSERT +extern filestruct *open_files; +#endif + extern shortcut *shortcut_list; extern shortcut main_list[MAIN_LIST_LEN], whereis_list[WHEREIS_LIST_LEN]; extern shortcut replace_list[REPLACE_LIST_LEN], goto_list[GOTO_LIST_LEN]; @@ -89,8 +94,14 @@ int do_uncut_text(void); int no_help(void); int renumber_all(void); int open_file(char *filename, int insert, int quiet); +int do_insertfile(int loading_file); + +#ifdef ENABLE_LOADONINSERT +int add_open_file(int update, int dup_fix); +#endif + int do_writeout(char *path, int exiting, int append); -int do_gotoline(long defline); +int do_gotoline(long line, int save_pos); int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx, int wholewords, int *i); /* Now in move.c */ @@ -110,7 +121,7 @@ void check_wrap(filestruct * inptr, char ch); void dump_buffer(filestruct * inptr); void align(char **strp); void edit_refresh(void), edit_refresh_clearok(void); -void edit_update(filestruct * fileptr, int topmidbot); +void edit_update(filestruct * fileptr, int topmidbotnone); void update_cursor(void); void delete_node(filestruct * fileptr); void set_modified(void); @@ -136,6 +147,7 @@ void do_early_abort(void); void *nmalloc(size_t howmuch); void *nrealloc(void *ptr, size_t howmuch); void die(char *msg, ...); +void die_save_file(char *die_filename); void new_file(void); void new_magicline(void); void splice_node(filestruct *begin, filestruct *newnode, filestruct *end); @@ -150,6 +162,7 @@ void nano_disabled_msg(void); void window_init(void); void do_mouse(void); void print_view_warning(void); +void unlink_node(filestruct * fileptr); void cut_marked_segment(filestruct * top, int top_x, filestruct * bot, int bot_x, int destructive); @@ -163,7 +176,13 @@ void do_credits(void); int do_writeout_void(void), do_exit(void), do_gotoline_void(void); -int do_insertfile(void), do_search(void), page_up(void), page_down(void); +int do_insertfile_void(void), do_search(void); + +#ifdef ENABLE_LOADONINSERT +int load_open_file(void), close_open_file(void); +#endif + +int page_up(void), page_down(void); int do_cursorpos(void), do_spell(void); int do_up(void), do_down (void), do_right(void), do_left (void); int do_home(void), do_end(void), total_refresh(void), do_mark(void); @@ -172,8 +191,17 @@ int do_first_line(void), do_last_line(void); int do_replace(void), do_help(void), do_enter_void(void); int keypad_on(WINDOW * win, int newval); +#ifdef ENABLE_LOADONINSERT +int open_file_dup_fix(int update); +int open_prevfile(int closing_file), open_nextfile(int closing_file); +#endif + char *charalloc (size_t howmuch); +#ifdef ENABLE_LOADONINSERT +char *get_full_path(const char *origpath); +#endif + #ifndef DISABLE_BROWSER char *do_browser(char *path); struct stat filestat(const char *path); @@ -195,3 +223,7 @@ filestruct *copy_filestruct(filestruct * src); filestruct *make_new_node(filestruct * prevnode); filestruct *findnextstr(int quiet, filestruct * begin, int beginx, char *needle); + +#ifdef ENABLE_LOADONINSERT +filestruct *open_file_dup_search(void); +#endif diff --git a/rcfile.c b/rcfile.c index b0b0c4e0..36342108 100644 --- a/rcfile.c +++ b/rcfile.c @@ -39,7 +39,7 @@ #define _(string) (string) #endif -#define NUM_RCOPTS 14 +#define NUM_RCOPTS 15 /* Static stuff for the nanorc file */ rcoption rcopts[NUM_RCOPTS] = { @@ -60,7 +60,8 @@ rcoption rcopts[NUM_RCOPTS] = {"view", VIEW_MODE}, {"nowrap", NO_WRAP}, {"nohelp", NO_HELP}, -{"suspend", SUSPEND}}; +{"suspend", SUSPEND}, +{"loadoninsert", LOADONINSERT}}; /* We have an error in some part of the rcfile; put it on stderr and make the user hit return to continue starting up nano */ diff --git a/search.c b/search.c index 74cb74c2..b6d1bf19 100644 --- a/search.c +++ b/search.c @@ -743,7 +743,7 @@ void goto_abort(void) display_main_list(); } -int do_gotoline(long line) +int do_gotoline(long line, int save_pos) { long i = 1; @@ -772,7 +772,13 @@ int do_gotoline(long line) current = current->next; current_x = 0; - edit_update(current, CENTER); + + /* if save_pos is non-zero, don't change the cursor position when + updating the edit window */ + if (save_pos) + edit_update(current, NONE); + else + edit_update(current, CENTER); goto_abort(); return 1; @@ -780,5 +786,5 @@ int do_gotoline(long line) int do_gotoline_void(void) { - return do_gotoline(0); + return do_gotoline(0, 0); } diff --git a/winio.c b/winio.c index 5c1c1240..4337e7f1 100644 --- a/winio.c +++ b/winio.c @@ -1079,7 +1079,7 @@ void edit_refresh_clearok(void) * Nice generic routine to update the edit buffer, given a pointer to the * file struct =) */ -void edit_update(filestruct * fileptr, int topmidbot) +void edit_update(filestruct * fileptr, int topmidbotnone) { int i = 0; filestruct *temp; @@ -1088,8 +1088,11 @@ void edit_update(filestruct * fileptr, int topmidbot) return; temp = fileptr; - if (topmidbot == 2); - else if (topmidbot == 0) + if (topmidbotnone == TOP); + else if (topmidbotnone == NONE) + for (i = 0; i <= current_y - 1 && temp->prev != NULL; i++) + temp = temp->prev; + else if (topmidbotnone == BOTTOM) for (i = 0; i <= editwinrows - 1 && temp->prev != NULL; i++) temp = temp->prev; else