Update to tcsh 6.20.00

This commit is contained in:
Dmitry Chagin 2017-03-25 13:32:28 +00:00
commit 19d2e3de75
103 changed files with 13817 additions and 3168 deletions

View File

@ -33,6 +33,7 @@ SRCS+= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \
tc.func.c tc.nls.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \
tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \
tc.who.c tc.h
SRCS+= dotlock.c dotlock.h
GENHDRS= ed.defns.h sh.err.h tc.const.h tc.defs.c
SRCS+= ${GENHDRS}

View File

@ -1,3 +1,95 @@
20. V6.20.00 - 20161124
19. Don't resize the screen if it did not change size.
18. V6.19.01 - 20161025
17. restore file description when cleaning up after eval:
repeat 99 time
16. PR/572: Fix $SHLVL issue when exec'ing subshells.
15. PR/403: Fix backquote expansion for multi-byte character sets.
14. Fix drawing issu with multi-line prompt (Kensuke Iwahashi/David Kaspar)
13. always send prusage to stdout.
12. PR/526: Fix double \\ printing from previous fix in history expansion.
11. Android updates from Corinna Vinschen
10. PR/526: Quote backslashes properly so they can be preserved in ``
expansions
9. Fix memory leak for paraml
8. Add notempty and ask values for the noclobber setting (Martin Tournoij)
7. more correct $wordchars for vimode (Luke Mewburn)
6. expose VImode in $vimode (Luke Mewburn)
5. display what the compiled in editor is in bindkey -d (Luke Mewburn)
4. run-fg-editor improvements and documentation (Luke Mewburn)
3. Fix parsing of 'if (cond)then' (Fridolin Pokorny)
2. PR/437: Fix handling of invalid unicode characters.
1. PR/451: Fix error messages containing %c to be always '%c'
41. V6.19.00 - 20150521
40. V6.18.05 - 20150510
39. fix reseting when interrupted inside an eval "eval sleep 10^C"
(paulo.cesar.pereira.de.andrade)
38. rename handle_intr -> handle_interrupt as originally intended.
37. fix input tests that need stdin on a tty
36. V6.18.04 - 20150504
35. revert fix echo "\1", it is incorrect.
34. revert fix to PR/437, breaks short strings.
33. V6.18.03 - 20150503
32. PR/437: Nakajima Akira: Fix segmentation fault reading input files
31. PR/291: Print job status messages to stderr.
30. Fridolin Pokorny NUL in `` does not mean EOF.
29. Pavel Raiskup fix hang with:
while (1)
( date & ; wait )
end
28. Add cdtohome special variable (Martin Tournoij)
27. Fix root prompt char for windows (Corinna Vinschen)
26. For "next" completion matches only consider exact matches of the previous
word (Jamie Landeg-Jones)
25. Fix echo "\1" for echo_style=both where the first character was
not processed properly (Gary Duzan)
24. V6.18.02 - 20140618
23. fix ls-F /non printing exit value twice.
22. rename configure.in to configure.ac, add aclocal.m4 to CVS
21. set foo="aabaabaa"; echo $foo:as/a// should produce bb
20. Add locked merge history support (Marcin Konarski)
19. Support more resource limits from various BSD's
18. Cache history count to speed up thing
17. PR/240: minix support
16. revert fix for 15. Causes extra quoting, for example (foo is a program
that prints its arguments):
$ ./foo 'abc' *
'\a\b\c'
15. fix globbing for ``, stripping backslashes. Example:
cat << _EOF > huh
echo 'hello\;world'
_EOF
echo `./huh 0`
echo `./huh $?`
14. fix for `` that causes hang. Example:
cat << _EOF > huh
#!/bin/sh
echo "[$@]"
echo "I am running"
echo "I am running ($$)" >> huh.out
_EOF
cat << _EOF > huh.tcsh
#!/bin/tcsh -f
./huh \
`#comment blah blah blah` \
parameter a \
`#comment blah blah blah` \
parameter b \
`#comment blah blah blah` \
parameter c
echo ok
_EOF
13. remove AsciiOnly fix now that the real issue has been fixed (Roman Kollar)
12. define utmp file for aix (Laurence Darby)
11. fix if history in loops
10. make ls-F print to stderr and set the exit code
9. make rmstar interruptible on linux
8. Get rid of pret_t and make the printf functions return the number of
characters printed as the system ones do.
7. Parse a FreeBSD compat $LSCOLORS. What to do when both LSCOLORS and
LS_COLORS are set. I am not documenting this until we decide.
6. V6.18.01 - 20120214
5. fix interruptible wait again
4. ignore bogus compiler overflow message

View File

@ -1,5 +1,5 @@
XCOMM
XCOMM $tcsh: Imakefile,v 1.87 2010/01/28 19:01:05 christos Exp $
XCOMM $tcsh: Imakefile,v 1.88 2014/07/07 20:34:58 christos Exp $
XCOMM
XCOMM Imakefile for tcsh 6.12
XCOMM Marc Horowitz, MIT SIPB
@ -526,8 +526,8 @@ MISCF = Makefile.std Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
README.imake complete.tcsh vmsreadme.txt Makefile.vms termcap.vms \
snames.h host.defs gethost.c tcsh.man2html Makefile.in configure.in \
Makefile.win32
snames.h host.defs gethost.c tcsh.man2html Makefile.in configure.ac \
Makefile.win32 aclocal.m4
CONFSRCS=config/[a-z]*

View File

@ -1,4 +1,4 @@
# $tcsh: Makefile.in,v 3.49 2011/02/05 17:35:31 christos Exp $
# $tcsh: Makefile.in,v 3.59 2015/08/24 20:09:04 kim Exp $
# Makefile.in 4.3 6/11/83
#
# C Shell with process control; VM/UNIX VAX Makefile
@ -315,8 +315,8 @@ CPP = @CPP@
# on the suns does not know how to make dynamically linked binaries.
# This is set by autoconf.
CC = @CC@
#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
# -ansi -pedantic
#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 -Wcast-qual -Wwrite-strings -Wold-style-definition -Wuninitialized -Wpointer-sign
# -Wconversion -Wformat=2 -ansi -pedantic
#CC= gcc -Wall -pipe -B/bin/
# Generate code for Intel 486 (linux)
#CC= gcc -m486 -pipe -Wall
@ -377,14 +377,14 @@ ASSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \
sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h \
tw.color.c
PSSRCS= sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
PSSRCS= sh.decls.h glob.c glob.h dotlock.c dotlock.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
vms.termcap.c
SHSRCS= ${ASSRCS} ${PSSRCS}
SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \
sh.char.${SUF} sh.exp.${SUF} sh.file.${SUF} sh.func.${SUF} \
sh.glob.${SUF} sh.hist.${SUF} sh.init.${SUF} sh.lex.${SUF} \
sh.misc.${SUF} sh.parse.${SUF} sh.print.${SUF} sh.proc.${SUF} \
sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} \
sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} dotlock.${SUF} \
mi.termios.${SUF} ma.setp.${SUF} vms.termcap.${SUF}
TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
@ -411,12 +411,12 @@ AVSRCS= Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
host.defs gethost.c tcsh.man2html configure.in configure config.h.in \
tests/testsuite.at
host.defs gethost.c tcsh.man2html configure.ac configure config.h.in \
tests/testsuite.at aclocal.m4
TESTFILES= tests/aliases.at tests/arguments.at tests/commands.at \
tests/expr.at tests/lexical.at tests/mb-eucjp.at \
tests/mb-utf8.at tests/noexec.at tests/syntax.at tests/subst.at \
tests/variables.at tests/sh.dol.at
tests/mb-utf8.at tests/noexec.at tests/parenthesis.at tests/syntax.at \
tests/subst.at tests/variables.at tests/sh.dol.at
VHSRCS=${PVSRCS} ${AVSRCS}
@ -533,11 +533,11 @@ tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
${CPP} $(CPPFLAGS) ${DFLAGS} ${EXTRAFLAGS} -D_h_tc_const\
$(srcdir)/tc.const.c | \
sed -n -e 's/^\(Char STR[a-zA-Z0-9_]*\) *\[ *\].*/extern \1[];/p' | \
sort >> $@.tmp
LC_COLLATE=C sort >> $@.tmp
@echo '#endif /* _h_tc_const */' >> $@.tmp
@if [ -f $@ ] && cmp -s $@.tmp $@; then echo $@ unchanged.; rm -f $@.tmp; else mv -f $@.tmp $@; echo $@ recreated.; fi
$(srcdir)/tests/package.m4: $(srcdir)/configure.in
$(srcdir)/tests/package.m4: $(srcdir)/configure.ac
{ \
echo '# Signature of the current package.'; \
echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
@ -594,12 +594,12 @@ vgrind:
@vgrind -t -x -h Index index >/crp/bill/csh/index.t
install-strip: install
-strip ${DESTBIN}/tcsh$(EXEEXT)
install: tcsh$(EXEEXT) install.catalogs install.man
-mkdir -p ${DESTBIN}
-mv -f ${DESTBIN}/tcsh$(EXEEXT) ${DESTBIN}/tcsh.old
cp tcsh$(EXEEXT) ${DESTBIN}/tcsh$(EXEEXT)
-strip ${DESTBIN}/tcsh$(EXEEXT)
chmod 755 ${DESTBIN}/tcsh$(EXEEXT)
install.catalogs:
@ -623,25 +623,6 @@ install.man: tcsh.man
# nroff -man tcsh.man | compress > ${DESTMAN}/tcsh.${MANSECT}.Z
# chmod 444 ${DESTMAN}/tcsh.${MANSECT}.Z
install.cygwin: install
-gzip ${DESTMAN}/tcsh.${MANSECT}
-mkdir -p ${DESTDIR}${prefix}/share/doc/tcsh
cp ${srcdir}/FAQ ${srcdir}/Fixes ${DESTDIR}${prefix}/share/doc/tcsh
cp ${srcdir}/NewThings ${srcdir}/README ${DESTDIR}${prefix}/share/doc/tcsh
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
-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
clean: clean.catalogs
${RM} -f a.out strings x.c xs.c tcsh$(EXEEXT) tcsh.a _MAKE_LOG gethost
${RM} -f *.${SUF} *.i *.s
@ -748,11 +729,11 @@ ftp: tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z
autoconfigure: $(srcdir)/configure $(srcdir)/config.h.in
$(srcdir)/configure: $(srcdir)/configure.in
$(srcdir)/configure: $(srcdir)/configure.ac
cd $(srcdir) && autoconf
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
$(srcdir)/stamp-h.in: $(srcdir)/configure.in
$(srcdir)/stamp-h.in: $(srcdir)/configure.ac
cd $(srcdir) && autoheader
@echo timestamp > $(srcdir)/stamp-h.in
@ -787,6 +768,9 @@ ${TWOBJS} ${TWINC}: ${TWH}
# glob.h
glob.${SUF} sh.glob.${SUF}: glob.h
# dotlock.h
dotlock.${SUF}: dotlock.h
# ed.defns.h
EDDINC=tc.bind.${SUF} tc.func.${SUF} tc.os.${SUF}
${EDOBJS} ${EDDINC}: ed.defns.h

View File

@ -1,4 +1,4 @@
# $tcsh: Makefile.std,v 1.97 2006/03/02 18:46:44 christos Exp $
# $tcsh: Makefile.std,v 1.100 2015/08/24 20:09:04 kim Exp $
# Makefile.std 4.3 6/11/83
#
# C Shell with process control; VM/UNIX VAX Makefile
@ -287,14 +287,14 @@ ASSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \
sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \
sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h
PSSRCS= sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
PSSRCS= sh.decls.h glob.c glob.h dotlock.c dotlock.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
vms.termcap.c
SHSRCS= ${ASSRCS} ${PSSRCS}
SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \
sh.char.${SUF} sh.exp.${SUF} sh.file.${SUF} sh.func.${SUF} \
sh.glob.${SUF} sh.hist.${SUF} sh.init.${SUF} sh.lex.${SUF} \
sh.misc.${SUF} sh.parse.${SUF} sh.print.${SUF} sh.proc.${SUF} \
sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} \
sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} dotlock.${SUF} \
mi.termios.${SUF} ma.setp.${SUF} vms.termcap.${SUF}
TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
@ -321,7 +321,8 @@ AVSRCS= Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
host.defs gethost.c tcsh.man2html configure.in configure config.h.in
host.defs gethost.c tcsh.man2html configure.ac configure config.h.in \
aclocal.m4
VHSRCS=${PVSRCS} ${AVSRCS}
@ -424,7 +425,7 @@ tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
${CPP} $(INCLUDES) ${DFLAGS} ${EXTRAFLAGS} -D_h_tc_const\
$(srcdir)/tc.const.c | grep 'Char STR' | \
sed -e 's/Char \([a-zA-Z0-9_]*\) *\[ *\].*/extern Char \1[];/' | \
sort >> $@
LC_COLLATE=C sort >> $@
@echo '#endif /* _h_tc_const */' >> $@
csh.prof: ${OBJS} sh.prof.${SUF} mcrt0.${SUF}
@ -584,11 +585,11 @@ ftp: tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z
autoconfigure: $(srcdir)/configure $(srcdir)/config.h.in
$(srcdir)/configure: $(srcdir)/configure.in
$(srcdir)/configure: $(srcdir)/configure.ac
cd $(srcdir) && autoconf
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
$(srcdir)/stamp-h.in: $(srcdir)/configure.in
$(srcdir)/stamp-h.in: $(srcdir)/configure.ac
cd $(srcdir) && autoheader
@echo timestamp > $(srcdir)/stamp-h.in
@ -620,6 +621,9 @@ ${TWOBJS} ${TWINC}: ${TWH}
# glob.h
glob.${SUF} sh.glob.${SUF}: glob.h
# dotlock.h
dotlock.${SUF}: dotlock.h
# ed.defns.h
EDDINC=tc.bind.${SUF} tc.func.${SUF} tc.os.${SUF}
${EDOBJS} ${EDDINC}: ed.defns.h

View File

@ -1,4 +1,4 @@
# $tcsh: Makefile.vms,v 1.39 2006/03/02 18:46:44 christos Exp $
# $tcsh: Makefile.vms,v 1.40 2014/07/07 20:34:58 christos Exp $
# Makefile.vms 4.3 6/11/83
#
# C Shell with process control; VM/UNIX VAX Makefile
@ -299,7 +299,7 @@ AVSRCS= Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
host.defs gethost.c tcsh.man2html configure.in
host.defs gethost.c tcsh.man2html configure.ac aclocal.m4
VHSRCS=${PVSRCS} ${AVSRCS}

View File

@ -1,4 +1,4 @@
This is tcsh version 6.18.01. Tcsh is a version of the Berkeley
This is tcsh version 6.20.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.

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,12 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
# Copyright 1992-2015 Free Software Foundation, Inc.
timestamp='2009-12-30'
timestamp='2015-03-04'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@ -17,26 +15,22 @@ timestamp='2009-12-30'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Per Bothner. Please send patches (context
# diff format) to <config-patches@gnu.org> and include a ChangeLog
# entry.
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
#
# Please send patches to <config-patches@gnu.org>.
me=`echo "$0" | sed -e 's,.*/,,'`
@ -56,9 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
Software Foundation, Inc.
Copyright 1992-2015 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."
@ -140,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_SYSTEM}" in
Linux|GNU|GNU/*)
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
LIBC=gnu
eval $set_cc_for_build
cat <<-EOF > $dummy.c
#include <features.h>
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
#else
LIBC=gnu
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
;;
esac
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
@ -155,20 +168,27 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || \
echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
earmv*)
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
machine=${arch}${endian}-unknown
;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE_ARCH}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
@ -181,7 +201,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
fi
;;
*)
os=netbsd
os=netbsd
;;
esac
# Determine ABI tags.
case "${UNAME_MACHINE_ARCH}" in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
;;
esac
# The OS release
@ -200,7 +227,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
echo "${machine}-${os}${release}${abi}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
@ -224,7 +255,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
@ -270,7 +301,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit ;;
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
exit $exitcode ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
@ -296,12 +330,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
echo powerpc-ibm-os400
echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
arm:riscos:*:*|arm:RISCOS:*:*)
arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@ -395,23 +429,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit ;;
echo m68k-milan-mint${UNAME_RELEASE}
exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit ;;
echo m68k-hades-mint${UNAME_RELEASE}
exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit ;;
echo m68k-unknown-mint${UNAME_RELEASE}
exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
@ -481,8 +515,8 @@ EOF
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@ -495,7 +529,7 @@ EOF
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit ;;
exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
@ -552,15 +586,16 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[456])
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
if [ -x /usr/bin/lslpp ] ; then
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
@ -595,52 +630,52 @@ EOF
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
esac ;;
esac
esac ;;
esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include <stdlib.h>
#include <unistd.h>
#define _HPUX_SOURCE
#include <stdlib.h>
#include <unistd.h>
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
@ -731,22 +766,22 @@ EOF
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit ;;
exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit ;;
exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit ;;
exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit ;;
exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
@ -770,14 +805,14 @@ EOF
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@ -789,30 +824,35 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
case ${UNAME_MACHINE} in
pc98)
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
*:MINGW64*:*)
echo ${UNAME_MACHINE}-pc-mingw64
exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
*:Interix*:*)
case ${UNAME_MACHINE} in
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
@ -849,15 +889,22 @@ EOF
exit ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
@ -867,52 +914,59 @@ EOF
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
echo crisv32-axis-linux-gnu
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
e2k:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
frv:Linux:*:*)
echo frv-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
@ -931,51 +985,63 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
or32:Linux:*:*)
echo or32-unknown-linux-gnu
openrisc*:Linux:*:*)
echo or1k-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:* | or1k*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
echo sparc-unknown-linux-${LIBC}
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
echo hppa64-unknown-linux-${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-gnu ;;
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
*) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
echo powerpc64-unknown-linux-${LIBC}
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
echo powerpc-unknown-linux-${LIBC}
exit ;;
ppc64le:Linux:*:*)
echo powerpc64le-unknown-linux-${LIBC}
exit ;;
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@ -984,11 +1050,11 @@ EOF
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
@ -1020,7 +1086,7 @@ EOF
fi
exit ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
@ -1048,13 +1114,13 @@ EOF
exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
@ -1089,8 +1155,8 @@ EOF
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
@ -1133,10 +1199,10 @@ EOF
echo ns32k-sni-sysv
fi
exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
@ -1162,11 +1228,11 @@ EOF
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit ;;
exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
@ -1179,6 +1245,9 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
x86_64:Haiku:*:*)
echo x86_64-unknown-haiku
exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@ -1205,19 +1274,31 @@ EOF
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
eval $set_cc_for_build
if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc
fi
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub
# that puts up a graphical alert prompting to install
# developer tools. Any system running Mac OS X 10.7 or
# later (Darwin 11 and later) is required to have a 64-bit
# processor. This is not true of the ARM version of Darwin
# that Apple uses in portable devices.
UNAME_PROCESSOR=x86_64
fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
@ -1231,7 +1312,10 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
NSE-?:NONSTOP_KERNEL:*:*)
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@ -1276,13 +1360,13 @@ EOF
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
@ -1300,159 +1384,11 @@ EOF
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include <sys/param.h>
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
c34*)
echo c34-convex-bsd
exit ;;
c38*)
echo c38-convex-bsd
exit ;;
c4*)
echo c4-convex-bsd
exit ;;
esac
fi
cat >&2 <<EOF
$0: unable to guess system type

View File

@ -1,4 +1,4 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to the type of elements in the array set by `getgroups'. Usually
this is either `int' or `gid_t'. */
@ -69,6 +69,9 @@
/* Define to 1 if you have the `mallinfo' function. */
#undef HAVE_MALLINFO
/* Define to 1 if you have the `mblen' function. */
#undef HAVE_MBLEN
/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
#undef HAVE_MBRTOWC

View File

@ -1,38 +1,31 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
# Copyright 1992-2013 Free Software Foundation, Inc.
timestamp='2009-12-31'
timestamp='2013-04-24'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted GNU ChangeLog entry.
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@ -75,9 +68,7 @@ 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, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
Software Foundation, Inc.
Copyright 1992-2013 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."
@ -124,13 +115,18 @@ 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* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | 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/'`
;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
@ -153,12 +149,12 @@ 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 | -knuth | -cray | -microblaze)
-apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
-bluegene*)
os=-cnk
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
@ -174,10 +170,10 @@ case $os in
os=-chorusos
basic_machine=$1
;;
-chorusrdb)
os=-chorusrdb
-chorusrdb)
os=-chorusrdb
basic_machine=$1
;;
;;
-hiux*)
os=-hiuxwe2
;;
@ -222,6 +218,12 @@ case $os in
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;;
-lynx*)
os=-lynxos
;;
@ -246,20 +248,27 @@ case $basic_machine in
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
| aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| be32 | be64 \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep | metag \
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@ -277,34 +286,45 @@ case $basic_machine in
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nios | nios2 \
| nds32 | nds32le | nds32be \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| or32 \
| open8 \
| or1k | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| rx \
| rl78 | rx \
| 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 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| spu \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12.
c54x)
basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@ -314,6 +334,21 @@ case $basic_machine in
basic_machine=mt-unknown
;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xgate)
basic_machine=$basic_machine-unknown
os=-none
;;
xscaleeb)
basic_machine=armeb-unknown
;;
xscaleel)
basic_machine=armel-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
@ -328,25 +363,30 @@ case $basic_machine in
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@ -364,29 +404,34 @@ case $basic_machine in
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nios-* | nios2-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
| romp-* | rs6000-* | rx-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| 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-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | vax-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-* | z80-*)
@ -411,7 +456,7 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
abacus)
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
@ -481,11 +526,20 @@ case $basic_machine in
basic_machine=powerpc-ibm
os=-cnk
;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
cegcc)
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
@ -517,7 +571,7 @@ case $basic_machine in
basic_machine=craynv-cray
os=-unicosmp
;;
cr16)
cr16 | cr16-*)
basic_machine=cr16-unknown
os=-elf
;;
@ -675,7 +729,6 @@ case $basic_machine in
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
@ -733,9 +786,13 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
microblaze)
microblaze*)
basic_machine=microblaze-xilinx
;;
mingw64)
basic_machine=x86_64-pc
os=-mingw64
;;
mingw32)
basic_machine=i386-pc
os=-mingw32
@ -772,10 +829,18 @@ case $basic_machine in
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=i386-pc
os=-msys
;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
nacl)
basic_machine=le32-unknown
os=-nacl
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
@ -840,6 +905,12 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@ -922,9 +993,10 @@ case $basic_machine in
;;
power) basic_machine=power-ibm
;;
ppc) basic_machine=powerpc-unknown
ppc | ppcbe) basic_machine=powerpc-unknown
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
@ -949,7 +1021,11 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
rdos)
rdos | rdos64)
basic_machine=x86_64-pc
os=-rdos
;;
rdos32)
basic_machine=i386-pc
os=-rdos
;;
@ -1018,6 +1094,9 @@ case $basic_machine in
basic_machine=i860-stratus
os=-sysv4
;;
strongarm-* | thumb-*)
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
sun2)
basic_machine=m68000-sun
;;
@ -1074,20 +1153,8 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
tic54x | c54x*)
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
basic_machine=$basic_machine-unknown
os=-linux-gnu
;;
tx39)
@ -1157,6 +1224,9 @@ case $basic_machine in
xps | xps100)
basic_machine=xps100-honeywell
;;
xscale-* | xscalee[bl]-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
;;
ymp)
basic_machine=ymp-cray
os=-unicos
@ -1254,11 +1324,11 @@ esac
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
-auroraux)
os=-auroraux
;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
@ -1282,20 +1352,21 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \
| -bitrig* | -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* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@ -1342,7 +1413,7 @@ case $os in
-opened*)
os=-openedition
;;
-os400*)
-os400*)
os=-os400
;;
-wince*)
@ -1391,7 +1462,7 @@ case $os in
-sinix*)
os=-sysv4
;;
-tpf*)
-tpf*)
os=-tpf
;;
-triton*)
@ -1427,17 +1498,14 @@ case $os in
-aros*)
os=-aros
;;
-kaos*)
os=-kaos
;;
-zvmoe)
os=-zvmoe
;;
-dicos*)
os=-dicos
;;
-nacl*)
;;
-nacl*)
;;
-none)
;;
*)
@ -1460,10 +1528,10 @@ else
# system, and we'll never get to this point.
case $basic_machine in
score-*)
score-*)
os=-elf
;;
spu-*)
spu-*)
os=-elf
;;
*-acorn)
@ -1475,8 +1543,20 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
c4x-* | tic4x-*)
os=-coff
;;
hexagon-*)
os=-elf
;;
tic54x-*)
os=-coff
;;
tic55x-*)
os=-coff
;;
tic6x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
@ -1496,14 +1576,11 @@ case $basic_machine in
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
m68*-cisco)
os=-aout
;;
mep-*)
mep-*)
os=-elf
;;
mips*-cisco)
@ -1512,6 +1589,9 @@ case $basic_machine in
mips*-*)
os=-elf
;;
or1k-*)
os=-elf
;;
or32-*)
os=-coff
;;
@ -1530,7 +1610,7 @@ case $basic_machine in
*-ibm)
os=-aix
;;
*-knuth)
*-knuth)
os=-mmixware
;;
*-wec)

View File

@ -98,6 +98,7 @@
#elif defined(__APPLE__)
# define SYSMALLOC
# define BSD_STYLE_COLORLS
#endif
#endif /* _h_config */

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/config_f.h,v 3.47 2011/02/05 20:34:55 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/config_f.h,v 3.52 2016/04/16 15:44:18 christos Exp $ */
/*
* config_f.h -- configure various defines for tcsh
*
@ -38,6 +38,10 @@
#ifndef _h_config_f
#define _h_config_f
#ifdef HAVE_FEATURES_H
#include <features.h> /* for __GLIBC__ */
#endif
/*
* SHORT_STRINGS Use at least 16 bit characters instead of 8 bit chars
* This fixes up quoting problems and eases implementation
@ -50,7 +54,7 @@
* WIDE_STRINGS Represent strings using wide characters
* Allows proper function in multibyte encodings like UTF-8
*/
#if defined (SHORT_STRINGS) && defined (NLS) && !defined (WINNT_NATIVE) && !defined(_OSD_POSIX)
#if defined (SHORT_STRINGS) && defined (NLS) && !defined (WINNT_NATIVE) && !defined(_OSD_POSIX) && SIZEOF_WCHAR_T > 1
# define WIDE_STRINGS
# if SIZEOF_WCHAR_T < 4
# define UTF16_STRINGS
@ -135,7 +139,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 (__CYGWIN__) || defined(__GLIBC__)
#if defined(__MACHTEN__) || defined(PURIFY) || defined(MALLOC_TRACE) || defined(_OSD_POSIX) || defined(__MVS__) || defined (__CYGWIN__) || defined(__GLIBC__) || defined(__OpenBSD__) || defined(__APPLE__) || defined (__ANDROID__)
# define SYSMALLOC
#else
# undef SYSMALLOC

418
contrib/tcsh/configure vendored
View File

@ -1,13 +1,11 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for tcsh 6.18.01.
# Generated by GNU Autoconf 2.69 for tcsh 6.20.00.
#
# Report bugs to <http://bugs.gw.com/>.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
# Foundation, Inc.
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
@ -136,6 +134,31 @@ export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# Use a proper internal environment variable to ensure we don't fall
# into an infinite loop, continuously re-executing ourselves.
if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
_as_can_reexec=no; export _as_can_reexec;
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
as_fn_exit 255
fi
# We don't want this to propagate to other subprocesses.
{ _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
@ -169,7 +192,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1"
test x\$exitcode = x0 || exit 1
test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@ -214,21 +238,25 @@ IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
export CONFIG_SHELL
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
export CONFIG_SHELL
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
if test x$as_have_required = xno; then :
@ -331,6 +359,14 @@ $as_echo X"$as_dir" |
} # as_fn_mkdir_p
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
@ -452,6 +488,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
# If we had to re-execute with $CONFIG_SHELL, we're ensured to have
# already done that, so ensure we don't try to do so again and fall
# in an infinite loop. This has already happened in practice.
_as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
@ -486,16 +526,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -p'.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -p'
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@ -507,28 +547,8 @@ else
as_mkdir_p=false
fi
if test -x / >/dev/null 2>&1; then
as_test_x='test -x'
else
if ls -dL / >/dev/null 2>&1; then
as_ls_L_option=L
else
as_ls_L_option=
fi
as_test_x='
eval sh -c '\''
if test -d "$1"; then
test -d "$1/.";
else
case $1 in #(
-*)set "./$1";;
esac;
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
fi
as_executable_p=$as_test_x
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@ -560,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='tcsh'
PACKAGE_TARNAME='tcsh'
PACKAGE_VERSION='6.18.01'
PACKAGE_STRING='tcsh 6.18.01'
PACKAGE_VERSION='6.20.00'
PACKAGE_STRING='tcsh 6.20.00'
PACKAGE_BUGREPORT='http://bugs.gw.com/'
PACKAGE_URL=''
@ -1145,8 +1165,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
$as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used" >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@ -1232,7 +1250,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures tcsh 6.18.01 to adapt to many kinds of systems.
\`configure' configures tcsh 6.20.00 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1297,7 +1315,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of tcsh 6.18.01:";;
short | recursive ) echo "Configuration of tcsh 6.20.00:";;
esac
cat <<\_ACEOF
@ -1312,7 +1330,7 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-gnu-ld assume the C compiler uses GNU ld default=no
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
--without-libiconv-prefix don't search for libiconv in includedir and libdir
--with-hesiod=PREFIX Use Hesiod lookup for ~ expansion
@ -1393,10 +1411,10 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
tcsh configure 6.18.01
generated by GNU Autoconf 2.68
tcsh configure 6.20.00
generated by GNU Autoconf 2.69
Copyright (C) 2010 Free Software Foundation, Inc.
Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
@ -1509,7 +1527,7 @@ $as_echo "$ac_try_echo"; } >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
test -x conftest$ac_exeext
}; then :
ac_retval=0
else
@ -1709,7 +1727,8 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) >= 0)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@ -1725,7 +1744,8 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@ -1751,7 +1771,8 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) < 0)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@ -1767,7 +1788,8 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) >= $ac_mid)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@ -1801,7 +1823,8 @@ int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@ -1948,7 +1971,8 @@ int
main ()
{
static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
test_array [0] = 0
test_array [0] = 0;
return test_array [0];
;
return 0;
@ -2150,8 +2174,8 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by tcsh $as_me 6.18.01, which was
generated by GNU Autoconf 2.68. Invocation command line was
It was created by tcsh $as_me 6.20.00, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2571,7 +2595,7 @@ case $as_dir/ in #((
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@ -2781,6 +2805,11 @@ case "${host}" in
tcsh_config_file=sysV88
;;
## Minix systems
*-*-minix*)
tcsh_config_file=minix
;;
## NetBSD systems
*-*-netbsd*)
tcsh_config_file=bsd4.4
@ -2801,6 +2830,11 @@ case "${host}" in
tcsh_config_file=bsd4.4
;;
## MirBSD systems
*-*-mirbsd*)
tcsh_config_file=bsd4.4
;;
## OpenBSD systems
*-*-openbsd*)
tcsh_config_file=bsd4.4
@ -2975,7 +3009,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@ -3015,7 +3049,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@ -3068,7 +3102,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@ -3109,7 +3143,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@ -3167,7 +3201,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@ -3211,7 +3245,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@ -3657,8 +3691,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@ -3898,7 +3931,7 @@ do
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
{ test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
@ -3964,7 +3997,7 @@ do
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
{ test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
@ -4073,7 +4106,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_GENCAT="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@ -4108,6 +4141,13 @@ if test "x$GCC" != xyes ; then
CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
fi
case "${host}" in
*-*-android*)
CFLAGS="${CFLAGS} -fPIE"
LDFLAGS="${LDFLAGS} -pie"
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing crypt" >&5
$as_echo_n "checking for library containing crypt... " >&6; }
if ${ac_cv_search_crypt+:} false; then :
@ -4274,6 +4314,10 @@ ac_res=$ac_cv_search_tgetent
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
else
as_fn_error $? "unable to find the tgetent() function" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5
@ -4461,6 +4505,7 @@ fi
prefix="$acl_save_prefix"
# Check whether --with-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then :
withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
@ -4471,21 +4516,21 @@ fi
# Prepare PATH_SEPARATOR.
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
# Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
# contains only /bin. Note that ksh looks also at the FPATH variable,
# so we have to set that as well for the test.
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
&& { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
|| PATH_SEPARATOR=';'
}
fi
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
$as_echo_n "checking for ld used by GCC... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
$as_echo_n "checking for ld used by $CC... " >&6; }
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@ -4495,11 +4540,11 @@ $as_echo_n "checking for ld used by GCC... " >&6; }
esac
case $ac_prog in
# Accept absolute paths.
[\\/]* | [A-Za-z]:[\\/]*)
[\\/]* | ?:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
# Canonicalize the path of ld
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
# Canonicalize the pathname of ld
ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
@ -4524,23 +4569,26 @@ if ${acl_cv_path_LD+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
for ac_dir in $PATH; do
IFS="$acl_save_ifs"
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
acl_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# but apparently some variants of GNU ld only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
test "$with_gnu_ld" != no && break ;;
test "$with_gnu_ld" != no && break
;;
*)
test "$with_gnu_ld" != yes && break ;;
test "$with_gnu_ld" != yes && break
;;
esac
fi
done
IFS="$ac_save_ifs"
IFS="$acl_save_ifs"
else
acl_cv_path_LD="$LD" # Let the user override the test with a path.
fi
@ -4560,12 +4608,14 @@ $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
if ${acl_cv_prog_gnu_ld+:} false; then :
$as_echo_n "(cached) " >&6
else
# I'd rather use --version here, but apparently some GNU ld's only accept -v.
# I'd rather use --version here, but apparently some GNU lds only accept -v.
case `$LD -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
acl_cv_prog_gnu_ld=yes ;;
acl_cv_prog_gnu_ld=yes
;;
*)
acl_cv_prog_gnu_ld=no ;;
acl_cv_prog_gnu_ld=no
;;
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
@ -4748,7 +4798,7 @@ fi
done
if test -z "$already_handled"; then
names_already_handled="$names_already_handled $name"
uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
eval value=\"\$HAVE_LIB$uppername\"
if test -n "$value"; then
if test "$value" = yes; then
@ -5176,14 +5226,16 @@ else
am_cv_lib_iconv=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#include <iconv.h>
int
main ()
{
iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);
;
return 0;
}
@ -5198,14 +5250,16 @@ rm -f core conftest.err conftest.$ac_objext \
LIBS="$LIBS $LIBICONV"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#include <iconv.h>
int
main ()
{
iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);
;
return 0;
}
@ -5229,40 +5283,50 @@ if ${am_cv_func_iconv_works+:} false; then :
$as_echo_n "(cached) " >&6
else
am_save_LIBS="$LIBS"
am_save_LIBS="$LIBS"
if test $am_cv_lib_iconv = yes; then
LIBS="$LIBS $LIBICONV"
fi
if test "$cross_compiling" = yes; then :
am_cv_func_iconv_works=no
for ac_iconv_const in '' 'const'; do
if test "$cross_compiling" = yes; then :
case "$host_os" in
aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
*) am_cv_func_iconv_works="guessing yes" ;;
esac
aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
*) am_cv_func_iconv_works="guessing yes" ;;
esac
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <iconv.h>
#include <string.h>
int main ()
#ifndef ICONV_CONST
# define ICONV_CONST $ac_iconv_const
#endif
int
main ()
{
int result = 0;
/* Test against AIX 5.1 bug: Failures are not distinguishable from successful
returns. */
{
iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
if (cd_utf8_to_88591 != (iconv_t)(-1))
{
static const char input[] = "\342\202\254"; /* EURO SIGN */
static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
char buf[10];
const char *inptr = input;
ICONV_CONST char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_utf8_to_88591,
(char **) &inptr, &inbytesleft,
&inptr, &inbytesleft,
&outptr, &outbytesleft);
if (res == 0)
return 1;
result |= 1;
iconv_close (cd_utf8_to_88591);
}
}
/* Test against Solaris 10 bug: Failures are not distinguishable from
@ -5271,17 +5335,37 @@ int main ()
iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
if (cd_ascii_to_88591 != (iconv_t)(-1))
{
static const char input[] = "\263";
static ICONV_CONST char input[] = "\263";
char buf[10];
const char *inptr = input;
ICONV_CONST char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_ascii_to_88591,
(char **) &inptr, &inbytesleft,
&inptr, &inbytesleft,
&outptr, &outbytesleft);
if (res == 0)
return 1;
result |= 2;
iconv_close (cd_ascii_to_88591);
}
}
/* Test against AIX 6.1..7.1 bug: Buffer overrun. */
{
iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
if (cd_88591_to_utf8 != (iconv_t)(-1))
{
static ICONV_CONST char input[] = "\304";
static char buf[2] = { (char)0xDE, (char)0xAD };
ICONV_CONST char *inptr = input;
size_t inbytesleft = 1;
char *outptr = buf;
size_t outbytesleft = 1;
size_t res = iconv (cd_88591_to_utf8,
&inptr, &inbytesleft,
&outptr, &outbytesleft);
if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
result |= 4;
iconv_close (cd_88591_to_utf8);
}
}
#if 0 /* This bug could be worked around by the caller. */
@ -5290,17 +5374,18 @@ int main ()
iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
if (cd_88591_to_utf8 != (iconv_t)(-1))
{
static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
char buf[50];
const char *inptr = input;
ICONV_CONST char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_88591_to_utf8,
(char **) &inptr, &inbytesleft,
&inptr, &inbytesleft,
&outptr, &outbytesleft);
if ((int)res > 0)
return 1;
result |= 8;
iconv_close (cd_88591_to_utf8);
}
}
#endif
@ -5314,19 +5399,22 @@ int main ()
&& iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
/* Try HP-UX names. */
&& iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
return 1;
result |= 16;
return result;
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
am_cv_func_iconv_works=yes
else
am_cv_func_iconv_works=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
test "$am_cv_func_iconv_works" = no || break
done
LIBS="$am_save_LIBS"
fi
@ -5373,7 +5461,7 @@ extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
@ -5406,6 +5494,7 @@ cat >>confdefs.h <<_ACEOF
#define ICONV_CONST $am_cv_proto_iconv_arg1
_ACEOF
fi
@ -6303,11 +6392,11 @@ else
int
main ()
{
/* FIXME: Include the comments suggested by Paul. */
#ifndef __cplusplus
/* Ultrix mips cc rejects this. */
/* Ultrix mips cc rejects this sort of thing. */
typedef int charset[2];
const charset cs;
const charset cs = { 0, 0 };
/* SunOS 4.1.1 cc rejects this. */
char const *const *pcpcc;
char **ppc;
@ -6324,8 +6413,9 @@ main ()
++pcpcc;
ppc = (char**) pcpcc;
pcpcc = (char const *const *) ppc;
{ /* SCO 3.2v4 cc rejects this. */
char *t;
{ /* SCO 3.2v4 cc rejects this sort of thing. */
char tx;
char *t = &tx;
char const *s = 0 ? (char *) 0 : (char const *) 0;
*t++ = 0;
@ -6341,10 +6431,10 @@ main ()
iptr p = 0;
++p;
}
{ /* AIX XL C 1.02.0.0 rejects this saying
{ /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
"k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
struct s { int j; const int *ap[3]; };
struct s *b; b->j = 5;
struct s { int j; const int *ap[3]; } bx;
struct s *b = &bx; b->j = 5;
}
{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
const int foo = 10;
@ -6486,7 +6576,7 @@ else
have_catgets=no
fi
for ac_func in dup2 getauthid getcwd gethostname getpwent getutent getutxent mallinfo memmove memset mkstemp nice nl_langinfo sbrk setpgid setpriority strerror strstr sysconf wcwidth
for ac_func in dup2 getauthid getcwd gethostname getpwent getutent getutxent mallinfo mblen memmove memset mkstemp nice nl_langinfo sbrk setpgid setpriority strerror strstr sysconf wcwidth
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@ -7161,16 +7251,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -p'.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -p'
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@ -7230,28 +7320,16 @@ else
as_mkdir_p=false
fi
if test -x / >/dev/null 2>&1; then
as_test_x='test -x'
else
if ls -dL / >/dev/null 2>&1; then
as_ls_L_option=L
else
as_ls_L_option=
fi
as_test_x='
eval sh -c '\''
if test -d "$1"; then
test -d "$1/.";
else
case $1 in #(
-*)set "./$1";;
esac;
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
fi
as_executable_p=$as_test_x
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@ -7272,8 +7350,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by tcsh $as_me 6.18.01, which was
generated by GNU Autoconf 2.68. Invocation command line was
This file was extended by tcsh $as_me 6.20.00, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@ -7338,11 +7416,11 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
tcsh config.status 6.18.01
configured by $0, generated by GNU Autoconf 2.68,
tcsh config.status 6.20.00
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Copyright (C) 2010 Free Software Foundation, Inc.
Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@ -7431,7 +7509,7 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
@ -8027,7 +8105,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
"./atconfig":C) cat >./atconfig <<ATEOF
# Configurable variable values for building test suites.
# Generated by $0.
# Copyright (C) 2010 Free Software Foundation, Inc.
# Copyright (C) 2012 Free Software Foundation, Inc.
# The test suite will define top_srcdir=$at_top_srcdir/../.. etc.
at_testdir='.'

View File

@ -1,485 +0,0 @@
dnl Autoconf script for tcsh
dnl To rebuild the `configure' script from this, execute the command
dnl autoconf
dnl in the directory containing this script.
dnl
dnl You'll also need a version of config.guess from a gnu package
dnl
dnl Written by Kaveh Ghazi (ghazi@caip.rutgers.edu) 5/11/96.
dnl
dnl $tcsh: configure.in,v 3.99 2012/02/13 16:33:50 christos Exp $
AC_PREREQ([2.59])dnl Minimum Autoconf version required.
AC_INIT([tcsh], [6.18.01], [http://bugs.gw.com/])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([tc.vers.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_TESTDIR([.], [.])
AC_PROG_INSTALL
AC_CANONICAL_HOST
AC_MSG_CHECKING([cached host tuple])
if { test x"${ac_cv_host_system_type+set}" = x"set" &&
test x"$ac_cv_host_system_type" != x"$host"; }; then
AC_MSG_RESULT([different])
AC_MSG_ERROR([remove config.cache and re-run configure])
else
AC_MSG_RESULT(ok)
fi
ac_cv_host_system_type="$host"
changequote(, )dnl
case "${host}" in
## Alpha (DEC) machines.
alpha*-dec-osf* )
tcsh_config_file=decosf1
;;
## Ultrix
*-dec-ultrix* )
tcsh_config_file=ultrix
;;
## DGUX
*-dg-dguxR4* )
tcsh_config_file=dgux5.4
;;
m88k-dg-dgux5.4R* )
tcsh_config_file=dgux5.4
;;
## HP/UX
*-hp-hpux7* )
tcsh_config_file=hpux7
;;
*-hp-hpux[89]* )
tcsh_config_file=hpux8
;;
*-hp-hpux1[0-9]* )
tcsh_config_file=hpux11
;;
## IBM AIX systems
*-ibm-aix*)
tcsh_config_file=aix
;;
## SX-4
sx4-nec-*)
CC='cc -h0,ansi,novector,float0'
LDFLAGS='-Gsmall'
tcsh_config_file=superux8
;;
## IBM OS/390 systems
*-ibm-os390*)
CC='c89'
tcsh_config_file=os390
;;
## Android
*-*-android*)
tcsh_config_file=android
;;
## Linux
*-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
tcsh_config_file=linux
;;
## Motorola systems
m68k-motorola-sysv* )
tcsh_config_file=sysV68
;;
m88k-motorola-sysv3* )
tcsh_config_file=sysV88
;;
## NetBSD systems
*-*-netbsd*)
tcsh_config_file=bsd4.4
;;
## FreeBSD systems
*-*-freebsd*)
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
;;
## BSDI systems
*-*-bsdi*)
tcsh_config_file=bsd4.4
;;
## Mac OS X Server
*-*-rhapsody* )
tcsh_config_file=bsd4.4
;;
## Mac OS X Server
*-*-darwin* )
tcsh_config_file=bsd4.4
;;
## DragonFly systems
*-*-dragonfly*)
tcsh_config_file=bsd4.4
;;
## Silicon Graphics machines
*-sgi-iri* )
tcsh_config_file=irix
case "${host_os}" in
irix[34]*) # Irix-3.x - Irix 4.x
NON_GNU_DFLAGS='-D__STDC__'
LIBS='-lsun -lbsd -lc_s'
;;
irix5* | irix6.[01]*) # Irix 5.x, Irix 6.0 - 6.1
LIBS='-lbsd'
;;
irix6.[2-9]*) # Irix 6.2 and later
tcsh_config_file=irix62
;;
esac
;;
## Suns
*-sun-sunos3* )
tcsh_config_file=sunos35
;;
*-sun-sunos4.0* )
tcsh_config_file=sunos40
;;
*-sun-sunos4.1.[12]* )
tcsh_config_file=sunos41
;;
*-sun-sunos4.1.[3456]* )
tcsh_config_file=sunos413
;;
*-*-solaris2.[01] ) # Should handle sparc or x86
tcsh_config_file=sol2
;;
*-sun-solaris2.2 ) # Sparc only release
tcsh_config_file=sol22
;;
*-sun-solaris2.3 ) # Sparc only release
tcsh_config_file=sol23
;;
*-*-solaris2.[45] ) # Should handle sparc, x86 and powerpc
tcsh_config_file=sol24
;;
*-*-solaris2.[678] ) # Should handle sparc, x86 and powerpc
tcsh_config_file=sol26
;;
*-*-solaris2.* ) # Should handle sparc, x86 and powerpc
tcsh_config_file=sol29
;;
## Dell SVR4
*-dell-sysv4* )
tcsh_config_file=sysv4
DFLAGS="$DFLAGS -DDELL"
;;
## SVR4 (Generic and otherwise)
*-*-sysv4* )
tcsh_config_file=sysv4
;;
## Tektronix systems
m68k-tektronix-bsd* )
tcsh_config_file=bsd
NON_GNU_DFLAGS='-DBSD -DUTek'
;;
m88k-tektronix-sysv3* )
tcsh_config_file=tekXD88
;;
## SCO
*-sco3.2v5*)
tcsh_config_file=sco32v5
;;
*-sco3.2v4*)
tcsh_config_file=sco32v4
;;
*-sco3.2v2*)
tcsh_config_file=sco32v2
;;
## Siemens BS2000 Mainframe
bs2000-siemens-*)
tcsh_config_file=bs2000
;;
## Convex
*-convex*)
tcsh_config_file=convex
;;
## Cray
*-cray-unicos*)
tcsh_config_file=cray
;;
## Red Hat Cygwin
*-cygwin)
tcsh_config_file=cygwin
;;
## mips-compaq-nonstopux
*-*-nonstopux)
tcsh_config_file=sysv4
;;
## Apollo Domain/OS
*-apollo-*)
tcsh_config_file=apollo
;;
## QNX6
*-qnx6*)
tcsh_config_file=qnx6
;;
* )
changequote([, ])dnl
AC_MSG_ERROR([Tcsh can't guess the configuration file name
for `${host}' systems.
Check tcsh's `Ported' file for manual configuration instructions.])
changequote(, )dnl
;;
esac
echo "Tcsh will use configuration file \`$tcsh_config_file'."
changequote([, ])dnl
cp ${srcdir}/config/${tcsh_config_file} config_p.h
AH_BOTTOM(
[#include "config_p.h"
#include "config_f.h"])
dnl Checks for programs
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
AC_PATH_PROG([GENCAT], [gencat])
dnl Require build CC to create gethost helper when cross building
if test "x${cross_compiling}" = xyes ; then
CC_FOR_GETHOST="cc"
else
CC_FOR_GETHOST="\$(CC)"
fi
AC_SUBST(CC_FOR_GETHOST)
if test "x$GCC" != xyes ; then
DFLAGS="$DFLAGS $NON_GNU_DFLAGS"
CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
fi
dnl Checks for libraries
AC_SEARCH_LIBS(crypt, crypt)
AC_SEARCH_LIBS(getspnam, sec)
AC_SEARCH_LIBS(tgetent, termlib termcap curses ncurses)
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(connect, socket)
AC_SEARCH_LIBS(catgets, catgets)
AM_ICONV
dnl Checks for header files
AC_CHECK_HEADERS([auth.h crypt.h features.h inttypes.h paths.h] dnl
[shadow.h stdint.h utmp.h utmpx.h])
AC_CHECK_HEADERS([wchar.h],
[AC_CHECK_SIZEOF([wchar_t], [], [dnl
#include <stdio.h>
#include <wchar.h>])
AC_CHECK_HEADERS([wctype.h])])
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_HEADER_STDC
dnl Checks for types
AC_CHECK_TYPES([long long])
AC_TYPE_GETGROUPS
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_TYPE_UINT32_T
AC_DEFUN([AC_TYPE_SSIZE_T], [
AC_CHECK_TYPE(ssize_t,,
AC_DEFINE(ssize_t, int, [Define to `int' not defined in <sys/types.h>.]),
[
#include <sys/types.h>
])
])
AC_TYPE_SSIZE_T
AC_DEFUN([AC_TYPE_SOCKLEN_T], [
AC_CHECK_TYPE(socklen_t,,
AC_DEFINE(socklen_t, int, [Define to `int' if neither <sys/types.h> nor <sys/socket.h> define.]),
[
#include <sys/types.h>
#include <sys/socket.h>
])
])
AC_TYPE_SOCKLEN_T
dnl Checks for structures
AC_CHECK_MEMBERS([struct dirent.d_ino], , ,
[#ifdef HAVE_DIRENT_H
# include <dirent.h>
#else
# ifdef HAVE_NDIR_H
# include <ndir.h>
# else
# include <sys/dir.h>
# endif
# define dirent direct
#endif])
AC_CHECK_MEMBERS([struct utmp.ut_host, struct utmp.ut_user, struct utmp.ut_tv,
struct utmp.ut_xtime, struct utmpx.ut_host,
struct utmpx.ut_user, struct utmpx.ut_tv,
struct utmpx.ut_xtime], , ,
[#include <sys/types.h>
#ifdef HAVE_UTMPX_H
#include <utmpx.h>
#define utmp utmpx
#elif defined HAVE_UTMP_H
#include <utmp.h>
#endif])
AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], , ,
[#include <sys/types.h>
#include <sys/socket.h>])
dnl Checks for compiler characteristics
AC_C_CONST
AC_C_VOLATILE
dnl checks for library functions
AC_CHECK_DECLS([crypt, environ, gethostname, getpgrp], , ,
[#include "config_p.h"
AC_INCLUDES_DEFAULT([])
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#endif
])
AC_CHECK_FUNC([setlocale], [have_setlocale=yes], [have_setlocale=no])
AC_CHECK_FUNC([catgets], [have_catgets=yes], [have_catgets=no])
AC_CHECK_FUNCS([dup2 getauthid getcwd gethostname getpwent] dnl
[getutent getutxent mallinfo memmove memset mkstemp nice] dnl
[nl_langinfo sbrk setpgid setpriority strerror strstr sysconf wcwidth])
AC_FUNC_GETPGRP
AC_FUNC_MBRTOWC
if test "x${cross_compiling}" != xyes ; then
AC_FUNC_SETPGRP
else
ac_cv_func_setpgrp_void=yes
fi
AC_FUNC_STRCOLL
dnl This is not good enough; we need sockaddr_storage too.
dnl See whether we can use IPv6 related functions
dnl AC_DEFUN([IPv6_CHECK_FUNC], [
dnl changequote(, )dnl
dnl ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
dnl -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
dnl changequote([, ])dnl
dnl AC_CHECK_FUNC($1, [dnl
dnl AC_DEFINE_UNQUOTED($ac_tr_lib)
dnl ac_cv_lib_inet6_$1=no], [dnl
dnl AC_MSG_CHECKING([whether your system has IPv6 directory])
dnl AC_CACHE_VAL(ipv6_cv_dir, [dnl
dnl for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
dnl if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
dnl break
dnl fi
dnl done])dnl
dnl AC_MSG_RESULT($ipv6_cv_dir)
dnl if test $ipv6_cv_dir = no; then
dnl ac_cv_lib_inet6_$1=no
dnl else
dnl if test x$ipv6_libinet6 = x; then
dnl ipv6_libinet6=no
dnl SAVELDFLAGS="$LDFLAGS"
dnl LDFLAGS="-L$ipv6_cv_dir/lib"
dnl fi
dnl AC_CHECK_LIB(inet6, $1, [dnl
dnl AC_DEFINE_UNQUOTED($ac_tr_lib)
dnl if test $ipv6_libinet6 = no; then
dnl ipv6_libinet6=yes
dnl LIBS="$LIBS -linet6"
dnl fi],)dnl
dnl if test $ipv6_libinet6 = no; then
dnl LDFLAGS="$SAVELDFLAGS"
dnl fi
dnl fi])dnl
dnl if test $ac_cv_func_$1 = yes -o $ac_cv_lib_inet6_$1 = yes
dnl then
dnl ipv6_cv_$1=yes
dnl ifelse([$2], , :, [$2])
dnl else
dnl ipv6_cv_$1=no
dnl ifelse([$3], , :, [$3])
dnl fi])
dnl IPv6_CHECK_FUNC(getnameinfo, DFLAGS="$DFLAGS -DINET6")
AC_SUBST(DFLAGS)
dnl Checks for system services
if test "$have_setlocale" != no; then
AC_ARG_ENABLE([nls], AS_HELP_STRING([--disable-nls], [Disable NLS support]),
[], [enable_nls=yes])
if test "x$enable_nls" != xno; then
AC_DEFINE([NLS], [1], [Support NLS.])
fi
fi
if test "x$enable_nls" != xno -a "$have_catgets" != no -a -n "$GENCAT" ; then
AC_ARG_ENABLE([nls-catalogs], AS_HELP_STRING([--disable-nls-catalogs], [Disable NLS catalog support]),
[], [enable_nls_catalogs=yes])
if test "x$enable_nls_catalogs" != xno; then
BUILD_CATALOGS="yes"
AC_DEFINE([NLS_CATALOGS], [1], [Support NLS catalogs.])
fi
fi
AC_ARG_WITH(hesiod,
[ --with-hesiod=PREFIX Use Hesiod lookup for ~ expansion],
[hesiod="$withval"], [hesiod=no])
if test "$hesiod" != no; then
HESLIB="-lhesiod"
AC_CHECK_FUNC(res_send, :,
AC_CHECK_LIB(resolv, res_send, HESLIB="$HESLIB -lresolv"))
HESDEF=-DHESIOD
if test "$hesiod" != yes; then
HESDEF="$HESDEF -I$hesiod/include"
HESLIB="-L$hesiod/lib $HESLIB"
fi
fi
AC_SUBST(HESDEF)
AC_SUBST(HESLIB)
AC_SUBST(BUILD_CATALOGS)
AC_CONFIG_FILES([Makefile nls/Makefile])
AC_OUTPUT

180
contrib/tcsh/dotlock.c Normal file
View File

@ -0,0 +1,180 @@
/* $NetBSD: dotlock.c,v 1.11 2009/10/21 01:07:46 snj Exp $ */
/*
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "sh.h"
RCSID("$tcsh: dotlock.c,v 3.4 2015/11/03 21:04:13 christos Exp $")
#include <stdio.h>
#ifndef O_SYNC
#define O_SYNC 0
#endif
#include "dotlock.h"
static int create_exclusive(const char *);
/*
* Create a unique file. O_EXCL does not really work over NFS so we follow
* the following trick: [Inspired by S.R. van den Berg]
*
* - make a mostly unique filename and try to create it.
* - link the unique filename to our target
* - get the link count of the target
* - unlink the mostly unique filename
* - if the link count was 2, then we are ok; else we've failed.
*/
static int
create_exclusive(const char *fname)
{
char path[MAXPATHLEN], hostname[MAXHOSTNAMELEN + 1];
const char *ptr;
struct timeval tv;
pid_t pid;
size_t ntries, cookie;
int fd, serrno;
struct stat st;
(void)gettimeofday(&tv, NULL);
(void)gethostname(hostname, sizeof(hostname));
hostname[sizeof(hostname) - 1] = '\0';
pid = getpid();
cookie = pid ^ tv.tv_usec;
/*
* We generate a semi-unique filename, from hostname.(pid ^ usec)
*/
if ((ptr = strrchr(fname, '/')) == NULL)
ptr = fname;
else
ptr++;
(void)snprintf(path, sizeof(path), "%.*s.%s.%lx",
(int)(ptr - fname), fname, hostname, (u_long)cookie);
/*
* We try to create the unique filename.
*/
for (ntries = 0; ntries < 5; ntries++) {
fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_SYNC, 0);
if (fd != -1) {
(void)close(fd);
break;
}
else if (errno == EEXIST)
continue;
else
return -1;
}
/*
* We link the path to the name
*/
if (link(path, fname) == -1)
goto bad;
/*
* Note that we stat our own exclusively created name, not the
* destination, since the destination can be affected by others.
*/
if (stat(path, &st) == -1)
goto bad;
(void)unlink(path);
/*
* If the number of links was two (one for the unique file and one
* for the lock), we've won the race
*/
if (st.st_nlink != 2) {
errno = EEXIST;
return -1;
}
return 0;
bad:
serrno = errno;
(void)unlink(path);
errno = serrno;
return -1;
}
/*
* fname -- Pathname to lock
* pollinterval -- Interval (miliseconds) to check for lock, -1 return
*/
int
dot_lock(const char *fname, int pollinterval)
{
char path[MAXPATHLEN];
sigset_t nset, oset;
int retval;
(void)sigemptyset(&nset);
(void)sigaddset(&nset, SIGHUP);
(void)sigaddset(&nset, SIGINT);
(void)sigaddset(&nset, SIGQUIT);
(void)sigaddset(&nset, SIGTERM);
(void)sigaddset(&nset, SIGTTIN);
(void)sigaddset(&nset, SIGTTOU);
(void)sigaddset(&nset, SIGTSTP);
(void)sigaddset(&nset, SIGCHLD);
(void)snprintf(path, sizeof(path), "%s.lock", fname);
retval = -1;
for (;;) {
handle_pending_signals();
(void)sigprocmask(SIG_BLOCK, &nset, &oset);
if (create_exclusive(path) != -1) {
(void)sigprocmask(SIG_SETMASK, &oset, NULL);
retval = 0;
break;
}
else
(void)sigprocmask(SIG_SETMASK, &oset, NULL);
if (errno != EEXIST)
break;
if (pollinterval) {
if (pollinterval == -1) {
errno = EEXIST;
break;
}
(void)usleep((unsigned int)pollinterval * 1000);
}
}
handle_pending_signals();
return retval;
}
void
dot_unlock(const char *fname)
{
char path[MAXPATHLEN];
(void)snprintf(path, sizeof(path), "%s.lock", fname);
(void)unlink(path);
}

35
contrib/tcsh/dotlock.h Normal file
View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _DOTLOCK_H_
#define _DOTLOCK_H_ 1
/*
* fname -- Pathname to lock
* pollinterval -- Interval (miliseconds) to check for lock, -1 return
*/
int dot_lock(const char *fname, int pollinterval);
void dot_unlock(const char *fname);
#endif /* #ifndef _DOTLOCK_H_ */

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/ed.chared.c,v 3.98 2010/05/08 00:37:39 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.chared.c,v 3.103 2015/08/19 14:29:55 christos Exp $ */
/*
* ed.chared.c: Character editing functions.
*/
@ -72,7 +72,7 @@
#include "sh.h"
RCSID("$tcsh: ed.chared.c,v 3.98 2010/05/08 00:37:39 christos Exp $")
RCSID("$tcsh: ed.chared.c,v 3.103 2015/08/19 14:29:55 christos Exp $")
#include "ed.h"
#include "tw.h"
@ -93,7 +93,7 @@ RCSID("$tcsh: ed.chared.c,v 3.98 2010/05/08 00:37:39 christos Exp $")
* from: Gert-Jan Vons <vons@cesar.crbca1.sinet.slb.com>
*/
#define C_CLASS_WHITE 1
#define C_CLASS_ALNUM 2
#define C_CLASS_WORD 2
#define C_CLASS_OTHER 3
static Char *InsertPos = InputBuf; /* Where insertion starts */
@ -290,7 +290,7 @@ c_preword(Char *p, Char *low, int n, Char *delim)
/*
* c_to_class() returns the class of the given character.
*
* This is used to make the c_prev_word() and c_next_word() functions
* This is used to make the c_prev_word(), c_next_word() and c_eword() functions
* work like vi's, which classify characters. A word is a sequence of
* characters belonging to the same class, classes being defined as
* follows:
@ -305,8 +305,8 @@ c_to_class(Char ch)
if (Isspace(ch))
return C_CLASS_WHITE;
if (Isdigit(ch) || Isalpha(ch) || ch == '_')
return C_CLASS_ALNUM;
if (isword(ch))
return C_CLASS_WORD;
return C_CLASS_OTHER;
}
@ -828,15 +828,24 @@ c_eword(Char *p, Char *high, int n)
p++;
while (n--) {
while ((p < high) && Isspace(*p))
p++;
int c_class;
if (isword(*p))
while ((p < high) && isword(*p))
p++;
else
while ((p < high) && !(Isspace(*p) || isword(*p)))
p++;
if (p >= high)
break;
/* scan until end of current word (may be all whitespace!) */
c_class = c_to_class(*p);
while ((p < high) && c_class == c_to_class(*p))
p++;
/* if this was a non_whitespace word, we're ready */
if (c_class != C_CLASS_WHITE)
continue;
/* otherwise, move to the end of the word just found */
c_class = c_to_class(*p);
while ((p < high) && c_class == c_to_class(*p))
p++;
}
p--;
@ -941,7 +950,7 @@ c_push_kill(Char *start, Char *end)
/* Save InputBuf etc in SavedBuf etc for restore after cmd exec */
static void
c_save_inputbuf()
c_save_inputbuf(void)
{
SavedBuf.len = 0;
Strbuf_append(&SavedBuf, InputBuf);
@ -953,7 +962,7 @@ c_save_inputbuf()
}
CCRETVAL
GetHistLine()
GetHistLine(void)
{
struct Hist *hp;
int h;
@ -3025,7 +3034,7 @@ e_uppercase(Char c)
/*ARGSUSED*/
CCRETVAL
e_capitolcase(Char c)
e_capitalcase(Char c)
{
Char *cp, *end;
@ -3387,7 +3396,7 @@ e_stuff_char(Char c)
(void) Cookedmode();
(void) xwrite(SHIN, "\n", 1);
len = one_wctomb(buf, c & CHAR);
len = one_wctomb(buf, c);
for (i = 0; i < len; i++)
(void) ioctl(SHIN, TIOCSTI, (ioctl_t) &buf[i]);

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/ed.decls.h,v 3.45 2008/10/17 20:25:00 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.decls.h,v 3.46 2015/08/19 14:29:55 christos Exp $ */
/*
* ed.decls.h: Editor external definitions
*/
@ -142,7 +142,7 @@ extern CCRETVAL e_wordfwd (Char);
extern CCRETVAL v_wordbegnext (Char);
extern CCRETVAL e_uppercase (Char);
extern CCRETVAL e_lowercase (Char);
extern CCRETVAL e_capitolcase (Char);
extern CCRETVAL e_capitalcase (Char);
extern CCRETVAL e_cleardisp (Char);
extern CCRETVAL e_complete (Char);
extern CCRETVAL e_correct (Char);

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/ed.defns.c,v 3.46 2006/03/02 18:46:44 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.defns.c,v 3.51 2016/02/14 15:44:18 christos Exp $ */
/*
* ed.defns.c: Editor function definitions and initialization
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: ed.defns.c,v 3.46 2006/03/02 18:46:44 christos Exp $")
RCSID("$tcsh: ed.defns.c,v 3.51 2016/02/14 15:44:18 christos Exp $")
#include "ed.h"
@ -151,7 +151,7 @@ PFCmd CcFuncTbl[] = { /* table of available commands */
#define F_CASEUPPER 54
e_lowercase,
#define F_CASELOWER 55
e_capitolcase,
e_capitalcase,
#define F_CASECAPITAL 56
v_zero,
#define V_ZERO 57
@ -1801,27 +1801,27 @@ editinit(void)
void
CheckMaps(void)
{ /* check the size of the key maps */
int c1 = (NT_NUM_KEYS * sizeof(KEYCMD));
size_t c1 = NT_NUM_KEYS * sizeof(KEYCMD);
if ((sizeof(CcKeyMap)) != c1)
xprintf("CcKeyMap should be %d entries, but is %d.\r\n",
NT_NUM_KEYS, sizeof(CcKeyMap) / sizeof(KEYCMD)));
if (sizeof(CcKeyMap) != c1)
xprintf("CcKeyMap should be %u entries, but is %zu.\r\n",
NT_NUM_KEYS, sizeof(CcKeyMap) / sizeof(KEYCMD));
if ((sizeof(CcAltMap)) != c1)
xprintf("CcAltMap should be %d entries, but is %d.\r\n",
NT_NUM_KEYS, (sizeof(CcAltMap) / sizeof(KEYCMD)));
if (sizeof(CcAltMap) != c1)
xprintf("CcAltMap should be %u entries, but is %zu.\r\n",
NT_NUM_KEYS, sizeof(CcAltMap) / sizeof(KEYCMD));
if ((sizeof(CcEmacsMap)) != c1)
xprintf("CcEmacsMap should be %d entries, but is %d.\r\n",
NT_NUM_KEYS, (sizeof(CcEmacsMap) / sizeof(KEYCMD)));
if (sizeof(CcEmacsMap) != c1)
xprintf("CcEmacsMap should be %u entries, but is %zu.\r\n",
NT_NUM_KEYS, sizeof(CcEmacsMap) / sizeof(KEYCMD));
if ((sizeof(CcViMap)) != c1)
xprintf("CcViMap should be %d entries, but is %d.\r\n",
NT_NUM_KEYS, (sizeof(CcViMap) / sizeof(KEYCMD)));
if (sizeof(CcViMap) != c1)
xprintf("CcViMap should be %u entries, but is %zu.\r\n",
NT_NUM_KEYS, sizeof(CcViMap) / sizeof(KEYCMD));
if ((sizeof(CcViCmdMap)) != c1)
xprintf("CcViCmdMap should be %d entries, but is %d.\r\n",
NT_NUM_KEYS, (sizeof(CcViCmdMap) / sizeof(KEYCMD)));
if (sizeof(CcViCmdMap) != c1)
xprintf("CcViCmdMap should be %u entries, but is %zu.\r\n",
NT_NUM_KEYS, sizeof(CcViCmdMap) / sizeof(KEYCMD));
}
#endif
@ -1889,6 +1889,9 @@ ed_InitVIMaps(void)
int i;
VImode = 1;
setNS(STRvimode);
update_wordchars();
ResetXmap();
for (i = 0; i < NT_NUM_KEYS; i++) {
CcKeyMap[i] = CcViMap[i];
@ -1910,6 +1913,10 @@ ed_InitEmacsMaps(void)
cstr.len = 2;
VImode = 0;
if (adrof(STRvimode))
unsetv(STRvimode);
update_wordchars();
ResetXmap();
for (i = 0; i < NT_NUM_KEYS; i++) {
CcKeyMap[i] = CcEmacsMap[i];

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/ed.inputl.c,v 3.71 2010/12/22 17:26:04 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.inputl.c,v 3.73 2012/10/19 15:23:32 christos Exp $ */
/*
* ed.inputl.c: Input line handling.
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: ed.inputl.c,v 3.71 2010/12/22 17:26:04 christos Exp $")
RCSID("$tcsh: ed.inputl.c,v 3.73 2012/10/19 15:23:32 christos Exp $")
#include "ed.h"
#include "ed.defns.h" /* for the function names */
@ -683,7 +683,7 @@ GetNextCommand(KEYCMD *cmdnum, Char *ch)
#ifdef DSPMBYTE
_enable_mbdisp &&
#else
MB_CUR_MAX == 1 &&
MB_LEN_MAX == 1 &&
#endif
!adrof(STRnokanji) && (*ch & META)) {
MetaNext = 0;
@ -800,17 +800,13 @@ GetNextChar(Char *cp)
return -1;
}
}
if (AsciiOnly) {
*cp = (unsigned char)*cbuf;
} else {
cbp++;
if (normal_mbtowc(cp, cbuf, cbp) == -1) {
reset_mbtowc();
if (cbp < MB_CUR_MAX)
continue; /* Maybe a partial character */
/* And drop the following bytes, if any */
*cp = (unsigned char)*cbuf | INVALID_BYTE;
}
cbp++;
if (normal_mbtowc(cp, cbuf, cbp) == -1) {
reset_mbtowc();
if (cbp < MB_CUR_MAX)
continue; /* Maybe a partial character */
/* And drop the following bytes, if any */
*cp = (unsigned char)*cbuf | INVALID_BYTE;
}
break;
}

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/ed.refresh.c,v 3.47 2011/02/27 00:14:51 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.refresh.c,v 3.51 2015/06/06 21:19:07 christos Exp $ */
/*
* ed.refresh.c: Lower level screen refreshing functions
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: ed.refresh.c,v 3.47 2011/02/27 00:14:51 christos Exp $")
RCSID("$tcsh: ed.refresh.c,v 3.51 2015/06/06 21:19:07 christos Exp $")
#include "ed.h"
/* #define DEBUG_UPDATE */
@ -46,7 +46,7 @@ static int vcursor_h, vcursor_v;
static int rprompt_h, rprompt_v;
static int MakeLiteral (Char *, int, Char);
static int Draw (Char *, int);
static int Draw (Char *, int, int);
static void Vdraw (Char, int);
static void RefreshPromptpart (Char *);
static void update_line (Char *, Char *, int);
@ -159,15 +159,44 @@ static int MakeLiteral(Char *str, int len, Char addlit)
return i | LITERAL;
}
/* draw char at cp, expand tabs, ctl chars */
static int
Draw(Char *cp, int nocomb) /* draw char at cp, expand tabs, ctl chars */
Draw(Char *cp, int nocomb, int drawPrompt)
{
int w, i, lv, lh;
Char c, attr;
#ifdef WIDE_STRINGS
if (!drawPrompt) { /* draw command-line */
attr = 0;
c = *cp;
} else { /* draw prompt */
/* prompt with attributes(UNDER,BOLD,STANDOUT) */
if (*cp & (UNDER | BOLD | STANDOUT)) { /* *cp >= STANDOUT */
/* example)
* We can't distinguish whether (*cp=)0x02ffffff is
* U+02FFFFFF or U+00FFFFFF|STANDOUT.
* We handle as U+00FFFFFF|STANDOUT, only when drawing prompt. */
attr = (*cp & ATTRIBUTES);
/* ~(UNDER | BOLD | STANDOUT) = 0xf1ffffff */
c = *cp & ~(UNDER | BOLD | STANDOUT);
/* if c is ctrl code, we handle *cp as havnig no attributes */
if ((c < 0x20 && c >= 0) || c == 0x7f) {
attr = 0;
c = *cp;
}
} else { /* prompt without attributes */
attr = 0;
c = *cp;
}
}
#else
attr = *cp & ~CHAR;
c = *cp & CHAR;
w = NLSClassify(c, nocomb);
#endif
w = NLSClassify(c, nocomb, drawPrompt);
switch (w) {
case NLSCLASS_NL:
Vdraw('\0', 0); /* assure end of line */
@ -201,10 +230,11 @@ Draw(Char *cp, int nocomb) /* draw char at cp, expand tabs, ctl chars */
case NLSCLASS_ILLEGAL2:
case NLSCLASS_ILLEGAL3:
case NLSCLASS_ILLEGAL4:
Vdraw('\\' | attr, 1);
Vdraw('U' | attr, 1);
Vdraw('+' | attr, 1);
for (i = 8 * NLSCLASS_ILLEGAL_SIZE(w) - 4; i >= 0; i -= 4)
case NLSCLASS_ILLEGAL5:
Vdraw('\\', 1);
Vdraw('U', 1);
Vdraw('+', 1);
for (i = 16 + 4 * (-w-5); i >= 0; i -= 4)
Vdraw("0123456789ABCDEF"[(c >> i) & 15] | attr, 1);
break;
case 0:
@ -302,7 +332,7 @@ RefreshPromptpart(Char *buf)
}
}
else
cp += Draw(cp, cp == buf);
cp += Draw(cp, cp == buf, 1);
}
}
@ -354,7 +384,7 @@ Refresh(void)
cur_v = vcursor_v;
Cursor = cp;
}
cp += Draw(cp, cp == InputBuf);
cp += Draw(cp, cp == InputBuf, 0);
}
if (cur_h == -1) { /* if I haven't been set yet, I'm at the end */
@ -1126,7 +1156,7 @@ RefCursor(void)
cp++;
continue;
}
w = NLSClassify(*cp & CHAR, cp == Prompt);
w = NLSClassify(*cp & CHAR, cp == Prompt, 0);
cp++;
switch(w) {
case NLSCLASS_NL:
@ -1158,7 +1188,7 @@ RefCursor(void)
}
for (cp = InputBuf; cp < Cursor;) { /* do input buffer to Cursor */
w = NLSClassify(*cp & CHAR, cp == InputBuf);
w = NLSClassify(*cp & CHAR, cp == InputBuf, 0);
cp++;
switch(w) {
case NLSCLASS_NL:
@ -1251,7 +1281,7 @@ RefPlusOne(int l)
}
cp = Cursor - l;
c = *cp & CHAR;
w = NLSClassify(c, cp == InputBuf);
w = NLSClassify(c, cp == InputBuf, 0);
switch(w) {
case NLSCLASS_CTRL:
PutPlusOne('^', 1);
@ -1299,7 +1329,7 @@ ClearDisp(void)
CursorV = 0; /* clear the display buffer */
CursorH = 0;
for (i = 0; i < TermV; i++)
(void) memset(Display[i], 0, TermH * sizeof(Display[0][0]));
(void) memset(Display[i], 0, (TermH + 1) * sizeof(Display[0][0]));
OldvcV = 0;
litlen = 0;
}

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/ed.screen.c,v 3.78 2011/02/27 00:14:38 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.screen.c,v 3.82 2016/11/24 15:04:14 christos Exp $ */
/*
* ed.screen.c: Editor/termcap-curses interface
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: ed.screen.c,v 3.78 2011/02/27 00:14:38 christos Exp $")
RCSID("$tcsh: ed.screen.c,v 3.82 2016/11/24 15:04:14 christos Exp $")
#include "ed.h"
#include "tc.h"
@ -994,14 +994,14 @@ SetAttributes(Char atr)
int highlighting = 0;
void
StartHighlight()
StartHighlight(void)
{
(void) tputs(Str(T_mr), 1, PUTPURE);
highlighting = 1;
}
void
StopHighlight()
StopHighlight(void)
{
(void) tputs(Str(T_me), 1, PUTPURE);
highlighting = 0;
@ -1437,7 +1437,8 @@ GetTermCaps(void)
if (i <= 0) {
if (i == -1) {
#if (SYSVREL == 0) || defined(IRIS3D)
xprintf(CGETS(7, 20, "%s: Cannot open /etc/termcap.\n"), progname);
xprintf(CGETS(7, 20,
"%s: The terminal database could not be opened.\n"), progname);
}
else if (i == 0) {
#endif /* SYSVREL */
@ -1563,13 +1564,13 @@ GetSize(int *lins, int *cols)
#endif /* SIG_WINDOW */
#ifdef KNOWsize
static void
static int
UpdateVal(const Char *tag, int value, Char *termcap, Char *backup)
{
Char *ptr, *p;
if ((ptr = Strstr(termcap, tag)) == NULL) {
(void)Strcpy(backup, termcap);
return;
return 0;
} else {
size_t len = (ptr - termcap) + Strlen(tag);
(void)Strncpy(backup, termcap, len);
@ -1580,6 +1581,7 @@ UpdateVal(const Char *tag, int value, Char *termcap, Char *backup)
ptr = Strchr(ptr, ':');
if (ptr)
(void) Strcat(backup, ptr);
return 1;
}
}
#endif
@ -1625,21 +1627,23 @@ ChangeSize(int lins, int cols)
if ((tptr = getenv("TERMCAP")) != NULL) {
/* Leave 64 characters slop in case we enlarge the termcap string */
Char termcap[TC_BUFSIZE+64], backup[TC_BUFSIZE+64], *ptr;
Char buf[4];
int changed;
ptr = str2short(tptr);
(void) Strncpy(termcap, ptr, TC_BUFSIZE);
termcap[TC_BUFSIZE-1] = '\0';
UpdateVal(STRco, Val(T_co), termcap, backup);
UpdateVal(STRli, Val(T_li), termcap, backup);
changed = UpdateVal(STRco, Val(T_co), termcap, backup);
changed |= UpdateVal(STRli, Val(T_li), termcap, backup);
/*
* Chop the termcap string at TC_BUFSIZE-1 characters to avoid
* core-dumps in the termcap routines
*/
termcap[TC_BUFSIZE - 1] = '\0';
tsetenv(STRTERMCAP, termcap);
if (changed) {
/*
* Chop the termcap string at TC_BUFSIZE-1 characters to avoid
* core-dumps in the termcap routines
*/
termcap[TC_BUFSIZE - 1] = '\0';
tsetenv(STRTERMCAP, termcap);
}
}
}
#endif /* KNOWsize */

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/ed.term.h,v 1.18 2007/07/05 14:13:06 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.term.h,v 1.19 2015/03/25 19:53:16 christos Exp $ */
/*
* ed.term.h: Local terminal header
*/
@ -300,10 +300,18 @@
# endif /* masscomp */
#endif /* CBRK */
#ifndef CMIN
# define CMIN CEOF
# if VMIN == VEOF
# define CMIN CEOF
# else
# define CMIN 1
# endif
#endif /* CMIN */
#ifndef CTIME
# define CTIME CEOL
# if VTIME == VEOL
# define CTIME CEOL
# else
# define CTIME 0
# endif
#endif /* CTIME */
/*

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/ed.xmap.c,v 3.37 2009/06/25 21:15:37 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/ed.xmap.c,v 3.38 2015/06/06 21:19:07 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.37 2009/06/25 21:15:37 christos Exp $")
RCSID("$tcsh: ed.xmap.c,v 3.38 2015/06/06 21:19:07 christos Exp $")
#include "ed.h"
#include "ed.defns.h"
@ -743,7 +743,7 @@ unparsestring(const CStr *str, const Char *sep)
*b++ = (unsigned char) p;
}
else if (p == ' ' || (Isprint(p) && !Isspace(p)))
b += one_wctomb((char *)b, p & CHAR);
b += one_wctomb((char *)b, p);
else {
*b++ = '\\';
*b++ = ((p >> 6) & 7) + '0';

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/gethost.c,v 1.15 2012/01/15 17:14:54 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/gethost.c,v 1.19 2014/03/09 00:11:54 christos Exp $ */
/*
* gethost.c: Create version file from prototype
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: gethost.c,v 1.15 2012/01/15 17:14:54 christos Exp $")
RCSID("$tcsh: gethost.c,v 1.19 2014/03/09 00:11:54 christos Exp $")
#ifdef SCO
# define perror __perror
@ -150,11 +150,17 @@ cat(const char *a, const char *b, size_t len)
char *r;
if (len == 0)
len = strlen(b);
l = strlen(a) + len + 1;
len = strlen(b) + 1;
if (a)
l = strlen(a) + len;
else
l = len;
if ((r = malloc(l)) == NULL)
abort();
snprintf(r, l, "%s%.*s", a, (int)len, b);
if (a)
snprintf(r, l, "%s%.*s", a, (int)len, b);
else
snprintf(r, l, "%.*s", (int)len, b);
return r;
}
@ -165,19 +171,22 @@ explode(const char *defs)
static char *buf;
size_t len;
const char *ptr, *bptr, *eptr = NULL, *name;
size_t buflen = 0;
if (strstr(defs, "#machine(" /* ) */))
return defs;
if (!strstr(defs, def))
return defs;
free(buf);
buf = strdup("("); /* ) */
buf = NULL;
for (ptr = defs; (bptr = strstr(ptr, def)) != NULL; ptr = eptr + 1) {
if (ptr != bptr)
buf = cat(buf, ptr, bptr - ptr);
buf = cat(buf, ptr, bptr - ptr + 1);
buf = cat(buf, "(", 0); /* ) */
if ((eptr = strchr(ptr + sizeof(def) - 1, ')')) == NULL) {
(void) fprintf(stderr, "%s: missing close paren `%s'\n",
pname, defs);
free(buf);
return defs;
}
buf = cat(buf, bptr, eptr - bptr + 1);
@ -186,26 +195,29 @@ explode(const char *defs)
if (len < 1) {
(void) fprintf(stderr, "%s: empty define `%s'\n",
pname, defs);
free(buf);
return defs;
}
if (*name != '_') {
if (*name != '_' && (*name != 'M' && name[1] != '_')) {
char *undername = malloc(len + 10);
buf = cat(buf, " || defined(", 0);
if (undername == NULL)
abort();
buf = cat(buf, ") || defined(", 0);
snprintf(undername, len + 10, "__%.*s__)", (int)len,
name);
buf = cat(buf, undername, len + 5);
buf = cat(buf, " || defined(", 0);
buf = cat(buf, ") || defined(", 0);
snprintf(undername, len + 10, "__%.*s)", (int)len,
name);
buf = cat(buf, undername, len + 3);
}
buf = cat(buf, "))", 0);
}
if (!eptr) {
(void) fprintf(stderr, "%s: invalid input `%s'\n", pname, defs);
return defs;
}
buf = cat(buf, eptr + 1, 0);
buf = cat(buf, ")", 0);
return buf;
}
@ -292,8 +304,8 @@ main(int argc, char *argv[])
pname, fname, lineno);
break;
}
(void) fprintf(stdout, "\n#if %s\n# define %s\n#endif\n\n", stmt,
defs);
(void) fprintf(stdout, "\n#if %s\n# define %s\n#endif\n\n",
explode(stmt), defs);
break;
case T_NONE:
@ -340,7 +352,7 @@ main(int argc, char *argv[])
#ifdef LINEDIRECTIVE
(void) fprintf(stdout, "# %d \"%s\"\n", lineno + 1, fname);
#endif /* LINEDIRECTIVE */
(void) fprintf(stdout, "#if %s\n", defs);
(void) fprintf(stdout, "#if (%s)\n", explode(defs));
inprocess = 1;
}
else {

View File

@ -59,6 +59,11 @@ static char sccsid[] = "@(#)glob.c 5.12 (Berkeley) 6/24/91";
#include "sh.h"
#include "glob.h"
#ifndef HAVE_MBLEN
#undef mblen
#define mblen(_s,_n) mbrlen((_s),(_n),NULL)
#endif
#undef Char
#undef QUOTE
#undef TILDE
@ -435,6 +440,7 @@ glob(const char *pattern, int flags, int (*errfunc) (const char *, int),
dest = copy;
src = pattern;
while (*src != EOS) {
/* Don't interpret quotes. The spec does not say we should do */
if (*src == QUOTE) {
if (*++src == EOS)
--src;

View File

@ -1,5 +1,5 @@
newcode :
/* $Header: /p/tcsh/cvsroot/tcsh/host.defs,v 1.55 2012/01/11 20:20:15 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/host.defs,v 1.61 2015/05/26 18:56:19 christos Exp $ */
/*
* host.defs: Hosttype/Machtype etc.
*/
@ -33,18 +33,19 @@ newcode :
*/
#include "sh.h"
RCSID("$tcsh: host.defs,v 1.55 2012/01/11 20:20:15 christos Exp $")
RCSID("$tcsh: host.defs,v 1.61 2015/05/26 18:56:19 christos Exp $")
endcode :
macro : M_mips64el : (defined(mips64) || defined(__mips64)) && (defined(MIPSEL) || defined(__MIPSEL))
macro : M_mips64eb : (defined(mips64) || defined(__mips64)) && (defined(MIPSEB) || defined(__MIPSEB))
macro : M_mipsel : (!defined(M_mips64el)) && (defined(mips) || defined(__mips)) && (defined(MIPSEL) || defined(__MIPSEL))
macro : M_mipseb : (!defined(M_mips64eb)) && (defined(mips) || defined(__mips)) && (defined(MIPSEB) || defined(__MIPSEB))
macro : M_i386 : (defined(i386) || defined(__i386__))
macro : M_i486 : (defined(i486) || defined(__i486__))
macro : M_i586 : (defined(i586) || defined(__i586__))
macro : M_i686 : (defined(i686) || defined(__i686__))
macro : M_mips64el : (defined(mips64) && defined(MIPSEL))
macro : M_mips64eb : (defined(mips64) && defined(MIPSEB))
macro : M_mipsel : (!defined(M_mips64el) && defined(mips) && defined(MIPSEL))
macro : M_mipseb : (!defined(M_mips64eb) && defined(mips) && defined(MIPSEB))
macro : M_amd64: (defined(amd64) || defined(x86_64))
macro : M_i386 : defined(i386)
macro : M_i486 : defined(i486)
macro : M_i586 : defined(i586)
macro : M_i686 : defined(i686)
macro : M_intel : (defined(M_i386) || defined(M_i486) || defined(M_i586))
newdef : defined(ns32000)
@ -169,7 +170,7 @@ getconvex(void)
endcode :
enddef :
newdef : defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__) || defined(__GLIBC__)
newdef : defined(linux) || defined(CYGWIN) || defined(GNU) || defined(GLIBC)
newcode :
# include "tw.h"
#include <sys/utsname.h>
@ -240,7 +241,7 @@ hosttype: : HOSTTYPE
enddef :
newdef : defined(__PARAGON__)
newdef : defined(PARAGON)
comment : Intel Paragon running OSF/1
vendor : : "intel"
hosttype: : "paragon"
@ -277,7 +278,7 @@ machtype: defined(vax) : "vax"
enddef :
newdef : defined(__hp_osf)
newdef : defined(hp_osf)
comment : Hewlett Packard running OSF/1
vendor : : "hp"
hosttype: defined(pa_risc) : "hp9000s700-osf1"
@ -300,7 +301,7 @@ machtype: defined(hp800) : "pa_risc"
enddef :
newdef : defined(hpux) || defined(__hpux)
newdef : defined(hpux)
comment : Hewlett Packard running HP/UX
vendor : : "hp"
hosttype: defined(hp9000s800) : "hp9000s800"
@ -325,14 +326,15 @@ machtype: : "m68k"
enddef :
newdef : defined(sun) || defined(__sun__)
newdef : defined(sun)
comment : Sun Microsystems series 2 workstation (68010 based)
comment : Sun Microsystems series 3 workstation (68020 based)
comment : Sun Microsystems 386i workstation (386 based)
comment : Sun Microsystems series 4 workstation (SPARC based)
vendor : : "sun"
hosttype: defined(M_i386) && !defined(__SVR4) : "sun386i"
hosttype: defined(M_i386) && defined(__SVR4) : "i86pc"
hosttype: defined(M_i386) && !defined(SVR4) : "sun386i"
hosttype: defined(M_i386) && defined(SVR4) : "i86pc"
hosttype: defined(M_amd64) : "i86pc"
hosttype: defined(mc68010) : "sun2"
hosttype: defined(mc68020) : "sun3"
hosttype: defined(sparc) : "sun4"
@ -345,6 +347,7 @@ machtype: defined(mc68020) : "m68k"
machtype: defined(sparcv9) : "sparcv9"
machtype: defined(sparc) : "sparc"
machtype: defined(M_i386) : "i386"
machtype: defined(M_amd64) : "amd64"
enddef :
@ -488,7 +491,7 @@ machtype: defined(M_i386) : "i386"
enddef :
newdef : defined(__gnu_hurd__)
newdef : defined(gnu_hurd)
comment : GNU/HURD
vendor : defined(M_intel) : "intel"
hosttype: defined(M_i686) : "i686"
@ -503,19 +506,19 @@ machtype: defined(M_i386) : "i386-pc-gnu"
enddef :
newdef : defined(linux) || defined(__GNU__) || defined(__GLIBC__)
newdef : defined(linux) || defined(GNU) || defined(GLIBC)
comment : Linus Torvalds's linux
vendor : defined(M_intel) : "intel"
hosttype: : gethost()
ostype : : getostype()
machtype: : getmach()
vendor : defined(__ANDROID__) : "linux"
vendor : defined(ANDROID) : "linux"
vendor : defined(alpha) : "dec"
vendor : defined(PPC) : "apple"
enddef :
newdef : defined(__EMX__)
newdef : defined(EMX)
comment : OS/2 EMX [unix emulation under OS/2]
vendor : defined(M_intel) : "intel"
hosttype: defined(M_i386) : "i386-emx"
@ -524,10 +527,10 @@ machtype: defined(M_i386) : "i386"
enddef :
newdef : defined(__NetBSD__)
newdef : defined(NetBSD)
comment : NetBSD
vendor : defined(algor) : "algoritmics"
vendor : defined(arm32) || defined(__arm__) : "acorn"
vendor : defined(arm32) || defined(arm) : "acorn"
vendor : defined(alpha) : "digital"
vendor : defined(amiga) : "commodore"
vendor : defined(atari) : "atari"
@ -543,13 +546,13 @@ vendor : defined(sparc) : "sun"
vendor : defined(sparc64) : "sun"
vendor : defined(sun3) : "sun"
vendor : defined(vax) : "digital"
vendor : defined(x86_64) : "amd"
vendor : defined(M_amd64) : "amd"
hosttype: : "NetBSD"
ostype : : "NetBSD"
machtype: defined(alpha) : "alpha"
machtype: defined(algor) : "algor"
machtype: defined(arm32) || defined(__APCS_32__) : "arm32"
machtype: defined(arm26) || defined(__APCS_26__) : "arm26"
machtype: defined(arm32) || defined(APCS_32) : "arm32"
machtype: defined(arm26) || defined(APCS_26) : "arm26"
machtype: defined(arm) : "arm"
machtype: defined(sparc) : "sparc"
machtype: defined(sparc64) : "sparc64"
@ -561,25 +564,57 @@ machtype: defined(mips) : "mips"
machtype: defined(pc532) : "pc532"
machtype: defined(powerpc) : "powerpc"
machtype: defined(vax) : "vax"
machtype: defined(x86_64) : "x86_64"
machtype: defined(M_amd64) : "x86_64"
enddef :
newdef : defined(OpenBSD)
comment : OpenBSD
vendor : defined(alpha) : "digital"
vendor : defined(M_amd64) : "amd"
vendor : defined(arm) : "arm"
vendor : defined(hppa) || defined(hppa64) : "hp"
vendor : defined(M_intel) : "intel"
vendor : defined(m68k) : "motorola"
vendor : defined(m88k) : "motorola"
vendor : defined(mips) && defined(sgi) : "sgi"
vendor : defined(powerpc) : "motorola"
vendor : defined(sh) : "io-data"
vendor : defined(sparc) || defined(sparc64) : "sun"
vendor : defined(vax) : "digital"
hosttype: : "OpenBSD"
ostype : : "OpenBSD"
machtype: defined(alpha) : "alpha"
machtype: defined(M_amd64) : "amd64"
machtype: defined(arm) : "arm"
machtype: defined(hppa) : "hppa"
machtype: defined(hppa64) : "hppa64"
machtype: defined(M_i386) : "i386"
machtype: defined(m68k) : "m68k"
machtype: defined(m88k) : "m88k"
machtype: defined(mips) : "mips"
machtype: defined(sh) : "sh"
machtype: defined(sparc64) : "sparc64"
machtype: defined(sparc) : "sparc"
machtype: defined(powerpc) : "powerpc"
machtype: defined(vax) : "vax"
enddef :
newdef : defined(__FreeBSD__)
newdef : defined(FreeBSD)
comment : FreeBSD
vendor : defined(alpha) : "digital"
vendor : defined(arm32) || defined(__arm__) : "acorn"
vendor : defined(arm32) || defined(arm) : "acorn"
vendor : defined(M_intel) : "intel"
vendor : defined(ia64) : "intel"
vendor : defined(mips) : "mips"
vendor : defined(powerpc) : "motorola"
vendor : defined(sparc) : "sun"
vendor : defined(sparc64) : "sun"
vendor : defined(x86_64) : "amd"
vendor : defined(M_amd64) : "amd"
hosttype: : "FreeBSD"
ostype : : "FreeBSD"
machtype: defined(alpha) : "alpha"
machtype: defined(arm32) || defined(__APCS_32__) : "arm32"
machtype: defined(arm32) || defined(APCS_32) : "arm32"
machtype: defined(arm) : "arm"
machtype: defined(ia64) : "ia64"
machtype: defined(M_i386) : "i386"
@ -587,11 +622,11 @@ machtype: defined(mips) : "mips"
machtype: defined(powerpc) : "powerpc"
machtype: defined(sparc) : "sparc"
machtype: defined(sparc64) : "sparc64"
machtype: defined(x86_64) : "x86_64"
machtype: defined(M_amd64) : "x86_64"
enddef :
newdef : defined(__MidnightBSD__)
newdef : defined(MidnightBSD)
comment : MidnightBSD
vendor : defined(M_intel) : "intel"
hosttype: : "MidnightBSD"
@ -819,13 +854,15 @@ machtype: defined(sparc) : "sparc"
enddef :
newdef : defined(__APPLE__) && defined(__MACH__)
newdef : defined(APPLE) && defined(MACH)
comment : OS X
vendor : : "apple"
hosttype: defined(i386) : "intel-pc"
hosttype: defined(ppc) : "powermac"
hosttype: defined(M_amd64) : "amd"
ostype : : "darwin"
machtype: defined(i386) : "i386"
machtype: defined(M_amd64) : "x86_64"
machtype: defined(ppc) : "powerpc"
enddef :
@ -855,7 +892,7 @@ machtype: defined(mc68000) : "mc68000"
enddef :
newdef : defined(ultrix) || defined(__ultrix)
newdef : defined(ultrix)
comment : Digital's Ultrix
vendor : : "dec"
hosttype: defined(M_mipsel) : "decstation"
@ -917,7 +954,7 @@ hosttype: : "masscomp"
ostype : : "masscomp"
enddef :
newdef : defined(__MACHTEN__)
newdef : defined(MACHTEN)
comment : Machintosh
vendor : : "Tenon"
hosttype: : "Macintosh"
@ -1040,7 +1077,7 @@ hosttype: : "tekXD88"
enddef :
newdef : defined(__DGUX__)
newdef : defined(DGUX)
comment : Data-General AViiON running DGUX
hosttype: : "aviion"
ostype : : "dgux"
@ -1074,14 +1111,14 @@ machtype: : "m88k"
enddef :
newdef : defined(__clipper__)
newdef : defined(clipper)
comment : Clipper Chipset (Intergraph)
vendor : : "intergraph"
hosttype: : "clipper"
machtype: : "clipper"
enddef :
newdef : defined(__QNX__)
newdef : defined(QNX)
ostype : : "qnx"
enddef :
@ -1110,7 +1147,7 @@ machtype: #machine(sparc) : "sparc"
machtype: : "bs2000"
enddef :
newdef : defined(__MVS__)
newdef : defined(MVS)
comment : ibm uss s/390 (mainframe, EBCDIC)
vendor : : "ibm"
hosttype: : "s390"
@ -1134,7 +1171,7 @@ ostype : : "svr4"
machtype: defined(M_i386) : "i386"
enddef :
newdef : defined(__uxp__) || defined(__uxps__)
newdef : defined(uxp) || defined(uxps)
comment : FUJITSU DS/90 7000
vendor : : "fujitsu"
hosttype: : "ds90"
@ -1142,9 +1179,9 @@ ostype : : "sysv4"
machtype: : "sparc"
enddef :
newdef : defined(__CYGWIN__)
newdef : defined(CYGWIN)
comment : Cygwin
vendor : : "intel"
vendor : defined(M_intel) : "intel"
hosttype: : gethost()
ostype : : getostype()
machtype: : getmach()

View File

@ -1,4 +1,4 @@
$ $tcsh: set1,v 1.6 2006/03/02 18:46:45 christos Exp $
$ $tcsh: set1,v 1.7 2015/05/26 17:38:25 christos Exp $
$ Error messages
$set 1
1 Syntax Error
@ -8,7 +8,7 @@ $set 1
5 No file for $0
6 Incomplete [] modifier
7 $ expansion must end before ]
8 Bad : modifier in $ (%c)
8 Bad : modifier in $ '%c'
9 Subscript error
10 Badly formed number
11 No more words
@ -51,8 +51,8 @@ $set 1
48 Not in while/foreach
49 No more processes
50 No match
51 Missing %c
52 Unmatched %c
51 Missing '%c'
52 Unmatched '%c'
53 Out of memory
54 Can't make pipe
55 %s: %s
@ -93,7 +93,7 @@ $set 1
90 Bad substitute
91 No previous left hand side
92 Right hand side too long
93 Bad ! modifier: %c
93 Bad ! modifier: '%c'
94 Modifier failed
95 Substitution buffer overflow
96 Bad ! arg selector
@ -118,7 +118,7 @@ $set 1
115 Out of termcap string space
116 Usage: settc %s [yes|no]
117 Unknown capability `%s'
118 Unknown termcap parameter `%%%c'
118 Unknown termcap parameter '%%%c'
119 Too many arguments for `%s' (%d)
120 `%s' requires %d arguments
121 Usage: echotc [-v|-s] [<capability> [<args>]]
@ -137,4 +137,4 @@ $set 1
134 Usage: unlimit [-fh] [limits]
135 $%S is read-only
136 No such job
137 Unknown colorls variable `%c%c'
137 Unknown colorls variable '%c%c'

View File

@ -1,4 +1,4 @@
$ $tcsh: set20,v 1.3 2006/03/02 18:46:45 christos Exp $
$ $tcsh: set20,v 1.4 2015/08/13 08:54:04 christos Exp $
$ tc.bind.c
$set 20
1 Invalid key name `%S'\n
@ -19,7 +19,7 @@ $set 20
16 -c interpret COMMAND as a builtin or external command\n
17 -v bind all keys to vi bindings\n
18 -e bind all keys to emacs bindings\n
19 -d bind all keys to default editor's bindings\n
19 -d bind all keys to default editor's bindings (%s)\n
20 -l list editor commands with descriptions\n
21 -r remove KEY's binding\n
22 -k interpret KEY as a symbolic arrow-key name\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set9,v 1.3 2006/03/02 18:46:45 christos Exp $
$ $tcsh: set9,v 1.4 2015/05/26 17:38:25 christos Exp $
$ ed.xmap.c
$set 9
1 AddXkey: Null extended-key not allowed.\n
@ -8,5 +8,5 @@ $set 9
5 Some extended keys too long for internal print buffer
6 Enumerate: BUG!! Null ptr passed\n!
7 no input
8 Something must follow: %c\n
8 Something must follow: '%c'\n
9 Octal constant does not fit in a char.\n

View File

@ -1,4 +1,4 @@
# $tcsh: Makefile.in,v 1.13 2012/01/05 16:54:25 christos Exp $
# $tcsh: Makefile.in,v 1.16 2014/07/23 18:18:07 christos Exp $
CATALOGS= C.cat et.cat finnish.cat french.cat german.cat greek.cat \
italian.cat ja.cat pl.cat russian.cat spanish.cat ukrainian.cat
@ -19,7 +19,7 @@ all: ${CATALOGS}
INSTALLED+=${localedir}/C/LC_MESSAGES/tcsh.cat
${localedir}/C/LC_MESSAGES/tcsh.cat: C.cat
mkdir -p $(@D)
$(INSTALL) $< $@
$(INSTALL) $> $^ $@
C.cat: ${srcdir}/C/charset ${srcdir}/C/*set[0-9]*
@${CATGEN} $(GENCAT) $@ $^ $>
@ -27,7 +27,7 @@ C.cat: ${srcdir}/C/charset ${srcdir}/C/*set[0-9]*
INSTALLED+=${localedir}/et/LC_MESSAGES/tcsh.cat
${localedir}/et/LC_MESSAGES/tcsh.cat: et.cat
mkdir -p $(@D)
$(INSTALL) $< $@
$(INSTALL) $> $^ $@
et.cat: ${srcdir}/et/charset ${srcdir}/et/*set[0-9]*
@${CATGEN} $(GENCAT) $@ $^ $>
@ -35,7 +35,7 @@ et.cat: ${srcdir}/et/charset ${srcdir}/et/*set[0-9]*
INSTALLED+=${localedir}/fi/LC_MESSAGES/tcsh.cat
${localedir}/fi/LC_MESSAGES/tcsh.cat: finnish.cat
mkdir -p $(@D)
$(INSTALL) $< $@
$(INSTALL) $> $^ $@
finnish.cat: ${srcdir}/finnish/charset ${srcdir}/finnish/*set[0-9]*
@${CATGEN} $(GENCAT) $@ $^ $>
@ -43,7 +43,7 @@ finnish.cat: ${srcdir}/finnish/charset ${srcdir}/finnish/*set[0-9]*
INSTALLED+=${localedir}/fr/LC_MESSAGES/tcsh.cat
${localedir}/fr/LC_MESSAGES/tcsh.cat: french.cat
mkdir -p $(@D)
$(INSTALL) $< $@
$(INSTALL) $> $^ $@
french.cat: ${srcdir}/french/charset ${srcdir}/french/*set[0-9]*
@${CATGEN} $(GENCAT) $@ $^ $>
@ -51,7 +51,7 @@ french.cat: ${srcdir}/french/charset ${srcdir}/french/*set[0-9]*
INSTALLED+=${localedir}/de/LC_MESSAGES/tcsh.cat
${localedir}/de/LC_MESSAGES/tcsh.cat: german.cat
mkdir -p $(@D)
$(INSTALL) $< $@
$(INSTALL) $> $^ $@
german.cat: ${srcdir}/german/charset ${srcdir}/german/*set[0-9]*
@${CATGEN} $(GENCAT) $@ $^ $>
@ -59,7 +59,7 @@ german.cat: ${srcdir}/german/charset ${srcdir}/german/*set[0-9]*
INSTALLED+=${localedir}/gr/LC_MESSAGES/tcsh.cat
${localedir}/gr/LC_MESSAGES/tcsh.cat: greek.cat
mkdir -p $(@D)
$(INSTALL) $< $@
$(INSTALL) $> $^ $@
greek.cat: ${srcdir}/greek/charset ${srcdir}/greek/*set[0-9]*
@${CATGEN} $(GENCAT) $@ $^ $>
@ -67,7 +67,7 @@ greek.cat: ${srcdir}/greek/charset ${srcdir}/greek/*set[0-9]*
INSTALLED+=${localedir}/it/LC_MESSAGES/tcsh.cat
${localedir}/it/LC_MESSAGES/tcsh.cat: italian.cat
mkdir -p $(@D)
$(INSTALL) $< $@
$(INSTALL) $> $^ $@
italian.cat: ${srcdir}/italian/charset ${srcdir}/italian/*set[0-9]*
@${CATGEN} $(GENCAT) $@ $^ $>
@ -75,7 +75,7 @@ italian.cat: ${srcdir}/italian/charset ${srcdir}/italian/*set[0-9]*
INSTALLED+=${localedir}/ja/LC_MESSAGES/tcsh.cat
${localedir}/ja/LC_MESSAGES/tcsh.cat: ja.cat
mkdir -p $(@D)
$(INSTALL) $< $@
$(INSTALL) $> $^ $@
ja.cat: ${srcdir}/ja/charset ${srcdir}/ja/*set[0-9]*
@${CATGEN} $(GENCAT) $@ $^ $>
@ -83,7 +83,7 @@ ja.cat: ${srcdir}/ja/charset ${srcdir}/ja/*set[0-9]*
INSTALLED+=${localedir}/pl/LC_MESSAGES/tcsh.cat
${localedir}/pl/LC_MESSAGES/tcsh.cat: pl.cat
mkdir -p $(@D)
$(INSTALL) $< $@
$(INSTALL) $> $^ $@
pl.cat: ${srcdir}/pl/charset ${srcdir}/pl/*set[0-9]*
@${CATGEN} $(GENCAT) $@ $^ $>
@ -91,7 +91,7 @@ pl.cat: ${srcdir}/pl/charset ${srcdir}/pl/*set[0-9]*
INSTALLED+=${localedir}/ru/LC_MESSAGES/tcsh.cat
${localedir}/ru/LC_MESSAGES/tcsh.cat: russian.cat
mkdir -p $(@D)
$(INSTALL) $< $@
$(INSTALL) $> $^ $@
russian.cat: ${srcdir}/russian/charset ${srcdir}/russian/*set[0-9]*
@${CATGEN} $(GENCAT) $@ $^ $>
@ -99,15 +99,15 @@ russian.cat: ${srcdir}/russian/charset ${srcdir}/russian/*set[0-9]*
INSTALLED+=${localedir}/es/LC_MESSAGES/tcsh.cat
${localedir}/es/LC_MESSAGES/tcsh.cat: spanish.cat
mkdir -p $(@D)
$(INSTALL) $< $@
$(INSTALL) $> $^ $@
spanish.cat: ${srcdir}/spanish/charset ${srcdir}/spanish/*set[0-9]*
@${CATGEN} $(GENCAT) $@ $^ $>
INSTALLED+=${localedir}/ru_UA.koi8u/LC_MESSAGES/tcsh.cat
${localedir}/ru_UA.koi8u/LC_MESSAGES/tcsh.cat: ukrainian.cat
INSTALLED+=${localedir}/ru_UA/LC_MESSAGES/tcsh.cat
${localedir}/ru_UA/LC_MESSAGES/tcsh.cat: ukrainian.cat
mkdir -p $(@D)
$(INSTALL) $< $@
$(INSTALL) $> $^ $@
ukrainian.cat: ${srcdir}/ukrainian/charset ${srcdir}/ukrainian/*set[0-9]*
@${CATGEN} $(GENCAT) $@ $^ $>

View File

@ -3,10 +3,18 @@
TMP=/tmp/catgen.$$
trap "rm -f $TMP" 0 1 2 3 15
sortit() {
awk '/^\$set/ {print $2, FILENAME}' "$@" | sort -n | cut -d ' ' -f 2
}
GENCAT="$1"
shift
OUT="$1"
shift
cat "$@" > "$TMP"
CHARSET="$1"
shift
cat "${CHARSET}" $(sortit "$@") > "$TMP"
echo "$(basename "$OUT" .cat)"
"${GENCAT}" "$OUT" "$TMP"
exit 0

View File

@ -1,4 +1,4 @@
$ $tcsh: set1,v 1.4 2011/02/04 18:19:33 christos Exp $
$ $tcsh: set1,v 1.5 2015/05/26 17:38:25 christos Exp $
$ Error messages
$set 1
1 Süntaksi viga
@ -8,7 +8,7 @@ $set 1
5 $0 jaoks pole faili
6 Mittetäielik [] muutja
7 $ laiendus peab lõppema enne ]
8 Halb : täiendaja $ (%c)
8 Halb : täiendaja $ '%c'
9 Viga indeksis
10 Vigane number
11 Sõnad on otsas
@ -51,8 +51,8 @@ $set 1
48 Pole while/foreach sees
49 Protsessid on otsas
50 Ei leia
51 Puuduv %c
52 Ei leia sümbolit %c
51 Puuduv '%c'
52 Ei leia sümbolit '%c'
53 Mälu on otsas
54 Toru ei saa luua
55 %s: %s
@ -93,7 +93,7 @@ $set 1
90 Vigane asendamine
91 Eelmist vasakut poolt pole
92 Parem pool on liiga pikk
93 Vigane ! modifikaator: %c
93 Vigane ! modifikaator: '%c'
94 Modifikaator ebaõnnestus
95 Asenduse puhvri ületäitumine
96 Vigane ! argumendi valik
@ -118,7 +118,7 @@ $set 1
115 Termcap sõne on liiga pikk
116 Kasuta: settc %s [yes|no]
117 Tundmatu omadus `%s'
118 Tundmatu termcap parameeter `%%%c'
118 Tundmatu termcap parameeter '%%%c'
119 `%s' jaoks on liiga palju argumente (%d)
120 `%s' nõuab %d argumenti
121 Kasuta: echotc [-v|-s] [<omadus> [<argumendid>]]
@ -137,4 +137,4 @@ $set 1
134 Kasuta: unlimit [-fh] [limiidid]
135 $%S on ainult lugemiseks
136 Pole sellist tööd
137 Tundmatu colorls muutuja `%c%c'
137 Tundmatu colorls muutuja '%c%c'

View File

@ -1,4 +1,4 @@
$ $tcsh: set20,v 1.3 2011/02/04 18:19:33 christos Exp $
$ $tcsh: set20,v 1.4 2015/08/13 08:54:04 christos Exp $
$ tc.bind.c
$set 20
1 Vigane klahvi nimi `%S'\n
@ -19,7 +19,7 @@ $set 20
16 -c käsitle COMMAND kui sisemist või välist käsku\n
17 -v seo kõik klahvid vi seostega\n
18 -e seo kõik klahvid emacsi seostega\n
19 -d seo kõik klahvid vaikimisi toimeti seostega\n
19 -d seo kõik klahvid vaikimisi toimeti seostega (%s)\n
20 -l esita toimeti käsud koos kirjeldustega\n
21 -r kustuta KLAHVILT seos\n
22 -k kasuta KLAHVI kui noole-klahvi sümbolnime\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set9,v 1.3 2011/02/04 18:19:34 christos Exp $
$ $tcsh: set9,v 1.4 2015/05/26 17:38:25 christos Exp $
$ ed.xmap.c
$set 9
1 AddXkey: Null pikkusega laiend-klahv ei ole lubatud.\n
@ -8,5 +8,5 @@ $set 9
5 Mõned laiendatud klahvid on sisemise trükipuhvri jaoks liiga pikad
6 Enumerate: BUG!! Null viit anti\n!
7 sisendit pole
8 Midagi peab järgnema: %c\n
8 Midagi peab järgnema: '%c'\n
9 kaheksand-konstant ei mahu sümbolisse.\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set1,v 1.4 2011/02/04 18:19:34 christos Exp $
$ $tcsh: set1,v 1.5 2015/05/26 17:38:25 christos Exp $
$ Error messages
$set 1
1 Kielioppivirhe
@ -8,7 +8,7 @@ $set 1
5 Puuttuva tiedosto $0
6 Vajavainen [] muunnos
7 $ -laajennuksen on päätyttävä ennen ']'-merkkiä
8 Virheellinen : -muunnos $ (%c)
8 Virheellinen : -muunnos $ '%c'
9 Indeksivirhe
10 Virheellinen numero
11 Liian vähän sanoja
@ -51,8 +51,8 @@ $set 1
48 Silmukan (while/foreach) ulkopuolella
49 Lisää prosesseja ei voida luoda
50 Ei vastaavuuksia (match)
51 Puuttuva %c
52 Ylimääräinen/pariton %c
51 Puuttuva '%c'
52 Ylimääräinen/pariton '%c'
53 Muisti loppu
54 Putkea ei voida luoda
55 %s: %s
@ -93,7 +93,7 @@ $set 1
90 Virheellinen korvaava merkkijono
91 Edellistä vasemmanpuolista merkkijonoa ei ole
92 Oikeanpuolinen merkkijono on liian pitkä
93 Virheellinen ! -muunnos: %c
93 Virheellinen ! -muunnos: '%c'
94 Muunnos epäonnistui
95 Korvauspuskurin ylivuoto
96 Virheellinen ! argumenttivalitsin
@ -118,7 +118,7 @@ $set 1
115 Päätetyypin kuvaukselle (termcap) ei ole tarpeeksi tilaa
116 Käyttö: settc %s [yes|no]
117 Tuntematon toiminne `%s'
118 Tuntematon päätetyypin (termcap) parameteri `%%%c'
118 Tuntematon päätetyypin (termcap) parameteri '%%%c'
119 Liian paljon argumentteja käskylle `%s' (%d)
120 `%s' edellyttää %d argumenttia
121 Käyttö: echotc [-v|-s] [<toiminne> [<argumentit>]]
@ -137,4 +137,4 @@ $set 1
134 Käyttö: unlimit [-fh] [rajoitteet (limits)]
135 Muuttujalle $%S ei voida asettaa arvoa
136 Viitattua työtä ei ole
137 Tuntematon colorls-muuttuja `%c%c'
137 Tuntematon colorls-muuttuja '%c%c'

View File

@ -1,4 +1,4 @@
$ $tcsh: set20,v 1.4 2011/02/04 18:19:34 christos Exp $
$ $tcsh: set20,v 1.5 2015/08/13 08:54:04 christos Exp $
$ tc.bind.c
$set 20
1 Invalid key name `%S'\n
@ -19,7 +19,7 @@ $set 20
16 -c interpret COMMAND as a builtin or external command\n
17 -v bind all keys to vi bindings\n
18 -e bind all keys to emacs bindings\n
19 -d bind all keys to default editor's bindings\n
19 -d bind all keys to default editor's bindings (%s)\n
20 -l list editor commands with descriptions\n
21 -r remove KEY's binding\n
22 -k interpret KEY as a symbolic arrow-key name\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set3,v 1.4 2011/02/04 18:19:34 christos Exp $
$ $tcsh: set3,v 1.5 2015/09/01 14:08:28 kim Exp $
$ Editor function descriptions
$set 3
1 Siirry taaksepäin yksi merkki
@ -114,11 +114,11 @@ $set 3
111 Vi: peruuta muutos
112 Vi: siirry rivin alkuun
113 Suorita 'which' tälle komennolle
114 Liimaa/lisää leikkauspuskurin sisältö kursorin paikalle
114 Liitä leikkauspuskurin sisältö kursorin paikalle
115 Korvaa viimeksi liimattu teksti aikaisemmalla leikkauksella
116 (WIN32 only) Copy cut buffer to system clipboard
117 (WIN32 only) Paste clipboard buffer at cursor position
118 (WIN32 only) Convert each '/' in next word to '\\\\'
119 (WIN32 only) Convert each '/' in previous word to '\\\\'
120 (WIN32 only) Page visible console window up
121 (WIN32 only) Page visible console window down
116 (Vain WIN32) Kopioi leikkauspuskuri leikepöydälle
117 (Vain WIN32) Liitä leikepöydän sisältö kursorin paikalle
118 (Vain WIN32) Muuta jokainen '/' seuraavassa sanassa merkkijonoksi '\\\\'
119 (Vain WIN32) Muuta jokainen '/' edellisessä sanassa merkkijonoksi '\\\\'
120 (Vain WIN32) Näytä konsoli-ikkunan edellinen sivu
121 (Vain WIN32) Näytä konsoli-ikkunan seuraava sivu

View File

@ -1,12 +1,12 @@
$ $tcsh: set9,v 1.3 2011/02/04 18:19:34 christos Exp $
$ $tcsh: set9,v 1.5 2015/09/01 14:08:28 kim Exp $
$ ed.xmap.c
$set 9
1 AddXkey: Null extended-key not allowed.\n
1 AddXkey: Tyhjää laajennettua näppäintä ei sallita.\n
2 AddXkey: sequence-lead-in command not allowed\n
3 DeleteXkey: Null extended-key not allowed.\n
3 DeleteXkey: Tyhjää laajennettua näppäintä ei sallita.\n
4 Sitomaton laajennettu näppäin "%S"\n
5 Jotkin laajennetut näppäimet ovat liian pitkiä sisäiseen tulostuspuskurille
5 Jotkin laajennetut näppäimet ovat liian pitkiä sisäiselle tulostuspuskurille
6 Enumerate: VIKA!! Välitetty null-osoitin\n!
7 ei syötettä
8 Jotain on seurattava: %c\n
8 Jotain on seurattava: '%c'\n
9 Oktaalivakio ei mahdu char-tyypin muuttujaan.\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set1,v 1.5 2011/02/04 18:19:35 christos Exp $
$ $tcsh: set1,v 1.6 2015/05/26 17:38:25 christos Exp $
$ Messages d 'erreur
$set 1
1 Erreur de syntaxe
@ -8,7 +8,7 @@ $set 1
5 Pas de fichier pour $0
6 Modificateur [] incomplet
7 $ l'expansion doit se terminer avant ]
8 Mauvais : modificateur dans $ (%c)
8 Mauvais : modificateur dans $ '%c'
9 Erreur d'indice
10 Numéro mal formé
11 Plus de mots
@ -51,8 +51,8 @@ $set 1
48 Vous n'êtes pas dans une boucle while ou foreach
49 Plus de processus
50 Pas de correspondance
51 %c manquant
52 %c sans correspondance
51 '%c' manquant
52 '%c' sans correspondance
53 Mémoire insuffisante
54 Impossible de créer un tube
55 %s: %s
@ -93,7 +93,7 @@ $set 1
90 Remplacement incorrect
91 Pas de partie gauche précédente
92 Partie droite trop longue
93 Modificateur ! incorrect: %c
93 Modificateur ! incorrect: '%c'
94 Echec du modificateur
95 Dépassement de capacité de la mémoire tampon de substitution
96 Sélecteur d'argument ! incorrect
@ -118,7 +118,7 @@ $set 1
115 Pas assez de place pour la chaine termcap
116 Syntaxe: settc %s [yes|no]
117 Capacité `%s' inconnue
118 Paramètre termcap inconnu `%%%c'
118 Paramètre termcap inconnu '%%%c'
119 Trop d'arguments pour `%s' (%d)
120 `%s' nécessite %d arguments
121 Syntaxe: echotc [-v|-s] [<capacité> [<args>]]
@ -137,4 +137,4 @@ $set 1
134 Syntaxe: unlimit [-fh] [limites]
135 $%S est en lecture seule
136 Pas de travail de ce type
137 Unknown colorls variable `%c%c'
137 Unknown colorls variable '%c%c'

View File

@ -1,4 +1,4 @@
$ $tcsh: set20,v 1.3 2011/02/04 18:19:35 christos Exp $
$ $tcsh: set20,v 1.4 2015/08/13 08:54:04 christos Exp $
$ tc.bind.c
$set 20
1 Nom de touche incorrect `%S'\n
@ -19,7 +19,7 @@ $set 20
16 -c interprète COMMANDE comme une commande intégrée ou externe\n
17 -v redéfinit toutes les touches pour vi\n
18 -e redéfinit toutes les touches pour emacs\n
19 -d redéfinit toutes les touches pour de l'éditeur par defaut\n
19 -d redéfinit toutes les touches pour de l'éditeur par defaut (%s)\n
20 -l liste les commandes de l'éditeur avec descriptions\n
21 -r enlève la correspondance pour la TOUCHE\n
22 -k interprète TOUCHE comme un nom de touche de direction symbolique\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set9,v 1.3 2011/02/04 18:19:36 christos Exp $
$ $tcsh: set9,v 1.4 2015/05/26 17:38:25 christos Exp $
$ ed.xmap.c
$set 9
1 AddXkey: touche d'extension nulle pas autorisé.\n
@ -8,5 +8,5 @@ $set 9
5 Certaines touches d'extension trop longues pour tampon d'impression interne
6 Enumerate: BUG!! Pointeur Null passé!\n
7 pas d'entrée
8 Quelque chose doit suivre: %c\n
8 Quelque chose doit suivre: '%c'\n
9 Une constante Octale ne peut pas tenir dans un caractère.\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set1,v 1.7 2011/02/04 18:19:36 christos Exp $
$ $tcsh: set1,v 1.8 2015/05/26 17:38:25 christos Exp $
$ Error messages
$set 1
1 Syntaxfehler
@ -8,7 +8,7 @@ $set 1
5 Keine Datei für $0
6 Unvollständiger [] Modifizierer
7 $ Ausweitung muß vor ] enden
8 Falscher : Modifizierer in $ (%c)
8 Falscher : Modifizierer in $ '%c'
9 Indexfehler
10 Falsche Nummer
11 Keine Worte mehr
@ -51,8 +51,8 @@ $set 1
48 Nicht in while/foreach
49 Keine Prozesse mehr
50 Kein Treffer
51 Fehlendes %c
52 Überflüssiges %c
51 Fehlendes '%c'
52 Überflüssiges '%c'
53 Kein Speicher mehr
54 Kann keine Pipe erzeugen
55 %s: %s
@ -93,7 +93,7 @@ $set 1
90 Falsche Ersetzung
91 Keine vorhergehende linke Seite
92 Rechte Seite zu lang
93 Falscher ! Modifizierer: %c
93 Falscher ! Modifizierer: '%c'
94 Modifizierer fehlgeschlagen
95 Überlauf des Ersetzungspuffers
96 Falscher ! Argumentbezeichner
@ -118,7 +118,7 @@ $set 1
115 Kein Platz mehr für Termcap-Eintrag
116 Benutzung: settc %s [yes|no]
117 Unbekannte Fähigkeit `%s'
118 Unbekannter Termcap-Parameter `%%%c'
118 Unbekannter Termcap-Parameter '%%%c'
119 Zu viele Argumente für `%s' (%d)
120 `%s' erfordert %d Argumente
121 Benutzung: echotc [-v|-s] [<Fähigkeit> [<Argumente>]]
@ -137,4 +137,4 @@ $set 1
134 Benutzung: unlimit [-fh] [Grenzen]
135 $%S ist nur lesbar
136 Kein solcher Job
137 Unknown colorls variable `%c%c'
137 Unknown colorls variable '%c%c'

View File

@ -1,4 +1,4 @@
$ $tcsh: set20,v 1.4 2011/02/04 18:19:36 christos Exp $
$ $tcsh: set20,v 1.5 2015/08/13 08:54:04 christos Exp $
$ tc.bind.c
$set 20
1 Ungültiger Tastenname `%S'\n
@ -19,7 +19,7 @@ $set 20
16 -c belege einen Unix-Befehl anstelle eines Befehls\n
17 -v initialisiere Belegungen mit Standard-Vi-Belegungen\n
18 -e initialisiere Belegungen mit Standard-Emacs-Belegungen\n
19 -d initialisiere Belegungen mit Standard-Belegungen\n
19 -d initialisiere Belegungen mit Standard-Belegungen (%s)\n
20 -l zeige verfügbare Funktionen mit Beschreibungen an\n
21 -r entferne Belegung eines Tastes\n
22 -k belege Pfeiltaste mit Namen in In-String\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set9,v 1.5 2011/02/04 18:19:37 christos Exp $
$ $tcsh: set9,v 1.6 2015/05/26 17:38:25 christos Exp $
$ ed.xmap.c
$set 9
1 AddXkey: Null extended-key not allowed.\n
@ -8,5 +8,5 @@ $set 9
5 Some extended keys too long for internal print buffer
6 Enumerate: BUG!! Null ptr passed\n!
7 keine Eingabe
8 Es muß noch etwas folgen: %c\n
8 Es muß noch etwas folgen: '%c'\n
9 Oktal-Konstante paßt nicht in ein Zeichen.\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set1,v 1.5 2011/02/04 18:19:37 christos Exp $
$ $tcsh: set1,v 1.6 2015/05/26 17:38:25 christos Exp $
$ Error messages
$set 1
1 Λάθος σύνταξη
@ -8,7 +8,7 @@ $set 1
5 Δεν υπάρχει αρχείο γιά το $0
6 Ελλιπής μετατροπέας []
7 Η ανάπτυξη του $ πρέπει να τελειώνει πριν το ]
8 Λάθος μετατροπέας : στο $ (%c)
8 Λάθος μετατροπέας : στο $ '%c'
9 Λάθος όρισμα
10 Κακοσχηματισμένος αριθμός
11 Δεν υπάρχουν άλλες λέξεις
@ -51,8 +51,8 @@ $set 1
48 Εκτός while/foreach
49 Δεν υπάρχουν άλλες διεργασίες
50 Δεν υπάρχει ταίριασμα
51 Απόν %c
52 Μη ταιριασμένο %c
51 Απόν '%c'
52 Μη ταιριασμένο '%c'
53 Δεν υπάρχει άλλη μνήμη
54 Δεν μπορώ να δημιουργήσω pipe
55 %s: %s
@ -93,7 +93,7 @@ $set 1
90 Λάθος αντικατάσταση
91 Δεν υπάρχει προηγούμενο αριστερό μέρος
92 Tο δεξί μέρος είναι πολύ μεγάλο
93 Κακός μετατροπέας !: %c
93 Κακός μετατροπέας !: '%c'
94 Ο μετατροπέας απέτυχε
95 Υπερχείλιση του buffer αντικαταστάσεων
96 Λάθος επιλογέας ορίσματος !
@ -118,7 +118,7 @@ $set 1
115 Δεν υπάρχει χώρος γιά το termcap string
116 Χρήση: settc %s [yes|no]
117 Αγνωστη ικανότητα `%s'
118 Αγνωστη παράμετρος του termcap `%%%c'
118 Αγνωστη παράμετρος του termcap '%%%c'
119 Υπερβολικά πολλά ορίσματα γιά το `%s' (%d)
120 Tο `%s' απαιτεί %d ορίσματα
121 Χρήση: echotc [-v|-s] [<ικανότητα> [<ορίσματα>]]
@ -137,4 +137,4 @@ $set 1
134 Χρήση: unlimit [-fh] [όρια]
135 Tο $%S είναι μόνο γιά διάβασμα
136 Δεν υπάρχει τέτοια εργασία
137 Unknown colorls variable `%c%c'
137 Unknown colorls variable '%c%c'

View File

@ -1,4 +1,4 @@
$ $tcsh: set20,v 1.5 2011/02/04 18:19:37 christos Exp $
$ $tcsh: set20,v 1.6 2015/08/13 08:54:04 christos Exp $
$ tc.bind.c
$set 20
1 Ακυρο όνομα πλήκτρου `%S'\n
@ -19,7 +19,7 @@ $set 20
16 -c ερμηνεία ΕΝΤΟΛΗς ως εσωτερικής ή εξωτερικής εντολής\n
17 -v συσχέτιση όλων των πλήκτρων σε αντιστοιχία vi\n
18 -e συσχέτιση όλων των πλήκτρων σε αντιστοιχία emacs\n
19 -d συσχέτιση όλων των πλήκτρων στην default του editor\n
19 -d συσχέτιση όλων των πλήκτρων στην default του editor (%s)\n
20 -l εμφάνιση των εντολών του editor με περιγραφές\n
21 -r κατάργηση συσχέτισης του ΠΛΗΚΤΡΟυ\n
22 -k ερμηνεία ΠΛΗΚΤΡΟυ ως συμβολικό όνομα πλήκτρου βέλους\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set9,v 1.4 2011/02/04 18:19:38 christos Exp $
$ $tcsh: set9,v 1.5 2015/05/26 17:38:25 christos Exp $
$ ed.xmap.c
$set 9
1 AddXkey: δεν επιτρέπεται μηδενικό extended-key.\n
@ -8,5 +8,5 @@ $set 9
5 Μερικά extended keys είναι πολύ μεγάλα γιά τον εσωτερικό print buffer
6 Enumerate: BUG!! Πέρασμα μηδενικού pointer!\n
7 δεν υπάρχει είσοδος
8 Κάτι πρέπει να ακολουθεί: %c\n
8 Κάτι πρέπει να ακολουθεί: '%c'\n
9 Η οκταδική σταθερά δε χωράει στο μέγεθος ενός char.\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set1,v 1.3 2011/02/04 18:19:38 christos Exp $
$ $tcsh: set1,v 1.4 2015/05/26 17:38:25 christos Exp $
$ Error messages
$set 1
1 Errore di Sintassi
@ -8,7 +8,7 @@ $set 1
5 Nessun file per $0
6 Modificatore [] incompleto
7 L'espansione $ deve terminare prima di ]
8 Modificatore sbagliato in $ (%c)
8 Modificatore sbagliato in $ '%c'
9 Errore di indice
10 Numero non corretto
11 Sono senza parole
@ -51,8 +51,8 @@ $set 1
48 Non in un while/foreach
49 Ho finito i processi
50 Corrispondenza non esistente
51 %c mancante
52 %c non corrispondente
51 '%c' mancante
52 '%c' non corrispondente
53 Memoria esaurita
54 Non posso creare una pipe
55 %s: %s
@ -93,7 +93,7 @@ $set 1
90 Sostituzione sbagliata
91 Non esiste il precedente lato sinistro
92 Lato destro troppo lungo
93 Modificatore ! errato: %c
93 Modificatore ! errato: '%c'
94 Il modificatore non ha funzionato
95 Overflow di buffer nella sostituzione
96 Errato selettore ! di argomento
@ -118,7 +118,7 @@ $set 1
115 Al di fuori dello spazio stringa del termcap
116 Utilizzo: settc %s [yes|no]
117 Capacità `%s' sconosciuta
118 Parametro del termcap `%%%c' sconosciuto
118 Parametro del termcap '%%%c' sconosciuto
119 Troppi argomenti per `%s' (%d)
120 `%s' richiede %d argomenti
121 Utilizzo: echotc [-v|-s] [<capacità> [<argomenti>]]
@ -137,4 +137,4 @@ $set 1
134 Utilizzo: unlimit [-fh] [limiti]
135 $%S è a sola lettura
136 Non esiste il lavoro
137 Variabile `%c%c colorls' sconosciuta
137 Variabile '%c%c colorls' sconosciuta

View File

@ -1,4 +1,4 @@
$ $tcsh: set20,v 1.3 2011/02/04 18:19:39 christos Exp $
$ $tcsh: set20,v 1.4 2015/08/13 08:54:04 christos Exp $
$ tc.bind.c
$set 20
1 Nome di tasto non corretto `%S'\n
@ -19,7 +19,7 @@ $set 20
16 -c interpreta COMANDO come un comando interno o esterno\n
17 -v definisce tutti i tasti alla 'vi'\n
18 -e definisce tutti i tasti alla 'emacs'\n
19 -d definisce tutti i tasti in base all'editor di default\n
19 -d definisce tutti i tasti in base all'editor di default (%s)\n
20 -l elenca i comandi di modifica testo con relativa descrizione\n
21 -r rimuove la definizione per TASTO\n
22 -k interpreta TASTO come un nome simbolico di tasto freccia\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set9,v 1.2 2006/03/02 18:46:47 christos Exp $
$ $tcsh: set9,v 1.3 2015/05/26 17:38:25 christos Exp $
$ ed.xmap.c
$set 9
1 AddXkey: tasto esteso nullo non ammesso.\n
@ -8,5 +8,5 @@ $set 9
5 Alcuni tasti estesi sono troppo grandi per il buffer interno di stampa
6 Enumerate: BACO!! ho ricevuto un puntatore nullo\n!
7 niente in ingresso
8 Qualcosa deve seguire: %c\n
8 Qualcosa deve seguire: '%c'\n
9 Costante ottale non adeguata per un char.\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set1,v 1.6 2011/02/04 18:19:39 christos Exp $
$ $tcsh: set1,v 1.7 2015/05/26 17:38:25 christos Exp $
$ Error messages
$set 1
1 文法が間違っています
@ -8,7 +8,7 @@ $set 1
5 $0 用のファイルがありません
6 [] 修飾子が不完全です
7 $ 展開は ] の前に終わる必要があります
8 $ 内の : 修飾子が間違っています (%c)
8 $ 内の : 修飾子が間違っています '%c'
9 配列の添え字が間違っています
10 番号が正しい書式になっていません
11 文字列はもうありません
@ -51,8 +51,8 @@ $set 1
48 while/foreachの中ではありません
49 プロセスを生成できません
50 照合パターンに合いません
51 %c が欠けている箇所があります
52 %c が対応しません
51 '%c' が欠けている箇所があります
52 '%c' が対応しません
53 メモリが不足しています
54 パイプを作れません
55 %s: %s
@ -93,7 +93,7 @@ $set 1
90 不正な置換です
91 直前の左サイドがありません
92 右サイドが長過ぎます
93 間違った ! 修飾子です: %c
93 間違った ! 修飾子です: '%c'
94 修飾子の失敗です
95 置換バッファがオーバーフローしました
96 間違った ! 引数のセレクターです
@ -118,7 +118,7 @@ $set 1
115 termcapの文字列領域不足です
116 形式: settc %s [yes|no]
117 知らないcapability `%s'
118 知らないtermcapパラメタ `%%%c'
118 知らないtermcapパラメタ '%%%c'
119 `%s' に対する引数が多過ぎます (%d)
120 `%s' には %d 引数が必要です
121 形式: echotc [-v|-s] [<capability> [<args>]]
@ -137,4 +137,4 @@ $set 1
134 形式: unlimit [-fh] [limits]
135 $%S は読取専用です
136 jobが見つかりません
137 不明のcolorls変数です `%c%c'
137 不明のcolorls変数です '%c%c'

View File

@ -1,4 +1,4 @@
$ $tcsh: set1,v 1.5 2011/02/04 18:19:41 christos Exp $
$ $tcsh: set1,v 1.6 2015/05/26 17:38:25 christos Exp $
$ Error messages
$set 1
1 Синтаксическая ошибка
@ -8,7 +8,7 @@ $set 1
5 Нет файла для $0
6 Незавершённый модификатор []
7 $ расширение должно оканчиваться перед ]
8 Плохой модификатор в $ (%c)
8 Плохой модификатор в $ '%c'
9 Ошибка подпрограммы
10 Неправильно сформированное число
11 Нет больше слов
@ -51,8 +51,8 @@ $set 1
48 Не внутри while/foreach
49 Нет больше процессов
50 Нет соответствий
51 Отсутствует %c
52 Нет соответствия для %c
51 Отсутствует '%c'
52 Нет соответствия для '%c'
53 Нет памяти
54 Не могу создать неименованный канал
55 %s: %s
@ -93,7 +93,7 @@ $set 1
90 Плохая подстановка
91 Отсутствует предыдущая левая сторона
92 Правая сторона слишком длинная
93 Плохой модификатор !: %c
93 Плохой модификатор !: '%c'
94 Ошибка модификатора
95 Переполнение буфера подстановки
96 Плохой селектор для аргумента !
@ -118,7 +118,7 @@ $set 1
115 Переполнение строки termcap
116 Использование: settc %s [yes|no]
117 Неизвестная capability `%s'
118 Неизвестный параметр termcap `%%%c'
118 Неизвестный параметр termcap '%%%c'
119 Слишком много аргументов для `%s' (%d)
120 `%s' требует %d аргументов
121 Использование: echotc [-v|-s] [<capability> [<аргументы>]]
@ -137,4 +137,4 @@ $set 1
134 Использование: unlimit [-fh] [пределы]
135 $%S только для чтения
136 Нет такого задания
137 Неизвестное значение `%c%c' переменной colorls
137 Неизвестное значение '%c%c' переменной colorls

View File

@ -1,4 +1,4 @@
$ $tcsh: set20,v 1.6 2011/02/04 18:19:42 christos Exp $
$ $tcsh: set20,v 1.7 2015/08/13 08:54:04 christos Exp $
$ tc.bind.c
$set 20
1 Неверное имя клавиши `%S'\n
@ -19,7 +19,7 @@ $set 20
16 -c воспринимать КОМАНДу как встроенную или внешнюю команду\n
17 -v привязать все клавиши в соответствии с редактором vi\n
18 -e привязать все клавиши в соответствии с редактором emacs\n
19 -d привязать все клавиши в соответствии с редактором по умолчанию\n
19 -d привязать все клавиши в соответствии с редактором по умолчанию (%s)\n
20 -l вывести список команд редактора и их описания\n
21 -r удалить привязку КЛАВИШи\n
22 -k воспринимать КЛАВИШу как явное название управляющей клавиши\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set9,v 1.4 2011/02/04 18:19:42 christos Exp $
$ $tcsh: set9,v 1.5 2015/05/26 17:38:25 christos Exp $
$ ed.xmap.c
$set 9
1 AddXkey: Null extended-key not allowed.\n
@ -8,5 +8,5 @@ $set 9
5 Some extended keys too long for internal print buffer
6 Enumerate: BUG!! Передан нулевой указатель!\n
7 нет вводимых данных
8 Something must follow: %c\n
8 Something must follow: '%c'\n
9 Восьмеричная константа не умещается в char.\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set1,v 1.4 2011/02/04 18:19:42 christos Exp $
$ $tcsh: set1,v 1.5 2015/05/26 17:38:25 christos Exp $
$ Mensajes de Error
$set 1
1 Error de sintaxis
@ -8,7 +8,7 @@ $set 1
5 No hay fichero para $0
6 Modificador [] incompleto
7 $ expansión debe terminar antes de ]
8 Modificador erróneo : en $ (%c)
8 Modificador erróneo : en $ '%c'
9 Error de índice
10 Número erróneamente formado
11 No hay más palabras
@ -51,8 +51,8 @@ $set 1
48 No se encuentra en bucle while/foreach
49 No hay más procesos
50 No existe correspondencia
51 Falta %c
52 No se ha hallado correspondencia con %c
51 Falta '%c'
52 No se ha hallado correspondencia con '%c'
53 Memoria insuficiente
54 No se puede crear la tubería
55 %s: %s
@ -93,7 +93,7 @@ $set 1
90 Sustituto erróneo
91 No existe `lado izquierdo' previo
92 Valor de asignación demasiado largo
93 Modificador de ! incorrecto: %c
93 Modificador de ! incorrecto: '%c'
94 Error de modificador
95 Desborde el el buffer de sustitución
96 Selector de argumento de ! erróneo
@ -118,7 +118,7 @@ $set 1
115 Se ha agotado el espacio para cadenas termcap
116 Uso: settc %s [yes|no]
117 Característica `%s' desconocida
118 Parámetro termcap `%%%c' desconocido
118 Parámetro termcap '%%%c' desconocido
119 Demasiados argumentos para `%s' (%d)
120 `%s' requiere %d argumentos
121 Uso: echotc [-v|-s] [<característica> [<args>]]
@ -137,4 +137,4 @@ $set 1
134 Uso: unlimit [-fh] [límites]
135 $%S es de sólo-lectura
136 No existe ese trabajo
137 Unknown colorls variable `%c%c'
137 Unknown colorls variable '%c%c'

View File

@ -1,4 +1,4 @@
$ $tcsh: set20,v 1.4 2011/02/04 18:19:43 christos Exp $
$ $tcsh: set20,v 1.5 2015/08/13 08:54:04 christos Exp $
$ tc.bind.c
$set 20
1 Nombre de tecla no válido `%S'\n
@ -19,7 +19,7 @@ $set 20
16 -c interpreta COMANDO como comando interno o externo\n
17 -v usa las definiciones del editor vi\n
18 -e usa las definiciones del editor vi\n
19 -d usa las definiciones del editor por defecto\n
19 -d usa las definiciones del editor por defecto (%s)\n
20 -l lista los comandos del editor y sus descripciones\n
21 -r elimina la definición asociada a TECLA\n
22 -k interpreta TECLA como nombre simbólico de tecla de flecha\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set9,v 1.3 2011/02/04 18:19:43 christos Exp $
$ $tcsh: set9,v 1.4 2015/05/26 17:38:25 christos Exp $
$ ed.xmap.c
$set 9
1 AddXkey: No se permite una tecla extendida nula.\n
@ -8,5 +8,5 @@ $set 9
5 Algunas teclas extendidas son demasiado grandes para el buffer de impresión interno
6 Enumerate: ¡¡BUG!! Se ha pasado un puntero nulo!\n
7 no hay entrada
8 Falta algo a continuación: %c\n
8 Falta algo a continuación: '%c'\n
9 Una constante octal no cabe en un carácter.\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set1,v 1.4 2011/02/04 18:19:44 christos Exp $
$ $tcsh: set1,v 1.5 2015/05/26 17:38:25 christos Exp $
$ Error messages
$set 1
1 Синтаксична помилка
@ -8,7 +8,7 @@ $set 1
5 Немає файлу для $0
6 Неповний модифікатор []
7 Розширення $ має бути перед ]
8 Поганий модифікатор : в $ (%c)
8 Поганий модифікатор : в $ '%c'
9 Помилковий індекс
10 Число погано сформоване
11 Не можна більше слів
@ -51,8 +51,8 @@ $set 1
48 Не у while/foreach
49 Не можна більше процесів
50 Немає співпадань
51 Пропущено %c
52 Відсутній відповідник до %c
51 Пропущено '%c'
52 Відсутній відповідник до '%c'
53 Мало пам'яті
54 Не можу створити канал
55 %s: %s
@ -93,7 +93,7 @@ $set 1
90 Погана підстановка
91 No previous left hand side
92 Right hand side too long
93 Поганий модифікатор !: %c
93 Поганий модифікатор !: '%c'
94 Невдача модифікатора
95 Переповнення буферу підстановки
96 Bad ! arg selector
@ -118,7 +118,7 @@ $set 1
115 Out of termcap string space
116 Використання: settc %s [yes|no]
117 Unknown capability `%s'
118 Невідомий параметр termcap `%%%c'
118 Невідомий параметр termcap '%%%c'
119 Забагато аргументів для `%s' (%d)
120 `%s' вимагає %d аргумент(ів)
121 Використання: echotc [-v|-s] [<capability> [<args>]]
@ -137,4 +137,4 @@ $set 1
134 Використання: unlimit [-fh] [ліміти]
135 $%S лише для читання
136 Немає такої задачі
137 Невідоме значення змінної colorls: `%c%c'
137 Невідоме значення змінної colorls: '%c%c'

View File

@ -1,4 +1,4 @@
$ $tcsh: set20,v 1.4 2011/02/04 18:19:44 christos Exp $
$ $tcsh: set20,v 1.5 2015/08/13 08:54:04 christos Exp $
$ tc.bind.c
$set 20
1 Invalid key name `%S'\n
@ -19,7 +19,7 @@ $set 20
16 -c interpret COMMAND as a builtin or external command\n
17 -v bind all keys to vi bindings\n
18 -e bind all keys to emacs bindings\n
19 -d bind all keys to default editor's bindings\n
19 -d bind all keys to default editor's bindings (%s)\n
20 -l list editor commands with descriptions\n
21 -r remove KEY's binding\n
22 -k interpret KEY as a symbolic arrow-key name\n

View File

@ -1,4 +1,4 @@
$ $tcsh: set9,v 1.4 2011/02/04 18:19:45 christos Exp $
$ $tcsh: set9,v 1.5 2015/05/26 17:38:25 christos Exp $
$ ed.xmap.c
$set 9
1 AddXkey: Null extended-key not allowed.\n
@ -8,5 +8,5 @@ $set 9
5 Some extended keys too long for internal print buffer
6 Enumerate: ПОМИЛКА!! Null ptr passed\n!
7 no input
8 Something must follow: %c\n
8 Something must follow: '%c'\n
9 Octal constant does not fit in a char.\n

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/patchlevel.h,v 3.180 2012/02/13 16:33:50 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/patchlevel.h,v 3.187 2016/11/24 15:04:52 christos Exp $ */
/*
* patchlevel.h: Our life story.
*/
@ -7,8 +7,8 @@
#define ORIGIN "Astron"
#define REV 6
#define VERS 18
#define PATCHLEVEL 1
#define DATE "2012-02-14"
#define VERS 20
#define PATCHLEVEL 00
#define DATE "2016-11-24"
#endif /* _h_patchlevel */

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.c,v 3.174 2011/11/29 18:38:54 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.c,v 3.189 2016/09/12 16:33:54 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.174 2011/11/29 18:38:54 christos Exp $")
RCSID("$tcsh: sh.c,v 3.189 2016/09/12 16:33:54 christos Exp $")
#include "tc.h"
#include "ed.h"
@ -78,7 +78,8 @@ extern int NLSMapsAreInited;
* ported to Apple Unix (TM) (OREO) 26 -- 29 Jun 1987
*/
jmp_buf_t reslab;
jmp_buf_t reslab IZERO_STRUCT;
struct wordent paraml IZERO_STRUCT;
static const char tcshstr[] = "tcsh";
@ -250,10 +251,11 @@ main(int argc, char **argv)
int osetintr;
struct sigaction oparintr;
(void)memset(&reslab, 0, sizeof(reslab));
#ifdef WINNT_NATIVE
nt_init();
#endif /* WINNT_NATIVE */
(void)memset(&reslab, 0, sizeof(reslab));
#if defined(NLS_CATALOGS) && defined(LC_MESSAGES)
(void) setlocale(LC_MESSAGES, "");
#endif /* NLS_CATALOGS && LC_MESSAGES */
@ -272,6 +274,7 @@ main(int argc, char **argv)
#endif
nlsinit();
initlex(&paraml);
#ifdef MALLOC_TRACE
mal_setstatsfile(fdopen(dmove(xopen("/tmp/tcsh.trace",
@ -343,6 +346,7 @@ main(int argc, char **argv)
# endif
#endif
STR_WORD_CHARS = SAVE(WORD_CHARS);
STR_WORD_CHARS_VI = SAVE(WORD_CHARS_VI);
HIST = '!';
HISTSUB = '^';
@ -355,6 +359,7 @@ main(int argc, char **argv)
/* Default history size to 100 */
setcopy(STRhistory, str2short("100"), VAR_READWRITE);
sethistory(100);
tempv = argv;
ffile = SAVE(tempv[0]);
@ -477,6 +482,9 @@ main(int argc, char **argv)
*/
initdesc();
cdtohome = 1;
setv(STRcdtohome, SAVE(""), VAR_READWRITE);
/*
* Get and set the tty now
*/
@ -493,6 +501,7 @@ main(int argc, char **argv)
}
else
setv(STRtty, cp = SAVE(""), VAR_READWRITE);
/*
* Initialize the shell variables. ARGV and PROMPT are initialized later.
* STATUS is also munged in several places. CHILD is munged when
@ -588,19 +597,22 @@ main(int argc, char **argv)
*/
shlvl(1);
#ifdef __ANDROID__
/* On Android, $HOME either isn't set or set to /data, a R/O location.
Check for the environment variable EXTERNAL_STORAGE, which contains
the mount point of the external storage (SD card, mostly). If
EXTERNAL_STORAGE isn't set fall back to "/sdcard". Eventually
override $HOME so the environment is on the same page. */
if (((tcp = getenv("HOME")) != NULL && strcmp (tcp, "/data") != 0)
|| (tcp = getenv("EXTERNAL_STORAGE")) != NULL) {
cp = quote(SAVE(tcp));
} else
cp = quote(SAVE("/sdcard"));
tsetenv(STRKHOME, cp);
#else
if ((tcp = getenv("HOME")) != NULL)
cp = quote(SAVE(tcp));
else
#ifdef __ANDROID__
/* On Android, $HOME usually isn't set, so we can't load user RC files.
Check for the environment variable EXTERNAL_STORAGE, which contains
the mount point of the external storage (SD card, mostly). If
EXTERNAL_STORAGE isn't set fall back to "/sdcard". */
if ((tcp = getenv("EXTERNAL_STORAGE")) != NULL)
cp = quote(SAVE(tcp));
else
cp = quote(SAVE("/sdcard"));
#else
cp = NULL;
#endif
@ -797,9 +809,12 @@ main(int argc, char **argv)
#ifdef COLOR_LS_F
if ((tcp = getenv("LS_COLORS")) != NULL)
parseLS_COLORS(str2short(tcp));
if ((tcp = getenv("LSCOLORS")) != NULL)
parseLSCOLORS(str2short(tcp));
#endif /* COLOR_LS_F */
doldol = putn((tcsh_number_t)getpid()); /* For $$ */
mainpid = getpid();
doldol = putn((tcsh_number_t)mainpid); /* For $$ */
#ifdef WINNT_NATIVE
{
char *tmp;
@ -818,7 +833,7 @@ main(int argc, char **argv)
#else /* !WINNT_NATIVE */
#ifdef HAVE_MKSTEMP
{
char *tmpdir = getenv ("TMPDIR");
const char *tmpdir = getenv ("TMPDIR");
if (!tmpdir)
tmpdir = "/tmp";
shtemp = Strspl(SAVE(tmpdir), SAVE("/sh" TMP_TEMPLATE)); /* For << */
@ -1215,14 +1230,14 @@ main(int argc, char **argv)
#ifdef NeXT
/* NeXT 2.0 /usr/etc/rlogind, does not set our process group! */
if (shpgrp == 0) {
if (f != -1 && shpgrp == 0) {
shpgrp = getpid();
(void) setpgid(0, shpgrp);
(void) tcsetpgrp(f, shpgrp);
}
#endif /* NeXT */
#ifdef BSDJOBS /* if we have tty job control */
if (grabpgrp(f, shpgrp) != -1) {
if (f != -1 && grabpgrp(f, shpgrp) != -1) {
/*
* Thanks to Matt Day for the POSIX references, and to
* Paul Close for the SGI clarification.
@ -1904,6 +1919,8 @@ pintr1(int wantnl)
{
(void) Cookedmode();
GettingInput = 0;
if (evalvec)
doneinp = 1;
}
drainoline();
#ifdef HAVE_GETPWENT
@ -2037,6 +2054,7 @@ process(int catch)
*/
if (setintr)
pintr_push_enable(&old_pintr_disabled);
freelex(&paraml);
hadhist = lex(&paraml);
if (setintr)
cleanup_until(&old_pintr_disabled);
@ -2178,6 +2196,7 @@ dosource(Char **t, struct command *c)
cleanup_push(file, xfree);
xfree(f);
t = glob_all_or_error(t);
cleanup_push(t, blk_cleanup);
if ((!srcfile(file, 0, hflg, t)) && (!hflg) && (!bequiet))
stderror(ERR_SYSTEM, file, strerror(errno));
cleanup_until(file);

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.char.h,v 3.36 2010/05/08 00:36:02 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.char.h,v 3.37 2014/05/09 19:22:49 christos Exp $ */
/*
* sh.char.h: Table for spotting special characters quickly
* Makes for very obscure but efficient coding.
@ -167,15 +167,15 @@ extern tcshuc _cmap_lower[], _cmap_upper[];
#define iscmdmeta(c) cmap((c), _CMD)
#ifdef WIDE_STRINGS
#define letter(c) (((c) & QUOTE) ? 0 : \
(iswalpha((tcshuc) (c)) || (c) == '_'))
(iswalpha((c)) || (c) == '_'))
#define alnum(c) (((c) & QUOTE) ? 0 : \
(iswalnum((tcshuc) (c)) || (c) == '_'))
(iswalnum((c)) || (c) == '_'))
#else
#define letter(c) (((Char)(c) & QUOTE) ? 0 : \
((isalpha((tcshuc) (c)) && !(cmap((c), _PUN))) \
((isalpha((c)) && !(cmap((c), _PUN))) \
|| (c) == '_'))
#define alnum(c) (((Char)(c) & QUOTE) ? 0 : \
((isalnum((tcshuc) (c)) && !(cmap((c), _PUN))) \
((isalnum((c)) && !(cmap((c), _PUN))) \
|| (c) == '_'))
#endif

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.decls.h,v 3.62 2011/02/25 23:58:34 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.decls.h,v 3.68 2016/08/01 16:21:09 christos Exp $ */
/*
* sh.decls.h External declarations from sh*.c
*/
@ -78,6 +78,7 @@ extern void loaddirs (Char *);
extern void Dfix (struct command *);
extern Char *Dfix1 (Char *);
extern void heredoc (Char *);
extern Char *randsuf (void);
/*
* sh.err.c
@ -184,6 +185,7 @@ extern void unalias (Char **, struct command *);
extern void wfree (void);
extern void dobuiltins (Char **, struct command *);
extern void reexecute (struct command *);
extern int getYN (const char *);
/*
* sh.glob.c
@ -221,6 +223,7 @@ extern char *fmthist (int, ptr_t);
extern void rechist (Char *, int);
extern void loadhist (Char *, int);
extern void displayHistStats(const char *);
extern void sethistory (int);
/*
* sh.init.c
@ -236,6 +239,7 @@ extern void btell (struct Ain *);
extern void btoeof (void);
extern void copylex (struct wordent *, struct wordent *);
extern Char *domod (Char *, Char);
extern void initlex (struct wordent *);
extern void freelex (struct wordent *);
extern int lex (struct wordent *);
extern void lex_cleanup (void *);
@ -243,6 +247,7 @@ extern void prlex (struct wordent *);
extern eChar readc (int);
extern void settell (void);
extern void unreadc (Char);
extern ssize_t wide_read (int, Char *, size_t, int);
/*
@ -397,6 +402,7 @@ extern void autoset_dspmbyte (const Char *);
#if defined(AUTOSET_KANJI)
extern void autoset_kanji (void);
#endif
extern void update_wordchars (void);
/*
* sh.time.c

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.dir.c,v 3.82 2011/10/16 16:25:05 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.dir.c,v 3.85 2016/04/08 16:10:52 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.82 2011/10/16 16:25:05 christos Exp $")
RCSID("$tcsh: sh.dir.c,v 3.85 2016/04/08 16:10:52 christos Exp $")
/*
* C Shell - directory management
@ -501,7 +501,9 @@ dochngd(Char **v, struct command *c)
cp = (dflag & DIR_OLD) ? varval(STRowd) : *v;
if (cp == NULL) {
if ((cp = varval(STRhome)) == STRNULL || *cp == 0)
if (!cdtohome)
stderror(ERR_NAME | ERR_TOOFEW);
else if ((cp = varval(STRhome)) == STRNULL || *cp == 0)
stderror(ERR_NAME | ERR_NOHOMEDIR);
if (chdir(short2str(cp)) < 0)
stderror(ERR_NAME | ERR_CANTCHANGE);
@ -674,6 +676,7 @@ dfollow(Char *cp, int old)
cleanup_until(cp);
return dgoto(cp);
}
xfree(dp);
}
xfree(buf.s);
}

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.dol.c,v 3.83 2011/01/25 20:10:46 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.dol.c,v 3.87 2014/08/13 23:39:34 amold Exp $ */
/*
* sh.dol.c: Variable substitutions
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: sh.dol.c,v 3.83 2011/01/25 20:10:46 christos Exp $")
RCSID("$tcsh: sh.dol.c,v 3.87 2014/08/13 23:39:34 amold Exp $")
/*
* C shell
@ -825,9 +825,8 @@ setDolp(Char *cp)
(void) Strcpy(np + diff, rhsub);
(void) Strcpy(np + diff + rhlen, dp + lhlen);
dp = np + diff + 1;
xfree(cp);
cp = np;
dp = cp = np;
cp[--len] = '\0';
didmod = 1;
if (diff >= (ssize_t)len)
@ -920,6 +919,19 @@ inheredoc_cleanup(void *dummy)
inheredoc = 0;
}
Char *
randsuf(void) {
#ifndef WINNT_NATIVE
struct timeval tv;
(void) gettimeofday(&tv, NULL);
return putn((((tcsh_number_t)tv.tv_sec) ^
((tcsh_number_t)tv.tv_usec) ^
((tcsh_number_t)getpid())) & 0x00ffffff);
#else
return putn(getpid());
#endif
}
/*
* Form a shell temporary file (in unit 0) from the words
* of the shell input up to EOF or a line the same as "term".
@ -950,7 +962,6 @@ heredoc(Char *term)
#else /* !HAVE_MKSTEMP */
char *tmp;
# ifndef WINNT_NATIVE
struct timeval tv;
again:
# endif /* WINNT_NATIVE */
@ -966,11 +977,8 @@ heredoc(Char *term)
# ifndef WINNT_NATIVE
if (errno == EEXIST) {
if (unlink(tmp) == -1) {
(void) gettimeofday(&tv, NULL);
xfree(shtemp);
mbp = putn((((tcsh_number_t)tv.tv_sec) ^
((tcsh_number_t)tv.tv_usec) ^
((tcsh_number_t)getpid())) & 0x00ffffff);
mbp = randsuf();
shtemp = Strspl(STRtmpsh, mbp);
xfree(mbp);
}

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.err.c,v 3.55 2011/02/25 23:58:34 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.err.c,v 3.57 2015/05/26 17:32:45 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.55 2011/02/25 23:58:34 christos Exp $")
RCSID("$tcsh: sh.err.c,v 3.57 2015/05/26 17:32:45 christos Exp $")
/*
* C Shell
@ -218,7 +218,7 @@ errinit(void)
elst[ERR_DOLZERO] = CSAVS(1, 5, "No file for $0");
elst[ERR_INCBR] = CSAVS(1, 6, "Incomplete [] modifier");
elst[ERR_EXPORD] = CSAVS(1, 7, "$ expansion must end before ]");
elst[ERR_BADMOD] = CSAVS(1, 8, "Bad : modifier in $ (%c)");
elst[ERR_BADMOD] = CSAVS(1, 8, "Bad : modifier in $ '%c'");
elst[ERR_SUBSCRIPT] = CSAVS(1, 9, "Subscript error");
elst[ERR_BADNUM] = CSAVS(1, 10, "Badly formed number");
elst[ERR_NOMORE] = CSAVS(1, 11, "No more words");
@ -262,8 +262,8 @@ errinit(void)
elst[ERR_NOTWHILE] = CSAVS(1, 48, "Not in while/foreach");
elst[ERR_NOPROC] = CSAVS(1, 49, "No more processes");
elst[ERR_NOMATCH] = CSAVS(1, 50, "No match");
elst[ERR_MISSING] = CSAVS(1, 51, "Missing %c");
elst[ERR_UNMATCHED] = CSAVS(1, 52, "Unmatched %c");
elst[ERR_MISSING] = CSAVS(1, 51, "Missing '%c'");
elst[ERR_UNMATCHED] = CSAVS(1, 52, "Unmatched '%c'");
elst[ERR_NOMEM] = CSAVS(1, 53, "Out of memory");
elst[ERR_PIPE] = CSAVS(1, 54, "Can't make pipe");
elst[ERR_SYSTEM] = CSAVS(1, 55, "%s: %s");
@ -309,7 +309,7 @@ errinit(void)
elst[ERR_BADSUBST] = CSAVS(1, 90, "Bad substitute");
elst[ERR_LHS] = CSAVS(1, 91, "No previous left hand side");
elst[ERR_RHSLONG] = CSAVS(1, 92, "Right hand side too long");
elst[ERR_BADBANGMOD] = CSAVS(1, 93, "Bad ! modifier: %c");
elst[ERR_BADBANGMOD] = CSAVS(1, 93, "Bad ! modifier: '%c'");
elst[ERR_MODFAIL] = CSAVS(1, 94, "Modifier failed");
elst[ERR_SUBOVFL] = CSAVS(1, 95, "Substitution buffer overflow");
elst[ERR_BADBANGARG] = CSAVS(1, 96, "Bad ! arg selector");
@ -335,7 +335,7 @@ errinit(void)
elst[ERR_TCNOSTR] = CSAVS(1, 115, "Out of termcap string space");
elst[ERR_SETTCUS] = CSAVS(1, 116, "Usage: settc %s [yes|no]");
elst[ERR_TCCAP] = CSAVS(1, 117, "Unknown capability `%s'");
elst[ERR_TCPARM] = CSAVS(1, 118, "Unknown termcap parameter `%%%c'");
elst[ERR_TCPARM] = CSAVS(1, 118, "Unknown termcap parameter '%%%c'");
elst[ERR_TCARGS] = CSAVS(1, 119, "Too many arguments for `%s' (%d)");
elst[ERR_TCNARGS] = CSAVS(1, 120, "`%s' requires %d arguments");
elst[ERR_TCUSAGE] = CSAVS(1, 121,
@ -365,7 +365,7 @@ errinit(void)
elst[ERR_ULIMUS] = CSAVS(1, 134, "Usage: unlimit [-fh] [limits]");
elst[ERR_READONLY] = CSAVS(1, 135, "$%S is read-only");
elst[ERR_BADJOB] = CSAVS(1, 136, "No such job (badjob)");
elst[ERR_BADCOLORVAR] = CSAVS(1, 137, "Unknown colorls variable `%c%c'");
elst[ERR_BADCOLORVAR] = CSAVS(1, 137, "Unknown colorls variable '%c%c'");
elst[ERR_EOF] = CSAVS(1, 138, "Unexpected end of file");
}
@ -380,10 +380,10 @@ struct cleanup_entry
#endif
};
static struct cleanup_entry *cleanup_stack; /* = NULL; */
static size_t cleanup_sp; /* = 0; Next free entry */
static size_t cleanup_mark; /* = 0; Last entry to handle before unwinding */
static size_t cleanup_stack_size; /* = 0 */
static struct cleanup_entry *cleanup_stack INIT_ZERO; /* = NULL; */
static size_t cleanup_sp INIT_ZERO; /* = 0; Next free entry */
static size_t cleanup_mark INIT_ZERO; /* = 0; Last entry to handle before unwinding */
static size_t cleanup_stack_size INIT_ZERO; /* = 0 */
/* fn() will be run with all signals blocked, so it should not do anything
risky. */

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.exec.c,v 3.79 2011/02/25 23:58:34 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.exec.c,v 3.81 2016/09/12 16:33:54 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.79 2011/02/25 23:58:34 christos Exp $")
RCSID("$tcsh: sh.exec.c,v 3.81 2016/09/12 16:33:54 christos Exp $")
#include "tc.h"
#include "tw.h"
@ -606,9 +606,10 @@ execash(Char **t, struct command *kp)
cleanup_push(&state, execash_cleanup);
/*
* Decrement the shell level
* Decrement the shell level, if not in a subshell
*/
shlvl(-1);
if (mainpid == getpid())
shlvl(-1);
#ifdef WINNT_NATIVE
__nt_really_exec=1;
#endif /* WINNT_NATIVE */
@ -1070,6 +1071,9 @@ dowhere(Char **v, struct command *c)
{
int found = 1;
USE(c);
if (adrof(STRautorehash))
dohash(NULL, NULL);
for (v++; *v; v++)
found &= find_cmd(*v, 1);
/* Make status nonzero if any command is not found. */
@ -1166,7 +1170,11 @@ find_cmd(Char *cmd, int prt)
return rval;
}
}
if (adrof(STRautorehash) && !rehashed && havhash) {
/*
* If we are printing, we are being called from dowhere() which it
* has rehashed already
*/
if (!prt && adrof(STRautorehash) && !rehashed && havhash) {
dohash(NULL, NULL);
rehashed = 1;
goto retry;

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.exp.c,v 3.58 2011/12/25 15:21:50 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.exp.c,v 3.63 2015/12/09 17:17:43 christos Exp $ */
/*
* sh.exp.c: Expression evaluations
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: sh.exp.c,v 3.58 2011/12/25 15:21:50 christos Exp $")
RCSID("$tcsh: sh.exp.c,v 3.63 2015/12/09 17:17:43 christos Exp $")
#include "tw.h"
@ -172,6 +172,7 @@ sh_access(const Char *fname, int mode)
mode <<= 3;
break;
}
xfree(groups);
}
}
# endif /* NGROUPS_MAX */
@ -322,7 +323,7 @@ exp2c(Char ***vp, int ignore)
cleanup_push(p2, xfree);
etracc("exp2c p2", p2, vp);
if (!(ignore & TEXP_IGNORE))
switch (i) {
switch ((int)i) {
case EQEQ:
i = eq(p1, p2);
@ -367,7 +368,7 @@ exp3(Char ***vp, int ignore)
cleanup_push(p2, xfree);
etracc("exp3 p2", p2, vp);
if (!(ignore & TEXP_IGNORE))
switch (i) {
switch ((int)i) {
case GTR:
i = egetn(p1) > egetn(p2);
@ -632,7 +633,7 @@ filetest(Char *cp, Char ***vp, int ignore)
int altout = 0;
Char *ft = cp, *dp, *ep, *strdev, *strino, *strF, *str, valtest = '\0',
*errval = STR0;
char *string, string0[22 + MB_LEN_MAX + 1]; // space for 64 bit octal
char *string, string0[22 + MB_LEN_MAX + 1]; /* space for 64 bit octal */
time_t footime;
struct passwd *pw;
struct group *gr;
@ -954,8 +955,7 @@ evalav(Char **v)
struct wordent *wdp = hp;
setcopy(STRstatus, STR0, VAR_READWRITE);
hp->prev = hp->next = hp;
hp->word = STRNULL;
initlex(hp);
while (*v) {
struct wordent *new = xcalloc(1, sizeof *wdp);

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.file.c,v 3.37 2010/02/09 20:21:49 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.file.c,v 3.40 2016/04/16 14:08:14 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.37 2010/02/09 20:21:49 christos Exp $")
RCSID("$tcsh: sh.file.c,v 3.40 2016/04/16 14:08:14 christos Exp $")
#if defined(FILEC) && defined(TIOCSTI)
@ -231,7 +231,7 @@ pushback(const Char *string)
# ifdef POSIX
(void) tcgetattr(SHOUT, &tty);
# else
(void) ioctl(SHOUT, TCSETAW, (ioctl_t) &tty);
(void) ioctl(SHOUT, TCGETA, (ioctl_t) &tty);
# endif /* POSIX */
tty_normal = tty;
tty.c_lflag &= ~(ECHOKE | ECHO | ECHOE | ECHOK | ECHONL |
@ -249,7 +249,7 @@ pushback(const Char *string)
char buf[MB_LEN_MAX];
size_t i, len;
len = one_wctomb(buf, *p & CHAR);
len = one_wctomb(buf, *p);
for (i = 0; i < len; i++)
(void) ioctl(SHOUT, TIOCSTI, (ioctl_t) &buf[i]);
}
@ -564,7 +564,7 @@ tsearch(Char *word, COMMAND command, size_t max_word_length)
}
if (looking_for_lognames) {
#ifndef HAVE_GETPWENT
#ifdef HAVE_GETPWENT
(void) endpwent();
#endif
} else

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.func.c,v 3.162 2011/02/26 00:07:06 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.func.c,v 3.176 2016/10/18 17:26:42 christos Exp $ */
/*
* sh.func.c: csh builtin functions
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: sh.func.c,v 3.162 2011/02/26 00:07:06 christos Exp $")
RCSID("$tcsh: sh.func.c,v 3.176 2016/10/18 17:26:42 christos Exp $")
#include "ed.h"
#include "tw.h"
@ -799,8 +799,16 @@ search(int type, int level, Char *goal)
break;
case TC_IF:
while (getword(&word))
while (getword(&word)) {
if (intty) {
histent->word = Strsave(word.s);
histent->next = xmalloc(sizeof(*histent));
histent->next->prev = histent;
histent = histent->next;
}
continue;
}
if ((type == TC_IF || type == TC_ELSE) &&
eq(word.s, STRthen))
level++;
@ -893,7 +901,7 @@ search(int type, int level, Char *goal)
static struct wordent *
histgetword(struct wordent *histent)
{
int found = 0, first;
int first;
eChar c, d;
int e;
struct Strbuf *tmp;
@ -917,7 +925,6 @@ histgetword(struct wordent *histent)
if (c == '\n')
goto nl;
unreadc(c);
found = 1;
first = 1;
do {
e = (c == '\\');
@ -1038,6 +1045,17 @@ getword(struct Strbuf *wp)
goto past;
if (wp)
Strbuf_append1(wp, (Char) c);
if (!d && c == ')') {
if (!first && wp) {
goto past_word_end;
} else {
if (wp) {
wp->len = 1;
Strbuf_terminate(wp);
}
return found;
}
}
if (!first && !d && c == '(') {
if (wp)
goto past_word_end;
@ -1381,7 +1399,7 @@ dosetenv(Char **v, struct command *c)
stderror(ERR_NAME | ERR_VARBEGIN);
do {
lp++;
} while (alnum(*lp));
} while (alnum(*lp) || *lp == '.');
if (*lp != '\0')
stderror(ERR_NAME | ERR_VARALNUM);
@ -1543,6 +1561,11 @@ dosetenv(Char **v, struct command *c)
cleanup_until(lp);
return;
}
if (eq(vp, STRLSCOLORS)) {
parseLSCOLORS(lp);
cleanup_until(lp);
return;
}
#endif /* COLOR_LS_F */
#ifdef SIG_WINDOW
@ -1670,6 +1693,8 @@ dounsetenv(Char **v, struct command *c)
#ifdef COLOR_LS_F
else if (eq(name, STRLS_COLORS))
parseLS_COLORS(n);
else if (eq(name, STRLSCOLORS))
parseLSCOLORS(n);
#endif /* COLOR_LS_F */
#ifdef NLS_CATALOGS
else if (eq(name, STRNLSPATH)) {
@ -1927,6 +1952,14 @@ struct limits limits[] =
{ RLIMIT_NOFILE, "descriptors", 1, "" },
# endif /* RLIMIT_NOFILE */
# ifdef RLIMIT_NPTS
{ RLIMIT_NPTS, "pseudoterminals", 1, "" },
# endif /* RLIMIT_NPTS */
# ifdef RLIMIT_KQUEUES
{ RLIMIT_KQUEUES, "kqueues", 1, "" },
# endif /* RLIMIT_KQUEUES */
# ifdef RLIMIT_CONCUR
{ RLIMIT_CONCUR, "concurrency", 1, "thread(s)" },
# endif /* RLIMIT_CONCUR */
@ -1939,6 +1972,10 @@ struct limits limits[] =
{ RLIMIT_NPROC, "maxproc", 1, "" },
# endif /* RLIMIT_NPROC */
# ifdef RLIMIT_NTHR
{ RLIMIT_NTHR, "maxthread", 1, "" },
# endif /* RLIMIT_NTHR */
# if defined(RLIMIT_OFILE) && !defined(RLIMIT_NOFILE)
{ RLIMIT_OFILE, "openfiles", 1, "" },
# endif /* RLIMIT_OFILE && !defined(RLIMIT_NOFILE) */
@ -1955,6 +1992,10 @@ struct limits limits[] =
{ RLIMIT_LOCKS, "maxlocks", 1, "" },
# endif /* RLIMIT_LOCKS */
# ifdef RLIMIT_POSIXLOCKS
{ RLIMIT_POSIXLOCKS,"posixlocks", 1, "" },
# endif /* RLIMIT_POSIXLOCKS */
# ifdef RLIMIT_SIGPENDING
{ RLIMIT_SIGPENDING,"maxsignal", 1, "" },
# endif /* RLIMIT_SIGPENDING */
@ -2407,12 +2448,20 @@ doeval_cleanup(void *xstate)
didcch = state->didcch;
#endif /* CLOSE_ON_EXEC */
didfds = state->didfds;
xclose(SHIN);
xclose(SHOUT);
xclose(SHDIAG);
if (state->saveIN != SHIN)
xclose(SHIN);
if (state->saveOUT != SHOUT)
xclose(SHOUT);
if (state->saveDIAG != SHDIAG)
xclose(SHDIAG);
close_on_exec(SHIN = dmove(state->saveIN, state->SHIN), 1);
close_on_exec(SHOUT = dmove(state->saveOUT, state->SHOUT), 1);
close_on_exec(SHDIAG = dmove(state->saveDIAG, state->SHDIAG), 1);
if (didfds) {
close_on_exec(dcopy(SHIN, 0), 1);
close_on_exec(dcopy(SHOUT, 1), 1);
close_on_exec(dcopy(SHDIAG, 2), 1);
}
}
static Char **Ggv;
@ -2681,3 +2730,20 @@ nlsclose(void)
}
#endif /* NLS_CATALOGS */
}
int
getYN(const char *prompt)
{
int doit, c;
xprintf("%s", prompt);
flush();
(void) force_read(SHIN, &c, 1);
/*
* Perhaps we should use the yesexpr from the
* actual locale
*/
doit = (strchr(CGETS(22, 14, "Yy"), c) != NULL);
while (c != '\n' && force_read(SHIN, &c, 1) == 1)
continue;
return doit;
}

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.glob.c,v 3.82 2011/02/27 00:15:17 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.glob.c,v 3.95 2016/08/01 16:21:09 christos Exp $ */
/*
* sh.glob.c: Regular expression expansion
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: sh.glob.c,v 3.82 2011/02/27 00:15:17 christos Exp $")
RCSID("$tcsh: sh.glob.c,v 3.95 2016/08/01 16:21:09 christos Exp $")
#include "tc.h"
#include "tw.h"
@ -594,8 +594,13 @@ trim(Char **t)
Char *p;
while ((p = *t++) != '\0')
while (*p)
*p++ &= TRIM;
while (*p) {
#if INVALID_BYTE != 0
if ((*p & INVALID_BYTE) != INVALID_BYTE) /* *p < INVALID_BYTE */
#endif
*p &= TRIM;
p++;
}
}
int
@ -699,11 +704,15 @@ backeval(struct blk_buf *bb, struct Strbuf *word, Char *cp, int literal)
int hadnl;
int pvec[2], quoted;
Char *fakecom[2], ibuf[BUFSIZE];
char tibuf[BUFSIZE];
hadnl = 0;
icnt = 0;
quoted = (literal || (cp[0] & QUOTE)) ? QUOTE : 0;
if (!literal) {
for (ip = cp; (*ip & QUOTE) != 0; ip++)
continue;
quoted = *ip == '\0';
} else
quoted = literal;
faket.t_dtyp = NODE_COMMAND;
faket.t_dflg = F_BACKQ;
faket.t_dlef = 0;
@ -760,6 +769,9 @@ backeval(struct blk_buf *bb, struct Strbuf *word, Char *cp, int literal)
omark = cleanup_push_mark();
getexit(osetexit);
for (;;) {
struct wordent paraml1;
initlex(&paraml1);
(void) setexit();
justpr = 0;
@ -775,19 +787,19 @@ backeval(struct blk_buf *bb, struct Strbuf *word, Char *cp, int literal)
seterr = NULL;
}
(void) lex(&paraml);
cleanup_push(&paraml, lex_cleanup);
freelex(&paraml1);
(void) lex(&paraml1);
cleanup_push(&paraml1, lex_cleanup);
if (seterr)
stderror(ERR_OLD);
alias(&paraml);
t = syntax(paraml.next, &paraml, 0);
if (t == NULL)
return;
alias(&paraml1);
t = syntax(paraml1.next, &paraml1, 0);
cleanup_push(t, syntax_cleanup);
/* The F_BACKQ flag must set so the job output is correct if
* printexitvalue is set. If it's not set, the job output
* will have "Exit N" appended where N is the exit status. */
t->t_dflg = F_BACKQ|F_NOFORK;
if (t)
t->t_dflg = F_BACKQ|F_NOFORK;
if (seterr)
stderror(ERR_OLD);
#ifdef SIGTSTP
@ -801,7 +813,7 @@ backeval(struct blk_buf *bb, struct Strbuf *word, Char *cp, int literal)
#endif
execute(t, -1, NULL, NULL, TRUE);
cleanup_until(&paraml);
cleanup_until(&paraml1);
}
}
cleanup_until(&pvec[1]);
@ -809,45 +821,13 @@ backeval(struct blk_buf *bb, struct Strbuf *word, Char *cp, int literal)
ip = NULL;
do {
ssize_t cnt = 0;
char *tmp;
tmp = tibuf;
for (;;) {
while (icnt == 0) {
int i, eof;
if (icnt == 0) {
ip = ibuf;
icnt = xread(pvec[0], tmp, tibuf + BUFSIZE - tmp);
eof = 0;
if (icnt <= 0) {
if (tmp == tibuf)
goto eof;
icnt = 0;
eof = 1;
}
icnt += tmp - tibuf;
i = 0;
tmp = tibuf;
while (tmp < tibuf + icnt) {
int len;
len = normal_mbtowc(&ip[i], tmp, tibuf + icnt - tmp);
if (len == -1) {
reset_mbtowc();
if (!eof && (size_t)(tibuf + icnt - tmp) < MB_CUR_MAX) {
break; /* Maybe a partial character */
}
ip[i] = (unsigned char) *tmp | INVALID_BYTE; /* Error */
}
if (len <= 0)
len = 1;
i++;
tmp += len;
}
if (tmp != tibuf)
memmove (tibuf, tmp, tibuf + icnt - tmp);
tmp = tibuf + (tibuf + icnt - tmp);
icnt = i;
icnt = wide_read(pvec[0], ibuf, BUFSIZE, 0);
if (icnt <= 0)
goto eof;
}
if (hadnl)
break;
@ -870,7 +850,9 @@ backeval(struct blk_buf *bb, struct Strbuf *word, Char *cp, int literal)
if (!quoted && (c == ' ' || c == '\t'))
break;
cnt++;
Strbuf_append1(word, c | quoted);
if (c == '\\' || quoted)
c |= QUOTE;
Strbuf_append1(word, c);
}
/*
* Unless at end-of-file, we will form a new word here if there were

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.h,v 3.165 2011/04/14 18:25:25 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.h,v 3.178 2016/09/12 16:33:54 christos Exp $ */
/*
* sh.h: Catch it all globals and includes file!
*/
@ -127,6 +127,11 @@ typedef int eChar;
#if !defined(__inline) && !defined(__GNUC__) && !defined(_MSC_VER)
#define __inline
#endif
#ifdef _MSC_VER
#define TCSH_PTRDIFF_T_FMT "I"
#else
#define TCSH_PTRDIFF_T_FMT "t"
#endif
/* Elide unused argument warnings */
#define USE(a) (void) (a)
#define TCSH_IGNORE(a) tcsh_ignore((intptr_t)a)
@ -188,6 +193,11 @@ static __inline void tcsh_ignore(intptr_t a)
# endif /* SYSVREL */
#endif /* ECHO_STYLE */
/* values for noclobber */
#define NOCLOBBER_DEFAULT 1
#define NOCLOBBER_NOTEMPTY 2
#define NOCLOBBER_ASK 4
/*
* The shell moves std in/out/diag and the old std input away from units
* 0, 1, and 2 so that it is easy to set up these standards for invoked
@ -428,9 +438,7 @@ typedef long tcsh_number_t;
# if (defined(_SS_SIZE) || defined(_SS_MAXSIZE)) && defined(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)
# if !defined(__APPLE__) /* Damnit, where is getnameinfo() folks? */
# if !defined(sgi)
# if !defined(__CYGWIN__)
# define INET6
# endif /* __CYGWIN__ */
# define INET6
# endif /* sgi */
# endif /* __APPLE__ */
# endif
@ -440,21 +448,7 @@ typedef long tcsh_number_t;
#ifdef PURIFY
/* exit normally, allowing purify to trace leaks */
# define _exit exit
typedef int pret_t;
#else /* !PURIFY */
/*
* If your compiler complains, then you can either
* throw it away and get gcc or, use the following define
* and get rid of the typedef.
* [The 4.2/3BSD vax compiler does not like that]
* Both MULTIFLOW and PCC compilers exhbit this bug. -- sterling@netcom.com
*/
# if (defined(vax) || defined(uts) || defined(MULTIFLOW) || defined(PCC)) && !defined(__GNUC__)
# define pret_t void
# else /* !((vax || uts || MULTIFLOW || PCC) && !__GNUC__) */
typedef void pret_t;
# endif /* (vax || uts || MULTIFLOW || PCC) && !__GNUC__ */
#endif /* PURIFY */
#endif /* !PURIFY */
/*
* ASCII vs. EBCDIC
@ -573,7 +567,7 @@ EXTERN int neednote IZERO; /* Need to pnotify() */
EXTERN int noexec IZERO; /* Don't execute, just syntax check */
EXTERN int pjobs IZERO; /* want to print jobs if interrupted */
EXTERN int setintr IZERO; /* Set interrupts on/off -> Wait intr... */
EXTERN int handle_intr IZERO;/* Are we currently handling an interrupt? */
EXTERN int handle_interrupt IZERO;/* Are we currently handling an interrupt? */
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 */
@ -585,8 +579,10 @@ EXTERN int isdiagatty IZERO;/* is SHDIAG a tty */
EXTERN int is1atty IZERO; /* is file descriptor 1 a tty (didfds mode) */
EXTERN int is2atty IZERO; /* is file descriptor 2 a tty (didfds mode) */
EXTERN int arun IZERO; /* Currently running multi-line-aliases */
EXTERN int implicit_cd IZERO;/* implicit cd enabled?(1=enabled,2=verbose) */
EXTERN int implicit_cd IZERO;/* implicit cd enabled?(1=enabled,2=verbose) */
EXTERN int cdtohome IZERO; /* cd without args goes home */
EXTERN int inheredoc IZERO; /* Currently parsing a heredoc */
EXTERN int no_clobber IZERO; /* no clobber enabled? 1=yes 2=notempty, 4=ask*/
/* We received a window change event */
EXTERN volatile sig_atomic_t windowchg IZERO;
#if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
@ -635,9 +631,11 @@ EXTERN time_t seconds0;
/*
* Miscellany
*/
EXTERN pid_t mainpid; /* pid of the main shell ($$) */
EXTERN Char *doldol; /* Character pid for $$ */
EXTERN pid_t backpid; /* pid of the last background job */
/*
* Ideally these should be uid_t, gid_t, pid_t. I cannot do that right now
* cause pid's could be unsigned and that would break our -1 flag, and
@ -717,14 +715,21 @@ extern struct sigaction parterm; /* Parents terminate catch */
#define ASCII 0177
#ifdef WIDE_STRINGS /* Implies SHORT_STRINGS */
/* 31st char bit used for 'ing (not 32nd, we want all values nonnegative) */
# define QUOTE 0x40000000
# define TRIM 0x3FFFFFFF /* Mask to strip quote bit */
/*
* Notice
*
* By fix for handling unicode name file, 32nd bit is used.
* We need use '&' instead of '> or <' when comparing with INVALID_BYTE etc..
* Cast to uChar is not recommended,
* becase Char is 4bytes but uChar is 8bytes on I32LP64. */
# define QUOTE 0x80000000
# define TRIM 0x7FFFFFFF /* Mask to strip quote bit */
# 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 */
# define INVALID_BYTE 0xF0000000 /* Invalid character on input */
# ifdef SOLARIS2
# define CHAR 0x30FFFFFF /* Mask to mask out the character */
# else
@ -753,6 +758,8 @@ extern struct sigaction parterm; /* Parents terminate catch */
#endif
#define CHAR_DBWIDTH (LITERAL|(LITERAL-1))
# define MAX_UTF32 0x7FFFFFFF /* max UTF32 is U+7FFFFFFF */
EXTERN int AsciiOnly; /* If set only 7 bits expected in characters */
/*
@ -1020,10 +1027,6 @@ EXTERN Char **alvec IZERO_STRUCT,
* Filename/command name expansion variables
*/
#ifdef __CYGWIN__
# undef MAXPATHLEN
#endif /* __CYGWIN__ */
#ifndef MAXPATHLEN
# ifdef PATH_MAX
# define MAXPATHLEN PATH_MAX
@ -1065,7 +1068,7 @@ EXTERN struct Hist {
unsigned Hhash; /* hash value of command line */
} Histlist IZERO_STRUCT;
EXTERN struct wordent paraml; /* Current lexical word list */
extern struct wordent paraml; /* Current lexical word list */
EXTERN int eventno; /* Next events number */
EXTERN int lastev; /* Last event reference (default) */
@ -1166,12 +1169,14 @@ extern struct mesg {
const char *pname; /* print name */
} mesg[];
/* word_chars is set by default to WORD_CHARS but can be overridden by
the worchars variable--if unset, reverts to WORD_CHARS */
/* word_chars is set by default to WORD_CHARS (or WORD_CHARS_VI) but can
be overridden by the wordchars variable--if unset, reverts to
WORD_CHARS (or WORD_CHARS_VI) */
EXTERN Char *word_chars;
#define WORD_CHARS "*?_-.[]~=" /* default chars besides alnums in words */
#define WORD_CHARS_VI "_" /* default chars besides alnums in words */
EXTERN Char *STR_SHELLPATH;
@ -1179,6 +1184,7 @@ EXTERN Char *STR_SHELLPATH;
EXTERN Char *STR_BSHELL;
#endif
EXTERN Char *STR_WORD_CHARS;
EXTERN Char *STR_WORD_CHARS_VI;
EXTERN Char **STR_environ IZERO;
extern int dont_free; /* Tell free that we are in danger if we free */

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.hist.c,v 3.53 2011/01/24 18:10:26 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.hist.c,v 3.61 2015/06/06 21:19:08 christos Exp $ */
/*
* sh.hist.c: Shell history expansions and substitutions
*/
@ -32,10 +32,12 @@
*/
#include "sh.h"
RCSID("$tcsh: sh.hist.c,v 3.53 2011/01/24 18:10:26 christos Exp $")
RCSID("$tcsh: sh.hist.c,v 3.61 2015/06/06 21:19:08 christos Exp $")
#include <stdio.h> /* for rename(2), grr. */
#include <assert.h>
#include "tc.h"
#include "dotlock.h"
extern int histvalid;
extern struct Strbuf histline;
@ -68,12 +70,12 @@ static void hfree (struct Hist *);
static const int fastMergeErase = 1;
static unsigned histCount = 0; /* number elements on history list */
static int histlen = 0;
static struct Hist *histTail = NULL; /* last element on history list */
static struct Hist *histMerg = NULL; /* last element merged by Htime */
static void insertHistHashTable(struct Hist *, unsigned);
/* Insert new element (hp) in history list after specified predecessor (pp). */
static void
hinsert(struct Hist *hp, struct Hist *pp)
@ -107,7 +109,7 @@ hremove(struct Hist *hp)
/* Prune length of history list to specified size by history variable. */
PG_STATIC void
discardExcess(int histlen)
discardExcess(int hlen)
{
struct Hist *hp, *np;
if (histTail == NULL) {
@ -117,23 +119,23 @@ discardExcess(int histlen)
/* Prune dummy entries from the front, then old entries from the back. If
* the list is still too long scan the whole list as before. But only do a
* full scan if the list is more than 6% (1/16th) too long. */
while (histCount > (unsigned)histlen && (np = Histlist.Hnext)) {
if (eventno - np->Href >= histlen || histlen == 0)
while (histCount > (unsigned)hlen && (np = Histlist.Hnext)) {
if (eventno - np->Href >= hlen || hlen == 0)
hremove(np), hfree(np);
else
break;
}
while (histCount > (unsigned)histlen && (np = histTail) != &Histlist) {
if (eventno - np->Href >= histlen || histlen == 0)
while (histCount > (unsigned)hlen && (np = histTail) != &Histlist) {
if (eventno - np->Href >= hlen || hlen == 0)
hremove(np), hfree(np);
else
break;
}
if (histCount - (histlen >> 4) <= (unsigned)histlen)
if (histCount - (hlen >> 4) <= (unsigned)hlen)
return; /* don't bother doing the full scan */
for (hp = &Histlist; histCount > (unsigned)histlen &&
for (hp = &Histlist; histCount > (unsigned)hlen &&
(np = hp->Hnext) != NULL;)
if (eventno - np->Href >= histlen || histlen == 0)
if (eventno - np->Href >= hlen || hlen == 0)
hremove(np), hfree(np);
else
hp = np;
@ -145,20 +147,9 @@ savehist(
struct wordent *sp,
int mflg) /* true if -m (merge) specified */
{
int histlen = 0;
Char *cp;
/* throw away null lines */
if (sp && sp->next->word[0] == '\n')
return;
cp = varval(STRhistory);
while (*cp) {
if (!Isdigit(*cp)) {
histlen = 0;
break;
}
histlen = histlen * 10 + *cp++ - '0';
}
if (sp)
(void) enthist(++eventno, sp, 1, mflg, histlen);
discardExcess(histlen);
@ -711,9 +702,9 @@ discardHistHashTable(void)
/* Computes a new hash table size, when the current one is too small. */
static unsigned
getHashTableSize(int histlen)
getHashTableSize(int hlen)
{
unsigned target = histlen * 2;
unsigned target = hlen * 2;
unsigned e = 5;
unsigned size;
while ((size = 1<<e) < target)
@ -729,17 +720,16 @@ getHashTableSize(int histlen)
/* Create the hash table or resize, if necessary. */
static void
createHistHashTable(int histlen)
createHistHashTable(int hlen)
{
if (histlen == 0) {
if (hlen == 0) {
discardHistHashTable();
return;
}
if (histlen < 0) {
histlen = getn(varval(STRhistory));
if (histlen == 0)
if (hlen < 0) {
if (histlen <= 0)
return; /* no need for hash table */
assert(histlen > 0);
hlen = histlen;
}
if (histHashTable != NULL) {
if (histCount < histHashTableLength * 3 / 4)
@ -747,7 +737,7 @@ createHistHashTable(int histlen)
discardHistHashTable(); /* too small */
}
histHashTableLength = getHashTableSize(
histlen > (int)histCount ? histlen : (int)histCount);
hlen > (int)histCount ? hlen : (int)histCount);
histHashTable = xmalloc(histHashTableLength * sizeof(struct Hist *));
memset(histHashTable, 0, histHashTableLength * sizeof(struct Hist *));
assert(histHashTable[0] == emptyHTE);
@ -934,7 +924,7 @@ enthist(
struct wordent *lp,
int docopy,
int mflg, /* true if merge requested */
int histlen) /* -1 if unknown */
int hlen) /* -1 if unknown */
{
struct Hist *p = NULL, *pp = &Histlist, *pTime = NULL;
struct Hist *np;
@ -944,7 +934,7 @@ enthist(
if ((dp = varval(STRhistdup)) != STRNULL) {
if (eq(dp, STRerase)) {
/* masaoki@akebono.tky.hp.com (Kobayashi Masaoki) */
createHistHashTable(histlen);
createHistHashTable(hlen);
lpHash = hashhist(lp);
assert(lpHash != 0);
p = findHistHashTable(lp, lpHash);
@ -963,7 +953,7 @@ enthist(
}
}
else if (eq(dp, STRall)) {
createHistHashTable(histlen);
createHistHashTable(hlen);
lpHash = hashhist(lp);
assert(lpHash != 0);
p = findHistHashTable(lp, lpHash);
@ -1031,7 +1021,7 @@ enthist(
else
pp = &Histlist; /* insert at beginning of history */
hinsert(np, pp);
if (lpHash && histlen != 0) /* erase & all modes use hash table */
if (lpHash && hlen != 0) /* erase & all modes use hash table */
insertHistHashTable(np, lpHash);
else
discardHistHashTable();
@ -1053,6 +1043,8 @@ hfree(struct Hist *hp)
PG_STATIC void
phist(struct Hist *hp, int hflg)
{
if (hp->Href < 0)
return;
if (hflg & HIST_ONLY) {
int old_output_raw;
@ -1207,7 +1199,7 @@ fmthist(int fmt, ptr_t ptr)
buf = xmalloc(Strlen(istr) * MB_LEN_MAX + 1);
for (p = buf, ip = istr; *ip != '\0'; ip++)
p += one_wctomb(p, CHAR & *ip);
p += one_wctomb(p, *ip);
*p = '\0';
xfree(istr);
@ -1220,13 +1212,21 @@ fmthist(int fmt, ptr_t ptr)
}
}
static void
dotlock_cleanup(void* lockpath)
{
dot_unlock((char*)lockpath);
}
/* Save history before exiting the shell. */
void
rechist(Char *fname, int ref)
{
Char *snum;
Char *snum, *rs;
int fp, ftmp, oldidfds;
struct varent *shist;
char path[MAXPATHLEN];
struct stat st;
static Char *dumphist[] = {STRhistory, STRmhT, 0, 0};
if (fname == NULL && !ref)
@ -1255,12 +1255,14 @@ rechist(Char *fname, int ref)
* with numerous shells being in simultaneous use. Imagine
* any kind of window system. All these shells 'share' the same
* ~/.history file for recording their command line history.
* Currently the automatic merge can only succeed when the shells
* nicely quit one after another.
* We try to handle the case of multiple shells trying to merge
* histories at the same time, by creating semi-unique filenames
* and saving the history there first and then trying to rename
* them in the proper history file.
*
* Users that like to nuke their environment require here an atomic
* loadhist-creat-dohist(dumphist)-close
* sequence.
* loadhist-creat-dohist(dumphist)-close sequence which is given
* by optional lock parameter to savehist.
*
* jw.
*/
@ -1271,16 +1273,49 @@ rechist(Char *fname, int ref)
*/
oldidfds = didfds;
didfds = 0;
if ((shist = adrof(STRsavehist)) != NULL && shist->vec != NULL)
if (shist->vec[1] && eq(shist->vec[1], STRmerge))
loadhist(fname, 1);
if ((shist = adrof(STRsavehist)) != NULL && shist->vec != NULL) {
size_t i;
int merge = 0, lock = 0;
fp = xcreat(short2str(fname), 0600);
cleanup_until(fname);
for (i = 1; shist->vec[i]; i++) {
if (eq(shist->vec[i], STRmerge))
merge++;
if (eq(shist->vec[i], STRlock))
lock++;
}
if (merge) {
if (lock) {
#ifndef WINNT_NATIVE
char *lockpath = strsave(short2str(fname));
cleanup_push(lockpath, xfree);
/* Poll in 100 miliseconds interval to obtain the lock. */
if ((dot_lock(lockpath, 100) == 0))
cleanup_push(lockpath, dotlock_cleanup);
#endif
}
loadhist(fname, 1);
}
}
rs = randsuf();
xsnprintf(path, sizeof(path), "%S.%S", fname, rs);
xfree(rs);
fp = xcreat(path, 0600);
if (fp == -1) {
didfds = oldidfds;
cleanup_until(fname);
return;
}
/* Try to preserve ownership and permissions of the original history file */
#ifndef WINNT_NATIVE
if (stat(short2str(fname), &st) != -1) {
TCSH_IGNORE(fchown(fp, st.st_uid, st.st_gid));
TCSH_IGNORE(fchmod(fp, st.st_mode));
}
#else
UNREFERENCED_PARAMETER(st);
#endif
ftmp = SHOUT;
SHOUT = fp;
dumphist[2] = snum;
@ -1288,6 +1323,8 @@ rechist(Char *fname, int ref)
xclose(fp);
SHOUT = ftmp;
didfds = oldidfds;
(void)rename(path, short2str(fname));
cleanup_until(fname);
}
@ -1317,3 +1354,10 @@ loadhist(Char *fname, int mflg)
hp->Hnum = hp->Href = n--;
}
}
void
sethistory(int n)
{
histlen = n;
discardExcess(histlen);
}

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.init.c,v 3.63 2006/08/23 01:49:32 mitr Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.init.c,v 3.64 2013/02/11 13:51:16 christos Exp $ */
/*
* sh.init.c: Function and signal tables
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: sh.init.c,v 3.63 2006/08/23 01:49:32 mitr Exp $")
RCSID("$tcsh: sh.init.c,v 3.64 2013/02/11 13:51:16 christos Exp $")
#include "ed.h"
#include "tw.h"
@ -214,7 +214,7 @@ int nsrchn = sizeof srchn / sizeof *srchn;
*/
/* We define NUMSIG to avoid changing NSIG or MAXSIG */
#if defined(POSIX) && !defined(__CYGWIN__)
#if defined(POSIX) && (!defined(__CYGWIN__) || defined (__x86_64__))
# define NUMSIG 65
#else /* !POSIX */
# define NUMSIG 33

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.lex.c,v 3.87 2011/01/24 17:48:15 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.lex.c,v 3.91 2016/08/01 16:21:09 christos Exp $ */
/*
* sh.lex.c: Lexical analysis into tokens
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: sh.lex.c,v 3.87 2011/01/24 17:48:15 christos Exp $")
RCSID("$tcsh: sh.lex.c,v 3.91 2016/08/01 16:21:09 christos Exp $")
#include "ed.h"
@ -66,7 +66,6 @@ static int getsel (int *, int *, int);
static struct wordent *getsub (struct wordent *);
static Char *subword (Char *, Char, int *, size_t *);
static struct wordent *dosub (Char, struct wordent *, int);
static ssize_t wide_read (int, Char *, size_t, int);
/*
* Peekc is a peek character for getC, peekread for readc.
@ -257,6 +256,14 @@ copylex(struct wordent *hp, struct wordent *fp)
} while (wdp->word[0] != '\n');
}
void
initlex(struct wordent *vp)
{
vp->word = STRNULL;
vp->prev = vp;
vp->next = vp;
}
void
freelex(struct wordent *vp)
{
@ -378,7 +385,7 @@ word(int parsehtime)
*/
c |= QUOTE;
ungetC(c);
c = '\\';
c = '\\' | QUOTE;
}
}
}
@ -1539,7 +1546,7 @@ balloc(int buf)
}
}
static ssize_t
ssize_t
wide_read(int fildes, Char *buf, size_t nchars, int use_fclens)
{
char cbuf[BUFSIZE + 1];

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.misc.c,v 3.46 2010/05/08 00:41:58 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.misc.c,v 3.50 2015/06/06 21:19:08 christos Exp $ */
/*
* sh.misc.c: Miscelaneous functions
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: sh.misc.c,v 3.46 2010/05/08 00:41:58 christos Exp $")
RCSID("$tcsh: sh.misc.c,v 3.50 2015/06/06 21:19:08 christos Exp $")
static int renum (int, int);
static Char **blkend (Char **);
@ -450,8 +450,13 @@ strip(Char *cp)
if (!cp)
return (cp);
while ((*dp++ &= TRIM) != '\0')
continue;
while (*dp != '\0') {
#if INVALID_BYTE != 0
if ((*dp & INVALID_BYTE) != INVALID_BYTE) /* *dp < INVALID_BYTE */
#endif
*dp &= TRIM;
dp++;
}
return (cp);
}
@ -462,8 +467,17 @@ quote(Char *cp)
if (!cp)
return (cp);
while (*dp != '\0')
*dp++ |= QUOTE;
while (*dp != '\0') {
#ifdef WIDE_STRINGS
if ((*dp & 0xffffff80) == 0) /* *dp < 0x80 */
#elif defined SHORT_STRINGS
if ((*dp & 0xff80) == 0) /* *dp < 0x80 */
#else
if ((*dp & 0x80) == 0) /* *dp < 0x80 */
#endif
*dp |= QUOTE;
dp++;
}
return (cp);
}
@ -533,14 +547,16 @@ xclose(int fildes)
if (fildes < 0)
return;
while (close(fildes) == -1 && errno == EINTR)
handle_pending_signals();
if (handle_pending_signals())
break;
}
void
xclosedir(DIR *dirp)
{
while (closedir(dirp) == -1 && errno == EINTR)
handle_pending_signals();
if (handle_pending_signals())
break;
}
int
@ -549,7 +565,8 @@ xcreat(const char *path, mode_t mode)
int res;
while ((res = creat(path, mode)) == -1 && errno == EINTR)
handle_pending_signals();
if (handle_pending_signals())
break;
return res;
}
@ -560,7 +577,8 @@ xdup2(int fildes, int fildes2)
int res;
while ((res = dup2(fildes, fildes2)) == -1 && errno == EINTR)
handle_pending_signals();
if (handle_pending_signals())
break;
return res;
}
#endif
@ -572,7 +590,8 @@ xgetgrgid(gid_t xgid)
errno = 0;
while ((res = getgrgid(xgid)) == NULL && errno == EINTR) {
handle_pending_signals();
if (handle_pending_signals())
break;
errno = 0;
}
return res;
@ -585,7 +604,8 @@ xgetpwnam(const char *name)
errno = 0;
while ((res = getpwnam(name)) == NULL && errno == EINTR) {
handle_pending_signals();
if (handle_pending_signals())
break;
errno = 0;
}
return res;
@ -598,7 +618,8 @@ xgetpwuid(uid_t xuid)
errno = 0;
while ((res = getpwuid(xuid)) == NULL && errno == EINTR) {
handle_pending_signals();
if (handle_pending_signals())
break;
errno = 0;
}
return res;
@ -611,7 +632,8 @@ xopen(const char *path, int oflag, ...)
if ((oflag & O_CREAT) == 0) {
while ((res = open(path, oflag)) == -1 && errno == EINTR)
handle_pending_signals();
if (handle_pending_signals())
break;
} else {
va_list ap;
mode_t mode;
@ -623,7 +645,8 @@ xopen(const char *path, int oflag, ...)
mode = va_arg(ap, int);
va_end(ap);
while ((res = open(path, oflag, mode)) == -1 && errno == EINTR)
handle_pending_signals();
if (handle_pending_signals())
break;
}
return res;
}
@ -636,7 +659,8 @@ xread(int fildes, void *buf, size_t nbyte)
/* This is where we will be blocked most of the time, so handle signals
that didn't interrupt any system call. */
do
handle_pending_signals();
if (handle_pending_signals())
break;
while ((res = read(fildes, buf, nbyte)) == -1 && errno == EINTR);
return res;
}
@ -649,7 +673,8 @@ xtcsetattr(int fildes, int optional_actions, const struct termios *termios_p)
while ((res = tcsetattr(fildes, optional_actions, termios_p)) == -1 &&
errno == EINTR)
handle_pending_signals();
if (handle_pending_signals())
break;
return res;
}
#endif
@ -662,7 +687,8 @@ xwrite(int fildes, const void *buf, size_t nbyte)
/* This is where we will be blocked most of the time, so handle signals
that didn't interrupt any system call. */
do
handle_pending_signals();
if (handle_pending_signals())
break;
while ((res = write(fildes, buf, nbyte)) == -1 && errno == EINTR);
return res;
}

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.print.c,v 3.36 2011/05/25 20:17:20 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.print.c,v 3.37 2015/05/10 13:29:28 christos Exp $ */
/*
* sh.print.c: Primitive Output routines.
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: sh.print.c,v 3.36 2011/05/25 20:17:20 christos Exp $")
RCSID("$tcsh: sh.print.c,v 3.37 2015/05/10 13:29:28 christos Exp $")
#include "ed.h"
@ -231,13 +231,13 @@ flush(void)
return;
if (GettingInput && !Tty_raw_mode && linp < &linbuf[sizeof linbuf - 10])
return;
if (handle_intr)
exitset = 1;
if (handle_interrupt)
exitset = 1;
if (interrupted) {
interrupted = 0;
linp = linbuf; /* avoid recursion as stderror calls flush */
if (handle_intr)
if (handle_interrupt)
fixerror();
else
stderror(ERR_SILENT);
@ -298,11 +298,11 @@ flush(void)
case EDQUOT:
#endif
/* Nothing to do, but die */
if (handle_intr == 0)
if (handle_interrupt == 0)
xexit(1);
/*FALLTHROUGH*/
default:
if (handle_intr)
if (handle_interrupt)
fixerror();
else
stderror(ERR_SILENT);

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.proc.c,v 3.121 2012/01/25 15:34:41 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.proc.c,v 3.134 2016/09/23 19:17:28 christos Exp $ */
/*
* sh.proc.c: Job manipulations
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: sh.proc.c,v 3.121 2012/01/25 15:34:41 christos Exp $")
RCSID("$tcsh: sh.proc.c,v 3.134 2016/09/23 19:17:28 christos Exp $")
#include "ed.h"
#include "tc.h"
@ -47,11 +47,9 @@ RCSID("$tcsh: sh.proc.c,v 3.121 2012/01/25 15:34:41 christos Exp $")
# define HZ 16
#endif /* aiws */
#if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
# if !defined(__ANDROID__)
# define BSDWAIT
# endif
#endif /* _BSD || (IRIS4D && __STDC__) || __lucid || glibc */
#if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid)
# define BSDWAIT
#endif /* _BSD || (IRIS4D && __STDC__) || __lucid */
#ifndef WTERMSIG
# define WTERMSIG(w) (((union wait *) &(w))->w_termsig)
# ifndef BSDWAIT
@ -191,8 +189,13 @@ pchild(void)
# else
/* both a wait3 and rusage */
# if !defined(BSDWAIT) || defined(NeXT) || defined(MACH) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) || (defined(IRIS4D) && SYSVREL <= 3) || defined(__lucid) || defined(__osf__)
#ifdef __ANDROID__ /* no wait3, only wait4 */
pid = wait4(-1, &w,
(setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG), &ru);
#else
pid = wait3(&w,
(setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG), &ru);
#endif /* __ANDROID__ */
# else /* BSDWAIT */
pid = wait3(&w.w_status,
(setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG), &ru);
@ -507,6 +510,7 @@ pjwait(struct process *pp)
cleanup_push(&oset, sigprocmask_cleanup);
pause_mask = oset;
sigdelset(&pause_mask, SIGCHLD);
sigaddset(&pause_mask, SIGINT);
for (;;) {
(void)handle_pending_signals();
jobflags = 0;
@ -593,22 +597,44 @@ void
dowait(Char **v, struct command *c)
{
struct process *pp;
/* the current block mask to be able to restore */
sigset_t old_mask;
/* block mask for critical section: OLD_MASK U {SIGCHLD} */
sigset_t block_mask;
/* ignore those during blocking sigsuspend:
OLD_MASK / {SIGCHLD, possibly(SIGINT)} */
sigset_t pause_mask;
int opintr_disabled, gotsig;
USE(c);
USE(v);
pjobs++;
sigprocmask(SIG_BLOCK, NULL, &pause_mask);
sigdelset(&pause_mask, SIGCHLD);
if (setintr)
sigdelset(&pause_mask, SIGINT);
/* critical section, block also SIGCHLD */
sigprocmask(SIG_BLOCK, NULL, &block_mask);
sigaddset(&block_mask, SIGCHLD);
sigprocmask(SIG_BLOCK, &block_mask, &old_mask);
/* detect older SIGCHLDs and remove PRUNNING flag from proclist */
(void)handle_pending_signals();
loop:
for (pp = proclist.p_next; pp; pp = pp->p_next)
if (pp->p_procid && /* pp->p_procid == pp->p_jobid && */
pp->p_flags & PRUNNING) {
(void)handle_pending_signals();
/* wait for (or pick up alredy blocked) SIGCHLD */
sigsuspend(&pause_mask);
/* make the 'wait' interuptable by CTRL-C */
opintr_disabled = pintr_disabled;
pintr_disabled = 0;
gotsig = handle_pending_signals();
@ -618,6 +644,8 @@ dowait(Char **v, struct command *c)
goto loop;
}
pjobs = 0;
sigprocmask(SIG_SETMASK, &old_mask, NULL);
}
/*
@ -963,6 +991,7 @@ pprint(struct process *pp, int flag)
struct process *tp;
int jobflags, pstatus, pcond;
const char *format;
int ohaderr;
#ifdef BACKPIPE
struct process *pipehead = NULL, *pipetail = NULL, *pmarker = NULL;
@ -978,6 +1007,9 @@ pprint(struct process *pp, int flag)
tp = pp;
status = reason = -1;
jobflags = 0;
ohaderr = haderr;
/* Print status to stderr, except for jobs built-in */
haderr = !(flag & JOBLIST);
do {
#ifdef BACKPIPE
/*
@ -1186,6 +1218,7 @@ pprint(struct process *pp, int flag)
xprintf(" ");
ptprint(tp);
}
haderr = ohaderr;
return (jobflags);
}
@ -1284,7 +1317,7 @@ void
dojobs(Char **v, struct command *c)
{
struct process *pp;
int flag = NUMBER | NAME | REASON;
int flag = NUMBER | NAME | REASON | JOBLIST;
int i;
USE(c);
@ -1833,12 +1866,12 @@ pfork(struct command *t, int wanttty)
(void) signal(SIGHUP, SIG_IGN);
if (t->t_dflg & F_NICE) {
int nval = SIGN_EXTEND_CHAR(t->t_nice);
#ifdef HAVE_SETPRIORITY
#if defined(HAVE_SETPRIORITY) && defined(PRIO_PROCESS)
if (setpriority(PRIO_PROCESS, 0, nval) == -1 && errno)
stderror(ERR_SYSTEM, "setpriority", strerror(errno));
#else /* !HAVE_SETPRIORITY */
#else /* !HAVE_SETPRIORITY || !PRIO_PROCESS */
(void) nice(nval);
#endif /* !HAVE_SETPRIORITY */
#endif /* HAVE_SETPRIORITY && PRIO_PROCESS */
}
#ifdef F_VER
if (t->t_dflg & F_VER) {

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.proc.h,v 3.15 2011/04/14 18:25:25 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.proc.h,v 3.16 2016/05/24 17:41:12 christos Exp $ */
/*
* sh.proc.h: Process data structures and variables
*/
@ -106,14 +106,15 @@ struct process {
#define PBRACE (1<<18) /* Process is {} evaluation */
/* defines for arguments to pprint */
#define NUMBER 01
#define NAME 02
#define REASON 04
#define AMPERSAND 010
#define FANCY 020
#define SHELLDIR 040 /* print shell's dir if not the same */
#define JOBDIR 0100 /* print job's dir if not the same */
#define AREASON 0200
#define NUMBER 0x001
#define NAME 0x002
#define REASON 0x004
#define AMPERSAND 0x008
#define FANCY 0x010
#define SHELLDIR 0x020 /* print shell's dir if not the same */
#define JOBDIR 0x040 /* print job's dir if not the same */
#define AREASON 0x080
#define JOBLIST 0x100
EXTERN struct process proclist IZERO_STRUCT;/* list head of all processes */

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.sem.c,v 3.86 2011/02/25 23:24:19 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.sem.c,v 3.90 2015/10/31 18:54:42 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.86 2011/02/25 23:24:19 christos Exp $")
RCSID("$tcsh: sh.sem.c,v 3.90 2015/10/31 18:54:42 christos Exp $")
#include "tc.h"
#include "tw.h"
@ -212,8 +212,14 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout,
* If noexec then this is all we do.
*/
if (t->t_dflg & F_READ) {
int old_pintr_disabled;
xclose(0);
if (setintr)
pintr_push_enable(&old_pintr_disabled);
heredoc(t->t_dlef);
if (setintr)
cleanup_until(&old_pintr_disabled);
if (noexec)
xclose(0);
}
@ -346,10 +352,6 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout,
* not pipedout, niced, nohupped, or &'d. It would be nice(?) to not
* fork in some of these cases.
*/
/*
* Prevent forking cd, pushd, popd, chdir cause this will cause the
* shell not to change dir!
*/
#ifdef BACKPIPE
/*
* Can't have NOFORK for the tail of a pipe - because it is not the
@ -358,11 +360,26 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout,
*/
if (t->t_dflg & F_PIPEIN)
t->t_dflg &= ~(F_NOFORK);
#else
/*
* "command | builtin" may cause major misbehaviour as noted in
* in the BUGS file entry
* Subject: Redirected input to built-in functions misbehaves badly
* forking when the builtin is the end of the pipe corrects the
* problem.
*/
if (bifunc && (t->t_dflg & F_PIPEIN))
t->t_dflg &= ~(F_NOFORK);
#endif /* BACKPIPE */
/*
* Prevent forking cd, pushd, popd, chdir cause this will cause the
* shell not to change dir! (XXX: but only for nice?)
*/
if (bifunc && (bifunc->bfunct == (bfunc_t)dochngd ||
bifunc->bfunct == (bfunc_t)dopushd ||
bifunc->bfunct == (bfunc_t)dopopd))
t->t_dflg &= ~(F_NICE);
if (((t->t_dflg & F_TIME) || ((t->t_dflg & F_NOFORK) == 0 &&
(!bifunc || t->t_dflg &
(F_PIPEOUT | F_AMPERSAND | F_NICE | F_NOHUP | F_HUP)))) ||
@ -560,13 +577,13 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout,
(void) signal(SIGHUP, SIG_DFL);
if (t->t_dflg & F_NICE) {
int nval = SIGN_EXTEND_CHAR(t->t_nice);
# ifdef HAVE_SETPRIORITY
# if defined(HAVE_SETPRIORITY) && defined(PRIO_PROCESS)
if (setpriority(PRIO_PROCESS, 0, nval) == -1 && errno)
stderror(ERR_SYSTEM, "setpriority",
strerror(errno));
# else /* !HAVE_SETPRIORITY */
# else /* !HAVE_SETPRIORITY || !PRIO_PROCESS */
(void) nice(nval);
# endif /* HAVE_SETPRIORITY */
# endif /* HAVE_SETPRIORITY && PRIO_PROCESS */
}
# ifdef F_VER
if (t->t_dflg & F_VER) {
@ -898,7 +915,7 @@ doio(struct command *t, int *pipein, int *pipeout)
else
fd = 0;
if ((flags & F_APPEND) == 0 || fd == -1) {
if (!(flags & F_OVERWRITE) && adrof(STRnoclobber)) {
if (!(flags & F_OVERWRITE) && no_clobber) {
if (flags & F_APPEND)
stderror(ERR_SYSTEM, tmp, strerror(errno));
chkclob(tmp);
@ -970,5 +987,13 @@ chkclob(const char *cp)
return;
if (S_ISCHR(stb.st_mode))
return;
if (no_clobber & NOCLOBBER_NOTEMPTY && stb.st_size == 0)
return;
if (no_clobber & NOCLOBBER_ASK) {
if (getYN(CGETS(22, 15,
"Do you really want to overwrite an existing file? [N/y] ")))
return;
}
stderror(ERR_EXISTS, cp);
}

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.set.c,v 3.83 2012/01/15 17:15:28 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.set.c,v 3.89 2015/09/08 15:49:53 christos Exp $ */
/*
* sh.set.c: Setting and Clearing of variables
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: sh.set.c,v 3.83 2012/01/15 17:15:28 christos Exp $")
RCSID("$tcsh: sh.set.c,v 3.89 2015/09/08 15:49:53 christos Exp $")
#include "ed.h"
#include "tw.h"
@ -55,6 +55,7 @@ static struct varent *madrof (Char *, struct varent *);
static void unsetv1 (struct varent *);
static void exportpath (Char **);
static void balance (struct varent *, int, int);
static int set_noclobber (Char **);
/*
* C Shell
@ -72,6 +73,13 @@ update_vars(Char *vp)
dohash(NULL, NULL);
}
}
else if (eq(vp, STRnoclobber)) {
struct varent *p = adrof(STRnoclobber);
if (p == NULL)
stderror(ERR_NAME | ERR_UNDVAR);
else
no_clobber = set_noclobber(p->vec);
}
else if (eq(vp, STRhistchars)) {
Char *pn = varval(vp);
@ -165,6 +173,10 @@ update_vars(Char *vp)
noediting = 0;
/* PWP: add more stuff in here later */
}
else if (eq(vp, STRvimode)) {
VImode = 1;
update_wordchars();
}
else if (eq(vp, STRshlvl)) {
tsetenv(STRKSHLVL, varval(vp));
}
@ -195,6 +207,9 @@ update_vars(Char *vp)
else if (eq(vp, STRkillring)) {
SetKillRing((int)getn(varval(vp)));
}
else if (eq(vp, STRhistory)) {
sethistory((int)getn(varval(vp)));
}
#ifndef HAVENOUTMP
else if (eq(vp, STRwatch)) {
resetwatch();
@ -203,6 +218,9 @@ update_vars(Char *vp)
else if (eq(vp, STRimplicitcd)) {
implicit_cd = ((eq(varval(vp), STRverbose)) ? 2 : 1);
}
else if (eq(vp, STRcdtohome)) {
cdtohome = 1;
}
#ifdef COLOR_LS_F
else if (eq(vp, STRcolor)) {
set_color_context();
@ -762,6 +780,8 @@ unset(Char **v, struct command *c)
PRCH = tcsh ? '>' : '%';
PRCHROOT = '#';
}
if (adrof(STRnoclobber) == 0)
no_clobber = 0;
if (adrof(STRhistlit) == 0)
HistLit = 0;
if (adrof(STRloginsh) == 0)
@ -780,12 +800,18 @@ unset(Char **v, struct command *c)
symlinks = 0;
if (adrof(STRimplicitcd) == 0)
implicit_cd = 0;
if (adrof(STRcdtohome) == 0)
cdtohome = 0;
if (adrof(STRkillring) == 0)
SetKillRing(0);
if (did_edit && noediting && adrof(STRedit) == 0)
noediting = 0;
if (adrof(STRvimode) == 0)
VImode = 0;
if (did_roe && adrof(STRrecognize_only_executables) == 0)
tw_cmd_free();
if (adrof(STRhistory) == 0)
sethistory(0);
#ifdef COLOR_LS_F
if (adrof(STRcolor) == 0)
set_color_context();
@ -793,6 +819,7 @@ unset(Char **v, struct command *c)
#if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
update_dspmbyte_vars();
#endif
update_wordchars();
#ifdef NLS_CATALOGS
nlsclose();
nlsinit();
@ -920,6 +947,28 @@ exportpath(Char **val)
cleanup_until(exppath);
}
static int
set_noclobber(Char **val)
{
Char *option;
int nc = NOCLOBBER_DEFAULT;
if (val == NULL)
return nc;
while (*val) {
if (*val == 0 || eq(*val, STRRparen))
return nc;
option = *val++;
if (eq(option, STRnotempty))
nc |= NOCLOBBER_NOTEMPTY;
else if (eq(option, STRask))
nc |= NOCLOBBER_ASK;
}
return nc;
}
#ifndef lint
/*
* Lint thinks these have null effect
@ -1301,3 +1350,11 @@ autoset_kanji(void)
}
#endif
#endif
void
update_wordchars(void)
{
if ((word_chars == STR_WORD_CHARS) || (word_chars == STR_WORD_CHARS_VI)) {
word_chars = (VImode ? STR_WORD_CHARS_VI : STR_WORD_CHARS);
}
}

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/sh.time.c,v 3.35 2010/12/09 15:39:29 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/sh.time.c,v 3.37 2016/07/09 00:45:29 christos Exp $ */
/*
* sh.time.c: Shell time keeping and printing.
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: sh.time.c,v 3.35 2010/12/09 15:39:29 christos Exp $")
RCSID("$tcsh: sh.time.c,v 3.37 2016/07/09 00:45:29 christos Exp $")
#ifdef SUNOS4
# include <machine/param.h>
@ -158,12 +158,12 @@ donice(Char **v, struct command *c)
nval = 4;
else if (*v == 0 && any("+-", cp[0]))
nval = getn(cp);
#ifdef HAVE_SETPRIORITY
#if defined(HAVE_SETPRIORITY) && defined(PRIO_PROCESS)
if (setpriority(PRIO_PROCESS, 0, nval) == -1 && errno)
stderror(ERR_SYSTEM, "setpriority", strerror(errno));
#else /* !HAVE_SETPRIORITY */
#else /* !HAVE_SETPRIORITY || !PRIO_PROCESS */
(void) nice(nval);
#endif /* HAVE_SETPRIORITY */
#endif /* HAVE_SETPRIORITY && PRIO_PROCESS */
}
#ifdef BSDTIMES
@ -293,6 +293,7 @@ prusage(struct tms *bs, struct tms *es, clock_t e, clock_t b)
# endif /* _SEQUENT_ */
#endif /* BSDTIMES */
{
int ohaderr = haderr;
#ifdef BSDTIMES
time_t t =
(r1->ru_utime.tv_sec - r0->ru_utime.tv_sec) * 100 +
@ -334,12 +335,14 @@ prusage(struct tms *bs, struct tms *es, clock_t e, clock_t b)
((e->tv_sec - b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000);
cp = "%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww";
haderr = 0;
#else /* !BSDTIMES */
# ifdef _SEQUENT_
int ms = (int)
((e->tv_sec - b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000);
cp = "%Uu %Ss %E %P %I+%Oio %Fpf+%Ww";
haderr = 0;
# else /* !_SEQUENT_ */
# ifndef POSIX
time_t ms = ((time_t)((e - b) / HZ) * 100) +
@ -350,6 +353,7 @@ prusage(struct tms *bs, struct tms *es, clock_t e, clock_t b)
# endif /* POSIX */
cp = "%Uu %Ss %E %P";
haderr = 0;
/*
* the tms stuff is not very precise, so we fudge it.
@ -678,6 +682,7 @@ prusage(struct tms *bs, struct tms *es, clock_t e, clock_t b)
break;
}
xputchar('\n');
haderr = ohaderr;
}
#if defined(BSDTIMES) || defined(_SEQUENT_)

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tc.alloc.c,v 3.50 2011/12/30 20:55:24 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tc.alloc.c,v 3.56 2016/03/08 12:47:43 christos Exp $ */
/*
* tc.alloc.c (Caltech) 2/21/82
* Chris Kingsley, kingsley@cit-20.
@ -42,8 +42,11 @@
#ifdef HAVE_MALLINFO
#include <malloc.h>
#endif
#if defined(HAVE_SBRK) && !defined(__APPLE__)
#define USE_SBRK
#endif
RCSID("$tcsh: tc.alloc.c,v 3.50 2011/12/30 20:55:24 christos Exp $")
RCSID("$tcsh: tc.alloc.c,v 3.56 2016/03/08 12:47:43 christos Exp $")
#define RCHECK
#define DEBUG
@ -66,7 +69,7 @@ out_of_memory (void)
{
static const char msg[] = "Out of memory\n";
write(didfds ? 2 : SHDIAG, msg, strlen(msg));
TCSH_IGNORE(write(didfds ? 2 : SHDIAG, msg, strlen(msg)));
_exit(1);
}
#endif
@ -131,7 +134,11 @@ union overhead {
#endif
#ifdef _LP64
#define ROUNDUP 15
#else
#define ROUNDUP 7
#endif
/*
* nextf[i] is the pointer to the next free block of size 2^(i+3). The
@ -345,10 +352,13 @@ calloc(size_t i, size_t j)
{
#ifndef lint
char *cp;
volatile size_t k;
i *= j;
cp = xmalloc(i);
memset(cp, 0, i);
/* Stop gcc 5.x from optimizing malloc+memset = calloc */
k = i;
memset(cp, 0, k);
return ((memalign_t) cp);
#else
@ -459,7 +469,7 @@ malloc_usable_size(M_U_S_CONST void *ptr)
const union overhead *op = (const union overhead *)
(((const char *) ptr) - MEMALIGN(sizeof(*op)));
if (op->ov_magic == MAGIC)
return 1 << (op->ov_index + 2);
return 1 << (op->ov_index + 3);
else
return 0;
}
@ -513,19 +523,19 @@ smalloc(size_t n)
n = n ? n : 1;
#ifdef HAVE_SBRK
#ifdef USE_SBRK
if (membot == NULL)
membot = sbrk(0);
#endif /* HAVE_SBRK */
#endif /* USE_SBRK */
if ((ptr = malloc(n)) == NULL)
out_of_memory();
#ifndef HAVE_SBRK
#ifndef USE_SBRK
if (memtop < ((char *) ptr) + n)
memtop = ((char *) ptr) + n;
if (membot == NULL)
membot = ptr;
#endif /* !HAVE_SBRK */
#endif /* !USE_SBRK */
return ((memalign_t) ptr);
}
@ -536,19 +546,19 @@ srealloc(ptr_t p, size_t n)
n = n ? n : 1;
#ifdef HAVE_SBRK
#ifdef USE_SBRK
if (membot == NULL)
membot = sbrk(0);
#endif /* HAVE_SBRK */
#endif /* USE_SBRK */
if ((ptr = (p ? realloc(p, n) : malloc(n))) == NULL)
out_of_memory();
#ifndef HAVE_SBRK
#ifndef USE_SBRK
if (memtop < ((char *) ptr) + n)
memtop = ((char *) ptr) + n;
if (membot == NULL)
membot = ptr;
#endif /* !HAVE_SBRK */
#endif /* !USE_SBRK */
return ((memalign_t) ptr);
}
@ -560,22 +570,22 @@ scalloc(size_t s, size_t n)
n *= s;
n = n ? n : 1;
#ifdef HAVE_SBRK
#ifdef USE_SBRK
if (membot == NULL)
membot = sbrk(0);
#endif /* HAVE_SBRK */
#endif /* USE_SBRK */
if ((ptr = malloc(n)) == NULL)
out_of_memory();
memset (ptr, 0, n);
#ifndef HAVE_SBRK
#ifndef USE_SBRK
if (memtop < ((char *) ptr) + n)
memtop = ((char *) ptr) + n;
if (membot == NULL)
membot = ptr;
#endif /* !HAVE_SBRK */
#endif /* !USE_SBRK */
return ((memalign_t) ptr);
}
@ -625,9 +635,9 @@ showall(Char **v, struct command *c)
(unsigned long) sbrk(0));
#else /* SYSMALLOC */
#ifndef HAVE_MALLINFO
#ifdef HAVE_SBRK
#ifdef USE_SBRK
memtop = sbrk(0);
#endif /* HAVE_SBRK */
#endif /* USE_SBRK */
xprintf(CGETS(19, 12, "Allocated memory from 0x%lx to 0x%lx (%ld).\n"),
(unsigned long) membot, (unsigned long) memtop,
(unsigned long) (memtop - membot));

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tc.bind.c,v 3.45 2009/06/25 21:15:37 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tc.bind.c,v 3.46 2015/08/13 08:54:04 christos Exp $ */
/*
* tc.bind.c: Key binding functions
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: tc.bind.c,v 3.45 2009/06/25 21:15:37 christos Exp $")
RCSID("$tcsh: tc.bind.c,v 3.46 2015/08/13 08:54:04 christos Exp $")
#include "ed.h"
#include "ed.defns.h"
@ -506,8 +506,14 @@ bindkey_usage(void)
" -v bind all keys to vi bindings\n"));
xprintf("%s", CGETS(20, 18,
" -e bind all keys to emacs bindings\n"));
xprintf("%s", CGETS(20, 19,
" -d bind all keys to default editor's bindings\n"));
xprintf(CGETS(20, 19,
" -d bind all keys to default editor's bindings (%s)\n"),
#ifdef VIDEFAULT
"vi"
#else /* EMACSDEFAULT */
"emacs"
#endif /* VIDEFAULT */
);
xprintf("%s", CGETS(20, 20,
" -l list editor commands with descriptions\n"));
xprintf("%s", CGETS(20, 21,

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tc.const.c,v 3.98 2011/04/14 18:25:26 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tc.const.c,v 3.107 2015/09/08 15:49:53 christos Exp $ */
/*
* sh.const.c: String constants for tcsh.
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: tc.const.c,v 3.98 2011/04/14 18:25:26 christos Exp $")
RCSID("$tcsh: tc.const.c,v 3.107 2015/09/08 15:49:53 christos Exp $")
Char STRlogout[] = { 'l', 'o', 'g', 'o', 'u', 't', '\0' };
Char STRautologout[] = { 'a', 'u', 't', 'o', 'l', 'o', 'g', 'o', 'u', 't',
@ -85,6 +85,8 @@ Char STRVENDOR[] = { 'V', 'E', 'N', 'D', 'O', 'R', '\0' };
Char STRMACHTYPE[] = { 'M', 'A', 'C', 'H', 'T', 'Y', 'P', 'E', '\0' };
Char STROSTYPE[] = { 'O', 'S', 'T', 'Y', 'P', 'E', '\0' };
Char STRedit[] = { 'e', 'd', 'i', 't', '\0' };
Char STReditors[] = { 'e', 'd', 'i', 't', 'o', 'r', 's', '\0' };
Char STRvimode[] = { 'v', 'i', 'm', 'o', 'd', 'e', '\0' };
Char STRaddsuffix[] = { 'a', 'd', 'd', 's', 'u', 'f', 'f', 'i', 'x',
'\0' };
Char STRcsubstnonl[] = { 'c', 's', 'u', 'b', 's', 't', 'n', 'o', 'n', 'l',
@ -113,6 +115,7 @@ Char STRmhT[] = { '-', 'h', 'T', '\0' };
Char STRmm[] = { '-', 'm', '\0' };
Char STRmr[] = { '-', 'r', '\0' };
Char STRmerge[] = { 'm', 'e', 'r', 'g', 'e', '\0' };
Char STRlock[] = { 'l', 'o', 'c', 'k', '\0' };
Char STRtildothist[] = { '~', '/', '.', 'h', 'i', 's', 't', 'o', 'r',
'y', '\0' };
@ -369,6 +372,8 @@ Char STRsldotcshrc[] = { '/', '.', 'c', 's', 'h', 'r', 'c', '\0' };
Char STRsldotlogin[] = { '/', '.', 'l', 'o', 'g', 'i', 'n', '\0' };
Char STRignoreeof[] = { 'i', 'g', 'n', 'o', 'r', 'e', 'e', 'o', 'f', '\0' };
Char STRnoclobber[] = { 'n', 'o', 'c', 'l', 'o', 'b', 'b', 'e', 'r', '\0' };
Char STRnotempty[] = { 'n', 'o', 't', 'e', 'm', 'p', 't', 'y', '\0' };
Char STRask[] = { 'a', 's', 'k', '\0' };
Char STRhelpcommand[] = { 'h', 'e', 'l', 'p', 'c', 'o', 'm', 'm', 'a', 'n',
'd', '\0' };
Char STRfignore[] = { 'f', 'i', 'g', 'n', 'o', 'r', 'e', '\0' };
@ -430,8 +435,9 @@ Char STRrmstar[] = { 'r', 'm', 's', 't', 'a', 'r', '\0' };
Char STRrm[] = { 'r', 'm', '\0' };
Char STRhighlight[] = { 'h', 'i', 'g', 'h', 'l', 'i', 'g', 'h', 't', '\0' };
Char STRimplicitcd[] = { 'i', 'm', 'p', 'l', 'i', 'c', 'i', 't',
'c', 'd', '\0' };
Char STRimplicitcd[] = { 'i', 'm', 'p', 'l', 'i', 'c', 'i', 't',
'c', 'd', '\0' };
Char STRcdtohome[] = { 'c', 'd', 't', 'o', 'h', 'o', 'm', 'e', '\0' };
Char STRkillring[] = { 'k', 'i', 'l', 'l', 'r', 'i', 'n', 'g', '\0' };
Char STRkilldup[] = { 'k', 'i', 'l', 'l', 'd', 'u', 'p', '\0' };
Char STRshlvl[] = { 's', 'h', 'l', 'v', 'l', '\0' };
@ -450,12 +456,12 @@ Char STRLC_MONETARY[] = { 'L', 'C', '_', 'M', 'O', 'N', 'E', 'T', 'A',
'R', 'Y', '\0' };
Char STRNOREBIND[] = { 'N', 'O', 'R', 'E', 'B', 'I', 'N', 'D', '\0' };
#if defined(SIG_WINDOW) || defined (_VMS_POSIX)
#if defined(SIG_WINDOW) || defined(SIGWINCH) || defined(SIGWINDOW) || defined (_VMS_POSIX) || defined(_SIGWINCH)
/* atp - problem with declaration of str{lines,columns} in sh.func.c (1277) */
Char STRLINES[] = { 'L', 'I', 'N', 'E', 'S', '\0'};
Char STRCOLUMNS[] = { 'C', 'O', 'L', 'U', 'M', 'N', 'S', '\0'};
Char STRTERMCAP[] = { 'T', 'E', 'R', 'M', 'C', 'A', 'P', '\0'};
#endif /* SIG_WINDOW || _VMS_POSIX */
#endif /* SIG_WINDOW || SIGWINCH || SIGWINDOW || _VMS_POSIX */
#if defined (_OSD_POSIX) /* BS2000 needs this variable set to "SHELL" */
Char STRPROGRAM_ENVIRONMENT[] = { 'P', 'R', 'O', 'G', 'R', 'A', 'M',
@ -491,6 +497,7 @@ Char STRmmcolormauto[] = { '-', 'G', '\0' };
Char STRmmcolormauto[] = { '-', '-', 'c', 'o', 'l', 'o', 'r', '=', 'a', 'u', 't', 'o', '\0' };
#endif /* BSD_STYLE_COLORLS */
Char STRLS_COLORS[] = { 'L', 'S', '_', 'C', 'O', 'L', 'O', 'R', 'S', '\0' };
Char STRLSCOLORS[] = { 'L', 'S', 'C', 'O', 'L', 'O', 'R', 'S', '\0' };
#endif /* COLOR_LS_F */
Char STRls[] = { 'l', 's', '\0' };

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tc.decls.h,v 3.65 2010/02/09 20:26:13 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tc.decls.h,v 3.66 2012/06/21 18:49:11 christos Exp $ */
/*
* tc.decls.h: Function declarations from all the tcsh modules
*/
@ -226,15 +226,15 @@ extern int getv (Char *);
#ifndef __GNUC__
#define __attribute__(a)
#endif
extern pret_t xprintf (const char *, ...)
extern int xprintf (const char *, ...)
__attribute__((__format__(__printf__, 1, 2)));
extern pret_t xsnprintf (char *, size_t, const char *, ...)
extern int xsnprintf (char *, size_t, const char *, ...)
__attribute__((__format__(__printf__, 3, 4)));
extern char *xasprintf (const char *, ...)
__attribute__((__format__(__printf__, 1, 2)));
extern pret_t xvprintf (const char *, va_list)
extern int xvprintf (const char *, va_list)
__attribute__((__format__(__printf__, 1, 0)));
extern pret_t xvsnprintf (char *, size_t, const char *, va_list)
extern int xvsnprintf (char *, size_t, const char *, va_list)
__attribute__((__format__(__printf__, 3, 0)));
extern char *xvasprintf (const char *, va_list)
__attribute__((__format__(__printf__, 1, 0)));

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tc.func.c,v 3.148 2011/12/14 16:36:44 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tc.func.c,v 3.158 2016/05/13 15:08:12 christos Exp $ */
/*
* tc.func.c: New tcsh builtins.
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: tc.func.c,v 3.148 2011/12/14 16:36:44 christos Exp $")
RCSID("$tcsh: tc.func.c,v 3.158 2016/05/13 15:08:12 christos Exp $")
#include "ed.h"
#include "ed.defns.h" /* for the function names */
@ -120,11 +120,17 @@ expand_lex(const struct wordent *sp0, int from, int to)
if ((*s & QUOTE)
&& (((*s & TRIM) == HIST && HIST != '\0') ||
(((*s & TRIM) == '\'') && (prev_c != '\\')) ||
(((*s & TRIM) == '\"') && (prev_c != '\\')) ||
(((*s & TRIM) == '\\') && (prev_c != '\\')))) {
(((*s & TRIM) == '\"') && (prev_c != '\\')))) {
Strbuf_append1(&buf, '\\');
}
#if INVALID_BYTE != 0
if ((*s & INVALID_BYTE) != INVALID_BYTE) /* *s < INVALID_BYTE */
Strbuf_append1(&buf, *s & TRIM);
else
Strbuf_append1(&buf, *s);
#else
Strbuf_append1(&buf, *s & TRIM);
#endif
prev_c = *s;
}
Strbuf_append1(&buf, ' ');
@ -193,7 +199,7 @@ void
dolist(Char **v, struct command *c)
{
Char **globbed;
int i, k;
int i, k, ret = 0;
struct stat st;
USE(c);
@ -333,8 +339,11 @@ dolist(Char **v, struct command *c)
xputchar('\n');
print_by_column(STRNULL, &v[i], k - i, FALSE);
}
haderr = 1;
xprintf("%S: %s.\n", tmp, strerror(err));
haderr = 0;
i = k + 1;
ret = 1;
}
else if (S_ISDIR(st.st_mode)) {
Char *cp;
@ -372,6 +381,8 @@ dolist(Char **v, struct command *c)
xputchar('\n');
print_by_column(STRNULL, &v[i], k - i, FALSE);
}
if (ret)
stderror(ERR_SILENT);
}
cleanup_until(globbed);
@ -481,6 +492,19 @@ dowhich(Char **v, struct command *c)
setcopy(STRstatus, STR1, VAR_READWRITE);
}
static int
findvv(Char **vv, const char *cp)
{
for (; vv && *vv; vv++) {
size_t i;
for (i = 0; (*vv)[i] && (*vv)[i] == cp[i]; i++)
continue;
if ((*vv)[i] == '\0' && cp[i] == '\0')
return 1;
}
return 0;
}
/* PWP: a hack to start up your stopped editor on a single keystroke */
/* jbs - fixed hack so it worked :-) 3/28/89 */
@ -488,33 +512,42 @@ struct process *
find_stop_ed(void)
{
struct process *pp, *retp;
const char *ep, *vp;
const char *ep = NULL, *vp = NULL;
char *cp, *p;
size_t epl, vpl;
size_t epl = 0, vpl = 0;
int pstatus;
if ((ep = getenv("EDITOR")) != NULL) { /* if we have a value */
if ((p = strrchr(ep, '/')) != NULL) /* if it has a path */
ep = p + 1; /* then we want only the last part */
}
else
ep = "ed";
if ((vp = getenv("VISUAL")) != NULL) { /* if we have a value */
if ((p = strrchr(vp, '/')) != NULL) /* and it has a path */
vp = p + 1; /* then we want only the last part */
}
else
vp = "vi";
for (vpl = 0; vp[vpl] && !isspace((unsigned char)vp[vpl]); vpl++)
continue;
for (epl = 0; ep[epl] && !isspace((unsigned char)ep[epl]); epl++)
continue;
struct varent *varp;
Char **vv;
if (pcurrent == NULL) /* see if we have any jobs */
return NULL; /* nope */
if ((varp = adrof(STReditors)) != NULL)
vv = varp->vec;
else
vv = NULL;
if (! vv) {
if ((ep = getenv("EDITOR")) != NULL) { /* if we have a value */
if ((p = strrchr(ep, '/')) != NULL) /* if it has a path */
ep = p + 1; /* then we want only the last part */
}
else
ep = "ed";
if ((vp = getenv("VISUAL")) != NULL) { /* if we have a value */
if ((p = strrchr(vp, '/')) != NULL) /* and it has a path */
vp = p + 1; /* then we want only the last part */
}
else
vp = "vi";
for (vpl = 0; vp[vpl] && !isspace((unsigned char)vp[vpl]); vpl++)
continue;
for (epl = 0; ep[epl] && !isspace((unsigned char)ep[epl]); epl++)
continue;
}
retp = NULL;
for (pp = proclist.p_next; pp; pp = pp->p_next)
if (pp->p_procid == pp->p_jobid) {
@ -540,10 +573,13 @@ find_stop_ed(void)
else
cp = p; /* else we get all of it */
/* if we find either in the current name, fg it */
if (strncmp(ep, cp, epl) == 0 ||
strncmp(vp, cp, vpl) == 0) {
/*
* If we find the current name in the $editors array (if set)
* or as $EDITOR or $VISUAL (if $editors not set), fg it.
*/
if ((vv && findvv(vv, cp)) ||
(epl && strncmp(ep, cp, epl) == 0 && cp[epl] == '\0') ||
(vpl && strncmp(vp, cp, vpl) == 0 && cp[vpl] == '\0')) {
/*
* If there is a choice, then choose the current process if
* available, or the previous process otherwise, or else
@ -733,7 +769,7 @@ auto_lock(void)
pp = xgetpass("Password:");
crpp = XCRYPT(pw, pp, srpp);
if ((strcmp(crpp, srpp) == 0)
if ((crpp && strcmp(crpp, srpp) == 0)
#ifdef AFS
|| (ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION,
afsname, /* name */
@ -1108,8 +1144,7 @@ rmstar(struct wordent *cp)
Char *tag;
#endif /* RMDEBUG */
Char *charac;
char c;
int ask, doit, star = 0, silent = 0;
int ask, doit, star = 0, silent = 0, opintr_disabled;
if (!adrof(STRrmstar))
return;
@ -1119,6 +1154,8 @@ rmstar(struct wordent *cp)
we = cp->next;
while (*we->word == ';' && we != cp)
we = we->next;
opintr_disabled = pintr_disabled;
pintr_disabled = 0;
while (we != cp) {
#ifdef RMDEBUG
if (*tag)
@ -1139,17 +1176,8 @@ rmstar(struct wordent *cp)
if (!Strcmp(args->word, STRstar))
star = 1;
if (ask && star) {
xprintf("%s", CGETS(22, 8,
"Do you really want to delete all files? [n/y] "));
flush();
(void) force_read(SHIN, &c, 1);
/*
* Perhaps we should use the yesexpr from the
* actual locale
*/
doit = (strchr(CGETS(22, 14, "Yy"), c) != NULL);
while (c != '\n' && force_read(SHIN, &c, 1) == 1)
continue;
doit = getYN(CGETS(22, 8,
"Do you really want to delete all files? [N/y] "));
if (!doit) {
/* remove the command instead */
#ifdef RMDEBUG
@ -1195,6 +1223,7 @@ rmstar(struct wordent *cp)
xprintf("%S ", we->word);
}
#endif /* RMDEBUG */
pintr_disabled = opintr_disabled;
return;
}

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tc.nls.c,v 3.23 2010/02/12 22:17:20 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tc.nls.c,v 3.27 2016/07/17 15:02:44 christos Exp $ */
/*
* tc.nls.c: NLS handling
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: tc.nls.c,v 3.23 2010/02/12 22:17:20 christos Exp $")
RCSID("$tcsh: tc.nls.c,v 3.27 2016/07/17 15:02:44 christos Exp $")
#ifdef WIDE_STRINGS
@ -64,7 +64,11 @@ NLSWidth(Char c)
{
# ifdef HAVE_WCWIDTH
int l;
#if INVALID_BYTE != 0
if ((c & INVALID_BYTE) == INVALID_BYTE) /* c >= INVALID_BYTE */
#else
if (c & INVALID_BYTE)
#endif
return 1;
l = xwcwidth((wchar_t) c);
return l >= 0 ? l : 0;
@ -116,14 +120,29 @@ NLSChangeCase(const Char *p, int mode)
}
int
NLSClassify(Char c, int nocomb)
NLSClassify(Char c, int nocomb, int drawPrompt)
{
int w;
if (c & INVALID_BYTE)
#ifndef SHORT_STRINGS
if ((c & 0x80) != 0) /* c >= 0x80 */
return NLSCLASS_ILLEGAL;
w = NLSWidth(c);
if ((w > 0 && !(Iscntrl(c) && (c & CHAR) < 0x100)) || (Isprint(c) && !nocomb))
return w;
#endif
if (!drawPrompt) { /* draw command-line */
#if INVALID_BYTE != 0
if ((c & INVALID_BYTE) == INVALID_BYTE) /* c >= INVALID_BYTE */
return NLSCLASS_ILLEGAL;
if ((c & INVALID_BYTE) == QUOTE && (c & 0x80) == 0) /* c >= QUOTE */
return 1;
if (c >= 0x10000000) /* U+10000000 = FC 90 80 80 80 80 */
return NLSCLASS_ILLEGAL5;
if (c >= 0x1000000) /* U+1000000 = F9 80 80 80 80 */
return NLSCLASS_ILLEGAL4;
if (c >= 0x100000) /* U+100000 = F4 80 80 80 */
return NLSCLASS_ILLEGAL3;
#endif
if (c >= 0x10000) /* U+10000 = F0 90 80 80 */
return NLSCLASS_ILLEGAL2;
}
if (Iscntrl(c) && (c & CHAR) < 0x100) {
if (c == '\n')
return NLSCLASS_NL;
@ -131,13 +150,14 @@ NLSClassify(Char c, int nocomb)
return NLSCLASS_TAB;
return NLSCLASS_CTRL;
}
#ifdef WIDE_STRINGS
if (c >= 0x1000000)
return NLSCLASS_ILLEGAL4;
if (c >= 0x10000)
return NLSCLASS_ILLEGAL3;
#endif
if (c >= 0x100)
return NLSCLASS_ILLEGAL2;
w = NLSWidth(c);
if (drawPrompt) { /* draw prompt */
if (w > 0)
return w;
if (w == 0)
return 1;
}
if ((w > 0 && !(Iscntrl(c) && (c & CHAR) < 0x100)) || (Isprint(c) && !nocomb))
return w;
return NLSCLASS_ILLEGAL;
}

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tc.nls.h,v 3.14 2011/02/25 23:57:21 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tc.nls.h,v 3.17 2015/06/06 21:19:08 christos Exp $ */
/*
* tc.nls.h: NLS support
*
@ -43,7 +43,7 @@ extern int NLSStringWidth (const Char *);
#endif
extern Char *NLSChangeCase (const Char *, int);
extern int NLSClassify (Char, int);
extern int NLSClassify (Char, int, int);
#define NLSCLASS_CTRL (-1)
#define NLSCLASS_TAB (-2)
@ -52,6 +52,7 @@ extern int NLSClassify (Char, int);
#define NLSCLASS_ILLEGAL2 (-5)
#define NLSCLASS_ILLEGAL3 (-6)
#define NLSCLASS_ILLEGAL4 (-7)
#define NLSCLASS_ILLEGAL5 (-8)
#define NLSCLASS_ILLEGAL_SIZE(x) (-(x) - (-(NLSCLASS_ILLEGAL) - 1))

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tc.os.c,v 3.72 2011/01/25 13:58:19 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tc.os.c,v 3.73 2016/04/16 15:44:18 christos Exp $ */
/*
* tc.os.c: OS Dependent builtin functions
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: tc.os.c,v 3.72 2011/01/25 13:58:19 christos Exp $")
RCSID("$tcsh: tc.os.c,v 3.73 2016/04/16 15:44:18 christos Exp $")
#include "tw.h"
#include "ed.h"
@ -1585,28 +1585,6 @@ isapad(void)
}
#endif
#ifdef __ANDROID__
#include <stdio.h>
/* Android (<= 2.1?) has an incomplete ttyname implementation. */
char *
ttyname(int fd)
{
char path[64];
ssize_t siz;
static char ttyname[32];
if (!isatty(fd))
return NULL;
(void)snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
siz = readlink(path, ttyname, sizeof(ttyname));
if (siz < 0 || siz == sizeof(ttyname))
return NULL;
ttyname[siz] = '\0';
return ttyname;
}
#endif /* __ANDROID__ */
#if defined(__CYGWIN__) && !defined(NO_CRYPT)
#undef CHAR /* Collides with Win32 API */
#define WIN32_LEAN_AND_MEAN

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tc.printf.c,v 3.35 2006/03/02 18:46:45 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tc.printf.c,v 3.38 2015/06/06 21:19:08 christos Exp $ */
/*
* tc.printf.c: A public-domain, minimal printf/sprintf routine that prints
* through the putchar() routine. Feel free to use for
@ -34,7 +34,7 @@
*/
#include "sh.h"
RCSID("$tcsh: tc.printf.c,v 3.35 2006/03/02 18:46:45 christos Exp $")
RCSID("$tcsh: tc.printf.c,v 3.38 2015/06/06 21:19:08 christos Exp $")
#ifdef lint
#undef va_arg
@ -46,9 +46,9 @@ RCSID("$tcsh: tc.printf.c,v 3.35 2006/03/02 18:46:45 christos Exp $")
static char snil[] = "(nil)";
static void xaddchar (int);
static void doprnt (void (*) (int), const char *, va_list);
static int doprnt (void (*) (int), const char *, va_list);
static void
static int
doprnt(void (*addchar) (int), const char *sfmt, va_list ap)
{
char *bp;
@ -68,8 +68,8 @@ doprnt(void (*addchar) (int), const char *sfmt, va_list ap)
int fmt;
unsigned char pad = ' ';
int flush_left = 0, f_width = 0, prec = INF, hash = 0;
int do_long = 0, do_size_t = 0;
int sign = 0;
int do_long = 0, do_size_t = 0, do_ptrdiff_t = 0;
int sign = 0, count = 0;
int attributes = 0;
@ -77,6 +77,7 @@ doprnt(void (*addchar) (int), const char *sfmt, va_list ap)
for (; *f; f++) {
if (*f != '%') { /* then just out the char */
(*addchar) (((unsigned char)*f) | attributes);
count++;
}
else {
f++; /* skip the % */
@ -131,6 +132,10 @@ doprnt(void (*addchar) (int), const char *sfmt, va_list ap)
do_size_t++;
f++;
}
if (*f == 't') { /* ptrdiff_t format */
do_ptrdiff_t++;
f++;
}
fmt = (unsigned char) *f;
if (fmt != 'S' && fmt != 'Q' && isupper(fmt)) {
@ -171,13 +176,19 @@ doprnt(void (*addchar) (int), const char *sfmt, va_list ap)
*bp++ = '-';
f_width = f_width - (int) (bp - buf);
if (!flush_left)
while (f_width-- > 0)
while (f_width-- > 0) {
(*addchar) (pad | attributes);
for (bp--; bp >= buf; bp--)
count++;
}
for (bp--; bp >= buf; bp--) {
(*addchar) (((unsigned char) *bp) | attributes);
count++;
}
if (flush_left)
while (f_width-- > 0)
while (f_width-- > 0) {
(*addchar) (' ' | attributes);
count++;
}
break;
case 'p':
@ -192,6 +203,8 @@ doprnt(void (*addchar) (int), const char *sfmt, va_list ap)
case 0:
if (do_size_t)
u = va_arg(ap, size_t);
else if (do_ptrdiff_t)
u = va_arg(ap, ptrdiff_t);
else
u = va_arg(ap, unsigned int);
break;
@ -234,19 +247,24 @@ doprnt(void (*addchar) (int), const char *sfmt, va_list ap)
}
i = f_width - (int) (bp - buf);
if (!flush_left)
while (i-- > 0)
while (i-- > 0) {
(*addchar) (pad | attributes);
count++;
}
for (bp--; bp >= buf; bp--)
(*addchar) (((unsigned char) *bp) | attributes);
if (flush_left)
while (i-- > 0)
while (i-- > 0) {
(*addchar) (' ' | attributes);
count++;
}
break;
case 'c':
i = va_arg(ap, int);
(*addchar) (i | attributes);
count++;
break;
case 'S':
@ -259,23 +277,31 @@ doprnt(void (*addchar) (int), const char *sfmt, va_list ap)
}
f_width = f_width - Strlen(Bp);
if (!flush_left)
while (f_width-- > 0)
while (f_width-- > 0) {
(*addchar) ((int) (pad | attributes));
count++;
}
for (i = 0; *Bp && i < prec; i++) {
char cbuf[MB_LEN_MAX];
size_t pos, len;
if (fmt == 'Q' && *Bp & QUOTE)
if (fmt == 'Q' && *Bp & QUOTE) {
(*addchar) ('\\' | attributes);
len = one_wctomb(cbuf, *Bp & CHAR);
for (pos = 0; pos < len; pos++)
count++;
}
len = one_wctomb(cbuf, *Bp);
for (pos = 0; pos < len; pos++) {
(*addchar) ((unsigned char)cbuf[pos] | attributes
| (*Bp & ATTRIBUTES));
count++;
}
Bp++;
}
if (flush_left)
while (f_width-- > 0)
while (f_width-- > 0) {
(*addchar) (' ' | attributes);
count++;
}
break;
#endif /* SHORT_STRINGS */
@ -287,17 +313,24 @@ doprnt(void (*addchar) (int), const char *sfmt, va_list ap)
bp = snil;
f_width = f_width - strlen(bp);
if (!flush_left)
while (f_width-- > 0)
while (f_width-- > 0) {
(*addchar) (pad | attributes);
count++;
}
for (i = 0; *bp && i < prec; i++) {
if (fmt == 'q' && *bp & QUOTE)
if (fmt == 'q' && *bp & QUOTE) {
(*addchar) ('\\' | attributes);
count++;
}
(*addchar) (((unsigned char) *bp & TRIM) | attributes);
count++;
bp++;
}
if (flush_left)
while (f_width-- > 0)
while (f_width-- > 0) {
(*addchar) (' ' | attributes);
count++;
}
break;
case 'a':
@ -306,17 +339,19 @@ doprnt(void (*addchar) (int), const char *sfmt, va_list ap)
case '%':
(*addchar) ('%' | attributes);
count++;
break;
default:
break;
}
flush_left = 0, f_width = 0, prec = INF, hash = 0;
do_size_t = 0, do_long = 0;
do_ptrdiff_t = 0, do_size_t = 0, do_long = 0;
sign = 0;
pad = ' ';
}
}
return count;
}
@ -331,56 +366,49 @@ xaddchar(int c)
}
pret_t
int
/*VARARGS*/
xsnprintf(char *str, size_t size, const char *fmt, ...)
{
int count;
va_list va;
va_start(va, fmt);
xstring = str;
xestring = str + size - 1;
doprnt(xaddchar, fmt, va);
count = doprnt(xaddchar, fmt, va);
va_end(va);
*xstring++ = '\0';
#ifdef PURIFY
return 1;
#endif
return count;
}
pret_t
int
/*VARARGS*/
xprintf(const char *fmt, ...)
{
int count;
va_list va;
va_start(va, fmt);
doprnt(xputchar, fmt, va);
count = doprnt(xputchar, fmt, va);
va_end(va);
#ifdef PURIFY
return 1;
#endif
return count;
}
pret_t
int
xvprintf(const char *fmt, va_list va)
{
doprnt(xputchar, fmt, va);
#ifdef PURIFY
return 1;
#endif
return doprnt(xputchar, fmt, va);
}
pret_t
int
xvsnprintf(char *str, size_t size, const char *fmt, va_list va)
{
int count;
xstring = str;
xestring = str + size - 1;
doprnt(xaddchar, fmt, va);
count = doprnt(xaddchar, fmt, va);
*xstring++ = '\0';
#ifdef PURIFY
return 1;
#endif
return count;
}
char *
@ -435,18 +463,18 @@ xasprintf(const char *fmt, ...)
int
fprintf(FILE *fp, const char* fmt, ...)
{
int count;
va_list va;
va_start(va, fmt);
doprnt(xputchar, fmt, va);
count = doprnt(xputchar, fmt, va);
va_end(va);
return 1;
return count;
}
int
vfprintf(FILE *fp, const char *fmt, va_list va)
{
doprnt(xputchar, fmt, va);
return 1;
return doprnt(xputchar, fmt, va);
}
#endif /* PURIFY */

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tc.prompt.c,v 3.70 2011/10/27 22:41:06 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tc.prompt.c,v 3.71 2014/08/23 09:07:57 christos Exp $ */
/*
* tc.prompt.c: Prompt printing stuff
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: tc.prompt.c,v 3.70 2011/10/27 22:41:06 christos Exp $")
RCSID("$tcsh: tc.prompt.c,v 3.71 2014/08/23 09:07:57 christos Exp $")
#include "ed.h"
#include "tw.h"
@ -213,7 +213,22 @@ tprintf(int what, const Char *fmt, const char *str, time_t tim, ptr_t info)
}
break;
case '#':
#ifdef __CYGWIN__
/* Check for being member of the Administrators group */
{
gid_t grps[NGROUPS_MAX];
int grp, gcnt;
gcnt = getgroups(NGROUPS_MAX, grps);
# define DOMAIN_GROUP_RID_ADMINS 544
for (grp = 0; grp < gcnt; ++grp)
if (grps[grp] == DOMAIN_GROUP_RID_ADMINS)
break;
Scp = (grp < gcnt) ? PRCHROOT : PRCH;
}
#else
Scp = (uid == 0 || euid == 0) ? PRCHROOT : PRCH;
#endif
if (Scp != '\0')
Strbuf_append1(&buf, attributes | Scp);
break;

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tc.str.c,v 3.42 2012/01/10 21:34:31 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tc.str.c,v 3.47 2015/06/06 21:19:08 christos Exp $ */
/*
* tc.str.c: Short string package
* This has been a lesson of how to write buggy code!
@ -36,7 +36,7 @@
#include <assert.h>
#include <limits.h>
RCSID("$tcsh: tc.str.c,v 3.42 2012/01/10 21:34:31 christos Exp $")
RCSID("$tcsh: tc.str.c,v 3.47 2015/06/06 21:19:08 christos Exp $")
#define MALLOC_INCR 128
#ifdef WIDE_STRINGS
@ -66,10 +66,24 @@ one_wctomb(char *s, Char wchar)
{
int len;
if (wchar & INVALID_BYTE) {
s[0] = wchar & 0xFF;
#if INVALID_BYTE != 0
if ((wchar & INVALID_BYTE) == INVALID_BYTE) { /* wchar >= INVALID_BYTE */
/* invalid char
* exmaple)
* if wchar = f0000090(=90|INVALID_BYTE), then *s = ffffff90 */
*s = (char)wchar;
len = 1;
#else
if (wchar & (CHAR & INVALID_BYTE)) {
s[0] = wchar & (CHAR & 0xFF);
len = 1;
#endif
} else {
#if INVALID_BYTE != 0
wchar &= MAX_UTF32;
#else
wchar &= CHAR;
#endif
#ifdef UTF16_STRINGS
if (wchar >= 0x10000) {
/* UTF-16 systems can't handle these values directly in calls to
@ -224,7 +238,7 @@ short2str(const Char *src)
dst = sdst;
edst = &dst[dstsize];
while (*src) {
dst += one_wctomb(dst, *src & CHAR);
dst += one_wctomb(dst, *src);
src++;
if (dst >= edst) {
char *wdst = dst;
@ -544,7 +558,7 @@ short2qstr(const Char *src)
dst = &edst[-MALLOC_INCR];
}
}
dst += one_wctomb(dst, *src & CHAR);
dst += one_wctomb(dst, *src);
src++;
if (dst >= edst) {
ptrdiff_t i = dst - edst;
@ -559,7 +573,7 @@ short2qstr(const Char *src)
}
struct blk_buf *
bb_alloc()
bb_alloc(void)
{
return xcalloc(1, sizeof(struct blk_buf));
}
@ -590,10 +604,14 @@ bb_cleanup(void *xbb)
struct blk_buf *bb;
size_t i;
bb = xbb;
for (i = 0; i < bb->len; i++)
xfree(bb->vec[i]);
xfree(bb->vec);
bb = (struct blk_buf *)xbb;
if (bb->vec) {
for (i = 0; i < bb->len; i++)
xfree(bb->vec[i]);
xfree(bb->vec);
}
bb->vec = NULL;
bb->len = 0;
}
void

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tc.who.c,v 3.57 2012/01/17 20:53:38 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tc.who.c,v 3.59 2012/11/15 02:55:08 christos Exp $ */
/*
* tc.who.c: Watch logins and logouts...
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: tc.who.c,v 3.57 2012/01/17 20:53:38 christos Exp $")
RCSID("$tcsh: tc.who.c,v 3.59 2012/11/15 02:55:08 christos Exp $")
#include "tc.h"
@ -65,6 +65,8 @@ RCSID("$tcsh: tc.who.c,v 3.57 2012/01/17 20:53:38 christos Exp $")
# define TCSH_PATH_UTMP "/var/run/utx.active"
# elif defined(__hpux)
# define TCSH_PATH_UTMP "/etc/utmpx"
# elif defined(IBMAIX) && defined(UTMP_FILE)
# define TCSH_PATH_UTMP UTMP_FILE
# endif
# if defined(TCSH_PATH_UTMP) || !defined(HAVE_UTMP_H)
# define utmp utmpx

View File

@ -1,3 +1,5 @@
.\" $tcsh: tcsh.man,v 3.266 2016/11/24 15:04:52 christos Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@ -42,6 +44,10 @@
.\"
.\" - Use `', not '' or "", except of course in shell syntax examples.
.\" '' at the beginning of a line will vanish!
.\"
.\" - Use \` for literal back-quote (`).
.\"
.\" - Use \e for literal backslash (\).
.\"
.\" - Use \-, not -.
.\"
@ -72,7 +78,7 @@
.\" used here if you can. In particular, please don't use nroff commands
.\" which aren't already used herein.
.\"
.TH TCSH 1 "14 February 2012" "Astron 6.18.01"
.TH TCSH 1 "24 November 2016" "Astron 6.20.00"
.SH NAME
tcsh \- C shell with file name completion and command line editing
.SH SYNOPSIS
@ -160,7 +166,7 @@ it is used under a debugger. Job control is disabled. (u)
Command input is taken from the standard input.
.TP 4
.B \-t
The shell reads and executes a single line of input. A `\\' may be used to
The shell reads and executes a single line of input. A `\e' may be used to
escape the newline at the end of this line and continue onto another line.
.TP 4
.B \-v
@ -201,7 +207,7 @@ A login shell begins by executing commands from the system files
It then executes commands from files in the user's \fBhome\fR directory:
first \fI~/.tcshrc\fR (+)
or, if \fI~/.tcshrc\fR is not found, \fI~/.cshrc\fR,
then \fI~/.history\fR (or the value of the \fBhistfile\fR shell variable),
then the contents of \fI~/.history\fR (or the value of the \fBhistfile\fR shell variable) are loaded into memory,
then \fI~/.login\fR,
and finally \fI~/.cshdirs\fR (or the value of the \fBdirsfile\fR shell variable) (+).
The shell may read \fI/etc/csh.login\fR before instead of after
@ -251,13 +257,13 @@ Finally, \fBEditor commands\fR lists and describes
the editor commands specific to the shell and their default bindings.
.SS "The command-line editor (+)"
Command-line input can be edited using key sequences much like those used in
GNU Emacs or \fIvi\fR(1).
\fIemacs\fR(1) or \fIvi\fR(1).
The editor is active only when the \fBedit\fR shell variable is set, which
it is by default in interactive shells.
The \fIbindkey\fR builtin can display and change key bindings.
Emacs-style key bindings are used by default
\fIemacs\fR(1)\-style key bindings are used by default
(unless the shell was compiled otherwise; see the \fBversion\fR shell variable),
but \fIbindkey\fR can change the key bindings to \fIvi\fR-style bindings en masse.
but \fIbindkey\fR can change the key bindings to \fIvi\fR(1)\-style bindings en masse.
.PP
The shell always binds the arrow keys (as defined in the \fBTERMCAP\fR
environment variable) to
@ -284,10 +290,12 @@ One can set the arrow key escape sequences to the empty string with \fIsettc\fR
to prevent these bindings.
The ANSI/VT100 sequences for arrow keys are always bound.
.PP
Other key bindings are, for the most part, what Emacs and \fIvi\fR(1)
Other key bindings are, for the most part, what \fIemacs\fR(1) and \fIvi\fR(1)
users would expect and can easily be displayed by \fIbindkey\fR, so there
is no need to list them here. Likewise, \fIbindkey\fR can list the editor
commands with a short description of each.
Certain key bindings have different behavior depending if \fIemacs\fR(1) or \fIvi\fR(1)
style bindings are being used; see \fBvimode\fR for more information.
.PP
Note that editor commands do not have the same notion of a ``word'' as does the
shell. The editor delimits words with any non-alphanumeric characters not in
@ -408,7 +416,7 @@ README main.c meal side.o
.br
condiments.h main.c~
.br
> set fignore = (.o \\~)
> set fignore = (.o \e~)
.br
> emacs ma[^D]
.br
@ -420,7 +428,7 @@ main.c main.c~ main.o
.PP
`main.c~' and `main.o' are ignored by completion (but not listing),
because they end in suffixes in \fBfignore\fR.
Note that a `\\' was needed in front of `~' to prevent it from being
Note that a `\e' was needed in front of `~' to prevent it from being
expanded to \fBhome\fR as described under \fBFilename substitution\fR.
\fBfignore\fR is ignored if only one completion is possible.
.PP
@ -534,10 +542,6 @@ not register a misspelling.
Like completion, spelling correction works anywhere in the line,
pushing the rest of the line to the right and possibly leaving
extra characters to the right of the cursor.
.PP
Beware: spelling correction is not guaranteed to work the way one intends,
and is provided mostly as an experimental feature.
Suggestions and improvements are welcome.
.SS "Editor commands (+)"
`bindkey' lists key bindings and `bindkey \-l' lists and briefly describes
editor commands.
@ -552,6 +556,26 @@ on terminals without a meta key. Case counts, but commands that are bound
to letters by default are bound to both lower- and uppercase letters for
convenience.
.TP 8
.B backward-char \fR(^B, left)
Move back a character.
Cursor behavior modified by \fBvimode\fR.
.TP 8
.B backward-delete-word \fR(M-^H, M-^?)
Cut from beginning of current word to cursor \- saved in cut buffer.
Word boundary behavior modified by \fBvimode\fR.
.TP 8
.B backward-word \fR(M-b, M-B)
Move to beginning of current word.
Word boundary and cursor behavior modified by \fBvimode\fR.
.TP 8
.B beginning-of-line \fR(^A, home)
Move to beginning of line.
Cursor behavior modified by \fBvimode\fR.
.TP 8
.B capitalize-word \fR(M-c, M-C)
Capitalize the characters from cursor to end of current word.
Word boundary behavior modified by \fBvimode\fR.
.TP 8
.B complete-word \fR(tab)
Completes a word as described under \fBCompletion and listing\fR.
.TP 8
@ -569,6 +593,7 @@ Like \fIcomplete-word\fR, but ignores user-defined completions.
.B copy-prev-word \fR(M-^_)
Copies the previous word in the current line into the input buffer.
See also \fIinsert-last-word\fR.
Word boundary behavior modified by \fBvimode\fR.
.TP 8
.B dabbrev-expand \fR(M-/)
Expands the current word to the most recent preceding one for which
@ -581,11 +606,13 @@ much like \fIhistory-search-backward\fR does.
.B delete-char \fR(not bound)
Deletes the character under the cursor.
See also \fIdelete-char-or-list-or-eof\fR.
Cursor behavior modified by \fBvimode\fR.
.TP 8
.B delete-char-or-eof \fR(not bound)
Does \fIdelete-char\fR if there is a character under the cursor
or \fIend-of-file\fR on an empty line.
See also \fIdelete-char-or-list-or-eof\fR.
Cursor behavior modified by \fBvimode\fR.
.TP 8
.B delete-char-or-list \fR(not bound)
Does \fIdelete-char\fR if there is a character under the cursor
@ -600,14 +627,26 @@ See also those three commands, each of which does only a single action, and
\fIdelete-char-or-eof\fR, \fIdelete-char-or-list\fR and \fIlist-or-eof\fR,
each of which does a different two out of the three.
.TP 8
.B delete-word \fR(M-d, M-D)
Cut from cursor to end of current word \- save in cut buffer.
Word boundary behavior modified by \fBvimode\fR.
.TP 8
.B down-history \fR(down-arrow, ^N)
Like \fIup-history\fR, but steps down, stopping at the original input line.
.TP 8
.B downcase-word \fR(M-l, M-L)
Lowercase the characters from cursor to end of current word.
Word boundary behavior modified by \fBvimode\fR.
.TP 8
.B end-of-file \fR(not bound)
Signals an end of file, causing the shell to exit unless the \fBignoreeof\fR
shell variable (q.v.) is set to prevent this.
See also \fIdelete-char-or-list-or-eof\fR.
.TP 8
.B end-of-line \fR(^E, end)
Move cursor to end of line.
Cursor behavior modified by \fBvimode\fR.
.TP 8
.B expand-history \fR(M-space)
Expands history substitutions in the current word.
See \fBHistory substitution\fR.
@ -626,6 +665,14 @@ expands history substitutions in each word in the input buffer.
Expands the variable to the left of the cursor.
See \fBVariable substitution\fR.
.TP 8
.B forward-char \fR(^F, right)
Move forward one character.
Cursor behavior modified by \fBvimode\fR.
.TP 8
.B forward-word \fR(M-f, M-F)
Move forward to end of current word.
Word boundary and cursor behavior modified by \fBvimode\fR.
.TP 8
.B history-search-backward \fR(M-p, M-P)
Searches backwards through the history list for a command beginning with
the current contents of the input buffer up to the cursor and copies it
@ -674,12 +721,13 @@ Any other character not bound to \fIself-insert-command\fR terminates the
search, leaving the current line in the input buffer, and
is then interpreted as normal input. In particular, a carriage return
causes the current line to be executed.
Emacs mode only.
See also \fIi-search-fwd\fR and \fIhistory-search-backward\fR.
Word boundary behavior modified by \fBvimode\fR.
.RE
.TP 8
.B i-search-fwd \fR(not bound)
Like \fIi-search-back\fR, but searches forward.
Word boundary behavior modified by \fBvimode\fR.
.TP 8
.B insert-last-word \fR(M-_)
Inserts the last word of the previous input line (`!$') into the input buffer.
@ -722,9 +770,13 @@ Toggles between input and overwrite modes.
.TP 8
.B run-fg-editor \fR(M-^Z)
Saves the current input line and
looks for a stopped job with a name equal to the last component of the
file name part of the \fBEDITOR\fR or \fBVISUAL\fR environment variables,
or, if neither is set, `ed' or `vi'.
looks for a stopped job where the file name portion of its first word
is found in the \fBeditors\fR shell variable.
If \fBeditors\fR is not set, then the file name portion of the
\fBEDITOR\fR environment variable (`ed' if unset)
and the
\fBVISUAL\fR environment variable (`vi' if unset)
will be used.
If such a job is found, it is restarted as if `fg %\fIjob\fR' had been
typed. This is used to toggle back and forth between an editor and
the shell easily. Some people bind this command to `^Z' so they
@ -760,7 +812,7 @@ unless bound to another command.
.B spell-line \fR(M-$)
Attempts to correct the spelling of each word in the input buffer, like
\fIspell-word\fR, but ignores words whose first character is one of
`\-', `!', `^' or `%', or which contain `\\', `*' or `?', to avoid problems
`\-', `!', `^' or `%', or which contain `\e', `*' or `?', to avoid problems
with switches, substitutions and the like.
See \fBSpelling correction\fR.
.TP 8
@ -781,6 +833,18 @@ Copies the previous entry in the history list into the input buffer.
If \fBhistlit\fR is set, uses the literal form of the entry.
May be repeated to step up through the history list, stopping at the top.
.TP 8
.B upcase-word \fR(M-u, M-U)
Uppercase the characters from cursor to end of current word.
Word boundary behavior modified by \fBvimode\fR.
.TP 8
.B vi-beginning-of-next-word \fR(not bound)
Vi goto the beginning of next word.
Word boundary and cursor behavior modified by \fBvimode\fR.
.TP 8
.B vi-eword \fR(not bound)
Vi move to the end of the current word.
Word boundary behavior modified by \fBvimode\fR.
.TP 8
.B vi-search-back \fR(?)
Prompts with `?' for a search string (which may be a glob-pattern, as with
\fIhistory-search-backward\fR), searches for it and copies it into the
@ -816,16 +880,16 @@ discarded before further parsing.
.PP
A special character (including a blank or tab) may be prevented from having
its special meaning, and possibly made part of another word, by preceding it
with a backslash (`\\') or enclosing it in single (`''), double (`"') or
backward (``') quotes. When not otherwise quoted a newline preceded by a `\\'
with a backslash (`\e') or enclosing it in single (`''), double (`"') or
backward (`\`') quotes. When not otherwise quoted a newline preceded by a `\e'
is equivalent to a blank, but inside quotes this sequence results in a
newline.
.PP
Furthermore, all \fBSubstitutions\fR (see below) except \fBHistory substitution\fR
can be prevented by enclosing the strings (or parts of strings)
in which they appear with single quotes or by quoting the crucial character(s)
(e.g., `$' or ``' for \fBVariable substitution\fR or \fBCommand substitution\fR respectively)
with `\\'. (\fBAlias substitution\fR is no exception: quoting in any way any
(e.g., `$' or `\`' for \fBVariable substitution\fR or \fBCommand substitution\fR respectively)
with `\e'. (\fBAlias substitution\fR is no exception: quoting in any way any
character of a word for which an \fIalias\fR has been defined prevents
substitution of the alias. The usual way of quoting an alias is to precede it
with a backslash.) \fBHistory substitution\fR is prevented by
@ -847,7 +911,7 @@ those parts of the string which need quoting, using different types of quoting
to do so if appropriate.
.PP
The \fBbackslash_quote\fR shell variable (q.v.) can be set to make backslashes
always quote `\\', `'', and `"'. (+) This may make complex quoting tasks
always quote `\e', `'', and `"'. (+) This may make complex quoting tasks
easier, but it can cause syntax errors in \fIcsh\fR(1) scripts.
.SS Substitutions
We now describe the various transformations the shell performs on the input in
@ -880,7 +944,7 @@ command in the current command, or fix spelling mistakes in the previous
command with little typing and a high degree of confidence.
.PP
History substitutions begin with the character `!'. They may begin anywhere in
the input stream, but they do not nest. The `!' may be preceded by a `\\' to
the input stream, but they do not nest. The `!' may be preceded by a `\e' to
prevent its special meaning; for convenience, a `!' is passed unchanged when it
is followed by a blank, tab, newline, `=' or `('. History substitutions also
occur when an input line begins with `^'. This special abbreviation will be
@ -1046,8 +1110,8 @@ Substitute \fIl\fR for \fIr\fR.
\fIl\fR is simply a string like \fIr\fR, not a regular expression as in
the eponymous \fIed\fR(1) command.
Any character may be used as the delimiter in place of `/';
a `\\' can be used to quote the delimiter inside \fIl\fR and \fIr\fR.
The character `&' in the \fIr\fR is replaced by \fIl\fR; `\\' also quotes `&'.
a `\e' can be used to quote the delimiter inside \fIl\fR and \fIr\fR.
The character `&' in the \fIr\fR is replaced by \fIl\fR; `\e' also quotes `&'.
If \fIl\fR is empty (``''), the \fIl\fR from a previous substitution or the
\fIs\fR from a previous search or event number in event specification is used.
The trailing delimiter may be omitted if it is immediately followed by a newline.
@ -1187,7 +1251,7 @@ After the input line is aliased and parsed, and before each command is
executed, variable substitution is performed keyed by `$' characters. This
expansion can be prevented by preceding the `$' with a `\e' except within `"'s
where it \fIalways\fR occurs, and within `''s where it \fInever\fR occurs.
Strings quoted by ``' are interpreted later (see \fBCommand substitution\fR
Strings quoted by `\`' are interpreted later (see \fBCommand substitution\fR
below) so `$' substitution does not occur there until later,
if at all. A `$' is passed unchanged if followed by a blank, tab, or
end-of-line.
@ -1316,7 +1380,7 @@ shell, the command name is substituted separately from the argument list. This
occurs very late, after input-output redirection is performed, and in a child
of the main shell.
.SS "Command substitution"
Command substitution is indicated by a command enclosed in ``'. The output
Command substitution is indicated by a command enclosed in `\`'. The output
from such a command is broken into separate words at blanks, tabs and newlines,
and null words are discarded. The output is variable and command substituted
and put in place of the original string.
@ -1401,7 +1465,7 @@ The \fBglobstar\fR shell variable can be set to allow `**' or `***' as
a file glob pattern that matches any string of characters including `/',
recursively traversing any existing sub-directories. For example,
`ls **.c' will list all the .c files in the current directory tree.
If used by itself, it will match match zero or more sub-directories
If used by itself, it will match zero or more sub-directories
(e.g. `ls /usr/include/**/time.h' will list any file named `time.h'
in the /usr/include directory tree; `ls /usr/include/**time.h' will match
any file in the /usr/include directory tree ending in `time.h'; and
@ -1549,9 +1613,9 @@ expanded) as the standard input.
Read the shell input up to a line which is identical to \fIword\fR. \fIword\fR
is not subjected to variable, filename or command substitution, and each input
line is compared to \fIword\fR before any substitutions are done on this input
line. Unless a quoting `\e', `"', `' or ``' appears in \fIword\fR variable and
line. Unless a quoting `\e', `"', `' or `\`' appears in \fIword\fR variable and
command substitution is performed on the intervening lines, allowing `\e' to
quote `$', `\e' and ``'. Commands which are substituted have all blanks, tabs,
quote `$', `\e' and `\`'. Commands which are substituted have all blanks, tabs,
and newlines preserved, except for the final newline which is dropped. The
resultant text is placed in an anonymous temporary file which is given to the
command as standard input.
@ -1573,6 +1637,9 @@ If the shell variable \fBnoclobber\fR is set, then the file must not exist or be
character special file (e.g., a terminal or `/dev/null') or an error results.
This helps prevent accidental destruction of files. In this case the `!' forms
can be used to suppress this check.
If \fBnotempty\fR is given in \fBnoclobber\fR, `>' is allowed on empty files;
if \fBask\fR is set, an interacive confirmation is presented, rather than an
error.
.PP
The forms involving `&' route the diagnostic output into the specified file as
well as the standard output. \fIname\fR is expanded in the same way as `<'
@ -1746,7 +1813,7 @@ rather than to the file to which the link points (+) *
see if it has the specified relationship to the real user. If \fIfile\fR
does not exist or is inaccessible or, for the operators indicated by `*',
if the specified file type does not exist on the current system,
then all enquiries return false, i.e., `0'.
then all inquiries return false, i.e., `0'.
.PP
These operators may be combined for conciseness: `\-\fIxy file\fR' is
equivalent to `\-\fIx file\fR && \-\fIy file\fR'. (+) For example, `\-fx' is true
@ -2174,17 +2241,20 @@ Options include:
Lists all editor commands and a short description of each.
.TP 4
.B \-d
Binds all keys to the standard bindings for the default editor.
Binds all keys to the standard bindings for the default editor,
as per \fB-e\fR and \fB-v\fR below.
.TP 4
.B \-e
Binds all keys to the standard GNU Emacs-like bindings.
Binds all keys to \fIemacs\fR(1)\-style bindings.
Unsets \fBvimode\fR.
.TP 4
.B \-v
Binds all keys to the standard \fIvi\fR(1)-like bindings.
Binds all keys to \fIvi\fR(1)\-style bindings.
Sets \fBvimode\fR.
.TP 4
.B \-a
Lists or changes key-bindings in the alternative key map.
This is the key map used in \fIvi\fR command mode.
This is the key map used in \fBvimode\fR command mode.
.TP 4
.B \-b
\fIkey\fR is interpreted as
@ -2262,7 +2332,7 @@ The ASCII character corresponding to the octal number \fInnn\fR
.RE
.PP
`\e' nullifies the special meaning of the following character, if it has
any, notably `\\' and `^'.
any, notably `\e' and `^'.
.RE
.TP 8
.B bs2cmd \fIbs2000-command\fR (+)
@ -2293,14 +2363,16 @@ A label in a \fIswitch\fR statement as discussed below.
.TP 8
.B cd \fR[\fB\-p\fR] [\fB\-l\fR] [\fB\-n\fR|\fB\-v\fR] [\I--\fR] [\fIname\fR]
If a directory \fIname\fR is given, changes the shell's working directory
to \fIname\fR. If not, changes to \fBhome\fR.
to \fIname\fR. If not, changes to \fBhome\fR, unless the \fBcdtohome\fR
variable is not set, in which case a \fIname\fR is required.
If \fIname\fR is `\-' it is interpreted as the previous working directory
(see \fBOther substitutions\fR). (+)
If \fIname\fR is not a subdirectory of the current directory
(and does not begin with `/', `./' or `../'), each component of the variable
\fBcdpath\fR is checked to see if it has a subdirectory \fIname\fR. Finally, if
all else fails but \fIname\fR is a shell variable whose value
begins with `/', then this is tried to see if it is a directory.
begins with `/' or '.', then this is tried to see if it is a directory, and
the \fB\-p\fR option is implied.
.RS +8
.PP
With \fB\-p\fR, prints the final directory stack, just like \fIdirs\fR.
@ -2309,7 +2381,7 @@ as on \fIdirs\fR, and they imply \fB\-p\fR. (+)
Using \fB\-\-\fR forces a break from option processing so the next word
is taken as the directory \fIname\fR even if it begins with '\-'. (+)
.PP
See also the \fBimplicitcd\fR shell variable.
See also the \fBimplicitcd\fR and \fBcdtohome\fR shell variables.
.RE
.TP 8
.B chdir
@ -2428,7 +2500,7 @@ Words from the variable \fIvar\fR
(...)
Words from the given list
.TP 8
`...`
\`...\`
Words from the output of command
.PD
.RE
@ -2445,7 +2517,7 @@ 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
\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
@ -2526,7 +2598,7 @@ rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net
.PP
or from a command run at completion time:
.IP "" 4
> complete kill 'p/*/`ps | awk \\{print\\ \\$1\\}`/'
> complete kill 'p/*/\`ps | awk \e{print\e \e$1\e}\`/'
.br
> kill \-9 [^D]
.br
@ -2587,7 +2659,7 @@ again the order in which the completions are specified.
.PP
Finally, here's a complex example for inspiration:
.IP "" 4
> complete find \\
> complete find \e
.br
\&'n/\-name/f/' 'n/\-newer/f/' 'n/\-{,n}cpio/f/' \e
.br
@ -2618,8 +2690,6 @@ and completes anything not otherwise completed to a directory. Whew.
.PP
Remember that programmed completions are ignored if the word being completed
is a tilde substitution (beginning with `~') or a variable (beginning with `$').
\fIcomplete\fR is an experimental feature, and the syntax may change
in future versions of the shell.
See also the \fIuncomplete\fR builtin command.
.RE
.TP 8
@ -2684,7 +2754,7 @@ or does not have that capability). One might use this to make the output
from a shell script less verbose on slow terminals, or limit command
output to the number of lines on the screen:
.IP "" 4
> set history=`echotc lines`
> set history=\`echotc lines\`
.br
> @ history\-\-
.PP
@ -2693,9 +2763,9 @@ One should use double quotes when setting a shell variable to a terminal
capability string, as in the following example that places the date in
the status line:
.IP "" 4
> set tosl="`echotc ts 0`"
> set tosl="\`echotc ts 0\`"
.br
> set frsl="`echotc fs`"
> set frsl="\`echotc fs\`"
.br
> echo \-n "$tosl";date; echo \-n "$frsl"
.PP
@ -2814,8 +2884,10 @@ number, at most that many lines are saved. If the second word of
existing history file instead of replacing it (if there is one) and
sorted by time stamp. (+) Merging is intended for an environment like
the X Window System
with several shells in simultaneous use. Currently it succeeds
only when the shells quit nicely one after another.
with several shells in simultaneous use. If the second word of \fBsavehist\fR
is `merge' and the third word is set to `lock', the history file update
will be serialized with other shell sessions that would possibly like
to merge history at exactly the same time.
.PP
With \fB\-L\fR, the shell appends \fIfilename\fR, which is presumably a
history list saved by the \fB\-S\fR option or the \fBsavehist\fR mechanism,
@ -2958,6 +3030,12 @@ may allocate per \fIbrk()\fR system call
\fIdescriptors\fR or \fIopenfiles\fR
the maximum number of open files for this process
.TP
\fIpseudoterminals\fR
the maximum number of pseudo-terminals for this user
.TP
\fIkqueues\fR
the maximum number of kqueues allocated for this process
.TP
\fIconcurrency\fR
the maximum number of threads for this process
.TP
@ -2967,6 +3045,13 @@ the maximum size which a process may lock into memory using mlock(2)
\fImaxproc\fR
the maximum number of simultaneous processes for this user id
.TP
\fImaxthread\fR
the maximum number of simultaneous threads (lightweight processes) for this
user id
.TP
\fIthreads\fR
the maximum number of threads for this process
.TP
\fIsbsize\fR
the maximum size of socket buffer usage for this user
.TP
@ -2976,6 +3061,9 @@ the maximum amount of swap space reserved or used for this user
\fImaxlocks\fR
the maximum number of locks for this user
.TP
\fIposixlocks\fR
the maximum number of POSIX advisory locks for this user
.TP
\fImaxsignal\fR
the maximum number of pending signals for this user
.TP
@ -3212,12 +3300,13 @@ For example,
.PD
.RS +8
.IP "" 4
> sched 11:00 echo It\\'s eleven o\\'clock.
> sched 11:00 echo It\e's eleven o\e'clock.
.PP
causes the shell to echo `It's eleven o'clock.' at 11 AM.
The time may be in 12-hour AM/PM format
.IP "" 4
> sched 5pm set prompt='[%h] It\\'s after 5; go home: >'
.\" TODO
> sched 5pm set prompt='[%h] It\e's after 5; go home: >'
.PP
or may be relative to the current time:
.IP "" 4
@ -3615,7 +3704,7 @@ whenever the environment variable changes the shell changes the corresponding
shell variable to match (unless the shell variable is read-only) and vice
versa. Note that although \fBcwd\fR and \fBPWD\fR have identical meanings, they
are not synchronized in this manner, and that the shell automatically
interconverts the different formats of \fBpath\fR and \fBPATH\fR.
converts between the different formats of \fBpath\fR and \fBPATH\fR.
.TP 8
.B addsuffix \fR(+)
If set, filename completion adds `/' to the end of directories and a space
@ -3629,6 +3718,11 @@ the local username for kerberos authentication.
.B ampm \fR(+)
If set, all times are shown in 12-hour AM/PM format.
.TP 8
.B anyerror \fR(+)
This variable selects what is propagated to the value of the
\fBstatus\fR variable. For more information see the description of the
\fBstatus\fR variable below.
.TP 8
.B argv
The arguments to the shell. Positional parameters are taken from \fBargv\fR,
i.e., `$1' is replaced by `$argv[1]', etc.
@ -3672,7 +3766,8 @@ command completion or spelling correction attempt if set to `complete' or
cases.
.TP 8
.B backslash_quote \fR(+)
If set, backslashes (`\\') always quote `\\', `'', and `"'. This may make
.\" TODO
If set, backslashes (`\e') always quote `\e', `'', and `"'. This may make
complex quoting tasks easier, but it can cause syntax errors in \fIcsh\fR(1)
scripts.
.TP 8
@ -3685,6 +3780,11 @@ default `tcsh'.
A list of directories in which \fIcd\fR should search for
subdirectories if they aren't found in the current directory.
.TP 8
.B cdtohome \fR(+)
If not set, \fIcd\fR requires a directory \fIname\fR, and will not go to the
\fBhome\fR directory if it's omitted.
This is set by default.
.TP 8
.B color
If set, it enables color display for the builtin \fBls\-F\fR and it passes
\fB\-\-color=auto\fR to \fBls\fR. Alternatively, it can be set to only
@ -3710,7 +3810,7 @@ periods, hyphens and underscores (`.', `\-' and `_') as word
separators.
If set to `Enhance', completion matches uppercase and underscore
characters explicitly and matches lowercase and hyphens in a
case-insensivite manner; it will treat periods, hypens and underscores
case-insensitive manner; it will treat periods, hyphens and underscores
as word separators.
.TP 8
.B continue \fR(+)
@ -3721,7 +3821,7 @@ commands, instead of starting a new one.
Same as continue, but the shell will execute:
.RS +8
.IP "" 4
echo `pwd` $argv > ~/.<cmd>_pause; %<cmd>
echo \`pwd\` $argv > ~/.<cmd>_pause; %<cmd>
.RE
.TP 8
.B correct \fR(+)
@ -3831,13 +3931,14 @@ The style of the \fIecho\fR builtin. May be set to
.PD 0
.TP 8
bsd
Don't echo a newline if the first argument is `\-n'.
Don't echo a newline if the first argument is `\-n'; the default for \fIcsh\fR.
.TP 8
sysv
Recognize backslashed escape sequences in echo strings.
.TP 8
both
Recognize both the `\-n' flag and backslashed escape sequences; the default.
Recognize both the `\-n' flag and backslashed escape sequences; the default
for \fItcsh\fR.
.TP 8
none
Recognize neither.
@ -3852,6 +3953,11 @@ systems.
If set, the command-line editor is used. Set by default in interactive
shells.
.TP 8
.B editors \fR(+)
A list of command names for the \fIrun-fg-editor\fR editor command to match.
If not set, the \fBEDITOR\fR (`ed' if unset) and \fBVISUAL\fR (`vi' if unset)
environment variables will be used instead.
.TP 8
.B ellipsis \fR(+)
If set, the `%c'/`%.' and `%C' prompt sequences (see the \fBprompt\fR
shell variable) indicate skipped directories with an ellipsis (`...')
@ -3884,7 +3990,7 @@ with `.' except for `.' and `..'
If set, the `**' and `***' file glob patterns will match any string of
characters including `/' traversing any existing sub-directories. (e.g.
`ls **.c' will list all the .c files in the current directory tree).
If used by itself, it will match match zero or more sub-directories
If used by itself, it will match zero or more sub-directories
(e.g. `ls /usr/include/**/time.h' will list any file named `time.h'
in the /usr/include directory tree; whereas `ls /usr/include/**time.h'
will match any file in the /usr/include directory tree ending in `time.h').
@ -3937,7 +4043,7 @@ also the \fItoggle-literal-history\fR editor command.
.B history
The first word indicates the number of history events to save. The
optional second word (+) indicates the format in which history is
printed; if not given, `%h\\t%T\\t%R\\n' is used. The format sequences
printed; if not given, `%h\et%T\et%R\en' is used. The format sequences
are described below under \fBprompt\fR; note the variable meaning of
`%R'. Set to `100' by default.
.TP 8
@ -4278,7 +4384,7 @@ Set by default to `%# ' in interactive shells.
.TP 8
.B prompt2 \fR(+)
The string with which to prompt in \fIwhile\fR and \fIforeach\fR loops and
after lines ending in `\\'.
after lines ending in `\e'.
The same format sequences may be used as in \fBprompt\fR (q.v.);
note the variable meaning of `%R'.
Set by default to `%R? ' in interactive shells.
@ -4329,14 +4435,19 @@ entries are saved.
.B savehist
If set, the shell does `history \-S' before exiting.
If the first word is set to a number, at most that many lines are saved.
(The number must be less than or equal to \fBhistory\fR.)
(The number should be less than or equal to the number \fBhistory\fR entries;
if it is set to greater than the number of \fBhistory\fR settings, only
\fBhistory\fR entries will be saved)
If the second word is set to `merge', the history list is merged with
the existing history file instead of replacing it (if there is one) and
sorted by time stamp and the most recent events are retained. (+)
sorted by time stamp and the most recent events are retained.
If the second word of \fBsavehist\fR is `merge' and the third word is set to
`lock', the history file update will be serialized with other shell sessions
that would possibly like to merge history at exactly the same time. (+)
.TP 8
.B sched \fR(+)
The format in which the \fIsched\fR builtin command prints scheduled events;
if not given, `%h\\t%T\\t%R\\n' is used.
if not given, `%h\et%T\et%R\en' is used.
The format sequences are described above under \fBprompt\fR;
note the variable meaning of `%R'.
.TP 8
@ -4353,17 +4464,22 @@ Reset to 1 in login shells.
See also \fBloginsh\fR.
.TP 8
.B status
The status returned by the last command, unless the variable
.B anyerror
is set, and any error in a pipeline or a backquote expansion will be
propagated (this is the default
.B csh
behavior, and the current
.B tcsh
default). If it terminated
abnormally, then 0200 is added to the status. Builtin commands
which fail return exit status `1', all other builtin commands
return status `0'.
The exit status from the last command or backquote expansion, or any
command in a pipeline is propagated to \fBstatus\fR. (This is also the
default \fBcsh\fR behavior.)
This default does not match what POSIX mandates (to return the
status of the last command only). To match the POSIX behavior, you need
to unset \fBanyerror\fR.
.RS +8
.PP
If the \fBanyerror\fR variable is unset, the exit status of a pipeline
is determined only from the last command in the pipeline, and the exit
status of a backquote expansion is \fInot\fR propagated to \fBstatus\fR.
.PP
If a command terminated abnormally, then 0200 is added to the status.
Builtin commands which fail return exit status `1', all other builtin
commands return status `0'.
.RE
.TP 8
.B symlinks \fR(+)
Can be set to several different values to control symbolic link (`symlink')
@ -4624,7 +4740,7 @@ nd
`.' is omitted from \fBpath\fR for security
.TP 6
vi
\fIvi\fR-style editing is the default rather than \fIemacs\fR
\fIvi\fR(1)\-style editing is the default rather than \fIemacs\fR(1)\-style
.TP 6
dtr
Login shells drop DTR when exiting
@ -4662,6 +4778,23 @@ An administrator may enter additional strings to indicate differences
in the local version.
.RE
.TP 8
.B vimode \fR(+)
.RS +8
If unset, various key bindings change behavior to be more \fBemacs\fR(1)\-style:
word boundaries are determined by \fBwordchars\fR versus other characters.
.PP
If set, various key bindings change behavior to be more \fBvi\fR(1)\-style:
word boundaries are determined by \fBwordchars\fR versus whitespace
versus other characters;
cursor behavior depends upon current vi mode (command, delete, insert, replace).
.PP
This variable is unset by \fIbindkey\fR \fB-e\fR and
set by \fIbindkey\fR \fB-v\fR.
.B vimode
may be explicitly set or unset by the user after those \fIbindkey\fR
operations if required.
.RE
.TP 8
.B visiblebell \fR(+)
If set, a screen flash is used rather than the audible bell.
See also \fBnobeep\fR.
@ -4726,7 +4859,9 @@ which don't store the remote hostname.
.B wordchars \fR(+)
A list of non-alphanumeric characters to be considered part of a word by the
\fIforward-word\fR, \fIbackward-word\fR etc., editor commands.
If unset, `*?_\-.[]~=' is used.
If unset, the default value is determined based on the state of \fBvimode\fR:
if \fBvimode\fR is unset, `*?_\-.[]~=' is used as the default;
if \fBvimode\fR is set, `_' is used as the default.
.SH ENVIRONMENT
.TP 8
.B AFSUSER \fR(+)
@ -4741,8 +4876,9 @@ If set, the shell does not set \fBautologout\fR (q.v.).
.TP 8
.B EDITOR
The pathname to a default editor.
See also the \fBVISUAL\fR environment variable
and the \fIrun-fg-editor\fR editor command.
Used by the \fIrun-fg-editor\fR editor command if the
the \fBeditors\fR shell variable is unset.
See also the \fBVISUAL\fR environment variable.
.TP 8
.B GROUP \fR(+)
Equivalent to the \fBgroup\fR shell variable.
@ -4978,8 +5114,9 @@ The vendor, as determined at compile time.
.TP 8
.B VISUAL
The pathname to a default full-screen editor.
See also the \fBEDITOR\fR environment variable
and the \fIrun-fg-editor\fR editor command.
Used by the \fIrun-fg-editor\fR editor command if the
the \fBeditors\fR shell variable is unset.
See also the \fBEDITOR\fR environment variable.
.SH FILES
.PD 0
.TP 16
@ -5047,8 +5184,9 @@ This manual describes \fItcsh\fR as a single entity,
but experienced \fIcsh\fR(1) users will want to pay special attention to
\fItcsh\fR's new features.
.PP
A command-line editor, which supports GNU Emacs or \fIvi\fR(1)-style
key bindings. See \fBThe command-line editor\fR and \fBEditor commands\fR.
A command-line editor, which supports \fIemacs\fR(1)\-style
or \fIvi\fR(1)\-style key bindings.
See \fBThe command-line editor\fR and \fBEditor commands\fR.
.PP
Programmable, interactive word completion and listing.
See \fBCompletion and listing\fR and the \fIcomplete\fR and \fIuncomplete\fR
@ -5201,7 +5339,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.18.01 (Astron) 2012-02-14.
This manual documents tcsh 6.20.00 (Astron) 2016-11-24.
.SH AUTHORS
.PD 0
.TP 2

9866
contrib/tcsh/tcsh.man.new Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $Header: /p/tcsh/cvsroot/tcsh/tw.color.c,v 1.27 2010/08/19 05:52:19 christos Exp $ */
/* $Header: /p/tcsh/cvsroot/tcsh/tw.color.c,v 1.33 2015/05/28 11:53:49 christos Exp $ */
/*
* tw.color.c: builtin color ls-F
*/
@ -32,7 +32,7 @@
*/
#include "sh.h"
RCSID("$tcsh: tw.color.c,v 1.27 2010/08/19 05:52:19 christos Exp $")
RCSID("$tcsh: tw.color.c,v 1.33 2015/05/28 11:53:49 christos Exp $")
#include "tw.h"
#include "ed.h"
@ -91,13 +91,66 @@ static Variable variables[] = {
VAR(NOS, "ca", "30;41"), /* File with capability */
};
enum FileType {
VDir, VSym, VOrph, VPipe, VSock, VDoor, VBlock, VChr, VExe,
VFile, VNormal, VMiss, VLeft, VRight, VEnd
};
#define nvariables (sizeof(variables)/sizeof(variables[0]))
enum FileType {
VDir, VSym, VOrph, VPipe, VSock, VDoor, VBlock, VChr, VExe,
VFile, VNormal, VMiss, VLeft, VRight, VEnd, VSuid, VSgid, VSticky,
VOther, Vstird, VReset, Vhard, Vhard2, VCap
};
/*
* Map from LSCOLORS entry index to Variable array index
*/
static const uint8_t map[] = {
VDir, /* Directory */
VSym, /* Symbolic Link */
VSock, /* Socket */
VPipe, /* Named Pipe */
VExe, /* Executable */
VBlock, /* Block Special */
VChr, /* Character Special */
VSuid, /* Setuid Executable */
VSgid, /* Setgid Executable */
VSticky, /* Directory writable to others and sticky */
VOther, /* Directory writable to others but not sticky */
};
enum ansi {
ANSI_RESET_ON = 0, /* reset colors/styles (white on black) */
ANSI_BOLD_ON = 1, /* bold on */
ANSI_ITALICS_ON = 3, /* italics on */
ANSI_UNDERLINE_ON = 4, /* underline on */
ANSI_INVERSE_ON = 7, /* inverse on */
ANSI_STRIKETHROUGH_ON = 9, /* strikethrough on */
ANSI_BOLD_OFF = 21, /* bold off */
ANSI_ITALICS_OFF = 23, /* italics off */
ANSI_UNDERLINE_OFF = 24, /* underline off */
ANSI_INVERSE_OFF = 27, /* inverse off */
ANSI_STRIKETHROUGH_OFF = 29,/* strikethrough off */
ANSI_FG_BLACK = 30, /* fg black */
ANSI_FG_RED = 31, /* fg red */
ANSI_FG_GREEN = 32, /* fg green */
ANSI_FG_YELLOW = 33, /* fg yellow */
ANSI_FG_BLUE = 34, /* fg blue */
ANSI_FG_MAGENTA = 35, /* fg magenta */
ANSI_FG_CYAN = 36, /* fg cyan */
ANSI_FG_WHITE = 37, /* fg white */
ANSI_FG_DEFAULT = 39, /* fg default (white) */
ANSI_BG_BLACK = 40, /* bg black */
ANSI_BG_RED = 41, /* bg red */
ANSI_BG_GREEN = 42, /* bg green */
ANSI_BG_YELLOW = 43, /* bg yellow */
ANSI_BG_BLUE = 44, /* bg blue */
ANSI_BG_MAGENTA = 45, /* bg magenta */
ANSI_BG_CYAN = 46, /* bg cyan */
ANSI_BG_WHITE = 47, /* bg white */
ANSI_BG_DEFAULT = 49, /* bg default (black) */
};
#define TCSH_BOLD 0x80
typedef struct {
Str extension; /* file extension */
Str color; /* color string */
@ -167,6 +220,101 @@ getstring(char **dp, const Char **sp, Str *pd, int f)
return *s == (Char)f;
}
static void
init(size_t colorlen, size_t extnum)
{
size_t i;
xfree(extensions);
for (i = 0; i < nvariables; i++)
variables[i].color = variables[i].defaultcolor;
if (colorlen == 0 && extnum == 0) {
extensions = NULL;
colors = NULL;
} else {
extensions = xmalloc(colorlen + extnum * sizeof(*extensions));
colors = extnum * sizeof(*extensions) + (char *)extensions;
}
nextensions = 0;
}
static int
color(Char x)
{
static const char ccolors[] = "abcdefghx";
char *p;
if (Isupper(x)) {
x = Tolower(x);
}
if (x == '\0' || (p = strchr(ccolors, x)) == NULL)
return -1;
return 30 + (p - ccolors);
}
static void
makecolor(char **c, int fg, int bg, Str *v)
{
int l;
if (fg & 0x80)
l = xsnprintf(*c, 12, "%.2d;%.2d;%.2d;%.2d", ANSI_BOLD_ON,
fg & ~TCSH_BOLD, (10 + bg) & ~TCSH_BOLD, ANSI_BOLD_OFF);
l = xsnprintf(*c, 6, "%.2d;%.2d",
fg & ~TCSH_BOLD, (10 + bg) & ~TCSH_BOLD);
v->s = *c;
v->len = l;
*c += l + 1;
}
/* parseLSCOLORS():
* Parse the LSCOLORS environment variable
*/
static const Char *xv; /* setjmp clobbering */
void
parseLSCOLORS(const Char *value)
{
size_t i, len, clen;
jmp_buf_t osetexit;
size_t omark;
xv = value;
if (xv == NULL) {
init(0, 0);
return;
}
len = Strlen(xv);
len >>= 1;
clen = len * 12; /* "??;??;??;??\0" */
init(clen, 0);
/* Prevent from crashing if unknown parameters are given. */
omark = cleanup_push_mark();
getexit(osetexit);
/* init pointers */
if (setexit() == 0) {
const Char *v = xv;
char *c = colors;
int fg, bg;
for (i = 0; i < len; i++) {
fg = color(*v++);
if (fg == -1)
stderror(ERR_BADCOLORVAR, v[-1], '?');
bg = color(*v++);
if (bg == -1)
stderror(ERR_BADCOLORVAR, '?', v[-1]);
makecolor(&c, fg, bg, &variables[map[i]].color);
}
}
cleanup_pop_mark(omark);
resexit(osetexit);
}
/* parseLS_COLORS():
* Parse the LS_COLORS environment variable
@ -183,16 +331,11 @@ parseLS_COLORS(const Char *value)
(void) &e;
/* init */
xfree(extensions);
for (i = 0; i < nvariables; i++)
variables[i].color = variables[i].defaultcolor;
colors = NULL;
extensions = NULL;
nextensions = 0;
if (value == NULL)
if (value == NULL) {
init(0, 0);
return;
}
len = Strlen(value);
/* allocate memory */
@ -200,14 +343,13 @@ parseLS_COLORS(const Char *value)
for (v = value; *v; v++)
if ((*v & CHAR) == ':')
i++;
extensions = xmalloc(len + i * sizeof(Extension));
colors = i * sizeof(Extension) + (char *)extensions;
nextensions = 0;
init(len, i);
/* init pointers */
v = value;
c = colors;
e = &extensions[0];
e = extensions;
/* Prevent from crashing if unknown parameters are given. */
@ -216,43 +358,43 @@ parseLS_COLORS(const Char *value)
if (setexit() == 0) {
/* parse */
while (*v) {
switch (*v & CHAR) {
case ':':
v++;
continue;
case '*': /* :*ext=color: */
v++;
if (getstring(&c, &v, &e->extension, '=') &&
0 < e->extension.len) {
/* parse */
while (*v) {
switch (*v & CHAR) {
case ':':
v++;
getstring(&c, &v, &e->color, ':');
e++;
continue;
}
break;
default: /* :vl=color: */
if (v[0] && v[1] && (v[2] & CHAR) == '=') {
for (i = 0; i < nvariables; i++)
if ((Char)variables[i].variable[0] == (v[0] & CHAR) &&
(Char)variables[i].variable[1] == (v[1] & CHAR))
break;
if (i < nvariables) {
v += 3;
getstring(&c, &v, &variables[i].color, ':');
case '*': /* :*ext=color: */
v++;
if (getstring(&c, &v, &e->extension, '=') &&
0 < e->extension.len) {
v++;
getstring(&c, &v, &e->color, ':');
e++;
continue;
}
else
stderror(ERR_BADCOLORVAR, v[0], v[1]);
break;
default: /* :vl=color: */
if (v[0] && v[1] && (v[2] & CHAR) == '=') {
for (i = 0; i < nvariables; i++)
if ((Char)variables[i].variable[0] == (v[0] & CHAR) &&
(Char)variables[i].variable[1] == (v[1] & CHAR))
break;
if (i < nvariables) {
v += 3;
getstring(&c, &v, &variables[i].color, ':');
continue;
}
else
stderror(ERR_BADCOLORVAR, v[0], v[1]);
}
break;
}
break;
while (*v && (*v & CHAR) != ':')
v++;
}
while (*v && (*v & CHAR) != ':')
v++;
}
}
cleanup_pop_mark(omark);
@ -264,15 +406,15 @@ parseLS_COLORS(const Char *value)
/* put_color():
*/
static void
put_color(const Str *color)
put_color(const Str *colorp)
{
size_t i;
const char *c = color->s;
const char *c = colorp->s;
int original_output_raw = output_raw;
output_raw = TRUE;
cleanup_push(&original_output_raw, output_raw_restore);
for (i = color->len; 0 < i; i--)
for (i = colorp->len; 0 < i; i--)
xputchar(*c++);
cleanup_until(&original_output_raw);
}
@ -286,12 +428,12 @@ print_color(const Char *fname, size_t len, Char suffix)
size_t i;
char *filename = short2str(fname);
char *last = filename + len;
Str *color = &variables[VFile].color;
Str *colorp = &variables[VFile].color;
switch (suffix) {
case '>': /* File is a symbolic link pointing to
* a directory */
color = &variables[VDir].color;
colorp = &variables[VDir].color;
break;
case '+': /* File is a hidden directory [aix] or
* context dependent [hpux] */
@ -301,7 +443,7 @@ print_color(const Char *fname, size_t len, Char suffix)
for (i = 0; i < nvariables; i++)
if (variables[i].suffix != NOS &&
(Char)variables[i].suffix == suffix) {
color = &variables[i].color;
colorp = &variables[i].color;
break;
}
if (i == nvariables) {
@ -310,7 +452,7 @@ print_color(const Char *fname, size_t len, Char suffix)
&& strncmp(last - extensions[i].extension.len,
extensions[i].extension.s,
extensions[i].extension.len) == 0) {
color = &extensions[i].color;
colorp = &extensions[i].color;
break;
}
}
@ -318,7 +460,7 @@ print_color(const Char *fname, size_t len, Char suffix)
}
put_color(&variables[VLeft].color);
put_color(color);
put_color(colorp);
put_color(&variables[VRight].color);
}

Some files were not shown because too many files have changed in this diff Show More