1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-26 11:47:31 +00:00

Update to tcsh 6.17.00.

Approved by:	re (kensmith)
This commit is contained in:
Mark Peek 2009-07-11 05:35:08 +00:00
commit a15e6f9a9a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=195609
55 changed files with 6224 additions and 4859 deletions

View File

@ -1,3 +1,74 @@
21. V6.17.00 - 20090710
20. Fix dataroot autoconf issue.
19. Fix directory stuff for unit tests.
18. Fix small bug in history in loops.
17. Provide newer config.{guess,sub}
16. Fix gcc 4 warnings.
15. Fix memory trashing bug introduced in 10.
14. V6.16.01 - 20090624
13. add missing sigemptyset in goodbye()
12. add rlimit swapsize from FreeBSD.
11. restore behavior where a[n-] never prints an error.
10. always save the whole command, not just the first 80 chars of it.
9. fix short2str/short2qstr length adjustment in wide chars
(Vitezslav Crhonek)
8. set histfile=/tmp/history.temp; set savehist=(100 merge);
alias precmd history -S. After that justpr is not restored and commands
don't execute. (Andriy Gapon)
7. Fix "as" $ modifier from corrupting memory.
set t=demfonsftraftionf; echo $t:as/f//
6. Make $% work with environment variable (Ron Johnston)
5. Dragonfly script support (Matthias Schmidt, m65)
4. Add autoexpand=onlyhistory (Don Estabrook, m66)
3. Add history in loops (Laurence Darby, m48)
2. Add missing colorls "rs" variable (Shlomi Fish, m70)
1. Fix pts detection issue (Ruslan Ermilov)
33. V6.16.00 - 20080930
32. longjmp clobbered variable fixes.
31. __GNX__ addition
30. Windows fork fixes
28. V6.15.02 - 20080830
27. Fix an eval free'ing botch (Per Hedeland)
26. /bin/echo "`" coredumped because stderror() calls longjmp corrupting
the stack (Mark Davies). We should vet the code for all stderror()
calls that cleanup local stack variables.
25. foo > ${undef} caused coredumps because of vfork() child corrupting
the state of the parent stack.
24. $x[A-B] did not complain for A out of range. (Cai Xianchao)
23. rename setp -> tcsh_setp to avoid conflict with mach (Javier Vasquez)
22. Fix degree handling by defining __XPG4_CHAR_CLASS__ for solaris
(Mike Sullivan)
21. Change 'od' to 'od -c' in tests so that they work on big endian machines.
(Martin Kraemer)
20. Add environment variable COMMAND_LINE to be available in completions
(Marcin Konarski)
19. V6.15.01 - 20070928
18. Evaluate expressions in the proper order (Li Zefan), controlled by
compat_expr.
17. Don't need to flush() if we are silent. Prevents recursive error issue.
(joshua stein)
16. Don't execute the jobcmd if the output is not a tty (Charles Ross)
15. Quote the history in the examples (Johann 'Myrkraverk' Oskarsson)
14. Mismatch clarification patch (Per Hedeland)
13. Fix 'repeat n cmd &' abort() (Mike Sullivan)
12. Fix octal parsing (Li Zefan)
11. Fix pty detection for autologout setting (Kris Kennaway, Giorgos Keramidas)
10. kill `foo` got stuck because sigchld was disabled too soon (Mark Peek)
9. Avoid null pointer dereference in proc cwd (Kurt Miller)
8. eval "foreach a b c" exits (Anthony Menasse)
7. Quoting was broken in substitutions (Joe Wells)
6. QNX patches via pkgsrc
5. cd - twice from a directory that contained a glob pattern,
expands the glob twice (Mark Santcroos)
4. MidnightBsd support (Lucas Holt)
3. Fix history substitution core-dump with no history entries
2. Merge two character tables that are the same (Martin Kraemer)
1. On ancient 7 bit locales, punctuation characters are used to
denote special characters such as umlaut, adiaresis, etc.
These characters return true for isalpha/isalnum. Ignore them
because they break parsing (Martin Kraemer)
74. V6.15.00 - 20070303
73. fix extension eating windows code (christos)
72. fix loop in %R history expansion (christos)

View File

@ -1,5 +1,5 @@
XCOMM
XCOMM $tcsh: Imakefile,v 1.85 2006/03/02 18:46:44 christos Exp $
XCOMM $tcsh: Imakefile,v 1.86 2007/03/19 23:25:02 christos Exp $
XCOMM
XCOMM Imakefile for tcsh 6.12
XCOMM Marc Horowitz, MIT SIPB
@ -211,6 +211,10 @@ EXTF=mi.termios.c mi.wait.h mi.varargs.h vms.termcap.c
# define ConfigH bsd4.4
# endif /* FreeBsdArchitecture */
# ifdef MidnightBSDArchitecture
# define ConfigH bsd4.4
# endif /* MidnightBsdArchitecture */
# ifdef i386SVR4Architecture
# define ConfigH sysv4
# ifdef DELL

View File

@ -1,20 +0,0 @@
#
# Makefile.ADMIN
#
# Maintenance tasks
#
# You can refetch files from the website, then run "cvs diff" to
# sanity check any changes before committing.
#
LYNX= lynx -dump -nolist
TRIM= expand | sed -e 's/^ *$$//' | cat -s
WEB= http://www.tcsh.org/page?
.for i in FAQ WishList
$i: force
${LYNX} ${WEB}$i | ${TRIM} > ${.TARGET}
.endfor
.DUMMY: force
force:

View File

@ -1,4 +1,4 @@
# $tcsh: Makefile.in,v 3.36 2006/08/24 20:56:31 christos Exp $
# $tcsh: Makefile.in,v 3.40 2009/06/24 22:09:05 christos Exp $
# Makefile.in 4.3 6/11/83
#
# C Shell with process control; VM/UNIX VAX Makefile
@ -248,7 +248,7 @@ CPP = @CPP@ # This is set by autoconf.
# The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which
# on the suns does not know how to make dynamically linked binaries.
CC = @CC@ # This is set by autoconf.
#CC= gcc -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Werror -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wsign-compare -Wcast-qual -Wreturn-type -Wswitch -Wshadow -Wwrite-strings
#CC= gcc -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Werror -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wsign-compare -Wcast-qual -Wreturn-type -Wswitch -Wshadow -Wwrite-strings -Wextra
#CC= gcc -Wall -pipe -B/bin/ # -ansi -pedantic
#CC= gcc -m486 -pipe -Wall # Generate code for Intel 486 (linux)
#CC= shlicc # BSDI2.1 w/ shared libraries
@ -278,7 +278,7 @@ P=
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
mandir=@mandir@
mandir=@datarootdir@/man
MANSECT=1
DESTBIN=${DESTDIR}${bindir}
DESTMAN=${DESTDIR}${mandir}/man${MANSECT}
@ -463,7 +463,7 @@ $(srcdir)/tests/package.m4: $(srcdir)/configure.in
echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
} >$(srcdir)/tests/package.m4
$(srcdir)/tests/testsuite: tests/package.m4 tests/testsuite.at $(TESTFILES)
$(srcdir)/tests/testsuite: $(srcdir)/tests/package.m4 $(srcdir}/tests/testsuite.at $(TESTFILES)
autom4te --language=autotest -I $(srcdir)/tests \
$(srcdir)/tests/testsuite.at -o $@.tmp
mv $@.tmp $@
@ -531,11 +531,16 @@ install.cygwin: install install.man
cp ${srcdir}/WishList ${srcdir}/Y2K ${DESTDIR}${prefix}/share/doc/tcsh
perl ${srcdir}/tcsh.man2html ${srcdir}/tcsh.man
cp -rp tcsh.html ${DESTDIR}${prefix}/share/doc/tcsh
-mkdir -p ${DESTDIR}/etc/defaults/etc/profile.d
-mkdir -p ${DESTDIR}/etc/profile.d
-mkdir -p ${DESTDIR}/etc/postinstall
cp -p ${srcdir}/cygwin/etc/csh.* ${DESTDIR}/etc
cp -p ${srcdir}/cygwin/etc/profile.d/*.tcsh ${DESTDIR}/etc/profile.d
cp -p ${srcdir}/cygwin/etc/postinstall/tcsh.sh ${DESTDIR}/etc/postinstall
-mkdir -p ${DESTDIR}/etc/preremove
cp -p ${srcdir}/cygwin/csh.cshrc ${DESTDIR}/etc/defaults/etc
cp -p ${srcdir}/cygwin/csh.login ${DESTDIR}/etc/defaults/etc
cp -p ${srcdir}/cygwin/bindkey.tcsh ${DESTDIR}/etc/defaults/etc/profile.d
cp -p ${srcdir}/complete.tcsh ${DESTDIR}/etc/defaults/etc/profile.d
cp -p ${srcdir}/cygwin/postinstall.sh ${DESTDIR}/etc/postinstall/tcsh.sh
cp -p ${srcdir}/cygwin/preremove.sh ${DESTDIR}/etc/preremove/tcsh.sh
# Amiga Unix
#install.man: tcsh.man

View 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.

View File

@ -1,27 +0,0 @@
HOW TO RELEASE TCSH
1) Update version number and date in patchlevel.h
2) Note the new version and date in Fixes
3) Updated tcsh.man to have the new version and date also
(two separate lines, with the date in different formats)
4) Commit changes into CVS
5) Tag the release with TCSHx_yy_zz where
x == REV
yy == VERS
zz == PATCHLEVEL
from patchlevel.h (the new values you picked)
6) Export the code using the new tag you created. Rename
the directory from "tcsh" to "tcsh-x.yy.zz" and create
tcsh-x.yy.zz.tar.gz (or tcsh-x.yy.tar.gz for public
releases where zz [PATCHLEVEL] is zero)
7) Export the previous release as well
8) Remove files that should not be in a release:
- Announce*
- Copyright
- Makefile.ADMIN
- RELEASE-PROCEDURE (this file)
9) Generate a "diff -urN" between the two directories you
have exported, save it in patchz.gz (z is PATCHLEVEL)
10) Make the patch and the source tarball available on ftp
11) Mail an announcement to tcsh@mx.gw.com
12) Mail the patch to tcsh-diffs@mx.gw.com

View 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

File diff suppressed because it is too large Load Diff

View File

@ -195,7 +195,7 @@
/* Define to 1 if the `setpgrp' function takes no argument. */
#undef SETPGRP_VOID
/* The size of a `wchar_t', as computed by sizeof. */
/* The size of `wchar_t', as computed by sizeof. */
#undef SIZEOF_WCHAR_T
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
@ -213,7 +213,7 @@
/* Define to `int' if <sys/types.h> does not define. */
#undef mode_t
/* Define to `unsigned' if <sys/types.h> does not define. */
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to `int' if neither <sys/types.h> nor <sys/socket.h> define. */

571
contrib/tcsh/config.rpath Normal file
View File

@ -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

View File

@ -1,9 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
timestamp='2002-07-03'
timestamp='2009-06-11'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -21,14 +22,15 @@ timestamp='2002-07-03'
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
@ -70,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -83,11 +85,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit 0 ;;
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit 0 ;;
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit 0 ;;
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
@ -99,7 +101,7 @@ while test $# -gt 0 ; do
*local*)
# First pass through any local machine types.
echo $1
exit 0;;
exit ;;
* )
break ;;
@ -118,7 +120,10 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@ -144,10 +149,13 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis)
-apple | -axis | -knuth | -cray)
os=
basic_machine=$1
;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
@ -169,6 +177,10 @@ case $os in
-hiux*)
os=-hiuxwe2
;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@ -185,6 +197,10 @@ case $os in
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@ -228,40 +244,57 @@ case $basic_machine in
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k \
| m32r | m68000 | m68k | m88k | mcore \
| ip2k | iq2000 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nios | nios2 \
| ns16k | ns32k \
| openrisc | or32 \
| or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic80 | tron \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
| x86 | xscale | xstormy16 | xtensa \
| z8k)
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
@ -271,6 +304,9 @@ case $basic_machine in
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
ms1)
basic_machine=mt-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
@ -290,48 +326,67 @@ case $basic_machine in
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
| bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c54x-* \
| clipper-* | cydra-* \
| avr-* | avr32-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* \
| m32r-* \
| ip2k-* | iq2000-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | mcore-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipstx39 | mipstx39el \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
| xtensa-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-*)
| z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
@ -349,6 +404,9 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
@ -363,6 +421,12 @@ case $basic_machine in
basic_machine=a29k-none
os=-bsd
;;
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
@ -386,6 +450,10 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-bsd
;;
aros)
basic_machine=i386-pc
os=-aros
;;
aux)
basic_machine=m68k-apple
os=-aux
@ -394,10 +462,26 @@ case $basic_machine in
basic_machine=ns32k-sequent
os=-dynix
;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
@ -422,12 +506,27 @@ case $basic_machine in
basic_machine=j90-cray
os=-unicos
;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16)
basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
@ -450,6 +549,14 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
@ -600,6 +707,14 @@ case $basic_machine in
basic_machine=m68k-isi
os=-sysv
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*)
basic_machine=m88k-omron
;;
@ -615,6 +730,10 @@ case $basic_machine in
basic_machine=i386-pc
os=-mingw32
;;
mingw32ce)
basic_machine=arm-unknown
os=-mingw32ce
;;
miniframe)
basic_machine=m68000-convergent
;;
@ -628,10 +747,6 @@ case $basic_machine in
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
mmix*)
basic_machine=mmix-knuth
os=-mmixware
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
@ -644,6 +759,9 @@ case $basic_machine in
basic_machine=i386-pc
os=-msdos
;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
mvs)
basic_machine=i370-ibm
os=-mvs
@ -719,9 +837,12 @@ case $basic_machine in
basic_machine=hppa1.1-oki
os=-proelf
;;
or32 | or32-*)
openrisc | openrisc-*)
basic_machine=or32-unknown
os=-coff
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
@ -739,55 +860,75 @@ case $basic_machine in
basic_machine=i860-intel
os=-osf
;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pc98)
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
pentiumpro | p6 | 6x86 | athlon)
pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc
;;
pentiumii | pentium2)
pentiumii | pentium2 | pentiumiii | pentium3)
basic_machine=i686-pc
;;
pentium4)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-*)
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium4-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
power) basic_machine=power-ibm
;;
ppc) basic_machine=powerpc-unknown
;;
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
;;
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
basic_machine=powerpc64le-unknown
;;
;;
ppc64le-* | powerpc64little-*)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
@ -798,6 +939,10 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
rdos)
basic_machine=i386-pc
os=-rdos
;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
@ -818,6 +963,20 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
sb1)
basic_machine=mipsisa64sb1-unknown
;;
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sde)
basic_machine=mipsisa32-sde
os=-elf
;;
sei)
basic_machine=mips-sei
os=-seiux
;;
sequent)
basic_machine=i386-sequent
;;
@ -825,6 +984,12 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
@ -883,7 +1048,7 @@ case $basic_machine in
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
sv1)
sv1)
basic_machine=sv1-cray
os=-unicos
;;
@ -891,10 +1056,6 @@ case $basic_machine in
basic_machine=i386-sequent
os=-dynix
;;
t3d)
basic_machine=alpha-cray
os=-unicos
;;
t3e)
basic_machine=alphaev5-cray
os=-unicos
@ -907,6 +1068,18 @@ case $basic_machine in
basic_machine=tic54x-unknown
os=-coff
;;
tic55x | c55x*)
basic_machine=tic55x-unknown
os=-coff
;;
tic6x | c6x*)
basic_machine=tic6x-unknown
os=-coff
;;
tile*)
basic_machine=tile-unknown
os=-linux-gnu
;;
tx39)
basic_machine=mipstx39-unknown
;;
@ -920,6 +1093,10 @@ case $basic_machine in
tower | tower-32)
basic_machine=m68k-ncr
;;
tpf)
basic_machine=s390x-ibm
os=-tpf
;;
udi29k)
basic_machine=a29k-amd
os=-udi
@ -941,8 +1118,8 @@ case $basic_machine in
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
@ -963,11 +1140,11 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
windows32)
basic_machine=i386-pc
os=-windows32-msvcrt
xbox)
basic_machine=i686-pc
os=-mingw32
;;
xps | xps100)
xps | xps100)
basic_machine=xps100-honeywell
;;
ymp)
@ -978,6 +1155,10 @@ case $basic_machine in
basic_machine=z8k-unknown
os=-sim
;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
@ -997,6 +1178,9 @@ case $basic_machine in
romp)
basic_machine=romp-ibm
;;
mmix)
basic_machine=mmix-knuth
;;
rs6000)
basic_machine=rs6000-ibm
;;
@ -1013,16 +1197,13 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparc | sparcv9 | sparcv9b)
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
basic_machine=sparc-sun
;;
cydra)
cydra)
basic_machine=cydra-cydrome
;;
orion)
@ -1037,10 +1218,6 @@ case $basic_machine in
pmac | pmac-mpw)
basic_machine=powerpc-apple
;;
c4x*)
basic_machine=c4x-none
os=-coff
;;
*-unknown)
# Make sure to match an already-canonicalized machine name.
;;
@ -1090,24 +1267,30 @@ case $os in
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@ -1119,16 +1302,21 @@ case $os in
;;
esac
;;
-nto-qnx*)
;;
-nto*)
os=-nto-qnx
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux-dietlibc)
os=-linux-dietlibc
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
@ -1141,6 +1329,9 @@ case $os in
-opened*)
os=-openedition
;;
-os400*)
os=-os400
;;
-wince*)
os=-wince
;;
@ -1162,6 +1353,9 @@ case $os in
-atheos*)
os=-atheos
;;
-syllable*)
os=-syllable
;;
-386bsd)
os=-bsd
;;
@ -1172,7 +1366,7 @@ case $os in
os=-rtmk-nova
;;
-ns2 )
os=-nextstep2
os=-nextstep2
;;
-nsk*)
os=-nsk
@ -1184,6 +1378,9 @@ case $os in
-sinix*)
os=-sysv4
;;
-tpf*)
os=-tpf
;;
-triton*)
os=-sysv3
;;
@ -1211,8 +1408,20 @@ case $os in
-xenix)
os=-xenix
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
;;
-aros*)
os=-aros
;;
-kaos*)
os=-kaos
;;
-zvmoe)
os=-zvmoe
;;
-dicos*)
os=-dicos
;;
-none)
;;
@ -1236,6 +1445,12 @@ else
# system, and we'll never get to this point.
case $basic_machine in
score-*)
os=-elf
;;
spu-*)
os=-elf
;;
*-acorn)
os=-riscix1.2
;;
@ -1245,11 +1460,14 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
;;
pdp11-*)
pdp11-*)
os=-none
;;
*-dec | vax-*)
@ -1270,6 +1488,9 @@ case $basic_machine in
m68*-cisco)
os=-aout
;;
mep-*)
os=-elf
;;
mips*-cisco)
os=-elf
;;
@ -1288,9 +1509,15 @@ case $basic_machine in
*-be)
os=-beos
;;
*-haiku)
os=-haiku
;;
*-ibm)
os=-aix
;;
*-knuth)
os=-mmixware
;;
*-wec)
os=-proelf
;;
@ -1342,19 +1569,19 @@ case $basic_machine in
*-next)
os=-nextstep3
;;
*-gould)
*-gould)
os=-sysv
;;
*-highlevel)
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
*-sgi)
os=-irix
;;
*-siemens)
*-siemens)
os=-sysv4
;;
*-masscomp)
@ -1393,7 +1620,7 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
-aix*)
-cnk*|-aix*)
vendor=ibm
;;
-beos*)
@ -1423,9 +1650,15 @@ case $basic_machine in
-mvs* | -opened*)
vendor=ibm
;;
-os400*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-tpf*)
vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
@ -1450,7 +1683,7 @@ case $basic_machine in
esac
echo $basic_machine$os
exit 0
exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)

View 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
*
@ -143,7 +143,7 @@
* 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
@ -189,7 +189,7 @@
# 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 */

7361
contrib/tcsh/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ dnl Written by Kaveh Ghazi (ghazi@caip.rutgers.edu) 5/11/96.
dnl
AC_PREREQ([2.59])dnl Minimum Autoconf version required.
AC_INIT([tcsh], [6.15.00], [http://bugs.gw.com/])
AC_INIT([tcsh], [6.17.00], [http://bugs.gw.com/])
AC_CONFIG_SRCDIR([tc.vers.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_TESTDIR([.], [.])
@ -101,6 +101,16 @@ case "${host}" in
tcsh_config_file=bsd4.4
;;
## MidnightBSD systems
*-*-midnightbsd*)
tcsh_config_file=bsd4.4
;;
## DragonFlyBSD systems
*-*-dragonfly*)
tcsh_config_file=bsd4.4
;;
## OpenBSD systems
*-*-openbsd*)
tcsh_config_file=bsd4.4
@ -233,6 +243,11 @@ case "${host}" in
tcsh_config_file=apollo
;;
## QNX6
*-qnx6*)
tcsh_config_file=qnx6
;;
* )
changequote([, ])dnl
AC_MSG_ERROR([Tcsh can't guess the configuration file name

View 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 @@ c_expand(Char *p)
* 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);
}

View 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);

View 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
*/
@ -43,6 +43,11 @@
# 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 */
/****************************************************************************/

View 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;
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();
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))
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;
}
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;
}
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;

View 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)

View 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
*/
@ -453,7 +453,7 @@
* 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

View 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;
}

View 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);

View File

@ -1,5 +1,5 @@
newcode :
/* $Header: /p/tcsh/cvsroot/tcsh/host.defs,v 1.43 2006/03/02 18:46:44 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/host.defs,v 1.46 2008/09/25 14:41:05 christos Exp $ */
/*
* host.defs: Hosttype/Machtype etc.
*/
@ -33,7 +33,7 @@ newcode :
*/
#include "sh.h"
RCSID("$tcsh: host.defs,v 1.43 2006/03/02 18:46:44 christos Exp $")
RCSID("$tcsh: host.defs,v 1.46 2008/09/25 14:41:05 christos Exp $")
endcode :
@ -520,6 +520,15 @@ machtype: defined(M_i386) : "i386"
enddef :
newdef : defined(__MidnightBSD__)
comment : MidnightBSD
vendor : defined(M_intel) : "intel"
hosttype: : "MidnightBSD"
ostype : : "MidnightBSD"
machtype: defined(M_i386) : "i386"
enddef :
newdef : defined(__386BSD__)
comment : Bill Jolitz's 386BSD
vendor : defined(M_intel) : "intel"
@ -1003,6 +1012,9 @@ hosttype: : "clipper"
machtype: : "clipper"
enddef :
newdef : defined(__QNX__)
ostype : : "qnx"
enddef :
newdef : (defined(SNI) || defined(sinix)) && !defined(_OSD_POSIX)
comment : Fujitsu Siemens Computers (former "Siemens Nixdorf Informationssysteme"): SINIX aka. ReliantUNIX, a SVR4 derivative
@ -1061,6 +1073,12 @@ ostype : : "sysv4"
machtype: : "sparc"
enddef :
newdef : defined(__CYGWIN__)
comment : Cygwin
hosttype: : "i386-cygwin"
ostype : : "cygwin"
enddef :
newdef : defined(_UWIN)
comment : AT&T Research Unix for Windows
vendor : : "att"

View File

@ -82,7 +82,7 @@
**********************************************************************
*/
#include "sh.h"
RCSID("$tcsh: ma.setp.c,v 1.18 2006/03/02 18:46:44 christos Exp $")
RCSID("$tcsh: ma.setp.c,v 1.19 2007/11/20 20:03:51 christos Exp $")
#ifdef MACH
@ -135,7 +135,7 @@ static int eflag;
static int initpaths (char **);
static void savepaths (char **);
static void freepaths (void);
static void rcmd (char *);
static void tcsh_rcmd (char *);
static void icmd (char *, char *);
static void iacmd (char *, char *);
static void ibcmd (char *, char *);
@ -173,7 +173,7 @@ setpath(char **paths, char **cmds, char *localsyspath, int dosuffix,
case 'r':
if (cmd[2] != '\0')
INVALID;
rcmd(localsyspath);
tcsh_rcmd(localsyspath);
break;
case 'i':
if (cmd[2] == '\0') {
@ -342,7 +342,7 @@ freepaths(void)
***********************************************/
static void
rcmd(char *localsyspath) /* reset path with localsyspath */
tcsh_rcmd(char *localsyspath) /* reset path with localsyspath */
{
int n, done;
char *new, *p;

View 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 */

View 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 */
@ -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;
}

View 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
*/
@ -32,11 +32,10 @@
*/
#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

View 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)

View 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 *);

View 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;

View 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 @@ heredoc(Char *term)
#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 (;;) {

View 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)) {

View 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 */

View 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');
}

View 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);

View 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,9 +1933,9 @@ struct limits limits[] =
{ RLIMIT_SBSIZE, "sbsize", 1, "" },
# endif /* RLIMIT_SBSIZE */
# ifdef RLIMIT_SWAP
{ RLIMIT_SWAP, "swaplimit", 1024, "kbytes" },
# endif /* RLIMIT_SWAP */
# ifdef RLIMIT_SWAP
{ RLIMIT_SWAP, "swapsize", 1024, "kbytes" },
# endif /* RLIMIT_SWAP */
{ -1, NULL, 0, NULL }
};
@ -2139,10 +2276,9 @@ void
dosuspend(Char **v, struct command *c)
{
#ifdef BSDJOBS
int ctpgrp;
struct sigaction old;
#endif /* BSDJOBS */
USE(c);
USE(v);
@ -2162,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);
}
@ -2225,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++;
@ -2251,6 +2380,7 @@ doeval(Char **v, struct command *c)
trim(v);
}
Ggv = gv;
state.evalvec = evalvec;
state.evalp = evalp;
state.didfds = didfds;
@ -2267,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);
}
/*************************************************************************/

View 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

View 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 */

View 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 @@ word(int parsehtime)
else {
if (bslash_quote &&
((c == '\'') || (c == '"') ||
(c == '\\'))) {
(c == '\\') || (c == '$'))) {
c |= QUOTE;
}
else {
@ -1491,7 +1491,7 @@ readc(int wanteof)
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,
@ -1626,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
@ -1634,7 +1634,7 @@ bgetc(void)
ch = fbuf[0][fseekp - fbobp];
fseekp++;
} while(ch == '\r');
#endif /* !WINNT_NATIVE */
#endif /* !WINNT_NATIVE && !__CYGWIN__ */
return (ch);
}
@ -1679,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
@ -1687,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);
}

View 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 @@ pprint(struct process *pp, int flag)
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 @@ pprint(struct process *pp, int flag)
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");
}

View 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

View 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);

View 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)

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/snames.h,v 1.3 1996/04/26 19:20:31 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/snames.h,v 1.4 2008/10/17 20:25:00 christos Exp $ */
/*
* snames.h: Short names for old compilers
*/
@ -38,6 +38,7 @@
#define e_delwordnext edelwrdnext
#define e_delwordprev edelwrdprev
#define e_expand eexp
#define e_expand_history_rne eexphistrne
#define e_expand_history eexphistory
#define e_expand_vars eexpvars
#define e_tty_starto ettystarto

View 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"));
}

View 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',
@ -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' };

View 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 *);
/*

View 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 */
@ -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

View 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
*/
@ -88,6 +88,13 @@
# 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 */

View 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

View 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);

View 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,9 +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
\fIswaplimit\fR
the maximum amount of swap space reserved or used 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
@ -3370,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.
@ -3469,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
@ -3518,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
@ -3569,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.
@ -3618,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
@ -5060,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.
@ -5079,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

View 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 {

View 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;
}

View 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);