Merge tcsh 6.22.03-ceccc7f

PR:		252663
MFC after:	1 week
This commit is contained in:
Dmitry Chagin 2021-03-14 19:33:13 +03:00
commit 5224c2a3bc
35 changed files with 2286 additions and 1370 deletions

View File

@ -1,237 +1,190 @@
* Home
* FAQ
* Y2K
__________________________________________________________________
[Home] FAQ
FAQ
Home | RecentChanges | Preferences
_________________________________________________________________
For the people who do not read the manual!
This is for people who do not read the manual!
Why is the meta key broken in tcsh-5.20 and up?
So far people who don't read manuals don't read this either... I may
call it README.*PLEASE* in the future, but then the same people won't
be able to get ftp it... :-)
_________________________________________________________________
1. Where can I find tcsh sources?
See http://www.tcsh.org/MostRecentRelease for download locations.
_________________________________________________________________
2. Why is the meta key broken in tcsh-5.20 and up?
On some machines the tty is not set up to pass 8 bit characters by
default. Tcsh 5.19 used to try to determine if pass8 should be set by
On some machines the tty is not set up to pass 8 bit characters by
default. Tcsh 5.19 used to try to determine if pass8 should be set by
looking at the terminal's meta key. Unfortunately there is no good way
of determining if the terminal can really pass 8 characters or not.
Consider if you are logged in through a modem line with 7 bits and
parity and your terminal has a meta key. Then tcsh 5.19 would set
of determining if the terminal can really pass 8 characters or not.
Consider if you are logged in through a modem line with 7 bits and
parity and your terminal has a meta key. Then tcsh 5.19 would set
wrongly set pass8.
If you did like the previous behavior you can add in /etc/csh.login,
or in .login:
If you did like the previous behavior you can add in /etc/csh.login, or
in .login:
if ( $?tcsh && $?prompt ) then
if ( "`echotc meta`" == "yes" ) then
stty pass8
endif
endif
If you don't have pass8, maybe one of these would work..
If you don't have pass8, maybe one of these would work:
stty -parity -evenp -oddp cs8 -istrip (rs6000)
stty -parenb -istrip cs8
Finally, tcsh will bind all printable meta characters to the self
insert command. If you don't want that to happen (i.e. use the
Finally, tcsh will bind all printable meta characters to the self
insert command. If you don't want that to happen (i.e. use the
printable meta characters for commands) setenv NOREBIND.
_________________________________________________________________
3. I ran 'dbxtool &' and 'shelltool &' from tcsh, and they end up in
cbreak and no echo mode?
These programs are broken. Background jobs should not try to look at
the tty. What happens is that dbxtool looks in stderr to inherit the
tty setups, but tcsh sets up the tty in cbreak and -echo modes, so
that it can do line editing. This cannot be fixed because tcsh cannot
give away the tty. Pick one of the following as a workaround:
I ran dbxtool & and shelltool & from tcsh, and they end up in cbreak and no
echo mode?
These programs are broken. Background jobs should not try to look at
the tty. What happens is that dbxtool looks in stderr to inherit the
tty setups, but tcsh sets up the tty in cbreak and -echo modes, so that
it can do line editing. This cannot be fixed because tcsh cannot give
away the tty. Pick one of the following as a workaround:
dbxtool < /dev/null >& /dev/null &
/usr/etc/setsid dbxtool &
If that does not work, for dbxtool at least you can add "sh stty sane"
in your .dbxinit
_________________________________________________________________
If that does not work, for dbxtool at least you can add sh stty sane in
your .dbxinit file.
4. I tried to compile tcsh and it cannot find <locale.h>?
I tried to compile tcsh and it cannot find <locale.h>?
Your system does not support NLS. Undefine NLS in config_f.h and it
Your system does not support NLS. Undefine NLS in config_f.h and it
should work fine.
_________________________________________________________________
5. Where can I get csh sources?
Where can I get csh sources?
Csh sources are now available with the 4.4BSD networking
distributions. You don't need csh sources to compile tcsh-6.0x.
_________________________________________________________________
Csh sources are now available with the 4.4BSD networking distributions.
You don't need csh sources to compile tcsh-6.0x.
6. I just made tcsh my login shell, and I cannot ftp any more?
I just made tcsh my login shell, and I cannot ftp any more?
Newer versions of the ftp daemon check for the validity of the user's
shell before they allow logins. The list of valid login shells is
either hardcoded or it is usually in a file called /etc/shells. If it
is hard-coded, then you are out of luck and your best bet is to get a
newer version of ftpd. Otherwise add tcsh to the list of shells. [For
AIX this file is called /etc/security/login.cfg.] Remember that the
full path is required. If there is no /etc/shells, and you are
creating one, remember to add /bin/csh, /bin/sh, and any other valid
shells for your system, so that other people can ftp too :-)
_________________________________________________________________
Newer versions of the ftp daemon check for the validity of the user's
shell before they allow logins. The list of valid login shells is
either hardcoded or it is usually in a file called /etc/shells. If it
is hard-coded, then you are out of luck and your best bet is to get a
newer version of ftpd. Otherwise add tcsh to the list of shells. (For
AIX this file is called /etc/security/login.cfg.) Remember that the
full path is required. If there is no /etc/shells, and you are creating
one, remember to add /bin/csh, /bin/sh, and any other valid shells for
your system, so that other people can ftp too.
7. I am using SunView or OpenWindows and editing is screwed up. In
particular my arrow keys and backspace don't work right. What am I
doing wrong?
I am using SunView or OpenWindows and editing is screwed up. In particular my
arrow keys and backspace don't work right. What am I doing wrong?
Well, cmdtool tries to do its own command line editing and the effect
you get is one of using an editor inside an editor. Both try to
interpret the arrow key sequences and cmdtool wins since it gets them
Well, cmdtool tries to do its own command line editing and the effect
you get is one of using an editor inside an editor. Both try to
interpret the arrow key sequences and cmdtool wins since it gets them
first. The solutions are in my order of preference:
* Don't use suntools
* Use shelltool instead of cmdtool.
* Unset edit in tcsh.
1. Don't use suntools
2. Use shelltool instead of cmdtool.
3. Unset edit in tcsh.
_________________________________________________________________
8. On a SPARCstation running Solaris 2.x and OpenWindows 3.1, inside a
cmdtool, the short-cut key sequence to clear log (i.e. Meta-e or
Diamond-e) doesn't work: it just echos 'e'; or
On a SPARCstation running Solaris 2.x and OpenWindows 3.1, inside a cmdtool,
the short-cut key sequence to clear log (i.e. Meta-e or Diamond-e) doesn't
work: it just echos e; or
Unset edit in tcsh.
_________________________________________________________________
9. On a SPARCstation running Solaris 2.x and OpenWindows 3.1, maketool
(within SPARCworks) doesn't work: it just does a `cd' to the working
directory then stops.
On a SPARCstation running Solaris 2.x and OpenWindows 3.1, maketool (within
SPARCworks) doesn't work: it just does a `cd to the working directory then
stops.
Unset edit in tcsh. Using shelltool instead of cmdtool does not fix
Unset edit in tcsh. Using shelltool instead of cmdtool does not fix
this.
_________________________________________________________________
10. I rlogin to another machine, and then no matter what I tell 'stty'
I cannot get it to pass 8 bit characters?
I rlogin to another machine, and then no matter what I tell stty I cannot get
it to pass 8 bit characters?
Maybe you need to use 'rlogin -8' to tell rlogin to pass 8 bit
Maybe you need to use rlogin -8 to tell rlogin to pass 8 bit
characters.
_________________________________________________________________
11. Where do I get the public domain directory library?
Where do I get the public domain directory library?
Anonymous ftp to prep.ai.mit.edu:/pub/gnu/dirent.tar.Z
_________________________________________________________________
Anonymous ftp to ftp://prep.ai.mit.edu/pub/gnu/dirent.tar.Z
12. I compiled tcsh using gcc, and when I start up it says: tcsh:
Warning no access to tty (Invalid Argument). Thus no job control in
this shell
I compiled tcsh using gcc, and when I start up it says: tcsh: Warning no
access to tty (Invalid Argument). Thus no job control in this shell
Your <sys/ioctl.h> file is not ansi compliant. You have one of 3
Your <sys/ioctl.h> file is not ansi compliant. You have one of 3
choices:
* Run fixincludes from the gcc distribution.
* Add -traditional to the gcc flags.
* Compile with cc.
1. Run fixincludes from the gcc distribution.
2. Add -traditional to the gcc flags.
3. Compile with cc.
_________________________________________________________________
13. I compiled tcsh with the SunOS unbundled compiler and now things
get echo'ed twice.
I compiled tcsh with the SunOS unbundled compiler and now things get echoed
twice.
It is a bug in the unbundled optimizer. Lower the optimization level.
_________________________________________________________________
14. How can I use the arrow keys with hpterm?
How can I use the arrow keys with hpterm?
Hp terminals use the arrow keys internally. You can tell hpterm not to
do that, by sending it the termcap sequence smkx. Since this has to be
done all the time, the easiest thing is to put it as an alias for
done all the time, the easiest thing is to put it as an alias for
precmd, or inside the prompt:
if ($term == "hp") then
set prompt="%{`echotc smkx`%}$prompt"
endif
Note that by doing that you cannot use pgup and pgdn to scroll... Also
if you are using termcap, replace "smkx" with "ks"...
_________________________________________________________________
Note that by doing that you cannot use pgup and pgdn to scroll… Also if
you are using termcap, replace smkx with ks.
15. On POSIX machines ^C and ^Z will do not work when tcsh is a login
shell?
On POSIX machines ^C and ^Z do not work when tcsh is a login shell?
Make sure that the interrupt character is set to ^C and suspend is set
to ^Z; 'stty -a' will show you the current stty settings; 'stty intr
^C susp ^Z' will set them to ^C and ^Z respectively.
_________________________________________________________________
to ^Z; stty -a will show you the current stty settings; stty intr ^C
susp ^Z will set them to ^C and ^Z respectively.
16. I am trying to compile tcsh and I am getting compile errors that
look like:
I am trying to compile tcsh and I am getting compile errors that look like:
>sh.c:???: `STR???' undeclared, outside of functions [gcc]
>"sh.c", line ???: STR??? undefined [cc]
sh.c:???: `STR???' undeclared, outside of functions [gcc]
"sh.c", line ???: STR??? undefined [cc]
You interrupted make, while it was making the automatically generated
headers. Type 'make clean; make'
_________________________________________________________________
You interrupted make, while it was making the automatically generated
headers. Type make clean; make
17. On the cray, sometimes the CR/LF mapping gets screwed up.
On the cray, sometimes the CR/LF mapping gets screwed up.
You are probably logged in to the cray via telnet. Cray's telnetd
implements line mode selection the telnet client you are using does
not implement telnet line mode. This cause the Cray's telnetd to try
to use KLUDGELINEMODE. You can turn off telnet line mode from the cray
side by doing a "stty -extproc", or you can get the Cray AIC to build
a telnetd without KLUDGELINEMODE, or you can compile a new telnet
client (from the BSD net2 tape), or at least on the suns use: 'mode
character'.
_________________________________________________________________
You are probably logged in to the cray via telnet. Cray's telnetd
implements line mode selection the telnet client you are using does not
implement telnet line mode. This cause the Cray's telnetd to try to use
KLUDGELINEMODE. You can turn off telnet line mode from the cray side by
doing a stty -extproc, or you can get the Cray AIC to build a telnetd
without KLUDGELINEMODE, or you can compile a new telnet client (from
the BSD net2 tape), or at least on the suns use: mode character.
18. On AU/X, I made tcsh my startup shell, but the mac desktop is not
starting up (no X11 or Finder), and I only get console emulation.
On AU/X, I made tcsh my startup shell, but the mac desktop is not starting up
(no X11 or Finder), and I only get console emulation.
This is another manifestation of item 5. Just add the pathname to tcsh
in /etc/shells and everything should work fine.
_________________________________________________________________
Add the pathname to tcsh in /etc/shells and everything should work
fine.
19. On machines that use YP (NIS) tilde expansion might end up in
/dev/null
On machines that use YP (NIS) tilde expansion might end up in /dev/null
If this happens complain to your vendor, to get a new version of NIS.
If this happens complain to your vendor, to get a new version of NIS.
You can fix that in tcsh by defining YPBUGS in config.h
_________________________________________________________________
20. Script on SGI 4.0.5 does not give us a tty, so we cannot have job
control.
Script on SGI 4.0.5 does not give us a tty, so we cannot have job control.
Their csh does not have job control either. Try:
% script
% cat > /dev/tty
_________________________________________________________________
21. I start tcsh and it takes a couple of minutes to get the prompt.
I start tcsh and it takes a couple of minutes to get the prompt.
You have defined REMOTEHOST and your DNS is not responding. Either
You have defined REMOTEHOST and your DNS is not responding. Either
undefine REMOTEHOST and recompile or fix your DNS.
_________________________________________________________________
22. If you need help generating your .cshrc file, check out:
If you need help generating your .cshrc file, check out:
http://www.imada.sdu.dk/~blackie/dotfile/
* https://github.com/tcsh-org/tcsh/blob/master/dot.tcshrc
* https://github.com/tcsh-org/tcsh/blob/master/dot.login
or
http://www.dotfiles.com
_________________________________________________________________
23. On POSIX systems the kernel will send hup signals to all the
processes in the foreground process group if 'stty hupcl' is set.
On POSIX systems the kernel will send hup signals to all the processes in the
foreground process group if stty hupcl is set.
For example
./tcsh
echo $$
591
@ -240,65 +193,51 @@
Will kill everything, since hup will be sent to all tcsh processes. To
avoid that you can set stty -hupcl, but it is not recommended.
_________________________________________________________________
24. When I rsh the meta key stops working on the remote machine.
When I rsh the meta key stops working on the remote machine.
Try using rsh -8; this option is undocumented on some systems, but it
works. If that does not work, get and use ssh/sshd. You'll be better
Try using rsh -8; this option is undocumented on some systems, but it
works. If that does not work, get and use ssh/sshd. You'll be better
off from a security point of view anyway.
_________________________________________________________________
25. Tcsh compiled under hp/ux-10.x does not pass resource limits
correctly when ran on hp/ux-11.x systems.
Tcsh compiled under hp/ux-10.x does not pass resource limits correctly when
ran on hp/ux-11.x systems.
This is a problem with lack of ABI compatibility between the two
This is a problem with lack of ABI compatibility between the two
systems. The only solution is to recompile.
_________________________________________________________________
26. Refreshing in command line editing can appear broken on some OS's
Refreshing in command line editing can appear broken on some OS's
This is because the termcap/terminfo description lies about the
ability of the terminal to use tabs. At least on Compaq/DEC Alpha
OSF/1 3.x and 4.x systems, stty -tabs will cause problems.
_________________________________________________________________
This is because the termcap/terminfo description lies about the ability
of the terminal to use tabs. At least on Compaq/DEC Alpha OSF/1 3.x and
4.x systems, stty -tabs will cause problems.
27. Where can I learn the merits of tcsh vs. bash vs. csh vs. sh etc?
Where can I learn the merits of tcsh vs. bash vs. csh vs. sh etc?
You can read the manual page section titled [NEW FEATURES] listing
You can read the manual page section titled [NEW FEATURES] listing
features that tcsh adds to csh.
You can read Tom Christiansen's [Csh Programming Considered Harmful],
a document advocating that csh (and by extension, tcsh) should not be
You can read Tom Christiansen's Csh Programming Considered Harmful, a
document advocating that csh (and by extension, tcsh) should not be
used for writing shell scripts.
XXX: Need to find something about [bash], but bash is sh-compatible
and has many of the same interactive features of tcsh (command
completion does not appear to be as flexible, though).
XXX: Need to find something about bash, but bash is sh-compatible and
has many of the same interactive features of tcsh (command completion
does not appear to be as flexible, though).
[Curtains up: introducing the Z shell] has a pretty good rundown on
zsh. Aside from the arguments about csh being evil, tcsh appears to
compare well with zsh [zsh]. Zsh is sh and ksh compatible, with many
of the interactive features of tcsh.
_________________________________________________________________
Curtains up: introducing the Z shell has a pretty good rundown on zsh.
Aside from the arguments about csh being evil, tcsh appears to compare
well with zsh. Zsh is sh and ksh compatible, with many of the
interactive features of tcsh.
28. Why does FreeBSD's tcsh do history browsing differently than I
expect?
Why does FreeBSD's tcsh do history browsing differently than I expect?
On FreeBSD, by default, the up arrow is set to
"history-search-backward", rather than the default "up-history". As a
result, if you type (part of) a word and press up arrow, you'll see
previous commands that match the prefix. Pretty useful, actually,
although it takes some getting used to. You can use bindkey to see
your settings, and to rebind up & down differently if desired.
_________________________________________________________________
On FreeBSD, by default, the up arrow is set to history-search-backward,
rather than the default up-history. As a result, if you type (part of)
a word and press up arrow, you'll see previous commands that match the
prefix. Pretty useful, actually, although it takes some getting used
to. You can use bindkey to see your settings, and to rebind up & down
differently if desired.
__________________________________________________________________
Everything else is a bug :-(
Christos
_________________________________________________________________
Home | RecentChanges | Preferences
Edit text of this page | View other revisions
Last edited April 29, 2004 15:02 (diff)
Search: ____________________
Page content last updated on 2019-12-31

View File

@ -1,3 +1,25 @@
14. Don't crash with 'bindkey "^0" clear-screen' (Karl Jeacle)
13. Fix $x:q:h and $x:q:t return the whole string for strings not containing /
12. V6.22.03 - 20201118
11. Fix $x:q:h and $x:q:t to not crash (alzwded) with strings containing /
10. Block SIGHUP while writing history/directory stack (Brett Frankenberger)
9. Fixed reversed test that broke history merging (Brett Frankenberger)
8. Prevent recursive entry for writing history (Brett Frankenberger)
7. alxwded@github, keep track of the :g and :a modifiers per modifier they
affect.
6. alzwded@github, fix infinite loop with :gas variable modifier
5. PR/88: Add a Q: modifier that preserves empty arguments leaving :q
alone.
4. V6.22.02 - 20191204
3. Fix version in configure.ac
2. V6.22.01 - 20191201
1. undo PR/88: Preserve empty arguments in :q, since it breaks
$ set x=""
$ alias test "echo "\""$x:q"\"" is working."
$ alias test
echo "
6. V6.22.00 - 20191128
5. PR/113: Sobomax: avoid infinite loops for -c commands when stdout is
not a tty.
4. Avoid infinite loops during history loads when merging, print a better
@ -6,6 +28,7 @@
2. PR/94: Small apple issues (SAVESIGVEC, HOSTTYPE)
1. PR/81: Fix range matching issue where we were comparing with the
range character instead of the start of range. [l-z]* would match foo
12. V6.21.00 - 20190508
11. Abort history loading on words and lines too long
https://bugzilla.redhat.com/show_bug.cgi?id=1598502

View File

@ -492,14 +492,15 @@ SHSRCS= 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 glob.c \
sh.sem.c sh.set.c sh.time.c dotlock.c dotlock.h glob.c \
sh.char.h sh.dir.h sh.proc.h sh.h \
sh.decls.h glob.h ${SYSSRCS}
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} ${SYSOBJS}
sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} dotlock.${SUF} glob.${SUF} \
${SYSOBJS}
TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
tw.comp.c tw.color.c
@ -512,9 +513,10 @@ EDOBJS= ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \
ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF}
TCSRCS= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \
tc.func.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
tc.func.c tc.nls.c tc.nls.h tc.os.c tc.os.h tc.printf.c tc.prompt.c \
tc.disc.${SUF} tc.func.${SUF} tc.nls.${SUF} tc.os.${SUF} \
tc.printf.${SUF} 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
TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \
tc.disc.${SUF} tc.func.${SUF} tc.os.${SUF} tc.printf.${SUF} \
tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \
@ -524,7 +526,7 @@ MISCF = Makefile.std BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md \
FAQ WishList config_f.h eight-bit.me glob.3 patchlevel.h pathnames.h \
tcsh.man Ported src.desc Imakefile imake.config complete.tcsh \
Makefile.vms termcap.vms snames.h host.defs gethost.c tcsh.man2html \
Makefile.in configure.ac Makefile.win32 aclocal.m4
Makefile.in configure.ac Makefile.win32 aclocal.m4 dot.login dot.tcshrc
CONFSRCS=config/[a-z]*

View File

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

View File

@ -6,6 +6,7 @@
# things; Paul Placeway, CIS Dept., Ohio State University
#
SHELL=/bin/sh
ENVCMD=/usr/bin/env
VERSION=@PACKAGE_VERSION@
BUILD=tcsh$(EXEEXT)
VPATH=@srcdir@
@ -410,7 +411,7 @@ AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \
gethost.c tcsh.man2html configure.ac configure config.h.in \
tests/testsuite.at aclocal.m4
tests/testsuite.at aclocal.m4 dot.login dot.tcshrc
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/parenthesis.at tests/syntax.at \
@ -634,6 +635,8 @@ veryclean: clean
${RM} -f Makefile config.h config_p.h
${RM} -f config.status config.cache config.log tcsh.ps
${RM} -f missing
${RM} -f testsuite.log
${RM} -rf testsuite.dir
${RM} -rf autom4te.cache
${RM} -f *~ #*
@ -735,8 +738,10 @@ $(srcdir)/stamp-h.in: $(srcdir)/configure.ac
cd $(srcdir) && autoheader
@echo timestamp > $(srcdir)/stamp-h.in
check: atconfig $(srcdir)/tests/testsuite
$(SHELL) $(srcdir)/tests/testsuite
check test: atconfig $(srcdir)/tests/testsuite
$(ENVCMD) - \
USER="$(USER)" \
$(SHELL) $(srcdir)/tests/testsuite
#
# Dependencies

View File

@ -320,7 +320,7 @@ AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \
gethost.c tcsh.man2html configure.ac configure config.h.in \
aclocal.m4
aclocal.m4 dot.login dot.tcshrc
VHSRCS=${PVSRCS} ${AVSRCS}

View File

@ -297,7 +297,7 @@ AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \
WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \
gethost.c tcsh.man2html configure.ac aclocal.m4
gethost.c tcsh.man2html configure.ac aclocal.m4 dot.login dot.tcshrc
VHSRCS=${PVSRCS} ${AVSRCS}

View File

@ -5,7 +5,7 @@
The Tcsh source code is available on GitHub as a read-only repo
mirror at:
> http://github.com/tcsh-org/tcsh
> https://github.com/tcsh-org/tcsh
Instructions for compiling Tcsh can be found in [BUILDING].
@ -20,7 +20,10 @@ the tcsh mailing list:
> https://mailman.astron.com/mailman/listinfo/tcsh
[![Build Status][status]][travis]
[![Coverity Scan][badge]][coverity]
[BUILDING]: BUILDING
[status]: https://travis-ci.org/tcsh-org/tcsh.svg?branch=master
[travis]: https://travis-ci.org/tcsh-org/tcsh
[badge]: https://scan.coverity.com/projects/20307/badge.svg
[coverity]: https://scan.coverity.com/projects/tcsh-org-tcsh
[status]: https://travis-ci.com/tcsh-org/tcsh.svg?branch=master
[travis]: https://travis-ci.com/tcsh-org/tcsh

2679
contrib/tcsh/configure vendored

File diff suppressed because it is too large Load Diff

12
contrib/tcsh/dot.login Normal file
View File

@ -0,0 +1,12 @@
#
# ~/.login - Setup user login shell environment
#
# See also tcsh(1), environ(7).
#
setenv EDITOR vi
setenv PAGER less
# umask 077
# set path=( ~/.local/bin $path:q )

110
contrib/tcsh/dot.tcshrc Normal file
View File

@ -0,0 +1,110 @@
#
# ~/.tcshrc - Setup user shell environment
#
# See also tcsh(1), environ(7).
#
unalias *
alias h 'history \!* 20'
alias j 'jobs -l'
alias ll 'ls -lAF'
alias md mkdir
alias rd rmdir
#
# The following commands are only for interactive shells.
#
if ( $?prompt ) then
set \
autocorrect \
autoexpand \
autolist=ambiguous \
correct=cmd \
ellipsis \
filec \
history=1000 \
killdup=erase \
listjobs=long \
listlinks \
listmax=100 \
nobeep \
prompt='%N@%m:%B%c02%b%# ' \
rmstar \
savehist=(1000 merge) \
unset promptchars
if ( $?tcsh ) then
bindkey -e
bindkey " " magic-space
bindkey ^W backward-delete-word
bindkey ^Z run-fg-editor
bindkey ^[^W kill-region
#
# Setup $hosts from ~/.hosts, ~/.rhosts, ~/.ssh/known_hosts
#
if ( ! $?hosts ) then
set hosts=()
foreach f ( ~/.{,r,ssh/known_}hosts )
if ( -r "$f" ) then
set hosts=( \
$hosts \
`sed \
-e 's/#.*//' \
-e '/^|/d' \
-e '/^[+-]@/d' \
-e 's/^[+-]//' \
-e 's/[[:space:]].*$//' \
-e 's/,/\n/g' \
"$f" \
| sed \
-e 's/:[[:digit:]]*$//' \
-e 's/^\[\([^]]*\)\]$/\1/' \
-e '/^[.:[:xdigit:][:space:]]*$/d' \
` \
)
endif
end
unset f
endif
uncomplete *
#
# Copy from complete.tcsh
#
if ( -r ~/.complete ) source ~/.complete
uncomplete rcp rsh
endif
#
# Set status to ^G in order to keep using ^T for transpose-char.
#
switch ( "$OSTYPE" )
case bsd44:
case darwin:
case FreeBSD:
case NetBSD:
stty status ^G
if ( $?tcsh ) bindkey ^G stuff-char
breaksw
endsw
#
# We don't want to create a root-owned files in our home.
#
if ( $uid == 0 ) then
unset savehist
setenv LESSHISTFILE -
setenv VIMINIT ':set viminfo='
endif
endif

View File

@ -257,7 +257,7 @@ c_preword(Char *p, Char *low, int n, Char *delim)
Char *new;
while (prev < p) { /* Skip initial non-word chars */
if (!Strchr(delim, *prev) || *(prev-1) == (Char)'\\')
if (!Strchr(delim, *prev) || (prev > low && prev[-1] == (Char)'\\'))
break;
prev++;
}
@ -269,7 +269,7 @@ c_preword(Char *p, Char *low, int n, Char *delim)
new = c_endword(prev-1, p, 1, delim); /* Skip to next non-word char */
new++; /* Step away from end of word */
while (new <= p) { /* Skip trailing non-word chars */
if (!Strchr(delim, *new) || *(new-1) == (Char)'\\')
if (!Strchr(delim, *new) || new > prev && new[-1] == (Char)'\\')
break;
new++;
}
@ -795,19 +795,19 @@ c_endword(Char *p, Char *high, int n, Char *delim)
while (n--) {
while (p < high) { /* Skip non-word chars */
if (!Strchr(delim, *p) || *(p-1) == (Char)'\\')
if (!Strchr(delim, *p) || p[-1] == (Char)'\\')
break;
p++;
}
while (p < high) { /* Skip string */
if ((*p == (Char)'\'' || *p == (Char)'"')) { /* Quotation marks? */
if (inquote || *(p-1) != (Char)'\\') { /* Should it be honored? */
if (inquote || p[-1] != (Char)'\\') { /* Should it be honored? */
if (inquote == 0) inquote = *p;
else if (inquote == *p) inquote = 0;
}
}
/* Break if unquoted non-word char */
if (!inquote && Strchr(delim, *p) && *(p-1) != (Char)'\\')
if (!inquote && Strchr(delim, *p) && p[-1] != (Char)'\\')
break;
p++;
}
@ -1472,8 +1472,8 @@ e_insert(Char c)
else {
if (inputmode != MODE_INSERT) {
int i;
for(i = 0; i < Argument; i++)
UndoBuf[UndoSize++] = *(Cursor + i);
for (i = 0; i < Argument; i++)
UndoBuf[UndoSize++] = Cursor[i];
UndoBuf[UndoSize] = '\0';
c_delafter(Argument); /* Do NOT use the saving ONE */
@ -2923,7 +2923,7 @@ v_csearch_fwd(Char ch, int count, int tflag)
cp = Cursor;
while (count--) {
if(*cp == ch)
if (*cp == ch)
cp++;
while (cp < LastChar && *cp != ch)
cp++;
@ -3771,7 +3771,7 @@ v_undo(Char c)
size = (int)(Cursor-LastChar); /* NOT NSL independant */
if (size < UndoSize)
size = UndoSize;
for(loop = 0; loop < size; loop++) {
for (loop = 0; loop < size; loop++) {
temp = *kp;
*kp++ = *cp;
*cp++ = temp;

View File

@ -862,7 +862,7 @@ SpellLine(int cmdonly)
/*
* This hack avoids correcting drive letter changes
*/
if((Cursor - InputBuf) != 2 || (char)InputBuf[1] != ':')
if ((Cursor - InputBuf) != 2 || (char)InputBuf[1] != ':')
#endif /* WINNT_NATIVE */
{
#ifdef HASH_SPELL_CHECK

View File

@ -1217,7 +1217,7 @@ so_write(Char *cp, int n)
Char xc;
if ((xc = Display[CursorV][CursorH]) != '\0') {
so_write(&xc, 1);
while(Display[CursorV][CursorH] == CHAR_DBWIDTH)
while (Display[CursorV][CursorH] == CHAR_DBWIDTH)
CursorH++;
}
else {

View File

@ -698,7 +698,7 @@ parseescape(const Char **ptr)
#endif
}
else
c = *p;
c = *p & CHAR;
*ptr = p;
return (c);
}

View File

@ -851,7 +851,7 @@ machtype: defined(sparc) : "sparc"
enddef :
newdef : defined(APPLE) && defined(MACH)
newdef : defined(APPLE)
comment : OS X
vendor : : "apple"
hosttype: defined(i386) : "intel-mac"

View File

@ -6,8 +6,8 @@
#define ORIGIN "Astron"
#define REV 6
#define VERS 21
#define PATCHLEVEL 00
#define DATE "2019-05-08"
#define VERS 22
#define PATCHLEVEL 03
#define DATE "2020-11-18"
#endif /* _h_patchlevel */

View File

@ -179,7 +179,7 @@ add_localedir_to_nlspath(const char *path)
if (path == NULL)
return;
(void) xsnprintf(trypath, sizeof(trypath), "%s/en/LC_MESSAGES/tcsh.cat",
(void) xsnprintf(trypath, sizeof(trypath), "%s/C/LC_MESSAGES/tcsh.cat",
path);
if (stat(trypath, &st) == -1)
return;
@ -1249,7 +1249,7 @@ main(int argc, char **argv)
* was a session leader .
*/
else if (shpgrp != mygetpgrp()) {
if(setpgid(0, shpgrp) == -1) {
if (setpgid(0, shpgrp) == -1) {
xprintf("setpgid:");
goto notty;
}
@ -1839,6 +1839,10 @@ exitstat(void)
void
phup(void)
{
static int again = 0;
if (again++)
return;
if (loginsh) {
setcopy(STRlogout, STRhangup, VAR_READWRITE);
#ifdef _PATH_DOTLOGOUT
@ -2516,11 +2520,20 @@ defaultpath(void)
static void
record(void)
{
static int again = 0;
int ophup_disabled;
if (again++)
return;
ophup_disabled = phup_disabled;
phup_disabled = 1;
if (!fast) {
recdirs(NULL, adrof(STRsavedirs) != NULL);
rechist(NULL, adrof(STRsavehist) != NULL);
}
displayHistStats("Exiting"); /* no-op unless DEBUG_HIST */
phup_disabled = ophup_disabled;
}
/*

View File

@ -48,6 +48,7 @@ static void dextract (struct directory *);
static int skipargs (Char ***, const char *,
const char *);
static void dgetstack (void);
static Char *dcanon_internal(Char *, Char *);
static struct directory dhead INIT_ZERO_STRUCT; /* "head" of loop */
static int printd; /* force name to be printed */
@ -148,16 +149,10 @@ dinit(Char *hp)
cleanup_push(tcp, xfree);
}
}
cleanup_push(tcp, xfree);
cp = dcanon(tcp, STRNULL);
cleanup_ignore(tcp);
cleanup_until(tcp);
}
#else /* S_IFLNK */
cleanup_push(tcp, xfree);
cp = dcanon(tcp, STRNULL);
cleanup_ignore(tcp);
cleanup_until(tcp);
#endif /* S_IFLNK */
}
@ -313,7 +308,7 @@ dtilde(void)
do {
if (d == &dhead)
continue;
d->di_name = dcanon(d->di_name, STRNULL);
d->di_name = dcanon_internal(d->di_name, STRNULL);
} while ((d = d->di_prev) != dcwd);
dset(dcwd->di_name);
@ -571,16 +566,10 @@ dgoto(Char *cp)
if (ABSOLUTEP(cp) && cp[1] == ':') { /* Only DOS paths are treated that way */
return agetcwd();
} else {
cleanup_push(cp, xfree);
ret = dcanon(cp, dp);
cleanup_ignore(cp);
cleanup_until(cp);
}
#else /* !WINNT_NATIVE */
cleanup_push(cp, xfree);
ret = dcanon(cp, dp);
cleanup_ignore(cp);
cleanup_until(cp);
#endif /* WINNT_NATIVE */
return ret;
}
@ -868,12 +857,26 @@ dfree(struct directory *dp)
}
/*
* dcanon - canonicalize the pathname, removing excess ./ and ../ etc.
* dcanon - a safe version of dcanon_internal that arranges for cleanup
*/
Char *
dcanon(Char *cp, Char *p)
{
cleanup_push(cp, xfree);
p = dcanon_internal(cp, p);
// coverity[use_after_free] we use the pointer as a marker
cleanup_ignore(cp);
cleanup_until(cp);
return p;
}
/*
* dcanon_internal - canonicalize the pathname, removing excess ./ and ../ etc.
* we are of course assuming that the file system is standardly
* constructed (always have ..'s, directories have links)
*/
Char *
dcanon(Char *cp, Char *p)
static Char *
dcanon_internal(Char *cp, Char *p)
{
Char *sp;
Char *p1, *p2; /* general purpose */
@ -1356,7 +1359,7 @@ loaddirs(Char *fname)
void
recdirs(Char *fname, int def)
{
int fp, ftmp, oldidfds;
int fp, ftmp, oldidfds, ophup_disabled;
int cdflag = 0;
struct directory *dp;
unsigned int num;
@ -1366,6 +1369,8 @@ recdirs(Char *fname, int def)
if (fname == NULL && !def)
return;
ophup_disabled = phup_disabled;
phup_disabled = 1;
if (fname == NULL) {
if ((fname = varval(STRdirsfile)) == STRNULL)
fname = Strspl(varval(STRhome), &STRtildotdirs[1]);
@ -1378,6 +1383,7 @@ recdirs(Char *fname, int def)
if ((fp = xcreat(short2str(fname), 0600)) == -1) {
cleanup_until(fname);
phup_disabled = ophup_disabled;
return;
}
@ -1413,4 +1419,5 @@ recdirs(Char *fname, int def)
SHOUT = ftmp;
didfds = oldidfds;
cleanup_until(fname);
phup_disabled = ophup_disabled;
}

View File

@ -64,8 +64,10 @@ static Char *dolp; /* Remaining chars from this word */
static Char **dolnxt; /* Further words */
static int dolcnt; /* Count of further words */
static struct Strbuf dolmod; /* = Strbuf_INIT; : modifier characters */
static int dolmcnt; /* :gx -> INT_MAX, else 1 */
static int dol_flag_a; /* :ax -> 1, else 0 */
static int ndolflags; /* keep track of mod counts for each modifier */
static int *dolmcnts; /* :gx -> INT_MAX, else 1 */
static int *dolaflags; /* :ax -> 1, else 0 */
static Char **Dfix2 (Char *const *);
static int Dpack (struct Strbuf *);
@ -378,7 +380,7 @@ Dgetdol(void)
static Char *dolbang = NULL;
cleanup_push(name, Strbuf_free);
dolmod.len = dolmcnt = dol_flag_a = 0;
dolmod.len = ndolflags = 0;
c = sc = DgetC(0);
if (c == DEOF) {
stderror(ERR_SYNTAX);
@ -718,21 +720,27 @@ fixDolMod(void)
c = DgetC(0);
if (c == ':') {
ndolflags = 0;
do {
c = DgetC(0), dolmcnt = 1, dol_flag_a = 0;
++ndolflags;
dolmcnts = xrealloc(dolmcnts, ndolflags * sizeof(int));
dolaflags = xrealloc(dolaflags, ndolflags * sizeof(int));
c = DgetC(0), dolmcnts[ndolflags - 1] = 1, dolaflags[ndolflags - 1] = 0;
if (c == 'g' || c == 'a') {
if (c == 'g')
dolmcnt = INT_MAX;
else
dol_flag_a = 1;
if (c == 'g') {
dolmcnts[ndolflags - 1] = INT_MAX;
} else {
dolaflags[ndolflags - 1] = 1;
}
c = DgetC(0);
}
if ((c == 'g' && dolmcnt != INT_MAX) ||
(c == 'a' && dol_flag_a == 0)) {
if (c == 'g')
dolmcnt = INT_MAX;
else
dol_flag_a = 1;
if ((c == 'g' && dolmcnts[ndolflags - 1] != INT_MAX) ||
(c == 'a' && dolaflags[ndolflags - 1] == 0)) {
if (c == 'g') {
dolmcnts[ndolflags - 1] = INT_MAX;
} else {
dolaflags[ndolflags - 1] = 1;
}
c = DgetC(0);
}
@ -749,20 +757,21 @@ fixDolMod(void)
}
while ((c = DgetC(0)) != DEOF) {
Strbuf_append1(&dolmod, (Char) c);
if(c == delim) delimcnt--;
if(!delimcnt) break;
if (c == delim) delimcnt--;
if (!delimcnt) break;
}
if(delimcnt) {
if (delimcnt) {
seterror(ERR_BADSUBST);
break;
}
continue;
}
if (!any("luhtrqxes", c))
if (!any(TCSH_MODIFIERS, c))
stderror(ERR_BADMOD, (int)c);
Strbuf_append1(&dolmod, (Char) c);
if (c == 'q')
dolmcnt = INT_MAX;
if (c == 'q') {
dolmcnts[ndolflags - 1] = INT_MAX;
}
}
while ((c = DgetC(0)) == ':');
unDredc(c);
@ -771,13 +780,25 @@ fixDolMod(void)
unDredc(c);
}
static int
all_dolmcnts_are_0()
{
int i = 0;
for (; i < ndolflags; ++i) {
if (dolmcnts[i] != 0)
return 0;
}
return 1;
}
static void
setDolp(Char *cp)
{
Char *dp;
size_t i;
int nthMod = 0;
if (dolmod.len == 0 || dolmcnt == 0) {
if (dolmod.len == 0 || all_dolmcnts_are_0()) {
dolp = cp;
return;
}
@ -786,10 +807,12 @@ setDolp(Char *cp)
int didmod = 0;
/* handle s// [eichin:19910926.0510EST] */
if(dolmod.s[i] == 's') {
if (dolmod.s[i] == 's') {
Char delim;
Char *lhsub, *rhsub, *np;
size_t lhlen = 0, rhlen = 0;
/* keep track of where the last :a match hit */
ptrdiff_t last_match = 0;
delim = dolmod.s[++i];
if (!delim || letter(delim)
@ -798,47 +821,50 @@ setDolp(Char *cp)
break;
}
lhsub = &dolmod.s[++i];
while(dolmod.s[i] != delim && dolmod.s[++i]) {
while (dolmod.s[i] != delim && dolmod.s[++i]) {
lhlen++;
}
dolmod.s[i] = 0;
rhsub = &dolmod.s[++i];
while(dolmod.s[i] != delim && dolmod.s[++i]) {
while (dolmod.s[i] != delim && dolmod.s[++i]) {
rhlen++;
}
dolmod.s[i] = 0;
strip(lhsub);
strip(rhsub);
strip(cp);
dp = cp;
do {
dp = Strstr(dp, lhsub);
if (dp) {
ptrdiff_t diff = dp - cp;
size_t len = (Strlen(cp) + 1 - lhlen + rhlen);
np = xmalloc(len * sizeof(Char));
(void) Strncpy(np, cp, diff);
(void) Strcpy(np + diff, rhsub);
(void) Strcpy(np + diff + rhlen, dp + lhlen);
if (dolmcnts[nthMod] != 0) {
strip(cp);
dp = cp;
do {
dp = Strstr(dp + last_match, lhsub);
if (dp) {
ptrdiff_t diff = dp - cp;
size_t len = (Strlen(cp) + 1 - lhlen + rhlen);
np = xmalloc(len * sizeof(Char));
(void) Strncpy(np, cp, diff);
(void) Strcpy(np + diff, rhsub);
(void) Strcpy(np + diff + rhlen, dp + lhlen);
last_match = diff + rhlen;
xfree(cp);
dp = cp = np;
cp[--len] = '\0';
didmod = 1;
if (diff >= (ssize_t)len)
break;
} else {
/* should this do a seterror? */
break;
}
}
while (dol_flag_a != 0);
xfree(cp);
dp = cp = np;
cp[--len] = '\0';
didmod = 1;
if (diff >= (ssize_t)len)
break;
} else {
/* should this do a seterror? */
break;
}
}
while (dolaflags[nthMod] != 0);
}
/*
* restore dolmod for additional words
*/
dolmod.s[i] = rhsub[-1] = (Char) delim;
} else {
} else if (dolmcnts[nthMod] != 0) {
do {
if ((dp = domod(cp, dolmod.s[i])) != NULL) {
@ -856,14 +882,16 @@ setDolp(Char *cp)
else
break;
}
while (dol_flag_a != 0);
while (dolaflags[nthMod] != 0);
}
if (didmod && dolmcnt != INT_MAX)
dolmcnt--;
if (didmod && dolmcnts[nthMod] != INT_MAX)
dolmcnts[nthMod]--;
#ifdef notdef
else
break;
#endif
++nthMod;
}
addla(cp);

View File

@ -634,7 +634,7 @@ filetest(Char *cp, Char ***vp, int ignore)
struct passwd *pw;
struct group *gr;
while(any(FILETESTS, *++ft))
while (any(FILETESTS, *++ft))
continue;
if (!*ft && *(ft - 1) == 'L')

View File

@ -1423,7 +1423,7 @@ dosetenv(Char **v, struct command *c)
/* dspkanji/dspmbyte autosetting */
/* PATCH IDEA FROM Issei.Suzuki VERY THANKS */
#if defined(DSPMBYTE)
if(eq(vp, STRLANG) && !adrof(CHECK_MBYTEVAR)) {
if (eq(vp, STRLANG) && !adrof(CHECK_MBYTEVAR)) {
autoset_dspmbyte(lp);
}
#endif
@ -1517,9 +1517,8 @@ dosetenv(Char **v, struct command *c)
/*
* convert to canonical pathname (possibly resolving symlinks)
*/
canon = dcanon(lp, lp);
cleanup_ignore(lp);
cleanup_until(lp);
canon = dcanon(lp, lp);
cleanup_push(canon, xfree);
setv(STRhome, quote(canon), VAR_READWRITE); /* lp memory used here */
cleanup_ignore(canon);

View File

@ -75,8 +75,13 @@ globtilde(Char *s)
Char *name, *u, *home, *res;
u = s;
if (s[1] == '~')
return Strsave(s);
for (s++; *s && *s != '/' && *s != ':'; s++)
continue;
name = Strnsave(u + 1, s - (u + 1));
cleanup_push(name, xfree);
home = gethdir(name);
@ -513,14 +518,16 @@ globone(Char *str, int action)
}
result:
if (vl && vl[0] == NULL) {
xfree(vl);
if (vl != v)
xfree(vl);
return (Strsave(STRNULL));
}
if (vl && vl[1])
return (handleone(str, vl, action));
else {
str = strip(*vl);
xfree(vl);
if (vl != v)
xfree(vl);
return (str);
}
}

View File

@ -685,10 +685,6 @@ EXTERN int OLDSTD IZERO; /* Old standard input (def for cmds) */
typedef struct { const char *f; size_t l; sigjmp_buf j; } jmp_buf_t;
# define tcsh_setjmp() sigsetjmp(reslab.j, 1)
# define tcsh_longjmp() siglongjmp(reslab.j, 1)
# define setexit() (reslab.f = __func__, \
reslab.l = __LINE__, \
sigsetjmp(reslab.j, 1))
# define _reset() siglongjmp(reslab.j, 1)
#else
typedef struct { const char *f; size_t l; jmp_buf j; } jmp_buf_t;
# define tcsh_setjmp() setjmp(reslab.j)
@ -1160,6 +1156,8 @@ EXTERN Char PRCHROOT; /* Prompt symbol for root */
#define Strstr(a, b) s_strstr(a, b)
#endif
#define TCSH_MODIFIERS "ehlqrstuxQ"
/*
* setname is a macro to save space (see sh.err.c)
*/

View File

@ -1219,7 +1219,7 @@ void
rechist(Char *fname, int ref)
{
Char *snum, *rs;
int fp, ftmp, oldidfds;
int fp, ftmp, oldidfds, ophup_disabled;
struct varent *shist;
char path[MAXPATHLEN];
struct stat st;
@ -1227,6 +1227,10 @@ rechist(Char *fname, int ref)
if (fname == NULL && !ref)
return;
ophup_disabled = phup_disabled;
phup_disabled = 1;
/*
* If $savehist is just set, we use the value of $history
* else we use the value in $savehist
@ -1292,7 +1296,7 @@ rechist(Char *fname, int ref)
#endif
}
getexit(osetexit);
if (setexit())
if (setexit() == 0)
loadhist(fname, 1);
resexit(osetexit);
}
@ -1305,6 +1309,7 @@ rechist(Char *fname, int ref)
if (fp == -1) {
didfds = oldidfds;
cleanup_until(fname);
phup_disabled = ophup_disabled;
return;
}
/* Try to preserve ownership and permissions of the original history file */
@ -1329,6 +1334,7 @@ rechist(Char *fname, int ref)
(void)ReplaceFile( short2str(fname),path,NULL,0,NULL,NULL);
#endif
cleanup_until(fname);
phup_disabled = ophup_disabled;
}

View File

@ -182,8 +182,9 @@ lex(struct wordent *hp)
wdp = new;
wdp->word = word(parsehtime);
parsehtime = 0;
if (enterhist && toolong++ > 10 * 1024)
if (enterhist && toolong++ > 10 * 1024) {
stderror(ERR_LTOOLONG);
}
} while (wdp->word[0] != '\n');
cleanup_ignore(hp);
cleanup_until(hp);
@ -300,8 +301,9 @@ word(int parsehtime)
cleanup_push(&wbuf, Strbuf_cleanup);
loop:
if (enterhist && toolong++ > 256 * 1024)
seterror(ERR_WTOOLONG);
if (enterhist && toolong++ > 256 * 1024) {
stderror(ERR_WTOOLONG);
}
while ((c = getC(DOALL)) == ' ' || c == '\t')
continue;
if (cmap(c, _META | _ESC))
@ -360,8 +362,9 @@ word(int parsehtime)
c1 = 0;
dolflg = DOALL;
for (;;) {
if (enterhist && toolong++ > 256 * 1024)
seterror(ERR_WTOOLONG);
if (enterhist && toolong++ > 256 * 1024) {
stderror(ERR_WTOOLONG);
}
if (c1) {
if (c == c1) {
c1 = 0;
@ -596,7 +599,7 @@ getdol(void)
int gmodflag = 0, amodflag = 0;
do {
Strbuf_append1(&name, c), c = getC(DOEXCL);
Strbuf_append1(&name, c), c = getC(DOEXCL), gmodflag = 0, amodflag = 0;
if (c == 'g' || c == 'a') {
if (c == 'g')
gmodflag++;
@ -625,16 +628,16 @@ getdol(void)
}
while ((c = getC(0)) != CHAR_ERR) {
Strbuf_append1(&name, c);
if(c == delim) delimcnt--;
if(!delimcnt) break;
if (c == delim) delimcnt--;
if (!delimcnt) break;
}
if(delimcnt) {
if (delimcnt) {
seterror(ERR_BADSUBST);
break;
}
c = 's';
}
if (!any("htrqxesul", c)) {
if (!any(TCSH_MODIFIERS, c)) {
if ((amodflag || gmodflag) && c == '\n')
stderror(ERR_VARSYN); /* strike */
seterror(ERR_BADMOD, c);
@ -1019,14 +1022,15 @@ domod(Char *cp, Char type)
int c;
switch (type) {
case 'Q':
if (*cp == '\0')
return Strsave(STRQNULL);
/*FALLTHROUGH*/
case 'q':
case 'x':
if (*cp == '\0')
return Strsave(STRQNULL);
wp = Strsave(cp);
for (xp = wp; (c = *xp) != 0; xp++)
if ((c != ' ' && c != '\t') || type == 'q')
if ((c != ' ' && c != '\t') || type == 'q' || type == 'Q')
*xp |= QUOTE;
return (wp);
@ -1040,13 +1044,13 @@ domod(Char *cp, Char type)
case 'h':
case 't':
if (!any(short2str(cp), '/'))
return (type == 't' ? Strsave(cp) : 0);
wp = Strrchr(cp, '/');
if (type == 'h')
xp = Strnsave(cp, wp - cp);
else
if (wp == NULL)
return NULL;
if (type == 't')
xp = Strsave(wp + 1);
else
xp = Strnsave(cp, wp - cp);
return (xp);
case 'e':
@ -1061,6 +1065,7 @@ domod(Char *cp, Char type)
return (xp);
}
return (Strsave(type == 'e' ? STRNULL : cp));
default:
break;
}
@ -1654,7 +1659,7 @@ bgetc(void)
do {
ch = fbuf[0][fseekp - fbobp];
fseekp++;
} while(ch == '\r');
} while (ch == '\r');
#endif /* !WINNT_NATIVE && !__CYGWIN__ */
return (ch);
}
@ -1707,7 +1712,7 @@ bgetc(void)
do {
ch = fbuf[(int) fseekp / BUFSIZE][(int) fseekp % BUFSIZE];
fseekp++;
} while(ch == '\r');
} while (ch == '\r');
#endif /* !WINNT_NATIVE && !__CYGWIN__ */
return (ch);
}

View File

@ -288,7 +288,7 @@ closem(void)
{
xclose(f);
#ifdef NISPLUS
if(f < 3)
if (f < 3)
(void) xopen(_PATH_DEVNULL, O_RDONLY|O_LARGEFILE);
#endif /* NISPLUS */
}
@ -531,6 +531,25 @@ areadlink(const char *path)
char *buf;
size_t size;
ssize_t res;
#ifdef __IBMC__
/*
* Prevent infinite recursion. Someone should tell me how to expand
* these...
*/
size_t i;
static const char *vars[] = {
"/$VERSION",
"/$SYSNAME",
"/$SYSSYMR",
"/$SYSSYMA",
};
for (i = 0; i < sizeof(vars) / sizeof(vars[0]); i++) {
if (strcmp(vars[i], path) == 0) {
return NULL;
}
}
#endif
size = MAXPATHLEN + 1;
buf = xmalloc(size);

View File

@ -146,14 +146,10 @@ update_vars(Char *vp)
Char *cp, *canon;
cp = Strsave(varval(vp)); /* get the old value back */
cleanup_push(cp, xfree);
/*
* convert to cononical pathname (possibly resolving symlinks)
*/
canon = dcanon(cp, cp);
cleanup_ignore(cp);
cleanup_until(cp);
cleanup_push(canon, xfree);
setcopy(vp, canon, VAR_READWRITE); /* have to save the new val */
@ -223,7 +219,7 @@ update_vars(Char *vp)
}
#endif /* COLOR_LS_F */
#if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
else if(eq(vp, CHECK_MBYTEVAR) || eq(vp, STRnokanji)) {
else if (eq(vp, CHECK_MBYTEVAR) || eq(vp, STRnokanji)) {
update_dspmbyte_vars();
}
#endif
@ -276,7 +272,7 @@ doset(Char **v, struct command *c)
v++;
changed = 1;
}
} while(changed);
} while (changed);
p = *v++;
if (p == 0) {
plist(&shvhed, flags);
@ -660,7 +656,7 @@ set1(const Char *var, Char **vec, struct varent *head, int flags)
gflag = tglob(oldv);
if (gflag) {
vec = globall(oldv, gflag);
if (vec == 0) {
if (vec == NULL) {
blkfree(oldv);
stderror(ERR_NAME | ERR_NOMATCH);
}
@ -677,7 +673,7 @@ set1(const Char *var, Char **vec, struct varent *head, int flags)
* Delete all duplicate words leaving "holes" in the word array (vec).
* Then remove the "holes", keeping the order of the words unchanged.
*/
if (vec && vec[0] && vec[1]) { /* more than one word ? */
if (vec[0] && vec[1]) { /* more than one word ? */
int i, j;
int num_items;
@ -1162,7 +1158,7 @@ update_dspmbyte_vars(void)
if ((vp = adrof(CHECK_MBYTEVAR)) && !adrof(STRnokanji)) {
_enable_mbdisp = 1;
dstr1 = vp->vec[0];
if(eq (dstr1, STRsjis))
if (eq (dstr1, STRsjis))
iskcode = 1;
else if (eq(dstr1, STReuc))
iskcode = 2;

View File

@ -655,3 +655,13 @@ showall(Char **v, struct command *c)
USE(c);
USE(v);
}
#ifndef SYSMALLOC
/* jemalloc defines these */
void _malloc_prefork(void);
void _malloc_postfork(void);
void _malloc_postfork_child(void);
void _malloc_prefork(void) {}
void _malloc_postfork(void) {}
void _malloc_postfork_child(void) {}
#endif

View File

@ -53,6 +53,10 @@ static struct termios otermiob;
char strPOSIX[] = "posix";
#endif /* _IBMR2 */
#ifdef __IBMC__
# define HAVE_DISC /* Z/OS TIOCGETD returns no such device */
#endif /* __IBMC__ */
#if !defined(HAVE_DISC) && defined(TIOCGETD) && defined(NTTYDISC)
static int oldisc;
#endif /* !HAVE_DISC && TIOCGETD && NTTYDISC */

View File

@ -831,7 +831,7 @@ dobs2cmd(Char **v, struct command *c)
xexit(bs2cmdlist(cmd));
}
cleanup_until(&pvec[1]);
for(;;) {
for (;;) {
int old_pintr_disabled;
if (setintr)

View File

@ -379,7 +379,7 @@ tprintf(int what, const Char *fmt, const char *str, time_t tim, ptr_t info)
Strbuf_append1(&buf, attributes | *z++);
do {
Strbuf_append1(&buf, attributes | *z++);
} while(*z != '/');
} while (*z != '/');
}
#endif /* WINNT_NATIVE */
q = z;

View File

@ -77,7 +77,7 @@
.\" used here if you can. In particular, please don't use nroff commands
.\" which aren't already used herein.
.\"
.TH TCSH 1 "8 May 2019" "Astron 6.21.00"
.TH TCSH 1 "11 Nov 2020" "Astron 6.22.03"
.SH NAME
tcsh \- C shell with file name completion and command line editing
.SH SYNOPSIS
@ -928,6 +928,10 @@ Saved commands are numbered sequentially from 1 and stamped with the time.
It is not usually necessary to use event numbers, but the current event number
can be made part of the prompt by placing an `!' in the \fBprompt\fR shell variable.
.PP
By default history entries are displayed by printing each parsed token
separated by space; thus the redirection operator `>&!' will be displayed as
`> & !'.
.PP
The shell actually saves history in expanded and literal (unexpanded) forms.
If the \fBhistlit\fR shell variable is set, commands that display and store
history use the literal form.
@ -1133,6 +1137,18 @@ Print the new command line but do not execute it.
q
Quote the substituted words, preventing further substitutions.
.TP 8
Q
Same as q
but in addition preserve empty variables as a string containing a NUL.
This is useful to preserve positional arguments for example:
.IP "" 12
> set args=('arg 1' '' 'arg 3')
.br
> tcsh -f -c 'echo ${#argv}' $args:gQ
.br
3
.br
.TP 8
x
Like q, but break into words at blanks, tabs and newlines.
.PD
@ -3754,6 +3770,7 @@ in login and superuser shells, but not if the shell thinks it is running
under a window system (i.e., the \fBDISPLAY\fR environment variable is set),
the tty is a pseudo-tty (pty) or the shell was not so compiled (see the
\fBversion\fR shell variable).
Unset or set to `0' to disable automatic logout.
See also the \fBafsuser\fR and \fBlogout\fR shell variables.
.TP 8
.B autorehash \fR(+)
@ -5338,7 +5355,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.21.00 (Astron) 2019-05-08.
This manual documents tcsh 6.22.03 (Astron) 2020-11-18.
.SH AUTHORS
.PD 0
.TP 2

View File

@ -64,9 +64,9 @@
.\" used here if you can. In particular, please don't use nroff commands
.\" which aren't already used herein.
.\"
.Dd May 8, 2019
.Dd Noverber 18, 2020
.Dt TCSH 1
.Os Astron 6.21.00
.Os Astron 6.22.02
.Sh NAME
.Nm tcsh
.Nd C shell with file name completion and command line editing
@ -1494,6 +1494,11 @@ in the
.Va prompt
shell variable.
.Pp
By default history entries are displayed by printing each parsed token
separated by space; thus the redirection operator
.Sq >\&&\&!
will be displayed as
.Sq >\0\&&\0\&! .
The shell actually saves history in expanded and literal (unexpanded) forms.
If the
.Va histlit
@ -1849,6 +1854,16 @@ substituted, not patterns that contain any substitution result.
Print the new command line but do not execute it.
.It Ar q
Quote the substituted words, preventing further substitutions.
.It Ar Q
Same as
.Ar q
but in addition preserve empty variables as a string containing a NUL.
This is useful to preserve positional arguments for example:
.Bd -literal -offset indent -compact
> set args=('arg 1' '' 'arg 3')
> tcsh -f -c 'echo ${#argv}' $args:gQ
3
.Ed
.It Ar x
Like
.Ar q ,
@ -3358,17 +3373,15 @@ by an unambiguous prefix of the string typed in to start it:
.Sq %ex
would
normally restart a suspended
.Va ex
(1) job, if there were only one suspended
.Xr ex 1
job, if there were only one suspended
job whose name began with the string
.Sq ex
.Sq ex .
It is also possible to say
`%?
.Va string
' to specify a job whose text contains
.Va string
, if there
is only one such job.
.Va %?string
to specify a job whose text contains
.Va string ,
if there is only one such job.
.Pp
The shell maintains a notion of the current and previous jobs.
In output
@ -3855,7 +3868,7 @@ are optional.
Components of
.Va expr
must be separated by spaces.
.It Ar alias[name[wordlist]]
.It Ar alias [name [wordlist]]
Without arguments, prints all aliases.
With
.Va name
@ -3884,26 +3897,21 @@ memory.
With an argument shows the number of free and used blocks in each size
category.
The categories start at size 8 and double at each step.
This
command's output may vary across system types, because systems other than the VAX
may use a different memory allocator.
.TP 8
.It Ar bg[%job...]
This command's output may vary across system types, because systems other
than the VAX may use a different memory allocator.
.It Ar bg [%job...]
Puts the specified jobs (or, without arguments, the current job)
into the background, continuing each if it is stopped.
.Va job
may be a number, a string,
.Sq
,
.Sq %
,
.Sq +
.Sq \&, ,
.Sq % ,
.Sq + ,
or
.Sq \-
.Sq \&-
as described
under
.Va Jobs
.Pp
.Va Jobs .
.It Ar bindkey Oo Fl l Ns | Ns Fl d Ns | Ns Fl e Ns | Ns Fl v Ns | Ns Fl u Oc (+)
.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl r Oc Oo Fl Fl Oc Ar key (+)
.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl c Ns | Ns Fl s Oc Oo Fl Fl Oc Ar key command (+)
@ -6810,6 +6818,10 @@ environment variable is set),
the tty is a pseudo-tty (pty) or the shell was not so compiled (see the
.Va version
shell variable).
Unset
.Va autologout or set it to
.Dv 0
to disable automatic logout.
See also the
.Va afsuser
and
@ -9518,7 +9530,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.21.00 (Astron) 2019-05-08.
This manual documents tcsh 6.22.03 (Astron) 2020-11-18.
.Sh AUTHORS
.PD 0
.TP 2

View File

@ -2350,7 +2350,7 @@ choose_scroll_tab(struct Strbuf *exp_name, int cnt)
ptr = xmalloc(sizeof(Char *) * cnt);
cleanup_push(ptr, xfree);
for(loop = scroll_tab; loop && (tmp >= 0); loop = loop->next)
for (loop = scroll_tab; loop && (tmp >= 0); loop = loop->next)
ptr[--tmp] = loop->element;
qsort(ptr, cnt, sizeof(Char *), fcompare);
@ -2366,7 +2366,7 @@ free_scroll_tab(void)
{
struct scroll_tab_list *loop;
while(scroll_tab) {
while (scroll_tab) {
loop = scroll_tab;
scroll_tab = scroll_tab->next;
xfree(loop->element);