dslinux/user/nano ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL Makefile.am Makefile.in NEWS README THANKS TODO UPGRADE acinclude.m4 aclocal.m4 color.c config.guess config.h.in config.rpath config.sub configure configure.ac cut.c depcomp faq.html files.c global.c install-sh missing mkinstalldirs move.c nano.1 nano.1.html nano.c nano.h nano.info nano.spec nano.spec.in nano.texi nanorc.5 nanorc.5.html nanorc.sample proto.h rcfile.c search.c texinfo.tex utils.c winio.c

stsp stsp at user.in-berlin.de
Thu Aug 17 01:41:05 CEST 2006


Update of /cvsroot/dslinux/dslinux/user/nano
In directory antilope:/tmp/cvs-serv2793

Added Files:
	ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL Makefile.am 
	Makefile.in NEWS README THANKS TODO UPGRADE acinclude.m4 
	aclocal.m4 color.c config.guess config.h.in config.rpath 
	config.sub configure configure.ac cut.c depcomp faq.html 
	files.c global.c install-sh missing mkinstalldirs move.c 
	nano.1 nano.1.html nano.c nano.h nano.info nano.spec 
	nano.spec.in nano.texi nanorc.5 nanorc.5.html nanorc.sample 
	proto.h rcfile.c search.c texinfo.tex utils.c winio.c 
Log Message:
Adding pristine copy of nano so I can branch from it.


--- NEW FILE: mkinstalldirs ---
#! /bin/sh
# mkinstalldirs --- make directory hierarchy

scriptversion=2005-02-02.21

# Original author: Noah Friedman <friedman at prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake at gnu.org> or send patches to
# <automake-patches at gnu.org>.

errstatus=0
dirmode=""

usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...

Create each directory DIR (with mode MODE, if specified), including all
leading file name components.

Report bugs to <bug-automake at gnu.org>."

# process command line arguments
while test $# -gt 0 ; do
  case $1 in
    -h | --help | --h*)         # -h for help
      echo "$usage"
      exit $?
      ;;
    -m)                         # -m PERM arg
      shift
      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
      dirmode=$1
      shift
      ;;
    --version)
      echo "$0 $scriptversion"
      exit $?
      ;;
    --)                         # stop option processing
      shift
      break
      ;;
    -*)                         # unknown option
      echo "$usage" 1>&2
      exit 1
      ;;
    *)                          # first non-opt arg
      break
      ;;
  esac
done

for file
do
  if test -d "$file"; then
    shift
  else
    break
  fi
done

case $# in
  0) exit 0 ;;
esac

# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error.  This is a problem when calling mkinstalldirs
# from a parallel make.  We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
  '')
    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
      echo "mkdir -p -- $*"
      exec mkdir -p -- "$@"
    else
      # On NextStep and OpenStep, the `mkdir' command does not
      # recognize any option.  It will interpret all options as
      # directories to create, and then abort because `.' already
      # exists.
      test -d ./-p && rmdir ./-p
      test -d ./--version && rmdir ./--version
    fi
    ;;
  *)
    if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
       test ! -d ./--version; then
      echo "mkdir -m $dirmode -p -- $*"
      exec mkdir -m "$dirmode" -p -- "$@"
    else
      # Clean up after NextStep and OpenStep mkdir.
      for d in ./-m ./-p ./--version "./$dirmode";
      do
        test -d $d && rmdir $d
      done
    fi
    ;;
esac

for file
do
  set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
  shift

  pathcomp=
  for d
  do
    pathcomp="$pathcomp$d"
    case $pathcomp in
      -*) pathcomp=./$pathcomp ;;
    esac

    if test ! -d "$pathcomp"; then
      echo "mkdir $pathcomp"

      mkdir "$pathcomp" || lasterr=$?

      if test ! -d "$pathcomp"; then
	errstatus=$lasterr
      else
	if test ! -z "$dirmode"; then
	  echo "chmod $dirmode $pathcomp"
	  lasterr=""
	  chmod "$dirmode" "$pathcomp" || lasterr=$?

	  if test ! -z "$lasterr"; then
	    errstatus=$lasterr
	  fi
	fi
      fi
    fi

    pathcomp="$pathcomp/"
  done
done

exit $errstatus

# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

--- NEW FILE: config.rpath ---
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
#   Copyright 1996-2002 Free Software Foundation, Inc.
#   Taken from GNU libtool, 2001
#   Originally by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful, but
#   WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#   As a special exception to the GNU General Public License, if you
#   distribute this file as part of a program that contains a
#   configuration script generated by Autoconf, you may include it under
#   the same distribution terms that you use for the rest of that program.
#
# The first argument passed to this file is the canonical host specification,
#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.

# All known linkers require a `.a' archive for static linking (except M$VC,
# which needs '.lib').
libext=a
shlibext=

host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`

wl=
if test "$GCC" = yes; then
  wl='-Wl,'
else
  case "$host_os" in
    aix3* | aix4* | aix5*)
      wl='-Wl,'
      ;;
    hpux9* | hpux10* | hpux11*)
      wl='-Wl,'
      ;;
    irix5* | irix6*)
      wl='-Wl,'
      ;;
    linux*)
      echo '__INTEL_COMPILER' > conftest.$ac_ext
      if $CC -E conftest.$ac_ext >/dev/null | grep __INTEL_COMPILER >/dev/null
      then
        :
      else
        # Intel icc
        wl='-Qoption,ld,'
      fi
      ;;
    osf3* | osf4* | osf5*)
      wl='-Wl,'
      ;;
    solaris*)
      wl='-Wl,'
      ;;
    sunos4*)
      wl='-Qoption ld '
      ;;
    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
      if test "x$host_vendor" = xsni; then
        wl='-LD'
      else
        wl='-Wl,'
      fi
      ;;
  esac
fi

hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no

case "$host_os" in
  cygwin* | mingw* | pw32*)
    # FIXME: the MSVC++ port hasn't been tested in a loooong time
    # When not using gcc, we currently assume that we are using
    # Microsoft Visual C++.
    if test "$GCC" != yes; then
      with_gnu_ld=no
    fi
    ;;
  openbsd*)
    with_gnu_ld=no
    ;;
esac

ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
  case "$host_os" in
    aix3* | aix4* | aix5*)
      # On AIX, the GNU linker is very broken
      ld_shlibs=no
      ;;
    amigaos*)
      hardcode_libdir_flag_spec='-L$libdir'
      hardcode_minus_L=yes
      # Samuel A. Falvo II <kc5tja at dolphin.openprojects.net> reports
      # that the semantics of dynamic libraries on AmigaOS, at least up
      # to version 4, is to share data among multiple programs linked
      # with the same dynamic library.  Since this doesn't match the
      # behavior of shared libraries on other platforms, we can use
      # them.
      ld_shlibs=no
      ;;
    beos*)
      if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
        :
      else
        ld_shlibs=no
      fi
      ;;
    cygwin* | mingw* | pw32*)
      # hardcode_libdir_flag_spec is actually meaningless, as there is
      # no search path for DLLs.
      hardcode_libdir_flag_spec='-L$libdir'
      ;;
    solaris* | sysv5*)
      if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
        ld_shlibs=no
      elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
        :
      else
        ld_shlibs=no
      fi
      ;;
    sunos4*)
      hardcode_direct=yes
      ;;
    *)
      if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
        :
      else
        ld_shlibs=no
      fi
      ;;
  esac
  if test "$ld_shlibs" = yes; then
    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
  fi
else
  case "$host_os" in
    aix3*)
      # Note: this linker hardcodes the directories in LIBPATH if there
      # are no directories specified by -L.
      hardcode_minus_L=yes
      if test "$GCC" = yes; then
        # Neither direct hardcoding nor static linking is supported with a
        # broken collect2.
        hardcode_direct=unsupported
      fi
      ;;
    aix4* | aix5*)
      if test "$host_cpu" = ia64; then
        # On IA64, the linker does run time linking by default, so we don't
        # have to do anything special.
        aix_use_runtimelinking=no
      else
        aix_use_runtimelinking=no
        # Test if we are trying to use run time linking or normal
        # AIX style linking. If -brtl is somewhere in LDFLAGS, we
        # need to do runtime linking.
        case $host_os in aix4.[23]|aix4.[23].*|aix5*)
          for ld_flag in $LDFLAGS; do
            if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
              aix_use_runtimelinking=yes
              break
            fi
          done
        esac
      fi
      hardcode_direct=yes
      hardcode_libdir_separator=':'
      if test "$GCC" = yes; then
        case $host_os in aix4.[012]|aix4.[012].*)
          collect2name=`${CC} -print-prog-name=collect2`
          if test -f "$collect2name" && \
            strings "$collect2name" | grep resolve_lib_name >/dev/null
          then
            # We have reworked collect2
            hardcode_direct=yes
          else
            # We have old collect2
            hardcode_direct=unsupported
            hardcode_minus_L=yes
            hardcode_libdir_flag_spec='-L$libdir'
            hardcode_libdir_separator=
          fi
        esac
      fi
      if test "$aix_use_runtimelinking" = yes; then
        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
      else
        if test "$host_cpu" = ia64; then
          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
        else
          hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
        fi
      fi
      ;;
    amigaos*)
      hardcode_libdir_flag_spec='-L$libdir'
      hardcode_minus_L=yes
      # see comment about different semantics on the GNU ld section
      ld_shlibs=no
      ;;
    cygwin* | mingw* | pw32*)
      # When not using gcc, we currently assume that we are using
      # Microsoft Visual C++.
      # hardcode_libdir_flag_spec is actually meaningless, as there is
      # no search path for DLLs.
      hardcode_libdir_flag_spec=' '
      libext=lib
      ;;
    darwin* | rhapsody*)
      hardcode_direct=yes
      ;;
    freebsd1*)
      ld_shlibs=no
      ;;
    freebsd2.2*)
      hardcode_libdir_flag_spec='-R$libdir'
      hardcode_direct=yes
      ;;
    freebsd2*)
      hardcode_direct=yes
      hardcode_minus_L=yes
      ;;
    freebsd*)
      hardcode_libdir_flag_spec='-R$libdir'
      hardcode_direct=yes
      ;;
    hpux9* | hpux10* | hpux11*)
      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
      hardcode_libdir_separator=:
      hardcode_direct=yes
      hardcode_minus_L=yes # Not in the search PATH, but as the default
                           # location of the library.
      ;;
    irix5* | irix6*)
      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
      hardcode_libdir_separator=:
      ;;
    netbsd*)
      hardcode_libdir_flag_spec='-R$libdir'
      hardcode_direct=yes
      ;;
    newsos6)
      hardcode_direct=yes
      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
      hardcode_libdir_separator=:
      ;;
    openbsd*)
      hardcode_direct=yes
      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
      else
        case "$host_os" in
          openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
            hardcode_libdir_flag_spec='-R$libdir'
            ;;
          *)
            hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
            ;;
        esac
      fi
      ;;
    os2*)
      hardcode_libdir_flag_spec='-L$libdir'
      hardcode_minus_L=yes
      ;;
    osf3*)
      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
      hardcode_libdir_separator=:
      ;;
    osf4* | osf5*)
      if test "$GCC" = yes; then
        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
      else
        # Both cc and cxx compiler support -rpath directly
        hardcode_libdir_flag_spec='-rpath $libdir'
      fi
      hardcode_libdir_separator=:
      ;;
    sco3.2v5*)
      ;;
    solaris*)
      hardcode_libdir_flag_spec='-R$libdir'
      ;;
    sunos4*)
      hardcode_libdir_flag_spec='-L$libdir'
      hardcode_direct=yes
      hardcode_minus_L=yes
      ;;
    sysv4)
      if test "x$host_vendor" = xsno; then
        hardcode_direct=yes # is this really true???
      else
        hardcode_direct=no # Motorola manual says yes, but my tests say they lie
      fi
      ;;
    sysv4.3*)
      ;;
    sysv5*)
      hardcode_libdir_flag_spec=
      ;;
    uts4*)
      hardcode_libdir_flag_spec='-L$libdir'
      ;;
    dgux*)
      hardcode_libdir_flag_spec='-L$libdir'
      ;;
    sysv4*MP*)
      if test -d /usr/nec; then
        ld_shlibs=yes
      fi
      ;;
    sysv4.2uw2*)
      hardcode_direct=yes
      hardcode_minus_L=no
      ;;
    sysv5uw7* | unixware7*)
      ;;
    *)
      ld_shlibs=no
      ;;
  esac
fi

# Check dynamic linker characteristics
libname_spec='lib$name'
sys_lib_dlsearch_path_spec="/lib /usr/lib"
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
case "$host_os" in
  aix3*)
    shlibext=so
    ;;
  aix4* | aix5*)
    shlibext=so
    ;;
  amigaos*)
    shlibext=ixlibrary
    ;;
  beos*)
    shlibext=so
    ;;
  bsdi4*)
    shlibext=so
    sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
    sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
    ;;
  cygwin* | mingw* | pw32*)
    case $GCC,$host_os in
      yes,cygwin*)
        shlibext=dll.a
        ;;
      yes,mingw*)
        shlibext=dll
        sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
        ;;
      yes,pw32*)
        shlibext=dll
        ;;
      *)
        shlibext=dll
        ;;
    esac
    ;;
  darwin* | rhapsody*)
    shlibext=dylib
    ;;
  freebsd1*)
    ;;
  freebsd*)
    shlibext=so
    ;;
  gnu*)
    shlibext=so
    ;;
  hpux9* | hpux10* | hpux11*)
    shlibext=sl
    ;;
  irix5* | irix6*)
    shlibext=so
    case "$host_os" in
      irix5*)
        libsuff= shlibsuff=
        ;;
      *)
        case $LD in
          *-32|*"-32 ") libsuff= shlibsuff= ;;
          *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 ;;
          *-64|*"-64 ") libsuff=64 shlibsuff=64 ;;
          *) libsuff= shlibsuff= ;;
        esac
        ;;
    esac
    sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
    sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
    ;;
  linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
    ;;
  linux-gnu*)
    shlibext=so
    ;;
  netbsd*)
    shlibext=so
    ;;
  newsos6)
    shlibext=so
    ;;
  openbsd*)
    shlibext=so
    ;;
  os2*)
    libname_spec='$name'
    shlibext=dll
    ;;
  osf3* | osf4* | osf5*)
    shlibext=so
    sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
    sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
    ;;
  sco3.2v5*)
    shlibext=so
    ;;
  solaris*)
    shlibext=so
    ;;
  sunos4*)
    shlibext=so
    ;;
  sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
    shlibext=so
    case "$host_vendor" in
      motorola)
        sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
        ;;
    esac
    ;;
  uts4*)
    shlibext=so
    ;;
  dgux*)
    shlibext=so
    ;;
  sysv4*MP*)
    if test -d /usr/nec; then
      shlibext=so
    fi
    ;;
esac

sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`

sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF

# How to pass a linker flag through the compiler.
wl="$escaped_wl"

# Static library suffix (normally "a").
libext="$libext"

# Shared library suffix (normally "so").
shlibext="$shlibext"

# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"

# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"

# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"

# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"

# Compile-time system search path for libraries
sys_lib_search_path_spec="$escaped_sys_lib_search_path_spec"

# Run-time system search path for libraries
sys_lib_dlsearch_path_spec="$escaped_sys_lib_dlsearch_path_spec"

EOF

--- NEW FILE: COPYING ---
		    GNU GENERAL PUBLIC LICENSE
		       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

			    Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

		    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

			    NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

		     END OF TERMS AND CONDITIONS

	    How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) year  name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Library General
Public License instead of this License.

--- NEW FILE: Makefile.in ---
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@

# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005  Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

@SET_MAKE@

SOURCES = $(nano_SOURCES)

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = nano$(EXEEXT)
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
	$(srcdir)/nano.spec.in $(top_srcdir)/configure ABOUT-NLS \
	AUTHORS COPYING ChangeLog INSTALL NEWS THANKS TODO \
	config.guess config.rpath config.sub depcomp install-sh \
	missing mkinstalldirs texinfo.tex
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
	$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
	$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
	$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
 configure.lineno configure.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = nano.spec
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(infodir)" \
	"$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_nano_OBJECTS = color.$(OBJEXT) cut.$(OBJEXT) files.$(OBJEXT) \
	global.$(OBJEXT) move.$(OBJEXT) nano.$(OBJEXT) \
	rcfile.$(OBJEXT) search.$(OBJEXT) utils.$(OBJEXT) \
	winio.$(OBJEXT)
nano_OBJECTS = $(am_nano_OBJECTS)
nano_DEPENDENCIES =
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(nano_SOURCES)
DIST_SOURCES = $(nano_SOURCES)
INFO_DEPS = $(srcdir)/nano.info
am__TEXINFO_TEX_DIR = $(srcdir)
DVIS = nano.dvi
PDFS = nano.pdf
PSS = nano.ps
HTMLS = nano.html
TEXINFOS = nano.texi
TEXI2DVI = texi2dvi
TEXI2PDF = $(TEXI2DVI) --pdf --batch
MAKEINFOHTML = $(MAKEINFO) --html
AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
DVIPS = dvips
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
	html-recursive info-recursive install-data-recursive \
	install-exec-recursive install-info-recursive \
	install-recursive installcheck-recursive installdirs-recursive \
	pdf-recursive ps-recursive uninstall-info-recursive \
	uninstall-recursive
man1dir = $(mandir)/man1
man5dir = $(mandir)/man5
NROFF = nroff
MANS = $(man_MANS)
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
  { test ! -d $(distdir) \
    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
         && rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CURSES_LIB = @CURSES_LIB@
CYGPATH_W = @CYGPATH_W@
DEFS = -DSYSCONFDIR=\"$(sysconfdir)\"
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_CONFIG = @GLIB_CONFIG@
GLIB_LIBS = @GLIB_LIBS@
GMSGFMT = @GMSGFMT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INTLLIBS = @INTLLIBS@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = makeinfo --no-split
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MSGMERGE = @MSGMERGE@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
XGETTEXT = @XGETTEXT@
ac_ct_CC = @ac_ct_CC@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
AUTOMAKE_OPTIONS = gnu no-dependencies
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 

man_MANS = nano.1 nanorc.5
nano_LDADD = @GLIB_LIBS@ @LIBINTL@
info_TEXINFOS = nano.texi
EXTRA_DIST = ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS \
		README THANKS TODO UPGRADE config.rpath install-sh missing \
		mkinstalldirs nano.1.html nanorc.5.html faq.html \
		nanorc.sample nano.spec $(man_MANS)

SUBDIRS = po m4
localedir = $(datadir)/locale
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -I at includedir@
ACLOCAL_AMFLAGS = -I m4
all: config.h
	$(MAKE) $(AM_MAKEFLAGS) all-recursive

.SUFFIXES:
.SUFFIXES: .c .dvi .html .info .o .obj .pdf .ps .texi
am--refresh:
	@:
$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
	@for dep in $?; do \
	  case '$(am__configure_deps)' in \
	    *$$dep*) \
	      echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
	      cd $(srcdir) && $(AUTOMAKE) --gnu  \
		&& exit 0; \
	      exit 1;; \
	  esac; \
	done; \
	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
	cd $(top_srcdir) && \
	  $(AUTOMAKE) --gnu  Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	@case '$?' in \
	  *config.status*) \
	    echo ' $(SHELL) ./config.status'; \
	    $(SHELL) ./config.status;; \
	  *) \
	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
	esac;

$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
	$(SHELL) ./config.status --recheck

$(top_srcdir)/configure:  $(am__configure_deps)
	cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)

config.h: stamp-h1
	@if test ! -f $@; then \
	  rm -f stamp-h1; \
	  $(MAKE) stamp-h1; \
	else :; fi

stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
	@rm -f stamp-h1
	cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in:  $(am__configure_deps) 
	cd $(top_srcdir) && $(AUTOHEADER)
	rm -f stamp-h1
	touch $@

distclean-hdr:
	-rm -f config.h stamp-h1
nano.spec: $(top_builddir)/config.status $(srcdir)/nano.spec.in
	cd $(top_builddir) && $(SHELL) ./config.status $@
install-binPROGRAMS: $(bin_PROGRAMS)
	@$(NORMAL_INSTALL)
	test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
	@list='$(bin_PROGRAMS)'; for p in $$list; do \
	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
	  if test -f $$p \
	  ; then \
	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
	  else :; fi; \
	done

uninstall-binPROGRAMS:
	@$(NORMAL_UNINSTALL)
	@list='$(bin_PROGRAMS)'; for p in $$list; do \
	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
	done

clean-binPROGRAMS:
	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
nano$(EXEEXT): $(nano_OBJECTS) $(nano_DEPENDENCIES) 
	@rm -f nano$(EXEEXT)
	$(LINK) $(nano_LDFLAGS) $(nano_OBJECTS) $(nano_LDADD) $(LIBS)

mostlyclean-compile:
	-rm -f *.$(OBJEXT)

distclean-compile:
	-rm -f *.tab.c

.c.o:
	$(COMPILE) -c $<

.c.obj:
	$(COMPILE) -c `$(CYGPATH_W) '$<'`

.texi.info:
	restore=: && backupdir="$(am__leading_dot)am$$$$" && \
	am__cwd=`pwd` && cd $(srcdir) && \
	rm -rf $$backupdir && mkdir $$backupdir && \
	for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
	  if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
	done; \
	cd "$$am__cwd"; \
	if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
	 -o $@ $<; \
	then \
	  rc=0; \
	  cd $(srcdir); \
	else \
	  rc=$$?; \
	  cd $(srcdir) && \
	  $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
	fi; \
	rm -rf $$backupdir; exit $$rc

.texi.dvi:
	TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
	MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
	$(TEXI2DVI) $<

.texi.pdf:
	TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
	MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
	$(TEXI2PDF) $<

.texi.html:
	rm -rf $(@:.html=.htp)
	if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
	 -o $(@:.html=.htp) $<; \
	then \
	  rm -rf $@; \
	  if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
	    mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
	else \
	  if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
	    rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
	  exit 1; \
	fi
$(srcdir)/nano.info: nano.texi 
nano.dvi: nano.texi 
nano.pdf: nano.texi 
nano.html: nano.texi 
.dvi.ps:
	$(DVIPS) -o $@ $<

uninstall-info-am:
	@$(PRE_UNINSTALL)
	@if (install-info --version && \
	     install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
	  list='$(INFO_DEPS)'; \
	  for file in $$list; do \
	    relfile=`echo "$$file" | sed 's|^.*/||'`; \
	    echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
	    install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
	  done; \
	else :; fi
	@$(NORMAL_UNINSTALL)
	@list='$(INFO_DEPS)'; \
	for file in $$list; do \
	  relfile=`echo "$$file" | sed 's|^.*/||'`; \
	  relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
	  (if cd "$(DESTDIR)$(infodir)"; then \
	     echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
	     rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
	   else :; fi); \
	done

dist-info: $(INFO_DEPS)
	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
	list='$(INFO_DEPS)'; \
	for base in $$list; do \
	  case $$base in \
	    $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
	  esac; \
	  if test -f $$base; then d=.; else d=$(srcdir); fi; \
	  for file in $$d/$$base*; do \
	    relfile=`expr "$$file" : "$$d/\(.*\)"`; \
	    test -f $(distdir)/$$relfile || \
	      cp -p $$file $(distdir)/$$relfile; \
	  done; \
	done

mostlyclean-aminfo:
	-rm -rf nano.aux nano.cp nano.cps nano.fn nano.fns nano.ky nano.kys nano.log \
	  nano.pg nano.pgs nano.tmp nano.toc nano.tp nano.tps nano.vr \
	  nano.vrs nano.dvi nano.pdf nano.ps nano.html

maintainer-clean-aminfo:
	@list='$(INFO_DEPS)'; for i in $$list; do \
	  i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
	  echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
	  rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
	done
install-man1: $(man1_MANS) $(man_MANS)
	@$(NORMAL_INSTALL)
	test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
	for i in $$l2; do \
	  case "$$i" in \
	    *.1*) list="$$list $$i" ;; \
	  esac; \
	done; \
	for i in $$list; do \
	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
	  else file=$$i; fi; \
	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
	  case "$$ext" in \
	    1*) ;; \
	    *) ext='1' ;; \
	  esac; \
	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
	done
uninstall-man1:
	@$(NORMAL_UNINSTALL)
	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
	for i in $$l2; do \
	  case "$$i" in \
	    *.1*) list="$$list $$i" ;; \
	  esac; \
	done; \
	for i in $$list; do \
	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
	  case "$$ext" in \
	    1*) ;; \
	    *) ext='1' ;; \
	  esac; \
	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
	  echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
	  rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
	done
install-man5: $(man5_MANS) $(man_MANS)
	@$(NORMAL_INSTALL)
	test -z "$(man5dir)" || $(mkdir_p) "$(DESTDIR)$(man5dir)"
	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
	for i in $$l2; do \
	  case "$$i" in \
	    *.5*) list="$$list $$i" ;; \
	  esac; \
	done; \
	for i in $$list; do \
	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
	  else file=$$i; fi; \
	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
	  case "$$ext" in \
	    5*) ;; \
	    *) ext='5' ;; \
	  esac; \
	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \
	done
uninstall-man5:
	@$(NORMAL_UNINSTALL)
	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
	for i in $$l2; do \
	  case "$$i" in \
	    *.5*) list="$$list $$i" ;; \
	  esac; \
	done; \
	for i in $$list; do \
	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
	  case "$$ext" in \
	    5*) ;; \
	    *) ext='5' ;; \
	  esac; \
	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
	  echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \
	  rm -f "$(DESTDIR)$(man5dir)/$$inst"; \
	done

# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
#     (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
	@failcom='exit 1'; \
	for f in x $$MAKEFLAGS; do \
	  case $$f in \
	    *=* | --[!k]*);; \
	    *k*) failcom='fail=yes';; \
	  esac; \
	done; \
	dot_seen=no; \
	target=`echo $@ | sed s/-recursive//`; \
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  echo "Making $$target in $$subdir"; \
	  if test "$$subdir" = "."; then \
	    dot_seen=yes; \
	    local_target="$$target-am"; \
	  else \
	    local_target="$$target"; \
	  fi; \
	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
	  || eval $$failcom; \
	done; \
	if test "$$dot_seen" = "no"; then \
	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
	fi; test -z "$$fail"

mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
	@failcom='exit 1'; \
	for f in x $$MAKEFLAGS; do \
	  case $$f in \
	    *=* | --[!k]*);; \
	    *k*) failcom='fail=yes';; \
	  esac; \
	done; \
	dot_seen=no; \
	case "$@" in \
	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
	  *) list='$(SUBDIRS)' ;; \
	esac; \
	rev=''; for subdir in $$list; do \
	  if test "$$subdir" = "."; then :; else \
	    rev="$$subdir $$rev"; \
	  fi; \
	done; \
	rev="$$rev ."; \
	target=`echo $@ | sed s/-recursive//`; \
	for subdir in $$rev; do \
	  echo "Making $$target in $$subdir"; \
	  if test "$$subdir" = "."; then \
	    local_target="$$target-am"; \
	  else \
	    local_target="$$target"; \
	  fi; \
	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
	  || eval $$failcom; \
	done && test -z "$$fail"
tags-recursive:
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
	done
ctags-recursive:
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
	done

ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	mkid -fID $$unique
tags: TAGS

TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	tags=; \
	here=`pwd`; \
	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
	  include_option=--etags-include; \
	  empty_fix=.; \
	else \
	  include_option=--include; \
	  empty_fix=; \
	fi; \
	list='$(SUBDIRS)'; for subdir in $$list; do \
	  if test "$$subdir" = .; then :; else \
	    test ! -f $$subdir/TAGS || \
	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
	  fi; \
	done; \
	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
	  test -n "$$unique" || unique=$$empty_fix; \
	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	    $$tags $$unique; \
	fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	tags=; \
	here=`pwd`; \
	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	test -z "$(CTAGS_ARGS)$$tags$$unique" \
	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
	     $$tags $$unique

GTAGS:
	here=`$(am__cd) $(top_builddir) && pwd` \
	  && cd $(top_srcdir) \
	  && gtags -i $(GTAGS_ARGS) $$here

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags

distdir: $(DISTFILES)
	$(am__remove_distdir)
	mkdir $(distdir)
	$(mkdir_p) $(distdir)/. $(distdir)/m4 $(distdir)/po
	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
	list='$(DISTFILES)'; for file in $$list; do \
	  case $$file in \
	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
	  esac; \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
	    dir="/$$dir"; \
	    $(mkdir_p) "$(distdir)$$dir"; \
	  else \
	    dir=''; \
	  fi; \
	  if test -d $$d/$$file; then \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
	    fi; \
	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
	  else \
	    test -f $(distdir)/$$file \
	    || cp -p $$d/$$file $(distdir)/$$file \
	    || exit 1; \
	  fi; \
	done
	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
	  if test "$$subdir" = .; then :; else \
	    test -d "$(distdir)/$$subdir" \
	    || $(mkdir_p) "$(distdir)/$$subdir" \
	    || exit 1; \
	    distdir=`$(am__cd) $(distdir) && pwd`; \
	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
	    (cd $$subdir && \
	      $(MAKE) $(AM_MAKEFLAGS) \
	        top_distdir="$$top_distdir" \
	        distdir="$$distdir/$$subdir" \
	        distdir) \
	      || exit 1; \
	  fi; \
	done
	$(MAKE) $(AM_MAKEFLAGS) \
	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
	  dist-info
	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
	|| chmod -R a+r $(distdir)
dist-gzip: distdir
	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
	$(am__remove_distdir)

dist-bzip2: distdir
	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
	$(am__remove_distdir)

dist-tarZ: distdir
	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
	$(am__remove_distdir)

dist-shar: distdir
	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
	$(am__remove_distdir)

dist-zip: distdir
	-rm -f $(distdir).zip
	zip -rq $(distdir).zip $(distdir)
	$(am__remove_distdir)

dist dist-all: distdir
	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
	$(am__remove_distdir)

# This target untars the dist file and tries a VPATH configuration.  Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
	case '$(DIST_ARCHIVES)' in \
	*.tar.gz*) \
	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
	*.tar.bz2*) \
	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
	*.tar.Z*) \
	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
	*.shar.gz*) \
	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
	*.zip*) \
	  unzip $(distdir).zip ;;\
	esac
	chmod -R a-w $(distdir); chmod a+w $(distdir)
	mkdir $(distdir)/_build
	mkdir $(distdir)/_inst
	chmod a-w $(distdir)
	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
	  && cd $(distdir)/_build \
	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
	    $(DISTCHECK_CONFIGURE_FLAGS) \
	  && $(MAKE) $(AM_MAKEFLAGS) \
	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
	  && $(MAKE) $(AM_MAKEFLAGS) check \
	  && $(MAKE) $(AM_MAKEFLAGS) install \
	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
	        distuninstallcheck \
	  && chmod -R a-w "$$dc_install_base" \
	  && ({ \
	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
	  && rm -rf "$$dc_destdir" \
	  && $(MAKE) $(AM_MAKEFLAGS) dist \
	  && rm -rf $(DIST_ARCHIVES) \
	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
	$(am__remove_distdir)
	@(echo "$(distdir) archives ready for distribution: "; \
	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
	  sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
	@cd $(distuninstallcheck_dir) \
	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
	   || { echo "ERROR: files left after uninstall:" ; \
	        if test -n "$(DESTDIR)"; then \
	          echo "  (check DESTDIR support)"; \
	        fi ; \
	        $(distuninstallcheck_listfiles) ; \
	        exit 1; } >&2
distcleancheck: distclean
	@if test '$(srcdir)' = . ; then \
	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
	  exit 1 ; \
	fi
	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
	  || { echo "ERROR: files left in build directory after distclean:" ; \
	       $(distcleancheck_listfiles) ; \
	       exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile $(INFO_DEPS) $(PROGRAMS) $(MANS) config.h
installdirs: installdirs-recursive
installdirs-am:
	for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)"; do \
	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
	done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-recursive
install-strip:
	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
	  `test -z '$(STRIP)' || \
	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:

clean-generic:

distclean-generic:
	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)

maintainer-clean-generic:
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive

clean-am: clean-binPROGRAMS clean-generic mostlyclean-am

distclean: distclean-recursive
	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
	-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
	distclean-hdr distclean-tags

dvi: dvi-recursive

dvi-am: $(DVIS)

html: html-recursive

html-am: $(HTMLS)

info: info-recursive

info-am: $(INFO_DEPS)

install-data-am: install-info-am install-man

install-exec-am: install-binPROGRAMS

install-info: install-info-recursive

install-info-am: $(INFO_DEPS)
	@$(NORMAL_INSTALL)
	test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)"
	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
	list='$(INFO_DEPS)'; \
	for file in $$list; do \
	  case $$file in \
	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
	  esac; \
	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
	  file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
	  for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
                       $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
	    if test -f $$ifile; then \
	      relfile=`echo "$$ifile" | sed 's|^.*/||'`; \
	      echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \
	      $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \
	    else : ; fi; \
	  done; \
	done
	@$(POST_INSTALL)
	@if (install-info --version && \
	     install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
	  list='$(INFO_DEPS)'; \
	  for file in $$list; do \
	    relfile=`echo "$$file" | sed 's|^.*/||'`; \
	    echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
	    install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
	  done; \
	else : ; fi
install-man: install-man1 install-man5

installcheck-am:

maintainer-clean: maintainer-clean-recursive
	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
	-rm -rf $(top_srcdir)/autom4te.cache
	-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-aminfo \
	maintainer-clean-generic

mostlyclean: mostlyclean-recursive

mostlyclean-am: mostlyclean-aminfo mostlyclean-compile \
	mostlyclean-generic

pdf: pdf-recursive

pdf-am: $(PDFS)

ps: ps-recursive

ps-am: $(PSS)

uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man

uninstall-info: uninstall-info-recursive

uninstall-man: uninstall-man1 uninstall-man5

.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
	check-am clean clean-binPROGRAMS clean-generic clean-recursive \
	ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
	dist-info dist-shar dist-tarZ dist-zip distcheck distclean \
	distclean-compile distclean-generic distclean-hdr \
	distclean-recursive distclean-tags distcleancheck distdir \
	distuninstallcheck dvi dvi-am html html-am info info-am \
	install install-am install-binPROGRAMS install-data \
	install-data-am install-exec install-exec-am install-info \
	install-info-am install-man install-man1 install-man5 \
	install-strip installcheck installcheck-am installdirs \
	installdirs-am maintainer-clean maintainer-clean-aminfo \
	maintainer-clean-generic maintainer-clean-recursive \
	mostlyclean mostlyclean-aminfo mostlyclean-compile \
	mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
	tags tags-recursive uninstall uninstall-am \
	uninstall-binPROGRAMS uninstall-info-am uninstall-man \
	uninstall-man1 uninstall-man5

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

--- NEW FILE: nanorc.sample ---
## Sample initialization file for GNU nano
## Please note that you must have configured nano with --enable-nanorc
## for this file to be read!  Also note that characters specially
## interpreted by the shell should not be escaped here.
##
## To make sure a value is not enabled, use "unset <option>"
##
## For the options that take parameters, the default value is given.
## Other options are unset by default.

## Use auto-indentation
# set autoindent

## Backup files to filename~
# set backup

## Constantly display the cursor position in the status bar.
# set const

## Use cut to end of line with ^K by default
# set cut

## Set the line length for wrapping text and justifying paragraphs.
## If fill is negative, the line length will be the screen width less
## this number.
##
# set fill -8

## Enable ~/.nano_history for saving and reading search/replace strings.
# set historylog

## Use alternate keypad routines
# set keypad

## Allow multiple file buffers (using ^R inserts into separate buffer).
## You must have configured with --enable-multibuffer or --enable-extra
## for this to work.
##
## set multibuffer

## Don't convert files from DOS/Mac format
# set noconvert

## Don't follow symlinks when writing files
# set nofollow

## Don't display the help lists at the bottom of the screen
# set nohelp

## Don't wrap text at all
# set nowrap

## Set operating directory.  nano will not read or write files outside
## this directory and its subdirectories.  Also, the current directory
## is changed to here, so files are inserted from this dir.  A blank
## string means the operating directory feature is turned off.
##
# set operatingdir ""

## Preserve the XON and XOFF keys (^Q and ^S)
# set preserve

## The email-quote string, used to justify email-quoted paragraphs.
## This is an extended regular expression if your system supports them,
## otherwise a literal string.  Default:
# set quotestr "^([ 	]*[\|>:}#])+"
## if you have regexps, otherwise:
# set quotestr "> "
## You can get old nano quoted-justify behavior via:
# set quotestr "(> )+"

## Do extended regular expression searches by default 
# set regexp

## Use smooth scrolling as the default
# set smooth

## Use this spelling checker instead of the internal one.  This option
## does not properly have a default value.
##
# set speller "aspell -c"

## Allow nano to be suspended with ^Z
# set suspend

## Use this tab size instead of the default; it must be greater than 0
# set tabsize 8

## Save automatically on exit, don't prompt
# set tempfile

## Disallow file modification, why would you want this in an rc file? ;)
# set view

## Color setup
## Format:
## syntax "short description" ["filename regex" ...]
## color foreground,background "regex" ["regex"...]
##
## Legal colors: white, black, red, blue, green, yellow, magenta, cyan.
## You may use the prefix "bright" to mean a stronger color highlight.
##
## To use multi-line regexes use the start="regex" end="regex" format.
##
## If your system supports transparency, not specifying a background
## color will use a transparent color.  If you don't want this, be sure
## to set the background color to black or white.
##
# syntax "c-file" "\.(c|h)$"
# color red "\<[A-Z_]{2,}\>" 
# color green "\<(float|char|int|void|static|const|struct)\>" 
# color brightyellow "\<(if|while|do|else|case|switch)\>"
# color brightcyan "^#( 	)*(define|include|ifn?def|endif|elif|else|if)" 
##
## You will in general want your comments and strings to come last,
## because syntax highlighting rules will be applied in the order they
## are read in.
##
# color brightyellow "<[^= 	]*>" ""(\\.|[^\"])*""
##
## This string is VERY resource intensive!!!
# color brightyellow start=""(\\.|[^\"])*\\( |	)*$" end="^(\\.|[^\"])*""
##
## And we want to have some nice comment highlighting too
# color brightblue "//.*"
# color brightblue start="/\*" end="\*/"

## Here is a short example for HTML
# syntax "HTML" "\.html$"
# color blue start="<" end=">"
# color red "&[^; 	]*;"

## Here is a short example for TeX files
# syntax "TeX" "\.tex$"
# color green "\\.|\\[A-Za-z]*"
# color magenta "[{}]"
# color blue "%.*"

## Here is an example for quoted emails (under e.g. mutt)
# syntax "mutt"
# color green "^>.*"

## Here is an example for groff
##
# syntax "groff" "\.ms$" "\.mm$" "\.me$" "\.tmac$" "^tmac." ".rof"
## The argument of .nr or .ds
# color cyan "^\.ds [^ ]*"
# color cyan "^\.nr [^ ]*"
## Single character escapes
# color brightmagenta "\\."
## Highlight the argument of \f or \s in the same color
# color brightmagenta "\\f."
# color brightmagenta "\\f\(.."
# color brightmagenta "\\s(\+|\-)?[0-9]"
## \n
# color cyan "(\\|\\\\)n."
# color cyan "(\\|\\\\)n\(.."
# color cyan start="(\\|\\\\)n\[" end="]"
## Requests
# color brightgreen "^\. *[^ ]*"
## Comments
# color yellow "^\.\\\".*$"
## Strings
# color green "(\\|\\\\)\*."
# color green "(\\|\\\\)\*\(.."
# color green start="(\\|\\\\)\*\[" end="]"
## Characters
# color brightred "\\\(.."
# color brightred start="\\\[" end="]"
## Macro arguments
# color brightcyan "\\\\\$[1-9]"

## Here is an example for perl
##
# syntax "perl" "\.p[lm]$"
# color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork)|get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join|keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek|seekdir|se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr|y|truncate|umask|un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
# color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
# color cyan start="[$@%]" end="( |\\W|-)"
# color yellow "".*"|qq\|.*\|"
# color white "[sm]/.*/"
# color white start="(^use| = new)" end=";"
# color green "#.*"
# color yellow start="<< 'STOP'" end="STOP"

## Here is an example for Java source
##
# syntax "Java source" "\.java$"
# color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
# color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
# color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
# color red ""[^\"]*""
# color yellow "\<(true|false|null)\>"
# color blue "//.*"
# color blue start="/\*" end="\*/"
# color brightblue start="/\*\*" end="\*/"
# color brightgreen,brightgreen "[ 	]+$"

## Here is an example for your .nanorc
##
# syntax "nanorc" "[\.]*nanorc$"
# color white "^ *(set|unset).*$"
# color cyan "^ *(set|unset) (autoindent|backup|const|cut|fill|keypad|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|quotestr|regexp|smooth|speller|suspend|tabsize|tempfile|historylog|view)"
# color brightwhite "^ *syntax [^ ]*"
# color brightblue "^ *set\>" "^ *unset\>" "^ *syntax\>"
# color white "^ *color\>.*"
# color yellow "^ *color (bright)?(white|black|red|blue|green|yellow|magenta|cyan)\>"
# color magenta "^ *color\>"
# color green "^#.*$"

--- NEW FILE: utils.c ---
/* $Id: utils.c,v 1.1 2006-08-16 23:41:03 stsp Exp $ */
/**************************************************************************
 *   utils.c                                                              *
 *                                                                        *
 *   Copyright (C) 1999-2003 Chris Allegretta                             *
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
 *   the Free Software Foundation; either version 2, or (at your option)  *
 *   any later version.                                                   *
 *                                                                        *
 *   This program is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *   GNU General Public License for more details.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
 **************************************************************************/

#include "config.h"

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "proto.h"
#include "nano.h"

#ifdef BROKEN_REGEXEC
#undef regexec
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
	regmatch_t pmatch[], int eflags)
{
    if (string != NULL && *string != '\0')
	return regexec(preg, string, nmatch, pmatch, eflags);
    return REG_NOMATCH;
}
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
#endif

int is_cntrl_char(int c)
{
    return (-128 <= c && c < -96) || (0 <= c && c < 32) ||
		(127 <= c && c < 160);
}

int num_of_digits(int n)
{
    int i = 1;

    if (n < 0)
	n = -n;

    while (n > 10) {
	n /= 10;
	i++;
    }

    return i;
}

/* Fix the memory allocation for a string. */
void align(char **strp)
{
    assert(strp != NULL);
    if (*strp != NULL)
	*strp = charealloc(*strp, strlen(*strp) + 1);
}

/* Null a string at a certain index and align it. */
void null_at(char **data, size_t index)
{
    assert(data != NULL);
    *data = charealloc(*data, index + 1);
    (*data)[index] = '\0';
}

/* For non-null-terminated lines.  A line, by definition, shouldn't
 * normally have newlines in it, so encode its nulls as newlines. */
void unsunder(char *str, size_t true_len)
{
    assert(str != NULL);
    for(; true_len > 0; true_len--, str++)
	if (*str == '\0')
	    *str = '\n';
}

/* For non-null-terminated lines.  A line, by definition, shouldn't
 * normally have newlines in it, so decode its newlines into nulls. */
void sunder(char *str)
{
    assert(str != NULL);
    for(; *str != '\0'; str++)
	if (*str == '\n')
	    *str = '\0';
}

#ifndef HAVE_STRCASECMP
/* This function is equivalent to strcasecmp(). */
int nstricmp(const char *s1, const char *s2)
{
    assert(s1 != NULL && s2 != NULL);
    for (; *s1 != '\0' && *s2 != '\0'; s1++, s2++) {
	if (tolower(*s1) != tolower(*s2))
	    break;
    }
    return (tolower(*s1) - tolower(*s2));
}
#endif

#ifndef HAVE_STRNCASECMP
/* This function is equivalent to strncasecmp(). */
int nstrnicmp(const char *s1, const char *s2, size_t n)
{
    assert(s1 != NULL && s2 != NULL);
    for (; n > 0 && *s1 != '\0' && *s2 != '\0'; n--, s1++, s2++) {
	if (tolower(*s1) != tolower(*s2))
	    break;
    }
    if (n > 0)
	return (tolower(*s1) - tolower(*s2));
    else if (n == 0)
	return 0;
    else if (n < 0)
	return -1;
}
#endif

/* None of this is needed if we're using NANO_SMALL! */
#ifndef NANO_SMALL
const char *revstrstr(const char *haystack, const char *needle,
			const char *rev_start)
{
    for(; rev_start >= haystack ; rev_start--) {
	const char *r, *q;

	for (r = rev_start, q = needle ; *q == *r && *q != '\0'; r++, q++)
	    ;
	if (*q == '\0')
	    return rev_start;
    }
    return NULL;
}

const char *revstristr(const char *haystack, const char *needle,
			const char *rev_start)
{
    for (; rev_start >= haystack; rev_start--) {
	const char *r = rev_start, *q = needle;

	for (; (tolower(*q) == tolower(*r)) && (*q != '\0') ; r++, q++)
	    ;
	if (*q == '\0')
	    return rev_start;
    }
    return NULL;
}
#endif /* !NANO_SMALL */

/* This is now mutt's version (called mutt_stristr) because it doesn't
 * use memory allocation to do a simple search (yuck). */
const char *stristr(const char *haystack, const char *needle)
{
    const char *p, *q;

    if (haystack == NULL)
	return NULL;
    if (needle == NULL)
	return haystack;
    
    while (*(p = haystack) != '\0') {
	for (q = needle; *p != 0 && *q != 0 && tolower(*p) == tolower(*q); p++, q++)
	    ;
	if (*q == 0)
	    return haystack;
	haystack++;
    }
    return NULL;
}

/* If we are searching backwards, we will find the last match
 * that starts no later than rev_start.  If we are doing a regexp search,
 * then line_pos should be 0 if haystack starts at the beginning of a
 * line, and positive otherwise.  In the regexp case, we fill in the
 * global variable regmatches with at most 9 subexpression matches.  Also,
 * all .rm_so elements are relative to the start of the whole match, so
 * regmatches[0].rm_so == 0. */
const char *strstrwrapper(const char *haystack, const char *needle,
			const char *rev_start, int line_pos)
{
#ifdef HAVE_REGEX_H
    if (ISSET(USE_REGEXP)) {
#ifndef NANO_SMALL
	if (ISSET(REVERSE_SEARCH)) {
		/* When doing a backwards search, haystack is a whole line. */
	    if (regexec(&search_regexp, haystack, 1, regmatches, 0) == 0 &&
		    haystack + regmatches[0].rm_so <= rev_start) {
		const char *retval = haystack + regmatches[0].rm_so;

		/* Search forward until there is no more match. */
		while (regexec(&search_regexp, retval + 1, 1, regmatches,
			    REG_NOTBOL) == 0 &&
			retval + 1 + regmatches[0].rm_so <= rev_start)
		    retval += 1 + regmatches[0].rm_so;
		/* Finally, put the subexpression matches in global
		 * variable regmatches.  The REG_NOTBOL flag doesn't
		 * matter now. */
		regexec(&search_regexp, retval, 10, regmatches, 0);
		return retval;
	    }
	} else
#endif /* !NANO_SMALL */
	if (regexec(&search_regexp, haystack, 10, regmatches,
			line_pos > 0 ? REG_NOTBOL : 0) == 0) {
	    const char *retval = haystack + regmatches[0].rm_so;

	    regexec(&search_regexp, retval, 10, regmatches, 0);
	    return retval;
	}
	return NULL;
    }
#endif /* HAVE_REGEX_H */
#ifndef NANO_SMALL
    if (ISSET(CASE_SENSITIVE)) {
	if (ISSET(REVERSE_SEARCH))
	    return revstrstr(haystack, needle, rev_start);
	else
	    return strstr(haystack, needle);
    } else if (ISSET(REVERSE_SEARCH))
	return revstristr(haystack, needle, rev_start);
#endif
    return stristr(haystack, needle);
}

/* This is a wrapper for the perror function.  The wrapper takes care of 
 * ncurses, calls perror (which writes to STDERR), then refreshes the 
 * screen.  Note that nperror causes the window to flicker once. */
void nperror(const char *s)
{
    /* leave ncurses mode, go to the terminal */
    if (endwin() != ERR) {
	perror(s);		/* print the error */
	total_refresh();	/* return to ncurses and repaint */
    }
}

/* Thanks BG, many ppl have been asking for this... */
void *nmalloc(size_t howmuch)
{
    void *r = malloc(howmuch);

    if (r == NULL && howmuch != 0)
	die(_("nano is out of memory!"));

    return r;
}

void *nrealloc(void *ptr, size_t howmuch)
{
    void *r = realloc(ptr, howmuch);

    if (r == NULL && howmuch != 0)
	die(_("nano is out of memory!"));

    return r;
}

/* Copy one malloc()ed string to another pointer.  Should be used as:
 * dest = mallocstrcpy(dest, src); */
char *mallocstrcpy(char *dest, const char *src)
{
    if (src == dest)
	return dest;

    if (dest != NULL)
	free(dest);

    if (src == NULL)
	return NULL;

    dest = charalloc(strlen(src) + 1);
    strcpy(dest, src);

    return dest;
}

/* Append a new magic-line to filebot. */
void new_magicline(void)
{
    filebot->next = (filestruct *)nmalloc(sizeof(filestruct));
    filebot->next->data = charalloc(1);
    filebot->next->data[0] = '\0';
    filebot->next->prev = filebot;
    filebot->next->next = NULL;
    filebot->next->lineno = filebot->lineno + 1;
    filebot = filebot->next;
    totlines++;
    totsize++;
}

#ifndef DISABLE_TABCOMP
/*
 * Routine to see if a text string is matched by a wildcard pattern.
 * Returns TRUE if the text is matched, or FALSE if it is not matched
 * or if the pattern is invalid.
 *  *		matches zero or more characters
 *  ?		matches a single character
 *  [abc]	matches 'a', 'b' or 'c'
 *  \c		quotes character c
 * Adapted from code written by Ingo Wilken, and
 * then taken from sash, Copyright (c) 1999 by David I. Bell
 * Permission is granted to use, distribute, or modify this source,
 * provided that this copyright notice remains intact.
 * Permission to distribute this code under the GPL has been granted.
 */
int check_wildcard_match(const char *text, const char *pattern)
{
    const char *retrypat;
    const char *retrytext;
    int ch;
    int found;
    int len;

    retrypat = NULL;
    retrytext = NULL;

    while (*text != '\0' || *pattern != '\0') {
	ch = *pattern++;

	switch (ch) {
	case '*':
	    retrypat = pattern;
	    retrytext = text;
	    break;

	case '[':
	    found = FALSE;

	    while ((ch = *pattern++) != ']') {
		if (ch == '\\')
		    ch = *pattern++;

		if (ch == '\0')
		    return FALSE;

		if (*text == ch)
		    found = TRUE;
	    }
	    len = strlen(text);
	    if (found == FALSE && len != 0) {
		return FALSE;
	    }
	    if (found == TRUE) {
		if (strlen(pattern) == 0 && len == 1) {
		    return TRUE;
		}
		if (len != 0) {
		    text++;
		    continue;
		}
	    }

	    /* fall into next case */

	case '?':
	    if (*text++ == '\0')
		return FALSE;

	    break;

	case '\\':
	    ch = *pattern++;

	    if (ch == '\0')
		return FALSE;

	    /* fall into next case */

	default:
	    if (*text == ch) {
		if (*text != '\0')
		    text++;
		break;
	    }

	    if (*text != '\0') {
		pattern = retrypat;
		text = ++retrytext;
		break;
	    }

	    return FALSE;
	}

	if (pattern == NULL)
	    return FALSE;
    }

    return TRUE;
}
#endif

--- NEW FILE: acinclude.m4 ---
/usr/local/share/aclocal

--- NEW FILE: configure.ac ---
# Configuration for GNU nano - a small and user-friendly text editor
#
# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
#
# GNU Nano is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# GNU Nano is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Nano; if not, write to the Free Software
# Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# $Id: configure.ac,v 1.1 2006-08-16 23:41:02 stsp Exp $

AC_INIT([GNU Nano], [1.2.5], [nano-devel at gnu.org], [nano])
AC_CONFIG_SRCDIR([nano.c])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER([config.h:config.h.in])

AC_PREREQ(2.52)

dnl Checks for programs.
AC_PROG_CC
AC_ISC_POSIX
AC_SYS_LARGEFILE

dnl Internationalization macros.
AM_GNU_GETTEXT_VERSION(0.11.5)
AM_GNU_GETTEXT([external], [need-ngettext])

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h getopt.h libintl.h limits.h regex.h termio.h termios.h unistd.h)
AC_CHECK_HEADER(regex.h,
    AC_MSG_CHECKING([for broken regexec])
    AC_TRY_RUN([
#include <sys/types.h>
#include <regex.h>
int main () { regex_t reg; size_t n = 1; regmatch_t r; regcomp(&reg, "\\<", 0); regexec(&reg, "", n, &r, 0); regfree(&reg); return 0; }],
	AC_MSG_RESULT(no),
	AC_MSG_RESULT(yes); AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions.])
    )
)

dnl options
AC_ARG_ENABLE(debug, 
[  --enable-debug          Enable debugging (disabled by default)],
 [if test x$enableval = xyes; then
    AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.])
    debug_support=yes
 fi])

if test "$debug_support" != "yes"; then
    AC_DEFINE(NDEBUG, 1, [Shut up the assert warnings :-)])
fi

AC_ARG_ENABLE(extra,
[  --enable-extra          Enable extra (optional) functions, including easter eggs],
[if test x$enableval = xyes; then
    AC_DEFINE(NANO_EXTRA, 1, [Define this to enable the extra stuff.]) extra_support=yes
    AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
 fi])

AC_ARG_ENABLE(tiny,
[  --enable-tiny           Disable features for the sake of size],
[if test x$enableval = xyes; then
    AC_DEFINE(NANO_SMALL, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
    AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in (crappy) file browser.]) 
    AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the ^G help menu.]) 
    AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.]) 
    AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.]) 
    AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).]) 
    AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.]) 
    AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!]) 
 fi])

AC_ARG_ENABLE(browser,
[  --disable-browser       Disable mini file browser],
 [if test x$enableval != xyes; then
    AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in (crappy) file browser.])
 fi])

AC_ARG_ENABLE(help,
[  --disable-help          Disable help function (^G)],
 [if test x$enableval != xyes; then
    AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the ^G help menu.])
 fi])

AC_ARG_ENABLE(justify,
[  --disable-justify       Disable justify/unjustify function],
 [if test x$enableval != xyes; then
    AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.]) 
 fi])

AC_ARG_ENABLE(mouse,
[  --disable-mouse         Disable mouse support (and -m flag)],
 [if test x$enableval != xyes; then
    AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
 fi])

AC_ARG_ENABLE(operatingdir,
[  --disable-operatingdir  Disable setting of operating directory (chroot of sorts)],
 [if test x$enableval != xyes; then
    AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
 fi])

AC_ARG_ENABLE(speller,
[  --disable-speller       Disable spell checker function],
 [if test x$enableval != xyes; then
    AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
 fi])

AC_ARG_ENABLE(tabcomp,
[  --disable-tabcomp       Disable tab completion code for a smaller binary],
 [if test x$enableval != xyes; then
    AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!]) 
 fi])

AC_ARG_ENABLE(wrapping,
[  --disable-wrapping      Disable all wrapping of text (and -w flag)],
 [if test x$enableval != xyes; then
    AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable any and all text wrapping.])
 fi])

AC_ARG_ENABLE(wrapping-as-root,
[  --disable-wrapping-as-root  Disable wrapping of text as root by default],
 [if test x$enableval != xyes; then
    AC_DEFINE(DISABLE_ROOTWRAP, 1, [Define this to disable wrapping as root by default.])
 fi])

AC_ARG_ENABLE(color,
[  --enable-color          Enable color and syntax highlighting],
[if test x$enableval = xyes; then
    AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
    AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires ENABLE_NANORC too!]) color_support=yes
    AC_MSG_WARN([

***********************************************************************
*** WARNING: Color support is far from perfect, but functional.     ***
*** Be careful with syntax in your .nanorc or nano may malfunction. ***
***********************************************************************
])
fi])

AC_ARG_ENABLE(multibuffer,
[  --enable-multibuffer    Enable multiple file buffers],
[if test x$enableval = xyes; then
    AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
 fi])

AC_ARG_ENABLE(nanorc,
[  --enable-nanorc         Enable use of .nanorc file],
[if test x$enableval = xyes; then
    AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
 fi])

AC_ARG_ENABLE(all,
[  --enable-all            Enable ALL extra nano functionality (kitchen sink option)],
[if test x$enableval = xyes; then
    AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
    AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires ENABLE_NANORC too!]) color_support=yes
    AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
    AC_DEFINE(NANO_EXTRA, 1, [Define this to enable the extra stuff.]) extra_support=yes
    AC_MSG_WARN([

***********************************************************************
*** WARNING: Color support is far from perfect, but functional.     ***
*** Be careful with syntax in your .nanorc or nano may malfunction. ***
***********************************************************************
])
fi])

AC_MSG_CHECKING([whether to use slang])
CURSES_LIB_NAME=""
AC_ARG_WITH(slang,
[  --with-slang[=DIR]      Use the slang library instead of curses],
[    case "$with_slang" in
    no)
	AC_MSG_RESULT(no)
	;;
    *)
	AC_MSG_RESULT(yes)

	if test "$with_slang" != "yes"; then
	    # Add additional search path
	    LDFLAGS="-L$with_slang/lib $LDFLAGS"
	    CPPFLAGS="-I$with_slang/include $CPPFLAGS"
	fi

	AC_CHECK_HEADER(slcurses.h,
	    AC_MSG_CHECKING([for SLtt_initialize in -lslang])
	    _libs=$LIBS
	    LIBS="$LIBS -lslang"
	    AC_TRY_RUN([
#include <stdio.h>
#include <slcurses.h>
int main () { SLtt_initialize (NULL); return 0; }],
		[AC_MSG_RESULT(yes)
		AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
		slang_support=yes
		if test "$with_slang" != "yes"; then
		    CURSES_LIB="-L${with_slang}/lib -lslang"
		else
		    CURSES_LIB="-lslang"
		fi
		CURSES_LIB_NAME=slang], [
		AC_MSG_RESULT(no)
		# We might need the term library
		for termlib in ncurses curses termcap terminfo termlib; do
		    AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
		    test -n "$tcap" && break
		done

		AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
		LIBS="$LIBS $tcap"
		AC_TRY_RUN([
#include <stdio.h>
#include <slcurses.h>
int main () { SLtt_initialize (NULL); return 0; }],
		    [AC_MSG_RESULT(yes)
		    AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
		    slang_support=yes
		    if test "$with_slang" != "yes"; then
			CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
		    else
			CURSES_LIB="-lslang $tcap"
		    fi
		    CURSES_LIB_NAME=slang], [
		    AC_MSG_RESULT(no)
		    # We might need the math library
		    AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
		    LIBS="$LIBS -lm"
		    AC_TRY_RUN([
#include <stdio.h>
#include <slcurses.h>
int main () { SLtt_initialize (NULL); return 0; }],
			[AC_MSG_RESULT(yes)
			AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
			slang_support=yes
			if test "$with_slang" != "yes"; then
			    CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
			else
			    CURSES_LIB="-lslang $tcap -lm"
			fi
			CURSES_LIB_NAME=slang],
			[AC_MSG_RESULT(no)],
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
AC_MSG_WARN([*** Can not use slang when cross-compiling]))], 
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
	    AC_MSG_ERROR([
*** The header file slcurses.h was not found. If you wish to use
*** slang support this header file is required. Please either
*** install a version of slang that includes the slcurses.h file or
*** do not call the configure script with --with-slang
]))

	test "${_libs+set}" = "set" && LIBS=$_libs

	if test "$with_slang" != "yes"; then
	    LDFLAGS=${_ldflags}
	fi
	;;
    esac], [AC_MSG_RESULT(no)])

dnl Checks for functions
AC_CHECK_FUNCS(snprintf vsnprintf strcasecmp strncasecmp)
if test "x$ac_cv_func_snprintf" = "xno" -o "xac_cv_func_vsnprintf" = "xno"
then
	AM_PATH_GLIB(1.2.4,,
	    [AC_MSG_ERROR([
*** snprintf() and/or vsnprintf() not found.  GLIB not found either.
*** You need both snprintf() and vsnprintf().  Alternatively you can
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.])],
	    glib)
	glib_cflags=`$GLIB_CONFIG --cflags glib`
	glib_libs=`$GLIB_CONFIG --libs glib`
fi

dnl Checks for typedefs, structures, and compiler characteristics.

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(getopt_long)

dnl Checks for libraries.


if eval "test x$CURSES_LIB_NAME = x"
then
    AC_CHECK_HEADERS(curses.h ncurses.h)
    AC_CHECK_LIB(ncurses, tgetent, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
fi

if eval "test x$CURSES_LIB_NAME = x"
then
    AC_CHECK_LIB(curses, tgetent, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
fi

# Fallback for PDCurses and less useful curses libs...
if eval "test x$CURSES_LIB_NAME = x"
then
    AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
fi

if eval "test x$CURSES_LIB_NAME = x"
then
    AC_CHECK_LIB(termcap, tgetent, [CURSES_LIB="-ltermcap" CURSES_LIB_NAME=termcap])
fi

if eval "test x$CURSES_LIB_NAME = x"
then
    AC_MSG_WARN([
*** No termcap lib available, consider getting the official ncurses
*** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get
*** errors compiling nano.])
else
    AC_MSG_RESULT([Using $CURSES_LIB_NAME as the termcap library])
fi


AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors command.]))
if test x$slang_support != xyes; then
    # Taken from aumix (can't tell from the variable name?)
    AC_CACHE_CHECK([for private member _use_keypad in WINDOW],
    aumix_cv_struct_window_usekeypad,
    [AC_TRY_COMPILE([#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#endif], [WINDOW w; w._use_keypad;],
    aumix_cv_struct_window_usekeypad=yes, aumix_cv_struct_window_usekeypad=no)])
    
    if test $aumix_cv_struct_window_usekeypad = yes; then
	AC_DEFINE(HAVE_USEKEYPAD, 1, [Define this if your curses lib has the _use_keypad flag.])
    fi
fi

dnl Parse any configure options

LIBS="$LIBS $CURSES_LIB"

AC_SUBST(CURSES_LIB)

if test "x$glib_cflags" != "x"
then
	CFLAGS="$CFLAGS $glib_cflags"
fi
if test "x$glib_libs" != "x"
then
	LDFLAGS="$LDFLAGS $glib_libs"
fi

AC_CONFIG_FILES([Makefile m4/Makefile po/Makefile.in nano.spec])
AC_OUTPUT

--- NEW FILE: UPGRADE ---
GNU nano upgrading information
==============================

Visible changes since 1.0
-------------------------
* Editor Features
  - Complete Pico compatibility (--pico has been removed, and -p means
    something else, see below).
  - nanorc support (see nanorc.sample included in sources).
  - Smooth scrolling (-S).
  - Searching of matching brace/bracket/etc.
  - Help for all editor features.
  - Color syntax highlighting support.
  - Quote string support, useful for mail agents, etc (-Q).
  - Insertion of output of external commands.
  - Optional enabling of XON and XOFF control characters (-p).
  - Tons of bugfixes/enhancements for already existing features.

* File Handling
  - Overwriting and appending or prepending to files.
  - Writing marked text to separate files.
  - Multiple file buffers (-F).
  - Converting from and to DOS/Mac file format (-D/-M, -N to disable).
  - Better control character handling.
  - Creation of backup files (-B).
  - Search/replace history (-H).

See the GNU nano manual for detailed information on each feature.

--- NEW FILE: THANKS ---
The following people have helped GNU nano in some way or another.
If we missed you here, let us know!

Sharuzzaman Ahmat Raslan <sharuzzaman at excite.com>
						Malay translator
Laurentiu Buzdugan <buzdugan at voyager.net>	Romanian translator
Ricardo Cárdenes Medina <ricardo at conisys.com>	Spanish translator
Marco Colombo <magicdice at inwind.it>		Italian translator
Karl Eichwalder <keichwa at gmx.net>		German translator
Doruk Fisek <dfisek at fisek.com.tr>		Turkish translator
Jean-Philippe Guérard <jean-philippe.guerard at laposte.net>
						French translator
Geir Helland					Norwegian bokmål translator
Tedi Heriyanto <tedi_h at gmx.net>			Indonesian translator
Václav Haisman <V.Haisman at sh.cvut.cz>		Czech translator
Szabolcs Horvath <horvaths at janus.gimsz.sulinet.hu>
						Hungarian translator
Kalle Kivimaa <kalle.kivimaa at iki.fi>		Finnish Translator
Eivind Kjørstad <ekj at vestdata.no>		Norwegian nynorsk translator
Florian König <floki at bigfoot.com>		German translator
Wojciech Kotwica <wkotwica at post.pl>		Polish translator
Clement Laforet <clem_laf at wanadoo.fr>		French translator
Gergely Nagy <algernon at debian.org>		Hungarian translator
Kalle Olavi Niemitalo <kon at iki.fi>		Finnish Translator
Claudio Neves <cneves at nextis.com>		Brazilian Portuguese translator
Michael Piefel <piefel at informatik.hu-berlin.de> German translator
Sergey A. Ribalchenko <fisher at obu.ck.ua>	Russian, Ukrainian translator
Michel Robitaille <robitail at IRO.UMontreal.CA>	French translator
Christian Rose <menthos at menthos.com>		Swedish translator
Stig E Sandoe <stig at ii.uib.no>			Norwegian bokmål translator
Danilo Segan <dsegan at gmx.net>			Serbian translator
Keld Simonsen <keld at dkuug.dk>			Danish translator
Guus Sliepen <guus at nl.linux.org>		Dutch translator
Cezary Sliwa <sliwa at cft.edu.pl>			Polish translator
Pierre Tane <tanep at bigfoot.com>			French translator
Jacobo Tarrío <jtarrio at trasno.net>		Galician translator
Kjetil Torgrim Homme <kjetilho at linpro.no>	Norwegian nynorsk translator
Miquel Vidal <miquel at sindominio.net>		Catalan translator
Pauli Virtanen <pauli.virtanen at saunalahti.fi>	Finnish translator
Peio Ziarsolo <peio at sindominio.net>		Basque translator

Ben Armstrong <synrg at sanctuary.nslug.ns.ca>	Negative -r value idea, code
Thomas Dickey <dickey at herndon4.his.com>		Curses help and advice
Sven Guckes <guckes at math.fu-berlin.de>		Advice and Advocacy
Jim Knoble <jmknoble at pobox.com>			Pico compat for browser
Ryan Krebs <fluffy at highwire.stanford.edu>	Many bug fixes and testing
Roy Lanek <lanek at ranahminang.net>		Advice and advocacy
Chuck Mead <csm at MoonGroup.com>			Feedback and RPM stuff
Mike Melanson <melanson at pcisys.net>		Bugs
Neil Parks <nparks at acsmail.com>			Bug reports and fixes
Jeremy Robichaud <robicj at yahoo.com>		Beta tester
Bill Soudan <wes0472 at rit.edu>			Regex code, etc
Ken Tyler <kent at werple.net.au>			Search fixes and more


$Id: THANKS,v 1.1 2006-08-16 23:41:02 stsp Exp $

--- NEW FILE: INSTALL ---
Installation Instructions
*************************

Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.

This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.

Basic Installation
==================

These are generic installation instructions.

   The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation.  It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions.  Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').

   It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring.  (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)

   If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release.  If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.

   The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'.  You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.

The simplest way to compile this package is:

  1. `cd' to the directory containing the package's source code and type
     `./configure' to configure the package for your system.  If you're
     using `csh' on an old version of System V, you might need to type
     `sh ./configure' instead to prevent `csh' from trying to execute
     `configure' itself.

     Running `configure' takes awhile.  While running, it prints some
     messages telling which features it is checking for.

  2. Type `make' to compile the package.

  3. Optionally, type `make check' to run any self-tests that come with
     the package.

  4. Type `make install' to install the programs and any data files and
     documentation.

  5. You can remove the program binaries and object files from the
     source code directory by typing `make clean'.  To also remove the
     files that `configure' created (so you can compile the package for
     a different kind of computer), type `make distclean'.  There is
     also a `make maintainer-clean' target, but that is intended mainly
     for the package's developers.  If you use it, you may have to get
     all sorts of other programs in order to regenerate files that came
     with the distribution.

Compilers and Options
=====================

Some systems require unusual options for compilation or linking that the
`configure' script does not know about.  Run `./configure --help' for
details on some of the pertinent environment variables.

   You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment.  Here
is an example:

     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix

   *Note Defining Variables::, for more details.

Compiling For Multiple Architectures
====================================

You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory.  To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'.  `cd' to the
directory where you want the object files and executables to go and run
the `configure' script.  `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.

   If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory.  After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.

Installation Names
==================

By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc.  You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PREFIX'.

   You can specify separate installation prefixes for
architecture-specific files and architecture-independent files.  If you
give `configure' the option `--exec-prefix=PREFIX', the package will
use PREFIX as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.

   In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files.  Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.

   If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.

Optional Features
=================

Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System).  The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.

   For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.

Specifying the System Type
==========================

There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option.  TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:

     CPU-COMPANY-SYSTEM

where SYSTEM can have one of these forms:

     OS KERNEL-OS

   See the file `config.sub' for the possible values of each field.  If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.

   If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will
produce code for.

   If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.

Sharing Defaults
================

If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists.  Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.

Defining Variables
==================

Variables not defined in a site shell script can be set in the
environment passed to `configure'.  However, some packages may run
configure again during the build, and the customized values of these
variables may be lost.  In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'.  For example:

     ./configure CC=/usr/local2/bin/gcc

causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).  Here is a another example:

     /bin/bash ./configure CONFIG_SHELL=/bin/bash

Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.

`configure' Invocation
======================

`configure' recognizes the following options to control how it operates.

`--help'
`-h'
     Print a summary of the options to `configure', and exit.

`--version'
`-V'
     Print the version of Autoconf used to generate the `configure'
     script, and exit.

`--cache-file=FILE'
     Enable the cache: use and save the results of the tests in FILE,
     traditionally `config.cache'.  FILE defaults to `/dev/null' to
     disable caching.

`--config-cache'
`-C'
     Alias for `--cache-file=config.cache'.

`--quiet'
`--silent'
`-q'
     Do not print messages saying which checks are being made.  To
     suppress all normal output, redirect it to `/dev/null' (any error
     messages will still be shown).

`--srcdir=DIR'
     Look for the package's source code in directory DIR.  Usually
     `configure' can determine that directory automatically.

`configure' also accepts some other, not widely useful, options.  Run
`configure --help' for more details.


--- NEW FILE: aclocal.m4 ---
# generated automatically by aclocal 1.9.5 -*- Autoconf -*-

# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005  Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

[...1027 lines suppressed...]
  if test -s conftest.tar; then
    AM_RUN_LOG([$am__untar <conftest.tar])
    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
  fi
done
rm -rf conftest.dir

AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR

m4_include([m4/gettext.m4])
m4_include([m4/iconv.m4])
m4_include([m4/lib-ld.m4])
m4_include([m4/lib-link.m4])
m4_include([m4/lib-prefix.m4])
m4_include([m4/progtest.m4])
m4_include([acinclude.m4])

--- NEW FILE: NEWS ---
2005.05.15 - GNU nano 1.2.5 is released, after a long quiet period. 
		This release includes fixes for segfault during filename
		completion, justify on systems without regex.h, 
		hangs when the input stream goes away, and scrolling 
		beyond COLS.  Included are some new keyboard sequences.
		Enjoy what may be the final 1.2 release of nano!

2004.06.27 - GNU nano 1.2.4 is finally here!  This release contains 
		fixes for the lack of error reporting when opening 
		a file, segfaults when backgrounding nano at start,
		file truncation when resizing the editor window,
		and memory corruption in the status bar routines.   Also 
		included are translation updates and a port to the 
		Tandem NonStop kernel.

2004.02.17 - GNU nano 1.2.3 "priority interrupt" is released.  This 
		release includes many fixes, including converting file
		formats, the suspend handler, and the ever popular
		replace function.   New features include more Pico 
		compatibility in the file browser.  Enjoy this release,
		who knows when the next one will be ;-)

2003.08.11 - GNU nano 1.2.2 is released, only four months since the 
		last version :-).  This release includes fixes for
		broken regex detection, search history recall, and 
		keypad handling with -K.  Debugging strings are no 
		longer translated and comments denote where translations 
		should be as short as possible (i.e. the statusbar).  
		There are new examples for syntax highlighting, and 
		documentation updates and fixes.  The 1.3.0 CVS
		tree will be opening soon for all your nano desires, so 
		stay tuned!

2003.04.19 - Happy Easter! GNU nano 1.2.1 is released.  This release
		features a new check for broken regexec() 
		implementations and some variable, function and macro
		cleanups.  Fixes are included for search history,
		cutting marked text, alt keyboard mode, and the usual
		translation and documentation updates.

2003.02.19 - GNU nano 1.2.0 is released.  Few changes from pre3, just
		some doc and translation updates, and bugfixes for
		justify and file conversion.  For those of you who
		haven't kept up with the 1.1 unstable series, v1.2
		brings nanorc support, color syntax highlighting,
		multiple file buffers, search/replace history and much
		much more. Please reade the UPGRADE file for details,
		and enjoy GNU nano 1.2.0. 

2003.02.13 - GNU nano 1.1.99pre3 "The last testing version, no 
		really!" is released.  This release includes fixes for
		wrapping (again), resizing, color syntax highlighting,
		rcfile parsing, the mouse code, more memory leaks, and
		some reversion of the code to get the user's home
		directory (nano will now again rely on $HOME).  There
		are also translation updates, a new manual page for the
		nanorc file, and an UPGRADE file detailing the changes
		since version 1.0. Please submit reports for any bugs
		you might find to the development team
		(nano-devel at gnu.org), and enjoy nano almost-1.2.0 ;-)
		
2003.02.03 - GNU nano 1.1.99pre2 "bugs in my pockets, bugs in my
		shoes" is released.  There are, not suprisingly,
		only bugfixes in this release as we move toward the
		stable 1.2.0 release.  Fixes are included for
		translable string format, subexpression replacement,
		constant cursor position, invalid search regexes,
		justify, screen state on SIGHUP and SIGTERM, cutting
		to end cuts with long lines, many file browser and
		operating directory bugs, memory and file descriptor
		leaks, marker code, spell checker, the mouse code
		with long lines, multiple buffers and non-file
		open errors, replacement string length, and a 
		silly but serious history message crash.  There is 
		also a drastic improvement in CPU utliization for
		the color regex code.  
			Depending on the number of bugs found in this
		release, there may be a 1.1.99pre3 or RC1, or just
		a 1.2.0 release.  Most of the major bugs seem to have
		been worked out, so if you are waiting for a good time
		to test nano before the official 1.2.0 release, this
		would be the one to use.  Happy bug hunting!

2003.01.17 - GNU nano 1.1.99pre1 "enough already" has been released.
		This release is, barring bug fixes and documentation
		updates, what version 1.2.0 has looked like, feature
		wise. There will very likely be bugs, just due the 
		volume of changes made in this release.  Search 
		and replace string history has been added, including an 
		option to log history to ~/.nano_history (-H, 
		--historylog). Because of this, the pico incompatible 
		search/replace string behavior that used to be the 
		default has been deleted.   The old "pico" flag (-p) 
		is now compatible with Pico's "preserve" mode for 
		allowing flow control characters; by default this 
		version ignores both ^Q and ^S. The 
		--disable-wrapping-as-root configure option has been 
		forward ported from version 1.0.x, and a new flag to 
		enable all extra options (--enable-all) has been added.  
		The internal spell checker has been improved, meaning 
		you will now be prompted only once for each unique 
		capitalization of a given word.  
			There have also been lots of bug fixes,
		including the "trying to insert a directory name in 
		multibuffer mode bug", the ugly spell checker scrolling,
		the color code, cutting text crashes, justification,
		deleting the "magic line" via replace, and cursor 
		positioning on the statusbar.   There have also been
		the usual helping of translation and documentation
		updates.  
			Please send all new feedback on this release
		direct to the development list (nano-devel at gnu.org).

10/24/2002 - GNU nano 1.1.12 "Make Jordi happy" is released.  This 
		release demonstrated that nano is starting to freeze for 
		version 1.2.  New features include a Meta-Y toggle
		for syntax highlighting, pluralized i18n, and a handler
		for SIGTERM.  Nano now ignores XOFF (^S) to stop 
		accidental lock-ups, and no longer references malloc.h.
			Also included are fixes for zero-length regex
		matches, segfaults with --disable-mouse, justification,
		memory corruption with the browser, version and help 
		cmdline output, and translation updates.  Aside from 
		the (currently up in the air) search history behavior, 
		the next version of nano should be 1.1.99pre1.  Have 
		fun!

10/01/2002 - GNU nano 1.1.11 "Oddball" is released.  This release 
		features a new version of gettext, a new and improved syntax 
		highlighting engine, and some updates for the nanorc.sample
		file.  The toggles for case sensitivity (Meta-C) and regular 
		expressions (Meta-R) have changed in the search and replace 
		prompts, multibuffer status is now displayed and can be 
		toggled from the insert file menu, and some wrapping behavior 
		that changed in 1.1.10 has reverted.  The --enable-color
		warning was also made less severe, as the color syntax code 
		has improved, and nano now uses extended regexes in the 
		.nanorc file.
			Also included are fixes for various memory leaks,
		the operating directory option, username tab completion,
		the page_up and down arrow, go to previous word and next
		word, nanorc parser and line wrapping code.  Have fun!
		

07/25/2002 - At long last!  GNU nano 1.1.10 "What didn't we break?" is
		released.  This version of GNU nano features version
		0.11.2 of gettext, building with automake 1.6, some new
		code for displaying control characters, browser
		improvements, a new backup file option (-B, --backup),
		a new option to ignore rc files (-I,--ignorercfiles), 
		compatibility with -pedantic, handling null characters
		before EOF, a slightly sportier nanorc.sample and more.
			Fixes are included included for justification, the 
		reading and writing file routines, resizing and fill
		length, millions of memory leaks, the usage screen was 
		updated, and the the --quotestr and --regexp really work
		now ;-)   Enjoy :)

05/12/2002 - GNU nano 1.1.9 is released, happy Mother's Day!  This release
		includes many new features, including a prepend mode 
		(^O,M-P), a new "syntax" command in the .nanorc to allow
		multiple syntax highlighting types, and a new -Y, --syntax  
		flag to set a specific one if there's no filename regex to 
		match it against (i.e. w/mutt).  The ^space and M-space keys
		will now show up in the help menu, which itself has been
		tweaked a bit, and many more configure options should now
		cooperate (like the odd pairing of --enable-tiny and 
		--enable-multibuffer).  The marker should now work
		when using multiple buffers, and the huge memory leak in
		color syntax highlighting has been fixed.  A lot of
		new stuff for everyone's favorite text editor ;)  Have fun!

03/30/2002 - GNU nano 1.1.8 is released.  New features include an 
		"Insert Output of External Command", ^R^X, and a .spec
		file is now included in the distribution.  There are 
		cleanups in the usage code, fixes for regex parsing, 
		the file browser, the NO_CONVERT auto-detect, indented 
		justification, the internal spell checker, and a serious 
		bug where reading a file of 0 lines would hang nano.  
		Also, the "show position" code now shows the starting 
		column as 1 instead of 0.  Have fun!

03/05/2002 - GNU nano 1.1.7 "lets change everything and see what breaks"
		is released.  New features include new flags 
		-N,--noconvert to stop any file format conversion and
		-Q, --quotestr for the new quoted text justification,
		a new tempnam() implementation to avoid silly warnings,
		DOS and Mac file options in the Write File dialog,
		multiple save files (file.1) for abnormal exits, ^C
		now shows column as well as character position, and 
		multibuffer allows duplicate files, even unnamed ones.
		Also, the static shortcut and toggle lengths are
		history, nano now reads $SYSCONFDIR/nanorc if rc file
		support is enabled, and nano is now built with (and
		requires for rebuilding) autoconf 2.5. 
			This release also includes fixes for some memory
		leaks, detecting DOS and mac file format, justification,
		suspending keys, search & replace under various 
		conditions, variable width for shortcuts, and the usual
		ton of translation updates.

01/25/2002 - GNU nano 1.1.6 is released.  Lots of new features in this
		release.  New Meta-keys were added as alternates for 
		control sequences: Meta-A for the marker key (^^), and
		Meta-G for the 'goto dir' key in the file browser (^_).
		The color syntax highlighting now supports multiple
		lines via start="regex" end="regex" syntax, and the
		.nanorc regex format itself has changed. Also, the
		gettext code was upgraded to version 0.10.40, and nano
		will now display a message if only occurrence of a
		given search exists. 
			For bugfixes, there are fixes for spelling,
		stray newlines in the usage() function, suspend issues
		with tcsh, auto-indent and wrapping clashes, ugly code 
		in rcfile.c, global variable compatibility with AIX.
		There are also oodles of translation updates.
		Have fun with it.

01/05/2002 - GNU nano 1.1.5 is out.  The main new feature in this 
		release is the changed behavior of the keypad.  Nano now 
		does the Right Thing and used keypad() by default.  If
		you wish to use the keypad arrow keys in certain 
		terminals, you may use the -K or --keypad flag to
		use the old behavior.  Users of other OSes should see 
		better handling of their non-keypad keys in this 
		release.  Other changes include more Hurd fixes, fixes
		parsing the .nanorc, display fixes for the color syntax
		highlighting, gettext stabilization and many translation
		updates.  This is almost like a stable release, much like
		in the 0.9.x series when every other release was the
		most stable one :)  Have fun!
		
12/11/2001 - GNU nano 1.1.4 is released.  This release contains 
		rudimentary color syntax support (but it's still
		broken), compatibility fixes for the Hurd and FreeBSD,
		spell checker and wrapping fixes, and more.  It seems
		that the amount of interest in the code is inversely
		proportional to the amount of time since last release,
		so it's time to show the world all the changes since 
		1.1.3 ;)  Have fun with it!
 
10/26/2001 - GNU nano 1.1.3 is released.  As far as new features go, 
		the help system is now available for all functions in the
		editor.  Also, nano will also now print a message on
		the status bar when it automatically converts a file from
		Mac or DOS format, and trying to load a file that
		has already been loaded in multibuffer mode will now also
		cause an error message.  There is now a "goto previous
		word" which you can use by hitting Meta-Space Bar.
			As for fixes, a SEVERE bug in the 
		null_at code which discarded the memory address of
		reallocated memory has been fixed. This is probably
		the biggest bug fix in well over the last year of
		development.  There are also some display fixes for when
		the screen shouldn't center itself on cut or uncut text.
		Also, the comments in the header files incorectly said
		that nano was distributed under version 1 of the GPL when
		the accompanying license was the GPLv2.  
			If you're using nano-1.1, it is highly
		recommended you upgrade to this release.  If using 1.0,
		wait for version 1.0.6 which should be available early
		next week.  Enjoy!

10/03/2001 - GNU nano 1.1.2 is out there.  Many new features in this
		release, including support for auto-converting from
		DOS and Mac formatted files, as well as toggles for
		writing out files in these formats.  Pico's -o flag has
		been implemented, as has some new smooth scrolling code
		(which can be used in place of the default jerky scrolling
		behavior). Also, there is now a "find matching
		bracket/brace/etc" feature (Meta-]).  The  .nanorc file
		now accepts setting the tabsize, and the help text at the
		bottom of the editor is now better spaced out in the
		search/replace prompts.  There are also the usual helping
		of bugfixes, translation updates and, surely a bug or two.
		You better get ready!

07/28/2001 - GNU nano 1.1.1 is released.  Our second 1.1 unstable release
		features many bugfixes from the initial release, in
		particular fixes for the multibuffer code, and various
		compiler macro fixes.  The shortcut lists for
		the search and replace prompts are a little more logical
		(with cancel the last option again), and the included
		gettext was re-downgraded to 0.10.35 due to problems
		on the PPC platform.  GNU nano now includes its own
		aclocal macros in the m4/ directory to allow rebuilding
		the configure script to work on platforms regardless of
		their gettext version.

07/15/2001 - GNU nano 1.1.0 is released.  This is the first release
		in the 1.1.x unstable series of GNU nano. It
		incorporates all changes up to the 1.0.3 release, 
		and also includes many many new features, including 
		appending to as well as overwriting files, writing 
		marked text to a separate file, dynamic wrap length, 
		lots more compatibility with Pico, and new optional 
		features like .nanorc file support and multiple file 
		buffers!  All in all, plenty of new stuff that's sure 
		to introduce lots of bugs ;-) Have fun with it, but
		be careful, unstable means unstable.

04/06/2001 - GNU nano 1.0.1 is out there.  The only new feature is a 
		configure option for those who want to disable all
		word wrapping from nano, --disable-wrapping.  Bug fixes
		this release include some bugs with autoconf and i18n,
		and several fixes in the file browser including a
		segfault on Solaris, symlinks to directories now work
		properly, and nano now sorts files case insensitively
		like pilot.  Have fun with it.

03/22/2001 - GNU Nano 1.0 is released!  The autoindent wrapping bug 
		has been fixed, as well as strange bug when using Pico
		mode and regex search.  There have also been some minor 
		spelling and documentation updates.  As stated on the
		website, there are currently no known bugs with nano, but
		some will pop up eventually and they will be addressed in
		subsequent releases.  We hope you enjoy this first stable
		release of nano, and as always, feedback is welcome!
		nano at nano-editor.org.

02/19/2001 - Nano 0.9.99pre3 brings a lot of changes!  The most important
		being that nano is now officially a GNU program.  Some
		changes have been made for GNU compatibility (like the
		default list of shortcuts, "^G Get Help" is now Listed and
		"^_ Goto Line" is not).  The Yes/No/All keys have
		finally been internationalized also.   All in all, quite
		a few changes, considering nano is supposed to be in a code
		freeze.  But there are the usual helping of bugfixes, a
		nasty bug when cutting text in -k mode and some
		compatibility issues with older ncurses libraries have also
		been fixed.  All in all, a lot to see.

01/31/2001 - Nano 0.9.99pre2 is released.  Not surprisingly, all that is
		new is bugfixes, bugfixes, bugfixes.  There were a few
		cleanups in unneeded global variables and duplicate
		functions, but most is just fixing.  Specifically, there
		is now a preliminary (read: needs testing) fix for
		resizing the editor in any mode other than normal edit
		mode.  Other fixes include some more tab completion
		segfaults, and an silly segfault that occurred when 
		successfully writing a file on the 2nd try (i.e. after an
		initial write error). Slowly but surely, on toward 1.0 we
		travel.

01/17/2001 - Nano 0.9.99pre1 is released.  This is the first pre-1.0
		release of nano, and is also the first release since the
		code freeze for nano 1.0.  Don't expect (or request) any 
		new features between now and nano 1.0, only bugfixes,
		optimizations and doc/translation updates.  For fixes, a
		nasty segfault when trying to insert one's home directory
		(~), some checks for the NumLock key making the keypad
		go awry, window size sanity checks, many autoconf fixes,
		and support for the KDE konsole keypad layout.  Have fun.

01/07/2001 - Nano 0.9.25 is the "Just one more feature I swear!" release.
		It includes one new feature that Pico has had forever, a
		built-in file browser.  Since not everyone may want this 
		option, there is a --disable-browser option to the
		configure script as well.  Other changes include slightly
		different keypad handling, and a bugfix for crashes when
		tab completion in certain instances.  Have fun and Happy
		New Year!

12/18/2000 - Nano 0.9.24 is released.  This version contains the last of
		the security fixes for writing files, as well as for a
		nasty segfault when nano is unable to open a file for
		reading, among other fixes.  Nano also now cowardly
		refuses to open device files, to stop silly things like
		trying to open /dev/zero.  New features include being
		Able to use Meta-Meta-<key> as Control-<key>, better
		HURD support, and some new flags have been added for Pico
		compatibility.  Upgrading to this version is highly 
		recommended.

12/08/2000 - Nano 0.9.23 is the "race conditions bite" release.  The
		main reason for this release is the less-than-optimal
		fix for the security issue in nano with following symbolic
		links.  Hopefully this will fix the problem permanently.  
		The --nofollow option also works again for those who
		are real security nuts.  There are also some display and
		search fixes, and the --disable-spell function was renamed
		to --disable-speller to be in line with nano and Pico's
		"speller" term.

12/02/2000 - Nano 0.9.22 is released, with many more changes and 
		additions than imaginable.  The most important change is
		a fix for unsafe handling of symbolic links which could
		lead to symlink attacks if nano were to exit because
		of an error or signal.  Also there are better checks when
		saving files.
		    As for new features, username tab completion is
		now working well, the internal spell checker code has been
		tweaked, you can now unjustify if you don't like how the
		justify formatted your text, and there are more
		options for configure, including --disable-spell and
		--disable-justify and --enable-extra (for those who like
		surprises).  All in all, a whole lot of changes in
		a little over a week.

11/23/2000 - Happy Thanksgiving!  Nano 0.9.21 is our "last version was 
		a big turkey" release.  It fixes several bugs introduced
		by the previous version, as well as a few long-
		standing display bugs.  All 0.9.20 users are strongly
		encouraged to upgrade to this release.

11/18/2000 - Nano 0.9.20 is finally out the door.  Probably the biggest
		change is the brand new way nano displays previous search
		and replace strings (they are now editable!)  This is a
		break from Pico's (inconsistent) interface, so if you
		don't like the new way, "Pico" mode (-p on the command
		line or Meta-P within nano) still works the "old" 
		way.
		    Other new features include being able to deal with
		search strings of any length, a new internal spell feature
		(courtesy of Mr. Rocco Corsi) and tab completion when
		reading in or writing out files!  There's also the usual
		billion or so bug fixes.  Feedback on this release is
		welcome because so much has changed, especially with the
		previous string display in search and replace. Email ->
		nano at nano-editor.org <-. If you like something, don't like
		something, or just want to order a pizza, let us know!

10/02/2000 - Nano 0.9.19 is the "Chris is getting married in less than
		a week and needs a distraction" release.  There are only
		a few actual code changes, mainly portability and compiler
		warning fixes.  Nano now also supports PDCurses, which
		enables easily-built nano executables for Windows NT
		and 95/98 for the brave.  The official nano site has
		changed (again) as well, check out www.nano-editor.org for
		all the latest nano schtuff.

09/18/2000 - Nano 0.9.18 is unleashed.  It has some new keyboard
		handling code, cygwin support out of the box, and 
		a more portable handler for the NOHELP toggle.  There
		is also a fix for a somewhat serious bug whereby trying
		to insert a directory instead of a normal file would
		destroy the contents of the editor.  A must-see.  Four
		stars.

09/04/2000 - Nano 0.9.17, the Labor Day release, is released after a
		quiet spell (almost an entire month since last release!)
		New features include better (not yet perfect) binary
		display support and toggle support for most of the program
		flags (M-c, M-i, M-z, M-x, M-p, M-w, M-m, M-k and M-e for
		-c, -i, -x, -p, -w, -k, and -R).

08/09/2000 - Nano 0.9.16, after some struggling, is released.  This release
		should fix a few of the holes that 0.9.15 dug.  The 
		"cutting text on the first line" bug is fixed, as is the
		"cutting text on the last line" bug.  Nice symmetry there
		huh?  Also the --tabsize argument should now work as well
		as by using -T.

08/03/2000 - Nano 0.9.15 is the "I can't think of a release description"
		release.  There are the usual gala of display bugfixes,
		a fix for the the nasty bug in -k mode that could create a
		loop in the file being edited, and some other code
		cleanup.  Also, the -T option should now work regardless
		of the curses library used.  Yay.

07/27/2000 - Nano 0.9.14 is officially the "13 is so unlucky it should
		be skipped as a version number" release.  One typo
		caused unending problems (calling nano with either -t or
		-k caused both flags to be used). The -k code is also now
		closer in functionality to Pico's -k mode; please
		note that this code is not finished yet.  Working on this
		code has made me realize that there is not enough 
		abstraction in the code, and I will be working on that
		for the next release.  Until then, have fun with this
		version.

07/23/2000 - Nano 0.9.13 has a few new bits and bobs, most notably the
		-k option from Pico (cut to end of line).  The majority
		of changes in this release are bugfixes, however, including
		the usual display fixes and fixes for writing to symbolic
		links and un-writable files.  Barring any other major 
		changes, this should be the feature set for nano 1.0,
		whenever it might be released =-)

07/07/2000 - Nano 0.9.12 (The "lucky day" release) is bursting with new
		features, bug fixes, and yummy fruit flavor.  For
		changes, the alternate replace keystroke ^W^T is now
		^W^R to be compatible with later versions of Pico.
		^W^T is now goto line, again for Pico compatibility.
		As for new features, the wonderful/hated magic line
		code has returned with a vengeance!  Also, regular
		expression searches and replaces have been incorporated
		via the -R flag.  And, of course, there are the usual
		helping of display and other bug fixes to top it all
		off.

06/20/2000 - Nano 0.9.11 presents drastic rewrites of the most buggy
		routines in the program, specifically the wrapping code
		and almost all of the display routines.  There are many
		improvements and bugfixes to the display subsystem in 
		general, but there may be bugs lurking yet.  Also, after
		many MANY requests, there is now an option to set the
		displayed tab width (-T, --tabsize).  Note that 
		this function just changes the way tabs LOOK in the
		editor, the tabs you input are still real tabs of normal
		width  (usually 8 characters); nano just makes them look
		smaller or bigger while in the editor.  New in the
		translation department is an Indonesian translation (id).

06/06/2000 - Nano 0.9.10 is primarily a bugfix for the loss of SIGINT when
		using "run and terminate" flags (for example, --help).
		There are also some minor documentation updates.  This
		version of nano is the most stable in quite some time, and
		is likely to be the most stable for awhile.  Users are
		encouraged to upgrade to this version.

05/31/2000 - Nano 0.9.9 introduces much better working i18n support,
		more portability, and a ton of bugfixes.  While
		nano is not likely anywhere near 1.0 in terms of
		code quality, it gets a quantum leap closer with this
		release.

05/18/2000 - Nano 0.9.8 (the 'what broke now?' release) should fix
		the resize crash people have been experiencing.  It also
		offers a new input method that should allow nano to do
		things the right way (like ^S, ^Q, custom suspend keys)
		and hopefully won't break with non-US keyboards.  There
		are also the obligatory display fixes and speedups.  Have
		fun with it.

05/14/2000 - Nano 0.9.7 (the Mother's Day release) continues in the long
		line of display fixes, and also fixes the broken symlink
		behavior (i.e. symlinks weren't being followed by
		default).  Hopefully all major bugs can be worked out soon
		and we can have a 1.0 release before the end of the year,
		but who knows.
 
05/08/2000 - Nano 0.9.6 cleans up a lot of the display bugs that 0.9.5
		uncovered.  There are improvements (and some remaining
		segfaults) in the wrapping code, and even more
		display optimizations.  I would still say 0.9.4 or 0.9.2
		are the most stable versions of nano to date, but this one
		may not be too bad =-)

05/01/2000 - Nano 0.9.5 attempts to speed up the display of text
		to be at least somewhat reasonable.  Much
		code profiling has been done to reduce the 
		ridiculous number of redundant display updates.  This
		will probably expose a lot of bugs that can then be
		fixed, so this release is probably not for the faint
		of heart.  For anyone curious, I would call nano 0.9.2
		the most stable version recently, so use that if you're
		not particularly concerned with being on the bleeding
		edge.

04/25/2000 - Nano 0.9.4 fixes some problems in 0.9.3 with the last
		line code and related segfaults.  It also now has
		much better handling for 8-bit characters.  The
		--enable-tiny code also produces a smaller executable.

04/19/2000 - Nano 0.9.3 is officially the "Micro$oft" release.  It
		underscores the recent problem of bugfixes introducing
		more bugs than they fix.  The most important change
		to this version of nano is the removal of the "magic
		line".  You will no longer see a blank line at the end of
		the file. If you want a new line at the end of your file,
		you'll have to hit enter to get one.  

		NOTE: THIS BREAKS COMPATIBILITY WITH PICO.  Unfortunately,
		this feature has been causing many many problems with nano
		so it is being removed for the time being, and perhaps
		indefinitely.

		Other new stuff includes an --enable-tiny option to make
		nano ultra small (disabling i18n, detailed help and the
		marker and mouse code), and --with-slang to use the 
		slang libraries instead of ncurses.

04/15/2000 - Nano 0.9.2 just fixes the serious segfault problem if 
		nano is invoked any way other than using the absolute 
		path.  The bug was in the new code for checking whether 
		nano is invoked as 'pico'.

04/14/2000 - 0.9.1 has some more Pico compatibility built-in.  The
		option to switch to/from Search and Search/Replace
		(^T) is now available, and nano now displays the 
		more Pico-like shortcut list when invoked as 'pico'
		(i.e. if 'pico' is a symlink to nano).  There is an
		important change to the handling of symbolic links
		as well.  Now, nano does the "correct" thing and
		automatically writes to the object of the symlink,
		rather than replace the symlink with the updated file.
		This behavior is still available with the --nofollow
		or -l flags.  
		    Other new things include a fix for the infamous
		"recursive replace" bug, and more bugfixes in the wrapping 
		code.  

04/07/2000 - Nano 0.9.0 has some updates, new language support and
		a much better refresh setup (It's still not great, but...)
		There should also be more stability editing long lines,
		as there was a stupid mistake in the update_line
		call.  Silly me =)

03/22/2000 - Nano 0.8.9 is basically just a bugfix release of 0.8.8
		to reflect the current stagnant status of the project.
		Most things work, the rest doesn't doesn't work because
		(a) I can't fix it or I would have already done so, and
		(b) the amount of patches I'm receiving right now is quite
		negligible.  Fortunately, this release marks the first
		release since I have acquired ownership of the nano pages
		on SourceForge.  Here's hoping SF will get us some more
		visibility, translators and patches.

03/12/2000 - After a hiatus, I have finally moved (not unpacked though)
		to my new home into Albany. Thus I should now have more
		time to work on nano.  Nano 0.8.8, the "dear god what
		broke this time?" release, incorporates patches for both
		i18n and many bugfixes.  It is VERY likely something broke 
		this version, and it's likely I didn't even apply the i18n
		stuff properly, so *it* may not even work.  

		I would like to announce that I'm going to need
		translations soonish, so if you are fluent in other
		languages than English (or even better, if your native
		language is not English) and you would like to submit a
		translation file to me, please feel free to do so.  If you
		do, I will list your name and email in the AUTHORS file as
		the maintainer of the .po file, and from then on it is
		yours to take care of and keep up to date.

03/01/2000 - Well, to continue my trend of going back on my previous
		release's comments, nano 0.8.7 is released.  The crashing
		behavior was still occurring, and this most recent fix also
		fixes some other wrapping problems, so here you go.
		There may be another release soon, there may not be, is
		that vague enough? =)

02/25/2000 - More minor bugfixes in 0.8.6, the bizarre behavior at the end
		of a page has ceased, thankfully.  I'm also moving next
		weekend, so don't be shocked if you don't see a new
		version of nano next week =-)

02/11/2000 - Okay, here we go again.  Aside from a few minor fixes and
		some under-the-hood changes, you won't notice much
		different in this version of nano.  I haven't gotten much
		feedback on the help feature, is it simply amazing or does
		no one care?  Write and let me know! =)

02/08/2000 - Nano 0.8.3 marks the first time in a long time that there has
		been more than three days since the last release.  New
		features include an initial help mode (YAY!), hopefully
		much more support for i18n out of the box, and a flag
		for more Pico compatibility in the shortcut lists
		displayed. This release also marks the new nano
		distribution site, http://www.asty.org/nano and email
		address nano at asty.org for bugs, etc.

02/02/2000 - Okay, I hate to go back on what I said in the last release,
		but I may be changing jobs very soon.  I will release
		version 0.8.2 as is (no i18n, no help menu (yet).  I
		expect things to settle down by the end of next week, and
		then I can try to start on the i18n support and help menu;
		look for these new features in version 0.8.5 to 0.9.0.

01/28/2000 - Nano 0.8.1 marks our first official step toward
		internationalization (i18n) and the help system (^G).  I
		will be merging in Jordi's patches for initial i18n in the
		next version, and will implement the help system with
		i18n built into it shortly after that.  Please don't
		hesitate to send bug reports, as long as you're sure the
		fault lies with nano =-).

01/25/2000 - Nano 0.8.0 is officially the 'let's try and be at least a
		little portable, mmmmkay?' release.  There are many
		portability checks and fixes; many thanks to Andy Kahn for
		his patches.  I removed the broken do_spell behavior with
		the 'spell' program; for now, we only try to call 'ispell'
		until I write a better method to handle the output of the
		normal 'spell' command.

01/24/2000 - Nano 0.7.9 features many new features. Among them are a
		new autoindent feature (-i, --autoindent), tempfile
		flag like Pico's -t flag (-t, --tempfile), and preliminary
		spelling program support.  The spelling function tries
		to run 'spell' and then 'ispell' in that order, but you
		can specify another spelling program with -s or --speller.

01/17/00 - Nano 0.7.7 is officially the 'way too much stuff changed this
		release' release.  It's the busy time at work for me, so
		please don't get offended if your patch doesn't get
		included in the next immediate version of nano.  I'm sure
		all the changes in this release will cause a few bugs, so
		0.7.8 will primarily be about fixing those bugs.

		Things added this release include resizability (kinda),
		new -x and -c flags (see nano -h for help), long command
		line flag support, and the usual array of bugfixes.

01/15/00 - Nano 0.7.6 is officially the 'lightning' release.  It now loads
		large files much faster than previous versions, and is
		even much faster than Pico or vi in some rather
		rudimentary tests. Many thanks to Adam Rogoyski for the
		read_byte patch!

01/09/00 - As of this version (0.7.4), TIP has officially been renamed
		to nano.  The new homepage is at
		http://faculty.plattsburgh.edu/astyanax/nano.  Please
		update your bookmarks, tell your friends, and all that
		jazz.

$Id: NEWS,v 1.1 2006-08-16 23:41:02 stsp Exp $

--- NEW FILE: BUGS ---
** Open BUGS **

** Fixed BUGS **
- Marked cutting sometimes leaves a newline in the file unintelligently,
  such as when all of a line is selected but the mark doesn't proceed to
  the new line. (8) [FIXED/IRRELEVANT]
- Certains are not lined up properly when there are tabs in them at 
  certain col values. (9) [FIXED]
- edit_refresh() and update_line() do not handle selecting text when the
  cursor is beyond COLS (10) [FIXED]
- no way to do a replace with the empty string (11) [FIXED, yay!]
- Spelling support is not elegant like Pico's integration of the 'spell'
  program.  Nano only uses ispell (for now) (12) [FIXED]
- Moving to the end of a line when close to a multiple of COLS and at
  least COLS * 2 does not make the screen jump early like it would for
  if we were around COLS (bugs in edit_refresh, update_line) (13)
  [FIXED, mostly]
- When at the very bottom of the edit window, do_wrap goes berserk and
  puts the cursor somewhere bad; subsequent keystrokes crash the program
  (14) [FIXED, mostly]
- Doing a replacement of a substring of the replace string (e.g. replacing
  "ed" with "fred" causes an infinite loop). (15) [FIXED]
- Cutting a file with marked text and both marker ends on the same line
  causes a random segfault (16) [FIXED]
- Cutting more than one line resets the KEEP_CUTBUFFER flag in 0.9.3.
  Error is in bitwise assignment (nano.h). (17) [FIXED]
- The wrapping code does not work right for lines like the following:
 *                                                                     *
  Error is in do_wrap, must be rewritten. (18) [FIXED]
- Nano fails to follow symlinks, even though -l isn't being used (20).
  [Bug in global flag init, FIXED]
- When using --help or --version, the SIGINT character gets lost. (21) [FIXED]
- edit_refresh() and update_line() (and related functions) have 
  trouble when a tab is the character that is the boundary at COLS (23)
  [FIXED]
- There is an off-by-one error in keeping track of totsize.  It is caused
  by the fact that we count the newline at the end when we read in a file
  but we do not, in fact, display this newline.  This should go away
  implicitly when the "Magic Line" returns, but it is noted here for
  documentation's sake. (24) [FIXED]
- In replace with completely adjacent strings, every other search string
  will be missed (try replace ':' in a string like ':::::::::') (28) [FIXED]
- If nano opens a read-only file with the --tempfile option, and a change
  is made to the buffer, and a write is attempted, nano will not give you
  a dialog about not being able to write the file, and it will not let the
  user exit (29, discovered by Joshua Jensen) [FIXED]
- Using nano -k, marked text is not cut properly. (31) [FIXED]
- Invoking -t or -k has the effect of invoking both options. (32) [FIXED]
- totsize becomes incorrect after word-wrapping (25) [FIXED]
- Wrapping a line with autoindent mode sometimes causes a segfault (19)
  [FIXED]
- When inserting files, the display sometimes fails to display properly
  until a pageup/down occurs (22) [FIXED]
- In search/replace code, there is too much refreshing in bottomwin (26)
  [FIXED]
- In replace, there is no way to accept the default replace string. (27)
  [FIXED]
- Using nano -t, user can not exit until a filename is given via ^O. (30)
  [FIXED]
- totsize problems still abound in do_justify (33) [FIXED]
- Using -k, cut text is not pasted properly. (34) [FIXED].
- Using -k, pasted text is not updated properly if it goes beyond editbot. (35)
  [FIXED]
- Doing a cut with -k can screw up the filestruct; fault is in cutting
 code. (36)  [FIXED]
- Hitting enter on the magic line makes new lines, but they are not
  written out to disk when saved..... (37). [FIXED]
- Page up and page down do not work the same way as in Pico (# of lines). (38)
  [FIXED]
- When doing a search and the marker is set, the screen does not always
  properly update the inverted text (39). [FIXED]
- Searches for a string that only exists on one line multiple times will
  fail after finding the last occurrence (discovered by Ken Tyler) (40).
  [FIXED]
- Alt-Z is currently broken to toggle suspend.  I guess I still don't know
  signals very well =-) (41) [FIXED].
- Unable to cut the entire file using the marker (discovered by Ken Tyler)
  (42). [FIXED]
- The keypad does not work when nano runs in the Gnome terminal (43). [FIXED]
- When reading in a file, if the file is a directory, the contents of the
  file being edited are blown away (discovered by  Chris Pimlot) (44). [FIXED]
- in certain terms, nano will leave a "ghost" of screen upon exit
  when called from inside mutt (among other settings) (45). [FIXED]
- In replace, hitting the Goto line shortcut key does nothing after a
  search string is entered (discovered by Rocco Corsi) (46) [FIXED].
- When typing in a string in search or replace and hitting CASE_SENSITIVE
  or the other search string, the current string edit is blown away in
  favor of the last stored search (47) [FIXED]
- If nano fails to open a file when it starts up, doing almost anything
  causes a segfault (discovered by Ben Roberts) (48). [FIXED]
- In certain terminals, nano would not work properly with keypad().
  Turned out to be the silly timeout(0) call, which is completely
  unneeded, anyway.  (49) [FIXED]
- With less than a page of text, doing a page down will move the
  current line to the top of the screen, which it shouldn't do.  (50) 
  [FIXED]
- with PDCURSES, running meta-X turns off the keypad.  (51) [FIXED]
- Resizing the window completely screws up the display if in any other
  mode than normal editing (help screen, search and replace, file
  browser..) (52) [FIXED]
- Alt speller argument (-s, --speller) does not take a string argument of
  more than one word. (53) [FIXED].
- Cut to end cutting (-k) causes segfaults (try cutting "- Backup making
  (filename~)?" line in TODO file) (discovered by
  higuita at cadernoverde.com) (54) [FIXED].
- When using autoindent (-i), wrapped text does not get autoindented
  (55, discovered by Mark Senior) [FIXED].
- When using -R (regex) and -p (Pico mode), subsequent searches after
  the first fail if no string is entered (56) [FIXED].
- Page down on a file of editwinrows fails (again). Reported by Ryan
  Krebs (57) [FIXED].
- File browser aborts on Solaris in qsort() call.  (Reported by
  Matthias Andree) (58) [FIXED].
- Can modify the current file in view mode with ^W^R (discovered by Rocco
  Corsi) (58) [FIXED].
- When page up is used after two page down's, the screen doesn't update
  properly (discovered by David Lawrence Ramsey) (59) [FIXED].
- On BSD systems, marked cutting sna paste often screws up the
  last line in the cutbuffer (discovered by Barry Pederson) (60) [FIXED]
- Blank lines are not kept when cutting with -k (discovered by Rocco)
  (61) [FIXED].
- Nano will not suspend properly inside of mutt (62) [FIXED].
- When switching from Pico mode to normal mode, the previous search is
  not displayed until cancelling the search (63) [FIXED].
- If you change search options but don't change the search string in
  normal mode, hitting  enter causes the search/replace to abort (64)
  (Jordi Mallach) [FIXED].
- Cutting one line of text causes the screen to recenter the line
  (reported and fixed by David Lawrence Ramsey) (65) [FIXED].
- When cutting marked text including the bottom of the file, a new   
  "magic line" is not created" (reported by David Lawrence
  Ramsey, fixed by David Lawrence Ramsey & Chris) (66) [FIXED].
- ^C does not work after a suspend in tcsh (discovered by
  Trevor Cordes) (68) [FIXED].
- Home and End control keys (^A, ^E) do not always work in filename
  prompt (bug found by Ian Turner) (69) [1.0 series only] [FIXED].
- Trying to insert a file of 0 bytes will hang nano (70) [FIXED].

$Id: BUGS,v 1.1 2006-08-16 23:41:01 stsp Exp $

--- NEW FILE: config.h.in ---
/* config.h.in.  Generated from configure.ac by autoheader.  */

/* Define this if your regexec() function segfaults when passed an empty
   string under certain conditions. */
#undef BROKEN_REGEXEC

/* Define this to enable nano debug messages and assert warnings. */
#undef DEBUG

/* Define this to disable the built-in (crappy) file browser. */
#undef DISABLE_BROWSER

/* Define this to disable the ^G help menu. */
#undef DISABLE_HELP

/* Define this to disable the justify routine. */
#undef DISABLE_JUSTIFY

/* Define this to disable the mouse functions. */
#undef DISABLE_MOUSE

/* Define this to disable setting of the operating directory (chroot of
   sorts). */
#undef DISABLE_OPERATINGDIR

/* Define this to disable wrapping as root by default. */
#undef DISABLE_ROOTWRAP

/* Define this to disable the use(full|less) spelling functions. */
#undef DISABLE_SPELLER

/* Define to disable the tab completion code Chris worked so hard on! */
#undef DISABLE_TABCOMP

/* Define this to disable any and all text wrapping. */
#undef DISABLE_WRAPPING

/* Define this to have syntax highlighting, requires ENABLE_NANORC too! */
#undef ENABLE_COLOR

/* Define this to enable multiple file buffers. */
#undef ENABLE_MULTIBUFFER

/* Define this to use the .nanorc file. */
#undef ENABLE_NANORC

/* Define to 1 if translation of program messages to the user's native
   language is requested. */
#undef ENABLE_NLS

/* Define to 1 if you have the <curses.h> header file. */
#undef HAVE_CURSES_H

/* Define if the GNU dcgettext() function is already present or preinstalled.
   */
#undef HAVE_DCGETTEXT

/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT

/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H

/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H

/* Define to 1 if you have the `getopt_long' function. */
#undef HAVE_GETOPT_LONG

/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT

/* Define if you have the iconv() function. */
#undef HAVE_ICONV

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H

/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the <ncurses.h> header file. */
#undef HAVE_NCURSES_H

/* Define to 1 if you have the <regex.h> header file. */
#undef HAVE_REGEX_H

/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF

/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP

/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H

/* Define to 1 if you have the `strncasecmp' function. */
#undef HAVE_STRNCASECMP

/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H

/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H

/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H

/* Define to 1 if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H

/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define this if your curses lib has the _use_keypad flag. */
#undef HAVE_USEKEYPAD

/* Define this if your curses library has the use_default_colors command. */
#undef HAVE_USE_DEFAULT_COLORS

/* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF

/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF

/* Define this to enable the extra stuff. */
#undef NANO_EXTRA

/* Define this to make the nano executable as small as possible. */
#undef NANO_SMALL

/* Shut up the assert warnings :-) */
#undef NDEBUG

/* Name of package */
#undef PACKAGE

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

/* Define to the full name of this package. */
#undef PACKAGE_NAME

/* Define to the full name and version of this package. */
#undef PACKAGE_STRING

/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

/* Define to use the slang wrappers for curses instead of native curses. */
#undef USE_SLANG

/* Version number of package */
#undef VERSION

/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS

/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES

--- NEW FILE: config.guess ---
#! /bin/sh
# Attempt to guess a canonical system name.
#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.

timestamp='2003-07-02'

# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
[...1368 lines suppressed...]
/bin/universe          = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch              = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`

UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM  = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF

exit 1

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:

--- NEW FILE: config.sub ---
#! /bin/sh
# Configuration validation subroutine script.
#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.

timestamp='2003-07-04'

# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine.  It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
[...1465 lines suppressed...]
			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
				vendor=atari
				;;
			-vos*)
				vendor=stratus
				;;
		esac
		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
		;;
esac

echo $basic_machine$os
exit 0

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:

--- NEW FILE: nano.1.html ---
<HTML><HEAD><TITLE>Manpage of NANO</TITLE>
</HEAD><BODY>
<H1>NANO</H1>
Section: User Commands  (1)<BR>Updated: June 19, 2003<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>



<P>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>

nano - Nano's ANOther editor, an enhanced free Pico clone
<P>
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>

<B>nano</B>

<I>[+LINE]&nbsp;[options]&nbsp;[file]</I>

<BR>

<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>

This manual page documents briefly the <B>nano</B> command.
<P>




<B>nano</B> is a small, free and friendly editor which aims to replace
Pico, the default editor included in the non-free Pine package. Rather
than just copying Pico's look and feel, <B>nano</B> also implements some
missing (or disabled by default) features in Pico, such as &quot;search and
replace&quot; and &quot;go to line number&quot;.
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>

<DL COMPACT>
<DT><B>+</B><I>LINE</I>

<DD>
Places cursor at <I>LINE</I> on startup.
<DT><B>-B (--backup)</B>

<DD>
When saving a file, back up the previous version of it to the current
filename suffixed with a ~.
<DT><B>-D (--dos)</B>

<DD>
Write file in DOS format.
<DT><B>-F (--multibuffer)</B>

<DD>
Enable multiple file buffers, if available.
<DT><B>-H (--historylog)</B>

<DD>
Log search and replace strings to
<I>~/.nano_history</I>

so they may be stored for later editing, if nanorc support is 
configured.
<DT><B>-I (--ignorercfiles)</B>

<DD>
Don't look at
<I>$SYSCONFDIR/nanorc</I>

or
<I>~/.nanorc</I>,

if nanorc support is available.
<DT><B>-K (--keypad)</B>

<DD>
Do not use the ncurses keypad() call unless necessary.  Try this flag if
you find that the arrow keys on the numeric keypad do not work for you
under nano.
<DT><B>-M (--mac)</B>

<DD>
Write file in Mac format.
<DT><B>-N (--noconvert)</B>

<DD>
Disable automatic conversion of files from DOS/Mac format.
<DT><B>-Q </B><I>str</I> (--quotestr=<I>str</I>)

<DD>
Set the quoting string for justifying.  The default is
&quot;^([&nbsp;\t]*[|&gt;:}#])+&quot; if regular expression support is available, or
&quot;&gt;&nbsp;&quot; otherwise.
<DT><B>-R (--regexp)</B>

<DD>
Enable regular expression matching for search strings, as well as
\n subexpression replacement for replace strings, if available.
<DT><B>-S (--smooth)</B>

<DD>
Enable smooth scrolling. Text will scroll line-by-line, instead of the
usual chunk-by-chunk behavior.
<DT><B>-T </B><I>num</I> (--tabsize=<I>num</I>)

<DD>
Set the size (width) of a tab.
<DT><B>-V (--version)</B>

<DD>
Show the current version number and author.
<DT><B>-Y </B><I>str</I> (--syntax=<I>str</I>)

<DD>
Specify a specific syntax highlighting from the
<I>.nanorc</I>

to use, if available.
<DT><B>-c (--const)</B>

<DD>
Constantly show the cursor position.
<DT><B>-h (--help)</B>

<DD>
Display a summary of command line options.
<DT><B>-i (--autoindent)</B>

<DD>
Indent new lines to the previous line's indentation. Useful when editing
source code.
<DT><B>-k (--cut)</B>

<DD>
Enable cut from cursor to end of line with ^K.
<DT><B>-l (--nofollow)</B>

<DD>
If the file being edited is a symbolic link, replace the link with
a new file, do not follow it.  Good for editing files in
<I>/tmp</I>,

perhaps?
<DT><B>-m (--mouse)</B>

<DD>
Enable mouse support (if available for your system).
<DT><B>-o </B><I>dir</I> (--operatingdir=<I>dir</I>)

<DD>
Set operating directory. Makes nano set up something similar to a
chroot.
<DT><B>-p (--preserve)</B>

<DD>
Preserve the XON and XOFF sequences (^Q and ^S) so they will be 
caught by the terminal.
<DT><B>-r </B><I>cols</I> (--fill=<I>cols</I>)

<DD>
Wrap lines at column <I>cols</I>.  By default, this is the width of the
screen, less eight.  If this value is negative, wrapping will occur at
<I>cols</I> columns from the right of the screen, allowing the wrap point 
to vary along with the screen width if resized.
<DT><B>-s </B><I>prog</I> (--speller=<I>prog</I>)

<DD>
Enable alternative spell checker command.
<DT><B>-t (--tempfile)</B>

<DD>
Always save changed buffer without prompting.  Same as Pico -t option.
<DT><B>-v (--view)</B>

<DD>
View file (read only) mode.
<DT><B>-w (--nowrap)</B>

<DD>
Disable wrapping of long lines.
<DT><B>-x (--nohelp)</B>

<DD>
Disable help screen at bottom of editor.
<DT><B>-z (--suspend)</B>

<DD>
Enable suspend ability.
<DT><B>-a, -b, -e, -f, -g, -j</B>

<DD>
Ignored, for compatibility with Pico.
<P>
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>INITIALIZATION FILE</H2>

<B>nano</B> will read initialization files in the following 
order:
<I>$SYSCONFDIR/nanorc</I>,

then
<I>~/.nanorc</I>.

Please see
<B><A HREF="http://localhost/cgi-bin/man/man2html?5+nanorc">nanorc</A></B>(5)

and the example file <B>nanorc.sample</B> which should be provided with 
<B>nano</B>. 
<P>
<A NAME="lbAG">&nbsp;</A>
<H2>NOTES</H2>

<B>nano</B> will try to dump the buffer into an emergency file in some
cases.  Mainly, this will happen if <B>nano</B> receives a SIGHUP or
SIGTERM or runs out of memory, when it will write the buffer into a file
named
<I>nano.save</I>

if the buffer didn't have a name already, or will add a &quot;.save&quot; suffix 
to the current filename. If an emergency file with that name already 
exists in the current directory, &quot;.save&quot; and a number (e.g. &quot;.save.1&quot;) 
will be suffixed to the current filename in order to make it unique. In 
multibuffer mode, <B>nano</B> will write all the open buffers to the 
respective emergency files.
<P>
<A NAME="lbAH">&nbsp;</A>
<H2>BUGS</H2>

Please send any comments or bug reports to
<B><A HREF="mailto:nano at nano-editor.org">nano at nano-editor.org</A></B>.

<P>
The <B>nano</B> mailing list is available from
<B><A HREF="mailto:nano-devel at gnu.org">nano-devel at gnu.org</A></B>.

<P>
To subscribe, email to
<B><A HREF="mailto:nano-devel-request at gnu.org">nano-devel-request at gnu.org</A></B>

with a subject of &quot;subscribe&quot;.
<P>
<A NAME="lbAI">&nbsp;</A>
<H2>HOMEPAGE</H2>

<A HREF="http://www.nano-editor.org/">http://www.nano-editor.org/</A>
<P>
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>


<DL COMPACT>
<DT><B><A HREF="http://localhost/cgi-bin/man/man2html?5+nanorc">nanorc</A></B>(5)<DD>
</DL>
<P>

<I>/usr/share/doc/nano/</I> (or equivalent on your system)
<P>
<A NAME="lbAK">&nbsp;</A>
<H2>AUTHOR</H2>

Chris Allegretta &lt;<A HREF="mailto:chrisa at asty.org">chrisa at asty.org</A>&gt;, et al (see
<I>AUTHORS</I>

and
<I>THANKS</I>

for details). This manual page was originally written by Jordi Mallach
&lt;<A HREF="mailto:jordi at sindominio.net">jordi at sindominio.net</A>&gt;, for the Debian GNU system (but may be
used by others).
<P>

<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</A><DD>
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT><A HREF="#lbAE">OPTIONS</A><DD>
<DT><A HREF="#lbAF">INITIALIZATION FILE</A><DD>
<DT><A HREF="#lbAG">NOTES</A><DD>
<DT><A HREF="#lbAH">BUGS</A><DD>
<DT><A HREF="#lbAI">HOMEPAGE</A><DD>
<DT><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT><A HREF="#lbAK">AUTHOR</A><DD>
</DL>
<HR>
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 22:27:55 GMT, June 19, 2003
</BODY>
</HTML>

--- NEW FILE: Makefile.am ---
## $Id: Makefile.am,v 1.1 2006-08-16 23:41:02 stsp Exp $
AUTOMAKE_OPTIONS = gnu no-dependencies

DEFS= -DSYSCONFDIR=\"$(sysconfdir)\"

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 

man_MANS = nano.1 nanorc.5
nano_LDADD = @GLIB_LIBS@ @LIBINTL@

info_TEXINFOS = nano.texi
MAKEINFO = makeinfo --no-split

EXTRA_DIST =	ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS \
		README THANKS TODO UPGRADE config.rpath install-sh missing \
		mkinstalldirs nano.1.html nanorc.5.html faq.html \
		nanorc.sample nano.spec $(man_MANS)

SUBDIRS = po m4

localedir = $(datadir)/locale
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -I at includedir@

ACLOCAL_AMFLAGS = -I m4

--- NEW FILE: winio.c ---
/* $Id: winio.c,v 1.1 2006-08-16 23:41:03 stsp Exp $ */
/**************************************************************************
 *   winio.c                                                              *
 *                                                                        *
 *   Copyright (C) 1999-2003 Chris Allegretta                             *
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
 *   the Free Software Foundation; either version 2, or (at your option)  *
 *   any later version.                                                   *
 *                                                                        *
 *   This program is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *   GNU General Public License for more details.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
[...1868 lines suppressed...]
		mvwaddstr(edit, i * 2 - k, start_x, what);
	    }
	    usleep(700000);
	    wrefresh(edit);
	}
	if (j < editwinrows / 2 - 1)
	    j++;

	place++;

	if (place >= CREDIT_LEN + editwinrows / 2)
	    break;
    }

    nodelay(edit, FALSE);
    curs_set(1);
    display_main_list();
    total_refresh();
}
#endif

--- NEW FILE: nano.h ---
/* $Id: nano.h,v 1.1 2006-08-16 23:41:02 stsp Exp $ */
/**************************************************************************
 *   nano.h                                                               *
 *                                                                        *
 *   Copyright (C) 1999-2003 Chris Allegretta                             *
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
 *   the Free Software Foundation; either version 2, or (at your option)  *
 *   any later version.                                                   *
 *                                                                        *
 *   This program is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *   GNU General Public License for more details.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
 **************************************************************************/

#ifndef NANO_H
#define NANO_H 1

#ifdef __TANDEM
/* Tandem NonStop Kernel */
#include <floss.h>
#define NANO_ROOT_UID 65535
#else
#define NANO_ROOT_UID 0
#endif

#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif

/* Macros for the flags int... */
#define SET(bit) flags |= bit
#define UNSET(bit) flags &= ~bit
#define ISSET(bit) (flags & bit)
#define TOGGLE(bit) flags ^= bit

/* Define charalloc as a macro rather than duplicating code */
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
#ifdef BROKEN_REGEXEC
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
#endif

#ifndef NANO_SMALL
  /* For the backup file copy ... */
# define COPYFILEBLOCKSIZE 1024
#endif

#ifdef USE_SLANG	/* Slang support enabled */
#include <slcurses.h>
#define KEY_IC SL_KEY_IC
#define KEY_DC SL_KEY_DELETE
#elif defined(HAVE_NCURSES_H)
#include <ncurses.h>
#else /* Uh oh */
#include <curses.h> 
#endif /* CURSES_H */

#ifdef ENABLE_NLS
#  ifdef HAVE_LIBINTL_H
#    include <libintl.h>
#  endif
#  define _(string) gettext(string)
#  define P_(singular, plural, number) ngettext(singular, plural, number)
#else
#  define _(string) (string)
#  define P_(singular, plural, number) (number == 1 ? singular : plural)
#endif

#include <sys/types.h>
#include <sys/stat.h>
#include "config.h"

#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
#include <glib.h>
# ifndef HAVE_SNPRINTF
#  define snprintf	g_snprintf
# endif
# ifndef HAVE_VSNPRINTF
#  define vsnprintf	g_vsnprintf
# endif
#endif

#ifndef HAVE_STRCASECMP
#define strcasecmp nstricmp
#endif

#ifndef HAVE_STRNCASECMP
#define strncasecmp nstrnicmp
#endif

/* HP-UX 10 & 11 do not seem to support KEY_HOME and KEY_END */
#ifndef KEY_HOME
#define KEY_HOME -1
#endif /* KEY_HOME */

#ifndef KEY_END
#define KEY_END -1
#endif /* KEY_END */

/* Snatch these out of the ncurses defs, so we can use them in search
   history regardless of whether we're using ncurses or not */
#if !defined(KEY_UP) || !defined(KEY_DOWN)
#define KEY_UP   0403
#define KEY_DOWN 0402
#endif /* !KEY_UP || !KEY_DOWN */

#define VERMSG "GNU nano " VERSION

#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#define DISABLE_WRAPJUSTIFY 1
#endif

/* Structure types */
typedef struct filestruct {
    char *data;
    struct filestruct *next;	/* Next node */
    struct filestruct *prev;	/* Previous node */
    int lineno;			/* The line number */
} filestruct;

#ifdef ENABLE_MULTIBUFFER
typedef struct openfilestruct {
    char *filename;
#ifndef NANO_SMALL
    struct stat originalfilestat;
#endif
    struct openfilestruct *next;	/* Next node */
    struct openfilestruct *prev;	/* Previous node */
    struct filestruct *fileage;	/* Current file */
    struct filestruct *filebot;	/* Current file's last line */
#ifndef NANO_SMALL
    struct filestruct *file_mark_beginbuf;
				/* Current file's beginning marked line */
    int file_mark_beginx;	/* Current file's beginning marked line's
				   x-coordinate position */
#endif
    int file_current_x;		/* Current file's x-coordinate position */
    int file_current_y;		/* Current file's y-coordinate position */
    int file_flags;		/* Current file's flags: modification
				   status (and marking status, if
				   available) */
    int file_placewewant;	/* Current file's place we want */
    int file_totlines;		/* Current file's total number of lines */
    long file_totsize;		/* Current file's total size */
    int file_lineno;		/* Current file's line number */
} openfilestruct;
#endif

typedef struct shortcut {
   int val;		/* Actual sequence that generates the keystroke */
   int altval;		/* Alt key # for this function, or 0 for none */
   int misc1;		/* Other int functions we want bound */
   int misc2;
   int viewok;		/* is this function legal in view mode? */
   int (*func) (void);	/* Function to call when we catch this key */
   const char *desc;	/* Description, e.g. "Page Up" */
#ifndef DISABLE_HELP
   const char *help;	/* Help file entry text */
#endif
   struct shortcut *next;
} shortcut;

#ifndef NANO_SMALL
typedef struct toggle {
   int val;		/* Sequence to toggle the key.  Should only need 1 */
   const char *desc;	/* Description for when toggle is, uh, toggled,
			   e.g. "Pico Messages"; we'll append Enabled or
			   Disabled */
   int flag;		/* What flag actually gets toggled */
   struct toggle *next;
} toggle;
#endif /* !NANO_SMALL */

#ifdef ENABLE_NANORC
typedef struct rcoption {
   const char *name;
   int flag;
} rcoption;
#endif /* ENABLE_NANORC */

#ifdef ENABLE_COLOR

typedef struct colortype {
    int fg;			/* fg color */
    int bg;			/* bg color */
    int bright;			/* Is this color A_BOLD? */
    int pairnum;		/* Color pair number used for this fg/bg */
    regex_t start;		/* Start (or all) of the regex string */
    regex_t *end;		/* End of the regex string */
    struct colortype *next;
} colortype;

typedef struct exttype {
    regex_t val;		/* The extensions that match this syntax. */
    struct exttype *next;
} exttype;

typedef struct syntaxtype {
    char *desc;			/* Name of this syntax type */
    exttype *extensions;	/* List of extensions that this applies to */
    colortype *color;		/* color struct for this syntax */
    struct syntaxtype *next;
} syntaxtype;

#endif /* ENABLE_COLOR */

#ifndef NANO_SMALL
typedef struct historytype {
    struct historytype *next;
    struct historytype *prev;
    char *data;
} historytype;
typedef struct historyheadtype {
    struct historytype *next;	/* keep *next and *prev members together */
    struct historytype *prev;	/* and in same order as in historytype */
    struct historytype *tail;
    struct historytype *current;
    int count;
    int len;
} historyheadtype;
#endif /* !NANO_SMALL */

/* Bitwise flags so we can save space (or more correctly, not waste it) */

#define MODIFIED		(1<<0)
#define KEEP_CUTBUFFER		(1<<1)
#define CASE_SENSITIVE		(1<<2)
#define MARK_ISSET		(1<<3)
#define CONSTUPDATE		(1<<4)
#define NO_HELP			(1<<5)
#define NOFOLLOW_SYMLINKS	(1<<6)
#define SUSPEND			(1<<7)
#define NO_WRAP			(1<<8)
#define AUTOINDENT		(1<<9)
#define SAMELINEWRAP		(1<<10)
#define VIEW_MODE		(1<<11)
#define USE_MOUSE		(1<<12)
#define USE_REGEXP		(1<<13)
#define REGEXP_COMPILED		(1<<14)
#define TEMP_OPT		(1<<15)
#define CUT_TO_END		(1<<16)
#define REVERSE_SEARCH		(1<<17)
#define MULTIBUFFER		(1<<18)
#define DOS_FILE		(1<<19)
#define MAC_FILE		(1<<20)
#define SMOOTHSCROLL		(1<<21)
#define DISABLE_CURPOS		(1<<22)	/* Damn, we still need it */
#define ALT_KEYPAD		(1<<23)
#define NO_CONVERT		(1<<24)
#define BACKUP_FILE		(1<<25)
#define NO_RCFILE		(1<<26)
#define COLOR_SYNTAX		(1<<27)
#define PRESERVE		(1<<28)
#define HISTORY_CHANGED		(1<<29)
#define HISTORYLOG		(1<<30)
#define JUSTIFY_MODE		(1<<31)

/* Control key sequences, changing these would be very very bad */

#define NANO_CONTROL_SPACE 0
#define NANO_CONTROL_A 1
#define NANO_CONTROL_B 2
#define NANO_CONTROL_C 3
#define NANO_CONTROL_D 4
#define NANO_CONTROL_E 5
#define NANO_CONTROL_F 6
#define NANO_CONTROL_G 7
#define NANO_CONTROL_H 8
#define NANO_CONTROL_I 9
#define NANO_CONTROL_J 10
#define NANO_CONTROL_K 11
#define NANO_CONTROL_L 12
#define NANO_CONTROL_M 13
#define NANO_CONTROL_N 14
#define NANO_CONTROL_O 15
#define NANO_CONTROL_P 16
#define NANO_CONTROL_Q 17
#define NANO_CONTROL_R 18
#define NANO_CONTROL_S 19
#define NANO_CONTROL_T 20
#define NANO_CONTROL_U 21
#define NANO_CONTROL_V 22
#define NANO_CONTROL_W 23
#define NANO_CONTROL_X 24
#define NANO_CONTROL_Y 25
#define NANO_CONTROL_Z 26

#define NANO_CONTROL_4 28
#define NANO_CONTROL_5 29
#define NANO_CONTROL_6 30
#define NANO_CONTROL_7 31

#define NANO_ALT_A 'a'
#define NANO_ALT_B 'b'
#define NANO_ALT_C 'c'
#define NANO_ALT_D 'd'
#define NANO_ALT_E 'e'
#define NANO_ALT_F 'f'
#define NANO_ALT_G 'g'
#define NANO_ALT_H 'h'
#define NANO_ALT_I 'i'
#define NANO_ALT_J 'j'
#define NANO_ALT_K 'k'
#define NANO_ALT_L 'l'
#define NANO_ALT_M 'm'
#define NANO_ALT_N 'n'
#define NANO_ALT_O 'o'
#define NANO_ALT_P 'p'
#define NANO_ALT_Q 'q'
#define NANO_ALT_R 'r'
#define NANO_ALT_S 's'
#define NANO_ALT_T 't'
#define NANO_ALT_U 'u'
#define NANO_ALT_V 'v'
#define NANO_ALT_W 'w'
#define NANO_ALT_X 'x'
#define NANO_ALT_Y 'y'
#define NANO_ALT_Z 'z'
#define NANO_ALT_PERIOD '.'
#define NANO_ALT_COMMA ','
#define NANO_ALT_LCARAT '<'
#define NANO_ALT_RCARAT '>'
#define NANO_ALT_BRACKET ']'
#define NANO_ALT_SPACE ' '

/* Some semi-changeable keybindings; don't play with unless you're sure you
know what you're doing */

#define NANO_INSERTFILE_KEY	NANO_CONTROL_R
#define NANO_INSERTFILE_FKEY	KEY_F(5)
#define NANO_EXIT_KEY 		NANO_CONTROL_X
#define NANO_EXIT_FKEY 		KEY_F(2)
#define NANO_WRITEOUT_KEY	NANO_CONTROL_O
#define NANO_WRITEOUT_FKEY	KEY_F(3)
#define NANO_GOTO_KEY		NANO_CONTROL_7
#define NANO_GOTO_FKEY		KEY_F(13)
#define NANO_ALT_GOTO_KEY	NANO_ALT_G
#define NANO_HELP_KEY		NANO_CONTROL_G
#define NANO_HELP_FKEY		KEY_F(1)
#define NANO_WHEREIS_KEY	NANO_CONTROL_W
#define NANO_WHEREIS_FKEY	KEY_F(6)
#define NANO_REPLACE_KEY	NANO_CONTROL_4
#define NANO_REPLACE_FKEY	KEY_F(14)
#define NANO_ALT_REPLACE_KEY	NANO_ALT_R
#define NANO_OTHERSEARCH_KEY	NANO_CONTROL_R
#define NANO_PREVPAGE_KEY	NANO_CONTROL_Y
#define NANO_PREVPAGE_FKEY	KEY_F(7)
#define NANO_NEXTPAGE_KEY	NANO_CONTROL_V
#define NANO_NEXTPAGE_FKEY	KEY_F(8)
#define NANO_CUT_KEY		NANO_CONTROL_K
#define NANO_CUT_FKEY		KEY_F(9)
#define NANO_UNCUT_KEY		NANO_CONTROL_U
#define NANO_UNCUT_FKEY		KEY_F(10)
#define NANO_CURSORPOS_KEY	NANO_CONTROL_C
#define NANO_CURSORPOS_FKEY	KEY_F(11)
#define NANO_SPELL_KEY		NANO_CONTROL_T
#define NANO_SPELL_FKEY		KEY_F(12)
#define NANO_FIRSTLINE_KEY	NANO_PREVPAGE_KEY
#define NANO_LASTLINE_KEY	NANO_NEXTPAGE_KEY
#define NANO_CANCEL_KEY		NANO_CONTROL_C
#define NANO_REFRESH_KEY	NANO_CONTROL_L
#define NANO_JUSTIFY_KEY	NANO_CONTROL_J
#define NANO_JUSTIFY_FKEY	KEY_F(4)
#define NANO_UNJUSTIFY_KEY	NANO_CONTROL_U
#define NANO_UP_KEY		NANO_CONTROL_P
#define NANO_DOWN_KEY		NANO_CONTROL_N
#define NANO_FORWARD_KEY	NANO_CONTROL_F
#define NANO_BACK_KEY		NANO_CONTROL_B
#define NANO_MARK_KEY		NANO_CONTROL_6
#define NANO_ALT_MARK_KEY	NANO_ALT_A
#define NANO_HOME_KEY		NANO_CONTROL_A
#define NANO_END_KEY		NANO_CONTROL_E
#define NANO_DELETE_KEY		NANO_CONTROL_D
#define NANO_BACKSPACE_KEY	NANO_CONTROL_H
#define NANO_TAB_KEY		NANO_CONTROL_I
#define NANO_SUSPEND_KEY	NANO_CONTROL_Z
#define NANO_ENTER_KEY		NANO_CONTROL_M
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
#define NANO_TOFILES_KEY	NANO_CONTROL_T
#define NANO_APPEND_KEY		NANO_ALT_A
#define NANO_PREPEND_KEY	NANO_ALT_P
#define NANO_OPENPREV_KEY	NANO_ALT_LCARAT
#define NANO_OPENNEXT_KEY	NANO_ALT_RCARAT
#define NANO_OPENPREV_ALTKEY	NANO_ALT_COMMA
#define NANO_OPENNEXT_ALTKEY	NANO_ALT_PERIOD
#define NANO_BRACKET_KEY	NANO_ALT_BRACKET
#define NANO_EXTCMD_KEY		NANO_CONTROL_X
#define NANO_NEXTWORD_KEY	NANO_CONTROL_SPACE
#define NANO_PREVWORD_KEY	NANO_ALT_SPACE

#ifndef NANO_SMALL
/* Toggles do not exist with NANO_SMALL. */
#define TOGGLE_CONST_KEY	NANO_ALT_C
#define TOGGLE_AUTOINDENT_KEY	NANO_ALT_I
#define TOGGLE_SUSPEND_KEY	NANO_ALT_Z
#define TOGGLE_NOHELP_KEY	NANO_ALT_X
#define TOGGLE_MOUSE_KEY	NANO_ALT_M
#define TOGGLE_CUTTOEND_KEY	NANO_ALT_K
#define TOGGLE_REGEXP_KEY	NANO_ALT_R
#define TOGGLE_WRAP_KEY		NANO_ALT_W
#define TOGGLE_BACKWARDS_KEY	NANO_ALT_B
#define TOGGLE_CASE_KEY		NANO_ALT_C
#define TOGGLE_LOAD_KEY		NANO_ALT_F
#define TOGGLE_DOS_KEY		NANO_ALT_D
#define TOGGLE_MAC_KEY		NANO_ALT_O
#define TOGGLE_SMOOTH_KEY	NANO_ALT_S
#define TOGGLE_NOCONVERT_KEY	NANO_ALT_N
#define TOGGLE_BACKUP_KEY	NANO_ALT_B
#define TOGGLE_SYNTAX_KEY	NANO_ALT_Y
#endif /* !NANO_SMALL */

#define MAIN_VISIBLE 12

#define VIEW 1
#define NOVIEW 0

typedef enum {
    CENTER, TOP, NONE
} topmidbotnone;

/* Minimum editor window rows required for nano to work correctly */
#define MIN_EDITOR_ROWS 3

/* Minimum editor window cols required for nano to work correctly */
#define MIN_EDITOR_COLS 10

/* Default number of characters from end-of-line where text wrapping
   occurs */
#define CHARS_FROM_EOL 8

/* Maximum number of search history strings saved, same value used for
   replace history */
#define MAX_SEARCH_HISTORY 100

#endif /* !NANO_H */

--- NEW FILE: proto.h ---
/* $Id: proto.h,v 1.1 2006-08-16 23:41:03 stsp Exp $ */
/**************************************************************************
 *   proto.h                                                              *
 *                                                                        *
 *   Copyright (C) 1999-2003 Chris Allegretta                             *
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
 *   the Free Software Foundation; either version 2, or (at your option)  *
 *   any later version.                                                   *
 *                                                                        *
 *   This program is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *   GNU General Public License for more details.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
 **************************************************************************/

/* Externs */

#include <sys/stat.h>

#ifdef HAVE_REGEX_H
#include <regex.h>
#endif

#include "nano.h"

extern int wrap_at;
extern int editwinrows;
extern int current_x, current_y, totlines;
extern int placewewant;
#ifndef NANO_SMALL
extern int mark_beginx;
#endif
extern long totsize;
extern int temp_opt;
extern int wrap_at, flags, tabsize;
extern int search_last_line;
extern int search_offscreen;
extern int currslen;

#ifndef DISABLE_JUSTIFY
extern char *quotestr;
#endif

extern WINDOW *edit, *topwin, *bottomwin;
extern char *filename;
extern struct stat originalfilestat;
extern char *answer;
extern char *hblank;
#ifndef DISABLE_HELP
extern char *help_text;
#endif
extern char *last_search;
extern char *last_replace;
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
extern char *full_operating_dir;
#endif
#ifndef DISABLE_SPELLER
extern char *alt_speller;
#endif

extern int resetstatuspos;
extern struct stat fileinfo;
extern filestruct *current, *fileage, *edittop, *editbot, *filebot; 
extern filestruct *cutbuffer;
#ifndef NANO_SMALL
extern filestruct *mark_beginbuf;
#endif

#ifdef ENABLE_MULTIBUFFER
extern openfilestruct *open_files;
#endif

#ifdef ENABLE_COLOR
extern const colortype *colorstrings;
extern syntaxtype *syntaxes;
extern char *syntaxstr;
#endif

extern shortcut *shortcut_list;
extern shortcut *main_list, *whereis_list;
extern shortcut *replace_list, *goto_list;
extern shortcut *writefile_list, *insertfile_list;
extern shortcut *replace_list_2;
#ifndef NANO_SMALL
extern shortcut *extcmd_list;
#endif
#ifndef DISABLE_HELP
extern shortcut *help_list;
#endif
#ifndef DISABLE_SPELLER
extern shortcut *spell_list;
#endif
#ifndef DISABLE_BROWSER
extern shortcut *browser_list, *gotodir_list;
#endif

#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || (!defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION))
extern const shortcut *currshortcut;
#endif

#ifdef HAVE_REGEX_H
extern regex_t search_regexp;
extern regmatch_t regmatches[10];  
#ifdef ENABLE_COLOR
extern regex_t syntaxfile_regexp;
extern regmatch_t synfilematches[1];  
#endif /* ENABLE_COLOR */
#endif /* HAVE_REGEX_H */

#ifndef NANO_SMALL
extern toggle *toggles;
extern int jumpok;
#endif

#ifndef NANO_SMALL
extern historyheadtype search_history;
extern historyheadtype replace_history;
#endif

extern int curses_ended;

/* Functions we want available */

/* Public functions in color.c */
#ifdef ENABLE_COLOR
void set_colorpairs(void);
void do_colorinit(void);
void update_color(void);
#endif /* ENABLE_COLOR */

/* Public functions in cut.c */
filestruct *get_cutbottom(void);
void add_to_cutbuffer(filestruct *inptr);
void cut_marked_segment(filestruct *top, size_t top_x, filestruct *bot,
                        size_t bot_x, int destructive);
int do_cut_text(void);
int do_uncut_text(void);

/* Public functions in files.c */
void load_file(int update);
void new_file(void);
filestruct *read_line(char *buf, filestruct *prev, int *line1ins, int len);
int read_file(FILE *f, const char *filename, int quiet);
int open_file(const char *filename, int insert, int quiet);
char *get_next_filename(const char *name);
int do_insertfile(int loading_file);
int do_insertfile_void(void);
#ifdef ENABLE_MULTIBUFFER
openfilestruct *make_new_opennode(openfilestruct *prevnode);
void splice_opennode(openfilestruct *begin, openfilestruct *newnode, openfilestruct *end);
void unlink_opennode(const openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
void free_openfilestruct(openfilestruct *src);
int add_open_file(int update);
int load_open_file(void);
int open_prevfile(int closing_file);
int open_prevfile_void(void);
int open_nextfile(int closing_file);
int open_nextfile_void(void);
int close_open_file(void);
#endif
#if !defined(DISABLE_SPELLER) || !defined(DISABLE_OPERATINGDIR)
char *get_full_path(const char *origpath);
#endif
#ifndef DISABLE_SPELLER
char *check_writable_directory(const char *path);
char *safe_tempnam(const char *dirname, const char *filename_prefix);
#endif
#ifndef DISABLE_OPERATINGDIR
void init_operating_dir(void);
int check_operating_dir(const char *currpath, int allow_tabcomp);
#endif
int write_file(const char *name, int tmp, int append, int nonamechange);
int do_writeout(const char *path, int exiting, int append);
int do_writeout_void(void);
char *real_dir_from_tilde(const char *buf);
#ifndef DISABLE_TABCOMP
int append_slash_if_dir(char *buf, int *lastwastab, int *place);
char **username_tab_completion(char *buf, int *num_matches);
char **cwd_tab_completion(char *buf, int *num_matches);
char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list);
#endif
#ifndef DISABLE_BROWSER
struct stat filestat(const char *path);
int diralphasort(const void *va, const void *vb);
void free_charptrarray(char **array, int len);
const char *tail(const char *foo);
void striponedir(char *foo);
int readable_dir(const char *path);
char **browser_init(const char *path, int *longest, int *numents);
char *do_browser(const char *inpath);
char *do_browse_from(const char *inpath);
#endif

/* Public functions in global.c */
int length_of_list(const shortcut *s);
void sc_init_one(shortcut **shortcutage, int key, const char *desc,
#ifndef DISABLE_HELP
	const char *help,
#endif
	int alt, int misc1, int misc2, int view, int (*func) (void));
#ifndef NANO_SMALL
void toggle_init_one(int val, const char *desc, int flag);
void toggle_init(void);
#ifdef DEBUG
void free_toggles(void);
#endif
#endif
void free_shortcutage(shortcut **shortcutage);
void shortcut_init(int unjustify);
#ifdef DEBUG
void thanks_for_all_the_fish(void);
#endif

/* Public functions in move.c */
int do_home(void);
int do_end(void);
void page_up(void);
int do_page_up(void);
int do_page_down(void);
int do_up(void);
int do_down(void);
int do_left(void);
int do_right(void);

/* Public functions in nano.c */
RETSIGTYPE finish(int sigage);
void die(const char *msg, ...);
void die_save_file(const char *die_filename);
void die_too_small(void);
void print_view_warning(void);
void global_init(int save_cutbuffer);
void window_init(void);
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
void mouse_init(void);
#endif
#ifndef DISABLE_HELP
void help_init(void);
#endif
filestruct *make_new_node(filestruct *prevnode);
filestruct *copy_node(const filestruct *src);
void splice_node(filestruct *begin, filestruct *newnode, filestruct *end);
void unlink_node(const filestruct *fileptr);
void delete_node(filestruct *fileptr);
filestruct *copy_filestruct(const filestruct *src);
void free_filestruct(filestruct *src);
void renumber_all(void);
void renumber(filestruct *fileptr);
void print1opt(const char *shortflag, const char *longflag,
		const char *desc);
void usage(void);
void version(void);
void do_early_abort(void);
int no_help(void);
#if defined(DISABLE_JUSTIFY) || defined(DISABLE_SPELLER) || defined(DISABLE_HELP) || defined(NANO_SMALL)
void nano_disabled_msg(void);
#endif
#ifndef NANO_SMALL
RETSIGTYPE cancel_fork(int signal);
int open_pipe(const char *command);
#endif
#ifndef DISABLE_MOUSE
#ifdef NCURSES_MOUSE_VERSION
void do_mouse(void);
#endif
#endif
void do_char(char ch);
int do_backspace(void);
int do_delete(void);
int do_tab(void);
int do_enter(void);
#ifndef NANO_SMALL
int do_next_word(void);
int do_prev_word(void);
#endif
int do_mark(void);
void wrap_reset(void);
#ifndef DISABLE_WRAPPING
int do_wrap(filestruct *inptr);
#endif
#ifndef DISABLE_SPELLER
int do_int_spell_fix(const char *word);
char *do_int_speller(char *tempfile_name);
char *do_alt_speller(char *tempfile_name);
#endif
int do_spell(void);
#if !defined(DISABLE_WRAPPING) && !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
size_t indent_length(const char *line);
#endif
#ifndef DISABLE_JUSTIFY
int justify_format(int changes_allowed, filestruct *line, size_t skip);
#ifdef HAVE_REGEX_H
size_t quote_length(const char *line, const regex_t *qreg);
#else
size_t quote_length(const char *line);
#endif
#ifdef HAVE_REGEX_H
#  define IFREG(a, b) a, b
#else
#  define IFREG(a, b) a
#endif
int quotes_match(const char *a_line, size_t a_quote,
		IFREG(const char *b_line, const regex_t *qreg));
size_t indents_match(const char *a_line, size_t a_indent,
			const char *b_line, size_t b_indent);
filestruct *backup_lines(filestruct *first_line, size_t par_len,
			size_t quote_len);
int breakable(const char *line, int goal);
int break_line(const char *line, int goal, int force);
#endif /* !DISABLE_JUSTIFY */
int do_justify(void);
int do_exit(void);
void signal_init(void);
RETSIGTYPE handle_hupterm(int signal);
RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_cont(int signal);
#ifndef NANO_SMALL
void handle_sigwinch(int s);
#endif
void print_numlock_warning(void);
#ifndef NANO_SMALL
void do_toggle(const toggle *which);
#endif
int abcd(int input);

/* Public functions in rcfile.c */
#ifdef ENABLE_NANORC
void rcfile_error(const char *msg, ...);
void rcfile_msg(const char *msg, ...);
char *parse_next_word(char *ptr);
char *parse_argument(char *ptr);
#ifdef ENABLE_COLOR
int colortoint(const char *colorname, int *bright);
char *parse_next_regex(char *ptr);
int nregcomp(regex_t *preg, const char *regex, int flags);
void parse_syntax(char *ptr);
void parse_colors(char *ptr);
#endif /* ENABLE_COLOR */
void parse_rcfile(FILE *rcstream);
void do_rcfile(void);
#endif /* ENABLE_NANORC */

/* Public functions in search.c */
#ifdef HAVE_REGEX_H
int regexp_init(const char *regexp);
void regexp_cleanup(void);
#endif
void not_found_msg(const char *str);
void search_abort(void);
void search_init_globals(void);
int search_init(int replacing);
int is_whole_word(int curr_pos, const char *datastr, const char *searchword);
filestruct *findnextstr(int quiet, int bracket_mode,
			const filestruct *begin, int beginx,
			const char *needle, int no_sameline);
int do_search(void);
void replace_abort(void);
#ifdef HAVE_REGEX_H
int replace_regexp(char *string, int create_flag);
#endif
char *replace_line(void);
int do_replace_loop(const char *prevanswer, const filestruct *begin,
			int *beginx, int wholewords, int *i);
int do_replace(void);
int do_gotoline(int line, int save_pos);
int do_gotoline_void(void);
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant);
#endif
int do_find_bracket(void);
#ifndef NANO_SMALL
void history_init(void);
historytype *find_node(historytype *h, char *s);
void remove_node(historytype *r);
void insert_node(historytype *h, const char *s);
void update_history(historyheadtype *h, char *s);
char *get_history_older(historyheadtype *h);
char *get_history_newer(historyheadtype *h);
char *get_history_completion(historyheadtype *h, char *s);
void free_history(historyheadtype *h);
#ifdef ENABLE_NANORC
void load_history(void);  
void save_history(void);
#endif
#endif

/* Public functions in utils.c */
#ifdef BROKEN_REGEXEC
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
	regmatch_t pmatch[], int eflags);
#endif
int is_cntrl_char(int c);
int num_of_digits(int n);
void align(char **strp);
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
#ifndef HAVE_STRCASECMP
int nstricmp(const char *s1, const char *s2);
#endif
#ifndef HAVE_STRNCASECMP
int nstrnicmp(const char *s1, const char *s2, size_t n);
#endif
#ifndef NANO_SMALL
const char *revstrstr(const char *haystack, const char *needle,
			const char *rev_start);
const char *revstristr(const char *haystack, const char *needle,
			const char *rev_start);
#endif
const char *stristr(const char *haystack, const char *needle);
const char *strstrwrapper(const char *haystack, const char *needle,
			const char *rev_start, int line_pos);
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
char *mallocstrcpy(char *dest, const char *src);
void new_magicline(void);
#ifndef DISABLE_TABCOMP
int check_wildcard_match(const char *text, const char *pattern);
#endif

/* Public functions in winio.c */
int blocking_wgetch(WINDOW *win);
int do_first_line(void);
int do_last_line(void);
int xpt(const filestruct *fileptr, int index);
size_t xplustabs(void);
size_t actual_x(const filestruct *fileptr, size_t xplus);
size_t strnlenpt(const char *buf, size_t size);
size_t strlenpt(const char *buf);
void blank_bottombars(void);
void blank_bottomwin(void);
void blank_edit(void);
void blank_statusbar(void);
void blank_statusbar_refresh(void);
void check_statblank(void);
void nanoget_repaint(const char *buf, const char *inputbuf, int x);
int nanogetstr(int allowtabs, const char *buf, const char *def,
#ifndef NANO_SMALL
		historyheadtype *history_list,
#endif
		const shortcut *s
#ifndef DISABLE_TABCOMP
		, int *list
#endif
		);
void set_modified(void);
void titlebar(const char *path);
void bottombars(const shortcut *s);
void onekey(const char *keystroke, const char *desc, int len);
#ifndef NDEBUG
int check_linenumbers(const filestruct *fileptr);
#endif
int get_page_start(int column);
void reset_cursor(void);
void add_marked_sameline(int begin, int end, filestruct *fileptr, int y,
			 int virt_cur_x, int this_page);
void edit_add(const filestruct *fileptr, int yval, int start
#ifndef NANO_SMALL
		, int virt_mark_beginx,	int virt_cur_x
#endif
		);
void update_line(filestruct *fileptr, int index);
void update_cursor(void);
void center_cursor(void);
void edit_refresh(void);
void edit_refresh_clearok(void);
void edit_update(filestruct *fileptr, topmidbotnone location);
int statusq(int tabs, const shortcut *s, const char *def,
#ifndef NANO_SMALL
		historyheadtype *history_list,
#endif
		const char *msg, ...);
int do_yesno(int all, int leavecursor, const char *msg, ...);
int total_refresh(void);
void display_main_list(void);
void statusbar(const char *msg, ...);
int do_cursorpos(int constant);
int do_cursorpos_void(void);
int line_len(const char *ptr);
int do_help(void);
int keypad_on(WINDOW *win, int newval);
void do_replace_highlight(int highlight_flag, const char *word);
void fix_editbot(void);
#ifdef DEBUG
void dump_buffer(const filestruct *inptr);
void dump_buffer_reverse(void);
#endif
#ifdef NANO_EXTRA
void do_credits(void);
#endif

--- NEW FILE: README ---

	GNU nano - an enhanced clone of the Pico text editor.

Overview

     The nano project was started because of a few "problems" with the
     wonderfully easy-to-use and friendly Pico text editor.

     First and foremost is its license: the Pine suite does not use the
     GPL or a GPL-friendly license, and has unclear restrictions on 
     redistribution.  Because of this, Pine and Pico are not included with
     many GNU/Linux distributions.  Also, other features (like goto line
     number or search and replace) were unavailable until recently or
     require a command line flag.  Yuck.

     nano aims to solve these problems by emulating the functionality of
     Pico as closely as possible while addressing the problems above and
     perhaps providing other extra functionality.

     The nano editor is now an official GNU package.  For more information
     on GNU and the Free Software Foundation please see http://www.gnu.org.
     
How to compile and install nano

     Download the nano source code, then:
     tar zxvf nano-x.y.z.tar.gz
     cd nano-x.y.z
     ./configure
     make
     make install
     
     It's that simple. Use --prefix with configure to override the 
     default installation directory of /usr/local.
     
Web Page

	http://www.nano-editor.org
     
Mailing List and Bug Reports

	Savannah hosts all the nano-related mailing-lists.
	+ info-nano at gnu.org is a very low traffic list
	  used to announce new Nano versions or other important information
	  about the project.
	+ help-nano at gnu.org is for those seeking to get help without
	  wanting to hear about the technical details of its
	  development.
	+ nano-devel at gnu.org is the list used by the people
	  that make Nano and a general development discussion list, with
	  moderate traffic.
	To subscribe, send email to nano-<name>-request at gnu.org
	with a subject of "subscribe", where <name> is the list you want to
	subscribe to.
	For general bug reports, send a description of the problem to
	nano at nano-editor.org or directly to the development list.

Current Status

	GNU nano has reaching its second major milestone, 1.2.x. Development
	of new features will continue in the 1.3.x branch, while 1.2.x
	versions will be dedicated to bugfixing and polishing.

   Chris Allegretta (chrisa at asty.org)

$Id: README,v 1.1 2006-08-16 23:41:02 stsp Exp $

--- NEW FILE: nano.c ---
/* $Id: nano.c,v 1.1 2006-08-16 23:41:02 stsp Exp $ */
/**************************************************************************
 *   nano.c                                                               *
 *                                                                        *
 *   Copyright (C) 1999-2003 Chris Allegretta                             *
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
 *   the Free Software Foundation; either version 2, or (at your option)  *
 *   any later version.                                                   *
 *                                                                        *
 *   This program is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *   GNU General Public License for more details.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
[...3785 lines suppressed...]

		break;
	    default:
#ifdef DEBUG
		fprintf(stderr, "I got %c (%d)!\n", kbinput, kbinput);
#endif
		/* We no longer stop unhandled sequences so that people with
		   odd character sets can type... */

		if (ISSET(VIEW_MODE))
		    print_view_warning();
		else
		    do_char(kbinput);
	    }

	reset_cursor();
	wrefresh(edit);
    }
    assert(0);
}

--- NEW FILE: configure ---
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for GNU Nano 1.2.5.
#
# Report bugs to <nano-devel at gnu.org>.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization.  ##
## --------------------- ##

# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  emulate sh
  NULLCMD=:
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  # is contrary to our usage.  Disable this feature.
[...9486 lines suppressed...]
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
# by configure, so config.status won't be able to write to it; its
# output is simply discarded.  So we exec the FD to /dev/null,
# effectively closing config.log, so it can be properly (re)opened and
# appended to by config.status.  When coming back to configure, we
# need to make the FD available again.
if test "$no_create" != yes; then
  ac_cs_success=:
  ac_config_status_args=
  test "$silent" = yes &&
    ac_config_status_args="$ac_config_status_args --quiet"
  exec 5>/dev/null
  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
  exec 5>>config.log
  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
  # would make configure fail if this is the last instruction.
  $ac_cs_success || { (exit 1); exit 1; }
fi


--- NEW FILE: files.c ---
/* $Id: files.c,v 1.1 2006-08-16 23:41:02 stsp Exp $ */
/**************************************************************************
 *   files.c                                                              *
 *                                                                        *
 *   Copyright (C) 1999-2003 Chris Allegretta                             *
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
 *   the Free Software Foundation; either version 2, or (at your option)  *
 *   any later version.                                                   *
 *                                                                        *
 *   This program is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *   GNU General Public License for more details.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
[...2955 lines suppressed...]
	    if (fputs("\n", hist) == EOF) {
		    rcfile_msg(_("Unable to write ~/.nano_history file, %s"), strerror(errno));
		    goto come_from;
	    }
	    for (h = replace_history.tail ; h->prev ; h = h->prev) {
		h->data = charealloc(h->data, strlen(h->data) + 2);
		strcat(h->data, "\n");
		if (fputs(h->data, hist) == EOF) {
		    rcfile_msg(_("Unable to write ~/.nano_history file, %s"), strerror(errno));
		    goto come_from;
		}
	    }
come_from:
	    fclose(hist);
	}
	free(nanohist);
    }
}
#endif /* ENABLE_NANORC */
#endif /* !NANO_SMALL */

--- NEW FILE: missing ---
#! /bin/sh
# Common stub for a few missing GNU programs while installing.

scriptversion=2005-02-08.22

# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
#   Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

if test $# -eq 0; then
  echo 1>&2 "Try \`$0 --help' for more information"
  exit 1
fi

run=:

# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
  configure_ac=configure.ac
else
  configure_ac=configure.in
fi

msg="missing on your system"

case "$1" in
--run)
  # Try to run requested program, and just exit if it succeeds.
  run=
  shift
  "$@" && exit 0
  # Exit code 63 means version mismatch.  This often happens
  # when the user try to use an ancient version of a tool on
  # a file that requires a minimum version.  In this case we
  # we should proceed has if the program had been absent, or
  # if --run hadn't been passed.
  if test $? = 63; then
    run=:
    msg="probably too old"
  fi
  ;;

  -h|--h|--he|--hel|--help)
    echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...

Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.

Options:
  -h, --help      display this help and exit
  -v, --version   output version information and exit
  --run           try to run the given command, and emulate it if it fails

Supported PROGRAM values:
  aclocal      touch file \`aclocal.m4'
  autoconf     touch file \`configure'
  autoheader   touch file \`config.h.in'
  automake     touch all \`Makefile.in' files
  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
  flex         create \`lex.yy.c', if possible, from existing .c
  help2man     touch the output file
  lex          create \`lex.yy.c', if possible, from existing .c
  makeinfo     touch the output file
  tar          try tar, gnutar, gtar, then tar without non-portable flags
  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]

Send bug reports to <bug-automake at gnu.org>."
    exit $?
    ;;

  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
    echo "missing $scriptversion (GNU Automake)"
    exit $?
    ;;

  -*)
    echo 1>&2 "$0: Unknown \`$1' option"
    echo 1>&2 "Try \`$0 --help' for more information"
    exit 1
    ;;

esac

# Now exit if we have it, but it failed.  Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case "$1" in
  lex|yacc)
    # Not GNU programs, they don't have --version.
    ;;

  tar)
    if test -n "$run"; then
       echo 1>&2 "ERROR: \`tar' requires --run"
       exit 1
    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
       exit 1
    fi
    ;;

  *)
    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
       # We have it, but it failed.
       exit 1
    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
       # Could not run --version or --help.  This is probably someone
       # running `$TOOL --version' or `$TOOL --help' to check whether
       # $TOOL exists and not knowing $TOOL uses missing.
       exit 1
    fi
    ;;
esac

# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
  aclocal*)
    echo 1>&2 "\
WARNING: \`$1' is $msg.  You should only need it if
         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
         to install the \`Automake' and \`Perl' packages.  Grab them from
         any GNU archive site."
    touch aclocal.m4
    ;;

  autoconf)
    echo 1>&2 "\
WARNING: \`$1' is $msg.  You should only need it if
         you modified \`${configure_ac}'.  You might want to install the
         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
         archive site."
    touch configure
    ;;

  autoheader)
    echo 1>&2 "\
WARNING: \`$1' is $msg.  You should only need it if
         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
         from any GNU archive site."
    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
    test -z "$files" && files="config.h"
    touch_files=
    for f in $files; do
      case "$f" in
      *:*) touch_files="$touch_files "`echo "$f" |
				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
      *) touch_files="$touch_files $f.in";;
      esac
    done
    touch $touch_files
    ;;

  automake*)
    echo 1>&2 "\
WARNING: \`$1' is $msg.  You should only need it if
         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
         You might want to install the \`Automake' and \`Perl' packages.
         Grab them from any GNU archive site."
    find . -type f -name Makefile.am -print |
	   sed 's/\.am$/.in/' |
	   while read f; do touch "$f"; done
    ;;

  autom4te)
    echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
         You might have modified some files without having the
         proper tools for further handling them.
         You can get \`$1' as part of \`Autoconf' from any GNU
         archive site."

    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
    if test -f "$file"; then
	touch $file
    else
	test -z "$file" || exec >$file
	echo "#! /bin/sh"
	echo "# Created by GNU Automake missing as a replacement of"
	echo "#  $ $@"
	echo "exit 0"
	chmod +x $file
	exit 1
    fi
    ;;

  bison|yacc)
    echo 1>&2 "\
WARNING: \`$1' $msg.  You should only need it if
         you modified a \`.y' file.  You may need the \`Bison' package
         in order for those modifications to take effect.  You can get
         \`Bison' from any GNU archive site."
    rm -f y.tab.c y.tab.h
    if [ $# -ne 1 ]; then
        eval LASTARG="\${$#}"
	case "$LASTARG" in
	*.y)
	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
	    if [ -f "$SRCFILE" ]; then
	         cp "$SRCFILE" y.tab.c
	    fi
	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
	    if [ -f "$SRCFILE" ]; then
	         cp "$SRCFILE" y.tab.h
	    fi
	  ;;
	esac
    fi
    if [ ! -f y.tab.h ]; then
	echo >y.tab.h
    fi
    if [ ! -f y.tab.c ]; then
	echo 'main() { return 0; }' >y.tab.c
    fi
    ;;

  lex|flex)
    echo 1>&2 "\
WARNING: \`$1' is $msg.  You should only need it if
         you modified a \`.l' file.  You may need the \`Flex' package
         in order for those modifications to take effect.  You can get
         \`Flex' from any GNU archive site."
    rm -f lex.yy.c
    if [ $# -ne 1 ]; then
        eval LASTARG="\${$#}"
	case "$LASTARG" in
	*.l)
	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
	    if [ -f "$SRCFILE" ]; then
	         cp "$SRCFILE" lex.yy.c
	    fi
	  ;;
	esac
    fi
    if [ ! -f lex.yy.c ]; then
	echo 'main() { return 0; }' >lex.yy.c
    fi
    ;;

  help2man)
    echo 1>&2 "\
WARNING: \`$1' is $msg.  You should only need it if
	 you modified a dependency of a manual page.  You may need the
	 \`Help2man' package in order for those modifications to take
	 effect.  You can get \`Help2man' from any GNU archive site."

    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
    if test -z "$file"; then
	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
    fi
    if [ -f "$file" ]; then
	touch $file
    else
	test -z "$file" || exec >$file
	echo ".ab help2man is required to generate this page"
	exit 1
    fi
    ;;

  makeinfo)
    echo 1>&2 "\
WARNING: \`$1' is $msg.  You should only need it if
         you modified a \`.texi' or \`.texinfo' file, or any other file
         indirectly affecting the aspect of the manual.  The spurious
         call might also be the consequence of using a buggy \`make' (AIX,
         DU, IRIX).  You might want to install the \`Texinfo' package or
         the \`GNU make' package.  Grab either from any GNU archive site."
    # The file to touch is that specified with -o ...
    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
    if test -z "$file"; then
      # ... or it is the one specified with @setfilename ...
      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
      # ... or it is derived from the source name (dir/f.texi becomes f.info)
      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
    fi
    touch $file
    ;;

  tar)
    shift

    # We have already tried tar in the generic part.
    # Look for gnutar/gtar before invocation to avoid ugly error
    # messages.
    if (gnutar --version > /dev/null 2>&1); then
       gnutar "$@" && exit 0
    fi
    if (gtar --version > /dev/null 2>&1); then
       gtar "$@" && exit 0
    fi
    firstarg="$1"
    if shift; then
	case "$firstarg" in
	*o*)
	    firstarg=`echo "$firstarg" | sed s/o//`
	    tar "$firstarg" "$@" && exit 0
	    ;;
	esac
	case "$firstarg" in
	*h*)
	    firstarg=`echo "$firstarg" | sed s/h//`
	    tar "$firstarg" "$@" && exit 0
	    ;;
	esac
    fi

    echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
         You may want to install GNU tar or Free paxutils, or check the
         command line arguments."
    exit 1
    ;;

  *)
    echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
         You might have modified some files without having the
         proper tools for further handling them.  Check the \`README' file,
         it often tells you about the needed prerequisites for installing
         this package.  You may also peek at any GNU archive site, in case
         some other package would contain this missing \`$1' program."
    exit 1
    ;;
esac

exit 0

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

--- NEW FILE: nano.spec ---
%define name	nano
%define ver	1.2.5
%define rel	1

Summary	: Pico editor clone with enhancements
Name		: %{name}
Version		: %{ver}
Release		: %{rel}
Copyright	: GPL
Group		: Console/Editors
URL		: http://www.nano-editor.org
Source		: http://www.nano-editor.org/dist/v1.2/%{name}-%{ver}.tar.gz
BuildRoot	: /var/tmp/%{name}-buildroot
Requires	: ncurses

%description
GNU nano is a small and friendly text editor.  It aims to emulate the Pico
text editor while also offering a few enhancements.

%prep
%setup -q

%build
%configure --enable-all
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"

%install
rm -rf "$RPM_BUILD_ROOT"
make DESTDIR="$RPM_BUILD_ROOT" install

%files
%defattr(-,root,root)
%doc AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README THANKS TODO nanorc.sample
%{_bindir}/nano
%{_mandir}/*/*
%{_datadir}/locale/*/LC_MESSAGES/nano.mo
%{_infodir}/nano.info*

%changelog
* Sat Mar 30 2002 Chris Allegretta <chrisa at asty.org>
- Accepted into main distribution
- Added Packager and URL tage from original spec file.
* Tue Mar 06 2002 Brett Pemberton <generica at email.com>
- Initial spec-file

--- NEW FILE: texinfo.tex ---
% texinfo.tex -- TeX macros to handle Texinfo files.
%
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
\def\texinfoversion{2005-01-30.17}
%
% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
% Foundation, Inc.
%
% This texinfo.tex file is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
% published by the Free Software Foundation; either version 2, or (at
% your option) any later version.
%
% This texinfo.tex file is distributed in the hope that it will be
% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
[...7047 lines suppressed...]

% These look ok in all fonts, so just make them not special.
@catcode`@& = @other
@catcode`@# = @other
@catcode`@% = @other


@c Local variables:
@c eval: (add-hook 'write-file-hooks 'time-stamp)
@c page-delimiter: "^\\\\message"
@c time-stamp-start: "def\\\\texinfoversion{"
@c time-stamp-format: "%:y-%02m-%02d.%02H"
@c time-stamp-end: "}"
@c End:

@c vim:sw=2:

@ignore
   arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
@end ignore

--- NEW FILE: nanorc.5.html ---
<HTML><HEAD><TITLE>Manpage of NANORC</TITLE>
</HEAD><BODY>
<H1>NANORC</H1>
Section: File Formats (5)<BR>Updated: June 19, 2003<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>



<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>

nanorc - GNU nano's rcfile
<A NAME="lbAC">&nbsp;</A>
<H2>DESCRIPTION</H2>

This manual page documents GNU <B>nano</B>'s rcfile.
<P>

<B>nano</B> is a small, free and friendly editor which aims to replace
Pico, the default editor included in the non-free Pine package. Rather
than just copying Pico's look and feel, <B>nano</B> also implements some
missing (or disabled by default) features in Pico, such as &quot;search and
replace&quot; and &quot;go to line number&quot;.
<P>

The <I>nanorc</I> file contains the default settings for <B>nano</B>. 
During startup, <B>nano</B> will first read its system-wide settings from
<I>$SYSCONFDIR/nanorc</I>,

and then user-specific settings from
<I>~/.nanorc</I>.

<P>
<A NAME="lbAD">&nbsp;</A>
<H2>OPTIONS</H2>

The configuration file accepts a series of &quot;set&quot; and &quot;unset&quot; commands,
which can be used to configure nano on startup without using the
command-line options. Additionally, the &quot;syntax&quot; and &quot;color&quot; keywords
are used to define syntax highlighting rules for different text patterns.
GNU nano will read one command per line.
<P>
Options in rcfiles take precedence over nano's defaults, and command line
options override rcfile settings.
<P>
Options are unset by default, except for options that take an argument.
<P>
The supported commands and arguments are:
<P>
<DL COMPACT>
<DT><B>set/unset autoindent</B><DD>
Use auto-indentation.
<DT><B>set/unset backup</B><DD>
Create backup files in
<I>filename~</I>.

<DT><B>set/unset const</B><DD>
Constantly display the cursor position in the status bar.
<DT><B>set/unset cut</B><DD>
Use cut to end of line with ^K by default.
<DT><B>set fill </B><I>n</I><DD>
Wrap lines at column number <I>n</I>.  If <I>n</I> is 0 or less, the line
length will be the screen width less <I>n</I>.  The default value is -8.
<DT><B>set/unset historylog</B><DD>
Enable
<I>~/.nano_history</I>

for saving and reading search/replace strings.
<DT><B>set/unset keypad</B><DD>
Use alternate keypad routines.
<DT><B>set/unset multibuffer</B><DD>
Allow inserting files into their own buffers.
<DT><B>set/unset noconvert</B><DD>
Don't convert files from DOS/Mac format.
<DT><B>set/unset nofollow</B><DD>
Don't follow symlinks when writing files.
<DT><B>set/unset nohelp</B><DD>
Don't display the help lists at the bottom of the screen.
<DT><B>set/unset nowrap</B><DD>
Don't wrap text at all.
<DT><B>set operatingdir &quot;</B><I>directory</I>&quot;<DD>
<B>nano</B> will only read and write files inside <I>directory</I> and its
subdirectories.  Also, the current directory is changed to here, so files
are inserted from this dir.  By default the operating directory feature is
turned off.
<DT><B>set/unset preserve</B><DD>
Preserve the XON and XOFF keys (^Q and ^S).
<DT><B>set quotestr &quot;</B><I>string</I>&quot;<DD>
The email-quote string, used to justify email-quoted paragraphs.  This is
an &quot;extended regular expression&quot; if your system supports them, otherwise a
literal string.  The default value is
<P>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>set quotestr &quot;^([&nbsp;\t]*[|&gt;:}#])+&quot;<BR>
<P>
if you have regexps, otherwise set quotestr &quot;&gt;&nbsp;&quot;.  Note that '\t' 
above stands for a literal Tab character.
<DT><B>set/unset regexp</B><DD>
Do regular expression searches by default.
<DT><B>set/unset smooth</B><DD>
Use smooth scrolling by default.
<DT><B>set speller </B><I>spellprog</I><DD>
Use spelling checker <I>spellprog</I> instead of the built-in one, which
calls <I>spell</I>.
<DT><B>set/unset suspend</B><DD>
Allow nano to be suspended with ^Z.
<DT><B>set tabsize </B><I>n</I><DD>
Use a tab size of <I>n</I> instead of the default (8); must be greater 
than 0.
<DT><B>set/unset tempfile</B><DD>
Save automatically on exit, don't prompt.
<DT><B>set/unset view</B><DD>
Disallow file modification.
<DT><B>syntax </B><I>str</I> [<I>fileregex</I> ... ]

<DD>
Defines a syntax named <I>str</I> which can be activated via the 
<B>-Y</B> flag, or will be automatically activated if the current 
filename matches <I>fileregex</I>.  All following <B>color</B> statements 
will apply to <I>syntax</I> until a new syntax is defined.
<DT><B>color </B><I>fgcolor</I>[,<I>bgcolor</I>] <I>regex</I> ...

<DD>
For the currently defined syntax, display all expressions matching 
<I>regex</I> with foreground color <I>fgcolor</I> and optional background 
color <I>bgcolor</I>. Legal colors for foreground and background color are: 
white, black, red, blue, green, yellow, magenta, and cyan.  You may use 
the prefix &quot;bright&quot; to force a stronger color highlight.  If your 
terminal supports transparency, not specifying a <I>bgcolor</I> tells 
<B>nano</B> to attempt to use a transparent background.
<DT><B>color </B><I>fgcolor</I>[,<I>bgcolor</I>] start=<I>sr</I> end=<I>er</I>

<DD>
Display expressions which start with <I>sr</I> and end with <I>er</I> 
with foreground color <I>fgcolor</I> and optional 
background color <I>bgcolor</I>.  This allows syntax highlighting to span 
multiple lines.  Note that all subsequent instances of <I>sr</I> after 
an initial <I>sr</I> is found will be highlighted until the first 
instance of <I>er</I>.
<I>
<P>
</DL>
</I><A NAME="lbAE">&nbsp;</A>
<H2>FILES</H2>

<DL COMPACT>
<DT><I>$SYSCONFDIR/nanorc</I>

<DD>
System-wide configuration file
<DT><I>~/.nanorc</I>

<DD>
Per-user configuration file
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>SEE ALSO</H2>


<DL COMPACT>
<DT><B><A HREF="http://localhost/cgi-bin/man/man2html?1+nano">nano</A></B>(1)<DD>
</DL>
<P>

<I>/usr/share/doc/nano/examples/nanorc.sample</I> (or equivalent on your 
system)
<A NAME="lbAG">&nbsp;</A>
<H2>AUTHOR</H2>

Chris Allegretta &lt;<A HREF="mailto:chrisa at asty.org">chrisa at asty.org</A>&gt;, et al (see
<I>AUTHORS</I>

and
<I>THANKS</I>

for details).
This manual page was written by Jordi Mallach &lt;<A HREF="mailto:jordi at gnu.org">jordi at gnu.org</A>&gt;.
<P>

<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</A><DD>
<DT><A HREF="#lbAC">DESCRIPTION</A><DD>
<DT><A HREF="#lbAD">OPTIONS</A><DD>
<DT><A HREF="#lbAE">FILES</A><DD>
<DT><A HREF="#lbAF">SEE ALSO</A><DD>
<DT><A HREF="#lbAG">AUTHOR</A><DD>
</DL>
<HR>
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 22:28:00 GMT, June 19, 2003
</BODY>
</HTML>

--- NEW FILE: rcfile.c ---
/* $Id: rcfile.c,v 1.1 2006-08-16 23:41:03 stsp Exp $ */
/**************************************************************************
 *   rcfile.c                                                             *
 *                                                                        *
 *   Copyright (C) 1999-2003 Chris Allegretta                             *
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
 *   the Free Software Foundation; either version 2, or (at your option)  *
 *   any later version.                                                   *
 *                                                                        *
 *   This program is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *   GNU General Public License for more details.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
 **************************************************************************/

#include "config.h"

#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pwd.h>
#include <assert.h>
#include "proto.h"
#include "nano.h"

#ifdef ENABLE_NANORC

const static rcoption rcopts[] = {
#ifndef NANO_SMALL
    {"autoindent", AUTOINDENT},
    {"backup", BACKUP_FILE},
#endif
    {"const", CONSTUPDATE},
#ifndef NANO_SMALL
    {"cut", CUT_TO_END},
#endif
#ifndef DISABLE_WRAPJUSTIFY
    {"fill", 0},
#endif
    {"keypad", ALT_KEYPAD},
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
    {"mouse", USE_MOUSE},
#endif
#ifdef ENABLE_MULTIBUFFER
    {"multibuffer", MULTIBUFFER},
#endif
#ifndef NANO_SMALL
    {"noconvert", NO_CONVERT},
#endif
    {"nofollow", NOFOLLOW_SYMLINKS},
    {"nohelp", NO_HELP},
#ifndef DISABLE_WRAPPING
    {"nowrap", NO_WRAP},
#endif
#ifndef DISABLE_OPERATINGDIR
    {"operatingdir", 0},
#endif
    {"preserve", PRESERVE},
#ifndef DISABLE_JUSTIFY
    {"quotestr", 0},
#endif
#ifdef HAVE_REGEX_H
    {"regexp", USE_REGEXP},
#endif
#ifndef NANO_SMALL
    {"smooth", SMOOTHSCROLL},
#endif
#ifndef DISABLE_SPELLER
    {"speller", 0},
#endif
    {"suspend", SUSPEND},
    {"tabsize", 0},
    {"tempfile", TEMP_OPT},
    {"view", VIEW_MODE},
#ifndef NANO_SMALL
    {"historylog", HISTORYLOG},
#endif
    {NULL, 0}
};

static int errors = 0;
static int lineno = 0;
static char *nanorc;

/* 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. */
void rcfile_error(const char *msg, ...)
{
    va_list ap;

    fprintf(stderr, "\n");
    if (lineno > 0)
	fprintf(stderr, _("Error in %s on line %d: "), nanorc, lineno);

    va_start(ap, msg);
    vfprintf(stderr, msg, ap);
    va_end(ap);
    fprintf(stderr, _("\nPress return to continue starting nano\n"));

    while (getchar() != '\n');
}

/* Just print the error (one of many, perhaps) but don't abort, yet. */
void rcfile_msg(const char *msg, ...)
{
    va_list ap;

    if (!errors) {
	errors = 1;
	fprintf(stderr, "\n");
    }
    va_start(ap, msg);
    vfprintf(stderr, msg, ap);
    va_end(ap);
    fprintf(stderr, "\n");
}

/* Parse the next word from the string.  Returns NULL if we hit EOL. */
char *parse_next_word(char *ptr)
{
    while (*ptr != ' ' && *ptr != '\t' && *ptr != '\n' && *ptr != '\0')
	ptr++;

    if (*ptr == '\0')
	return NULL;

    /* Null terminate and advance ptr */
    *ptr++ = 0;

    while (*ptr == ' ' || *ptr == '\t')
	ptr++;

    return ptr;
}

/* The keywords operatingdir, fill, tabsize, speller, and quotestr take
 * an argument when set.  Among these, operatingdir, speller, and
 * quotestr have to allow tabs and spaces in the argument.  Thus, if the
 * next word starts with a ", we say it ends with the last " of the line.
 * Otherwise, the word is interpreted as usual.  That is so the arguments
 * can contain "s too. */
char *parse_argument(char *ptr)
{
    const char *ptr_bak = ptr;
    char *last_quote = NULL;

    assert(ptr != NULL);

    if (*ptr != '"')
	return parse_next_word(ptr);

    do {
	ptr++;
	if (*ptr == '"')
	    last_quote = ptr;
    } while (*ptr != '\n' && *ptr != '\0');

    if (last_quote == NULL) {
	if (*ptr == '\0')
	    ptr = NULL;
	else
	    *ptr++ = '\0';
	rcfile_error(_("argument %s has unterminated \""), ptr_bak);
    } else {
	*last_quote = '\0';
	ptr = last_quote + 1;
    }
    if (ptr != NULL)
	while (*ptr == ' ' || *ptr == '\t')
	    ptr++;
    return ptr;
}

#ifdef ENABLE_COLOR

int colortoint(const char *colorname, int *bright)
{
    int mcolor = 0;

    if (colorname == NULL)
	return -1;

    if (!strncasecmp(colorname, "bright", 6)) {
	*bright = 1;
	colorname += 6;
    }

    if (!strcasecmp(colorname, "green"))
	mcolor = COLOR_GREEN;
    else if (!strcasecmp(colorname, "red"))
	mcolor = COLOR_RED;
    else if (!strcasecmp(colorname, "blue"))
	mcolor = COLOR_BLUE;
    else if (!strcasecmp(colorname, "white"))
	mcolor = COLOR_WHITE;
    else if (!strcasecmp(colorname, "yellow"))
	mcolor = COLOR_YELLOW;
    else if (!strcasecmp(colorname, "cyan"))
	mcolor = COLOR_CYAN;
    else if (!strcasecmp(colorname, "magenta"))
	mcolor = COLOR_MAGENTA;
    else if (!strcasecmp(colorname, "black"))
	mcolor = COLOR_BLACK;
    else {
	rcfile_error(_("color %s not understood.\n"
		       "Valid colors are \"green\", \"red\", \"blue\", \n"
		       "\"white\", \"yellow\", \"cyan\", \"magenta\" and \n"
		       "\"black\", with the optional prefix \"bright\".\n"),
			colorname);
	mcolor = -1;
    }
    return mcolor;
}

char *parse_next_regex(char *ptr)
{
    while ((*ptr != '"' || (*(ptr + 1) != ' ' && *(ptr + 1) != '\n'))
	   && *ptr != '\n' && *ptr != '\0')
	ptr++;

    if (*ptr == '\0')
	return NULL;

    /* Null terminate and advance ptr */
    *ptr++ = '\0';

    while (*ptr == ' ' || *ptr == '\t')
	ptr++;

    return ptr;
}

/* Compile the regular expression regex to preg.  Returns FALSE on success,
   TRUE if the expression is invalid. */
int nregcomp(regex_t *preg, const char *regex, int flags)
{
    int rc = regcomp(preg, regex, REG_EXTENDED | flags);

    if (rc != 0) {
	size_t len = regerror(rc, preg, NULL, 0);
	char *str = charalloc(len);

	regerror(rc, preg, str, len);
	rcfile_error(_("Bad regex \"%s\": %s"), regex, str);
	free(str);
    }
    return rc != 0;
}

void parse_syntax(char *ptr)
{
    syntaxtype *tmpsyntax = NULL;
    const char *fileregptr = NULL, *nameptr = NULL;
    exttype *endext = NULL;
	/* The end of the extensions list for this syntax. */

    while (*ptr == ' ')
	ptr++;

    if (*ptr == '\n' || *ptr == '\0')
	return;

    if (*ptr != '"') {
	rcfile_error(_("regex strings must begin and end with a \" character\n"));
	return;
    }
    ptr++;

    nameptr = ptr;
    ptr = parse_next_regex(ptr);

    if (ptr == NULL) {
	rcfile_error(_("Missing syntax name"));
	return;
    }

    if (syntaxes == NULL) {
	syntaxes = (syntaxtype *)nmalloc(sizeof(syntaxtype));
	tmpsyntax = syntaxes;
	SET(COLOR_SYNTAX);
    } else {
	for (tmpsyntax = syntaxes; tmpsyntax->next != NULL;
		tmpsyntax = tmpsyntax->next)
	    ;
	tmpsyntax->next = (syntaxtype *)nmalloc(sizeof(syntaxtype));
	tmpsyntax = tmpsyntax->next;
#ifdef DEBUG
	fprintf(stderr, "Adding new syntax after 1st\n");
#endif
    }
    tmpsyntax->desc = mallocstrcpy(NULL, nameptr);
    tmpsyntax->color = NULL;
    tmpsyntax->extensions = NULL;
    tmpsyntax->next = NULL;
#ifdef DEBUG
    fprintf(stderr, "Starting a new syntax type\n");
    fprintf(stderr, "string val=%s\n", nameptr);
#endif

    /* Now load in the extensions to their part of the struct */
    while (*ptr != '\n' && *ptr != '\0') {
	exttype *newext;
	    /* The new extension structure. */

	while (*ptr != '"' && *ptr != '\n' && *ptr != '\0')
	    ptr++;

	if (*ptr == '\n' || *ptr == '\0')
	    return;
	ptr++;

	fileregptr = ptr;
	ptr = parse_next_regex(ptr);

	newext = (exttype *)nmalloc(sizeof(exttype));
	if (nregcomp(&newext->val, fileregptr, REG_NOSUB))
	    free(newext);
	else {
	    if (endext == NULL)
		tmpsyntax->extensions = newext;
	    else
		endext->next = newext;
	    endext = newext;
	    endext->next = NULL;
	}
    }
}

/* Parse the color stuff into the colorstrings array */
void parse_colors(char *ptr)
{
    int fg, bg, bright = 0;
    int expectend = 0;		/* Do we expect an end= line? */
    char *fgstr;
    colortype *tmpcolor = NULL;
    syntaxtype *tmpsyntax = NULL;

    fgstr = ptr;
    ptr = parse_next_word(ptr);

    if (ptr == NULL) {
	rcfile_error(_("Missing color name"));
	return;
    }

    if (strstr(fgstr, ",")) {
	strtok(fgstr, ",");
	bg = colortoint(strtok(NULL, ","), &bright);
    } else
	bg = -1;

    fg = colortoint(fgstr, &bright);

    /* Don't try and parse screwed up fg colors */
    if (fg == -1)
	return;

    if (syntaxes == NULL) {
	rcfile_error(_("Cannot add a color directive without a syntax line"));
	return;
    }

    for (tmpsyntax = syntaxes; tmpsyntax->next != NULL;
	 tmpsyntax = tmpsyntax->next)
	;

    /* Now the fun part, start adding regexps to individual strings
       in the colorstrings array, woo! */

    while (*ptr != '\0') {
	colortype *newcolor;
	    /* The new color structure. */
	int cancelled = 0;
	    /* The start expression was bad. */

	while (*ptr == ' ')
	    ptr++;

	if (*ptr == '\n' || *ptr == '\0')
	    break;

	if (!strncasecmp(ptr, "start=", 6)) {
	    ptr += 6;
	    expectend = 1;
	}

	if (*ptr != '"') {
	    rcfile_error(_("regex strings must begin and end with a \" character\n"));
	    ptr = parse_next_regex(ptr);
	    continue;
	}
	ptr++;

	newcolor = (colortype *)nmalloc(sizeof(colortype));
	fgstr = ptr;
	ptr = parse_next_regex(ptr);
	if (nregcomp(&newcolor->start, fgstr, 0)) {
	    free(newcolor);
	    cancelled = 1;
	} else {
	    newcolor->fg = fg;
	    newcolor->bg = bg;
	    newcolor->bright = bright;
	    newcolor->next = NULL;
	    newcolor->end = NULL;

	    if (tmpsyntax->color == NULL) {
		tmpsyntax->color = newcolor;
#ifdef DEBUG
		fprintf(stderr, "Starting a new colorstring for fg %d bg %d\n",
			fg, bg);
#endif
	    } else {
		for (tmpcolor = tmpsyntax->color; tmpcolor->next != NULL;
			tmpcolor = tmpcolor->next)
		    ;
#ifdef DEBUG
		fprintf(stderr, "Adding new entry for fg %d bg %d\n", fg, bg);
#endif
		tmpcolor->next = newcolor;
	    }
	}

	if (expectend) {
	    if (ptr == NULL || strncasecmp(ptr, "end=", 4)) {
		rcfile_error(_
			     ("\"start=\" requires a corresponding \"end=\""));
		return;
	    }

	    ptr += 4;

	    if (*ptr != '"') {
		rcfile_error(_
			     ("regex strings must begin and end with a \" character\n"));
		continue;
	    }
	    ptr++;

	    fgstr = ptr;
	    ptr = parse_next_regex(ptr);

	    /* If the start regex was invalid, skip past the end regex to
	     * stay in sync. */
	    if (cancelled)
		continue;
	    newcolor->end = (regex_t *)nmalloc(sizeof(regex_t));
	    if (nregcomp(newcolor->end, fgstr, 0)) {
		free(newcolor->end);
		newcolor->end = NULL;
	    }
	}
    }
}

#endif /* ENABLE_COLOR */

/* Parse the RC file, once it has been opened successfully */
void parse_rcfile(FILE *rcstream)
{
    char *buf, *ptr, *keyword, *option;
    int set = 0, i, j;

    buf = charalloc(1024);
    while (fgets(buf, 1023, rcstream) != 0) {
	lineno++;
	ptr = buf;
	while (*ptr == ' ' || *ptr == '\t')
	    ptr++;

	if (*ptr == '\n' || *ptr == '\0')
	    continue;

	if (*ptr == '#') {
#ifdef DEBUG
	    fprintf(stderr, "%s: Read a comment\n", "parse_rcfile()");
#endif
	    continue;		/* Skip past commented lines */
	}

	/* Else skip to the next space */
	keyword = ptr;
	ptr = parse_next_word(ptr);
	if (ptr == NULL)
	    continue;

	/* Else try to parse the keyword */
	if (!strcasecmp(keyword, "set"))
	    set = 1;
	else if (!strcasecmp(keyword, "unset"))
	    set = -1;
#ifdef ENABLE_COLOR
	else if (!strcasecmp(keyword, "syntax"))
	    parse_syntax(ptr);
	else if (!strcasecmp(keyword, "color"))
	    parse_colors(ptr);
#endif				/* ENABLE_COLOR */
	else {
	    rcfile_msg(_("command %s not understood"), keyword);
	    continue;
	}

	option = ptr;
	ptr = parse_next_word(ptr);
	/* We don't care if ptr == NULL, as it should if using proper syntax */

	if (set != 0) {
	    for (i = 0; rcopts[i].name != NULL; i++) {
		if (!strcasecmp(option, rcopts[i].name)) {
#ifdef DEBUG
		    fprintf(stderr, "%s: Parsing option %s\n", 
			    "parse_rcfile()", rcopts[i].name);
#endif
		    if (set == 1) {
			if (!strcasecmp(rcopts[i].name, "tabsize")
#ifndef DISABLE_OPERATINGDIR
				|| !strcasecmp(rcopts[i].name, "operatingdir")
#endif
#ifndef DISABLE_WRAPJUSTIFY
				|| !strcasecmp(rcopts[i].name, "fill")
#endif
#ifndef DISABLE_JUSTIFY
				|| !strcasecmp(rcopts[i].name, "quotestr")
#endif
#ifndef DISABLE_SPELLER
				|| !strcasecmp(rcopts[i].name, "speller")
#endif
				) {
			    if (*ptr == '\n' || *ptr == '\0') {
				rcfile_error(_
					     ("option %s requires an argument"),
					     rcopts[i].name);
				continue;
			    }
			    option = ptr;
			    if (*option == '"')
				option++;
			    ptr = parse_argument(ptr);
#ifdef DEBUG
			    fprintf(stderr, "option = %s\n", option);
#endif
#ifndef DISABLE_OPERATINGDIR
			    if (!strcasecmp(rcopts[i].name, "operatingdir"))
				operating_dir = mallocstrcpy(NULL, option);
			    else
#endif
#ifndef DISABLE_WRAPJUSTIFY
			    if (!strcasecmp(rcopts[i].name, "fill")) {
				char *first_error;

				/* Using strtol() instead of atoi() lets
				 * us accept 0 while checking other
				 * errors. */
				j = (int)strtol(option, &first_error, 10);
				if (errno == ERANGE || *option == '\0' || *first_error != '\0')
				    rcfile_error(_("requested fill size %d invalid"),
						 j);
				else
				    wrap_at = j;
			    } else
#endif
#ifndef DISABLE_JUSTIFY
			    if (!strcasecmp(rcopts[i].name, "quotestr"))
				quotestr = mallocstrcpy(NULL, option);
			    else
#endif
#ifndef DISABLE_SPELLER
			    if (!strcasecmp(rcopts[i].name, "speller"))
				alt_speller = mallocstrcpy(NULL, option);
			    else
#endif
			    {
				char *first_error;

				/* Using strtol instead of atoi lets us
				 * accept 0 while checking other
				 * errors. */
				j = (int)strtol(option, &first_error, 10);
				if (errno == ERANGE || *option == '\0' || *first_error != '\0')
				    rcfile_error(_("requested tab size %d invalid"),
						 j);
				else
				    tabsize = j;
			    }
			} else
			    SET(rcopts[i].flag);
#ifdef DEBUG
			fprintf(stderr, "set flag %d!\n",
				rcopts[i].flag);
#endif
		    } else {
			UNSET(rcopts[i].flag);
#ifdef DEBUG
			fprintf(stderr, "unset flag %d!\n",
				rcopts[i].flag);
#endif
		    }
		}
	    }
	}
    }
    free(buf);
    if (errors)
	rcfile_error(_("Errors found in .nanorc file"));

    return;
}

/* The main rc file function, tries to open the rc file */
void do_rcfile(void)
{
    FILE *rcstream;
    const struct passwd *userage;
    uid_t euid = geteuid();
    char *homenv = getenv("HOME");

#ifdef SYSCONFDIR
    assert(sizeof(SYSCONFDIR) == strlen(SYSCONFDIR) + 1);
    nanorc = charalloc(sizeof(SYSCONFDIR) + 7);
    sprintf(nanorc, "%s/nanorc", SYSCONFDIR);
    /* Try to open system nanorc */
    if ((rcstream = fopen(nanorc, "r")) != NULL) {
	/* Parse it! */
	parse_rcfile(rcstream);
	fclose(rcstream);
    }
#endif

    lineno = 0;

    /* Rely on $HOME, fall back on getpwuid() */
    if (homenv != NULL) {
	nanorc = charealloc(nanorc, strlen(homenv) + 10);
	sprintf(nanorc, "%s/.nanorc", homenv);
    } else {
	userage = getpwuid(euid);
	endpwent();

	if (userage == NULL) {
	    rcfile_error(_("I can't find my home directory!  Wah!"));
	    SET(NO_RCFILE);
	} else {
	    nanorc = charealloc(nanorc, strlen(userage->pw_dir) + 9);
	    sprintf(nanorc, "%s/.nanorc", userage->pw_dir);

	}
    }

    if (!ISSET(NO_RCFILE)) {

#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
    /* If we've already read $SYSCONFDIR/nanorc (if it's there), we're
       root, and --disable-wrapping-as-root is used, turn wrapping off */
	if (euid == NANO_ROOT_UID)
	    SET(NO_WRAP);
#endif
	if ((rcstream = fopen(nanorc, "r")) == NULL) {
	    /* Don't complain about the file not existing */
	    if (errno != ENOENT) {
		rcfile_error(_("Unable to open ~/.nanorc file, %s"),
			strerror(errno));
		SET(NO_RCFILE);
	    }
	} else {
	    parse_rcfile(rcstream);
	    fclose(rcstream);
	}
    }
    lineno = 0;

    free(nanorc);
#ifdef ENABLE_COLOR
    set_colorpairs();
#endif
}

#endif /* ENABLE_NANORC */

--- NEW FILE: depcomp ---
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects

scriptversion=2005-02-09.22

# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# Originally written by Alexandre Oliva <oliva at dcc.unicamp.br>.

case $1 in
  '')
     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
     exit 1;
     ;;
  -h | --h*)
    cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]

Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.

Environment variables:
  depmode     Dependency tracking mode.
  source      Source file read by `PROGRAMS ARGS'.
  object      Object file output by `PROGRAMS ARGS'.
  DEPDIR      directory where to store dependencies.
  depfile     Dependency file to output.
  tmpdepfile  Temporary file to use when outputing dependencies.
  libtool     Whether libtool is used (yes/no).

Report bugs to <bug-automake at gnu.org>.
EOF
    exit $?
    ;;
  -v | --v*)
    echo "depcomp $scriptversion"
    exit $?
    ;;
esac

if test -z "$depmode" || test -z "$source" || test -z "$object"; then
  echo "depcomp: Variables source, object and depmode must be set" 1>&2
  exit 1
fi

# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}

rm -f "$tmpdepfile"

# Some modes work just like other modes, but use different flags.  We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write.  Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
  # HP compiler uses -M and no extra arg.
  gccflag=-M
  depmode=gcc
fi

if test "$depmode" = dashXmstdout; then
   # This is just like dashmstdout with a different argument.
   dashmflag=-xM
   depmode=dashmstdout
fi

case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff.  Hmm.
  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
  stat=$?
  if test $stat -eq 0; then :
  else
    rm -f "$tmpdepfile"
    exit $stat
  fi
  mv "$tmpdepfile" "$depfile"
  ;;

gcc)
## There are various ways to get dependency output from gcc.  Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
##   up in a subdir.  Having to rename by hand is ugly.
##   (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
##   -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
##   than renaming).
  if test -z "$gccflag"; then
    gccflag=-MD,
  fi
  "$@" -Wp,"$gccflag$tmpdepfile"
  stat=$?
  if test $stat -eq 0; then :
  else
    rm -f "$tmpdepfile"
    exit $stat
  fi
  rm -f "$depfile"
  echo "$object : \\" > "$depfile"
  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
  sed -e 's/^[^:]*: / /' \
      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header).  We avoid this by adding
## dummy dependencies for each header file.  Too bad gcc doesn't do
## this for us directly.
  tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'.  On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly.  Breaking it into two sed invocations is a workaround.
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

hp)
  # This case exists only to let depend.m4 do its work.  It works by
  # looking at the text of this script.  This case will never be run,
  # since it is checked for above.
  exit 1
  ;;

sgi)
  if test "$libtool" = yes; then
    "$@" "-Wp,-MDupdate,$tmpdepfile"
  else
    "$@" -MDupdate "$tmpdepfile"
  fi
  stat=$?
  if test $stat -eq 0; then :
  else
    rm -f "$tmpdepfile"
    exit $stat
  fi
  rm -f "$depfile"

  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
    echo "$object : \\" > "$depfile"

    # Clip off the initial element (the dependent).  Don't try to be
    # clever and replace this with sed code, as IRIX sed won't handle
    # lines with more than a fixed number of characters (4096 in
    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
    # the IRIX cc adds comments like `#:fec' to the end of the
    # dependency line.
    tr ' ' '
' < "$tmpdepfile" \
    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
    tr '
' ' ' >> $depfile
    echo >> $depfile

    # The second pass generates a dummy entry for each header file.
    tr ' ' '
' < "$tmpdepfile" \
   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
   >> $depfile
  else
    # The sourcefile does not contain any dependencies, so just
    # store a dummy comment line, to avoid errors with the Makefile
    # "include basename.Plo" scheme.
    echo "#dummy" > "$depfile"
  fi
  rm -f "$tmpdepfile"
  ;;

aix)
  # The C for AIX Compiler uses -M and outputs the dependencies
  # in a .u file.  In older versions, this file always lives in the
  # current directory.  Also, the AIX compiler puts `$object:' at the
  # start of each line; $object doesn't have directory information.
  # Version 6 uses the directory in both cases.
  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
  tmpdepfile="$stripped.u"
  if test "$libtool" = yes; then
    "$@" -Wc,-M
  else
    "$@" -M
  fi
  stat=$?

  if test -f "$tmpdepfile"; then :
  else
    stripped=`echo "$stripped" | sed 's,^.*/,,'`
    tmpdepfile="$stripped.u"
  fi

  if test $stat -eq 0; then :
  else
    rm -f "$tmpdepfile"
    exit $stat
  fi

  if test -f "$tmpdepfile"; then
    outname="$stripped.o"
    # Each line is of the form `foo.o: dependent.h'.
    # Do two passes, one to just change these to
    # `$object: dependent.h' and one to simply `dependent.h:'.
    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
  else
    # The sourcefile does not contain any dependencies, so just
    # store a dummy comment line, to avoid errors with the Makefile
    # "include basename.Plo" scheme.
    echo "#dummy" > "$depfile"
  fi
  rm -f "$tmpdepfile"
  ;;

icc)
  # Intel's C compiler understands `-MD -MF file'.  However on
  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
  # ICC 7.0 will fill foo.d with something like
  #    foo.o: sub/foo.c
  #    foo.o: sub/foo.h
  # which is wrong.  We want:
  #    sub/foo.o: sub/foo.c
  #    sub/foo.o: sub/foo.h
  #    sub/foo.c:
  #    sub/foo.h:
  # ICC 7.1 will output
  #    foo.o: sub/foo.c sub/foo.h
  # and will wrap long lines using \ :
  #    foo.o: sub/foo.c ... \
  #     sub/foo.h ... \
  #     ...

  "$@" -MD -MF "$tmpdepfile"
  stat=$?
  if test $stat -eq 0; then :
  else
    rm -f "$tmpdepfile"
    exit $stat
  fi
  rm -f "$depfile"
  # Each line is of the form `foo.o: dependent.h',
  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
  # Do two passes, one to just change these to
  # `$object: dependent.h' and one to simply `dependent.h:'.
  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
  # Some versions of the HPUX 10.20 sed can't process this invocation
  # correctly.  Breaking it into two sed invocations is a workaround.
  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
    sed -e 's/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

tru64)
   # The Tru64 compiler uses -MD to generate dependencies as a side
   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
   # dependencies in `foo.d' instead, so we check for that too.
   # Subdirectories are respected.
   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
   test "x$dir" = "x$object" && dir=
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`

   if test "$libtool" = yes; then
      # With Tru64 cc, shared objects can also be used to make a
      # static library.  This mecanism is used in libtool 1.4 series to
      # handle both shared and static libraries in a single compilation.
      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
      #
      # With libtool 1.5 this exception was removed, and libtool now
      # generates 2 separate objects for the 2 libraries.  These two
      # compilations output dependencies in in $dir.libs/$base.o.d and
      # in $dir$base.o.d.  We have to check for both files, because
      # one of the two compilations can be disabled.  We should prefer
      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
      # automatically cleaned when .libs/ is deleted, while ignoring
      # the former would cause a distcleancheck panic.
      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
      tmpdepfile2=$dir$base.o.d          # libtool 1.5
      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
      "$@" -Wc,-MD
   else
      tmpdepfile1=$dir$base.o.d
      tmpdepfile2=$dir$base.d
      tmpdepfile3=$dir$base.d
      tmpdepfile4=$dir$base.d
      "$@" -MD
   fi

   stat=$?
   if test $stat -eq 0; then :
   else
      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
      exit $stat
   fi

   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
   do
     test -f "$tmpdepfile" && break
   done
   if test -f "$tmpdepfile"; then
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
      # That's a tab and a space in the [].
      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
   else
      echo "#dummy" > "$depfile"
   fi
   rm -f "$tmpdepfile"
   ;;

#nosideeffect)
  # This comment above is used by automake to tell side-effect
  # dependency tracking mechanisms from slower ones.

dashmstdout)
  # Important note: in order to support this mode, a compiler *must*
  # always write the preprocessed file to stdout, regardless of -o.
  "$@" || exit $?

  # Remove the call to Libtool.
  if test "$libtool" = yes; then
    while test $1 != '--mode=compile'; do
      shift
    done
    shift
  fi

  # Remove `-o $object'.
  IFS=" "
  for arg
  do
    case $arg in
    -o)
      shift
      ;;
    $object)
      shift
      ;;
    *)
      set fnord "$@" "$arg"
      shift # fnord
      shift # $arg
      ;;
    esac
  done

  test -z "$dashmflag" && dashmflag=-M
  # Require at least two characters before searching for `:'
  # in the target name.  This is to cope with DOS-style filenames:
  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
  "$@" $dashmflag |
    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
  rm -f "$depfile"
  cat < "$tmpdepfile" > "$depfile"
  tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly.  Breaking it into two sed invocations is a workaround.
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

dashXmstdout)
  # This case only exists to satisfy depend.m4.  It is never actually
  # run, as this mode is specially recognized in the preamble.
  exit 1
  ;;

makedepend)
  "$@" || exit $?
  # Remove any Libtool call
  if test "$libtool" = yes; then
    while test $1 != '--mode=compile'; do
      shift
    done
    shift
  fi
  # X makedepend
  shift
  cleared=no
  for arg in "$@"; do
    case $cleared in
    no)
      set ""; shift
      cleared=yes ;;
    esac
    case "$arg" in
    -D*|-I*)
      set fnord "$@" "$arg"; shift ;;
    # Strip any option that makedepend may not understand.  Remove
    # the object too, otherwise makedepend will parse it as a source file.
    -*|$object)
      ;;
    *)
      set fnord "$@" "$arg"; shift ;;
    esac
  done
  obj_suffix="`echo $object | sed 's/^.*\././'`"
  touch "$tmpdepfile"
  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
  rm -f "$depfile"
  cat < "$tmpdepfile" > "$depfile"
  sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly.  Breaking it into two sed invocations is a workaround.
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile" "$tmpdepfile".bak
  ;;

cpp)
  # Important note: in order to support this mode, a compiler *must*
  # always write the preprocessed file to stdout.
  "$@" || exit $?

  # Remove the call to Libtool.
  if test "$libtool" = yes; then
    while test $1 != '--mode=compile'; do
      shift
    done
    shift
  fi

  # Remove `-o $object'.
  IFS=" "
  for arg
  do
    case $arg in
    -o)
      shift
      ;;
    $object)
      shift
      ;;
    *)
      set fnord "$@" "$arg"
      shift # fnord
      shift # $arg
      ;;
    esac
  done

  "$@" -E |
    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
    sed '$ s: \\$::' > "$tmpdepfile"
  rm -f "$depfile"
  echo "$object : \\" > "$depfile"
  cat < "$tmpdepfile" >> "$depfile"
  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

msvisualcpp)
  # Important note: in order to support this mode, a compiler *must*
  # always write the preprocessed file to stdout, regardless of -o,
  # because we must use -o when running libtool.
  "$@" || exit $?
  IFS=" "
  for arg
  do
    case "$arg" in
    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
	set fnord "$@"
	shift
	shift
	;;
    *)
	set fnord "$@" "$arg"
	shift
	shift
	;;
    esac
  done
  "$@" -E |
  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
  rm -f "$depfile"
  echo "$object : \\" > "$depfile"
  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
  echo "	" >> "$depfile"
  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

none)
  exec "$@"
  ;;

*)
  echo "Unknown depmode $depmode" 1>&2
  exit 1
  ;;
esac

exit 0

# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

--- NEW FILE: nanorc.5 ---
.\" Hey, EMACS: -*- nroff -*-
.\" nanorc.5 is Copyright (C) 2003 Free Software Foundation, Inc.
.\"
.\" This is free documentation, see the latest version of the GNU General
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" $Id: nanorc.5,v 1.1 2006-08-16 23:41:03 stsp Exp $
.TH NANORC 5 "June 19, 2003"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
nanorc \- GNU nano's rcfile
.SH DESCRIPTION
This manual page documents GNU \fBnano\fP's rcfile.
.PP
\fBnano\fP is a small, free and friendly editor which aims to replace
Pico, the default editor included in the non-free Pine package. Rather
than just copying Pico's look and feel, \fBnano\fP also implements some
missing (or disabled by default) features in Pico, such as "search and
replace" and "go to line number".
.PP
The \fInanorc\fP file contains the default settings for \fBnano\fP. 
During startup, \fBnano\fP will first read its system-wide settings from
.IR $SYSCONFDIR/nanorc ,
and then user-specific settings from
.IR ~/.nanorc .

.SH OPTIONS
The configuration file accepts a series of "set" and "unset" commands,
which can be used to configure nano on startup without using the
command-line options. Additionally, the "syntax" and "color" keywords
are used to define syntax highlighting rules for different text patterns.
GNU nano will read one command per line.

Options in rcfiles take precedence over nano's defaults, and command line
options override rcfile settings.

Options are unset by default, except for options that take an argument.

The supported commands and arguments are:

.TP 3
\fBset/unset autoindent\fP
Use auto-indentation.
.TP
\fBset/unset backup\fP
Create backup files in
.IR filename~ .
.TP
\fBset/unset const\fP
Constantly display the cursor position in the status bar.
.TP
\fBset/unset cut\fP
Use cut to end of line with ^K by default.
.TP
\fBset fill \fIn\fP\fP
Wrap lines at column number \fIn\fP.  If \fIn\fP is 0 or less, the line
length will be the screen width less \fIn\fP.  The default value is -8.
.TP
\fBset/unset historylog\fP
Enable
.I ~/.nano_history
for saving and reading search/replace strings.
.TP
\fBset/unset keypad\fP
Use alternate keypad routines.
.TP
\fBset/unset multibuffer\fP
Allow inserting files into their own buffers.
.TP
\fBset/unset noconvert\fP
Don't convert files from DOS/Mac format.
.TP
\fBset/unset nofollow\fP
Don't follow symlinks when writing files.
.TP
\fBset/unset nohelp\fP
Don't display the help lists at the bottom of the screen.
.TP
\fBset/unset nowrap\fP
Don't wrap text at all.
.TP
\fBset operatingdir "\fIdirectory\fP"\fP
\fBnano\fP will only read and write files inside \fIdirectory\fP and its
subdirectories.  Also, the current directory is changed to here, so files
are inserted from this dir.  By default the operating directory feature is
turned off.
.TP
\fBset/unset preserve\fP
Preserve the XON and XOFF keys (^Q and ^S).
.TP
\fBset quotestr "\fIstring\fP"\fP
The email-quote string, used to justify email-quoted paragraphs.  This is
an "extended regular expression" if your system supports them, otherwise a
literal string.  The default value is

	set quotestr "^([\ \\t]*[|>:}#])+"

if you have regexps, otherwise set quotestr ">\ ".  Note that '\\t' 
above stands for a literal Tab character.
.TP
\fBset/unset regexp\fP
Do regular expression searches by default.
.TP
\fBset/unset smooth\fP
Use smooth scrolling by default.
.TP
\fBset speller \fIspellprog\fP\fP
Use spelling checker \fIspellprog\fP instead of the built-in one, which
calls \fIspell\fP.
.TP
\fBset/unset suspend\fP
Allow nano to be suspended with ^Z.
.TP
\fBset tabsize \fIn\fP\fP
Use a tab size of \fIn\fP instead of the default (8); must be greater 
than 0.
.TP
\fBset/unset tempfile\fP
Save automatically on exit, don't prompt.
.TP
\fBset/unset view\fP
Disallow file modification.
.TP
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
Defines a syntax named \fIstr\fP which can be activated via the 
\fB-Y\fP flag, or will be automatically activated if the current 
filename matches \fIfileregex\fP.  All following \fBcolor\fP statements 
will apply to \fIsyntax\fP until a new syntax is defined.
.TP
.B color \fIfgcolor\fP[,\fIbgcolor\fP] "\fIregex\fP" ...
For the currently defined syntax, display all expressions matching 
\fIregex\fP with foreground color \fIfgcolor\fP and optional background 
color \fIbgcolor\fP. Legal colors for foreground and background color are: 
white, black, red, blue, green, yellow, magenta, and cyan.  You may use 
the prefix "bright" to force a stronger color highlight.  If your 
terminal supports transparency, not specifying a \fIbgcolor\fP tells 
\fBnano\fP to attempt to use a transparent background.
.TP
.B color \fIfgcolor\fP[,\fIbgcolor\fP] start="\fIsr\fP" end="\fIer\fP"
Display expressions which start with \fIsr\fP and end with \fIer\fP 
with foreground color \fIfgcolor\fP and optional 
background color \fIbgcolor\fP.  This allows syntax highlighting to span 
multiple lines.  Note that all subsequent instances of \fIsr\fP after 
an initial \fIsr\fP is found will be highlighted until the first 
instance of \fIer\fP.
\fI

.SH FILES
.TP
.I $SYSCONFDIR/nanorc
System-wide configuration file
.TP
.I ~/.nanorc
Per-user configuration file
.SH SEE ALSO
.PD 0
.TP
\fBnano\fP(1)
.PP
\fI/usr/share/doc/nano/examples/nanorc.sample\fP (or equivalent on your 
system)
.SH AUTHOR
Chris Allegretta <chrisa at asty.org>, et al (see
.I AUTHORS
and
.I THANKS
for details).
This manual page was written by Jordi Mallach <jordi at gnu.org>.

--- NEW FILE: TODO ---
TODO file (? means the feature may be implemented, but not definitely)
-----------------------------------------------------------------------------

For version 1.4:
- UTF-8 support.
- Support for Pico's paragraph searching ability.
- Undo/Redo key?
- Rebindable keys?
- Keystroke to implement "Add next sequence as raw" like vi's ^V.
- Spell check selected text only.
- Make "To line" (^W^T) and "Read from Command" (^R^X) re-enter their
  parent menu when their keystroke is entered a second time (^W^T^T and
  (^R^X^X)(requires figuring out when to keep cursor pos and when not
  to).
- Fix resetstatuspos global which we shouldn't have.

Old requests:

For version 1.2:
- Single line scroll up/down? [DONE]
- Color syntax highlighting? (certainly seems like there's a demand for
  it.) [DONE]
- .nanorc [DONE]
- Backup making (filename~)? [DONE]
- Search (etc.) string history [DONE]
- Implement Pico's -j and -g flags, as they are pretty easy to do.
  [DONE]
- Make mouse support work with clicking on the shortcuts (-m).  Must
  make global variable pointing to current shortcut list to determine
  what keystroke to ungetch(). [DONE].
- Implement -o (chroot of sorts) [DONE]
- Allow -r to take a negative argument, meaning right margin instead of
  left (allows resizing that way), formerly -W arg. [DONE]

For version 1.0:
- Implement Spelling [DONE]
- Implement Help [DONE]
- Internationalization [In progress, translators welcome!]
- Allow nano to be resized in X. [DONE]
- On page up/down, put the cursor on the first line (like Pico), not the
  center line [DONE]
- Rewrite edit_refresh, if at all possible [DONE]
- Implement justify function [DONE]
- Cut to end of line [DONE]
- Built-in speller command [needed for version 1.0] [DONE]
- Better statusbar interaction (scrolling, tab completion for filename)
  [needed for version 1.0] [DONE]
- Now do username completion [DONE].
- Unjustify command (^U after ^J) [DONE =-].
- Username completion (~user) [DONE =-].

$Id: TODO,v 1.1 2006-08-16 23:41:02 stsp Exp $

--- NEW FILE: faq.html ---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>The GNU nano editor FAQ</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="GENERATOR" content="Mozilla/4.73 [en] (X11; U; Linux 2.2.16 i586) [Netscape]">
</head>
<body text="#330000" bgcolor="#ffffff" link="#0000ef" vlink="#51188e" alink="#ff0000">
<h1>The nano FAQ</h1>
<h2>Table of Contents</h2>
<h2><a href="#1">1. General</a></h2>
<blockquote><p><a href="#1.1">1.1 About this FAQ</a><br>
  <a href="#1.2">1.2. How do I contribute to it?</a><br>
  <a href="#1.3">1.3. What is GNU nano?</a><br>
  <a href="#1.4">1.4. What is the history behind nano?</a><br>
  <a href="#1.5">1.5. Why the name change from TIP?</a><br>
  <a href="#1.6">1.6. What is the current version of nano?</a><br>
  <a href="#1.7">1.7. I want to read the manpage without having to download the program!</a></p></blockquote>
<h2><a href="#2">2. Where to get GNU nano.</a></h2>
<blockquote><p><a href="#2.1">2.1. FTP and WWW sites that carry nano.</a><br>
  <a href="#2.2">2.2. RedHat and derivatives (.rpm) packages.</a><br>
  <a href="#2.3">2.3. Debian (.deb) packages.</a><br>
  <a href="#2.4">2.4. By CVS (for the brave).</a></p></blockquote>
<h2><a href="#3">3. Installation and Configuration</a></h2>
<blockquote><p><a href="#3.1">3.1. How do I install the RPM or DEB package?</a><br>
  <a href="#3.2">3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</a><br>
  <a href="#3.3">3.3. Why does everything go into /usr/local?</a><br>
  <a href="#3.4">3.4. I get errors about 'bindtextdomain','gettext' and/or 'gettextdomain'. What can I do about it?</a><br>
  <a href="#3.5">3.5. Nano should automatically run strip on the binary when installing it!</a><br>
  <a href="#3.6">3.6. How can I make the executable smaller? This is too bloated!</a><br>
  <a href="#3.7">3.7. Tell me more about this multibuffer stuff!</a><br>
  <a href="#3.8">3.8. How do I make a .nanorc file that nano will read when I start it?</a></p></blockquote>
<h2><a href="#4">4. Running</a></h2>
<blockquote><p><a href="#4.1">4.1. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</a><br>
  <a href="#4.2">4.2. Nano crashes when I type &lt;insert keystroke here&gt;!</a><br>
  <a href="#4.3">4.3. Nano crashes when I resize my window. How can I fix that?</a><br>
  <a href="#4.4">4.4. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
  <a href="#4.5a">4.5a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
  <a href="#4.5b">4.5b. [version 1.2.5 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
  <a href="#4.6">4.6. I get the message &quot;NumLock glitch detected. Keypad will malfunction with NumLock off.&quot; What gives?</a><br>
  <a href="#4.7">4.7. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
  <a href="#4.8">4.8. I've compiled nano with color support, but I don't see any color when I run it!</a></p></blockquote>
<h2><a href="#5">5. Internationalization</a></h2>
<blockquote><p><a href="#5.1">5.1. There's no translation for my language!</a><br>
  <a href="#5.2">5.2. I don't like the translation for &lt;x&gt; in my language. How can I fix it?</a></p></blockquote>
<h2><a href="#6">6. Advocacy and Licensing</a></h2>
<blockquote><p><a href="#6.1">6.1. Why should I use nano instead of Pico?</a><br>
  <a href="#6.2">6.2. Why should I use Pico instead of nano?</a><br>
  <a href="#6.3">6.3. What is so bad about the Pine license?</a><br>
  <a href="#6.4">6.4. Okay, well what mail program should I use then?</a><br>
  <a href="#6.5">6.5. Why doesn't UW simply change their license?</a><br>
  <a href="#6.6">6.6. What if tomorrow UW changes the license to be truly Free Software?</a></p></blockquote>
<h2><a href="#7">7. Miscellaneous</a></h2>
<blockquote><p><a href="#7.1">7.1. Nano related mailing lists.</a><br>
  <a href="#7.2">7.2. I want to send the development team a big load of cash (or just a thank you).</a><br>
  <a href="#7.3">7.3. How do I submit a patch?</a><br>
  <a href="#7.4">7.4. How do I join the development team?</a><br>
  <a href="#7.5">7.5. Can I have CVS write access?</a></p></blockquote>
<h2><a href="#8">8. ChangeLog</a></h2>
<hr width="100%">
<h1><a name="1"></a>1. General</h1>
<h2><a name="1.1"></a>1.1 About this FAQ</h2>
<blockquote><p>This FAQ was written and is maintained by Chris Allegretta &lt;<a href="mailto:chrisa at asty.org">chrisa at asty.org</a>&gt;, who also happens to be the creator of nano. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
<h2><a name="1.2"></a>1.2. How do I contribute to it?</h2>
<blockquote><p>Your best bet is to send it to the nano email address, <a href="mailto:nano at nano-editor.org">nano at nano-editor.org</a> and if it is useful enough it will be included in future versions.</p></blockquote>
<h2><a name="1.3"></a>1.3. What is GNU nano?</h2>
<blockquote><p>GNU nano is designed to be a free replacement for the Pico text editor, part of the Pine email suite from <a href="http://www.washington.edu/pine/">The University of Washington</a>. It aims to &quot;emulate Pico as closely as possible and perhaps include extra functionality&quot;.</p></blockquote>
<h2><a name="1.4"></a>1.4. What is the history behind nano?</h2>
<blockquote><p>Funny you should ask!</p>
  <p><b>In the beginning...</b></p>
  <p>For years Pine was THE program used to read email on a Unix system. The Pico text editor is the portion of the program one would use to compose his or her mail messages. Many beginners to Unix flocked to Pico and Pine because of their well organized, easy to use interfaces. With the proliferation of GNU/Linux in the mid to late 90's, many University students became intimately familiar with the strengths (and weaknesses) of Pine and Pico.</p>
  <p><b>Then came Debian...</b></p>
  <p>The <a href="http://www.debian.org/">Debian GNU/Linux</a> distribution, known for its strict standards in distributing truly &quot;free&quot; software (i.e. software with no restrictions on redistribution), would not include a binary package for Pine or Pico. Many people had a serious dilemma: they loved these programs, but they were not truly free software in the <a href="http://www.gnu.org/philosophy/free-sw.html">GNU</a> sense of the word.</p>
  <p><b>The event...</b></p>
  <p>It was in late 1999 when Chris Allegretta (our hero) was yet again complaining to himself about the less-than-perfect license Pico was distributed under, the 1000 makefiles that came with it and how just a few small improvements could make it the Best Editor in the World (TM). Having been a convert from Slackware to Debian, he missed having a simple binary package that included Pine and Pico, and had grown tired of downloading them himself.</p>
  <p>Finally something snapped inside and Chris coded and hacked like a madman for many hours straight one weekend to make a (barely usable) Pico clone, at the time called TIP (Tip Isn't Pico). The program could not be invoked without a filename, could not save files, had no help menu, spell checker, and so forth. But over time it improved, and with the help of a few great coders it matured to the (hopefully) stable state it is today.</p>
  <p>In February 2001, nano was declared an official GNU program by Richard Stallman. Nano also reached its first production release on March 22, 2001.</p></blockquote>
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program &quot;establishes a full duplex terminal connection to a remote host&quot;, and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
<blockquote><p>The current version of nano *should* be 1.2.5. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v1.2/nano.1.html">here</a>.</p></blockquote>
<hr width="100%">
<h1><a name="2"></a>2. Where to get GNU nano.</h1>
<h2><a name="2.1"></a>2.1. FTP and WWW sites that carry nano.</h2>
<blockquote><p>The nano distribution can be downloaded at the following fine web and ftp sites:</p>
  <ul>
    <li><a href="http://www.nano-editor.org/dist/">http://www.nano-editor.org/dist/</a></li>
    <li><a href="http://www.ewtoo.org/~astyanax/nano/dist/">http://www.ewtoo.org/~astyanax/nano/dist/</a></li>
    <li><a href="ftp://ftp.gnu.org/pub/gnu/nano/">ftp://ftp.gnu.org/pub/gnu/nano/</a></li>
  </ul>
</blockquote>
<h2><a name="2.2"></a>2.2. RedHat and derivatives (.rpm) packages.</h2>
<blockquote>
  <ul>
    <li><a href="http://www.nano-editor.org/dist/v1.2/RPMS/">http://www.nano-editor.org/dist/v1.2/RPMS/</a></li>
    <li><a href="http://www.ewtoo.org/~astyanax/nano/dist/v1.2/RPMS/">http://www.ewtoo.org/~astyanax/nano/dist/v1.2/RPMS/</a></li>
  </ul>
  <p>Additionally, check out the RedHat contribs section at:</p>
  <ul>
    <li><a href="http://distro.ibiblio.org/pub/Linux/distributions/redhat/contrib/libc6/i386/">http://distro.ibiblio.org/pub/Linux/distributions/redhat/contrib/libc6/i386/</a></li>
    <li><a href="ftp://distro.ibiblio.org/pub/Linux/distributions/redhat/contrib/libc6/i386/">ftp://distro.ibiblio.org/pub/Linux/distributions/redhat/contrib/libc6/i386/</a></li>
  </ul>
</blockquote>
<h2><a name="2.3"></a>2.3. Debian (.deb) packages.</h2>
<blockquote><p>Debian users can check out the current nano packages for:</p>
  <ul>
    <li><a href="http://packages.debian.org/stable/editors/nano.html">stable</a></li>
    <li><a href="http://packages.debian.org/testing/editors/nano.html">testing</a></li>
    <li><a href="http://packages.debian.org/unstable/editors/nano.html">unstable</a></li>
  </ul>
  <p>You can also have a look at the <a href="ftp://ftp.debian.org/debian/pool/main/n/nano/">Package Pool</a> to see all the available binary and source packages.</p>
  <p>Note that versions &lt; 0.9.10 are probably not for those wanting to get serious work done, so if you are using Debian 2.2, check that you have updated to 2.2r3, which comes with nano 0.9.23. If you're tracking unstable, you probably have the newest version already.</p></blockquote>
<h2><a name="2.4"></a>2.4. By CVS (for the brave).</h2>
<blockquote><p>For the 'bleeding edge' current version of nano, you can use CVS to download the current source code. <b>Note:</b> believe it or not, by downloading code that has not yet stabilized into an official release, there could quite possibly be bugs, in fact the code may not even compile! Anyway, see <a href="http://savannah.gnu.org/cvs/?group_id=1025">the nano CVS page</a> for info on anonymous CVS access to the nano source.</p></blockquote>
<hr width="100%">
<h1><a name="3"></a>3. Installation and Configuration</h1>
<h2><a name="3.1"></a>3.1. How do install the RPM or DEB package?</h2>
<blockquote><p>It's simple really! As root, type <b>rpm -Uvh nano-x.y.z-1.i386.rpm</b> if you have a RedHat-ish system or <b>dpkg -i nano_x.y.z-1.deb</b> if you have a Debian-ish system, where <b>x.y.z</b> is the release of nano. There are other programs to install packages, and if you wish to use those, knock yourself out.</p></blockquote>
<h2><a name="3.2"></a>3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</h2>
<blockquote><p>Okay, take a deep breath, this really isn't hard. Unpack the nano source with a command like:</p>
  <p><b>tar -zxvf nano-x.y.z.tar.gz</b></p>
  <p>If you get error messages about the -z option, try this:</p>
  <p><b>gzip -dc nano-x.y.z.tar.gz | tar xvf -</b></p>
  <p>(again, where x.y.z is the version number in question). Then you need to run configure with any options you might want (if any).</p>
  <p>The average case is this:</p>
  <p><b>cd nano-x.y.z/</b><br>
  <b>./configure</b><br>
  <b>make</b><br>
  <b>make install</b> (as root, of course)</p></blockquote>
<h2><a name="3.3"></a>3.3. Why does everything go into /usr/local?</h2>
<blockquote><p>Well, that's what the <b>configure</b> script defaults to. If you wish to change this, simply do this:</p>
  <p><b>./configure --prefix=/usr</b></p>
  <p>to put nano into /usr/bin when you run <b>make install</b>.</p></blockquote>
<h2><a name="3.4"></a>3.4. I get errors about 'bindtextdomain', 'gettext' and/or 'gettextdomain'. What can I do about it?</h2>
<blockquote><p>Try doing a <b>./configure --with-included-gettext</b> and see if that solves your problem. You may need to do a <b>make clean; make</b> to get it to work fully.</p></blockquote>
<h2><a name="3.5"></a>3.5. Nano should automatically run strip on the binary when installing it!</h2>
<blockquote><p>Actually, it does, but you have to use <b>make install-strip</b>. The default make install does not, and will not, run strip automatically.</p></blockquote>
<h2><a name="3.6"></a>3.6. How can I make the executable smaller? This is too bloated!</h2>
<blockquote><p>Actually, there are several parts of the editor that can be disabled. You can pass arguments to the <b>configure</b> script that disable certain features. Here's a brief list:</p>
  <pre>
  <b>--disable-tabcomp</b>       Disables tab completion code for a smaller binary
  <b>--disable-justify</b>       Disable justify/unjustify function
  <b>--disable-speller</b>       Disables spell checker function
  <b>--disable-help</b>          Disables help function (^G)
  <b>--disable-browser</b>       Disables mini file browser
  <b>--disable-wrapping</b>      Disables all wrapping of text (and -w flag)
  <b>--disable-mouse</b>         Disables mouse support (and -m flag)
  <b>--disable-operatingdir</b>  Disable setting of operating directory</pre>
  <p>There's also the <b>--enable-tiny</b> option which disables everything above, as well as some larger chunks of the program (like the marker code that you use Control-^ to select with). Also, if you know you aren't going to be using other languages you can use <b>--disable-nls</b> to disable internationalization and save a few K to a few dozen K depending on if you have locale support on your system. And finally there's always good old <b>strip</b> to strip all debugging code and code that exists in libraries on your system.</p>
  <p>If, on the other hand, you can't live without bells and whistles, you could try:</p>
  <pre>
  <b>--enable-extra</b>          Enable extra functions, including easter eggs
  <b>--enable-nanorc</b>         Enable use of .nanorc file
  <b>--enable-color</b>          Enables color and syntax highlighting
  <b>--enable-multibuffer</b>    Enables having multiple file buffers open
  <b>--enable-all</b>            Enables all of the above features</pre></blockquote>
<h2><a name="3.7"></a>3.7. Tell me more about this multibuffer stuff!</h2>
<blockquote><p>To use multiple file buffers, you must be using nano 1.1.12 or newer, and you must have configured nano with <b>--enable-multibuffer</b> or <b>--enable-extra</b> (use nano -V to check). Then when you want to enable inserting a file into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the file as normal with <b>^R</b>.  If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano. </p>
  <p>You can move between the buffers you have open with the <b>Meta-&lt;</b> and <b>Meta-&gt;</b> keys, or more easily with <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say &quot;Close&quot;, instead of the normal &quot;Exit&quot; when only one buffer is open.</p></blockquote>
<h2><a name="3.8"></a>3.8. How do I make a .nanorc file that nano will read when I start it?</h2>
<blockquote>It's not hard at all! But, your version of nano must have been compiled with <b>--enable-nanorc</b>, and again must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the word <b>set</b> and the getopt_long flag for the feature, for example &quot;set pico&quot; or &quot;set nowrap&quot;.</blockquote>
<hr width="100%">
<h1><a name="4"></a>4. Running</h1>
<h2><a name="4.1"></a>4.1. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</h2>
<blockquote><p>Try setting your $TERM variable to 'vt100'. Nano doesn't yet support every term entry under the sun.</p>
  <p>Bourne shell users (like bash): <b>export TERM=vt100</b><br>
  C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
<h2><a name="4.2"></a>4.2. Nano crashes when I type &lt;insert keystroke here&gt;!</h2>
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel at gnu.org">nano-devel</a> list or to <a href="mailto:nano at nano-editor.org">nano at nano-editor.org</a>.</p></blockquote>
<h2><a name="4.3"></a>4.3. Nano crashes when I resize my window. How can I fix that?</h2>
<blockquote><p>Older versions of nano had this problem, please upgrade to a newer version (at least 0.9.9 would be great, 0.9.12 is recommended).</p></blockquote>
<h2><a name="4.4"></a>4.4. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
<blockquote><p>The help (^G) and justify (^J) function were among the last to be written. To show the improvements that nano had over Pico (go to line # and replace), ^_ and ^\ were put on the shortcut list. Later, ^G came back in place of ^_ as it proved to be very valuable for new Unix users. If you use the <b>-p</b> option to nano (or hit Meta-P) you will get the same shortcuts at the bottom as Pico.</p></blockquote>
<a name="4.5"></a>
<h2><a name="4.5a"></a>4.5a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
<blockquote><p>In nano version 0.9.20, the default is to have a completely consistent user interface across all user input functions. This means that regardless of whether you're being asked for a filename to insert or write, or a string to search for, the previous value is already inserted before the cursor. If you prefer the old behavior, use the Pico emulation mode (-p or --pico) or just hit Meta-P while in nano (see the ^G help text for more details).</p></blockquote>
<h2><a name="4.5b"></a>4.5b. [version 1.2.5 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
<blockquote><p>It was decided that consistency was nice, but people are used to Pico's inconsistent behavior.  Also, in version 1.1.99pre1, search and replace history was introduced.  If you wish to edit your previous search/replace entry (or any previous entry), you can do so by hitting the up arrow to cycle through your history.  This method allows the best of both worlds: You don't need to erase the previous string if you want to enter a new one, but you can with one keystroke recall previous entries for editing. Therefore there is now no "Pico mode", nano is and has always been a Pico <b>clone</b>, and clones by default should be compatible.</p></blockquote>
<h2><a name="4.6"></a>4.6. I get the message &quot;NumLock glitch detected. Keypad will malfunction with NumLock off.&quot; What gives?</h2>
<blockquote><p>Nano (and actually almost all console editors) has issues when cycling the NumLock key in certain X terminals (rxvt, aterm, wterm, etc...). When you switch NumLock from on to off, you put the terminal into an &quot;application mode&quot; that changes what sequences are sent by the keypad. These sequences vary sufficiently from terminal to terminal that it is nearly impossible to work around them from within nano.</p>
  <p>In a nutshell, if you want to be able to use the keypad with the arrow and page up/down functionality, you have to exit nano and reset your terminal (presumably with &quot;reset&quot; or &quot;stty sane&quot; or similar) and then run nano again with NumLock off. If you know an easier way to restore &quot;normal mode&quot;, please mail <a href="mailto:nano at nano-editor.org">nano at nano-editor.org</a>.</p></blockquote>
<h2><a name="4.7"></a>4.7. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
  <p><b>export EDITOR=/usr/local/bin/nano</b></p>
  <p>or if you use tcsh put this in your <b>.cshrc</b> file:</p>
  <p><b>setenv EDITOR /usr/local/bin/nano</b></p>
  <p>Change /usr/local/bin/nano to wherever nano is installed on your system. Type &quot;which nano&quot; to find out. This will not take effect until the next time you login. So log out and back in again.</p>
  <p>Then on top that if you use Pine you must go into setup (type <b>S</b> at the main menu), then configure (type <b>C</b>). Hit enter on the lines that say:</p>
  <p><b>[ ] enable-alternate-editor-cmd</b><br>
  <b>[ ] enable-alternate-editor-implicitly</b></p>
  <p>Then exit (<b>E</b>) and select Yes (<b>Y</b>).</p>
  <p>Mutt users should see an effect immediately the next time you log in, no further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
  <p><b>my_hdr X-Composer: nano x.y.z</b></p>
  <p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
<h2><a name="4.8"></a>4.8. I've compiled nano with color support, but I don't see any color when I run it!</h2>
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Some example configurations are in the <b>nanorc.sample</b> that comes with the nano source or your nano package. See Section <a href="#3.8">3.8</a>.</p></blockquote>
<hr width="100%">
<h1><a name="5"></a>5. Internationalization</h1>
<h2><a name="5.1"></a>5.1. There's no translation for my language!</h2>
<blockquote><p>On June of 2001, GNU nano entered the <a href="http://www.iro.umontreal.ca/contrib/po/HTML/">Free Translation Project</a> and since then, translations should be managed from there.</p>
  <p>If there isn't a translation for your language, you could ask <a href="http://www.iro.umontreal.ca/contrib/po/HTML/teams.html">your language team</a> to translate nano, or better still, join your team and do it yourself. Joining a team is easy. You just need to ask the <a href="mailto:translation at iro.umontreal.ca">TP coordinator</a> to add you to your team, and send a <a href="http://www.iro.umontreal.ca/contrib/po/HTML/disclaim.html">translation disclaimer to the FSF</a> (this is necessary as nano is an official GNU package, but it does <b>not</b> mean that you transfer the rights of your work to the FSF, it's just so the FSF can legally manage them).</p>
  <p>In any case, translating nano is very easy. Just grab the <b>nano.pot</b> file from the latest and greatest nano distribution (it's in the <b>po/</b> directory) and translate each line into your native language on the <b>msgstr</b> line. When you're done, you should send it to the TP's central po repository.</p></blockquote>
<h2><a name="5.2"></a>5.2. I don't like the translation for &lt;x&gt; in my language. How can I fix it?</h2>
<blockquote><p>The best way would probably be to e-mail the person listed in the <code>Last-Translator:</code> field in the <b>&lt;your_language&gt;.po</b> file with your suggested corrections and they can make the changes reach the nano-devel list.</p></blockquote>
<hr width="100%">
<h1><a name="6"></a>6. Advocacy and Licensing</h1>
<h2><a name="6.1"></a>6.1. Why should I use nano instead of Pico?</h2>
<blockquote><p>There are many reasons to use nano instead of Pico, a more complete list can be found at the <a href="http://www.nano-editor.org/">nano homepage</a>.</p></blockquote>
<h2><a name="6.2"></a>6.2. Why should I use Pico instead of nano?</h2>
<blockquote><p>Again, check out the <a href="http://www.nano-editor.org/">nano homepage</a> for a good summary of reasons. It really is a matter of personal preference as to which editor you should use. If you're the type of person who likes using the original version of a program, then Pico is the editor for you. If you're looking for a few more features and a 'better' license as far as adding your own changes (sacrificing mailer integration with Pine), nano is the way to go.</p></blockquote>
<h2><a name="6.3"></a>6.3. What is so bad about the Pine license?</h2>
<blockquote><p>The U of W license for Pine and Pico is not considered truly Free Software according to both the Free Software Foundation and the <a href="http://www.debian.org/social_contract#guidelines">Debian Free Software Guidelines</a>. The main problem regards the limitations on distributing derived works: according to UW, you can distribute their software, and you can modify it, but you can not do both, i.e. distribute modified binaries.</p></blockquote>
<h2><a name="6.4"></a>6.4. Okay, well what mail program should I use then?</h2>
<blockquote><p>If you are looking to use a Free Software program similar to Pine and emacs is not your thing, you should definitely take a look at <a href="http://www.mutt.org/">mutt</a>. It is a full-screen, console based mail program that actually has a lot more flexibility than Pine, but has a keymap included in the distribution that allows you to use the same keystrokes as Pine would to send and receive mail. It's also licensed under the GPL.</p></blockquote>
<h2><a name="6.5"></a>6.5. Why doesn't UW simply change their license?</h2>
<blockquote><p>You're really not asking the right person here. I (Chris) waited a long time to see if UW would change their license because of the amount of high quality software being released and developed under the GPL without being taken advantage of by malicious corporate entities or other baddies, but no such luck so far.</p></blockquote>
<h2><a name="6.6"></a>6.6. What if tomorrow UW changes the license to be truly Free Software?</h2>
<blockquote><p>Honestly nothing would make me happier than to see that happen. Nano would continue to be developed independently until such time as Pico had all the features nano did or the projects merged. That just does not seem very likely given that there has been no sign of any changes in the past few years in a positive direction.</p></blockquote>
<hr width="100%">
<h1><a name="7"></a>7. Miscellaneous</h1>
<h2><a name="7.1"></a>7.1. Nano related mailing lists.</h2>
<blockquote><p>There are three mailing lists for nano hosted at <a href="http://savannah.gnu.org/">Savannah</a>, info-nano, help-nano and nano-devel. Info-nano is a very low traffic list where new versions of nano are announced (surprise!) Help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. Nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
  <p>info-nano - <a href="http://mail.gnu.org/mailman/listinfo/info-nano/">http://mail.gnu.org/mailman/listinfo/info-nano/</a><br>
  help-nano - <a href="http://mail.gnu.org/mailman/listinfo/help-nano/">http://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
  nano-devel - <a href="http://mail.gnu.org/mailman/listinfo/nano-devel/">http://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
<h2><a name="7.2"></a>7.2. I want to send the development team a big load of cash (or just a thank you).</h2>
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel at gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v1.2/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v1.2/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
<h2><a name="7.3"></a>7.3. How do I submit a patch?</h2>
<blockquote><p>See Section <a href="#7.2">7.2</a>.</p></blockquote>
<h2><a name="7.4"></a>7.4. How do I join the development team?</h2>
<blockquote><p>The easiest way is to consistently send in good patches that add some needed functionality, fix a bug or two and/or make the program more optimized/efficient. Then ask nicely and you will probably be added to the Savannah development list and be given CVS write access after awhile. There is a lot of responsibility that goes along with being a team member, so don't think it's just something to add to your resume.</p></blockquote>
<h2><a name="7.5"></a>7.5. Can I have CVS write access?</h2>
<blockquote><p>Re-read Section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
<h2><a name="8"></a>8. ChangeLog</h2>
<blockquote>
<p>
2003/07/02 - Added question about nano's not showing color when it's compiled with color support (DLR; suggested by Jordi).<br>
2003/02/23 - Updated RPM links for nano 1.2.x. (DLR).<br>
2003/01/16 - Split section 4.5 into 4.5a and 4.5b for search string behavior. Added --enable-all docs.<br>
2002/12/28 - More misc. fixes (David Benbennick, DLR).<br>
2002/10/25 - Misc. fixes and link updates (DLR).<br>
2002/09/10 - Another typo fix (DLR).<br>
2002/05/15 - Typo fix (DLR).<br>
2001/12/26 - Misc. fixes (Aaron S. Hawley, DLR).<br>
2001/10/02 - Update for Free Translation Project.<br>
2001/10/02 - Assorted fixes, Debian additions.<br>
2001/06/30 - Silly typo fix.<br>
2001/05/05 - Spelling fixes by David Lawrence Ramsey.<br>
2001/05/02 - Misc fixes.<br>
2001/03/26 - Typo fix in an URL.<br>
2001/02/17 - Advocacy updates.<br>
2001/02/15 - Added GNU notes for 0.9.99pre3.<br>
2001/02/06 - Typo fixes.<br>
2001/01/14 - Added note about NumLock glitch.<br>
2001/01/10 - Linux -&gt; GNU/Linux.<br>
2001/01/09 - Added &quot;making exe smaller&quot; section.<br>
2000/12/19 - Typo and assorted error fixes.<br>
2000/11/28 - Added blurb about make install-strip.<br>
2000/11/19 - Changed Debian frozen to stable.<br>
2000/11/18 - Previous string display (4.5).<br>
2000/09/27 - Moved addresses to nano-editor.org.<br>
2000/06/31 - Initial framework.</p></blockquote>
<p>$Id: faq.html,v 1.1 2006-08-16 23:41:02 stsp Exp $</p>
</body>
</html>

--- NEW FILE: cut.c ---
/* $Id: cut.c,v 1.1 2006-08-16 23:41:02 stsp Exp $ */
/**************************************************************************
 *   cut.c                                                                *
 *                                                                        *
 *   Copyright (C) 1999-2003 Chris Allegretta                             *
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
 *   the Free Software Foundation; either version 2, or (at your option)  *
 *   any later version.                                                   *
 *                                                                        *
 *   This program is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *   GNU General Public License for more details.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
 **************************************************************************/

#include "config.h"

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "proto.h"
#include "nano.h"

static int marked_cut;		/* Is the cutbuffer from a mark? */

#ifndef NANO_SMALL
static int concatenate_cut;	/* Should we add this cut string to the
				   end of the last one? */
#endif

static filestruct *cutbottom = NULL;
				/* Pointer to end of cutbuffer */

filestruct *get_cutbottom(void)
{
    return cutbottom;
}

void add_to_cutbuffer(filestruct *inptr)
{
#ifdef DEBUG
    fprintf(stderr, "add_to_cutbuffer() called with inptr->data = %s\n",
	    inptr->data);
#endif

    if (cutbuffer == NULL) {
	cutbuffer = inptr;
	inptr->prev = NULL;
#ifndef NANO_SMALL
    } else if (concatenate_cut && !ISSET(JUSTIFY_MODE)) {
	/* Just tack the text in inptr onto the text in cutbottom,
	   unless we're backing up lines while justifying text. */
	cutbottom->data = charealloc(cutbottom->data,
		strlen(cutbottom->data) + strlen(inptr->data) + 1);
	strcat(cutbottom->data, inptr->data);
	return;
#endif
    } else {
	cutbottom->next = inptr;
	inptr->prev = cutbottom;
    }

    inptr->next = NULL;
    cutbottom = inptr;
}

#ifndef NANO_SMALL
/* Cut a marked segment instead of a whole line.
 *
 * The first cut character is top->data[top_x].  Unless top == bot, the
 * last cut line has length bot_x.  That is, if bot_x > 0 then we cut to
 * bot->data[bot_x - 1].
 *
 * destructive is whether to actually modify the file structure, if not
 * then just copy the buffer into cutbuffer and don't pull it from the
 * file.
 *
 * If destructive, then we maintain totsize, totlines, filebot, the
 * magic line, and line numbers.  Also, we set current and current_x so
 * the cursor will be on the first character after what was cut.  We do
 * not do any screen updates. */
void cut_marked_segment(filestruct *top, size_t top_x, filestruct *bot,
			size_t bot_x, int destructive)
{
    filestruct *tmp, *next;
    size_t newsize;

    if (top == bot && top_x == bot_x)
	return;
    assert(top != NULL && bot != NULL);

    /* Make top be no later than bot. */
    if (top->lineno > bot->lineno) {
	filestruct *swap = top;
	int swap2 = top_x;

	top = bot;
	bot = swap;

	top_x = bot_x;
	bot_x = swap2;
    } else if (top == bot && top_x > bot_x) {
	/* And bot_x can't be an earlier character than top_x. */
	int swap = top_x;

	top_x = bot_x;
	bot_x = swap;
    }

    /* Make the first cut line manually. */
    tmp = copy_node(top);
    newsize = (top == bot ? bot_x - top_x : strlen(top->data + top_x));
    memmove(tmp->data, top->data + top_x, newsize);
    null_at(&tmp->data, newsize);
    add_to_cutbuffer(tmp);

    /* And make the remainder line manually too. */
    if (destructive) {
	current_x = top_x;
	totsize -= newsize;
	totlines -= bot->lineno - top->lineno;

	newsize = top_x + strlen(bot->data + bot_x) + 1;
	if (top == bot) {
	    /* In this case, the remainder line is shorter, so we must
	       move text from the end forward first. */
	    memmove(top->data + top_x, bot->data + bot_x,
			newsize - top_x);
	    top->data = charealloc(top->data, newsize);
	} else {
	    totsize -= bot_x + 1;

	    /* Here, the remainder line might get longer, so we
	       realloc() it first. */
	    top->data = charealloc(top->data, newsize);
	    memmove(top->data + top_x, bot->data + bot_x,
			newsize - top_x);
	}
    }

    if (top == bot) {
#ifdef DEBUG
	dump_buffer(cutbuffer);
#endif
	return;
    }

    tmp = top->next;
    while (tmp != bot) {
	next = tmp->next;
	if (!destructive)
	    tmp = copy_node(tmp);
	else
	    totsize -= strlen(tmp->data) + 1;
	add_to_cutbuffer(tmp);
	tmp = next;
    }

    /* Make the last cut line manually. */
    tmp = copy_node(bot);
    null_at(&tmp->data, bot_x);
    add_to_cutbuffer(tmp);
#ifdef DEBUG
    dump_buffer(cutbuffer);
#endif

    if (destructive) {
	top->next = bot->next;
	if (top->next != NULL)
	    top->next->prev = top;
	delete_node(bot);
	renumber(top);
	current = top;
	if (bot == filebot) {
	    filebot = top;
	    assert(bot_x == 0);
	    if (top_x > 0)
		new_magicline();
	}
    }
#ifdef DEBUG
    dump_buffer(cutbuffer);
#endif
}
#endif

int do_cut_text(void)
{
    filestruct *fileptr;
#ifndef NANO_SMALL
    int dontupdate = 0;
#endif

    assert(current != NULL && current->data != NULL);

    check_statblank();

    if (!ISSET(KEEP_CUTBUFFER)) {
	free_filestruct(cutbuffer);
	cutbuffer = NULL;
	marked_cut = 0;
#ifndef NANO_SMALL
	concatenate_cut = 0;
#endif
#ifdef DEBUG
	fprintf(stderr, "Blew away cutbuffer =)\n");
#endif
    }

    /* You can't cut the magic line except with the mark.  But
       trying does clear the cutbuffer if KEEP_CUTBUFFER is not set. */
    if (current == filebot
#ifndef NANO_SMALL
			&& !ISSET(MARK_ISSET)
#endif
						)
	return 0;

    SET(KEEP_CUTBUFFER);

#ifndef NANO_SMALL
    if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
	assert(current_x >= 0 && current_x <= strlen(current->data));

	if (current->data[current_x] == '\0') {
	    /* If the line is empty and we didn't just cut a non-blank
	       line, create a dummy line and add it to the cutbuffer */
	    if (marked_cut != 1 && current->next != filebot) {
		filestruct *junk = make_new_node(current);

	        junk->data = charalloc(1);
		junk->data[0] = '\0';
		add_to_cutbuffer(junk);
#ifdef DEBUG
		dump_buffer(cutbuffer);
#endif
	    }

	    do_delete();
	    marked_cut = 2;
	    return 1;
	} else {
	    SET(MARK_ISSET);

	    mark_beginx = strlen(current->data);
	    mark_beginbuf = current;
	    dontupdate = 1;
	}
    }

    if (ISSET(MARK_ISSET)) {
	/* Don't do_update() and move the screen position if the marked
	   area lies entirely within the screen buffer */
	dontupdate |= current->lineno >= edittop->lineno &&
			current->lineno <= editbot->lineno &&
			mark_beginbuf->lineno >= edittop->lineno &&
			mark_beginbuf->lineno <= editbot->lineno;
	cut_marked_segment(current, current_x, mark_beginbuf,
				mark_beginx, 1);

	placewewant = xplustabs();
	UNSET(MARK_ISSET);

	/* If we just did a marked cut of part of a line, we should add
	   the first line of any cut done immediately afterward to the
	   end of this cut, as Pico does. */
	if (current == mark_beginbuf && current_x < strlen(current->data))
	    concatenate_cut = 1;
	marked_cut = 1;
	if (dontupdate)
	    edit_refresh();
	else
	    edit_update(current, CENTER);
	set_modified();

	return 1;
    }
#endif /* !NANO_SMALL */

    totlines--;
    totsize -= strlen(current->data) + 1;
    fileptr = current;
    current = current->next;
    current->prev = fileptr->prev;
    add_to_cutbuffer(fileptr);
#ifdef DEBUG
    dump_buffer(cutbuffer);
#endif

    if (fileptr == fileage)
	fileage = current;
    else
	current->prev->next = current;

    if (fileptr == edittop)
	edittop = current;

    renumber(current);
    current_x = 0;
    edit_refresh();
    set_modified();
    marked_cut = 0;
#ifndef NANO_SMALL
    concatenate_cut = 0;
#endif
    placewewant = 0;
    return 1;
}

int do_uncut_text(void)
{
    filestruct *tmp = current, *fileptr = current;
    filestruct *newbuf = NULL, *newend = NULL;
    char *tmpstr, *tmpstr2;
    filestruct *hold = current;
    int i;

    wrap_reset();
    check_statblank();
    if (cutbuffer == NULL || fileptr == NULL)
	return 0;		/* AIEEEEEEEEEEEE */

    /* If we're uncutting a previously non-marked block, uncut to end if
       we're not at the beginning of the line.  If we are at the
       beginning of the line, set placewewant to 0.  Pico does both of
       these. */
    if (marked_cut == 0) {
	if (current_x != 0)
	    marked_cut = 2;
	else
	    placewewant = 0;
    }

    /* If we're going to uncut on the magicline, always make a new
       magicline in advance. */
    if (current->next == NULL)
	new_magicline();

    if (marked_cut == 0 || cutbuffer->next != NULL)
    {
	newbuf = copy_filestruct(cutbuffer);
	for (newend = newbuf; newend->next != NULL && newend != NULL;
		newend = newend->next)
	    totlines++;
    }

    /* Hook newbuf into fileptr */
    if (marked_cut != 0) {
	int recenter_me = 0;
	    /* Should we eventually use edit_update(CENTER)? */

	/* If there's only one line in the cutbuffer */
	if (cutbuffer->next == NULL) {
	    size_t buf_len = strlen(cutbuffer->data);
	    size_t cur_len = strlen(current->data);

	    current->data = charealloc(current->data, cur_len + buf_len + 1);
	    memmove(current->data + current_x + buf_len,
			current->data + current_x, cur_len - current_x + 1);
	    strncpy(current->data + current_x, cutbuffer->data, buf_len);
		/* Use strncpy() to not copy the terminal '\0'. */

	    current_x += buf_len;
	    totsize += buf_len;

	    placewewant = xplustabs();
	    update_cursor();
	} else {		/* yuck -- no kidding! */
	    tmp = current->next;
	    /* New beginning */
	    tmpstr = charalloc(current_x + strlen(newbuf->data) + 1);
	    strncpy(tmpstr, current->data, current_x);
	    strcpy(&tmpstr[current_x], newbuf->data);
	    totsize += strlen(newbuf->data) + strlen(newend->data) + 1;

	    /* New end */
	    tmpstr2 = charalloc(strlen(newend->data) +
			      strlen(&current->data[current_x]) + 1);
	    strcpy(tmpstr2, newend->data);
	    strcat(tmpstr2, &current->data[current_x]);

	    free(current->data);
	    current->data = tmpstr;
	    current->next = newbuf->next;
	    newbuf->next->prev = current;
	    delete_node(newbuf);

	    current_x = strlen(newend->data);
	    placewewant = xplustabs();
	    free(newend->data);
	    newend->data = tmpstr2;

	    newend->next = tmp;

	    /* If tmp isn't null, we're in the middle: update the
	       prev pointer.  If it IS null, we're at the end; update
	       the filebot pointer */

	    if (tmp != NULL)
		tmp->prev = newend;
	    else {
		/* Fix the editbot pointer too */
		if (editbot == filebot)
		    editbot = newend;
		filebot = newend;
		new_magicline();
	    }

	    /* Now why don't we update the totsize also */
	    for (tmp = current->next; tmp != newend; tmp = tmp->next)
		totsize += strlen(tmp->data) + 1;

	    current = newend;
	    if (editbot->lineno < newend->lineno)
		recenter_me = 1;
	}

	/* If marked cut == 2, that means that we're doing a cut to end
	   and we don't want anything else on the line, so we have to
	   screw up all the work we just did and separate the line.
	   There must be a better way to do this, but not at 1AM on a
	   work night. */

	if (marked_cut == 2) {
	    tmp = make_new_node(current);
	    tmp->data = mallocstrcpy(NULL, current->data + current_x);
	    splice_node(current, tmp, current->next);
	    null_at(&current->data, current_x);
	    current = current->next;
	    current_x = 0;
	    placewewant = 0;

	    /* Extra line added, update stuff */
	    totlines++;
	    totsize++;
	}
	/* Renumber from BEFORE where we pasted ;) */
	renumber(hold);

#ifdef DEBUG
	dump_buffer(fileage);
	dump_buffer(cutbuffer);
#endif
	set_modified();
	if (recenter_me)
	    edit_update(current, CENTER);
	else
	    edit_refresh();
	return 0;
    }

    if (fileptr != fileage) {
	tmp = fileptr->prev;
	tmp->next = newbuf;
	newbuf->prev = tmp;
    } else
	fileage = newbuf;
    totlines++;		/* Unmarked uncuts don't split lines */

    /* This is so uncutting at the top of the buffer will work => */
    if (current_y == 0)
	edittop = newbuf;

    /* Connect the end of the buffer to the filestruct */
    newend->next = fileptr;
    fileptr->prev = newend;

    /* Recalculate size *sigh* */
    for (tmp = newbuf; tmp != fileptr; tmp = tmp->next)
	totsize += strlen(tmp->data) + 1;

    i = editbot->lineno;
    renumber(newbuf);
    /* Center the screen if we've moved beyond the line numbers of both
       the old and new editbots */
    if (i < newend->lineno && editbot->lineno < newend->lineno)
	edit_update(fileptr, CENTER);
    else
	edit_refresh();

#ifdef DEBUG
    dump_buffer_reverse();
#endif

    set_modified();
    return 1;
}

--- NEW FILE: ABOUT-NLS ---
Notes on the Free Translation Project
*************************************

   Free software is going international!  The Free Translation Project
is a way to get maintainers of free software, translators, and users all
together, so that will gradually become able to speak many languages.
A few packages already provide translations for their messages.

   If you found this `ABOUT-NLS' file inside a distribution, you may
assume that the distributed package does use GNU `gettext' internally,
itself available at your nearest GNU archive site.  But you do _not_
need to install GNU `gettext' prior to configuring, installing or using
this package with messages translated.

   Installers will find here some useful hints.  These notes also
explain how users should proceed for getting the programs to use the
available translations.  They tell how people wanting to contribute and
work at translations should contact the appropriate team.

   When reporting bugs in the `intl/' directory or bugs which may be
related to internationalization, you should tell about the version of
`gettext' which is used.  The information can be found in the
`intl/VERSION' file, in internationalized packages.

Quick configuration advice
==========================

   If you want to exploit the full power of internationalization, you
should configure it using

     ./configure --with-included-gettext

to force usage of internationalizing routines provided within this
package, despite the existence of internationalizing capabilities in the
operating system where this package is being installed.  So far, only
the `gettext' implementation in the GNU C library version 2 provides as
many features (such as locale alias, message inheritance, automatic
charset conversion or plural form handling) as the implementation here.
It is also not possible to offer this additional functionality on top
of a `catgets' implementation.  Future versions of GNU `gettext' will
very likely convey even more functionality.  So it might be a good idea
to change to GNU `gettext' as soon as possible.

   So you need _not_ provide this option if you are using GNU libc 2 or
you have installed a recent copy of the GNU gettext package with the
included `libintl'.

INSTALL Matters
===============

   Some packages are "localizable" when properly installed; the
programs they contain can be made to speak your own native language.
Most such packages use GNU `gettext'.  Other packages have their own
ways to internationalization, predating GNU `gettext'.

   By default, this package will be installed to allow translation of
messages.  It will automatically detect whether the system already
provides the GNU `gettext' functions.  If not, the GNU `gettext' own
library will be used.  This library is wholly contained within this
package, usually in the `intl/' subdirectory, so prior installation of
the GNU `gettext' package is _not_ required.  Installers may use
special options at configuration time for changing the default
behaviour.  The commands:

     ./configure --with-included-gettext
     ./configure --disable-nls

will respectively bypass any pre-existing `gettext' to use the
internationalizing routines provided within this package, or else,
_totally_ disable translation of messages.

   When you already have GNU `gettext' installed on your system and run
configure without an option for your new package, `configure' will
probably detect the previously built and installed `libintl.a' file and
will decide to use this.  This might be not what is desirable.  You
should use the more recent version of the GNU `gettext' library.  I.e.
if the file `intl/VERSION' shows that the library which comes with this
package is more recent, you should use

     ./configure --with-included-gettext

to prevent auto-detection.

   The configuration process will not test for the `catgets' function
and therefore it will not be used.  The reason is that even an
emulation of `gettext' on top of `catgets' could not provide all the
extensions of the GNU `gettext' library.

   Internationalized packages have usually many `po/LL.po' files, where
LL gives an ISO 639 two-letter code identifying the language.  Unless
translations have been forbidden at `configure' time by using the
`--disable-nls' switch, all available translations are installed
together with the package.  However, the environment variable `LINGUAS'
may be set, prior to configuration, to limit the installed set.
`LINGUAS' should then contain a space separated list of two-letter
codes, stating which languages are allowed.

Using This Package
==================

   As a user, if your language has been installed for this package, you
only have to set the `LANG' environment variable to the appropriate
`LL_CC' combination.  Here `LL' is an ISO 639 two-letter language code,
and `CC' is an ISO 3166 two-letter country code.  For example, let's
suppose that you speak German and live in Germany.  At the shell
prompt, merely execute `setenv LANG de_DE' (in `csh'),
`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
This can be done from your `.login' or `.profile' file, once and for
all.

   You might think that the country code specification is redundant.
But in fact, some languages have dialects in different countries.  For
example, `de_AT' is used for Austria, and `pt_BR' for Brazil.  The
country code serves to distinguish the dialects.

   The locale naming convention of `LL_CC', with `LL' denoting the
language and `CC' denoting the country, is the one use on systems based
on GNU libc.  On other systems, some variations of this scheme are
used, such as `LL' or `LL_CC.ENCODING'.  You can get the list of
locales supported by your system for your country by running the command
`locale -a | grep '^LL''.

   Not all programs have translations for all languages.  By default, an
English message is shown in place of a nonexistent translation.  If you
understand other languages, you can set up a priority list of languages.
This is done through a different environment variable, called
`LANGUAGE'.  GNU `gettext' gives preference to `LANGUAGE' over `LANG'
for the purpose of message handling, but you still need to have `LANG'
set to the primary language; this is required by other parts of the
system libraries.  For example, some Swedish users who would rather
read translations in German than English for when Swedish is not
available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.

   In the `LANGUAGE' environment variable, but not in the `LANG'
environment variable, `LL_CC' combinations can be abbreviated as `LL'
to denote the language's main dialect.  For example, `de' is equivalent
to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
(Portuguese as spoken in Portugal) in this context.

Translating Teams
=================

   For the Free Translation Project to be a success, we need interested
people who like their own language and write it well, and who are also
able to synergize with other translators speaking the same language.
Each translation team has its own mailing list.  The up-to-date list of
teams can be found at the Free Translation Project's homepage,
`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
area.

   If you'd like to volunteer to _work_ at translating messages, you
should become a member of the translating team for your own language.
The subscribing address is _not_ the same as the list itself, it has
`-request' appended.  For example, speakers of Swedish can send a
message to `sv-request at li.org', having this message body:

     subscribe

   Keep in mind that team members are expected to participate
_actively_ in translations, or at solving translational difficulties,
rather than merely lurking around.  If your team does not exist yet and
you want to start one, or if you are unsure about what to do or how to
get started, please write to `translation at iro.umontreal.ca' to reach the
coordinator for all translator teams.

   The English team is special.  It works at improving and uniformizing
the terminology in use.  Proven linguistic skill are praised more than
programming skill, here.

Available Packages
==================

   Languages are not equally supported in all packages.  The following
matrix shows the current state of internationalization, as of August
2002.  The matrix shows, in regard of each package, for which languages
PO files have been submitted to translation coordination, with a
translation percentage of at least 50%.

     Ready PO files    be bg ca cs da de el en eo es et fi fr
                     +----------------------------------------+
     a2ps            |             [] []             []    [] |
     ap-utils        |                                        |
     bash            |                []       [] []       [] |
     bfd             |                            []       [] |
     binutils        |                            []       [] |
     bison           |                []          [] []    [] |
     clisp           |                                        |
     clisp           |                []    []    []       [] |
     clisplow        |                                        |
     cpio            |             [] []          []       [] |
     darkstat        |             ()                         |
     diffutils       |          [] [] []       [] []       [] |
     enscript        |                []                   [] |
     error           |                []          []       [] |
     fetchmail       |       [] () [] []          []       () |
     fileutils       |             [] []          [] []    [] |
     findutils       |             [] []       [] [] []    [] |
     flex            |       []    [] []          []       [] |
     gas             |                            []       [] |
     gawk            |                []          []       [] |
     gcal            |       []                            [] |
     gcc             |                            []       [] |
     gettext         |       []    [] []          []       [] |
     gnupg           |       []       [] []    [] [] []    [] |
     gprof           |                            []       [] |
     gpsdrive        |             () ()    ()    ()       () |
     grep            |    [] []       [] []       [] [] [] [] |
     gretl           |                            []          |
     gthumb          |                ()          ()       () |
     hello           |       []    [] [] []    [] [] [] [] [] |
     id-utils        |             [] []                   [] |
     indent          |       []       []       []    []    [] |
     jpilot          |          () [] []                   [] |
     jwhois          |                            []       [] |
     kbd             |                []          []       [] |
     ld              |                            []       [] |
     libc            |       [] [] [] [] []       []    [] [] |
     libiconv        |       []       []       [] []          |
     lifelines       |                ()                   () |
     lilypond        |             []                      [] |
     lingoteach      |                         []          [] |
     lingoteach_lessons|                ()          ()          |
     lynx            |       [] [] [] []             []       |
     m4              |          [] [] [] []                [] |
     make            |             [] []          []       [] |
     man-db          |       [] () () []          ()       () |
     mysecretdiary   |                []          []       [] |
     nano            |       [] () [] []          []       [] |
     nano_1_0        |       [] () [] []          []       [] |
     opcodes         |             []             []       [] |
     parted          |       []    [] []          []       [] |
     ptx             |             [] []       [] [] [] [] [] |
     python          |                                        |
     recode          |             [] [] []    [] []       [] |
     sed             |       [] [] [] [] []    [] [] [] [] [] |
     sh-utils        |                []          [] []    [] |
     sharutils       |          [] [] [] []       [] []    [] |
     sketch          |                ()          []       () |
     soundtracker    |                []          []       [] |
     sp              |                []                      |
     tar             |          [] [] []          [] []    [] |
     texinfo         |          [] [] []       []          [] |
     textutils       |       []    [] []          []       [] |
     util-linux      |          [] [] []          [] []    [] |
     vorbis-tools    |                                     [] |
     wastesedge      |                                        |
     wdiff           |       []    [] []          [] []    [] |
     wget            |    [] [] [] [] [] []       [] [] [] [] |
                     +----------------------------------------+
                       be bg ca cs da de el en eo es et fi fr
                        0  2 19 10 30 44  9  1 12 44 17  6 53
     
                       gl he hr hu id it ja ko lv nb nl nn
                     +-------------------------------------+
     a2ps            |                ()    ()       []    |
     ap-utils        |                                     |
     bash            |          []                         |
     bfd             |                   []                |
     binutils        |                   []                |
     bison           |       []       [] []          []    |
     clisp           |                                     |
     clisp           |                               []    |
     clisplow        |                                     |
     cpio            | []       []          []       []    |
     darkstat        |                                     |
     diffutils       | [] []    [] []    []                |
     enscript        |       []                      []    |
     error           |          []                         |
     fetchmail       |                   []                |
     fileutils       |          []    [] []                |
     findutils       | []    [] [] [] [] [] []       []    |
     flex            |                      []             |
     gas             |                                     |
     gawk            |    []                               |
     gcal            |                                     |
     gcc             |                   []                |
     gettext         |                   [] []             |
     gnupg           | []          [] [] []                |
     gprof           |             []                      |
     gpsdrive        |          []    ()             ()    |
     grep            | [] [] [] [] [] [] []                |
     gretl           |                                     |
     gthumb          |                () ()                |
     hello           | [] [] [] [] [] [] [] [] [] [] [] [] |
     id-utils        |          []                   []    |
     indent          | []       []       []          []    |
     jpilot          |                   ()          ()    |
     jwhois          |          [] []                      |
     kbd             |                                     |
     ld              |                                     |
     libc            | []                [] []    []       |
     libiconv        | []    [] []                         |
     lifelines       |                                     |
     lilypond        |                               []    |
     lingoteach      |          []                         |
     lingoteach_lessons|                                     |
     lynx            |          []    [] []          []    |
     m4              | []          []    []          []    |
     make            | [] [] []          [] []       []    |
     man-db          |                () ()                |
     mysecretdiary   |             []                      |
     nano            | []          [] []             []    |
     nano_1_0        | []          [] []          []    [] |
     opcodes         |             []                []    |
     parted          | []                []             [] |
     ptx             | []       [] []             [] []    |
     python          |                                     |
     recode          | [] []          []                   |
     sed             | [] [] []    [] [] [] []       []    |
     sh-utils        |                [] []       []       |
     sharutils       | []                []          []    |
     sketch          |                ()                   |
     soundtracker    | []    []                            |
     sp              |                                     |
     tar             | []    []    [] [] []       []       |
     texinfo         |    [] []          []                |
     textutils       | []                [] []    []       |
     util-linux      |                () []                |
     vorbis-tools    |          []                         |
     wastesedge      |                                     |
     wdiff           | []       [] []                      |
     wget            | [] [] [] []       []          []    |
                     +-------------------------------------+
                       gl he hr hu id it ja ko lv nb nl nn
                       23  9 12 19 16 13 26  9  1  7 19  3
     
                       no pl pt pt_BR ru sk sl sv tr uk zh_CN zh_TW
                     +----------------------------------------------+
     a2ps            | () () ()  []   []    [] [] []                | 10
     ap-utils        |                               ()             |  0
     bash            |           []                                 |  6
     bfd             |                         [] []                |  5
     binutils        |                         [] []                |  5
     bison           |           []   []       [] []                | 12
     clisp           |                                              |  0
     clisp           |                                              |  5
     clisplow        |                                              |  0
     cpio            |    []     []   []       []                   | 12
     darkstat        |           []            []        ()    ()   |  2
     diffutils       |    []     []   []       [] []           []   | 17
     enscript        |           []   []       [] []                |  8
     error           |                   []       []           []   |  7
     fetchmail       |    ()     ()               []                |  6
     fileutils       |                []    [] [] []     []    []   | 14
     findutils       |    []     []   [] [] [] [] []                | 21
     flex            |                []       [] []                |  9
     gas             |                            []                |  3
     gawk            |                         [] []                |  6
     gcal            |                         [] []                |  4
     gcc             |                            []                |  4
     gettext         |                [] [] [] [] []           []   | 13
     gnupg           |    []                   [] []                | 14
     gprof           |                         [] []                |  5
     gpsdrive        |                   []    []                   |  3
     grep            |    []     []   []    []    []                | 20
     gretl           |                                              |  1
     gthumb          |           ()   ()       []                   |  1
     hello           | [] []          [] []    [] [] []             | 28
     id-utils        |           []   []       [] []                |  9
     indent          |           []   [] []    [] []                | 14
     jpilot          | ()                      () []           []   |  5
     jwhois          |           []   ()       () []           []   |  7
     kbd             |                         [] []                |  5
     ld              |                         [] []                |  4
     libc            | [] []     []      []    [] []                | 18
     libiconv        |           []   [] []    [] []                | 12
     lifelines       |                         []                   |  1
     lilypond        |                         []                   |  4
     lingoteach      |           []            []                   |  5
     lingoteach_lessons|                                   ()         |  0
     lynx            |           []   []       [] []                | 13
     m4              |    []     []   []       []                   | 13
     make            |    []     []   []       [] []                | 15
     man-db          |                                              |  3
     mysecretdiary   |           []            [] []                |  7
     nano            |    []          []       []    []             | 13
     nano_1_0        |    []          []       []    []             | 14
     opcodes         |           []            [] []                |  8
     parted          |       []  []            [] []                | 12
     ptx             | [] [] []  []   []       [] []                | 19
     python          |                                              |  0
     recode          |    []     []   []    [] [] []                | 15
     sed             |           []   [] [] [] [] []                | 24
     sh-utils        |                []          []                |  9
     sharutils       |                []       [] []           []   | 14
     sketch          |           []   ()       []                   |  4
     soundtracker    |                         []                   |  6
     sp              |                                              |  1
     tar             | [] []     []      [] [] [] []                | 19
     texinfo         |                []       []                   | 10
     textutils       |                []    [] [] []           []   | 14
     util-linux      |           []            [] []                | 10
     vorbis-tools    |                         []                   |  3
     wastesedge      |                                              |  0
     wdiff           |           []   [] []    [] []                | 14
     wget            |    []          [] [] [] [] [] []        []   | 24
                     +----------------------------------------------+
       37 teams        no pl pt pt_BR ru sk sl sv tr uk zh_CN zh_TW
       68 domains       4 15  2  28   28 12 10 49 43  4   1     9    609

   Some counters in the preceding matrix are higher than the number of
visible blocks let us expect.  This is because a few extra PO files are
used for implementing regional variants of languages, or language
dialects.

   For a PO file in the matrix above to be effective, the package to
which it applies should also have been internationalized and
distributed as such by its maintainer.  There might be an observable
lag between the mere existence a PO file and its wide availability in a
distribution.

   If August 2002 seems to be old, you may fetch a more recent copy of
this `ABOUT-NLS' file on most GNU archive sites.  The most up-to-date
matrix with full percentage details can be found at
`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.

Using `gettext' in new packages
===============================

   If you are writing a freely available program and want to
internationalize it you are welcome to use GNU `gettext' in your
package.  Of course you have to respect the GNU Library General Public
License which covers the use of the GNU `gettext' library.  This means
in particular that even non-free programs can use `libintl' as a shared
library, whereas only free software can use `libintl' as a static
library or use modified versions of `libintl'.

   Once the sources are changed appropriately and the setup can handle
to use of `gettext' the only thing missing are the translations.  The
Free Translation Project is also available for packages which are not
developed inside the GNU project.  Therefore the information given above
applies also for every other Free Software Project.  Contact
`translation at iro.umontreal.ca' to make the `.pot' files available to
the translation teams.


--- NEW FILE: ChangeLog ---
GNU nano 1.2.5 - 2005.05.15
- files.c:
  open_prevfile(), open_nextfile()
	- Translate the "New Buffer" string when displaying "Switched
	  to" messages on the statusbar. (DLR)
  input_tab()
	- Fix snprintf() call so that we don't segfault when trying to
	  complete a filename containing %'s. (Ulf Härnhammar)
- global.c:
  shortcut_init()
	- Move the "Cancel" shortcut up so that it's just after the "Get
	  Help" shortcut, for consistency with the other shortcut lists.
	  (DLR)
- nano.c:
  do_int_spell_fix()
	- Move the REVERSE_SEARCH flag toggling into the NANO_SMALL
	  #ifdef, since the tiny version of nano doesn't support reverse
	  searching.  Also, turn the USE_REGEXP flag off during spell
	  checking in order to avoid a potential segfault. (DLR)
[...3777 lines suppressed...]
	program calls it and then refreshes.  Made the program not clear
	the screen on exit, just the bottom two lines (like Pico).
0.4.2	Implemented replace all in replace function.  Crude exit function
	(asks yes or no if modified but does not write to file).
0.4.1	Implementing search & replace.  Fixed crash on deleting at top of
	edit buffer.  Implemented "timeout" of statusbar messages.
	Implemented ^A and ^E (beginning and end of line).
0.4.0	Split code into global.c and proto.h to allow for better multiple
	file handling.  Added #defines for the majority of the shortcut
	keys in tip.h for easy modification. 
0.3.1	Write edit_refresh which doesn't move the screen around, just
	updates what's there already.  do_wrap() and do_enter() added.
0.3.0	Preliminary cutbuffer (cut and uncut) support.
0.2.7   Check for Modification added.  do_search() works.
0.2.5	Rewrite of file data struct.
0.2	Read in data to buffer, bound keystrokes to stub functions, 
	initial cursor movement on screen.  Initial autoconf support.
0.1	Initial program setup w/ncurses

$Id: ChangeLog,v 1.1 2006-08-16 23:41:01 stsp Exp $

--- NEW FILE: nano.spec.in ---
%define name	@PACKAGE@
%define ver	@VERSION@
%define rel	1

Summary	: Pico editor clone with enhancements
Name		: %{name}
Version		: %{ver}
Release		: %{rel}
Copyright	: GPL
Group		: Console/Editors
URL		: http://www.nano-editor.org
Source		: http://www.nano-editor.org/dist/v1.2/%{name}-%{ver}.tar.gz
BuildRoot	: /var/tmp/%{name}-buildroot
Requires	: ncurses

%description
GNU nano is a small and friendly text editor.  It aims to emulate the Pico
text editor while also offering a few enhancements.

%prep
%setup -q

%build
%configure --enable-all
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"

%install
rm -rf "$RPM_BUILD_ROOT"
make DESTDIR="$RPM_BUILD_ROOT" install

%files
%defattr(-,root,root)
%doc AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README THANKS TODO nanorc.sample
%{_bindir}/nano
%{_mandir}/*/*
%{_datadir}/locale/*/LC_MESSAGES/nano.mo
%{_infodir}/nano.info*

%changelog
* Sat Mar 30 2002 Chris Allegretta <chrisa at asty.org>
- Accepted into main distribution
- Added Packager and URL tage from original spec file.
* Tue Mar 06 2002 Brett Pemberton <generica at email.com>
- Initial spec-file

--- NEW FILE: move.c ---
/* $Id: move.c,v 1.1 2006-08-16 23:41:02 stsp Exp $ */
/**************************************************************************
 *   move.c                                                               *
 *                                                                        *
 *   Copyright (C) 1999-2003 Chris Allegretta                             *
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
 *   the Free Software Foundation; either version 2, or (at your option)  *
 *   any later version.                                                   *
 *                                                                        *
 *   This program is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *   GNU General Public License for more details.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
 **************************************************************************/

#include "config.h"

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "proto.h"
#include "nano.h"

int do_home(void)
{
    current_x = 0;
    placewewant = 0;
    update_line(current, current_x);
    return 1;
}

int do_end(void)
{
    current_x = strlen(current->data);
    placewewant = xplustabs();
    update_line(current, current_x);
    return 1;
}

void page_up(void)
{
    if (edittop != fileage) {
#ifndef NANO_SMALL
	if (ISSET(SMOOTHSCROLL))
	    edit_update(edittop->prev, TOP);
	else
#endif
	{
	    edit_update(edittop, CENTER);
	    /* Now that we've updated the edit window, edittop might be
	       at the top of the file; if so, just move the cursor up one
	       line and don't center it. */
	    if (edittop != fileage)
		center_cursor();
	    else
		reset_cursor();
	}
    } else
	current_y = 0;

    update_cursor();
}

int do_page_up(void)
{
    int i;

    wrap_reset();
    current_x = 0;
    placewewant = 0;

    if (current == fileage)
	return 0;

    current_y = 0;
    current = edittop;
    for (i = 0; i <= editwinrows - 3 && current->prev != NULL; i++)
	current = current->prev;

    edit_update(current, TOP);
    update_cursor();

    check_statblank();
    return 1;
}

int do_page_down(void)
{
    wrap_reset();
    current_x = 0;
    placewewant = 0;

    if (current == filebot)
	return 0;

    /* AHEM, if we only have a screen or less of text, DON'T do an
       edit_update(), just move the cursor to editbot! */
    if (edittop == fileage && editbot == filebot && totlines < editwinrows) {
	current = editbot;
	reset_cursor();
#ifndef NANO_SMALL
	/* ...unless marking is on, in which case we need it to update
	   the highlight. */
	if (ISSET(MARK_ISSET))
	    edit_update(current, NONE);
#endif
    } else if (editbot != filebot || edittop == fileage) {
	current_y = 0;
	current = editbot;

	if (current->prev != NULL)
	    current = current->prev;
	if (current->prev != NULL)
	    current = current->prev;
	edit_update(current, TOP);
    } else {
	while (current != filebot) {
	    current = current->next;
	    current_y++;
	}
	edit_update(edittop, TOP);
    }

    update_cursor();
    check_statblank();
    return 1;
}

int do_up(void)
{
    wrap_reset();
    if (current->prev != NULL) {
	current_x = actual_x(current->prev, placewewant);
	current = current->prev;
	if (current_y > 0) {
	    update_line(current->next, 0);
		/* It is necessary to change current first, so the mark
		   display will change! */
	    current_y--;
	    update_line(current, current_x);
	} else
	    page_up();
	check_statblank();
    }
    return 1;
}

/* Return value 1 means we moved down, 0 means we were already at the
 * bottom. */
int do_down(void)
{
    wrap_reset();
    check_statblank();

    if (current->next == NULL)
	return 0;

    current = current->next;
    current_x = actual_x(current, placewewant);

    /* Note current_y is zero-based.  This test checks for the cursor's
     * being on the last row of the edit window. */
    if (current_y == editwinrows - 1) {
#ifndef NANO_SMALL
	if (ISSET(SMOOTHSCROLL)) {
	    /* In this case current_y does not change.  The cursor
	     * remains at the bottom of the edit window. */
	    edittop = edittop->next;
	    editbot = editbot->next;
	    edit_refresh();
	} else
#endif
	{
	    /* Set edittop so editbot->next (or else editbot) is
	     * centered, and set current_y = editwinrows / 2. */
	    edit_update(editbot->next != NULL ? editbot->next : editbot, CENTER);
	    center_cursor();
	}
    } else {
	update_line(current->prev, 0);
	update_line(current, current_x);
	current_y++;
    }
    return 1;
}

int do_left(void)
{
    if (current_x > 0)
	current_x--;
    else if (current != fileage) {
	do_up();
	current_x = strlen(current->data);
    }
    placewewant = xplustabs();
    update_line(current, current_x);
    check_statblank();
    return 1;
}

int do_right(void)
{
    assert(current_x <= strlen(current->data));

    if (current->data[current_x] != '\0')
	current_x++;
    else if (current->next != NULL) {
	do_down();
	current_x = 0;
    }
    placewewant = xplustabs();
    update_line(current, current_x);
    check_statblank();
    return 1;
}

--- NEW FILE: search.c ---
/* $Id: search.c,v 1.1 2006-08-16 23:41:03 stsp Exp $ */
/**************************************************************************
 *   search.c                                                             *
 *                                                                        *
 *   Copyright (C) 2000-2003 Chris Allegretta                             *
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
 *   the Free Software Foundation; either version 2, or (at your option)  *
 *   any later version.                                                   *
 *                                                                        *
 *   This program is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *   GNU General Public License for more details.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
[...1053 lines suppressed...]
	    h->current = p;
	    return p->data;
	}
    }
    h->current = (historytype*)h;
    null_at(&s, h->len);
    return s;
}

/* free a history list */
void free_history(historyheadtype *h)
{
    historytype *p, *n;

    for (p = h->next; (n = p->next); p = n)
	remove_node(p);
}

/* end of history support functions */
#endif /* !NANO_SMALL */

--- NEW FILE: nano.1 ---
.\" Hey, EMACS: -*- nroff -*-
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003 by
.\" Chris Allegretta <chrisa at asty.org>
.\"
.\" This is free documentation, see the latest version of the GNU General
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" $Id: nano.1,v 1.1 2006-08-16 23:41:02 stsp Exp $
.TH NANO 1 "June 19, 2003"
.\" Please adjust this date whenever revising the manpage.
.\"

.SH NAME
nano \- Nano's ANOther editor, an enhanced free Pico clone

.SH SYNOPSIS
.B nano
.I [\+LINE]\ [options]\ [file]
.br

.SH DESCRIPTION
This manual page documents briefly the \fBnano\fP command.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics, 
.\" respectively.
\fBnano\fP is a small, free and friendly editor which aims to replace
Pico, the default editor included in the non-free Pine package. Rather
than just copying Pico's look and feel, \fBnano\fP also implements some
missing (or disabled by default) features in Pico, such as "search and
replace" and "go to line number".

.SH OPTIONS
.TP
.B \+\fILINE\fP
Places cursor at \fILINE\fP on startup.
.TP
.B \-B (\-\-backup)
When saving a file, back up the previous version of it to the current
filename suffixed with a ~.
.TP
.B \-D (\-\-dos)
Write file in DOS format.
.TP
.B \-F (\-\-multibuffer)
Enable multiple file buffers, if available.
.TP
.B \-H (\-\-historylog)
Log search and replace strings to
.I ~/.nano_history
so they may be stored for later editing, if nanorc support is 
configured.
.TP
.B \-I (\-\-ignorercfiles)
Don't look at
.I $SYSCONFDIR/nanorc
or
.IR ~/.nanorc ,
if nanorc support is available.
.TP
.B \-K (\-\-keypad)
Do not use the ncurses keypad() call unless necessary.  Try this flag if
you find that the arrow keys on the numeric keypad do not work for you
under nano.
.TP
.B \-M (\-\-mac)
Write file in Mac format.
.TP
.B \-N (\-\-noconvert)
Disable automatic conversion of files from DOS/Mac format.
.TP
.B \-Q \fIstr\fP (\-\-quotestr=\fIstr\fP)
Set the quoting string for justifying.  The default is
"^([\ \\t]*[|>:}#])+" if regular expression support is available, or
">\ " otherwise.
.TP
.B \-R (\-\-regexp)
Enable regular expression matching for search strings, as well as
\\n subexpression replacement for replace strings, if available.
.TP
.B \-S (\-\-smooth)
Enable smooth scrolling. Text will scroll line-by-line, instead of the
usual chunk-by-chunk behavior.
.TP
.B \-T \fInum\fP (\-\-tabsize=\fInum\fP)
Set the size (width) of a tab.
.TP
.B \-V (\-\-version)
Show the current version number and author.
.TP
.B \-Y \fIstr\fP (\-\-syntax=\fIstr\fP)
Specify a specific syntax highlighting from the
.I .nanorc
to use, if available.
.TP
.B \-c (\-\-const)
Constantly show the cursor position.
.TP
.B \-h (\-\-help)
Display a summary of command line options.
.TP
.B \-i (\-\-autoindent)
Indent new lines to the previous line's indentation. Useful when editing
source code.
.TP
.B \-k (\-\-cut)
Enable cut from cursor to end of line with ^K.
.TP
.B \-l (\-\-nofollow)
If the file being edited is a symbolic link, replace the link with
a new file, do not follow it.  Good for editing files in
.IR /tmp ,
perhaps?
.TP
.B \-m (\-\-mouse)
Enable mouse support (if available for your system).
.TP
.B \-o \fIdir\fP (\-\-operatingdir=\fIdir\fP)
Set operating directory. Makes nano set up something similar to a
chroot.
.TP
.B \-p (\-\-preserve)
Preserve the XON and XOFF sequences (^Q and ^S) so they will be 
caught by the terminal.
.TP
.B \-r \fIcols\fP (\-\-fill=\fIcols\fP)
Wrap lines at column \fIcols\fP.  By default, this is the width of the
screen, less eight.  If this value is negative, wrapping will occur at
\fIcols\fP columns from the right of the screen, allowing the wrap point 
to vary along with the screen width if resized.
.TP
.B \-s \fIprog\fP (\-\-speller=\fIprog\fP)
Enable alternative spell checker command.
.TP
.B \-t (\-\-tempfile)
Always save changed buffer without prompting.  Same as Pico -t option.
.TP
.B \-v (\-\-view)
View file (read only) mode.
.TP
.B \-w (\-\-nowrap)
Disable wrapping of long lines.
.TP
.B \-x (\-\-nohelp)
Disable help screen at bottom of editor.
.TP
.B \-z (\-\-suspend)
Enable suspend ability.
.TP
.B \-a, \-b, \-e, \-f, \-g, \-j
Ignored, for compatibility with Pico.

.SH INITIALIZATION FILE
\fBnano\fP will read initialization files in the following 
order:
.IR $SYSCONFDIR/nanorc ,
then
.IR ~/.nanorc .
Please see
.BR nanorc (5)
and the example file \fBnanorc.sample\fP which should be provided with 
\fBnano\fP. 

.SH NOTES
\fBnano\fP will try to dump the buffer into an emergency file in some
cases.  Mainly, this will happen if \fBnano\fP receives a SIGHUP or
SIGTERM or runs out of memory, when it will write the buffer into a file
named
.I nano.save
if the buffer didn't have a name already, or will add a ".save" suffix 
to the current filename. If an emergency file with that name already 
exists in the current directory, ".save" and a number (e.g. ".save.1") 
will be suffixed to the current filename in order to make it unique. In 
multibuffer mode, \fBnano\fP will write all the open buffers to the 
respective emergency files.

.SH BUGS
Please send any comments or bug reports to
.BR nano at nano-editor.org .

The \fBnano\fP mailing list is available from
.BR nano-devel at gnu.org .

To subscribe, email to
.B nano-devel-request at gnu.org
with a subject of "subscribe".

.SH HOMEPAGE
http://www.nano-editor.org/

.SH SEE ALSO
.PD 0
.TP
\fBnanorc\fP(5)
.PP
\fI/usr/share/doc/nano/\fP (or equivalent on your system)

.SH AUTHOR
Chris Allegretta <chrisa at asty.org>, et al (see
.I AUTHORS
and
.I THANKS
for details). This manual page was originally written by Jordi Mallach
<jordi at sindominio.net>, for the Debian GNU system (but may be
used by others).

--- NEW FILE: global.c ---
/* $Id: global.c,v 1.1 2006-08-16 23:41:02 stsp Exp $ */
/**************************************************************************
 *   global.c                                                             *
 *                                                                        *
 *   Copyright (C) 1999-2003 Chris Allegretta                             *
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
 *   the Free Software Foundation; either version 2, or (at your option)  *
 *   any later version.                                                   *
 *                                                                        *
 *   This program is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *   GNU General Public License for more details.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
 **************************************************************************/

#include "config.h"

#include <stdlib.h>
#include <assert.h>
#include <sys/stat.h>
#include "proto.h"
#include "nano.h"

/* Global variables */

/* wrap_at might be set in rcfile.c or nano.c */
int wrap_at = -CHARS_FROM_EOL;/* Right justified fill value, allows resize */
char *last_search = NULL;	/* Last string we searched for */
char *last_replace = NULL;	/* Last replacement string */
int search_last_line;		/* Is this the last search line? */
int search_offscreen;		/* Search lines not displayed */

int flags = 0;			/* Our new flag containing many options */
WINDOW *edit;			/* The file portion of the editor */
WINDOW *topwin;			/* Top line of screen */
WINDOW *bottomwin;		/* Bottom buffer */
char *filename = NULL;		/* Name of the file */

#ifndef NANO_SMALL
struct stat originalfilestat;	/* Stat for the file as we loaded it */
int jumpok = 0;			/* Okay to longjmp back to main loop */
#endif

int editwinrows = 0;		/* How many rows long is the edit
				   window? */
filestruct *current;		/* Current buffer pointer */
int current_x = 0, current_y = 0;	/* Current position of X and Y in
					   the editor - relative to edit
					   window (0,0) */
filestruct *fileage = NULL;	/* Our file buffer */
filestruct *edittop = NULL;	/* Pointer to the top of the edit
				   buffer with respect to the
				   file struct */
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_MULTIBUFFER
openfilestruct *open_files = NULL;	/* The list of open files */
#endif

#ifndef DISABLE_JUSTIFY
char *quotestr = NULL;		/* Quote string.  The default value is
				   set in main(). */
#endif

int resetstatuspos;		/* Hack for resetting the status bar 
				   cursor position */
char *answer = NULL;		/* Answer str to many questions */
int totlines = 0;		/* Total number of lines in the file */
long totsize = 0;		/* Total number of bytes in the file */
int placewewant = 0;		/* The column we'd like the cursor
				   to jump to when we go to the
				   next or previous line */

int tabsize = -1;		/* Our internal tabsize variable.  The
				   default value 8 is set in main(). */

char *hblank = NULL;		/* A horizontal blank line */
#ifndef DISABLE_HELP
char *help_text;		/* The text in the help window */
#endif

/* More stuff for the marker select */

#ifndef NANO_SMALL
filestruct *mark_beginbuf;	/* the begin marker buffer */
int mark_beginx;		/* X value in the string to start */
#endif

#ifndef DISABLE_OPERATINGDIR
char *operating_dir = NULL;	/* Operating directory, which we can't */
char *full_operating_dir = NULL;/* go higher than */
#endif

#ifndef DISABLE_SPELLER
char *alt_speller = NULL;		/* Alternative spell command */
#endif

shortcut *main_list = NULL;
shortcut *whereis_list = NULL;
shortcut *replace_list = NULL;
shortcut *replace_list_2 = NULL; 	/* 2nd half of replace dialog */
shortcut *goto_list = NULL;
shortcut *writefile_list = NULL;
shortcut *insertfile_list = NULL;
#ifndef DISABLE_HELP
shortcut *help_list = NULL;
#endif
#ifndef DISABLE_SPELLER
shortcut *spell_list = NULL;
#endif
#ifndef NANO_SMALL
shortcut *extcmd_list = NULL;
#endif
#ifndef DISABLE_BROWSER
shortcut *browser_list = NULL;
shortcut *gotodir_list = NULL;
#endif

#ifdef ENABLE_COLOR
const colortype *colorstrings = NULL;
syntaxtype *syntaxes = NULL;
char *syntaxstr = NULL;
#endif

#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || (!defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION))
const shortcut *currshortcut;	/* Current shortcut list we're using */
#endif

#ifndef NANO_SMALL
toggle *toggles = NULL;
#endif

#ifndef NANO_SMALL
historyheadtype search_history;
historyheadtype replace_history;
#endif

/* Regular expressions */

#ifdef HAVE_REGEX_H
regex_t search_regexp;		/* Global to store compiled search regexp */
regmatch_t regmatches[10];	/* Match positions for parenthetical
				   subexpressions, max of 10 */
#endif

int curses_ended = FALSE;	/* Indicates to statusbar() to simply
				 * write to stderr, since endwin() has
				 * ended curses mode. */


int length_of_list(const shortcut *s) 
{
    int i = 0;

    for (; s != NULL; s = s->next)
	i++;
    return i;
}

/* Initialize a struct *without* our lovely braces =( */
void sc_init_one(shortcut **shortcutage, int key, const char *desc,
#ifndef DISABLE_HELP
	const char *help,
#endif
	int alt, int misc1, int misc2, int view, int (*func) (void))
{
    shortcut *s;

    if (*shortcutage == NULL) {
	*shortcutage = (shortcut *)nmalloc(sizeof(shortcut));
	s = *shortcutage;
    } else {
	for (s = *shortcutage; s->next != NULL; s = s->next)
	    ;
	s->next = (shortcut *)nmalloc(sizeof(shortcut));
	s = s->next; 
    }

    s->val = key;
    s->desc = desc;
#ifndef DISABLE_HELP
    s->help = help;
#endif
    s->altval = alt;
    s->misc1 = misc1;
    s->misc2 = misc2;
    s->viewok = view;
    s->func = func;
    s->next = NULL;
}

#ifndef NANO_SMALL
/* Create one new toggle structure, at the end of the toggles
 * linked list. */
void toggle_init_one(int val, const char *desc, int flag)
{
    toggle *u;

    if (toggles == NULL) {
	toggles = (toggle *)nmalloc(sizeof(toggle));
	u = toggles;
    } else {
	for (u = toggles; u->next != NULL; u = u->next)
	    ;
	u->next = (toggle *)nmalloc(sizeof(toggle));
	u = u->next;
    }

    u->val = val;
    u->desc = desc;
    u->flag = flag;
    u->next = NULL;
}

void toggle_init(void)
{
    char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
	*toggle_nohelp_msg, *toggle_cuttoend_msg,
	*toggle_noconvert_msg, *toggle_dos_msg, *toggle_mac_msg,
	*toggle_backup_msg, *toggle_smooth_msg;
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
    char *toggle_mouse_msg;
#endif
#ifndef DISABLE_WRAPPING
    char *toggle_wrap_msg;
#endif
#ifdef ENABLE_MULTIBUFFER
    char *toggle_load_msg;
#endif
#ifdef ENABLE_COLOR
    char *toggle_syntax_msg;
#endif

    /* There is no need to reinitialize the toggles.  They can't
       change. */
    if (toggles != NULL)
	return;

    toggle_const_msg = _("Constant cursor position");
    toggle_autoindent_msg = _("Auto indent");
    toggle_suspend_msg = _("Suspend");
    toggle_nohelp_msg = _("Help mode");
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
    toggle_mouse_msg = _("Mouse support");
#endif
    toggle_cuttoend_msg = _("Cut to end");
    toggle_noconvert_msg = _("No conversion from DOS/Mac format");
    toggle_dos_msg = _("Writing file in DOS format");
    toggle_mac_msg = _("Writing file in Mac format");
    toggle_backup_msg = _("Backing up file");
    toggle_smooth_msg = _("Smooth scrolling");
#ifdef ENABLE_COLOR
    toggle_syntax_msg = _("Color syntax highlighting");
#endif
#ifndef DISABLE_WRAPPING
    toggle_wrap_msg = _("Auto wrap");
#endif
#ifdef ENABLE_MULTIBUFFER
    toggle_load_msg = _("Multiple file buffers");
#endif

    toggle_init_one(TOGGLE_CONST_KEY, toggle_const_msg, CONSTUPDATE);
    toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT);
    toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND);
    toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP);
#ifndef DISABLE_WRAPPING
    toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
#endif
#if !defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION)
    toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE);
#endif
    toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END);
#ifdef ENABLE_MULTIBUFFER
    toggle_init_one(TOGGLE_LOAD_KEY, toggle_load_msg, MULTIBUFFER);
#endif
    toggle_init_one(TOGGLE_NOCONVERT_KEY, toggle_noconvert_msg, NO_CONVERT);
    toggle_init_one(TOGGLE_DOS_KEY, toggle_dos_msg, DOS_FILE);
    toggle_init_one(TOGGLE_MAC_KEY, toggle_mac_msg, MAC_FILE);
    toggle_init_one(TOGGLE_BACKUP_KEY, toggle_backup_msg, BACKUP_FILE);
    toggle_init_one(TOGGLE_SMOOTH_KEY, toggle_smooth_msg, SMOOTHSCROLL);
#ifdef ENABLE_COLOR
    toggle_init_one(TOGGLE_SYNTAX_KEY, toggle_syntax_msg, COLOR_SYNTAX);
#endif
}

#ifdef DEBUG
/* Deallocate all of the toggles. */
void free_toggles(void)
{
    while (toggles != NULL) {
	toggle *pt = toggles;	/* Think "previous toggle" */

	toggles = toggles->next;
	free(pt);
    }
}
#endif
#endif /* !NANO_SMALL */

/* Deallocate the given shortcut. */
void free_shortcutage(shortcut **shortcutage)
{
    assert(shortcutage != NULL);
    while (*shortcutage != NULL) {
	shortcut *ps = *shortcutage;
	*shortcutage = (*shortcutage)->next;
	free(ps);
    }
}

void shortcut_init(int unjustify)
{
#ifndef DISABLE_HELP
    const char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg =
	"", *nano_goto_msg = "", *nano_justify_msg =
	"", *nano_replace_msg = "", *nano_insert_msg =
	"", *nano_whereis_msg = "", *nano_prevpage_msg =
	"", *nano_nextpage_msg = "", *nano_cut_msg =
	"", *nano_uncut_msg = "", *nano_cursorpos_msg =
	"", *nano_spell_msg = "", *nano_up_msg = "", *nano_down_msg =
	"", *nano_forward_msg = "", *nano_back_msg = "", *nano_home_msg =
	"", *nano_end_msg = "", *nano_firstline_msg =
	"", *nano_lastline_msg = "", *nano_refresh_msg =
	"", *nano_mark_msg = "", *nano_delete_msg =
	"", *nano_backspace_msg = "", *nano_tab_msg =
	"", *nano_enter_msg = "", *nano_cancel_msg =
	"", *nano_unjustify_msg = "", *nano_append_msg =
	"", *nano_prepend_msg = "", *nano_tofiles_msg =
	"", *nano_gotodir_msg = "", *nano_case_msg =
	"", *nano_reverse_msg = "", *nano_execute_msg =
	"", *nano_dos_msg = "", *nano_mac_msg =
	"", *nano_backup_msg = "", *nano_editstr_msg = "";

#ifdef ENABLE_MULTIBUFFER
    const char *nano_openprev_msg = "", *nano_opennext_msg =
	"", *nano_multibuffer_msg = "";
#endif
#ifdef HAVE_REGEX_H
    const char *nano_regexp_msg = "", *nano_bracket_msg = "";
#endif

    nano_help_msg = _("Invoke the help menu");
    nano_writeout_msg = _("Write the current file to disk");
#ifdef ENABLE_MULTIBUFFER
    nano_exit_msg = _("Close currently loaded file/Exit from nano");
#else
    nano_exit_msg = _("Exit from nano");
#endif
    nano_goto_msg = _("Go to a specific line number");
    nano_justify_msg = _("Justify the current paragraph");
    nano_unjustify_msg = _("Unjustify after a justify");
    nano_replace_msg = _("Replace text within the editor");
    nano_insert_msg = _("Insert another file into the current one");
    nano_whereis_msg = _("Search for text within the editor");
    nano_prevpage_msg = _("Move to the previous screen");
    nano_nextpage_msg = _("Move to the next screen");
    nano_cut_msg = _("Cut the current line and store it in the cutbuffer");
    nano_uncut_msg = _("Uncut from the cutbuffer into the current line");
    nano_cursorpos_msg = _("Show the position of the cursor");
    nano_spell_msg = _("Invoke the spell checker, if available");
    nano_up_msg = _("Move up one line");
    nano_down_msg = _("Move down one line");
    nano_forward_msg = _("Move forward one character");
    nano_back_msg = _("Move back one character");
    nano_home_msg = _("Move to the beginning of the current line");
    nano_end_msg = _("Move to the end of the current line");
    nano_firstline_msg = _("Go to the first line of the file");
    nano_lastline_msg = _("Go to the last line of the file");
    nano_refresh_msg = _("Refresh (redraw) the current screen");
    nano_mark_msg = _("Mark text at the current cursor location");
    nano_delete_msg = _("Delete the character under the cursor");
    nano_backspace_msg =
	_("Delete the character to the left of the cursor");
    nano_tab_msg = _("Insert a tab character");
    nano_enter_msg = _("Insert a carriage return at the cursor position");
    nano_case_msg =
	_("Make the current search or replace case (in)sensitive");
    nano_tofiles_msg = _("Go to file browser");
    nano_execute_msg = _("Execute external command");
    nano_gotodir_msg = _("Go to directory");
    nano_cancel_msg = _("Cancel the current function");
    nano_append_msg = _("Append to the current file");
    nano_prepend_msg = _("Prepend to the current file");
    nano_reverse_msg = _("Search backwards");
    nano_dos_msg = _("Write file out in DOS format");
    nano_mac_msg = _("Write file out in Mac format");
    nano_backup_msg = _("Back up original file when saving");
    nano_editstr_msg = _("Edit the previous search/replace strings");
#ifdef HAVE_REGEX_H
    nano_regexp_msg = _("Use regular expressions");
    nano_bracket_msg = _("Find other bracket");
#endif
#ifdef ENABLE_MULTIBUFFER
    nano_openprev_msg = _("Open previously loaded file");
    nano_opennext_msg = _("Open next loaded file");
    nano_multibuffer_msg = _("Toggle insert into new buffer");
#endif
#endif /* !DISABLE_HELP */

    free_shortcutage(&main_list);

/* The following macro is to be used in calling sc_init_one.  The point is
 * that sc_init_one takes 9 arguments, unless DISABLE_HELP is defined,
 * when the fourth one should not be there. */
#ifdef DISABLE_HELP
#  define IFHELP(help, nextvar) nextvar
#else
#  define IFHELP(help, nextvar) help, nextvar
#endif
    /* Translators: try to keep this string under 10 characters long */
    sc_init_one(&main_list, NANO_HELP_KEY, _("Get Help"),
		IFHELP(nano_help_msg, 0), NANO_HELP_FKEY, 0, VIEW,
		do_help);

#ifdef ENABLE_MULTIBUFFER
    if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL))
    /* Translators: try to keep this string under 10 characters long */
	sc_init_one(&main_list, NANO_EXIT_KEY, _("Close"),
		IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
		do_exit);
    else
#endif

    /* Translators: try to keep this string under 10 characters long */
	sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"),
		IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
		do_exit);

    /* Translators: try to keep this string under 10 characters long */
    sc_init_one(&main_list, NANO_WRITEOUT_KEY, _("WriteOut"),
		    IFHELP(nano_writeout_msg, 0),
		    NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);

    /* Translators: try to keep this string under 10 characters long */
    sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
		    IFHELP(nano_justify_msg, 0), NANO_JUSTIFY_FKEY, 0,
		    NOVIEW, do_justify);

    /* this is so we can view multiple files */
    /* Translators: try to keep this string under 10 characters long */
    sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
		IFHELP(nano_insert_msg, 0), NANO_INSERTFILE_FKEY, 0,
#ifdef ENABLE_MULTIBUFFER
		VIEW
#else
		NOVIEW
#endif
		, do_insertfile_void);

    /* Translators: try to keep this string under 10 characters long */
    sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"),
		IFHELP(nano_whereis_msg, 0),
		NANO_WHEREIS_FKEY, 0, VIEW, do_search);

    /* Translators: try to keep this string under 10 characters long */
    sc_init_one(&main_list, NANO_PREVPAGE_KEY, _("Prev Page"),
		IFHELP(nano_prevpage_msg, 0),
		NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, do_page_up);

    /* Translators: try to keep this string under 10 characters long */
    sc_init_one(&main_list, NANO_NEXTPAGE_KEY, _("Next Page"),
		IFHELP(nano_nextpage_msg, 0),
		NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);

    /* Translators: try to keep this string under 10 characters long */
    sc_init_one(&main_list, NANO_CUT_KEY, _("Cut Text"),
		IFHELP(nano_cut_msg, 0),
		NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);

    if (unjustify)
    /* Translators: try to keep this string under 10 characters long */
	sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, _("UnJustify"),
		IFHELP(nano_unjustify_msg, 0),
		0, 0, NOVIEW, do_uncut_text);
    else
    /* Translators: try to keep this string under 10 characters long */
	sc_init_one(&main_list, NANO_UNCUT_KEY, _("UnCut Txt"),
		IFHELP(nano_uncut_msg, 0),
		NANO_UNCUT_FKEY, 0, NOVIEW, do_uncut_text);

    /* Translators: try to keep this string under 10 characters long */
    sc_init_one(&main_list, NANO_CURSORPOS_KEY, _("Cur Pos"),
		IFHELP(nano_cursorpos_msg, 0),
		NANO_CURSORPOS_FKEY, 0, VIEW, do_cursorpos_void);

    /* Translators: try to keep this string under 10 characters long */
    sc_init_one(&main_list, NANO_SPELL_KEY, _("To Spell"),
		IFHELP(nano_spell_msg, 0),
		NANO_SPELL_FKEY, 0, NOVIEW, do_spell);

    sc_init_one(&main_list, NANO_UP_KEY, _("Up"),
		IFHELP(nano_up_msg, 0),
		KEY_UP, 0, VIEW, do_up);

    sc_init_one(&main_list, NANO_DOWN_KEY, _("Down"),
		IFHELP(nano_down_msg, 0),
		KEY_DOWN, 0, VIEW, do_down);

    sc_init_one(&main_list, NANO_FORWARD_KEY, _("Forward"),
		IFHELP(nano_forward_msg, 0),
		KEY_RIGHT, 0, VIEW, do_right);

    sc_init_one(&main_list, NANO_BACK_KEY, _("Back"),
		IFHELP(nano_back_msg, 0),
		KEY_LEFT, 0, VIEW, do_left);

    sc_init_one(&main_list, NANO_HOME_KEY, _("Home"),
		IFHELP(nano_home_msg, 0),
		KEY_HOME, 362, VIEW, do_home);

    sc_init_one(&main_list, NANO_END_KEY, _("End"),
		IFHELP(nano_end_msg, 0),
		KEY_END, 385, VIEW, do_end);

    sc_init_one(&main_list, NANO_REFRESH_KEY, _("Refresh"),
		IFHELP(nano_refresh_msg, 0),
		0, 0, VIEW, total_refresh);

    sc_init_one(&main_list, NANO_MARK_KEY, _("Mark Text"),
		IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY),
		0, 0, NOVIEW, do_mark);

    sc_init_one(&main_list, NANO_DELETE_KEY, _("Delete"),
		IFHELP(nano_delete_msg, 0), KEY_DC,
		NANO_CONTROL_D, NOVIEW, do_delete);

    sc_init_one(&main_list, NANO_BACKSPACE_KEY, _("Backspace"),
		IFHELP(nano_backspace_msg, 0),
		KEY_BACKSPACE, 127, NOVIEW, do_backspace);

    sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"),
		IFHELP(nano_tab_msg, 0), 0, 0, NOVIEW, do_tab);

    sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
		    IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
		    NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);

    sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"),
		IFHELP(nano_enter_msg, 0),
		KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter);

    sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"),
		    IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY),
		    NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);

#ifndef NANO_SMALL
    sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"),
		IFHELP(_("Move forward one word"), 0),
		0, 0, VIEW, do_next_word);

    sc_init_one(&main_list, -9, _("Prev Word"),
		IFHELP(_("Move backward one word"), NANO_PREVWORD_KEY), 0, 0,
		VIEW, do_prev_word);
#endif
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
    sc_init_one(&main_list, -9, _("Find Other Bracket"),
		    IFHELP(nano_bracket_msg, NANO_BRACKET_KEY),
		    0, 0, VIEW, do_find_bracket);
#endif
#ifdef ENABLE_MULTIBUFFER
    sc_init_one(&main_list, -9, _("Previous File"),
		    IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY),
		    0, 0, VIEW, open_prevfile_void);
    sc_init_one(&main_list, -9, _("Next File"),
		    IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY),
		    0, 0, VIEW, open_nextfile_void);
#endif

    free_shortcutage(&whereis_list);

    sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"),
		IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);

    /* Translators: try to keep this string under 12 characters long */
    sc_init_one(&whereis_list, NANO_CANCEL_KEY, _("Cancel"),
		IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);

    /* Translators: try to keep this string under 12 characters long */
    sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"),
		IFHELP(nano_firstline_msg, 0),
		0, 0, VIEW, do_first_line);

    /* Translators: try to keep this string under 12 characters long */
    sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"),
		IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);

    /* Translators: try to keep this string under 12 characters long */
    sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"),
		IFHELP(nano_replace_msg, 0), 0, 0, VIEW, do_replace);

    /* Translators: try to keep this string under 12 characters long */
    sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
		IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);

#ifndef NANO_SMALL
    /* Translators: try to keep this string under 12 characters long */
    sc_init_one(&whereis_list, TOGGLE_CASE_KEY, _("Case Sens"),
		IFHELP(nano_case_msg, 0), 0, 0, VIEW, 0);

    /* Translators: try to keep this string under 12 characters long */
    sc_init_one(&whereis_list, TOGGLE_BACKWARDS_KEY, _("Direction"),
		IFHELP(nano_reverse_msg, 0), 0, 0, VIEW, 0);

#ifdef HAVE_REGEX_H
    /* Translators: try to keep this string under 12 characters long */
    sc_init_one(&whereis_list, TOGGLE_REGEXP_KEY, _("Regexp"),
		IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
#endif

#ifndef NANO_SMALL
    /* Translators: try to keep this string under 12 characters long */
    sc_init_one(&whereis_list, KEY_UP, _("History"),
		IFHELP(nano_editstr_msg, 0), NANO_UP_KEY, 0, VIEW, 0);
#endif

#endif /* !NANO_SMALL */

    free_shortcutage(&replace_list);

    sc_init_one(&replace_list, NANO_HELP_KEY, _("Get Help"),
		IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);

    sc_init_one(&replace_list, NANO_CANCEL_KEY, _("Cancel"),
		IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);

    sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, _("First Line"),
		IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);

    sc_init_one(&replace_list, NANO_LASTLINE_KEY, _("Last Line"),
		IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);

    /* Translators: try to keep this string under 12 characters long */
    sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"),
		IFHELP(nano_whereis_msg, 0), 0, 0, VIEW, do_search);

    sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"), 
		IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);

#ifndef NANO_SMALL
    sc_init_one(&replace_list, TOGGLE_CASE_KEY, _("Case Sens"),
		IFHELP(nano_case_msg, 0), 0, 0, VIEW, 0);

    sc_init_one(&replace_list, TOGGLE_BACKWARDS_KEY, _("Direction"),
		IFHELP(nano_reverse_msg, 0), 0, 0, VIEW, 0);

#ifdef HAVE_REGEX_H
    sc_init_one(&replace_list, TOGGLE_REGEXP_KEY, _("Regexp"),
		IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
#endif

    sc_init_one(&replace_list, KEY_UP, _("History"),
		IFHELP(nano_editstr_msg, 0), NANO_UP_KEY, 0, VIEW, 0);
#endif /* !NANO_SMALL */

    free_shortcutage(&replace_list_2);

    sc_init_one(&replace_list_2, NANO_HELP_KEY, _("Get Help"),
		IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);

    sc_init_one(&replace_list_2, NANO_CANCEL_KEY, _("Cancel"),
		IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);

    sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, _("First Line"),
		IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);

    sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, _("Last Line"),
		IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);

#ifndef NANO_SMALL
    sc_init_one(&replace_list_2, KEY_UP, _("History"),
		IFHELP(nano_editstr_msg, 0), NANO_UP_KEY, 0, VIEW, 0);
#endif

    free_shortcutage(&goto_list);

    sc_init_one(&goto_list, NANO_HELP_KEY, _("Get Help"),
		IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);

    sc_init_one(&goto_list, NANO_CANCEL_KEY, _("Cancel"),
		IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);

    sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, _("First Line"),
		IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);

    sc_init_one(&goto_list, NANO_LASTLINE_KEY, _("Last Line"),
		IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);

#ifndef DISABLE_HELP
    free_shortcutage(&help_list);

    sc_init_one(&help_list, NANO_PREVPAGE_KEY, _("Prev Page"),
		IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
		KEY_PPAGE, VIEW, do_page_up);

    sc_init_one(&help_list, NANO_NEXTPAGE_KEY, _("Next Page"),
		IFHELP(nano_nextpage_msg, 0),
		NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);

    sc_init_one(&help_list, NANO_EXIT_KEY, _("Exit"),
		IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
		do_exit);
#endif

    free_shortcutage(&writefile_list);

    sc_init_one(&writefile_list, NANO_HELP_KEY, _("Get Help"),
		IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);

    sc_init_one(&writefile_list, NANO_CANCEL_KEY, _("Cancel"),
		IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);

#ifndef DISABLE_BROWSER
    /* Translators: try to keep this string under 16 characters long */
    sc_init_one(&writefile_list, NANO_TOFILES_KEY, _("To Files"),
		IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0);
#endif

#ifndef NANO_SMALL
    /* Translators: try to keep this string under 16 characters long */
    sc_init_one(&writefile_list, TOGGLE_DOS_KEY, _("DOS Format"),
		IFHELP(nano_dos_msg, 0), 0, 0, NOVIEW, 0);

    /* Translators: try to keep this string under 16 characters long */
    sc_init_one(&writefile_list, TOGGLE_MAC_KEY, _("Mac Format"),
		IFHELP(nano_mac_msg, 0), 0, 0, NOVIEW, 0);
#endif

    /* Translators: try to keep this string under 16 characters long */
    sc_init_one(&writefile_list, NANO_APPEND_KEY, _("Append"),
		IFHELP(nano_append_msg, 0), 0, 0, NOVIEW, 0);

    /* Translators: try to keep this string under 16 characters long */
    sc_init_one(&writefile_list, NANO_PREPEND_KEY, _("Prepend"),
		IFHELP(nano_prepend_msg, 0), 0, 0, NOVIEW, 0);

#ifndef NANO_SMALL
    /* Translators: try to keep this string under 16 characters long */
    sc_init_one(&writefile_list, TOGGLE_BACKUP_KEY, _("Backup File"),
		IFHELP(nano_backup_msg, 0), 0, 0, NOVIEW, 0);
#endif

    free_shortcutage(&insertfile_list);

    sc_init_one(&insertfile_list, NANO_HELP_KEY, _("Get Help"),
		IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);

    sc_init_one(&insertfile_list, NANO_CANCEL_KEY, _("Cancel"),
		IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);

#ifndef DISABLE_BROWSER
    sc_init_one(&insertfile_list, NANO_TOFILES_KEY, _("To Files"),
		IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0);
#endif
#ifndef NANO_SMALL
    /* Translators: try to keep this string under 22 characters long */
    sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"),
		IFHELP(nano_execute_msg, 0), 0, 0, NOVIEW, 0);
#ifdef ENABLE_MULTIBUFFER
    /* Translators: try to keep this string under 22 characters long */
    sc_init_one(&insertfile_list, TOGGLE_LOAD_KEY, _("New Buffer"),
		IFHELP(nano_multibuffer_msg, 0), 0, 0, NOVIEW, 0);
#endif
#endif

#ifndef DISABLE_SPELLER
    free_shortcutage(&spell_list);

    sc_init_one(&spell_list, NANO_HELP_KEY, _("Get Help"),
		IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);

    sc_init_one(&spell_list, NANO_CANCEL_KEY, _("Cancel"),
		IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
#endif

#ifndef NANO_SMALL
    free_shortcutage(&extcmd_list);

    sc_init_one(&extcmd_list, NANO_HELP_KEY, _("Get Help"),
		IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);

    sc_init_one(&extcmd_list, NANO_CANCEL_KEY, _("Cancel"),
		IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
#endif

#ifndef DISABLE_BROWSER
    free_shortcutage(&browser_list);

    sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"),
		IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);

    sc_init_one(&browser_list, NANO_CANCEL_KEY, _("Cancel"),
		IFHELP(nano_cancel_msg, 0), NANO_EXIT_FKEY, 0, VIEW, 0);

    sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"),
		IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
		KEY_PPAGE, VIEW, 0);

    sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, _("Next Page"),
		IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
		KEY_NPAGE, VIEW, 0);

    /* Translators: try to keep this string under 22 characters long */
    sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"),
		IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY),
		NANO_GOTO_FKEY, 0, VIEW, 0);

    free_shortcutage(&gotodir_list);

    sc_init_one(&gotodir_list, NANO_HELP_KEY, _("Get Help"),
		IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);

    sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"),
		IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
#endif

#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || (!defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION))
    currshortcut = main_list;
#endif
#ifndef NANO_SMALL
    toggle_init();
#endif
}

/* This function is called just before calling exit().  Practically, the
 * only effect is to cause a segmentation fault if the various data
 * structures got bolloxed earlier.  Thus, we don't bother having this
 * function unless debugging is turned on. */
#ifdef DEBUG
/* added by SPK for memory cleanup, gracefully return our malloc()s */
void thanks_for_all_the_fish(void)
{
#ifndef DISABLE_JUSTIFY
    if (quotestr != NULL)
	free(quotestr);
#endif
#ifndef DISABLE_OPERATINGDIR
    if (operating_dir != NULL)
	free(operating_dir);
    if (full_operating_dir != NULL)
	free(full_operating_dir);
#endif
    if (last_search != NULL)
	free(last_search);
    if (last_replace != NULL)
	free(last_replace);
    if (hblank != NULL)
	free(hblank);
#ifndef DISABLE_SPELLER
    if (alt_speller != NULL)
	free(alt_speller);
#endif
#ifndef DISABLE_HELP
    if (help_text != NULL)
	free(help_text);
#endif
    if (filename != NULL)
	free(filename);
    if (answer != NULL)
	free(answer);
    if (cutbuffer != NULL)
	free_filestruct(cutbuffer);

    free_shortcutage(&main_list);
    free_shortcutage(&whereis_list);
    free_shortcutage(&replace_list);
    free_shortcutage(&replace_list_2);
    free_shortcutage(&goto_list);
    free_shortcutage(&writefile_list);
    free_shortcutage(&insertfile_list);
#ifndef DISABLE_HELP
    free_shortcutage(&help_list);
#endif
#ifndef DISABLE_SPELLER
    free_shortcutage(&spell_list);
#endif
#ifndef NANO_SMALL
    free_shortcutage(&extcmd_list);
#endif
#ifndef DISABLE_BROWSER
    free_shortcutage(&browser_list);
    free_shortcutage(&gotodir_list);
#endif

#ifndef NANO_SMALL
    free_toggles();
#endif

#ifdef ENABLE_MULTIBUFFER
    if (open_files != NULL) {
	/* We free the memory associated with each open file. */
	while (open_files->prev != NULL)
	    open_files = open_files->prev;
	free_openfilestruct(open_files);
    }
#else
    free_filestruct(fileage);
#endif

#ifdef ENABLE_COLOR
    free(syntaxstr);
    while (syntaxes != NULL) {
	syntaxtype *bill = syntaxes;

	free(syntaxes->desc);
	while (syntaxes->extensions != NULL) {
	    exttype *bob = syntaxes->extensions;

	    syntaxes->extensions = bob->next;
	    regfree(&bob->val);
	    free(bob);
	}
	while (syntaxes->color != NULL) {
	    colortype *bob = syntaxes->color;

	    syntaxes->color = bob->next;
	    regfree(&bob->start);
	    if (bob->end != NULL)
		regfree(bob->end);
	    free(bob->end);
	    free(bob);
	}
	syntaxes = syntaxes->next;
	free(bill);
    }
#endif /* ENABLE_COLOR */
#ifndef NANO_SMALL
    /* free history lists */
    free_history(&search_history);
    free_history(&replace_history);
#endif
}
#endif /* DEBUG */

--- NEW FILE: nano.texi ---
\input texinfo  @c -*-texinfo-*-
@c %**start of header
@setfilename nano.info
@settitle nano Command Manual
@c %**end of header

@c This file has the new style title page commands.
@c Run `makeinfo' rather than `texinfo-format-buffer'.
@smallbook
@set EDITION 0.1
@set VERSION 1.2.5
@set UPDATED 17 Jan 2003

@dircategory Editors
@direntry
* nano: (nano).                 Small and friendly text editor.
@end direntry

@c tex
@c \overfullrule=0pt
@c end tex

@titlepage
@title GNU @code{nano}
@subtitle a small and friendly text editor.
@subtitle version 1.2.5

@author Chris Allegretta
@page

This manual documents GNU @code{nano}, a small and friendly text
editor.

This manual is part of the GNU @code{nano} distribution.@*
@sp4
Copyright (C) 1999, 2000, 2001, 2002 Chris Allegretta.

Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

@iftex
Permission is granted to process this file through @TeX{} and print the
results, provided the printed document carries copying permission notice
identical to this one except for the removal of this paragraph (this
paragraph not being relevant to the printed manual).
@end iftex

Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by the Foundation.

You may contact the author by
e-mail: @email{chrisa@@asty.org}@*
@end titlepage

@node Top, Introduction, (dir), (dir)

This manual documents GNU @code{nano}, a small and friendly text
editor.

@menu
* Introduction::
* Editor Basics::
* Online Help::
* Feature Toggles::
* The File Browser::
* Pico Compatibility::
* Building and Configure Options::
@end menu

@node Introduction, Editor Basics, Top, Top
@chapter Introduction

GNU @code{nano} is a small and friendly text editor.  Besides basic text
editing, @code{nano} offers many extra features like an interactive
search and replace, goto line number, auto-indentation, feature toggles,
internationalization support, and filename tab completion.

@menu
* Overview::
* Command Line Options::
@end menu

@node Overview, Command Line Options, Introduction, Introduction
@section Overview

@code{nano} +LINE [GNU long option] [option] [ @var{file ...} ]

The original goal for @code{nano} was a complete bug-for-bug compatible
emulation of Pico, but nano's main goal is to be as compatible as
possible while offering a superset of Pico's functionality.
Also see @xref{Pico Compatibility}, for other differences.

Email bug reports to @email{nano@@nano-editor.org}. 

@node Command Line Options, , Overview, Introduction
@section Command Line Options

@code{nano} takes the following options from the command line:

@table @code

@item -B, --backup
When saving a file, back up the previous version of it to the current
filename suffixed with a ~.

@item -D, --dos
Write file in DOS format.

@item -F, --multibuffer
Enable multiple file buffers, if available.

@item -I, --ignorercfiles
Don't look at $SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
available.

@item -K, --keypad
Do not use the ncurses keypad() call unless necessary.  Try this flag if
you find that the arrow keys on the numeric keypad do not work for you
under @code{nano}.

@item -M, --mac
Write file in Mac format.

@item -N, --noconvert
Do not convert files from DOS/Mac format.

@item -Q [str], --quotestr [str]
Set the quoting string for justifying.  The default is

@quotation
@code{^([ \t]*[|>:@}#])+}
@end quotation

if regular expression support is available, or ``> '' otherwise.  Note
that @code{\t} above stands for a literal Tab character.

@item -R, --regexp
Turn on regular expression search and search/replace.

@item -S, --smooth
Enable smooth scrolling.

@item -T [num], --tabsize=[num]
Set the displayed tab length to [num] columns.

@item -V, --version 
Print the version number and copyright and quit.

@item -Y, --syntax=[str]
Specify a specific syntax highlighting from the .nanorc to use, if
available.

@item -c, --const
Constantly display the cursor position and line number on the statusbar.

@item -h, --help
Print the usage and exit.

@item -i, --autoindent
Automatically indent new lines to the same number of spaces and tabs as
the previous line.

@item -k, --cut
Makes ^K cut from the current cursor position to the end of the current
line.

@item -l, --nofollow
When writing files, if the given file is a symbolic link it is removed
and a new file is created.

@item -m, --mouse
Enables the use of the mouse to select text (currently only useful for
running under the X window system).

@item -o [dir], --operatingdir=[dir]
Set operating directory. Makes @code{nano} set up something similar to a
chroot.

@item -p, --preserve
Preserve the ^Q (XON) and ^S (XOFF) sequences so data being sent to the editor
can be can be stopped and started.

@item -r [#cols], --fill=[#cols].
Wrap lines at column #cols.  By default this is the width of the screen,
less eight. If this value is negative, wrapping will occur at #cols from
the right of the screen, allowing it to vary along with the screen width
if the screen is resized.

@item -s [prog], --speller=[prog]
Invoke [prog] as the spell checker.  By default, @code{nano} uses its
own interactive spell checker that requires the @code{spell} program be
installed on your system.

@item -t, --tempfile
Do not ask whether or not to save the current contents of the file when
exiting, assume yes.  This is most useful when using @code{nano} as the
composer of a mailer program.

@anchor{Expert Mode}
@item -x, --nohelp
In Expert Mode, the Shortcut Lists will not appear at the bottom of the 
screen.  This affects the location of the statusbar as well, as in Expert
Mode it is located at the very bottom of the editor.

Note: When accessing the help system, Expert Mode is temporarily disabled
to display the help system navigation keys.

@item -v, --view
Do not allow the contents of the file to be altered.  Note that this
flag should NOT be used in place of correct file permissions to implement
a read-only file.

@item -w, --nowrap
Do not wrap long lines at any length. This option overrides any value for
-r.

@item -z, --suspend
Enable suspend ability of @code{nano} using the system's suspend
keystroke (usually ^Z).

@item -a, -b, -e, -f, -g, -j
Ignored, for compatibility with Pico.

@item +LINE
Start at line number LINE instead of the default of line 1.
@end table

@node Editor Basics, Online Help, Introduction, Top
@chapter Editor Basics
@menu
* Entering Text::
* Special Functions::
* The Titlebar::
* The Statusbar::
* Shortcut Lists::
@end menu

@node Entering Text, Special Functions, Editor Basics, Editor Basics
@section Entering Text

All key sequences in @code{nano} are entered using the keyboard.
@code{nano} is a ``modeless'' editor.  All keys with the exception of
Control and Meta key sequences will enter text into the file being
edited.  

@node Special Functions, The Titlebar, Entering Text, Editor Basics
@section Special Functions

Special functions use the Control key (displayed in the help and
shortcut lists as ^) or the Meta key (displayed as M).
     
@itemize @bullet
     
@item
Control key sequences are entered by holding down the Control key and
pressing the desired letter.  
@item
Meta key sequences can be entered in a number of
possible ways: Pressing the Escape key, then releasing it and pressing
the desired key, or holding down the Alt key while pressing the desired 
key.  This varies from keyboard to keyboard, and certain commercial
operating systems ``swallow'' the Alt key so that it never reaches the
application. If your operating system does this, you should use the
Escape key to generate Meta key sequences.
@end itemize

@node The Titlebar, The Statusbar, Special Functions, Editor Basics
@section The Titlebar

The titlebar is the line displayed at the top of the editor.  There are
three sections: left, center and right. The section on the left displays
the version of @code{nano} being used.  The center section displays the
current file name, or ``New Buffer'' if the file has not yet been named.
The section on the right will display ``Modified'' if the file has been
modified since it was last saved or opened.

Special modes: When @code{nano} is in ``File browser'' mode, the center
section will display the current directory instead of the filename.
@xref{The File Browser}.

@node The Statusbar, Shortcut Lists, The Titlebar, Editor Basics
@section The Statusbar

The statusbar is located three lines from the bottom of the screen (or
the bottom line in Expert Mode.  @xref{Expert Mode}, for more info).

The Statusbar shows important and informational messages.  Any error
messages that occur from using the editor will appear on the statusbar.
Any questions that are asked of the user will be asked on the statusbar,
and any user input (search strings, file names, etc) will be input on
the statusbar.

@node Shortcut Lists, , The Statusbar, Editor Basics
@section Shortcut Lists

The Shortcut Lists are the two lines at the bottom of the screen which
show some of the more commonly used functions in the editor. 

@node Online Help, Feature Toggles, Editor Basics, Top
@chapter Online Help

The online help system in @code{nano} is available by pressing ^G.
It is fairly self explanatory, documenting the various parts of the 
editor and available keystrokes.  Navigation is via the ^Y (Page Up)
and ^V (Page Down) keys.  ^X exits the help system.


@node Feature Toggles, The File Browser, Online Help, Top
@chapter Feature Toggles

Toggles allow you to change certain aspects of the editor that
would normally be done via command line flags. They are invoked via
certain Meta key sequences. @xref{Special Functions}, for more info.
The following global toggles are available:

@table @code

@item Backup File Toggle (Meta-B)
toggles the -B (@code{--backup}) command line flag.

@item DOS Format Toggle (Meta-D)
toggles the -D (@code{--dos}) command line flag.

@item Multiple Files Toggle (Meta-F)
toggles the -F (@code{--multibuffer}) command line flag.

@item AutoIndent Toggle (Meta-I)
toggles the -i (@code{--autoindent}) command line flag.

@item Cut To End Toggle (Meta-K)
toggles the -k (@code{--cut}) command line flag.

@item Mouse Toggle (Meta-M)
toggles the -m (@code{--mouse}) command line flag.

@item Mac Format Toggle (Meta-O)
toggles the -M (@code{--mac}) command line flag.

@item Smooth Scrolling Toggle (Meta-S)
toggles the -S (@code{--smooth}) command line flag.

@item AutoWrap Toggle (Meta-W)
toggles the -w (@code{--nowrap}) command line flag.

@item Expert/Nohelp Toggle (Meta-X)
toggles the -x (@code{--nohelp}) command line flag.

@item Suspend Toggle (Meta-Z)
toggles the -z (@code{--suspend}) command line flag.

@item Open Previous File Toggle (Meta-<)
changes buffer to previously loaded file.

@item Open Next File Toggle (Meta->)
changes buffer to next loaded file.

@end table


@node The File Browser, Pico Compatibility, Feature Toggles, Top
@chapter The File Browser

When reading or writing files, pressing ^T will invoke the file browser.
Here, one can navigate directories in a graphical manner in order to
find the desired file.

Basic movement in the file browser is accomplished with the arrow keys
and page up/down.  The behavior of the enter (or `s') key varies by what
is currently selected.  If the currently selected object is a directory,
the file browser will enter and display the contents of the directory. 
If the object is a file, this filename and path are copied to the
statusbar and the file browser is exited.

@node Pico Compatibility, Building and Configure Options, The File Browser, Top
@chapter Pico Compatibility

@code{nano} attempts to emulate Pico as closely as possible, but there
are certain differences between the editors:

@table @code
@item Search and Replace History
As of version 1.2.5 of @code{nano}, text entered as search or replace
strings will be stored and can be accessed with the up/down
arrow keys.  Previously, @code{nano} offered a more consistent, but incompatible
with Pico, method for entering search and replace strings.  In the old
method, previous entries would be displayed by default as editable text 
in front of the cursor, as opposed to being bracketed and uneditable as 
it is in Pico.  The old behavior could be made compatible with Pico via the
@code{-p} flag, but recent versions of Pico use the @code{-p} flag 
to preserve the XON and XOFF sequences within the editor.  Since with the new 
method search and replace strings can still be edited by simply 
hitting the up arrow key once, the old method was removed completely.


@item Writing or Appending Selected Text to Files
Text selected using the Control-Caret (^^) key can be written out or
appended to a new or existing file using the Writeout key (^O).

@item Toggles
Many options which alter the functionality of the program can be 
"toggled" on or off using Meta key sequences, meaning the program does 
not have to be restarted to turn a particular feature of the editor 
on or off.  Please see the internal help function (^G) for a list of 
what functions can be toggled for a particular version of 
@code{nano}.  Also see @xref{Feature Toggles}, though this may be out
of date.

@item Cursor Position Display
The output of the "Display Cursor Position" in @code{nano} displays
the given column position, as well as the row and total character
position of the cursor.

@item Interactive Replace and Spell Checker
It is worth noting that the @code{nano} replace function is interactive,
i.e. it does not stop after one search string is found and automatically 
replace it.  The @code{nano} implementation will stop at each search
string found and query whether to replace this instance or not.  The 
internal spell checker operates similarly.  Note that these is no way 
to force these functions to behave in the Pico fashion.  As of 
version 1.2.5, misspelled words are sorted and trimmed for 
uniqueness in the internal spell checker such that the words 'apple' 
and 'Apple' will be prompted for correction separately.  
@end table

@node Building and Configure Options, , Pico Compatibility, Top
@chapter Building and Configure Options

Building @code{nano} from source is fairly straightforward if you are familiar
with compiling programs with autoconf support:

@itemize @bullet
@item tar xvfz nano-x.y.z.tar.gz (where x.y.z is the version of nano)
@item cd nano-x.y.z/
@item ./configure
@item make
@item make install
@end itemize

if you are looking to optimize @code{nano} for size, you may want to
consider the following command line options:


@table @code

@item --disable-tabcomp
Disable the tab completion code when reading or writing files.

@item --disable-justify
Disable the justify (^J)/unjustify (^U) functions in the editor.

@item --disable-speller
Disable spell checker ability.

@item --disable-help
Disable the help function (^G).  Disabling this option makes the binary
much smaller, but makes it difficult for new users to learn more than
very basic things about using the editor.

@item --disable-browser
Disable the mini file browser (^T) when reading or writing files.

@item --disable-mouse
Disable all mouse functionality.  This also disables the -m command line
flag, which enables the mouse functions.

@item --disable-operatingdir
Disable setting the operating directory.  This also disables the -o
command line flag.

@item --enable-tiny
This option disables all the above.  It also disables some of the larger
internals of the editor, like the marker code (^^) and the cut to line
(-k) option, which depends on the marker code to work properly.  It also
disables the function toggles.

@item --disable-wrapping
Disable all word wrapping in the editor.  This also eliminates the -w
command line flag, as nonwrapping is then the default behavior.

@item --disable-nls
Disables Native Language support. This will make the available GNU
@code{nano} translations unusable.

@item --with-slang
Compiling GNU @code{nano} with Slang is supported, and will make the
binary notably smaller than if compiled with ncurses or other curses
libraries.

@end table

@contents
@bye

--- NEW FILE: AUTHORS ---
$Id: AUTHORS,v 1.1 2006-08-16 23:41:01 stsp Exp $
This file lists people who have made significant contribution to the nano
editor.  Please see the ChangeLog for specific changes by author.
-------------------------------------------------------------------------

Chris Allegretta <chrisa at asty.org>
	* Original program author, stable series maintainer.

David Lawrence Ramsey <pooka_regent at sluggy.net>
	* Development series maintainer.  Multiple buffer support, 
	  operating dir (-o) option, bug fixes for display routines, 
	  wrapping code, spelling fixes, const mode and various other 
	  fixes.

Jordi Mallach <jordi at sindominio.net>
	* Debian package maintainer, fellow bug squasher.
	* Internationalization support head, ca.po maintainer.

Adam Rogoyski <rogoyski at cs.utexas.edu>
	* New write_file() function, read_file() optimization, mouse
	  support, resize support, nohelp (-x) option, justify function,
	  follow symlink option and bugfixes, and much more.

Robert Siemborski <rjs3 at andrew.cmu.edu>
	* Miscellaneous cut, display, replace, and other bug fixes,
	  original and new "magic line" code, read_line() function, new
	  edit display routines.

Rocco Corsi <rocco.corsi at sympatico.ca>
	* Internal spelling code, many optimizations and bug fixes for 
	  findnextstr and search-related functions, various display and
	  file handling fixes.

David Benbennick <dbenbenn at math.cornell.edu>
	* Wrap and justify bugfixes/enhancements, new color syntax
	  code, memleak fixes and other miscellaneous fixes.

--- NEW FILE: install-sh ---
#!/bin/sh
# install - install a program, script, or datafile

scriptversion=2005-02-02.21

# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.  It can only install one file at a time, a restriction
# shared with many OS's install programs.

# set DOITPROG to echo to test this script

# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"

# put in absolute paths if you don't have them in your path; or use env. vars.

mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"

chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=

usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
   or: $0 [OPTION]... SRCFILES... DIRECTORY
   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
   or: $0 [OPTION]... -d DIRECTORIES...

In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.

Options:
-c         (ignored)
-d         create directories instead of installing files.
-g GROUP   $chgrpprog installed files to GROUP.
-m MODE    $chmodprog installed files to MODE.
-o USER    $chownprog installed files to USER.
-s         $stripprog installed files.
-t DIRECTORY  install into DIRECTORY.
-T         report an error if DSTFILE is a directory.
--help     display this help and exit.
--version  display version info and exit.

Environment variables override the default commands:
  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"

while test -n "$1"; do
  case $1 in
    -c) shift
        continue;;

    -d) dir_arg=true
        shift
        continue;;

    -g) chgrpcmd="$chgrpprog $2"
        shift
        shift
        continue;;

    --help) echo "$usage"; exit $?;;

    -m) chmodcmd="$chmodprog $2"
        shift
        shift
        continue;;

    -o) chowncmd="$chownprog $2"
        shift
        shift
        continue;;

    -s) stripcmd=$stripprog
        shift
        continue;;

    -t) dstarg=$2
	shift
	shift
	continue;;

    -T) no_target_directory=true
	shift
	continue;;

    --version) echo "$0 $scriptversion"; exit $?;;

    *)  # When -d is used, all remaining arguments are directories to create.
	# When -t is used, the destination is already specified.
	test -n "$dir_arg$dstarg" && break
        # Otherwise, the last argument is the destination.  Remove it from $@.
	for arg
	do
          if test -n "$dstarg"; then
	    # $@ is not empty: it contains at least $arg.
	    set fnord "$@" "$dstarg"
	    shift # fnord
	  fi
	  shift # arg
	  dstarg=$arg
	done
	break;;
  esac
done

if test -z "$1"; then
  if test -z "$dir_arg"; then
    echo "$0: no input file specified." >&2
    exit 1
  fi
  # It's OK to call `install-sh -d' without argument.
  # This can happen when creating conditional directories.
  exit 0
fi

for src
do
  # Protect names starting with `-'.
  case $src in
    -*) src=./$src ;;
  esac

  if test -n "$dir_arg"; then
    dst=$src
    src=

    if test -d "$dst"; then
      mkdircmd=:
      chmodcmd=
    else
      mkdircmd=$mkdirprog
    fi
  else
    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
    # might cause directories to be created, which would be especially bad
    # if $src (and thus $dsttmp) contains '*'.
    if test ! -f "$src" && test ! -d "$src"; then
      echo "$0: $src does not exist." >&2
      exit 1
    fi

    if test -z "$dstarg"; then
      echo "$0: no destination specified." >&2
      exit 1
    fi

    dst=$dstarg
    # Protect names starting with `-'.
    case $dst in
      -*) dst=./$dst ;;
    esac

    # If destination is a directory, append the input filename; won't work
    # if double slashes aren't ignored.
    if test -d "$dst"; then
      if test -n "$no_target_directory"; then
	echo "$0: $dstarg: Is a directory" >&2
	exit 1
      fi
      dst=$dst/`basename "$src"`
    fi
  fi

  # This sed command emulates the dirname command.
  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`

  # Make sure that the destination directory exists.

  # Skip lots of stat calls in the usual case.
  if test ! -d "$dstdir"; then
    defaultIFS='
	 '
    IFS="${IFS-$defaultIFS}"

    oIFS=$IFS
    # Some sh's can't handle IFS=/ for some reason.
    IFS='%'
    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
    shift
    IFS=$oIFS

    pathcomp=

    while test $# -ne 0 ; do
      pathcomp=$pathcomp$1
      shift
      if test ! -d "$pathcomp"; then
        $mkdirprog "$pathcomp"
	# mkdir can fail with a `File exist' error in case several
	# install-sh are creating the directory concurrently.  This
	# is OK.
	test -d "$pathcomp" || exit
      fi
      pathcomp=$pathcomp/
    done
  fi

  if test -n "$dir_arg"; then
    $doit $mkdircmd "$dst" \
      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }

  else
    dstfile=`basename "$dst"`

    # Make a couple of temp file names in the proper directory.
    dsttmp=$dstdir/_inst.$$_
    rmtmp=$dstdir/_rm.$$_

    # Trap to clean up those temp files at exit.
    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
    trap '(exit $?); exit' 1 2 13 15

    # Copy the file name to the temp name.
    $doit $cpprog "$src" "$dsttmp" &&

    # and set any options; do chmod last to preserve setuid bits.
    #
    # If any of these fail, we abort the whole thing.  If we want to
    # ignore errors from any of these, just make sure not to ignore
    # errors from the above "$doit $cpprog $src $dsttmp" command.
    #
    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&

    # Now rename the file to the real destination.
    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
      || {
	   # The rename failed, perhaps because mv can't rename something else
	   # to itself, or perhaps because mv is so ancient that it does not
	   # support -f.

	   # Now remove or move aside any old file at destination location.
	   # We try this two ways since rm can't unlink itself on some
	   # systems and the destination file might be busy for other
	   # reasons.  In this case, the final cleanup might fail but the new
	   # file should still install successfully.
	   {
	     if test -f "$dstdir/$dstfile"; then
	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
	       || {
		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
		 (exit 1); exit 1
	       }
	     else
	       :
	     fi
	   } &&

	   # Now rename the file to the real destination.
	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
	 }
    }
  fi || { (exit 1); exit 1; }
done

# The final little trick to "correctly" pass the exit status to the exit trap.
{
  (exit 0); exit 0
}

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

--- NEW FILE: color.c ---
/* $Id: color.c,v 1.1 2006-08-16 23:41:02 stsp Exp $ */
/**************************************************************************
 *   color.c                                                              *
 *                                                                        *
 *   Copyright (C) 1999-2003 Chris Allegretta                             *
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
 *   the Free Software Foundation; either version 2, or (at your option)  *
 *   any later version.                                                   *
 *                                                                        *
 *   This program is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of       *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
 *   GNU General Public License for more details.                         *
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
 *                                                                        *
 **************************************************************************/

#include "config.h"

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "proto.h"
#include "nano.h"

#ifdef ENABLE_COLOR

/* For each syntax list entry, we go through the list of colors and
 * assign color pairs. */
void set_colorpairs(void)
{
    const syntaxtype *this_syntax = syntaxes;

    for(; this_syntax != NULL; this_syntax = this_syntax->next) {
	colortype *this_color = this_syntax->color;
	int color_pair = 1;

	for(; this_color != NULL; this_color = this_color->next) {
	    const colortype *beforenow = this_syntax->color;

	    for(; beforenow != NULL && beforenow != this_color && 
			(beforenow->fg != this_color->fg ||
			 beforenow->bg != this_color->bg ||
			 beforenow->bright != this_color->bright);
		    beforenow = beforenow->next)
		;

	    if (beforenow != NULL && beforenow != this_color)
		this_color->pairnum = beforenow->pairnum;
	    else {
		this_color->pairnum = color_pair;
		color_pair++;
	    }
	}
    }
}

void do_colorinit(void)
{
    if (has_colors()) {
	const colortype *tmpcolor = NULL;
#ifdef HAVE_USE_DEFAULT_COLORS
	int defok;
#endif

	start_color();
	/* Add in colors, if available */

#ifdef HAVE_USE_DEFAULT_COLORS
	defok = use_default_colors() != ERR;
#endif

	for (tmpcolor = colorstrings; tmpcolor != NULL;
		tmpcolor = tmpcolor->next) {
	    short background = tmpcolor->bg;

	    if (background == -1)
#ifdef HAVE_USE_DEFAULT_COLORS
		if (!defok)
#endif
		    background = COLOR_BLACK;

	    init_pair(tmpcolor->pairnum, tmpcolor->fg, background);

#ifdef DEBUG
	    fprintf(stderr, "Running %s with fg = %d and bg = %d\n",
		"init_pair()", tmpcolor->fg, tmpcolor->bg);
#endif
	}
    }
}

/* Update the color information based on the current filename. */
void update_color(void)
{
    const syntaxtype *tmpsyntax;

    colorstrings = NULL;
    for (tmpsyntax = syntaxes; tmpsyntax != NULL; tmpsyntax = tmpsyntax->next) {
	const exttype *e;

	for (e = tmpsyntax->extensions; e != NULL; e = e->next) {
	    /* Set colorstrings if we matched the extension regex */
	    if (regexec(&e->val, filename, 0, NULL, 0) == 0)
		colorstrings = tmpsyntax->color;

	    if (colorstrings != NULL)
		break;
	}
    }

    /* if we haven't found a match, use the override string */
    if (colorstrings == NULL && syntaxstr != NULL) {
	for (tmpsyntax = syntaxes; tmpsyntax != NULL; 
	     tmpsyntax = tmpsyntax->next) {
	    if (!strcasecmp(tmpsyntax->desc, syntaxstr))
		colorstrings = tmpsyntax->color;
	}
    }
    do_colorinit();
}

#endif /* ENABLE_COLOR */

--- NEW FILE: nano.info ---
This is ./nano.info, produced by makeinfo version 4.6 from ./nano.texi.

INFO-DIR-SECTION Editors
START-INFO-DIR-ENTRY
* nano: (nano).                 Small and friendly text editor.
END-INFO-DIR-ENTRY


File: nano.info,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)

   This manual documents GNU `nano', a small and friendly text editor.

* Menu:

* Introduction::
* Editor Basics::
* Online Help::
* Feature Toggles::
* The File Browser::
* Pico Compatibility::
* Building and Configure Options::


File: nano.info,  Node: Introduction,  Next: Editor Basics,  Prev: Top,  Up: Top

Introduction
************

GNU `nano' is a small and friendly text editor.  Besides basic text
editing, `nano' offers many extra features like an interactive search
and replace, goto line number, auto-indentation, feature toggles,
internationalization support, and filename tab completion.

* Menu:

* Overview::
* Command Line Options::


File: nano.info,  Node: Overview,  Next: Command Line Options,  Prev: Introduction,  Up: Introduction

Overview
========

`nano' +LINE [GNU long option] [option] [ FILE ... ]

   The original goal for `nano' was a complete bug-for-bug compatible
emulation of Pico, but nano's main goal is to be as compatible as
possible while offering a superset of Pico's functionality.  Also see
*Note Pico Compatibility::, for other differences.

   Email bug reports to <nano at nano-editor.org>.


File: nano.info,  Node: Command Line Options,  Prev: Overview,  Up: Introduction

Command Line Options
====================

`nano' takes the following options from the command line:

`-B, --backup'
     When saving a file, back up the previous version of it to the
     current filename suffixed with a ~.

`-D, --dos'
     Write file in DOS format.

`-F, --multibuffer'
     Enable multiple file buffers, if available.

`-I, --ignorercfiles'
     Don't look at $SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
     available.

`-K, --keypad'
     Do not use the ncurses keypad() call unless necessary.  Try this
     flag if you find that the arrow keys on the numeric keypad do not
     work for you under `nano'.

`-M, --mac'
     Write file in Mac format.

`-N, --noconvert'
     Do not convert files from DOS/Mac format.

`-Q [str], --quotestr [str]'
     Set the quoting string for justifying.  The default is

          `^([ \t]*[|>:}#])+'

     if regular expression support is available, or "> " otherwise.
     Note that `\t' above stands for a literal Tab character.

`-R, --regexp'
     Turn on regular expression search and search/replace.

`-S, --smooth'
     Enable smooth scrolling.

`-T [num], --tabsize=[num]'
     Set the displayed tab length to [num] columns.

`-V, --version'
     Print the version number and copyright and quit.

`-Y, --syntax=[str]'
     Specify a specific syntax highlighting from the .nanorc to use, if
     available.

`-c, --const'
     Constantly display the cursor position and line number on the
     statusbar.

`-h, --help'
     Print the usage and exit.

`-i, --autoindent'
     Automatically indent new lines to the same number of spaces and
     tabs as the previous line.

`-k, --cut'
     Makes ^K cut from the current cursor position to the end of the
     current line.

`-l, --nofollow'
     When writing files, if the given file is a symbolic link it is
     removed and a new file is created.

`-m, --mouse'
     Enables the use of the mouse to select text (currently only useful
     for running under the X window system).

`-o [dir], --operatingdir=[dir]'
     Set operating directory. Makes `nano' set up something similar to a
     chroot.

`-p, --preserve'
     Preserve the ^Q (XON) and ^S (XOFF) sequences so data being sent
     to the editor can be can be stopped and started.

`-r [#cols], --fill=[#cols].'
     Wrap lines at column #cols.  By default this is the width of the
     screen, less eight. If this value is negative, wrapping will occur
     at #cols from the right of the screen, allowing it to vary along
     with the screen width if the screen is resized.

`-s [prog], --speller=[prog]'
     Invoke [prog] as the spell checker.  By default, `nano' uses its
     own interactive spell checker that requires the `spell' program be
     installed on your system.

`-t, --tempfile'
     Do not ask whether or not to save the current contents of the file
     when exiting, assume yes.  This is most useful when using `nano'
     as the composer of a mailer program.

`-x, --nohelp'
     In Expert Mode, the Shortcut Lists will not appear at the bottom
     of the screen.  This affects the location of the statusbar as
     well, as in Expert Mode it is located at the very bottom of the
     editor.

     Note: When accessing the help system, Expert Mode is temporarily
     disabled to display the help system navigation keys.

`-v, --view'
     Do not allow the contents of the file to be altered.  Note that
     this flag should NOT be used in place of correct file permissions
     to implement a read-only file.

`-w, --nowrap'
     Do not wrap long lines at any length. This option overrides any
     value for -r.

`-z, --suspend'
     Enable suspend ability of `nano' using the system's suspend
     keystroke (usually ^Z).

`-a, -b, -e, -f, -g, -j'
     Ignored, for compatibility with Pico.

`+LINE'
     Start at line number LINE instead of the default of line 1.


File: nano.info,  Node: Editor Basics,  Next: Online Help,  Prev: Introduction,  Up: Top

Editor Basics
*************

* Menu:

* Entering Text::
* Special Functions::
* The Titlebar::
* The Statusbar::
* Shortcut Lists::


File: nano.info,  Node: Entering Text,  Next: Special Functions,  Prev: Editor Basics,  Up: Editor Basics

Entering Text
=============

All key sequences in `nano' are entered using the keyboard.  `nano' is
a "modeless" editor.  All keys with the exception of Control and Meta
key sequences will enter text into the file being edited.


File: nano.info,  Node: Special Functions,  Next: The Titlebar,  Prev: Entering Text,  Up: Editor Basics

Special Functions
=================

Special functions use the Control key (displayed in the help and
shortcut lists as ^) or the Meta key (displayed as M).

   * Control key sequences are entered by holding down the Control key
     and pressing the desired letter.

   * Meta key sequences can be entered in a number of possible ways:
     Pressing the Escape key, then releasing it and pressing the
     desired key, or holding down the Alt key while pressing the desired
     key.  This varies from keyboard to keyboard, and certain commercial
     operating systems "swallow" the Alt key so that it never reaches
     the application. If your operating system does this, you should
     use the Escape key to generate Meta key sequences.


File: nano.info,  Node: The Titlebar,  Next: The Statusbar,  Prev: Special Functions,  Up: Editor Basics

The Titlebar
============

The titlebar is the line displayed at the top of the editor.  There are
three sections: left, center and right. The section on the left displays
the version of `nano' being used.  The center section displays the
current file name, or "New Buffer" if the file has not yet been named.
The section on the right will display "Modified" if the file has been
modified since it was last saved or opened.

   Special modes: When `nano' is in "File browser" mode, the center
section will display the current directory instead of the filename.
*Note The File Browser::.


File: nano.info,  Node: The Statusbar,  Next: Shortcut Lists,  Prev: The Titlebar,  Up: Editor Basics

The Statusbar
=============

The statusbar is located three lines from the bottom of the screen (or
the bottom line in Expert Mode.  *Note Expert Mode::, for more info).

   The Statusbar shows important and informational messages.  Any error
messages that occur from using the editor will appear on the statusbar.
Any questions that are asked of the user will be asked on the statusbar,
and any user input (search strings, file names, etc) will be input on
the statusbar.


File: nano.info,  Node: Shortcut Lists,  Prev: The Statusbar,  Up: Editor Basics

Shortcut Lists
==============

The Shortcut Lists are the two lines at the bottom of the screen which
show some of the more commonly used functions in the editor.


File: nano.info,  Node: Online Help,  Next: Feature Toggles,  Prev: Editor Basics,  Up: Top

Online Help
***********

The online help system in `nano' is available by pressing ^G.  It is
fairly self explanatory, documenting the various parts of the editor
and available keystrokes.  Navigation is via the ^Y (Page Up) and ^V
(Page Down) keys.  ^X exits the help system.


File: nano.info,  Node: Feature Toggles,  Next: The File Browser,  Prev: Online Help,  Up: Top

Feature Toggles
***************

Toggles allow you to change certain aspects of the editor that would
normally be done via command line flags. They are invoked via certain
Meta key sequences. *Note Special Functions::, for more info.  The
following global toggles are available:

`Backup File Toggle (Meta-B)'
     toggles the -B (`--backup') command line flag.

`DOS Format Toggle (Meta-D)'
     toggles the -D (`--dos') command line flag.

`Multiple Files Toggle (Meta-F)'
     toggles the -F (`--multibuffer') command line flag.

`AutoIndent Toggle (Meta-I)'
     toggles the -i (`--autoindent') command line flag.

`Cut To End Toggle (Meta-K)'
     toggles the -k (`--cut') command line flag.

`Mouse Toggle (Meta-M)'
     toggles the -m (`--mouse') command line flag.

`Mac Format Toggle (Meta-O)'
     toggles the -M (`--mac') command line flag.

`Smooth Scrolling Toggle (Meta-S)'
     toggles the -S (`--smooth') command line flag.

`AutoWrap Toggle (Meta-W)'
     toggles the -w (`--nowrap') command line flag.

`Expert/Nohelp Toggle (Meta-X)'
     toggles the -x (`--nohelp') command line flag.

`Suspend Toggle (Meta-Z)'
     toggles the -z (`--suspend') command line flag.

`Open Previous File Toggle (Meta-<)'
     changes buffer to previously loaded file.

`Open Next File Toggle (Meta->)'
     changes buffer to next loaded file.



File: nano.info,  Node: The File Browser,  Next: Pico Compatibility,  Prev: Feature Toggles,  Up: Top

The File Browser
****************

When reading or writing files, pressing ^T will invoke the file browser.
Here, one can navigate directories in a graphical manner in order to
find the desired file.

   Basic movement in the file browser is accomplished with the arrow
keys and page up/down.  The behavior of the enter (or `s') key varies
by what is currently selected.  If the currently selected object is a
directory, the file browser will enter and display the contents of the
directory.  If the object is a file, this filename and path are copied
to the statusbar and the file browser is exited.


File: nano.info,  Node: Pico Compatibility,  Next: Building and Configure Options,  Prev: The File Browser,  Up: Top

Pico Compatibility
******************

`nano' attempts to emulate Pico as closely as possible, but there are
certain differences between the editors:

`Search and Replace History'
     As of version 1.2.5 of `nano', text entered as search or replace
     strings will be stored and can be accessed with the up/down arrow
     keys.  Previously, `nano' offered a more consistent, but
     incompatible with Pico, method for entering search and replace
     strings.  In the old method, previous entries would be displayed
     by default as editable text in front of the cursor, as opposed to
     being bracketed and uneditable as it is in Pico.  The old behavior
     could be made compatible with Pico via the `-p' flag, but recent
     versions of Pico use the `-p' flag to preserve the XON and XOFF
     sequences within the editor.  Since with the new method search and
     replace strings can still be edited by simply hitting the up arrow
     key once, the old method was removed completely.

`Writing or Appending Selected Text to Files'
     Text selected using the Control-Caret (^^) key can be written out
     or appended to a new or existing file using the Writeout key (^O).

`Toggles'
     Many options which alter the functionality of the program can be
     "toggled" on or off using Meta key sequences, meaning the program
     does not have to be restarted to turn a particular feature of the
     editor on or off.  Please see the internal help function (^G) for
     a list of what functions can be toggled for a particular version of
     `nano'.  Also see *Note Feature Toggles::, though this may be out
     of date.

`Cursor Position Display'
     The output of the "Display Cursor Position" in `nano' displays the
     given column position, as well as the row and total character
     position of the cursor.

`Interactive Replace and Spell Checker'
     It is worth noting that the `nano' replace function is interactive,
     i.e. it does not stop after one search string is found and
     automatically replace it.  The `nano' implementation will stop at
     each search string found and query whether to replace this
     instance or not.  The internal spell checker operates similarly.
     Note that these is no way to force these functions to behave in
     the Pico fashion.  As of version 1.2.5, misspelled words are
     sorted and trimmed for uniqueness in the internal spell checker
     such that the words 'apple' and 'Apple' will be prompted for
     correction separately.


File: nano.info,  Node: Building and Configure Options,  Prev: Pico Compatibility,  Up: Top

Building and Configure Options
******************************

Building `nano' from source is fairly straightforward if you are
familiar with compiling programs with autoconf support:

   * tar xvfz nano-x.y.z.tar.gz (where x.y.z is the version of nano)

   * cd nano-x.y.z/

   * ./configure

   * make

   * make install

   if you are looking to optimize `nano' for size, you may want to
consider the following command line options:

`--disable-tabcomp'
     Disable the tab completion code when reading or writing files.

`--disable-justify'
     Disable the justify (^J)/unjustify (^U) functions in the editor.

`--disable-speller'
     Disable spell checker ability.

`--disable-help'
     Disable the help function (^G).  Disabling this option makes the
     binary much smaller, but makes it difficult for new users to learn
     more than very basic things about using the editor.

`--disable-browser'
     Disable the mini file browser (^T) when reading or writing files.

`--disable-mouse'
     Disable all mouse functionality.  This also disables the -m
     command line flag, which enables the mouse functions.

`--disable-operatingdir'
     Disable setting the operating directory.  This also disables the -o
     command line flag.

`--enable-tiny'
     This option disables all the above.  It also disables some of the
     larger internals of the editor, like the marker code (^^) and the
     cut to line (-k) option, which depends on the marker code to work
     properly.  It also disables the function toggles.

`--disable-wrapping'
     Disable all word wrapping in the editor.  This also eliminates the
     -w command line flag, as nonwrapping is then the default behavior.

`--disable-nls'
     Disables Native Language support. This will make the available GNU
     `nano' translations unusable.

`--with-slang'
     Compiling GNU `nano' with Slang is supported, and will make the
     binary notably smaller than if compiled with ncurses or other
     curses libraries.




Tag Table:
Node: Top203
Node: Introduction513
Node: Overview936
Node: Command Line Options1421
Ref: Expert Mode4478
Node: Editor Basics5390
Node: Entering Text5615
Node: Special Functions5953
Node: The Titlebar6805
Node: The Statusbar7501
Node: Shortcut Lists8080
Node: Online Help8328
Node: Feature Toggles8701
Node: The File Browser10146
Node: Pico Compatibility10853
Node: Building and Configure Options13493

End Tag Table




More information about the dslinux-commit mailing list