Import tcsh-6.17.00
authorSimon 'corecode' Schubert <corecode@fs.ei.tum.de>
Wed, 30 Sep 2009 13:45:15 +0000 (15:45 +0200)
committerSimon 'corecode' Schubert <corecode@fs.ei.tum.de>
Wed, 30 Sep 2009 13:45:15 +0000 (15:45 +0200)
43 files changed:
contrib/tcsh-6/README
contrib/tcsh-6/complete.tcsh
contrib/tcsh-6/config.rpath [new file with mode: 0644]
contrib/tcsh-6/config_f.h
contrib/tcsh-6/ed.chared.c
contrib/tcsh-6/ed.decls.h
contrib/tcsh-6/ed.h
contrib/tcsh-6/ed.inputl.c
contrib/tcsh-6/ed.screen.c
contrib/tcsh-6/ed.term.h
contrib/tcsh-6/ed.xmap.c
contrib/tcsh-6/glob.c
contrib/tcsh-6/patchlevel.h
contrib/tcsh-6/sh.c
contrib/tcsh-6/sh.char.c
contrib/tcsh-6/sh.char.h
contrib/tcsh-6/sh.decls.h
contrib/tcsh-6/sh.dir.c
contrib/tcsh-6/sh.dol.c
contrib/tcsh-6/sh.err.c
contrib/tcsh-6/sh.exec.c
contrib/tcsh-6/sh.exp.c
contrib/tcsh-6/sh.file.c
contrib/tcsh-6/sh.func.c
contrib/tcsh-6/sh.glob.c
contrib/tcsh-6/sh.h
contrib/tcsh-6/sh.lex.c
contrib/tcsh-6/sh.proc.c
contrib/tcsh-6/sh.proc.h
contrib/tcsh-6/sh.sem.c
contrib/tcsh-6/sh.set.c
contrib/tcsh-6/tc.bind.c
contrib/tcsh-6/tc.const.c
contrib/tcsh-6/tc.decls.h
contrib/tcsh-6/tc.func.c
contrib/tcsh-6/tc.os.h
contrib/tcsh-6/tc.sig.h
contrib/tcsh-6/tc.str.c
contrib/tcsh-6/tcsh.man
contrib/tcsh-6/tcsh.vcproj [new file with mode: 0644]
contrib/tcsh-6/tw.color.c
contrib/tcsh-6/tw.comp.c
contrib/tcsh-6/tw.parse.c

index 9648c27..ae06b57 100644 (file)
@@ -1,4 +1,4 @@
-This is tcsh version 6.15.  Tcsh is a version of the Berkeley
+This is tcsh version 6.17.00.  Tcsh is a version of the Berkeley
 C-Shell, with the addition of: a command line editor, command and file
 name completion, listing, etc. and a bunch of small additions to the
 shell itself.
index 42edcbd..4e13bf8 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $tcsh: complete.tcsh,v 1.47 2006/03/02 18:46:44 christos Exp $
+# $tcsh: complete.tcsh,v 1.51 2007/10/01 21:51:59 christos Exp $
 # example file using the new completion code
 #
 # Debian GNU/Linux
@@ -38,18 +38,18 @@ endif
 if ($?_complete) then
     set noglob
     if ( ! $?hosts ) set hosts
-    foreach f ($HOME/.hosts /usr/local/etc/csh.hosts $HOME/.rhosts /etc/hosts.equiv)
-        if ( -r $f ) then
-           set hosts = ($hosts `grep -v "+" $f | grep -E -v "^#" | tr -s " " " " | cut -f 1`)
+    foreach f ("$HOME/.hosts" /usr/local/etc/csh.hosts "$HOME/.rhosts" /etc/hosts.equiv)
+        if ( -r "$f" ) then
+           set hosts = ($hosts `grep -v "+" "$f" | grep -E -v "^#" | tr -s " " "       " | cut -f 1`)
        endif
     end
-    if ( -r $HOME/.netrc ) then
-       set f=`awk '/machine/ { print $2 }' < $HOME/.netrc` >& /dev/null
+    if ( -r "$HOME/.netrc" ) then
+       set f=`awk '/machine/ { print $2 }' < "$HOME/.netrc"` >& /dev/null
        set hosts=($hosts $f)
     endif
-    if ( -r $HOME/.ssh/known_hosts ) then
-       set f=`cat $HOME/.ssh/known_hosts | cut -f 1 -d \ ` >& /dev/null
-       set f=`cat $HOME/.ssh/known_hosts | cut -f 1 -d \ | sed -e 's/,/ /g'` >& /dev/null
+    if ( -r "$HOME/.ssh/known_hosts" ) then
+       set f=`cat "$HOME/.ssh/known_hosts" | cut -f 1 -d \ ` >& /dev/null
+       set f=`cat "$HOME/.ssh/known_hosts" | cut -f 1 -d \ | sed -e 's/,/ /g'` >& /dev/null
        set hosts=($hosts $f)
     endif
     unset f
@@ -224,7 +224,7 @@ if ($?_complete) then
 
     # these should be merged with the MH completion hacks below - jgotts
     complete {refile,sprev,snext,scan,pick,rmm,inc,folder,show} \
-               c@+@F:$HOME/Mail/@
+               "c@+@F:$HOME/Mail/@"
 
     # these and interrupt handling from Jaap Vermeulen <jaap@sequent.com>
     complete {rexec,rxexec,rxterm,rmterm} \
@@ -286,7 +286,7 @@ if ($?_complete) then
     complete setenv    'p/1/e/' 'c/*:/f/'
 
     # these and method of setting hosts from Kimmo Suominen <kim@tac.nyc.ny.us>
-    if ( -f $HOME/.mh_profile && -x "`which folders`" ) then 
+    if ( -f "$HOME/.mh_profile" && -x "`which folders`" ) then 
 
     if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`"
     if ( ! $?MHA )     setenv MHA     "`ali | sed -e '/^ /d' -e 's/:.*//'`"
@@ -505,6 +505,19 @@ if ($?_complete) then
                        logout rdiff release remove rtag status tag unedit \
                        update watch watchers)/' 'n/-a/(edit unedit commit \
                        all none)/' 'n/watch/(on off add remove)/'
+    complete svn       'C@file:///@`'"${HOME}/etc/tcsh/complete.d/svn"'`@@' \
+                       'n@ls@(file:/// svn+ssh:// svn://)@@' \
+                       'n@help@(add blame cat checkout \
+                       cleanup commit copy delete export help \
+                       import info list ls lock log merge mkdir \
+                       move propdel propedit propget proplist \
+                       propset resolved revert status switch unlock \
+                       update)@' 'p@1@(add blame cat checkout \
+                       cleanup commit copy delete export help \
+                       import info list ls lock log merge mkdir \
+                       move propdel propedit propget proplist \
+                       propset resolved revert status switch unlock \
+                       update)@'
     complete cxx       'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
     complete detex     'p/*/f:*.tex/'
     complete edquota    'n/*/u/'
@@ -591,14 +604,14 @@ if ($?_complete) then
                        flush-logs flush-status flush-tables flush-privileges \
                        kill password ping processlist reload refresh \
                        shutdown status variables version)/'
-    complete mutt      c@-f=@F:${HOME}/Mail/@ \
+    complete mutt      "c@-f=@F:${HOME}/Mail/@" \
                        n/-a/f/ \
                        n/-F/f/ n/-H/f/ \
                        n/-s/x:'<subject line>'/ \
                        n/-e/x:'<command>'/ \
-                       n@-b@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
-                       n@-c@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
-                       n@*@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@
+                       n@-b@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ \
+                       n@-c@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ \
+                       n@*@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@
     complete ndc       'n/*/(status dumpdb reload stats trace notrace \
                        querylog start stop restart )/'
     if ($?traditional_complete) then
@@ -711,14 +724,15 @@ if ($?_complete) then
     complete unsetenv  n/*/e/
 
     set _maildir = /var/mail
-    if (-r $HOME/.mailrc) then
+    if (-r "$HOME/.mailrc") then
         complete mail  c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
-                       c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
+                       "c@+@F:$HOME/Mail@" C@[./\$~]@f@ n/-s/x:'<subject>'/ \
                        n@-u@T:$_maildir@ n/-f/f/ \
-                       n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " "     " | cut -f 2`'@
+                       n@*@'`sed -n s/alias//p "$HOME/.mailrc" | \
+                       tr -s " " "     " | cut -f 2`'@
     else
         complete mail  c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
-                       c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
+                       "c@+@F:$HOME/Mail@" C@[./\$~]@f@ n/-s/x:'<subject>'/ \
                        n@-u@T:$_maildir@ n/-f/f/ n/*/u/
     endif
     unset _maildir
@@ -1029,23 +1043,41 @@ n@public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \
                        N/{-C,--directory}/'`\ls $:-1`'/ \
                        n/-[0-7]/"(l m h)"/
 
-    # Linux filesystems
-    complete  mount    c/-/"(a f F h l n o r s t U v V w)"/ n/-[hV]/n/ \
-                       n/-o/x:'<options>'/ n/-t/x:'<vfstype>'/ \
-                       n/-L/x:'<label>'/ n/-U/x:'<uuid>'/ \
-                       n@*@'`grep -v "^#" /etc/fstab | tr -s " " "      " | cut -f 2`'@
-    complete umount    c/-/"(a h n r t v V)"/ n/-t/x:'<vfstype>'/ \
-                       n/*/'`mount | cut -d " " -f 3`'/
-    # Solaris filesystems
-    #complete  mount   c/-/"(a F m o O p r v V)"/ n/-p/n/ n/-v/n/ \
-    #                  n/-o/x:'<FSType_options>'/ \
-    #                  n@-F@'`\ls -1 /usr/lib/fs`'@ \
-    #                  n@*@'`grep -v "^#" /etc/vfstab | tr -s " " "     " | cut -f 3`'@
-    #complete umount   c/-/"(a o V)"/ n/-o/x:'<FSType_options>'/ \
-    #                  n/*/'`mount | cut -d " " -f 1`'/
-    #complete  mountall        c/-/"(F l r)"/ n@-F@'`\ls -1 /usr/lib/fs`'@
-    #complete umountall        c/-/"(F h k l r s)"/ n@-F@'`\ls -1 /usr/lib/fs`'@ \
-    #                  n/-h/'`df -k | cut -s -d ":" -f 1 | sort -u`'/
+    switch ( "$OSTYPE" )
+    case "linux":
+      # Linux filesystems
+      complete  mount  c/-/"(a f F h l n o r s t U v V w)"/ n/-[hV]/n/ \
+                       n/-o/x:'<options>'/ n/-t/x:'<vfstype>'/ \
+                       n/-L/x:'<label>'/ n/-U/x:'<uuid>'/ \
+                       n@*@'`grep -v "^#" /etc/fstab | tr -s " " "      " | cut -f 2`'@
+      complete umount  c/-/"(a h n r t v V)"/ n/-t/x:'<vfstype>'/ \
+                         n/*/'`mount | cut -d " " -f 3`'/
+      breaksw
+    case "sunos*":
+    case "solaris":
+      # Solaris filesystems
+      complete  mount  c/-/"(a F m o O p r v V)"/ n/-p/n/ n/-v/n/ \
+                       n/-o/x:'<FSType_options>'/ \
+                       n@-F@'`\ls -1 /usr/lib/fs`'@ \
+                       n@*@'`grep -v "^#" /etc/vfstab | tr -s " " "     " | cut -f 3`'@
+      complete umount  c/-/"(a o V)"/ n/-o/x:'<FSType_options>'/ \
+                       n/*/'`mount | cut -d " " -f 1`'/
+      complete  mountall       c/-/"(F l r)"/ n@-F@'`\ls -1 /usr/lib/fs`'@
+      complete umountall       c/-/"(F h k l r s)"/ n@-F@'`\ls -1 /usr/lib/fs`'@ \
+                       n/-h/'`df -k | cut -s -d ":" -f 1 | sort -u`'/
+      breaksw
+    case "cygwin":
+      # Cygwin mounts
+      complete  mount  c/-/"(b c f h m o p s t u v x E X)"/ n/-[hmpv]/n/ \
+                       n/-c/x:'/'/ \
+                       n/-o/"(user system binary text exec notexec cygexec nosuid managed)"/ \
+                       n@*@'`mount -p | tail -1 | cut -d " " -f 1 | xargs ls -1 | awk '"'"'{print $1":/"; } END{print "//";}'"'"'`'@
+      complete umount  c/-/"(A c h s S u U v)"/ n/-[AhSUv]/n/ \
+                       n@*@'`mount | grep -v noumount | cut -d " " -f 3`'@
+      breaksw
+    default:
+      breaksw
+    endsw
 
     # these deal with NIS (formerly YP); if it's not running you don't need 'em
     if (-X domainname) then
diff --git a/contrib/tcsh-6/config.rpath b/contrib/tcsh-6/config.rpath
new file mode 100644 (file)
index 0000000..3f1bef3
--- /dev/null
@@ -0,0 +1,571 @@
+#! /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-2005 Free Software Foundation, Inc.
+#   Taken from GNU libtool, 2001
+#   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+#   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.
+#
+# 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.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+#   than 256 bytes, otherwise the compiler driver will dump core. The only
+#   known workaround is to choose shorter directory names for the build
+#   directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+cc_basename=`echo "$CC" | sed -e 's%^.*/%%'`
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+  wl='-Wl,'
+else
+  case "$host_os" in
+    aix*)
+      wl='-Wl,'
+      ;;
+    darwin*)
+      case "$cc_basename" in
+        xlc*)
+          wl='-Wl,'
+          ;;
+      esac
+      ;;
+    mingw* | pw32* | os2*)
+      ;;
+    hpux9* | hpux10* | hpux11*)
+      wl='-Wl,'
+      ;;
+    irix5* | irix6* | nonstopux*)
+      wl='-Wl,'
+      ;;
+    newsos6)
+      ;;
+    linux*)
+      case $cc_basename in
+        icc* | ecc*)
+          wl='-Wl,'
+          ;;
+        pgcc | pgf77 | pgf90)
+          wl='-Wl,'
+          ;;
+        ccc*)
+          wl='-Wl,'
+          ;;
+        como)
+          wl='-lopt='
+          ;;
+      esac
+      ;;
+    osf3* | osf4* | osf5*)
+      wl='-Wl,'
+      ;;
+    sco3.2v5*)
+      ;;
+    solaris*)
+      wl='-Wl,'
+      ;;
+    sunos4*)
+      wl='-Qoption ld '
+      ;;
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      wl='-Wl,'
+      ;;
+    sysv4*MP*)
+      ;;
+    unicos*)
+      wl='-Wl,'
+      ;;
+    uts4*)
+      ;;
+  esac
+fi
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
+
+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/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+        ld_shlibs=no
+      fi
+      ;;
+    amigaos*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # Samuel A. Falvo II <kc5tja@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 cannot use
+      # them.
+      ld_shlibs=no
+      ;;
+    beos*)
+      if $LD --help 2>&1 | grep ': 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'
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    netbsd*)
+      ;;
+    solaris* | sysv5*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+        ld_shlibs=no
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    sunos4*)
+      hardcode_direct=yes
+      ;;
+    linux*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+  esac
+  if test "$ld_shlibs" = yes; then
+    # Unlike libtool, we use -rpath here, not --rpath, since the documented
+    # option of GNU ld is called -rpath, not --rpath.
+    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
+      # Begin _LT_AC_SYS_LIBPATH_AIX.
+      echo 'int main () { return 0; }' > conftest.c
+      ${CC} ${LDFLAGS} conftest.c -o conftest
+      aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      if test -z "$aix_libpath"; then
+        aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      fi
+      if test -z "$aix_libpath"; then
+        aix_libpath="/usr/lib:/lib"
+      fi
+      rm -f conftest.c conftest
+      # End _LT_AC_SYS_LIBPATH_AIX.
+      if test "$aix_use_runtimelinking" = yes; then
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+      else
+        if test "$host_cpu" = ia64; then
+          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+        else
+          hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        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
+      ;;
+    bsdi[45]*)
+      ;;
+    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=no
+      if test "$GCC" = yes ; then
+        :
+      else
+        case "$cc_basename" in
+          xlc*)
+            ;;
+          *)
+            ld_shlibs=no
+            ;;
+        esac
+      fi
+      ;;
+    dgux*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+    freebsd2.2*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    freebsd2*)
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    freebsd* | kfreebsd*-gnu | dragonfly*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    hpux9*)
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      ;;
+    hpux10* | hpux11*)
+      if test "$with_gnu_ld" = no; then
+        case "$host_cpu" in
+          hppa*64*)
+            hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+            hardcode_libdir_separator=:
+            hardcode_direct=no
+            ;;
+          ia64*)
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_direct=no
+            # hardcode_minus_L: Not really in the search PATH,
+            # but as the default location of the library.
+            hardcode_minus_L=yes
+            ;;
+          *)
+            hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+            hardcode_libdir_separator=:
+            hardcode_direct=yes
+            # hardcode_minus_L: Not really in the search PATH,
+            # but as the default location of the library.
+            hardcode_minus_L=yes
+            ;;
+        esac
+      fi
+      ;;
+    irix5* | irix6* | nonstopux*)
+      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)
+      case $host_vendor in
+        sni)
+          hardcode_direct=yes # is this really true???
+          ;;
+        siemens)
+          hardcode_direct=no
+          ;;
+        motorola)
+          hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+          ;;
+      esac
+      ;;
+    sysv4.3*)
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+        ld_shlibs=yes
+      fi
+      ;;
+    sysv4.2uw2*)
+      hardcode_direct=yes
+      hardcode_minus_L=no
+      ;;
+    sysv5OpenUNIX8* | sysv5UnixWare7* |  sysv5uw[78]* | unixware7*)
+      ;;
+    sysv5*)
+      hardcode_libdir_flag_spec=
+      ;;
+    uts4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    *)
+      ld_shlibs=no
+      ;;
+  esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
+libname_spec='lib$name'
+case "$host_os" in
+  aix3*)
+    ;;
+  aix4* | aix5*)
+    ;;
+  amigaos*)
+    ;;
+  beos*)
+    ;;
+  bsdi[45]*)
+    ;;
+  cygwin* | mingw* | pw32*)
+    shrext=.dll
+    ;;
+  darwin* | rhapsody*)
+    shrext=.dylib
+    ;;
+  dgux*)
+    ;;
+  freebsd1*)
+    ;;
+  kfreebsd*-gnu)
+    ;;
+  freebsd*)
+    ;;
+  gnu*)
+    ;;
+  hpux9* | hpux10* | hpux11*)
+    case "$host_cpu" in
+      ia64*)
+        shrext=.so
+        ;;
+      hppa*64*)
+        shrext=.sl
+        ;;
+      *)
+        shrext=.sl
+        ;;
+    esac
+    ;;
+  irix5* | irix6* | nonstopux*)
+    case "$host_os" in
+      irix5* | nonstopux*)
+        libsuff= shlibsuff=
+        ;;
+      *)
+        case $LD in
+          *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+          *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+          *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+          *) libsuff= shlibsuff= ;;
+        esac
+        ;;
+    esac
+    ;;
+  linux*oldld* | linux*aout* | linux*coff*)
+    ;;
+  linux*)
+    ;;
+  knetbsd*-gnu)
+    ;;
+  netbsd*)
+    ;;
+  newsos6)
+    ;;
+  nto-qnx*)
+    ;;
+  openbsd*)
+    ;;
+  os2*)
+    libname_spec='$name'
+    shrext=.dll
+    ;;
+  osf3* | osf4* | osf5*)
+    ;;
+  sco3.2v5*)
+    ;;
+  solaris*)
+    ;;
+  sunos4*)
+    ;;
+  sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+    ;;
+  sysv4*MP*)
+    ;;
+  uts4*)
+    ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+LC_ALL=C 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"
+
+EOF
index aee7363..1fd3921 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/config_f.h,v 3.40 2006/08/28 14:53:04 mitr Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/config_f.h,v 3.42 2009/06/25 12:10:56 christos Exp $ */
 /*
  * config_f.h -- configure various defines for tcsh
  *
  *             This can be much slower and no memory statistics will be
  *             provided.
  */
-#if defined(__MACHTEN__) || defined(PURIFY) || defined(MALLOC_TRACE) || defined(_OSD_POSIX) || defined(__MVS__) || defined (__linux__)
+#if defined(__MACHTEN__) || defined(PURIFY) || defined(MALLOC_TRACE) || defined(_OSD_POSIX) || defined(__MVS__)
 # define SYSMALLOC
 #else
 # undef SYSMALLOC
 # ifndef __GNUC__
 #  define RCSID(id) static char *rcsid = (id);
 # else
-#  define RCSID(id) static char *rcsid(const char *a) { return rcsid(a = id); }
+#  define RCSID(id) static const char rcsid[] __attribute__((__used__)) = (id);
 # endif /* !__GNUC__ */
 #else
 # define RCSID(id)     /* Nothing */
index 9f09c68..1ab5a91 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/ed.chared.c,v 3.93 2006/08/23 15:03:13 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.chared.c,v 3.95 2009/06/25 21:15:37 christos Exp $ */
 /*
  * ed.chared.c: Character editing functions.
  */
@@ -72,7 +72,7 @@
 
 #include "sh.h"
 
-RCSID("$tcsh: ed.chared.c,v 3.93 2006/08/23 15:03:13 christos Exp $")
+RCSID("$tcsh: ed.chared.c,v 3.95 2009/06/25 21:15:37 christos Exp $")
 
 #include "ed.h"
 #include "tw.h"
@@ -120,8 +120,8 @@ static      Char    *c_prev_word            (Char *, Char *, int);
 static Char    *c_next_word            (Char *, Char *, int);
 static Char    *c_number               (Char *, int *, int);
 static Char    *c_expand               (Char *);
-static void     c_excl                 (Char *);
-static void     c_substitute           (void);
+static int      c_excl                 (Char *);
+static int      c_substitute           (void);
 static void     c_delfini              (void);
 static int      c_hmatch               (Char *);
 static void     c_hsetpat              (void);
@@ -682,13 +682,16 @@ excl_err:
  * space (or the beginning of the buffer) and properly expand all the excl's
  * from there up to the current cursor position. We also avoid (trying to)
  * expanding '>!'
+ * Returns number of expansions attempted (doesn't matter whether they succeeded
+ * or not).
  */
 
-static void
+static int
 c_excl(Char *p)
 {
     int i;
     Char *q;
+    int nr_exp;
 
     /*
      * if />[SPC TAB]*![SPC TAB]/, back up p to just after the >. otherwise,
@@ -708,9 +711,10 @@ c_excl(Char *p)
 
     /*
      * Forever: Look for history char.  (Stop looking when we find the cursor.)
-     * Count backslashes.  Of odd, skip history char. Return if all done.
-     * Expand if even number of backslashes.
+     * Count backslashes.  If odd, skip history char.  Expand if even number of
+     * backslashes.
      */
+    nr_exp = 0;
     for (;;) {
        while (*p != HIST && p < Cursor)
            ++p;
@@ -718,18 +722,23 @@ c_excl(Char *p)
            continue;
        if (i % 2 == 0)
            ++p;
-       if (p >= Cursor)
-           return;
-       if (i % 2 == 1)
+       if (p >= Cursor)   /* all done */
+           return nr_exp;
+       if (i % 2 == 1) {
            p = c_expand(p);
+           ++nr_exp;
+       }
     }
+
+    return nr_exp;
 }
 
 
-static void
+static int
 c_substitute(void)
 {
     Char *p;
+    int  nr_exp;
 
     /*
      * Start p out one character before the cursor.  Move it backwards looking
@@ -743,8 +752,12 @@ c_substitute(void)
      * If we found a history character, go expand it.
      */
     if (*p == HIST)
-       c_excl(p);
+       nr_exp = c_excl(p);
+    else
+        nr_exp = 0;
     Refresh();
+
+    return nr_exp;
 }
 
 static void
@@ -3441,13 +3454,20 @@ e_tty_stopo(Char c)
     return(CC_NORM);
 }
 
+/* returns the number of (attempted) expansions */
+int
+ExpandHistory(void)
+{
+    *LastChar = '\0';          /* just in case */
+    return c_substitute();
+}
+
 /*ARGSUSED*/
 CCRETVAL
 e_expand_history(Char c)
 {
     USE(c);
-    *LastChar = '\0';          /* just in case */
-    c_substitute();
+    (void)ExpandHistory();
     return(CC_NORM);
 }
 
@@ -3457,7 +3477,7 @@ e_magic_space(Char c)
 {
     USE(c);
     *LastChar = '\0';          /* just in case */
-    c_substitute();
+    (void)c_substitute();
     return(e_insert(' '));
 }
 
@@ -3548,7 +3568,7 @@ e_load_average(Char c)
      */
     if (ioctl(SHIN, TIOCSTAT, (ioctl_t) &c) < 0) 
 #endif
-       xprintf(CGETS(5, 1, "Load average unavailable\n"));
+       xprintf("%s", CGETS(5, 1, "Load average unavailable\n"));
     return(CC_REFRESH);
 }
 
index a9628ce..16197d6 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/ed.decls.h,v 3.44 2006/08/23 15:03:13 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.decls.h,v 3.45 2008/10/17 20:25:00 christos Exp $ */
 /*
  * ed.decls.h: Editor external definitions
  */
@@ -37,6 +37,7 @@
  * ed.chared.c
  */
 extern int     InsertStr               (Char *);
+extern int     ExpandHistory           (void);
 extern void    DeleteBack              (int);
 extern void    SetKillRing             (int);
 extern CCRETVAL GetHistLine            (void);
@@ -194,6 +195,7 @@ extern      CCRETVAL        e_copyregion            (Char);
 extern CCRETVAL        e_tty_int               (Char);
 extern CCRETVAL        e_run_fg_editor         (Char);
 extern CCRETVAL        e_list_eof              (Char);
+extern int             e_expand_history_rne    (Char);
 extern CCRETVAL        e_expand_history        (Char);
 extern CCRETVAL        e_magic_space           (Char);
 extern CCRETVAL        e_list_glob             (Char);
index 10e519c..a53b88a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/ed.h,v 3.49 2006/08/23 15:03:13 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.h,v 3.50 2007/07/05 14:13:06 christos Exp $ */
 /*
  * ed.h: Editor declarations and globals
  */
 # define NT_NUM_KEYS   256
 #endif /* WINNT_NATIVE */
 
+#ifdef __QNXNTO__
+#undef min
+#undef max
+#endif
+
 /****************************************************************************/
 /* stuff for the different states returned by the character editor routines */
 /****************************************************************************/
index a97058e..248130a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/ed.inputl.c,v 3.66 2006/11/29 22:32:24 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.inputl.c,v 3.70 2009/06/25 21:15:37 christos Exp $ */
 /*
  * ed.inputl.c: Input line handling.
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: ed.inputl.c,v 3.66 2006/11/29 22:32:24 christos Exp $")
+RCSID("$tcsh: ed.inputl.c,v 3.70 2009/06/25 21:15:37 christos Exp $")
 
 #include "ed.h"
 #include "ed.defns.h"          /* for the function names */
@@ -45,8 +45,10 @@ RCSID("$tcsh: ed.inputl.c,v 3.66 2006/11/29 22:32:24 christos Exp $")
 extern int MapsAreInited;
 
 /* mismatched first character */
-static Char mismatch[] = 
-    {'!', '^' , '\\', '-', '%', '\0', '"', '\'', '`', '\0' };
+static Char mismatch[] = { '\\', '-', '%', '\0' };
+/* don't Strchr() for '\0', obey current history character settings */
+#define MISMATCH(c) ((c) == '\0' || (c) == HIST || (c) == HISTSUB || \
+                       Strchr(mismatch, (c)))
 
 static int     Repair          (void);
 static int     GetNextCommand  (KEYCMD *, Char *);
@@ -89,10 +91,12 @@ Inputl(void)
     struct varent *imode = adrof(STRinputmode);
     Char   *SaveChar, *CorrChar;
     int     matchval;          /* from tenematch() */
+    int     nr_history_exp;     /* number of (attempted) history expansions */
     COMMAND fn;
     int curlen = 0;
     int newlen;
     int idx;
+    Char *autoexpand;
 
     if (!MapsAreInited)                /* double extra just in case */
        ed_InitMaps();
@@ -260,13 +264,13 @@ Inputl(void)
                    ch = tch;
                    if (ch == 'y' || ch == ' ') {
                        LastChar = CorrChar;    /* Restore the corrected end */
-                       xprintf(CGETS(6, 2, "yes\n"));
+                       xprintf("%s", CGETS(6, 2, "yes\n"));
                    }
                    else {
                        Strcpy(InputBuf, Origin);
                        LastChar = SaveChar;
                        if (ch == 'e') {
-                           xprintf(CGETS(6, 3, "edit\n"));
+                           xprintf("%s", CGETS(6, 3, "edit\n"));
                            *LastChar-- = '\0';
                            Cursor = LastChar;
                            printprompt(3, NULL);
@@ -277,7 +281,7 @@ Inputl(void)
                            break;
                        }
                        else if (ch == 'a') {
-                           xprintf(CGETS(6, 4, "abort\n"));
+                           xprintf("%s", CGETS(6, 4, "abort\n"));
                            LastChar = InputBuf;   /* Null the current line */
                            Cursor = LastChar;
                            printprompt(0, NULL);
@@ -285,7 +289,7 @@ Inputl(void)
                            cleanup_until(Origin);
                            break;
                        }
-                       xprintf(CGETS(6, 5, "no\n"));
+                       xprintf("%s", CGETS(6, 5, "no\n"));
                    }
                    flush();
                }
@@ -305,9 +309,9 @@ Inputl(void)
                     PastBottom();
                }
                if (matchval == 0) {
-                   xprintf(CGETS(6, 6, "No matching command\n"));
+                   xprintf("%s", CGETS(6, 6, "No matching command\n"));
                } else if (matchval == 2) {
-                   xprintf(CGETS(6, 7, "Ambiguous command\n"));
+                   xprintf("%s", CGETS(6, 7, "Ambiguous command\n"));
                }
                if (NeedsRedraw) {
                    ClearLines();
@@ -394,65 +398,73 @@ Inputl(void)
            curlen = (int) (LastChar - InputBuf);
 
 
-           if (adrof(STRautoexpand))
-               (void) e_expand_history(0);
-           /*
-            * Modified by Martin Boyer (gamin@ireq-robot.hydro.qc.ca):
-            * A separate variable now controls beeping after
-            * completion, independently of autolisting.
-            */
-           expnum = (int) (Cursor - InputBuf);
-           switch (matchval = tenematch(InputBuf, Cursor-InputBuf, fn)){
-           case 1:
-               if (non_unique_match && matchbeep && matchbeep->vec != NULL &&
-                   (Strcmp(*(matchbeep->vec), STRnotunique) == 0))
-                   SoundBeep();
-               break;
-           case 0:
-               if (matchbeep && matchbeep->vec != NULL) {
-                   if (Strcmp(*(matchbeep->vec), STRnomatch) == 0 ||
-                       Strcmp(*(matchbeep->vec), STRambiguous) == 0 ||
-                       Strcmp(*(matchbeep->vec), STRnotunique) == 0)
+           nr_history_exp = 0;
+           autoexpand = varval(STRautoexpand);
+           if (autoexpand != STRNULL)
+               nr_history_exp += ExpandHistory();
+
+           /* try normal expansion only if no history references were found */
+           if (nr_history_exp == 0 ||
+               Strcmp(autoexpand, STRonlyhistory) != 0) {
+               /*
+                * Modified by Martin Boyer (gamin@ireq-robot.hydro.qc.ca):
+                * A separate variable now controls beeping after
+                * completion, independently of autolisting.
+                */
+               expnum = (int) (Cursor - InputBuf);
+               switch (matchval = tenematch(InputBuf, Cursor-InputBuf, fn)){
+               case 1:
+                   if (non_unique_match && matchbeep &&
+                       matchbeep->vec != NULL &&
+                       (Strcmp(*(matchbeep->vec), STRnotunique) == 0))
                        SoundBeep();
-               }
-               else
-                   SoundBeep();
-               break;
-           default:
-               if (matchval < 0) {     /* Error from tenematch */
-                   curchoice = -1;
-                   SoundBeep();
                    break;
-               }
-               if (matchbeep && matchbeep->vec != NULL) {
-                   if ((Strcmp(*(matchbeep->vec), STRambiguous) == 0 ||
-                        Strcmp(*(matchbeep->vec), STRnotunique) == 0))
+               case 0:
+                   if (matchbeep && matchbeep->vec != NULL) {
+                       if (Strcmp(*(matchbeep->vec), STRnomatch) == 0 ||
+                           Strcmp(*(matchbeep->vec), STRambiguous) == 0 ||
+                           Strcmp(*(matchbeep->vec), STRnotunique) == 0)
+                           SoundBeep();
+                   }
+                   else
                        SoundBeep();
-               }
-               else
-                   SoundBeep();
-               /*
-                * Addition by David C Lawrence <tale@pawl.rpi.edu>: If an 
-                * attempted completion is ambiguous, list the choices.  
-                * (PWP: this is the best feature addition to tcsh I have 
-                * seen in many months.)
-                */
-               if (autol && autol->vec != NULL && 
-                   (Strcmp(*(autol->vec), STRambiguous) != 0 || 
-                                    expnum == Cursor - InputBuf)) {
-                   if (adrof(STRhighlight) && MarkIsSet) {
-                       /* clear highlighting before showing completions */
-                       MarkIsSet = 0;
-                       ClearLines();
-                       ClearDisp();
-                       Refresh();
-                       MarkIsSet = 1;
+                   break;
+               default:
+                   if (matchval < 0) { /* Error from tenematch */
+                       curchoice = -1;
+                       SoundBeep();
+                       break;
                    }
-                   PastBottom();
-                   fn = (retval == CC_COMPLETE_ALL) ? LIST_ALL : LIST;
-                   (void) tenematch(InputBuf, Cursor-InputBuf, fn);
+                   if (matchbeep && matchbeep->vec != NULL) {
+                       if ((Strcmp(*(matchbeep->vec), STRambiguous) == 0 ||
+                            Strcmp(*(matchbeep->vec), STRnotunique) == 0))
+                           SoundBeep();
+                   }
+                   else
+                       SoundBeep();
+                   /*
+                    * Addition by David C Lawrence <tale@pawl.rpi.edu>: If an 
+                    * attempted completion is ambiguous, list the choices.  
+                    * (PWP: this is the best feature addition to tcsh I have 
+                    * seen in many months.)
+                    */
+                   if (autol && autol->vec != NULL && 
+                       (Strcmp(*(autol->vec), STRambiguous) != 0 || 
+                                        expnum == Cursor - InputBuf)) {
+                       if (adrof(STRhighlight) && MarkIsSet) {
+                           /* clear highlighting before showing completions */
+                           MarkIsSet = 0;
+                           ClearLines();
+                           ClearDisp();
+                           Refresh();
+                           MarkIsSet = 1;
+                       }
+                       PastBottom();
+                       fn = (retval == CC_COMPLETE_ALL) ? LIST_ALL : LIST;
+                       (void) tenematch(InputBuf, Cursor-InputBuf, fn);
+                   }
+                   break;
                }
-               break;
            }
            if (NeedsRedraw) {
                PastBottom();
@@ -845,10 +857,7 @@ SpellLine(int cmdonly)
                Cursor--;
            endflag = 0;
        }
-       /* Obey current history character settings */
-       mismatch[0] = HIST;
-       mismatch[1] = HISTSUB;
-       if (!Strchr(mismatch, *argptr) &&
+       if (!MISMATCH(*argptr) &&
            (!cmdonly || starting_a_command(argptr, InputBuf))) {
 #ifdef WINNT_NATIVE
            /*
@@ -926,7 +935,7 @@ CompleteLine(void)
                Cursor--;
            endflag = 0;
        }
-       if (!Strchr(mismatch, *argptr) && starting_a_command(argptr, InputBuf)) {
+       if (!MISMATCH(*argptr) && starting_a_command(argptr, InputBuf)) {
            tmatch = tenematch(InputBuf, Cursor - InputBuf, RECOGNIZE);
            if (tmatch <= 0) {
                 return 0;
index c0ede76..cf36717 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/ed.screen.c,v 3.75 2006/08/24 20:56:31 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.screen.c,v 3.76 2009/06/25 21:15:37 christos Exp $ */
 /*
  * ed.screen.c: Editor/termcap-curses interface
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: ed.screen.c,v 3.75 2006/08/24 20:56:31 christos Exp $")
+RCSID("$tcsh: ed.screen.c,v 3.76 2009/06/25 21:15:37 christos Exp $")
 
 #include "ed.h"
 #include "tc.h"
@@ -383,8 +383,8 @@ TellTC(void)
     struct termcapstr *t;
     char *first, *s;
 
-    xprintf(CGETS(7, 1, "\n\tTcsh thinks your terminal has the\n"));
-    xprintf(CGETS(7, 2, "\tfollowing characteristics:\n\n"));
+    xprintf("%s", CGETS(7, 1, "\n\tTcsh thinks your terminal has the\n"));
+    xprintf("%s", CGETS(7, 2, "\tfollowing characteristics:\n\n"));
     xprintf(CGETS(7, 3, "\tIt has %d columns and %d lines\n"),
            Val(T_co), Val(T_li));
     s = strsave(T_HasMeta ? CGETS(7, 5, "a") : CGETS(7, 6, "no"));
@@ -610,7 +610,7 @@ EchoTC(Char **v)
        scap = tgetstr(cv, &area);
     if (!scap || scap[0] == '\0') {
        if (tgetflag(cv)) {
-           xprintf(CGETS(7, 14, "yes\n"));
+           xprintf("%s", CGETS(7, 14, "yes\n"));
            goto end;
        }
        if (silent)
index c610130..9ae8328 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/ed.term.h,v 1.17 2004/12/25 21:15:06 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.term.h,v 1.18 2007/07/05 14:13:06 christos Exp $ */
 /*
  * ed.term.h: Local terminal header
  */
  * Also for RH6.2 on the alpha, defined TIOCGLTC, but does not have
  * struct ltchars
  */
-#if (defined(hpux) && defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT)) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
+#if (defined(hpux) && defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT)) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) || defined(__QNXNTO__)
 # undef TIOCGLTC       /* not really needed */
 # undef TIOCSLTC
 #endif
index 866bc83..acd29d3 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/ed.xmap.c,v 3.36 2006/11/29 22:30:09 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.xmap.c,v 3.37 2009/06/25 21:15:37 christos Exp $ */
 /*
  * ed.xmap.c: This module contains the procedures for maintaining
  *           the extended-key map.
@@ -88,7 +88,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: ed.xmap.c,v 3.36 2006/11/29 22:30:09 christos Exp $")
+RCSID("$tcsh: ed.xmap.c,v 3.37 2009/06/25 21:15:37 christos Exp $")
 
 #include "ed.h"
 #include "ed.defns.h"
@@ -216,12 +216,13 @@ AddXkey(const CStr *Xkey, XmapVal *val, int ntype)
     cs.buf = Xkey->buf;
     cs.len = Xkey->len;
     if (Xkey->len == 0) {
-       xprintf(CGETS(9, 1, "AddXkey: Null extended-key not allowed.\n"));
+       xprintf("%s", CGETS(9, 1, "AddXkey: Null extended-key not allowed.\n"));
        return;
     }
 
     if (ntype == XK_CMD && val->cmd == F_XKEY) {
-       xprintf(CGETS(9, 2, "AddXkey: sequence-lead-in command not allowed\n"));
+       xprintf("%s",
+           CGETS(9, 2, "AddXkey: sequence-lead-in command not allowed\n"));
        return;
     }
 
@@ -318,7 +319,8 @@ DeleteXkey(const CStr *Xkey)
 
     s = *Xkey;
     if (s.len == 0) {
-       xprintf(CGETS(9, 3, "DeleteXkey: Null extended-key not allowed.\n"));
+       xprintf("%s",
+               CGETS(9, 3, "DeleteXkey: Null extended-key not allowed.\n"));
        return (-1);
     }
 
@@ -669,7 +671,7 @@ parseescape(const Char **ptr)
                    val = (val << 3) | (ch - '0');
                }
                if ((val & ~0xff) != 0) {
-                   xprintf(CGETS(9, 9,
+                   xprintf("%s", CGETS(9, 9,
                            "Octal constant does not fit in a char.\n"));
                    return 0;
                }
index 844ee36..a828f63 100644 (file)
@@ -329,8 +329,8 @@ glob(const char *pattern, int flags, int (*errfunc) (const char *, int),
            
            len = mblen((const char *)(patnext - 1), MB_LEN_MAX);
            if (len == -1)
-               mblen(NULL, 0);
-           if (len > 1) {
+               (void)mblen(NULL, 0);
+           else if (len > 1) {
                *bufnext++ = (Char) c;
                while (--len != 0)
                    *bufnext++ = (Char) (*patnext++ | M_PROTECT);
index f1c5a10..c0801cb 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/patchlevel.h,v 3.161 2007/03/03 20:01:26 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/patchlevel.h,v 3.167 2009/07/10 17:09:32 christos Exp $ */
 /*
  * patchlevel.h: Our life story.
  */
@@ -7,8 +7,8 @@
 
 #define ORIGIN "Astron"
 #define REV 6
-#define VERS 15
+#define VERS 17
 #define PATCHLEVEL 0
-#define DATE "2007-03-03"
+#define DATE "2009-07-10"
 
 #endif /* _h_patchlevel */
index 57b1bef..73b6d7f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.c,v 3.136 2007/02/22 21:57:37 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.c,v 3.145 2009/06/25 21:15:37 christos Exp $ */
 /*
  * sh.c: Main shell routines
  */
@@ -39,7 +39,7 @@ char    copyright[] =
  All rights reserved.\n";
 #endif /* not lint */
 
-RCSID("$tcsh: sh.c,v 3.136 2007/02/22 21:57:37 christos Exp $")
+RCSID("$tcsh: sh.c,v 3.145 2009/06/25 21:15:37 christos Exp $")
 
 #include "tc.h"
 #include "ed.h"
@@ -139,6 +139,7 @@ struct saved_state {
     Char         HIST;
     int          cantell;
     struct Bin   B;
+    int                  justpr;
 };
 
 static int               srccat        (Char *, Char *);
@@ -229,10 +230,6 @@ main(int argc, char **argv)
        xclose(f);
     }
 
-#ifdef O_TEXT
-    setmode(0, O_TEXT);
-#endif
-
     osinit();                  /* Os dependent initialization */
 
     
@@ -457,12 +454,12 @@ main(int argc, char **argv)
        if (*cp) {
            /* only for login shells or root and we must have a tty */
            if ((cp2 = Strrchr(cp, (Char) '/')) != NULL) {
-               cp = cp2 + 1;
+               cp2 = cp2 + 1;
            }
            else
                cp2 = cp;
            if (!(((Strncmp(cp2, STRtty, 3) == 0) && Isalpha(cp2[3])) ||
-                 ((Strncmp(cp, STRpts, 3) == 0) && cp[3] == '/'))) {
+                 Strstr(cp, STRptssl) != NULL)) {
                if (getenv("DISPLAY") == NULL) {
                    /* NOT on X window shells */
                    setcopy(STRautologout, STRdefautologout, VAR_READWRITE);
@@ -761,7 +758,7 @@ main(int argc, char **argv)
     }
     if (argc > 1 && strcmp(argv[1], "--help") == 0) {
        xprintf("%S\n\n", varval(STRversion));
-       xprintf(CGETS(11, 8, HELP_STRING));
+       xprintf("%s", CGETS(11, 8, HELP_STRING));
        xexit(0);
     }
     /*
@@ -945,9 +942,6 @@ main(int argc, char **argv)
            /* ... doesn't return */
            stderror(ERR_SYSTEM, tempv[0], strerror(errno));
        }
-#ifdef O_TEXT
-       setmode(nofile, O_TEXT);
-#endif
        xfree(ffile);
        dolzero = 1;
        ffile = SAVE(tempv[0]);
@@ -1110,17 +1104,7 @@ main(int argc, char **argv)
            }
 #endif /* NeXT */
 #ifdef BSDJOBS                 /* if we have tty job control */
-    retry:
-           if ((tpgrp = tcgetpgrp(f)) != -1) {
-               if (tpgrp != shpgrp) {
-                   struct sigaction old;
-
-                   sigaction(SIGTTIN, NULL, &old);
-                   signal(SIGTTIN, SIG_DFL);
-                   (void) kill(0, SIGTTIN);
-                   sigaction(SIGTTIN, &old, NULL);
-                   goto retry;
-               }
+           if (grabpgrp(f, shpgrp) != -1) {
                /*
                 * Thanks to Matt Day for the POSIX references, and to
                 * Paul Close for the SGI clarification.
@@ -1178,8 +1162,9 @@ main(int argc, char **argv)
            if (tpgrp == -1) {
        notty:
                xprintf(CGETS(11, 1, "Warning: no access to tty (%s).\n"),
-                       strerror(errno));
-               xprintf(CGETS(11, 2, "Thus no job control in this shell.\n"));
+                   strerror(errno));
+               xprintf("%s",
+                   CGETS(11, 2, "Thus no job control in this shell.\n"));
                /*
                 * Fix from:Sakari Jalovaara <sja@sirius.hut.fi> if we don't
                 * have access to tty, disable editing too
@@ -1423,9 +1408,6 @@ srcfile(const char *f, int onlyown, int flag, Char **av)
 
     if ((unit = xopen(f, O_RDONLY|O_LARGEFILE)) == -1) 
        return 0;
-#ifdef O_TEXT
-    setmode(unit, O_TEXT);
-#endif
     cleanup_push(&unit, open_cleanup);
     unit = dmove(unit, -1);
     cleanup_ignore(&unit);
@@ -1490,6 +1472,7 @@ st_save(struct saved_state *st, int unit, int hflg, Char **al, Char **av)
     st->alvec          = alvec;
     st->onelflg                = onelflg;
     st->enterhist      = enterhist;
+    st->justpr         = justpr;
     if (hflg)
        st->HIST        = HIST;
     else
@@ -1588,6 +1571,7 @@ st_restore(void *xst)
        HIST    = st->HIST;
     enterhist  = st->enterhist;
     cantell    = st->cantell;
+    justpr     = st->justpr;
 
     if (st->argv != NULL)
        setq(STRargv, st->argv, &shvhed, VAR_READWRITE);
@@ -1657,6 +1641,7 @@ goodbye(Char **v, struct command *c)
        size_t omark;
        sigset_t set;
 
+       sigemptyset(&set);
        signal(SIGQUIT, SIG_IGN);
        sigaddset(&set, SIGQUIT);
        sigprocmask(SIG_UNBLOCK, &set, NULL);
@@ -1854,15 +1839,19 @@ process(int catch)
     jmp_buf_t osetexit;
     /* PWP: This might get nuked my longjmp so don't make it a register var */
     size_t omark;
+    volatile int didexitset = 0;
 
     getexit(osetexit);
     omark = cleanup_push_mark();
-    exitset++;
     for (;;) {
        struct command *t;
        int hadhist, old_pintr_disabled;
 
-       (void) setexit();
+       (void)setexit();
+       if (didexitset == 0) {
+           exitset++;
+           didexitset++;
+       }
        pendjob();
 
        justpr = enterhist;     /* execute if not entering history */
@@ -2026,9 +2015,9 @@ process(int catch)
     cmd_done:
        cleanup_until(&paraml);
     }
-    exitset--;
     cleanup_pop_mark(omark);
     resexit(osetexit);
+    exitset--;
 }
 
 /*ARGSUSED*/
@@ -2362,3 +2351,28 @@ record(void)
        rechist(NULL, adrof(STRsavehist) != NULL);
     }
 }
+
+/*
+ * Grab the tty repeatedly, and give up if we are not in the correct
+ * tty process group.
+ */
+int
+grabpgrp(int fd, pid_t desired)
+{
+    struct sigaction old;
+    pid_t pgrp;
+    size_t i;
+
+    for (i = 0; i < 100; i++) {
+       if ((pgrp = tcgetpgrp(fd)) == -1)
+           return -1;
+       if (pgrp == desired)
+           return 0;
+       (void)sigaction(SIGTTIN, NULL, &old);
+       (void)signal(SIGTTIN, SIG_DFL);
+       (void)kill(0, SIGTTIN);
+       (void)sigaction(SIGTTIN, &old, NULL);
+    }
+    errno = EPERM;
+    return -1;
+}
index ee93c4f..498cc2f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.char.c,v 3.19 2006/03/02 18:46:44 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.char.c,v 3.20 2007/03/07 16:31:37 christos Exp $ */
 /*
  * sh.char.c: Character classification tables
  */
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.char.c,v 3.19 2006/03/02 18:46:44 christos Exp $")
+RCSID("$tcsh: sh.char.c,v 3.20 2007/03/07 16:31:37 christos Exp $")
 
 #include "sh.char.h"
 
-#if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
 /* on default same as original map */
 unsigned short _cmap[256] = {
 /*       0 nul           1 soh           2 stx           3 etx */
@@ -135,6 +134,7 @@ unsigned short _cmap[256] = {
 /*     124 |           125 }           126 ~           127 del */
        _META|_CMD|_PUN,_PUN,           _PUN,           _CTR,
 
+#ifdef SHORT_STRINGS
 /****************************************************************/
 /* 128 - 255 The below is supposedly ISO 8859/1                        */
 /****************************************************************/
@@ -234,6 +234,9 @@ unsigned short _cmap[256] = {
 /*     252 udiaeresis  253 yacute      254 thorn       255 ydiaeresis  */
        _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _LET|_DOW,
 };
+#endif /* SHORT_STRINGS */
+
+#if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
 /* original table */
 unsigned short _cmap_c[256] = {
 /*       0 nul           1 soh           2 stx           3 etx */
@@ -899,206 +902,6 @@ unsigned short _mbmap_utf8[256] = {
 /*  f8    f9    fa    fb    fc    fd    fe    ff*/
     _MB1, _MB1, _MB1, _MB1, _MB1, _MB1, 0,    0
 };
-
-#else /* !(defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)) */
-unsigned short _cmap[256] = {
-/*       0 nul           1 soh           2 stx           3 etx */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*       4 eot           5 enq           6 ack           7 bel */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*       8 bs            9 ht           10 nl           11 vt  */
-       _CTR,           _CTR|_SP|_META, _CTR|_NL|_META, _CTR,
-
-/*      12 np           13 cr           14 so           15 si  */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*      16 dle          17 dc1          18 dc2          19 dc3 */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*      20 dc4          21 nak          22 syn          23 etb */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*      24 can          25 em           26 sub          27 esc */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*      28 fs           29 gs           30 rs           31 us  */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*      32 sp           33 !            34 "            35 #   */
-       _SP|_META,      _PUN,           _QF|_PUN,       _META|_PUN,
-
-/*      36 $            37 %            38 &            39 '   */
-       _DOL|_PUN,      _PUN,           _META|_CMD|_PUN,_QF|_PUN,
-
-/*      40 (            41 )            42 *            43 +   */
-       _META|_CMD|_PUN,_META|_PUN,     _GLOB|_PUN,     _PUN,
-
-/*      44 ,            45 -            46 .            47 /   */
-       _PUN,           _PUN,           _PUN,           _PUN,
-
-/*      48 0            49 1            50 2            51 3   */
-       _DIG|_XD,       _DIG|_XD,       _DIG|_XD,       _DIG|_XD,
-
-/*      52 4            53 5            54 6            55 7   */
-       _DIG|_XD,       _DIG|_XD,       _DIG|_XD,       _DIG|_XD,
-
-/*      56 8            57 9            58 :            59 ;   */
-       _DIG|_XD,       _DIG|_XD,       _PUN,           _META|_CMD|_PUN,
-
-/*      60 <            61 =            62 >            63 ?   */
-       _META|_PUN,     _PUN,           _META|_PUN,     _GLOB|_PUN,
-
-/*      64 @            65 A            66 B            67 C   */
-       _PUN,           _LET|_UP|_XD,   _LET|_UP|_XD,   _LET|_UP|_XD,
-
-/*      68 D            69 E            70 F            71 G   */
-       _LET|_UP|_XD,   _LET|_UP|_XD,   _LET|_UP|_XD,   _LET|_UP,
-
-/*      72 H            73 I            74 J            75 K   */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _LET|_UP,
-
-/*      76 L            77 M            78 N            79 O   */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _LET|_UP,
-
-/*      80 P            81 Q            82 R            83 S   */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _LET|_UP,
-
-/*      84 T            85 U            86 V            87 W   */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _LET|_UP,
-
-/*      88 X            89 Y            90 Z            91 [   */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _GLOB|_PUN,
-
-/*      92 \            93 ]            94 ^            95 _   */
-       _ESC|_PUN,      _PUN,           _PUN,           _PUN,
-
-/*      96 `            97 a            98 b            99 c   */
-  _QB|_GLOB|_META|_PUN,        _LET|_DOW|_XD,  _LET|_DOW|_XD,  _LET|_DOW|_XD,
-
-/*     100 d           101 e           102 f           103 g   */
-       _LET|_DOW|_XD,  _LET|_DOW|_XD,  _LET|_DOW|_XD,  _LET|_DOW,
-
-/*     104 h           105 i           106 j           107 k   */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _LET|_DOW,
-
-/*     108 l           109 m           110 n           111 o   */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _LET|_DOW,
-
-/*     112 p           113 q           114 r           115 s   */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _LET|_DOW,
-
-/*     116 t           117 u           118 v           119 w   */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _LET|_DOW,
-
-/*     120 x           121 y           122 z           123 {   */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _GLOB|_PUN,
-
-/*     124 |           125 }           126 ~           127 del */
-       _META|_CMD|_PUN,_PUN,           _PUN,           _CTR,
-
-#ifdef SHORT_STRINGS
-/****************************************************************/
-/* 128 - 255 The below is supposedly ISO 8859/1                        */
-/****************************************************************/
-/*     128 (undef)     129 (undef)     130 (undef)     131 (undef)     */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*     132 (undef)     133 (undef)     134 (undef)     135 (undef)     */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*     136 (undef)     137 (undef)     138 (undef)     139 (undef)     */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*     140 (undef)     141 (undef)     142 (undef)     143 (undef)     */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*     144 (undef)     145 (undef)     146 (undef)     147 (undef)     */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*     148 (undef)     149 (undef)     150 (undef)     151 (undef)     */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*     152 (undef)     153 (undef)     154 (undef)     155 (undef)     */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*     156 (undef)     157 (undef)     158 (undef)     159 (undef)     */
-       _CTR,           _CTR,           _CTR,           _CTR,
-
-/*     160 nobreakspace 161 exclamdown 162 cent        163 sterling    */
-       _PUN, /* XXX */ _PUN,           _PUN,           _PUN,
-
-/*     164 currency    165 yen         166 brokenbar   167 section     */
-       _PUN,           _PUN,           _PUN,           _PUN,
-
-/*     168 diaeresis   169 copyright   170 ordfeminine 171 guillemotleft*/
-       _PUN,           _PUN,           _PUN,           _PUN,
-
-/*     172 notsign     173 hyphen      174 registered  175 macron      */
-       _PUN,           _PUN,           _PUN,           _PUN,
-
-/*     176 degree      177 plusminus   178 twosuperior 179 threesuperior*/
-       _PUN,           _PUN,           _PUN,           _PUN,
-
-/*     180 acute       181 mu          182 paragraph   183 periodcentered*/
-       _PUN,           _PUN, /*XXX*/   _PUN,           _PUN,
-
-/*     184 cedilla     185 onesuperior 186 masculine   187 guillemotright*/
-       _PUN,           _PUN,           _PUN,           _PUN,
-
-/*     188 onequarter  189 onehalf     190 threequarters 191 questiondown*/
-       _PUN,           _PUN,           _PUN,           _PUN,
-
-/*     192 Agrave      193 Aacute      194 Acircumflex 195 Atilde      */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _LET|_UP,
-
-/*     196 Adiaeresis  197 Aring       198 AE          199 Ccedilla    */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _LET|_UP,
-
-/*     200 Egrave      201 Eacute      202 Ecircumflex 203 Ediaeresis  */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _LET|_UP,
-
-/*     204 Igrave      205 Iacute      206 Icircumflex 207 Idiaeresis  */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _LET|_UP,
-
-/*     208 ETH         209 Ntilde      210 Ograve      211 Oacute      */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _LET|_UP,
-
-/*     212 Ocircumflex 213 Otilde      214 Odiaeresis  215 multiply    */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _PUN,
-
-/*     216 Ooblique    217 Ugrave      218 Uacute      219 Ucircumflex */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _LET|_UP,
-
-/*     220 Udiaeresis  221 Yacute      222 THORN       223 ssharp      */
-       _LET|_UP,       _LET|_UP,       _LET|_UP,       _LET|_DOW,
-
-/*     224 agrave      225 aacute      226 acircumflex 227 atilde      */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _LET|_DOW,
-
-/*     228 adiaeresis  229 aring       230 ae          231 ccedilla    */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _LET|_DOW,
-
-/*     232 egrave      233 eacute      234 ecircumflex 235 ediaeresis  */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _LET|_DOW,
-
-/*     236 igrave      237 iacute      238 icircumflex 239 idiaeresis  */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _LET|_DOW,
-
-/*     240 eth         241 ntilde      242 ograve      243 oacute      */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _LET|_DOW,
-
-/*     244 ocircumflex 245 otilde      246 odiaeresis  247 division    */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _PUN,
-
-/*     248 oslash      249 ugrave      250 uacute      251 ucircumflex */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _LET|_DOW,
-
-/*     252 udiaeresis  253 yacute      254 thorn       255 ydiaeresis  */
-       _LET|_DOW,      _LET|_DOW,      _LET|_DOW,      _LET|_DOW,
-#endif /* SHORT_STRINGS */
-};
 #endif /* defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE) */
 
 #ifndef NLS
index de2b5c0..eb20e69 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.char.h,v 3.32 2006/09/26 16:44:37 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.char.h,v 3.35 2008/09/25 14:41:34 christos Exp $ */
 /*
  * sh.char.h: Table for spotting special characters quickly
  *           Makes for very obscure but efficient coding.
@@ -64,7 +64,9 @@ extern unsigned short _mbmap_big5[];
 extern unsigned short _mbmap_utf8[];
 /* VARIABLE Check str */
 /* same compiler require #define even not define DSPMBYTE */
+#undef _MB1
 #define _MB1   0x0001
+#undef _MB2
 #define _MB2   0x0002
 
 #ifndef NLS
@@ -72,21 +74,56 @@ extern tcshuc _cmap_lower[], _cmap_upper[];
 
 #endif
 
+#ifndef __QNXNTO__
+#undef _QF
 #define        _QF     0x0001          /* '" (Forward quotes) */
+#undef _QB
 #define        _QB     0x0002          /* ` (Backquote) */
+#undef _SP
 #define        _SP     0x0004          /* space and tab */
+#else
+#undef _XD
+#define        _XD     0x0001          /* As in <ctype.h> */
+#undef _UP
+#define        _UP     0x0002          /* As in <ctype.h> */
+#undef _SP
+#define        _SP     0x0004          /* As in <ctype.h> */
+#endif
+#undef _NL
 #define        _NL     0x0008          /* \n */
+#undef _META
 #define        _META   0x0010          /* lex meta characters, sp #'`";&<>()|\t\n */
+#undef _GLOB
 #define        _GLOB   0x0020          /* glob characters, *?{[` */
+#undef _ESC
 #define        _ESC    0x0040          /* \ */
+#undef _DOL
 #define        _DOL    0x0080          /* $ */
+#undef _DIG
 #define        _DIG    0x0100          /* 0-9 */
+#undef _LET
 #define        _LET    0x0200          /* a-z, A-Z, _, or locale-specific */
+#ifndef __QNXNTO__
+#undef _UP
 #define        _UP     0x0400          /* A-Z, or locale-specific */
+#else
+#undef _QF
+#define        _QF     0x0400          /* '" (Forward quotes) */
+#endif
+#undef _DOW
 #define        _DOW    0x0800          /* a-z, or locale-specific */
+#ifndef __QNXNTO__
+#undef _XD
 #define        _XD     0x1000          /* 0-9, a-f, A-F */
+#else
+#undef _QB
+#define        _QB     0x1000          /* 0-9, a-f, A-F */
+#endif
+#undef _CMD
 #define        _CMD    0x2000          /* lex end of command chars, ;&(|` */
+#undef _CTR
 #define _CTR   0x4000          /* control */
+#undef _PUN
 #define _PUN   0x8000          /* punctuation */
 
 #ifdef IS_ASCII
@@ -137,9 +174,12 @@ extern tcshuc _cmap_lower[], _cmap_upper[];
                         (iswalnum((tcshuc) (c)) || (c) == '_'))
 #else
 #define letter(c)      (((Char)(c) & QUOTE) ? 0 :  \
-                        (isalpha((tcshuc) (c)) || (c) == '_'))
+                        ((isalpha((tcshuc) (c)) && !(cmap((c), _PUN))) \
+                         || (c) == '_'))
 #define alnum(c)       (((Char)(c) & QUOTE) ? 0 :  \
-                        (isalnum((tcshuc) (c)) || (c) == '_'))
+                        ((isalnum((tcshuc) (c)) && !(cmap((c), _PUN))) \
+                         || (c) == '_'))
+
 #endif
 
 #if defined(DSPMBYTE)
index 41cddba..70f76a4 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.decls.h,v 3.53 2006/08/24 20:56:31 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.decls.h,v 3.55 2009/02/25 22:54:54 christos Exp $ */
 /*
  * sh.decls.h   External declarations from sh*.c
  */
@@ -52,6 +52,7 @@ extern        void              done          (int);
 #else
 extern void              xexit         (int);
 #endif
+extern int               grabpgrp      (int, pid_t);
 
 /*
  * sh.dir.c
@@ -357,7 +358,7 @@ extern  struct process   *pfind             (Char *);
 /*
  * sh.sem.c
  */
-extern void              execute       (struct command *, int, int *,
+extern void              execute       (struct command *, volatile int, int *,
                                         int *, int);
 extern void              mypipe        (int *);
 
index 3fd8d70..9f72951 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.dir.c,v 3.79 2006/09/25 18:17:26 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.dir.c,v 3.80 2007/05/08 21:05:34 christos Exp $ */
 /*
  * sh.dir.c: Directory manipulation functions
  */
@@ -33,7 +33,7 @@
 #include "sh.h"
 #include "ed.h"
 
-RCSID("$tcsh: sh.dir.c,v 3.79 2006/09/25 18:17:26 christos Exp $")
+RCSID("$tcsh: sh.dir.c,v 3.80 2007/05/08 21:05:34 christos Exp $")
 
 /*
  * C Shell - directory management
@@ -42,7 +42,7 @@ RCSID("$tcsh: sh.dir.c,v 3.79 2006/09/25 18:17:26 christos Exp $")
 static Char                    *agetcwd        (void);
 static void                     dstart         (const char *);
 static struct directory        *dfind          (Char *);
-static Char                    *dfollow        (Char *);
+static Char                    *dfollow        (Char *, int);
 static void                     printdirs      (int);
 static Char                    *dgoto          (Char *);
 static void                     dnewcwd        (struct directory *, int);
@@ -523,7 +523,7 @@ dochngd(Char **v, struct command *c)
        return;
     }
     else
-       if ((cp = dfollow(cp)) == NULL)
+       if ((cp = dfollow(cp, dflag & DIR_OLD)) == NULL)
            return;
     dp = xcalloc(sizeof(struct directory), 1);
     dp->di_name = cp;
@@ -588,13 +588,13 @@ dgoto(Char *cp)
  * dfollow - change to arg directory; fall back on cdpath if not valid
  */
 static Char *
-dfollow(Char *cp)
+dfollow(Char *cp, int old)
 {
     Char *dp;
     struct varent *c;
     int serrno;
 
-    cp = globone(cp, G_ERROR);
+    cp = old ? Strsave(cp) : globone(cp, G_ERROR);
     cleanup_push(cp, xfree);
 #ifdef apollo
     if (Strchr(cp, '`')) {
@@ -712,7 +712,7 @@ dopushd(Char **v, struct command *c)
                stderror(ERR_NAME | ERR_NOHOMEDIR);
            if (chdir(short2str(cp)) < 0)
                stderror(ERR_NAME | ERR_CANTCHANGE);
-           if ((cp = dfollow(cp)) == NULL)
+           if ((cp = dfollow(cp, dflag & DIR_OLD)) == NULL)
                return;
            dp = xcalloc(sizeof(struct directory), 1);
            dp->di_name = cp;
@@ -758,7 +758,7 @@ dopushd(Char **v, struct command *c)
     else {
        Char *ccp;
 
-       if ((ccp = dfollow(cp)) == NULL)
+       if ((ccp = dfollow(cp, dflag & DIR_OLD)) == NULL)
            return;
        dp = xcalloc(sizeof(struct directory), 1);
        dp->di_name = ccp;
index 73ac3b2..bafb971 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.dol.c,v 3.70 2006/09/14 18:30:16 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.dol.c,v 3.77 2009/06/19 16:25:00 christos Exp $ */
 /*
  * sh.dol.c: Variable substitutions
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.dol.c,v 3.70 2006/09/14 18:30:16 christos Exp $")
+RCSID("$tcsh: sh.dol.c,v 3.77 2009/06/19 16:25:00 christos Exp $")
 
 /*
  * C shell
@@ -138,7 +138,8 @@ Dfix1(Char *cp)
 static Char **
 Dfix2(Char *const *v)
 {
-    struct blk_buf bb = BLK_BUF_INIT;
+    struct blk_buf *bb = bb_alloc();
+    Char **vec;
 
     Dvp = v;
     Dcp = STRNULL;             /* Setup input vector for Dreadc */
@@ -146,12 +147,14 @@ Dfix2(Char *const *v)
     unDredc(0);                        /* Clear out any old peeks (at error) */
     dolp = 0;
     dolcnt = 0;                        /* Clear out residual $ expands (...) */
-    cleanup_push(&bb, bb_cleanup);
-    while (Dword(&bb))
+    cleanup_push(bb, bb_free);
+    while (Dword(bb))
        continue;
-    cleanup_ignore(&bb);
-    cleanup_until(&bb);
-    return bb_finish(&bb);
+    cleanup_ignore(bb);
+    cleanup_until(bb);
+    vec = bb_finish(bb);
+    xfree(bb);
+    return vec;
 }
 
 /*
@@ -199,18 +202,19 @@ static int
 Dword(struct blk_buf *bb)
 {
     eChar c, c1;
-    struct Strbuf wbuf = Strbuf_INIT;
+    struct Strbuf *wbuf = Strbuf_alloc();
     int dolflg;
     int    sofar = 0;
+    Char *str;
 
-    cleanup_push(&wbuf, Strbuf_cleanup);
+    cleanup_push(wbuf, Strbuf_free);
     for (;;) {
        c = DgetC(DODOL);
        switch (c) {
 
        case DEOF:
            if (sofar == 0) {
-               cleanup_until(&wbuf);
+               cleanup_until(wbuf);
                return (0);
            }
            /* finish this word and catch the code above the next time */
@@ -226,7 +230,7 @@ Dword(struct blk_buf *bb)
 
        case '`':
            /* We preserve ` quotations which are done yet later */
-           Strbuf_append1(&wbuf, (Char) c);
+           Strbuf_append1(wbuf, (Char) c);
            /*FALLTHROUGH*/
        case '\'':
        case '"':
@@ -240,11 +244,13 @@ Dword(struct blk_buf *bb)
                c = DgetC(dolflg);
                if (c == c1)
                    break;
-               if (c == '\n' || c == DEOF)
+               if (c == '\n' || c == DEOF) {
+                   cleanup_until(bb);
                    stderror(ERR_UNMATCHED, (int)c1);
+               }
                if ((c & (QUOTE | TRIM)) == ('\n' | QUOTE)) {
-                   if (wbuf.len != 0 && (wbuf.s[wbuf.len - 1] & TRIM) == '\\')
-                       wbuf.len--;
+                   if (wbuf->len != 0 && (wbuf->s[wbuf->len - 1] & TRIM) == '\\')
+                       wbuf->len--;
                }
                switch (c1) {
 
@@ -253,17 +259,17 @@ Dword(struct blk_buf *bb)
                     * Leave any `s alone for later. Other chars are all
                     * quoted, thus `...` can tell it was within "...".
                     */
-                   Strbuf_append1(&wbuf, c == '`' ? '`' : c | QUOTE);
+                   Strbuf_append1(wbuf, c == '`' ? '`' : c | QUOTE);
                    break;
 
                case '\'':
                    /* Prevent all further interpretation */
-                   Strbuf_append1(&wbuf, c | QUOTE);
+                   Strbuf_append1(wbuf, c | QUOTE);
                    break;
 
                case '`':
                    /* Leave all text alone for later */
-                   Strbuf_append1(&wbuf, (Char) c);
+                   Strbuf_append1(wbuf, (Char) c);
                    break;
 
                default:
@@ -271,9 +277,9 @@ Dword(struct blk_buf *bb)
                }
            }
            if (c1 == '`')
-               Strbuf_append1(&wbuf, '`');
+               Strbuf_append1(wbuf, '`');
            sofar = 1;
-           if (Dpack(&wbuf) != 0)
+           if (Dpack(wbuf) != 0)
                goto end;
            continue;
 
@@ -289,14 +295,16 @@ Dword(struct blk_buf *bb)
        }
        unDgetC(c);
        sofar = 1;
-       if (Dpack(&wbuf) != 0)
+       if (Dpack(wbuf) != 0)
            goto end;
     }
 
  end:
-    cleanup_ignore(&wbuf);
-    cleanup_until(&wbuf);
-    bb_append(bb, Strbuf_finish(&wbuf));
+    cleanup_ignore(wbuf);
+    cleanup_until(wbuf);
+    str = Strbuf_finish(wbuf);
+    bb_append(bb, str);
+    xfree(wbuf);
     return 1;
 }
 
@@ -366,13 +374,13 @@ Dgetdol(void)
 {
     Char *np;
     struct varent *vp = NULL;
-    struct Strbuf name = Strbuf_INIT;
+    struct Strbuf *name = Strbuf_alloc();
     eChar   c, sc;
     int     subscr = 0, lwb = 1, upb = 0;
     int    dimen = 0, bitset = 0, length = 0;
     static Char *dolbang = NULL;
 
-    cleanup_push(&name, Strbuf_cleanup);
+    cleanup_push(name, Strbuf_free);
     dolmod.len = dolmcnt = dol_flag_a = 0;
     c = sc = DgetC(0);
     if (c == DEOF) {
@@ -396,14 +404,14 @@ Dgetdol(void)
            xfree(dolbang);
            setDolp(dolbang = putn(backpid));
        }
-       cleanup_until(&name);
+       cleanup_until(name);
        goto eatbrac;
 
     case '$':
        if (dimen || bitset || length)
            stderror(ERR_SYNTAX);
        setDolp(doldol);
-       cleanup_until(&name);
+       cleanup_until(name);
        goto eatbrac;
 
     case '<'|QUOTE: {
@@ -471,13 +479,13 @@ Dgetdol(void)
 
        fixDolMod();
        setDolp(wbuf.s); /* Kept allocated until next $< expansion */
-       cleanup_until(&name);
+       cleanup_until(name);
        goto eatbrac;
     }
 
     case '*':
-       Strbuf_append(&name, STRargv);
-       Strbuf_terminate(&name);
+       Strbuf_append(name, STRargv);
+       Strbuf_terminate(name);
        vp = adrof(STRargv);
        subscr = -1;            /* Prevent eating [...] */
        break;
@@ -487,8 +495,8 @@ Dgetdol(void)
        np = dimen ? STRargv : (bitset ? STRstatus : NULL);
        if (np) {
            bitset = 0;
-           Strbuf_append(&name, np);
-           Strbuf_terminate(&name);
+           Strbuf_append(name, np);
+           Strbuf_terminate(name);
            vp = adrof(np);
            subscr = -1;                /* Prevent eating [...] */
            unDredc(c);
@@ -513,7 +521,7 @@ Dgetdol(void)
            if (subscr == 0) {
                if (bitset) {
                    dolp = dolzero ? STR1 : STR0;
-                   cleanup_until(&name);
+                   cleanup_until(name);
                    goto eatbrac;
                }
                if (ffile == 0)
@@ -526,7 +534,7 @@ Dgetdol(void)
                    fixDolMod();
                    setDolp(ffile);
                }
-               cleanup_until(&name);
+               cleanup_until(name);
                goto eatbrac;
            }
 #if 0
@@ -538,7 +546,7 @@ Dgetdol(void)
            vp = adrof(STRargv);
            if (vp == 0) {
                vp = &nulargv;
-               cleanup_until(&name);
+               cleanup_until(name);
                goto eatmod;
            }
            break;
@@ -547,8 +555,8 @@ Dgetdol(void)
            np = dimen ? STRargv : (bitset ? STRstatus : NULL);
            if (np) {
                bitset = 0;
-               Strbuf_append(&name, np);
-               Strbuf_terminate(&name);
+               Strbuf_append(name, np);
+               Strbuf_terminate(name);
                vp = adrof(np);
                subscr = -1;            /* Prevent eating [...] */
                unDredc(c);
@@ -558,52 +566,56 @@ Dgetdol(void)
                stderror(ERR_VARALNUM);
        }
        for (;;) {
-           Strbuf_append1(&name, (Char) c);
+           Strbuf_append1(name, (Char) c);
            c = DgetC(0);
            if (c == DEOF || !alnum(c))
                break;
        }
-       Strbuf_terminate(&name);
+       Strbuf_terminate(name);
        unDredc(c);
-       vp = adrof(name.s);
+       vp = adrof(name->s);
     }
     if (bitset) {
-       dolp = (vp || getenv(short2str(name.s))) ? STR1 : STR0;
-       cleanup_until(&name);
+       dolp = (vp || getenv(short2str(name->s))) ? STR1 : STR0;
+       cleanup_until(name);
        goto eatbrac;
     }
     if (vp == NULL || vp->vec == NULL) {
-       np = str2short(getenv(short2str(name.s)));
+       np = str2short(getenv(short2str(name->s)));
        if (np) {
            static Char *env_val; /* = NULL; */
 
-           cleanup_until(&name);
+           cleanup_until(name);
            fixDolMod();
-           xfree(env_val);
-           env_val = Strsave(np);
-           setDolp(env_val);
+           if (length) {
+                   addla(putn(Strlen(np)));
+           } else {
+                   xfree(env_val);
+                   env_val = Strsave(np);
+                   setDolp(env_val);
+           }
            goto eatbrac;
        }
-       udvar(name.s);
+       udvar(name->s);
        /* NOTREACHED */
     }
-    cleanup_until(&name);
+    cleanup_until(name);
     c = DgetC(0);
     upb = blklen(vp->vec);
     if (dimen == 0 && subscr == 0 && c == '[') {
-       name = Strbuf_init;
-       cleanup_push(&name, Strbuf_cleanup);
-       np = name.s;
+       name = Strbuf_alloc();
+       cleanup_push(name, Strbuf_free);
+       np = name->s;
        for (;;) {
            c = DgetC(DODOL);   /* Allow $ expand within [ ] */
            if (c == ']')
                break;
            if (c == '\n' || c == DEOF)
                stderror(ERR_INCBR);
-           Strbuf_append1(&name, (Char) c);
+           Strbuf_append1(name, (Char) c);
        }
-       Strbuf_terminate(&name);
-       np = name.s;
+       Strbuf_terminate(name);
+       np = name->s;
        if (dolp || dolcnt)     /* $ exp must end before ] */
            stderror(ERR_EXPORD);
        if (!*np)
@@ -613,8 +625,8 @@ Dgetdol(void)
 
            for (i = 0; Isdigit(*np); i = i * 10 + *np++ - '0')
                continue;
-           if ((i < 0 || i > upb) && !any("-*", *np)) {
-               cleanup_until(&name);
+           if (i < 0 || i > upb && !any("-*", *np)) {
+               cleanup_until(name);
                dolerror(vp->v_name);
                return;
            }
@@ -635,7 +647,7 @@ Dgetdol(void)
                while (Isdigit(*np))
                    i = i * 10 + *np++ - '0';
                if (i < 0 || i > upb) {
-                   cleanup_until(&name);
+                   cleanup_until(name);
                    dolerror(vp->v_name);
                    return;
                }
@@ -647,7 +659,7 @@ Dgetdol(void)
        }
        if (lwb == 0) {
            if (upb != 0) {
-               cleanup_until(&name);
+               cleanup_until(name);
                dolerror(vp->v_name);
                return;
            }
@@ -655,7 +667,7 @@ Dgetdol(void)
        }
        if (*np)
            stderror(ERR_SYNTAX);
-       cleanup_until(&name);
+       cleanup_until(name);
     }
     else {
        if (subscr > 0) {
@@ -800,14 +812,15 @@ setDolp(Char *cp)
            dolmod.s[i] = 0;
 
            strip(lhsub);
+           strip(rhsub);
            strip(cp);
            dp = cp;
            do {
                dp = Strstr(dp, lhsub);
                if (dp) {
                    ptrdiff_t diff = dp - cp;
-                   np = xmalloc((Strlen(cp) + 1 - lhlen + rhlen) *
-                                sizeof(Char));
+                   size_t len = (Strlen(cp) + 1 - lhlen + rhlen);
+                   np = xmalloc(len * sizeof(Char));
                    (void) Strncpy(np, cp, diff);
                    (void) Strcpy(np + diff, rhsub);
                    (void) Strcpy(np + diff + rhlen, dp + lhlen);
@@ -815,7 +828,10 @@ setDolp(Char *cp)
                    dp = np + diff + 1;
                    xfree(cp);
                    cp = np;
+                   cp[--len] = '\0';
                    didmod = 1;
+                   if (diff >= len)
+                       break;
                } else {
                    /* should this do a seterror? */
                    break;
@@ -973,12 +989,6 @@ again:
 #ifdef WINNT_NATIVE
     __dup_stdin = 1;
 #endif /* WINNT_NATIVE */
-#ifdef O_TEXT
-    setmode(1, O_TEXT);
-#endif
-#ifdef O_BINARY
-    setmode(0, O_BINARY);
-#endif
     cleanup_push(&lbuf, Strbuf_cleanup);
     cleanup_push(&mbuf, Strbuf_cleanup);
     for (;;) {
index 4da927c..279c7b8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.err.c,v 3.48 2006/03/02 18:46:44 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.err.c,v 3.50 2007/09/28 20:25:15 christos Exp $ */
 /*
  * sh.err.c: Error printing routines. 
  */
@@ -34,7 +34,7 @@
 #include "sh.h"
 #include <assert.h>
 
-RCSID("$tcsh: sh.err.c,v 3.48 2006/03/02 18:46:44 christos Exp $")
+RCSID("$tcsh: sh.err.c,v 3.50 2007/09/28 20:25:15 christos Exp $")
 
 /*
  * C Shell
@@ -202,7 +202,7 @@ errinit(void)
 
     for (i = 0; i < NO_ERRORS; i++)
        xfree((char *)(intptr_t)elst[i]);
-#  if defined(__FreeBSD__) || defined(hpux)
+#  if defined(__FreeBSD__) || defined(hpux) || defined(__MidnightBSD__)
 #  define NLS_MAXSET 30
     for (i = 1; i <= NLS_MAXSET; i++)
        CGETS(i, 1, "" );
@@ -593,16 +593,17 @@ stderror(unsigned int id, ...)
        if (id >= sizeof(elst) / sizeof(elst[0]))
            id = ERR_INVALID;
 
-       /*
-        * Must flush before we print as we wish output before the error to go
-        * on (some form of) standard output, while output after goes on (some
-        * form of) diagnostic output. If didfds then output will go to 1/2
-        * else to FSHOUT/FSHDIAG. See flush in sh.print.c.
-        */
-       flush();/*FIXRESET*/
-       haderr = 1;                     /* Now to diagnostic output */
 
        if (!(flags & ERR_SILENT)) {
+           /*
+            * Must flush before we print as we wish output before the error
+            * to go * on (some form of) standard output, while output after
+            * goes on (some * form of) diagnostic output. If didfds then
+            * output will go to 1/2 * else to FSHOUT/FSHDIAG. See flush in
+            * sh.print.c.
+            */
+           flush();/*FIXRESET*/
+           haderr = 1;                 /* Now to diagnostic output */
            if (flags & ERR_NAME)
                xprintf("%s: ", bname);/*FIXRESET*/
            if ((flags & ERR_OLD)) {
index d5a80fe..ee7a551 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.exec.c,v 3.73 2006/08/24 20:56:31 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.exec.c,v 3.75 2009/06/25 21:15:37 christos Exp $ */
 /*
  * sh.exec.c: Search, find, and execute a command!
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.exec.c,v 3.73 2006/08/24 20:56:31 christos Exp $")
+RCSID("$tcsh: sh.exec.c,v 3.75 2009/06/25 21:15:37 christos Exp $")
 
 #include "tc.h"
 #include "tw.h"
@@ -402,9 +402,6 @@ texec(Char *sf, Char **st)
         */
        if ((fd = xopen(f, O_RDONLY|O_LARGEFILE)) != -1) {
            int nread;
-#ifdef O_TEXT
-           setmode(fd, O_TEXT);
-#endif
            if ((nread = xread(fd, pref, 2)) == 2) {
                if (!isprint((unsigned char)pref[0]) &&
                    (pref[0] != '\n' && pref[0] != '\t')) {
@@ -1069,7 +1066,7 @@ find_cmd(Char *cmd, int prt)
     int hashval, i, ex, rval = 0;
 
     if (prt && any(short2str(cmd), '/')) {
-       xprintf(CGETS(13, 7, "where: / in command makes no sense\n"));
+       xprintf("%s", CGETS(13, 7, "where: / in command makes no sense\n"));
        return rval;
     }
 
@@ -1132,7 +1129,7 @@ find_cmd(Char *cmd, int prt)
        ex = executable(*pv, sv, 0);
 #ifdef FASTHASH
        if (!ex && (hashdebug & 2)) {
-           xprintf(CGETS(13, 10, "hash miss: "));
+           xprintf("%s", CGETS(13, 10, "hash miss: "));
            ex = 1;     /* Force printing */
        }
 #endif /* FASTHASH */
index e242676..e995e86 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.exp.c,v 3.51 2006/05/13 21:25:20 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.exp.c,v 3.53 2007/10/01 19:09:28 christos Exp $ */
 /*
  * sh.exp.c: Expression evaluations
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.exp.c,v 3.51 2006/05/13 21:25:20 christos Exp $")
+RCSID("$tcsh: sh.exp.c,v 3.53 2007/10/01 19:09:28 christos Exp $")
 
 #include "tw.h"
 
@@ -72,16 +72,14 @@ static      void     evalav         (Char **);
 static int      isa            (Char *, int);
 static int      egetn          (Char *);
 
-
 #ifdef EDEBUG
-static void     etracc         (char *, Char *, Char ***);
-static void     etraci         (char *, int, Char ***);
+static void     etracc         (const char *, const Char *, Char ***);
+static void     etraci         (const char *, int, Char ***);
 #else /* !EDEBUG */
 #define etracc(A, B, C) ((void)0)
 #define etraci(A, B, C) ((void)0)
 #endif /* !EDEBUG */
 
-
 /*
  * shell access function according to POSIX and non POSIX
  * From Beto Appleton (beto@aixwiz.aix.ibm.com)
@@ -197,13 +195,19 @@ exp0(Char ***vp, int ignore)
     int p1 = exp1(vp, ignore);
 
     etraci("exp0 p1", p1, vp);
-    if (**vp && eq(**vp, STRor2)) {
+    while (**vp && eq(**vp, STRor2)) {
        int p2;
 
        (*vp)++;
-       p2 = exp0(vp, (ignore & TEXP_IGNORE) || p1);
-       etraci("exp0 p2", p2, vp);
-       return (p1 || p2);
+
+       p2 = compat_expr ? 
+           exp0(vp, (ignore & TEXP_IGNORE) || p1) :
+           exp1(vp, (ignore & TEXP_IGNORE) || p1);
+       if (compat_expr || !(ignore & TEXP_IGNORE))
+           p1 = (p1 || p2);
+       etraci("exp0 p1", p1, vp);
+       if (compat_expr)
+           break;
     }
     return (p1);
 }
@@ -214,13 +218,20 @@ exp1(Char ***vp, int ignore)
     int p1 = exp2x(vp, ignore);
 
     etraci("exp1 p1", p1, vp);
-    if (**vp && eq(**vp, STRand2)) {
+    while (**vp && eq(**vp, STRand2)) {
        int p2;
 
        (*vp)++;
-       p2 = exp1(vp, (ignore & TEXP_IGNORE) || !p1);
+       p2 = compat_expr ?
+           exp1(vp, (ignore & TEXP_IGNORE) || !p1) :
+           exp2x(vp, (ignore & TEXP_IGNORE) || !p1);
+
        etraci("exp1 p2", p2, vp);
-       return (p1 && p2);
+       if (compat_expr || !(ignore & TEXP_IGNORE))
+           p1 = (p1 && p2);
+       etraci("exp1 p1", p1, vp);
+       if (compat_expr)
+           break;
     }
     return (p1);
 }
@@ -230,14 +241,20 @@ exp2x(Char ***vp, int ignore)
 {
     int p1 = exp2a(vp, ignore);
 
-    etraci("exp3 p1", p1, vp);
-    if (**vp && eq(**vp, STRor)) {
+    etraci("exp2x p1", p1, vp);
+    while (**vp && eq(**vp, STRor)) {
        int p2;
 
        (*vp)++;
-       p2 = exp2x(vp, ignore);
-       etraci("exp3 p2", p2, vp);
-       return (p1 | p2);
+       p2 = compat_expr ?
+           exp2x(vp, ignore) :
+           exp2a(vp, ignore);
+       etraci("exp2x p2", p2, vp);
+       if (compat_expr || !(ignore & TEXP_IGNORE))
+               p1 = (p1 | p2);
+       etraci("exp2x p1", p1, vp);
+       if (compat_expr)
+           break;
     }
     return (p1);
 }
@@ -248,13 +265,19 @@ exp2a(Char ***vp, int ignore)
     int p1 = exp2b(vp, ignore);
 
     etraci("exp2a p1", p1, vp);
-    if (**vp && eq(**vp, STRcaret)) {
+    while (**vp && eq(**vp, STRcaret)) {
        int p2;
 
        (*vp)++;
-       p2 = exp2a(vp, ignore);
+       p2 = compat_expr ?
+           exp2a(vp, ignore) :
+           exp2b(vp, ignore);
        etraci("exp2a p2", p2, vp);
-       return (p1 ^ p2);
+       if (compat_expr || !(ignore & TEXP_IGNORE))
+           p1 = (p1 ^ p2);
+       etraci("exp2a p1", p1, vp);
+       if (compat_expr)
+           break;
     }
     return (p1);
 }
@@ -265,13 +288,19 @@ exp2b(Char ***vp, int ignore)
     int p1 = exp2c(vp, ignore);
 
     etraci("exp2b p1", p1, vp);
-    if (**vp && eq(**vp, STRand)) {
+    while (**vp && eq(**vp, STRand)) {
        int p2;
 
        (*vp)++;
-       p2 = exp2b(vp, ignore);
+       p2 = compat_expr ?
+           exp2b(vp, ignore) :
+           exp2c(vp, ignore);
        etraci("exp2b p2", p2, vp);
-       return (p1 & p2);
+       if (compat_expr || !(ignore & TEXP_IGNORE))
+           p1 = (p1 & p2);
+       etraci("exp2b p1", p1, vp);
+       if (compat_expr)
+           break;
     }
     return (p1);
 }
@@ -327,12 +356,14 @@ exp3(Char ***vp, int ignore)
 
     p1 = exp3a(vp, ignore);
     etracc("exp3 p1", p1, vp);
-    if ((i = isa(**vp, RELOP)) != 0) {
+    while ((i = isa(**vp, RELOP)) != 0) {
        (*vp)++;
        if (**vp && eq(**vp, STRequal))
            i |= 1, (*vp)++;
        cleanup_push(p1, xfree);
-       p2 = exp3(vp, ignore);
+       p2 = compat_expr ?
+           exp3(vp, ignore) :
+           exp3a(vp, ignore);
        cleanup_push(p2, xfree);
        etracc("exp3 p2", p2, vp);
        if (!(ignore & TEXP_IGNORE))
@@ -355,7 +386,10 @@ exp3(Char ***vp, int ignore)
                break;
            }
        cleanup_until(p1);
-       return (putn(i));
+       p1 = putn(i);
+       etracc("exp3 p1", p1, vp);
+       if (compat_expr)
+           break;
     }
     return (p1);
 }
@@ -373,7 +407,9 @@ exp3a(Char ***vp, int ignore)
     if (op && any("<>", op[0]) && op[0] == op[1]) {
        (*vp)++;
        cleanup_push(p1, xfree);
-       p2 = exp3a(vp, ignore);
+       p2 = compat_expr ?
+           exp3a(vp, ignore) :
+           exp4(vp, ignore);
        cleanup_push(p2, xfree);
        etracc("exp3a p2", p2, vp);
        if (op[0] == '<')
@@ -381,7 +417,8 @@ exp3a(Char ***vp, int ignore)
        else
            i = egetn(p1) >> egetn(p2);
        cleanup_until(p1);
-       return (putn(i));
+       p1 = putn(i);
+       etracc("exp3a p1", p1, vp);
     }
     return (p1);
 }
@@ -394,11 +431,13 @@ exp4(Char ***vp, int ignore)
 
     p1 = exp5(vp, ignore);
     etracc("exp4 p1", p1, vp);
-    if (isa(**vp, ADDOP)) {
+    while (isa(**vp, ADDOP)) {
        const Char *op = *(*vp)++;
 
        cleanup_push(p1, xfree);
-       p2 = exp4(vp, ignore);
+       p2 = compat_expr ?
+           exp4(vp, ignore) :
+           exp5(vp, ignore);
        cleanup_push(p2, xfree);
        etracc("exp4 p2", p2, vp);
        if (!(ignore & TEXP_IGNORE))
@@ -413,7 +452,10 @@ exp4(Char ***vp, int ignore)
                break;
            }
        cleanup_until(p1);
-       return (putn(i));
+       p1 = putn(i);
+       etracc("exp4 p1", p1, vp);
+       if (compat_expr)
+           break;
     }
     return (p1);
 }
@@ -427,7 +469,7 @@ exp5(Char ***vp, int ignore)
     p1 = exp6(vp, ignore);
     etracc("exp5 p1", p1, vp);
 
-    if (isa(**vp, MULOP)) {
+    while (isa(**vp, MULOP)) {
        const Char *op = *(*vp)++;
        if ((ignore & TEXP_NOGLOB) != 0) {
            /*
@@ -439,7 +481,9 @@ exp5(Char ***vp, int ignore)
        }
 
        cleanup_push(p1, xfree);
-       p2 = exp5(vp, ignore);
+       p2 = compat_expr ? 
+           exp5(vp, ignore) :
+           exp6(vp, ignore);
        cleanup_push(p2, xfree);
        etracc("exp5 p2", p2, vp);
        if (!(ignore & TEXP_IGNORE))
@@ -464,7 +508,10 @@ exp5(Char ***vp, int ignore)
                break;
            }
        cleanup_until(p1);
-       return (putn(i));
+       p1 = putn(i);
+       etracc("exp5 p1", p1, vp);
+       if (compat_expr)
+           break;
     }
     return (p1);
 }
@@ -989,16 +1036,16 @@ egetn(Char *cp)
 
 #ifdef EDEBUG
 static void
-etraci(char *str, int i, Char ***vp)
+etraci(const char *str, int i, Char ***vp)
 {
     xprintf("%s=%d\t", str, i);
     blkpr(*vp);
     xputchar('\n');
 }
 static void
-etracc(char *str, Char *cp, Char ***vp)
+etracc(const char *str, const Char *cp, Char ***vp)
 {
-    xprintf("%s=%s\t", str, cp);
+    xprintf("%s=%S\t", str, cp);
     blkpr(*vp);
     xputchar('\n');
 }
index 6955358..37e9475 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.file.c,v 3.35 2006/08/23 15:03:14 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.file.c,v 3.36 2007/07/05 14:13:06 christos Exp $ */
 /*
  * sh.file.c: File completion for csh. This file is not used in tcsh.
  */
@@ -33,7 +33,7 @@
 #include "sh.h"
 #include "ed.h"
 
-RCSID("$tcsh: sh.file.c,v 3.35 2006/08/23 15:03:14 christos Exp $")
+RCSID("$tcsh: sh.file.c,v 3.36 2007/07/05 14:13:06 christos Exp $")
 
 #if defined(FILEC) && defined(TIOCSTI)
 
@@ -234,7 +234,11 @@ pushback(const Char *string)
     (void) ioctl(SHOUT, TCSETAW, (ioctl_t) &tty);
 # endif /* POSIX */
     tty_normal = tty;
-    tty.c_lflag &= ~(ECHOKE | ECHO | ECHOE | ECHOK | ECHONL | ECHOPRT | ECHOCTL);
+    tty.c_lflag &= ~(ECHOKE | ECHO | ECHOE | ECHOK | ECHONL |
+#ifndef __QNXNTO__
+       ECHOPRT |
+#endif
+       ECHOCTL);
 # ifdef POSIX
     (void) xtcsetattr(SHOUT, TCSANOW, &tty);
 # else
@@ -390,7 +394,9 @@ retype(void)
     (void) ioctl(SHOUT, TCGETA, (ioctl_t) &tty);
 # endif /* POSIX */
 
+#ifndef __QNXNTO__
     tty.c_lflag |= PENDIN;
+#endif
 
 # ifdef POSIX
     (void) xtcsetattr(SHOUT, TCSANOW, &tty);
index 92e2447..2e37af0 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.func.c,v 3.143 2006/08/24 20:56:31 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.func.c,v 3.153 2009/06/25 21:15:37 christos Exp $ */
 /*
  * sh.func.c: csh builtin functions
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.func.c,v 3.143 2006/08/24 20:56:31 christos Exp $")
+RCSID("$tcsh: sh.func.c,v 3.153 2009/06/25 21:15:37 christos Exp $")
 
 #include "ed.h"
 #include "tw.h"
@@ -62,6 +62,7 @@ static        void    doagain         (void);
 static  const char *isrchx     (int);
 static void    search          (int, int, Char *);
 static int     getword         (struct Strbuf *);
+static struct wordent  *histgetword    (struct wordent *);
 static void    toend           (void);
 static void    xecho           (int, Char **);
 static int     islocale_var    (Char *);
@@ -688,7 +689,8 @@ dorepeat(Char **v, struct command *kp)
        reexecute(kp);
        --i;
     }
-    cleanup_until(&pintr_disabled);
+    if (setintr && pintr_disabled == 1)
+        cleanup_until(&pintr_disabled);
     donefds();
 }
 
@@ -753,6 +755,7 @@ search(int type, int level, Char *goal)
     Char *cp;
     struct whyle *wp;
     int wlevel = 0;
+    struct wordent *histent = NULL, *ohistent = NULL;
 
     Stype = type;
     Sgoal = goal;
@@ -764,11 +767,28 @@ search(int type, int level, Char *goal)
     }
     cleanup_push(&word, Strbuf_cleanup);
     do {
+           
+       if (intty) {
+           histent = xmalloc(sizeof(*histent));
+           ohistent = xmalloc(sizeof(*histent));
+           ohistent->word = STRNULL;
+           ohistent->next = histent;
+           histent->prev = ohistent;
+       }
+
        if (intty && fseekp == feobp && aret == TCSH_F_SEEK)
            printprompt(1, isrchx(type == TC_BREAK ? zlast : type));
        /* xprintf("? "), flush(); */
        (void) getword(&word);
        Strbuf_terminate(&word);
+
+       if (intty && Strlen(word.s) > 0) {
+           histent->word = Strsave(word.s);
+           histent->next = xmalloc(sizeof(*histent));
+           histent->next->prev = histent;
+           histent = histent->next;
+       }
+
        switch (srchx(word.s)) {
 
        case TC_ELSE:
@@ -855,12 +875,129 @@ search(int type, int level, Char *goal)
                level = -1;
            break;
        }
-       (void) getword(NULL);
+       if (intty) {
+           ohistent->prev = histgetword(histent);
+           ohistent->prev->next = ohistent;
+           savehist(ohistent, 0);
+           freelex(ohistent);
+           xfree(ohistent);
+       } else 
+           (void) getword(NULL);
     } while (level >= 0);
  end:
     cleanup_until(&word);
 }
 
+static struct wordent *
+histgetword(struct wordent *histent) 
+{
+    int found = 0, first;
+    eChar c, d;
+    int e;
+    struct Strbuf *tmp;
+    tmp = xmalloc(sizeof(*tmp));
+    tmp->size = 0;
+    tmp->s = NULL;
+    c = readc(1);
+    d = 0;
+    e = 0;
+    for (;;) {
+       tmp->len = 0;
+       Strbuf_terminate (tmp);
+       while (c == ' ' || c == '\t')
+           c = readc(1);
+       if (c == '#')
+           do
+               c = readc(1);
+           while (c != CHAR_ERR && c != '\n');
+       if (c == CHAR_ERR)
+           goto past;
+       if (c == '\n') 
+           goto nl;
+       unreadc(c);
+       found = 1;
+       first = 1;
+       do {
+           e = (c == '\\');
+           c = readc(1);
+           if (c == '\\' && !e) {
+               if ((c = readc(1)) == '\n') {
+                   e = 1;
+                   c = ' ';
+               } else {
+                   unreadc(c);
+                   c = '\\';
+               }
+           }
+           if ((c == '\'' || c == '"') && !e) {
+               if (d == 0)
+                   d = c;
+               else if (d == c)
+                   d = 0;
+           }
+           if (c == CHAR_ERR)
+               goto past;
+           
+           Strbuf_append1(tmp, (Char) c);
+           
+           if (!first && !d && c == '(' && !e) {
+               break;
+           }
+           first = 0;
+       } while (d || e || (c != ' ' && c != '\t' && c != '\n'));
+       tmp->len--;
+       if (tmp->len) {
+           Strbuf_terminate(tmp);
+           histent->word = Strsave(tmp->s);
+           histent->next = xmalloc(sizeof (*histent));
+           histent->next->prev = histent;
+           histent = histent->next;
+       }
+       if (c == '\n') {
+       nl:
+           tmp->len = 0;
+           Strbuf_append1(tmp, (Char) c);
+           Strbuf_terminate(tmp);
+           histent->word = Strsave(tmp->s);
+           return histent;
+       }
+    }
+    
+    unreadc(c);
+    return histent;
+
+past:
+    switch (Stype) {
+
+    case TC_IF:
+       stderror(ERR_NAME | ERR_NOTFOUND, "then/endif");
+       break;
+
+    case TC_ELSE:
+       stderror(ERR_NAME | ERR_NOTFOUND, "endif");
+       break;
+
+    case TC_BRKSW:
+    case TC_SWITCH:
+       stderror(ERR_NAME | ERR_NOTFOUND, "endsw");
+       break;
+
+    case TC_BREAK:
+       stderror(ERR_NAME | ERR_NOTFOUND, "end");
+       break;
+
+    case TC_GOTO:
+       setname(short2str(Sgoal));
+       stderror(ERR_NAME | ERR_NOTFOUND, "label");
+       break;
+
+    default:
+       break;
+    }
+    /* NOTREACHED */
+    return NULL;
+}
+
 static int
 getword(struct Strbuf *wp)
 {
@@ -1796,6 +1933,10 @@ struct limits limits[] =
     { RLIMIT_SBSIZE,   "sbsize",       1,      ""              },
 # endif /* RLIMIT_SBSIZE */
 
+# ifdef RLIMIT_SWAP 
+    { RLIMIT_SWAP,     "swapsize",     1024,   "kbytes"        }, 
+# endif /* RLIMIT_SWAP */ 
+
     { -1,              NULL,           0,      NULL            }
 };
 
@@ -2135,10 +2276,9 @@ void
 dosuspend(Char **v, struct command *c)
 {
 #ifdef BSDJOBS
-    int     ctpgrp;
     struct sigaction old;
 #endif /* BSDJOBS */
-    
+
     USE(c);
     USE(v);
 
@@ -2158,17 +2298,8 @@ dosuspend(Char **v, struct command *c)
 
 #ifdef BSDJOBS
     if (tpgrp != -1) {
-retry:
-       ctpgrp = tcgetpgrp(FSHTTY);
-       if (ctpgrp == -1)
+       if (grabpgrp(FSHTTY, opgrp) == -1)
            stderror(ERR_SYSTEM, "tcgetpgrp", strerror(errno));
-       if (ctpgrp != opgrp) {
-           sigaction(SIGTTIN, NULL, &old);
-           signal(SIGTTIN, SIG_DFL);
-           (void) kill(0, SIGTTIN);
-           sigaction(SIGTTIN, &old, NULL);
-           goto retry;
-       }
        (void) setpgid(0, shpgrp);
        (void) tcsetpgrp(FSHTTY, shpgrp);
     }
@@ -2221,13 +2352,15 @@ doeval_cleanup(void *xstate)
     close_on_exec(SHDIAG = dmove(state->saveDIAG, state->SHDIAG), 1);
 }
 
+static Char **Ggv;
 /*ARGSUSED*/
 void
 doeval(Char **v, struct command *c)
 {
     struct doeval_state state;
-    int gflag;
+    int gflag, my_reenter;
     Char **gv;
+    jmp_buf_t osetexit;
 
     USE(c);
     v++;
@@ -2247,6 +2380,7 @@ doeval(Char **v, struct command *c)
        trim(v);
     }
 
+    Ggv = gv;
     state.evalvec = evalvec;
     state.evalp = evalp;
     state.didfds = didfds;
@@ -2263,21 +2397,39 @@ doeval(Char **v, struct command *c)
 
     cleanup_push(&state, doeval_cleanup);
 
-    evalvec = v;
-    evalp = 0;
-    (void)close_on_exec(SHIN = dcopy(0, -1), 1);
-    (void)close_on_exec(SHOUT = dcopy(1, -1), 1);
-    (void)close_on_exec(SHDIAG = dcopy(2, -1), 1);
+    getexit(osetexit);
+
+    /* PWP: setjmp/longjmp bugfix for optimizing compilers */
+#ifdef cray
+    my_reenter = 1;             /* assume non-zero return val */
+    if (setexit() == 0) {
+       my_reenter = 0;         /* Oh well, we were wrong */
+#else /* !cray */
+    if ((my_reenter = setexit()) == 0) {
+#endif /* cray */
+       evalvec = v;
+       evalp = 0;
+       (void)close_on_exec(SHIN = dcopy(0, -1), 1);
+       (void)close_on_exec(SHOUT = dcopy(1, -1), 1);
+       (void)close_on_exec(SHDIAG = dcopy(2, -1), 1);
 #ifndef CLOSE_ON_EXEC
-    didcch = 0;
+       didcch = 0;
 #endif /* CLOSE_ON_EXEC */
-    didfds = 0;
-    process(0);
+       didfds = 0;
+       gv = Ggv;
+       process(0);
+       Ggv = gv;
+    }
 
-    cleanup_until(&state);
+    if (my_reenter == 0) {
+       cleanup_until(&state);
+       if (Ggv)
+           cleanup_until(Ggv);
+    }
 
-    if (gv)
-       cleanup_until(gv);
+    resexit(osetexit);
+    if (my_reenter)
+       stderror(ERR_SILENT);
 }
 
 /*************************************************************************/
index a7215f3..6ee5ecc 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.glob.c,v 3.74 2006/10/14 17:57:21 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.glob.c,v 3.76 2008/06/19 15:20:56 christos Exp $ */
 /*
  * sh.glob.c: Regular expression expansion
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.glob.c,v 3.74 2006/10/14 17:57:21 christos Exp $")
+RCSID("$tcsh: sh.glob.c,v 3.76 2008/06/19 15:20:56 christos Exp $")
 
 #include "tc.h"
 #include "tw.h"
@@ -667,6 +667,7 @@ dobackp(Char *cp, int literal)
            }
        if (!*rp) {
        oops:
+           cleanup_until(&bb);
            stderror(ERR_UNMATCHED, '`');
        }
        ep = Strnsave(lp, rp - lp);
@@ -842,10 +843,10 @@ backeval(struct blk_buf *bb, struct Strbuf *word, Char *cp, int literal)
            c = (*ip++ & TRIM);
            if (c == 0)
                break;
-#ifdef WINNT_NATIVE
+#if defined(WINNT_NATIVE) || defined(__CYGWIN__)
            if (c == '\r')
                c = ' ';
-#endif /* WINNT_NATIVE */
+#endif /* WINNT_NATIVE || __CYGWIN__ */
            if (c == '\n') {
                /*
                 * Continue around the loop one more time, so that we can eat
index 6bd594e..f955734 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.h,v 3.146 2006/07/03 22:59:01 mitr Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.h,v 3.150 2009/06/25 21:27:37 christos Exp $ */
 /*
  * sh.h: Catch it all globals and includes file!
  */
@@ -94,7 +94,7 @@ typedef unsigned long uChar;
 typedef wint_t eChar; /* Can contain any Char value or CHAR_ERR */
 #define CHAR_ERR WEOF /* Pretty please, use bit 31... */
 #define normal_mbtowc(PWC, S, N) rt_mbtowc(PWC, S, N)
-#define reset_mbtowc() mbtowc(NULL, NULL, 0)
+#define reset_mbtowc() IGNORE(mbtowc(NULL, NULL, 0))
 # else
 typedef short Char;
 typedef unsigned short uChar;
@@ -116,6 +116,11 @@ typedef int eChar;
 
 /* Elide unused argument warnings */
 #define USE(a) (void) (a)
+#define IGNORE(a)      ignore((intptr_t)a)
+static inline void ignore(intptr_t a)
+{
+    USE(a);
+}
 
 /*
  * Return true if the path is absolute
@@ -552,6 +557,7 @@ EXTERN int    havhash IZERO;        /* path hashing is available */
 EXTERN int    editing IZERO;   /* doing filename expansion and line editing */
 EXTERN int    noediting IZERO; /* initial $term defaulted to noedit */
 EXTERN int    bslash_quote IZERO;/* PWP: tcsh-style quoting?  (in sh.c) */
+EXTERN int    compat_expr IZERO;/* csh-style expressions? */
 EXTERN int    isoutatty IZERO; /* is SHOUT a tty */
 EXTERN int    isdiagatty IZERO;/* is SHDIAG a tty */
 EXTERN int    is1atty IZERO;   /* is file descriptor 1 a tty (didfds mode) */
@@ -691,13 +697,17 @@ extern struct sigaction parterm;  /* Parents terminate catch */
 /* 31st char bit used for 'ing (not 32nd, we want all values nonnegative) */
 # define       QUOTE           0x40000000
 # define       TRIM            0x3FFFFFFF /* Mask to strip quote bit */
-# define       UNDER           0x20000000 /* Underline flag */
-# define       BOLD            0x10000000 /* Bold flag */
-# define       STANDOUT        0x08000000 /* Standout flag */
-# define       LITERAL         0x04000000 /* Literal character flag */
-# define       ATTRIBUTES      0x3C000000 /* The bits used for attributes */
-# define       INVALID_BYTE    0x00200000 /* Invalid character on input */
-# define       CHAR            0x003FFFFF /* Mask to mask out the character */
+# define       UNDER           0x08000000 /* Underline flag */
+# define       BOLD            0x04000000 /* Bold flag */
+# define       STANDOUT        0x02000000 /* Standout flag */
+# define       LITERAL         0x01000000 /* Literal character flag */
+# define       ATTRIBUTES      0x0F000000 /* The bits used for attributes */
+# define       INVALID_BYTE    0x00800000 /* Invalid character on input */
+# ifdef SOLARIS2
+#  define      CHAR            0x30FFFFFF /* Mask to mask out the character */
+# else
+#  define      CHAR            0x00FFFFFF /* Mask to mask out the character */
+# endif
 #elif defined (SHORT_STRINGS)
 # define       QUOTE   ((Char) 0100000)/* 16nth char bit used for 'ing */
 # define       TRIM            0073777 /* Mask to strip quote/lit bit */
index 0cccf47..536097e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.lex.c,v 3.77 2006/09/27 17:01:06 mitr Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.lex.c,v 3.81 2009/06/25 21:15:37 christos Exp $ */
 /*
  * sh.lex.c: Lexical analysis into tokens
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.lex.c,v 3.77 2006/09/27 17:01:06 mitr Exp $")
+RCSID("$tcsh: sh.lex.c,v 3.81 2009/06/25 21:15:37 christos Exp $")
 
 #include "ed.h"
 
@@ -368,7 +368,7 @@ loop:
                else {
                    if (bslash_quote &&
                        ((c == '\'') || (c == '"') ||
-                        (c == '\\'))) {
+                        (c == '\\') || (c == '$'))) {
                        c |= QUOTE;
                    }
                    else {
@@ -851,7 +851,8 @@ getsub(struct wordent *en)
            return (en);
        }
        slhs.len = 0;
-       Strbuf_append(&slhs, lhsb.s);
+       if (lhsb.s != NULL && lhsb.len != 0)
+           Strbuf_append(&slhs, lhsb.s);
        Strbuf_terminate(&slhs);
        if (exclc)
            en = dosub(sc, en, global);
@@ -1490,7 +1491,7 @@ reread:
                if (adrof(STRignoreeof)) {
                        /* If so, tell the user to use exit or logout */
                    if (loginsh) {
-                               xprintf(CGETS(16, 2,
+                               xprintf("%s", CGETS(16, 2,
                                        "\nUse \"logout\" to logout.\n"));
                        } else {
                                xprintf(CGETS(16, 3,
@@ -1625,7 +1626,7 @@ bgetc(void)
                return CHAR_ERR;
            feobp += c;
        }
-#ifndef WINNT_NATIVE
+#if !defined(WINNT_NATIVE) && !defined(__CYGWIN__)
        ch = fbuf[0][fseekp - fbobp];
        fseekp++;
 #else
@@ -1633,7 +1634,7 @@ bgetc(void)
            ch = fbuf[0][fseekp - fbobp];
            fseekp++;
        } while(ch == '\r');
-#endif /* !WINNT_NATIVE */
+#endif /* !WINNT_NATIVE && !__CYGWIN__ */
        return (ch);
     }
 
@@ -1678,7 +1679,7 @@ bgetc(void)
     if (windowchg)
        (void) check_window_size(0);    /* for window systems */
 #endif /* SIG_WINDOW */
-#ifndef WINNT_NATIVE
+#if !defined(WINNT_NATIVE) && !defined(__CYGWIN__)
     ch = fbuf[(int) fseekp / BUFSIZE][(int) fseekp % BUFSIZE];
     fseekp++;
 #else
@@ -1686,7 +1687,7 @@ bgetc(void)
        ch = fbuf[(int) fseekp / BUFSIZE][(int) fseekp % BUFSIZE];
        fseekp++;
     } while(ch == '\r');
-#endif /* !WINNT_NATIVE */
+#endif /* !WINNT_NATIVE && !__CYGWIN__ */
     return (ch);
 }
 
index bf6fb3a..d57f324 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.proc.c,v 3.104 2006/09/27 16:59:04 mitr Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.proc.c,v 3.109 2009/06/25 21:15:37 christos Exp $ */
 /*
  * sh.proc.c: Job manipulations
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.proc.c,v 3.104 2006/09/27 16:59:04 mitr Exp $")
+RCSID("$tcsh: sh.proc.c,v 3.109 2009/06/25 21:15:37 christos Exp $")
 
 #include "ed.h"
 #include "tc.h"
@@ -126,6 +126,7 @@ static      void             pflushall      (void);
 static void             pflush         (struct process *);
 static void             pfree          (struct process *);
 static void             pclrcurr       (struct process *);
+static void             morecommand    (size_t);
 static void             padd           (struct command *);
 static int              pprint         (struct process *, int);
 static void             ptprint        (struct process *);
@@ -485,7 +486,7 @@ pjwait(struct process *pp)
 
     do {
        if ((fp->p_flags & (PFOREGND | PRUNNING)) == PRUNNING)
-         xprintf(CGETS(17, 1, "BUG: waiting for background job!\n"));
+         xprintf("%s", CGETS(17, 1, "BUG: waiting for background job!\n"));
     } while ((fp = fp->p_friends) != pp);
     /*
      * Now keep pausing as long as we are not interrupted (SIGINT), and the
@@ -518,7 +519,7 @@ pjwait(struct process *pp)
        (void) tcsetpgrp(FSHTTY, tpgrp);
 #endif /* BSDJOBS */
     if ((jobflags & (PSIGNALED | PSTOPPED | PTIME)) ||
-       !eq(dcwd->di_name, fp->p_cwd->di_name)) {
+       fp->p_cwd == NULL || !eq(dcwd->di_name, fp->p_cwd->di_name)) {
        if (jobflags & PSTOPPED) {
            xputchar('\n');
            if (adrof(STRlistjobs)) {
@@ -626,7 +627,7 @@ pflush(struct process *pp)
     int idx;
 
     if (pp->p_procid == 0) {
-       xprintf(CGETS(17, 3, "BUG: process flushed twice"));
+       xprintf("%s", CGETS(17, 3, "BUG: process flushed twice"));
        return;
     }
     while (pp->p_procid != pp->p_jobid)
@@ -670,9 +671,25 @@ pclrcurr(struct process *pp)
 }
 
 /* +4 here is 1 for '\0', 1 ea for << >& >> */
-static Char command[PMAXLEN + 4];
+static Char *cmdstr;
+static size_t cmdmax;
 static size_t cmdlen;
 static Char *cmdp;
+#define CMD_INIT 1024
+#define CMD_INCR 64
+
+static void
+morecommand(size_t s)
+{
+    Char *ncmdstr;
+    ptrdiff_t d;
+
+    cmdmax += s;
+    ncmdstr = xrealloc(cmdstr, cmdmax * sizeof(*cmdstr));
+    d = ncmdstr - cmdstr;
+    cmdstr = ncmdstr;
+    cmdp += d;
+}
 
 /* GrP
  * unparse - Export padd() functionality 
@@ -680,11 +697,13 @@ static Char *cmdp;
 Char *
 unparse(struct command *t)
 {
-    cmdp = command;
+    if (cmdmax == 0)
+       morecommand(CMD_INIT);
+    cmdp = cmdstr;
     cmdlen = 0;
     padd(t);
     *cmdp++ = '\0';
-    return Strsave(command);
+    return Strsave(cmdstr);
 }
 
 
@@ -707,7 +726,9 @@ palloc(pid_t pid, struct command *t)
        pp->p_flags |= PBACKQ;
     if (t->t_dflg & F_HUP)
        pp->p_flags |= PHUP;
-    cmdp = command;
+    if (cmdmax == 0)
+       morecommand(CMD_INIT);
+    cmdp = cmdstr;
     cmdlen = 0;
     padd(t);
     *cmdp++ = 0;
@@ -716,7 +737,7 @@ palloc(pid_t pid, struct command *t)
        if (t->t_dflg & F_STDERR)
            pp->p_flags |= PDIAG;
     }
-    pp->p_command = Strsave(command);
+    pp->p_command = Strsave(cmdstr);
     if (pcurrjob) {
        struct process *fp;
 
@@ -839,7 +860,7 @@ padd(struct command *t)
 static void
 pads(Char *cp)
 {
-    size_t i;
+    size_t i, len;
 
     /*
      * Avoid the Quoted Space alias hack! Reported by:
@@ -850,14 +871,9 @@ pads(Char *cp)
 
     i = Strlen(cp);
 
-    if (cmdlen >= PMAXLEN)
-       return;
-    if (cmdlen + i >= PMAXLEN) {
-       (void) Strcpy(cmdp, STRsp3dots);
-       cmdlen = PMAXLEN;
-       cmdp += 4;
-       return;
-    }
+    len = cmdlen + i + CMD_INCR;
+    if (len >= cmdmax)
+       morecommand(len);
     (void) Strcpy(cmdp, cp);
     cmdp += i;
     cmdlen += i;
@@ -1074,13 +1090,13 @@ prcomd:
                xprintf("&");
        }
        if (flag & (REASON | AREASON) && pp->p_flags & PDUMPED)
-           xprintf(CGETS(17, 9, " (core dumped)"));
+           xprintf("%s", CGETS(17, 9, " (core dumped)"));
        if (tp == pp->p_friends) {
            if (flag & AMPERSAND)
                xprintf(" &");
            if (flag & JOBDIR &&
                !eq(tp->p_cwd->di_name, dcwd->di_name)) {
-               xprintf(CGETS(17, 10, " (wd: "));
+               xprintf("%s", CGETS(17, 10, " (wd: "));
                dtildepr(tp->p_cwd->di_name);
                xprintf(")");
            }
@@ -1111,7 +1127,7 @@ prcomd:
            if (linp != linbuf)
                xputchar('\n');
            if (flag & SHELLDIR && !eq(tp->p_cwd->di_name, dcwd->di_name)) {
-               xprintf(CGETS(17, 11, "(wd now: "));
+               xprintf("%s", CGETS(17, 11, "(wd now: "));
                dtildepr(dcwd->di_name);
                xprintf(")\n");
            }
@@ -1428,13 +1444,6 @@ pkill(Char **v, int signum)
     pid_t     pid;
     Char *cp, **vp, **globbed;
 
-    pchild_disabled++;
-    cleanup_push(&pchild_disabled, disabled_cleanup);
-    if (setintr) {
-       pintr_disabled++;
-       cleanup_push(&pintr_disabled, disabled_cleanup);
-    }
-
     /* Avoid globbing %?x patterns */
     for (vp = v; vp && *vp; vp++)
        if (**vp == '%')
@@ -1444,6 +1453,12 @@ pkill(Char **v, int signum)
     globbed = v;
     cleanup_push(globbed, blk_cleanup);
 
+    pchild_disabled++;
+    cleanup_push(&pchild_disabled, disabled_cleanup);
+    if (setintr) {
+       pintr_disabled++;
+       cleanup_push(&pintr_disabled, disabled_cleanup);
+    }
 
     while (v && (cp = *v)) {
        if (*cp == '%') {
index 90b5e04..48a3771 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.proc.h,v 3.12 2006/01/12 19:55:38 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.proc.h,v 3.13 2009/06/19 16:35:33 christos Exp $ */
 /*
  * sh.proc.h: Process data structures and variables
  */
@@ -77,7 +77,7 @@ struct process {
 #  endif /* POSIX */
 # endif /* _SEQUENT_ */
 #endif /* BSDTIMES */
-    Char   *p_command;         /* first PMAXLEN chars of command */
+    Char   *p_command;         /* command */
 };
 
 /* flag values for p_flags */
@@ -103,8 +103,6 @@ struct process {
 #define PBACKQ         (1<<16) /* Process is `` evaluation */
 #define PHUP           (1<<17) /* Process is marked for SIGHUP on exit */
 
-#define        PMAXLEN         80
-
 /* defines for arguments to pprint */
 #define        NUMBER          01
 #define        NAME            02
index 0ae1502..c9e2581 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.sem.c,v 3.78 2006/10/14 17:23:39 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.sem.c,v 3.80 2009/06/25 21:27:38 christos Exp $ */
 /*
  * sh.sem.c: I/O redirections and job forking. A touchy issue!
  *          Most stuff with builtins is incorrect
@@ -33,7 +33,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.sem.c,v 3.78 2006/10/14 17:23:39 christos Exp $")
+RCSID("$tcsh: sh.sem.c,v 3.80 2009/06/25 21:27:38 christos Exp $")
 
 #include "tc.h"
 #include "tw.h"
@@ -326,7 +326,14 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout,
         * Don't run if we're not in a tty
         * Don't run if we're not really executing 
         */
-       if (t->t_dtyp == NODE_COMMAND && !bifunc && !noexec && intty) {
+       /*
+        * CR  -  Charles Ross Aug 2005
+        * added "isoutatty".
+        * The new behavior is that the jobcmd won't be executed
+        * if stdout (SHOUT) isnt attached to a tty.. IE when
+        * redirecting, or using backquotes etc..
+        */
+       if (t->t_dtyp == NODE_COMMAND && !bifunc && !noexec && intty && isoutatty) {
            Char *cmd = unparse(t);
 
            cleanup_push(cmd, xfree);
@@ -833,7 +840,7 @@ doio(struct command *t, int *pipein, int *pipeout)
        }
        else if (flags & F_PIPEIN) {
            xclose(0);
-           (void) dup(pipein[0]);
+           IGNORE(dup(pipein[0]));
            xclose(pipein[0]);
            xclose(pipein[1]);
        }
@@ -843,7 +850,7 @@ doio(struct command *t, int *pipein, int *pipeout)
        }
        else {
            xclose(0);
-           (void) dup(OLDSTD);
+           IGNORE(dup(OLDSTD));
 #if defined(CLOSE_ON_EXEC) && defined(CLEX_DUPS)
            /*
             * PWP: Unlike Bezerkeley 4.3, FIONCLEX for Pyramid is preserved
@@ -896,12 +903,12 @@ doio(struct command *t, int *pipein, int *pipeout)
     }
     else if (flags & F_PIPEOUT) {
        xclose(1);
-       (void) dup(pipeout[1]);
+       IGNORE(dup(pipeout[1]));
        is1atty = 0;
     }
     else {
        xclose(1);
-       (void) dup(SHOUT);
+       IGNORE(dup(SHOUT));
        is1atty = isoutatty;
 # if defined(CLOSE_ON_EXEC) && defined(CLEX_DUPS)
        (void) close_on_exec(1, 0);
@@ -910,11 +917,11 @@ doio(struct command *t, int *pipein, int *pipeout)
 
     xclose(2);
     if (flags & F_STDERR) {
-       (void) dup(1);
+       IGNORE(dup(1));
        is2atty = is1atty;
     }
     else {
-       (void) dup(SHDIAG);
+       IGNORE(dup(SHDIAG));
        is2atty = isdiagatty;
 # if defined(CLOSE_ON_EXEC) && defined(CLEX_DUPS)
        (void) close_on_exec(2, 0);
index 8253e02..0047b7a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/sh.set.c,v 3.70 2006/08/24 20:56:31 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.set.c,v 3.72 2007/09/28 21:02:03 christos Exp $ */
 /*
  * sh.set.c: Setting and Clearing of variables
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.set.c,v 3.70 2006/08/24 20:56:31 christos Exp $")
+RCSID("$tcsh: sh.set.c,v 3.72 2007/09/28 21:02:03 christos Exp $")
 
 #include "ed.h"
 #include "tw.h"
@@ -174,6 +174,9 @@ update_vars(Char *vp)
     else if (eq(vp, STRbackslash_quote)) {
        bslash_quote = 1;
     }
+    else if (eq(vp, STRcompat_expr)) {
+       compat_expr = 1;
+    }
     else if (eq(vp, STRdirstack)) {
        dsetstack();
     }
@@ -525,6 +528,7 @@ getn(Char *cp)
 {
     int n;
     int     sign;
+    int base;
 
     if (!cp)                   /* PWP: extra error checking */
        stderror(ERR_NAME | ERR_BADNUM);
@@ -538,9 +542,19 @@ getn(Char *cp)
        if (!Isdigit(*cp))
            stderror(ERR_NAME | ERR_BADNUM);
     }
+
+    if (cp[0] == '0' && cp[1])
+       base = 8;
+    else
+       base = 10;
+
     n = 0;
     while (Isdigit(*cp))
-       n = n * 10 + *cp++ - '0';
+    {
+       if (base == 8 && *cp >= '8')
+           stderror(ERR_NAME | ERR_BADNUM);
+       n = n * base + *cp++ - '0';
+    }
     if (*cp)
        stderror(ERR_NAME | ERR_BADNUM);
     return (sign ? -n : n);
@@ -750,6 +764,8 @@ unset(Char **v, struct command *c)
        editing = 0;
     if (adrof(STRbackslash_quote) == 0)
        bslash_quote = 0;
+    if (adrof(STRcompat_expr) == 0)
+       compat_expr = 0;
     if (adrof(STRsymlinks) == 0)
        symlinks = 0;
     if (adrof(STRimplicitcd) == 0)
index 45c58d9..c8de1c2 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/tc.bind.c,v 3.44 2006/03/02 18:46:44 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.bind.c,v 3.45 2009/06/25 21:15:37 christos Exp $ */
 /*
  * tc.bind.c: Key binding functions
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tc.bind.c,v 3.44 2006/03/02 18:46:44 christos Exp $")
+RCSID("$tcsh: tc.bind.c,v 3.45 2009/06/25 21:15:37 christos Exp $")
 
 #include "ed.h"
 #include "ed.defns.h"
@@ -382,7 +382,7 @@ parsestring(const Char *str, CStr *buf)
     eChar  es;
 
     if (*str == 0) {
-       xprintf(CGETS(20, 5, "Null string specification\n"));
+       xprintf("%s", CGETS(20, 5, "Null string specification\n"));
        return NULL;
     }
 
@@ -415,7 +415,7 @@ print_all_keys(void)
     nilstr.len = 0;
 
 
-    xprintf(CGETS(20, 6, "Standard key bindings\n"));
+    xprintf("%s", CGETS(20, 6, "Standard key bindings\n"));
     prev = 0;
     for (i = 0; i < 256; i++) {
        if (CcKeyMap[prev] == CcKeyMap[i])
@@ -425,7 +425,7 @@ print_all_keys(void)
     }
     printkeys(CcKeyMap, prev, i - 1);
 
-    xprintf(CGETS(20, 7, "Alternative key bindings\n"));
+    xprintf("%s", CGETS(20, 7, "Alternative key bindings\n"));
     prev = 0;
     for (i = 0; i < 256; i++) {
        if (CcAltMap[prev] == CcAltMap[i])
@@ -434,9 +434,9 @@ print_all_keys(void)
        prev = i;
     }
     printkeys(CcAltMap, prev, i - 1);
-    xprintf(CGETS(20, 8, "Multi-character bindings\n"));
+    xprintf("%s", CGETS(20, 8, "Multi-character bindings\n"));
     PrintXkey(NULL);   /* print all Xkey bindings */
-    xprintf(CGETS(20, 9, "Arrow key bindings\n"));
+    xprintf("%s", CGETS(20, 9, "Arrow key bindings\n"));
     PrintArrowKeys(&nilstr);
 }
 
@@ -492,36 +492,36 @@ printkeys(KEYCMD *map, int first, int last)
 static void
 bindkey_usage(void)
 {
-    xprintf(CGETS(20, 12,
+    xprintf("%s", CGETS(20, 12,
            "Usage: bindkey [options] [--] [KEY [COMMAND]]\n"));
-    xprintf(CGETS(20, 13,
+    xprintf("%s", CGETS(20, 13,
            "    -a   list or bind KEY in alternative key map\n"));
-    xprintf(CGETS(20, 14,
+    xprintf("%s", CGETS(20, 14,
            "    -b   interpret KEY as a C-, M-, F- or X- key name\n"));
-    xprintf(CGETS(20, 15,
+    xprintf("%s", CGETS(20, 15,
             "    -s   interpret COMMAND as a literal string to be output\n"));
-    xprintf(CGETS(20, 16,
+    xprintf("%s", CGETS(20, 16,
             "    -c   interpret COMMAND as a builtin or external command\n"));
-    xprintf(CGETS(20, 17,
+    xprintf("%s", CGETS(20, 17,
            "    -v   bind all keys to vi bindings\n"));
-    xprintf(CGETS(20, 18,
+    xprintf("%s", CGETS(20, 18,
            "    -e   bind all keys to emacs bindings\n"));
-    xprintf(CGETS(20, 19,
+    xprintf("%s", CGETS(20, 19,
            "    -d   bind all keys to default editor's bindings\n"));
-    xprintf(CGETS(20, 20,
+    xprintf("%s", CGETS(20, 20,
            "    -l   list editor commands with descriptions\n"));
-    xprintf(CGETS(20, 21,
+    xprintf("%s", CGETS(20, 21,
            "    -r   remove KEY's binding\n"));
-    xprintf(CGETS(20, 22,
+    xprintf("%s", CGETS(20, 22,
            "    -k   interpret KEY as a symbolic arrow-key name\n"));
-    xprintf(CGETS(20, 23,
+    xprintf("%s", CGETS(20, 23,
            "    --   force a break from option processing\n"));
-    xprintf(CGETS(20, 24,
+    xprintf("%s", CGETS(20, 24,
            "    -u   (or any invalid option) this message\n"));
     xprintf("\n");
-    xprintf(CGETS(20, 25,
+    xprintf("%s", CGETS(20, 25,
            "Without KEY or COMMAND, prints all bindings\n"));
-    xprintf(CGETS(20, 26,
+    xprintf("%s", CGETS(20, 26,
            "Without COMMAND, prints the binding for KEY.\n"));
 }
 
index e7c92f4..ce2d18b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/tc.const.c,v 3.84 2006/10/29 19:02:17 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.const.c,v 3.91 2009/06/19 16:35:33 christos Exp $ */
 /*
  * sh.const.c: String constants for tcsh.
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tc.const.c,v 3.84 2006/10/29 19:02:17 christos Exp $")
+RCSID("$tcsh: tc.const.c,v 3.91 2009/06/19 16:35:33 christos Exp $")
 
 Char STRlogout[]       = { 'l', 'o', 'g', 'o', 'u', 't', '\0' };
 Char STRautologout[]   = { 'a', 'u', 't', 'o', 'l', 'o', 'g', 'o', 'u', 't', 
@@ -46,7 +46,7 @@ Char STRautomatic[]   = { 'a', 'u', 't', 'o', 'm', 'a', 't', 'i', 'c',
 Char STRhangup[]       = { 'h', 'a', 'n', 'g', 'u', 'p', '\0' };
 Char STRaout[]         = { 'a', '.', 'o', 'u', 't', '\0' };
 Char STRtty[]          = { 't', 't', 'y', '\0' };
-Char STRpts[]          = { 'p', 't', 's', '\0' };
+Char STRptssl[]                = { 'p', 't', 's', '/', '\0' };
 Char STRany[]          = { 'a', 'n', 'y', '\0' };
 Char STRstatus[]       = { 's', 't', 'a', 't', 'u', 's', '\0' };
 Char STR0[]            = { '0', '\0' };
@@ -177,7 +177,7 @@ Char STRLANGBIG5[]  = { 'z', 'h', '_', 'T', 'W', '.', 'B', 'i', 'g', '5',
                            '\0' };
 Char STRLANGEUCZH[]    = { '\0' };
 Char STRLANGEUCZHB[]   = { '\0' };
-#  elif (defined(__FreeBSD__) || defined(__NetBSD__))
+#  elif (defined(__FreeBSD__) || defined(__NetBSD__)) || defined(__MidnightBSD__)
 Char STRLANGEUCJP[]    = { 'j', 'a', '_', 'J', 'P', '.', 'e', 'u', 'c', 'J',
                            'P', '\0' };
 Char STRLANGEUCJPB[]   = { 'j', 'a', '_', 'J', 'P', '.', 'E', 'U', 'C', '\0' };
@@ -326,7 +326,6 @@ Char STRspLarrowsp[]        = { ' ', '<', ' ', '\0' };
 Char STRspRarrow2[]    = { ' ', '>', '>', '\0' };
 Char STRspRarrow[]     = { ' ', '>', '\0' };
 Char STRgt[]           = { '>', '\0' };
-Char STRsp3dots[]      = { ' ', '.', '.', '.', '\0' };
 Char STRcent2[]                = { '%', '%', '\0' };
 Char STRcentplus[]     = { '%', '+', '\0' };
 Char STRcentminus[]    = { '%', '-', '\0' };
@@ -353,6 +352,8 @@ Char STRKTERM[]             = { 'T', 'E', 'R', 'M', '\0' };
 Char STRKHOME[]                = { 'H', 'O', 'M', 'E', '\0' };
 Char STRbackslash_quote[] = { 'b', 'a', 'c', 'k', 's', 'l', 'a', 's', 'h', '_',
                             'q', 'u', 'o', 't', 'e', '\0' };
+Char STRcompat_expr[]  = { 'c', 'o', 'm', 'p', 'a', 't', '_', 'e', 'x', 'p',
+                            'r', '\0' };
 Char STRRparen[]       = { ')', '\0' };
 Char STRmail[]         = { 'm', 'a', 'i', 'l', '\0' };
 #ifndef HAVENOUTMP
@@ -450,8 +451,12 @@ Char STRTERMCAP[]  = { 'T', 'E', 'R', 'M', 'C', 'A', 'P', '\0'};
 #endif /* SIG_WINDOW  || _VMS_POSIX */
 
 #if defined (_OSD_POSIX)  /* BS2000 needs this variable set to "SHELL" */
-Char STRPROGRAM_ENVIRONMENT[]          = { 'P', 'R', 'O', 'G', 'R', 'A', 'M', '_', 'E', 'N', 'V', 'I', 'R', 'O', 'N', 'M', 'E', 'N', 'T', '\0'};
+Char STRPROGRAM_ENVIRONMENT[] = { 'P', 'R', 'O', 'G', 'R', 'A', 'M',
+                           '_', 'E', 'N', 'V', 'I', 'R', 'O', 'N', 'M',
+                           'E', 'N', 'T', '\0'};
 #endif /* _OSD_POSIX */
+Char STRCOMMAND_LINE[] = { 'C', 'O', 'M', 'M', 'A', 'N', 'D', '_', 'L', 'I',
+                           'N', 'E', '\0' };
 
 #ifdef WARP
 Char STRwarp[]         = { 'w', 'a', 'r', 'p', '\0' };
@@ -498,3 +503,5 @@ Char STRshwordsep[] = { ' ', '\t', '&', '|', ';', '<', '>', '(', ')', '\0' };
 Char STRrepeat[]       = { 'r', 'e', 'p', 'e', 'a', 't', '\0' };
 
 Char STReof[]          = { '^', 'D', '\b', '\b', '\0' };
+Char STRonlyhistory[]  = { 'o', 'n', 'l', 'y', 'h', 'i', 's', 't', 'o', 'r',
+                           'y', '\0' };
index 1da345d..d6a9f9e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/tc.decls.h,v 3.63 2006/02/14 14:07:36 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.decls.h,v 3.64 2008/05/14 20:10:30 christos Exp $ */
 /*
  * tc.decls.h: Function declarations from all the tcsh modules
  */
@@ -294,10 +294,13 @@ extern    char             *caching_strip (const char *);
 #endif
 extern char             *short2qstr    (const Char *);
 
+extern  struct blk_buf   *bb_alloc     (void);
 extern void              bb_append     (struct blk_buf *, Char *);
 extern void              bb_cleanup    (void *);
 extern Char            **bb_finish     (struct blk_buf *);
+extern  void             bb_free       (void *);
 
+extern struct strbuf    *strbuf_alloc(void);
 extern void              strbuf_terminate(struct strbuf *);
 extern  void             strbuf_append1(struct strbuf *, char);
 extern  void             strbuf_appendn(struct strbuf *, const char *,
@@ -305,6 +308,8 @@ extern  void                  strbuf_appendn(struct strbuf *, const char *,
 extern  void             strbuf_append (struct strbuf *, const char *);
 extern  char            *strbuf_finish (struct strbuf *);
 extern void              strbuf_cleanup(void *);
+extern void              strbuf_free(void *);
+extern struct Strbuf    *Strbuf_alloc(void);
 extern void              Strbuf_terminate(struct Strbuf *);
 extern  void             Strbuf_append1(struct Strbuf *, Char);
 extern  void             Strbuf_appendn(struct Strbuf *, const Char *,
@@ -312,6 +317,7 @@ extern  void                  Strbuf_appendn(struct Strbuf *, const Char *,
 extern  void             Strbuf_append (struct Strbuf *, const Char *);
 extern  Char            *Strbuf_finish (struct Strbuf *);
 extern void              Strbuf_cleanup(void *);
+extern void              Strbuf_free(void *);
 
 
 /*
index e2db430..23262b7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/tc.func.c,v 3.136 2006/09/01 12:51:35 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.func.c,v 3.139 2009/06/25 21:15:38 christos Exp $ */
 /*
  * tc.func.c: New tcsh builtins.
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tc.func.c,v 3.136 2006/09/01 12:51:35 christos Exp $")
+RCSID("$tcsh: tc.func.c,v 3.139 2009/06/25 21:15:38 christos Exp $")
 
 #include "ed.h"
 #include "ed.defns.h"          /* for the function names */
@@ -632,7 +632,7 @@ xgetpass(const char *prm)
     }
     strbuf_terminate(&pass);
 
-    cleanup_until(&sa);
+    cleanup_until(&osa);
 
     return pass.s;
 }
@@ -798,7 +798,7 @@ precmd(void)
     cleanup_push(&pintr_disabled, disabled_cleanup);
     if (precmd_active) {       /* an error must have been caught */
        aliasrun(2, STRunalias, STRprecmd);
-       xprintf(CGETS(22, 3, "Faulty alias 'precmd' removed.\n"));
+       xprintf("%s", CGETS(22, 3, "Faulty alias 'precmd' removed.\n"));
        goto leave;
     }
     precmd_active = 1;
@@ -816,7 +816,7 @@ postcmd(void)
     cleanup_push(&pintr_disabled, disabled_cleanup);
     if (postcmd_active) {      /* an error must have been caught */
        aliasrun(2, STRunalias, STRpostcmd);
-       xprintf(CGETS(22, 3, "Faulty alias 'postcmd' removed.\n"));
+       xprintf("%s", CGETS(22, 3, "Faulty alias 'postcmd' removed.\n"));
        goto leave;
     }
     postcmd_active = 1;
@@ -840,7 +840,7 @@ cwd_cmd(void)
     cleanup_push(&pintr_disabled, disabled_cleanup);
     if (cwdcmd_active) {       /* an error must have been caught */
        aliasrun(2, STRunalias, STRcwdcmd);
-       xprintf(CGETS(22, 4, "Faulty alias 'cwdcmd' removed.\n"));
+       xprintf("%s", CGETS(22, 4, "Faulty alias 'cwdcmd' removed.\n"));
        goto leave;
     }
     cwdcmd_active = 1;
@@ -862,7 +862,7 @@ beep_cmd(void)
     cleanup_push(&pintr_disabled, disabled_cleanup);
     if (beepcmd_active) {      /* an error must have been caught */
        aliasrun(2, STRunalias, STRbeepcmd);
-       xprintf(CGETS(22, 5, "Faulty alias 'beepcmd' removed.\n"));
+       xprintf("%s", CGETS(22, 5, "Faulty alias 'beepcmd' removed.\n"));
     }
     else {
        beepcmd_active = 1;
@@ -889,7 +889,7 @@ period_cmd(void)
     cleanup_push(&pintr_disabled, disabled_cleanup);
     if (periodic_active) {     /* an error must have been caught */
        aliasrun(2, STRunalias, STRperiodic);
-       xprintf(CGETS(22, 6, "Faulty alias 'periodic' removed.\n"));
+       xprintf("%s", CGETS(22, 6, "Faulty alias 'periodic' removed.\n"));
        goto leave;
     }
     periodic_active = 1;
@@ -927,7 +927,7 @@ job_cmd(Char *args)
     cleanup_push(&pintr_disabled, disabled_cleanup);
     if (jobcmd_active) {       /* an error must have been caught */
        aliasrun(2, STRunalias, STRjobcmd);
-       xprintf(CGETS(22, 14, "Faulty alias 'jobcmd' removed.\n"));
+       xprintf("%s", CGETS(22, 14, "Faulty alias 'jobcmd' removed.\n"));
        goto leave;
     }
     jobcmd_active = 1;
@@ -1134,7 +1134,7 @@ rmstar(struct wordent *cp)
                    if (!Strcmp(args->word, STRstar))
                        star = 1;
                if (ask && star) {
-                   xprintf(CGETS(22, 8,
+                   xprintf("%s", CGETS(22, 8,
                            "Do you really want to delete all files? [n/y] "));
                    flush();
                    (void) force_read(SHIN, &c, 1);
@@ -1773,9 +1773,9 @@ hashbang(int fd, Char ***vp)
        switch (*p) {
        case ' ':
        case '\t':
-#ifdef WINNT_NATIVE
+#if defined(WINNT_NATIVE) || defined (__CYGWIN__)
        case '\r':
-#endif /* WINNT_NATIVE */
+#endif /* WINNT_NATIVE || __CYGWIN__ */
            if (ws) {   /* a blank after a word.. save it */
                *p = '\0';
 #ifdef WINNT_NATIVE
index df8f747..74f0d6f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/tc.os.h,v 3.101 2006/02/14 00:52:52 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.os.h,v 3.102 2007/07/05 14:13:06 christos Exp $ */
 /*
  * tc.os.h: Shell os dependent defines
  */
 # endif /* POSIX */
 #endif /* OREO */
 
+#ifdef __QNXNTO__
+#include <sys/resource.h>
+#include <fcntl.h>
+#undef O_TEXT
+#undef O_BINARY
+#endif
+
 #ifdef convex
 # include <sys/dmon.h>
 #endif /* convex */
index 3578181..cf9d61a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/tc.sig.h,v 3.32 2006/03/11 15:32:00 mitr Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.sig.h,v 3.33 2007/07/05 14:13:06 christos Exp $ */
 /*
  * tc.sig.h: Signal handling
  *
@@ -34,7 +34,7 @@
 #ifndef _h_tc_sig
 #define _h_tc_sig
 
-#if (SYSVREL > 0) || defined(BSD4_4) || defined(_MINIX) || defined(DGUX) || defined(WINNT_NATIVE)
+#if (SYSVREL > 0) || defined(BSD4_4) || defined(_MINIX) || defined(DGUX) || defined(WINNT_NATIVE) || defined(__QNXNTO__)
 # include <signal.h>
 # ifndef SIGCHLD
 #  define SIGCHLD SIGCLD
index b94671e..568a1ef 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/tc.str.c,v 3.26 2006/03/02 18:46:45 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.str.c,v 3.30 2009/06/25 21:27:38 christos Exp $ */
 /*
  * tc.str.c: Short string package
  *          This has been a lesson of how to write buggy code!
@@ -35,7 +35,7 @@
 
 #include <limits.h>
 
-RCSID("$tcsh: tc.str.c,v 3.26 2006/03/02 18:46:45 christos Exp $")
+RCSID("$tcsh: tc.str.c,v 3.30 2009/06/25 21:27:38 christos Exp $")
 
 #define MALLOC_INCR    128
 #ifdef WIDE_STRINGS
@@ -52,7 +52,7 @@ one_mbtowc(wchar_t *pwc, const char *s, size_t n)
 
     len = rt_mbtowc(pwc, s, n);
     if (len == -1) {
-        mbtowc(NULL, NULL, 0);
+        reset_mbtowc();
        *pwc = (unsigned char)*s | INVALID_BYTE;
     }
     if (len <= 0)
@@ -169,10 +169,17 @@ short2str(const Char *src)
        dst += one_wctomb(dst, *src & CHAR);
        src++;
        if (dst >= edst) {
+           char *wdst = dst;
+           char *wedst = edst;
+
            dstsize += MALLOC_INCR;
            sdst = xrealloc(sdst, (dstsize + MALLOC_SURPLUS) * sizeof(char));
            edst = &sdst[dstsize];
            dst = &edst[-MALLOC_INCR];
+           while (wdst > wedst) {
+               dst++;
+               wdst--;
+           }
        }
     }
     *dst = 0;
@@ -480,16 +487,23 @@ short2qstr(const Char *src)
        dst += one_wctomb(dst, *src & CHAR);
        src++;
        if (dst >= edst) {
+           ptrdiff_t i = dst - edst;
            dstsize += MALLOC_INCR;
            sdst = xrealloc(sdst, (dstsize + MALLOC_SURPLUS) * sizeof(char));
            edst = &sdst[dstsize];
-           dst = &edst[-MALLOC_INCR];
+           dst = &edst[-MALLOC_INCR + i];
        }
     }
     *dst = 0;
     return (sdst);
 }
 
+struct blk_buf *
+bb_alloc()
+{
+    return xcalloc(1, sizeof(struct blk_buf));
+}
+
 static void
 bb_store(struct blk_buf *bb, Char *str)
 {
@@ -522,6 +536,13 @@ bb_cleanup(void *xbb)
     xfree(bb->vec);
 }
 
+void
+bb_free(void *bb)
+{
+    bb_cleanup(bb);
+    xfree(bb);
+}
+
 Char **
 bb_finish(struct blk_buf *bb)
 {
@@ -530,6 +551,13 @@ bb_finish(struct blk_buf *bb)
 }
 
 #define DO_STRBUF(STRBUF, CHAR, STRLEN)                                \
+                                                               \
+struct STRBUF *                                                        \
+STRBUF##_alloc(void)                                           \
+{                                                              \
+    return xcalloc(1, sizeof(struct STRBUF));                  \
+}                                                              \
+                                                               \
 static void                                                    \
 STRBUF##_store1(struct STRBUF *buf, CHAR c)                    \
 {                                                              \
@@ -593,6 +621,13 @@ STRBUF##_cleanup(void *xbuf)                                       \
     xfree(buf->s);                                             \
 }                                                              \
                                                                \
+void                                                           \
+STRBUF##_free(void *xbuf)                                      \
+{                                                              \
+    STRBUF##_cleanup(xbuf);                                    \
+    xfree(xbuf);                                               \
+}                                                              \
+                                                               \
 const struct STRBUF STRBUF##_init /* = STRBUF##_INIT; */
 
 DO_STRBUF(strbuf, char, strlen);
index 0c9c3b6..5178d10 100644 (file)
@@ -72,7 +72,7 @@
 .\"   used here if you can. In particular, please don't use nroff commands
 .\"   which aren't already used herein.
 .\" 
-.TH TCSH 1 "3 March 2007" "Astron 6.15.00"
+.TH TCSH 1 "10 July 2009" "Astron 6.17.00"
 .SH NAME
 tcsh \- C shell with file name completion and command line editing
 .SH SYNOPSIS
@@ -1785,7 +1785,7 @@ Equivalent to `\-P \fIfile\fR & \fImode\fR', e.g., `\-P22 \fIfile\fR' returns
 and `0' if by neither
 .TP 8
 .B P\fImode\fB:
-Like \fBP\fImode\fB:\fR, with leading zero
+Like \fBP\fImode\fR, with leading zero
 .TP 8
 .B U
 Numeric userid
@@ -1894,9 +1894,9 @@ default \fInotify\fR marks the current process; simply say `notify' after
 starting a background job to mark it.
 .PP
 When you try to leave the shell while jobs are stopped, you will be
-warned that `You have stopped jobs.' You may use the \fIjobs\fR command to see
-what they are.  If you do this or immediately try to exit again, the shell will
-not warn you a second time, and the suspended jobs will be terminated.
+warned that `There are suspended jobs.' You may use the \fIjobs\fR command to
+see what they are.  If you do this or immediately try to exit again, the shell
+will not warn you a second time, and the suspended jobs will be terminated.
 .SS "Automatic, periodic and timed events (+)"
 There are various ways to run commands and take other actions automatically
 at various times in the ``life cycle'' of the shell.  They are summarized here,
@@ -2413,6 +2413,14 @@ completion.  If null, no character is appended.  If omitted (in which
 case the fourth delimiter can also be omitted), a slash is appended to
 directories and a space to other words.
 .PP
+\fIcommand\fR invoked from `...` version has additional environment
+variable set, the variable name is \%\fBCOMMAND_LINE\fR\% and
+contains (as its name indicates) contents of the current (already
+typed in) command line. One can examine and use contents of the
+\%\fBCOMMAND_LINE\fR\% variable in her custom script to build more
+sophisticated completions (see completion for svn(1) included in
+this package).
+.PP
 Now for some examples.  Some commands take only directories as arguments,
 so there's no point completing plain files.
 .IP "" 4
@@ -2921,6 +2929,9 @@ the maximum number of simultaneous processes for this user id
 .TP
 \fIsbsize\fR
 the maximum size of socket buffer usage for this user
+.TP 
+\fIswapsize\fR 
+the maximum amount of swap space reserved or used for this user 
 .PP
 \fImaximum-use\fR may be given as a (floating point or
 integer) number followed by a scale factor.  For all limits
@@ -3367,13 +3378,14 @@ executed programs.
 .B universe \fIuniverse\fR (+)
 Sets the universe to \fIuniverse\fR.  (Masscomp/RTU only)
 .TP 8
-.B unlimit \fR[\fB\-h\fR] [\fIresource\fR]
+.B unlimit \fR[\fB\-hf\fR] [\fIresource\fR]
 Removes the limitation on \fIresource\fR or, if no \fIresource\fR is
 specified, all \fIresource\fR limitations.
 With \fB\-h\fR, the corresponding hard limits are removed.
 Only the super-user may do this.
 Note that \fBunlimit\fR may not exit successful, since most systems
 do not allow \fIdescriptors\fR to be unlimited.
+With \fB\-f\fR errors are ignored.
 .TP 8
 .B unset \fIpattern
 Removes all variables whose names match \fIpattern\fR, unless they are read-only.
@@ -3466,7 +3478,7 @@ Runs before each command gets executed, or when the command changes state.
 This is similar to \fIpostcmd\fR, but it does not print builtins.
 .RS +8
 .IP "" 4
-> alias jobcmd  'echo \-n "^[]2\e;\e!#^G"'
+> alias jobcmd  'echo \-n "^[]2\e;\e!#:q^G"'
 .PP
 then executing \fIvi foo.c\fR will put the command string in the xterm title bar.
 .RE
@@ -3515,7 +3527,7 @@ should be used.
 Runs before each command gets executed.
 .RS +8
 .IP "" 4
-> alias postcmd  'echo \-n "^[]2\e;\e!#^G"'
+> alias postcmd  'echo \-n "^[]2\e;\e!#:q^G"'
 .PP
 then executing \fIvi foo.c\fR will put the command string in the xterm title bar.
 .RE
@@ -3566,7 +3578,8 @@ each completion attempt.
 .TP 8
 .B autoexpand \fR(+)
 If set, the \fIexpand-history\fR editor command is invoked automatically
-before each completion attempt.
+before each completion attempt. If this is set to \fIonlyhistory\fR, then
+only history will be expanded and a second completion will expand filenames.
 .TP 8
 .B autolist \fR(+)
 If set, possibilities are listed after an ambiguous completion.
@@ -3615,6 +3628,10 @@ And display colorful NLS messages.
 .B command \fR(+)
 If set, the command which was passed to the shell with the \fB-c\fR flag (q.v.).
 .TP 8
+.B compat_expr \fR(+)
+If set, the shell will evaluate expressions right to left, like the original
+\fIcsh\fR.
+.TP 8
 .B complete \fR(+)
 If set to `enhance', completion 1) ignores case and 2) considers
 periods, hyphens and underscores (`.', `\-' and `_') to be word
@@ -5057,9 +5074,7 @@ supervisor call mechanism [are my IBM roots also showing?]).
 The creator of tcsh was impressed by this feature and several others of TENEX
 and TOPS-20, and created a version of csh which mimicked them.
 .SH LIMITATIONS
-Words can be no longer than 1024 characters.
-.PP
-The system limits argument lists to 10240 characters.
+The system limits argument lists to ARG_MAX characters.
 .PP
 The number of arguments to a command which involves filename expansion is
 limited to 1/6th the number of characters allowed in an argument list.
@@ -5076,7 +5091,7 @@ pipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2),
 malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7),
 termio(7), Introduction to the C Shell
 .SH VERSION
-This manual documents tcsh 6.15.00 (Astron) 2007-03-03.
+This manual documents tcsh 6.17.00 (Astron) 2009-07-10.
 .SH AUTHORS
 .PD 0
 .TP 2
diff --git a/contrib/tcsh-6/tcsh.vcproj b/contrib/tcsh-6/tcsh.vcproj
new file mode 100644 (file)
index 0000000..6178823
--- /dev/null
@@ -0,0 +1,827 @@
+<?xml version="1.0" encoding="Windows-1252"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="9.00"\r
+       Name="tcsh"\r
+       ProjectGUID="{0DF699BA-6A5E-4B74-AE29-19757D072F19}"\r
+       RootNamespace="tcsh"\r
+       Keyword="Win32Proj"\r
+       TargetFrameworkVersion="196613"\r
+       >\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"\r
+               />\r
+               <Platform\r
+                       Name="x64"\r
+               />\r
+       </Platforms>\r
+       <ToolFiles>\r
+       </ToolFiles>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                               CommandLine=""\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                               Description=""\r
+                               CommandLine=""\r
+                               AdditionalDependencies=""\r
+                               Outputs=""\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               WholeProgramOptimization="false"\r
+                               AdditionalIncludeDirectories="$(SolutionDir)\win32;$(SolutionDir)"\r
+                               PreprocessorDefinitions="WINNT_NATIVE;NO_CRYPT;HAVE_DIRENT_H;NTDBG"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="0"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               DebugInformationFormat="4"\r
+                               CompileAs="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               LinkIncremental="2"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               StackReserveSize="1048576"\r
+                               StackCommitSize="524288"\r
+                               EntryPointSymbol="silly_entry"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="2"\r
+                       WholeProgramOptimization="1"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                               CommandLine=""\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                               Description=""\r
+                               CommandLine=""\r
+                               AdditionalDependencies=""\r
+                               Outputs=""\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="2"\r
+                               EnableIntrinsicFunctions="true"\r
+                               WholeProgramOptimization="false"\r
+                               AdditionalIncludeDirectories="$(SolutionDir)\win32;$(SolutionDir)"\r
+                               PreprocessorDefinitions="WINNT_NATIVE;NO_CRYPT;HAVE_DIRENT_H"\r
+                               RuntimeLibrary="0"\r
+                               EnableFunctionLevelLinking="true"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               DebugInformationFormat="3"\r
+                               CompileAs="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               LinkIncremental="1"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               StackReserveSize="1048576"\r
+                               StackCommitSize="524288"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               LinkTimeCodeGeneration="0"\r
+                               EntryPointSymbol="silly_entry"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Debug|x64"\r
+                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"\r
+                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                               CommandLine=""\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                               Description=""\r
+                               CommandLine=""\r
+                               AdditionalDependencies=""\r
+                               Outputs=""\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                               TargetEnvironment="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               WholeProgramOptimization="false"\r
+                               AdditionalIncludeDirectories="$(SolutionDir)\win32;$(SolutionDir)"\r
+                               PreprocessorDefinitions="WINNT_NATIVE;NO_CRYPT;HAVE_DIRENT_H;NTDBG"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="0"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               DebugInformationFormat="3"\r
+                               CompileAs="1"\r
+                               DisableSpecificWarnings="4244;4267"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               LinkIncremental="2"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               StackReserveSize="1048576"\r
+                               StackCommitSize="524288"\r
+                               EntryPointSymbol="silly_entry"\r
+                               TargetMachine="17"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|x64"\r
+                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"\r
+                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="2"\r
+                       WholeProgramOptimization="1"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                               CommandLine=""\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                               Description=""\r
+                               CommandLine=""\r
+                               AdditionalDependencies=""\r
+                               Outputs=""\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                               TargetEnvironment="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="2"\r
+                               EnableIntrinsicFunctions="true"\r
+                               WholeProgramOptimization="false"\r
+                               AdditionalIncludeDirectories="$(SolutionDir)\win32;$(SolutionDir)"\r
+                               PreprocessorDefinitions="WINNT_NATIVE;NO_CRYPT;HAVE_DIRENT_H"\r
+                               RuntimeLibrary="0"\r
+                               EnableFunctionLevelLinking="true"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               DebugInformationFormat="3"\r
+                               CompileAs="1"\r
+                               DisableSpecificWarnings="4244;4267"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               LinkIncremental="1"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               StackReserveSize="1048576"\r
+                               StackCommitSize="524288"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               LinkTimeCodeGeneration="0"\r
+                               EntryPointSymbol="silly_entry"\r
+                               TargetMachine="17"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="Source Files"\r
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+                       >\r
+                       <File\r
+                               RelativePath=".\win32\bogus.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\clip.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\console.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\customstep.cmd"\r
+                               >\r
+                               <FileConfiguration\r
+                                       Name="Debug|Win32"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCustomBuildTool"\r
+                                               Description="Generating headers"\r
+                                               CommandLine="$(SolutionDir)\win32\customstep.cmd $(SolutionDir)"\r
+                                               AdditionalDependencies="ed.defns.c;sh.err.c;tc.const.c;win32\nt.const.c"\r
+                                               Outputs="ed.defns.h;sh.err.h;tc.const.h;win32\nt.const.h"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release|Win32"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCustomBuildTool"\r
+                                               Description="Generating headers"\r
+                                               CommandLine="$(SolutionDir)\win32\customstep.cmd $(SolutionDir)"\r
+                                               AdditionalDependencies="ed.defns.c;sh.err.c;tc.const.c;win32\nt.const.c"\r
+                                               Outputs="ed.defns.h;sh.err.h;tc.const.h;win32\nt.const.h"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Debug|x64"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCustomBuildTool"\r
+                                               Description="Generating headers"\r
+                                               CommandLine="$(SolutionDir)\win32\customstep.cmd $(SolutionDir)"\r
+                                               AdditionalDependencies="ed.defns.c;sh.err.c;tc.const.c;win32\nt.const.c"\r
+                                               Outputs="ed.defns.h;sh.err.h;tc.const.h;win32\nt.const.h"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release|x64"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCustomBuildTool"\r
+                                               Description="Generating headers"\r
+                                               CommandLine="$(SolutionDir)\win32\customstep.cmd $(SolutionDir)"\r
+                                               AdditionalDependencies="ed.defns.c;sh.err.c;tc.const.c;win32\nt.const.c"\r
+                                               Outputs="ed.defns.h;sh.err.h;tc.const.h;win32\nt.const.h"\r
+                                       />\r
+                               </FileConfiguration>\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\dirent.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ed.chared.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ed.defns.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ed.init.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ed.inputl.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ed.refresh.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ed.term.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ed.xmap.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\fork.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\glob.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\globals.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\io.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\nt.bind.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\nt.char.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\nt.const.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\nt.screen.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\nt.who.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\ntb1.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\ntb2.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\ntfunc.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\ps.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.char.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.char.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.dir.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.dol.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.err.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.exec.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.exp.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.file.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.func.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.glob.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.hist.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.init.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.lex.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.misc.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.parse.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.print.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.proc.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.sem.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.set.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.time.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\signal.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\stdio.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\support.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.alloc.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.bind.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.const.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.disc.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.func.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.nls.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.os.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.printf.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.prompt.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.sched.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.sig.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.str.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.vers.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.who.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tw.color.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tw.comp.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tw.help.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tw.init.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tw.parse.c"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tw.spell.c"\r
+                               >\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Header Files"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+                       >\r
+                       <File\r
+                               RelativePath=".\config.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\config_f.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\config_p.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\dirent.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ed.decls.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ed.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\ed.term.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\forkdata.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\glob.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\ntport.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\patchlevel.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\pathnames.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.decls.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.dir.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.proc.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\sh.types.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\signal.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\snames.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.decls.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.nls.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.os.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.sig.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tc.wait.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tw.decls.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\tw.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\version.h"\r
+                               >\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Resource Files"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+                       >\r
+                       <File\r
+                               RelativePath=".\win32\tcshrc.rc"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\win32\WILDCAT.RC"\r
+                               >\r
+                       </File>\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
index 3c6b57f..2e935fc 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/tw.color.c,v 1.24 2006/03/02 18:46:45 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tw.color.c,v 1.25 2008/10/17 19:57:33 christos Exp $ */
 /*
  * tw.color.c: builtin color ls-F
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tw.color.c,v 1.24 2006/03/02 18:46:45 christos Exp $")
+RCSID("$tcsh: tw.color.c,v 1.25 2008/10/17 19:57:33 christos Exp $")
 
 #include "tw.h"
 #include "ed.h"
@@ -85,6 +85,7 @@ static Variable variables[] = {
     VAR(NOS, "tw", ""),                /* Sticky and other writable dir (+t,o+w) */
     VAR(NOS, "ow", ""),                /* Other writable dir (o+w) but not sticky */
     VAR(NOS, "st", ""),                /* Sticky dir (+t) but not other writable */
+    VAR(NOS, "rs", "0"),       /* Reset to normal color */
 };
 
 enum FileType {
index 30285af..475262d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/tw.comp.c,v 1.41 2006/03/02 18:46:45 christos Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tw.comp.c,v 1.42 2007/10/01 21:52:00 christos Exp $ */
 /*
  * tw.comp.c: File completion builtin
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tw.comp.c,v 1.41 2006/03/02 18:46:45 christos Exp $")
+RCSID("$tcsh: tw.comp.c,v 1.42 2007/10/01 21:52:00 christos Exp $")
 
 #include "tw.h"
 #include "ed.h"
@@ -630,7 +630,9 @@ tw_complete(const Char *line, Char **word, Char **pat, int looking, eChar *suf)
        default:
            abort();                   /* Cannot happen */
        }
+       tsetenv(STRCOMMAND_LINE, line);
        res = tw_result(com, pat);
+       Unsetenv(STRCOMMAND_LINE);
        cleanup_until(buf);
        return res;
     }
index 97cabce..d17225f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /p/tcsh/cvsroot/tcsh/tw.parse.c,v 3.123 2007/03/01 21:21:42 corinna Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tw.parse.c,v 3.124 2007/07/02 15:48:48 christos Exp $ */
 /*
  * tw.parse.c: Everyone has taken a shot in this futile effort to
  *            lexically analyze a csh line... Well we cannot good
@@ -35,7 +35,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tw.parse.c,v 3.123 2007/03/01 21:21:42 corinna Exp $")
+RCSID("$tcsh: tw.parse.c,v 3.124 2007/07/02 15:48:48 christos Exp $")
 
 #include "tw.h"
 #include "ed.h"
@@ -433,7 +433,7 @@ tenematch(Char *inputline, int num_read, COMMAND command)
        Char *p;
        int found;
 
-       found = !cmd_expand(qline.s + wordp, &p);
+       found = cmd_expand(qline.s + wordp, &p);
        
        if (!found) {
            xfree(p);