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 On some machines the tty is not set up to pass 8 bit characters by
call it README.*PLEASE* in the future, but then the same people won't default. Tcsh 5.19 used to try to determine if pass8 should be set by
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
looking at the terminal's meta key. Unfortunately there is no good way 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. 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 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 parity and your terminal has a meta key. Then tcsh 5.19 would set
wrongly set pass8. wrongly set pass8.
If you did like the previous behavior you can add in /etc/csh.login, If you did like the previous behavior you can add in /etc/csh.login, or
or in .login: in .login:
if ( $?tcsh && $?prompt ) then if ( $?tcsh && $?prompt ) then
if ( "`echotc meta`" == "yes" ) then if ( "`echotc meta`" == "yes" ) then
stty pass8 stty pass8
endif endif
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 -parity -evenp -oddp cs8 -istrip (rs6000)
stty -parenb -istrip cs8 stty -parenb -istrip cs8
Finally, tcsh will bind all printable meta characters to the self 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 insert command. If you don't want that to happen (i.e. use the
printable meta characters for commands) setenv NOREBIND. printable meta characters for commands) setenv NOREBIND.
_________________________________________________________________
3. I ran 'dbxtool &' and 'shelltool &' from tcsh, and they end up in I ran dbxtool & and shelltool & from tcsh, and they end up in cbreak and no
cbreak and no echo mode? 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:
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 & dbxtool < /dev/null >& /dev/null &
/usr/etc/setsid dbxtool & /usr/etc/setsid dbxtool &
If that does not work, for dbxtool at least you can add "sh stty sane" If that does not work, for dbxtool at least you can add sh stty sane in
in your .dbxinit 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. 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 Csh sources are now available with the 4.4BSD networking distributions.
distributions. You don't need csh sources to compile tcsh-6.0x. 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 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 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 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 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 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 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 full path is required. If there is no /etc/shells, and you are creating
creating one, remember to add /bin/csh, /bin/sh, and any other valid one, remember to add /bin/csh, /bin/sh, and any other valid shells for
shells for your system, so that other people can ftp too :-) your system, so that other people can ftp too.
_________________________________________________________________
7. I am using SunView or OpenWindows and editing is screwed up. In I am using SunView or OpenWindows and editing is screwed up. In particular my
particular my arrow keys and backspace don't work right. What am I arrow keys and backspace don't work right. What am I doing wrong?
doing wrong?
Well, cmdtool tries to do its own command line editing and the effect 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 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 interpret the arrow key sequences and cmdtool wins since it gets them
first. The solutions are in my order of preference: 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 On a SPARCstation running Solaris 2.x and OpenWindows 3.1, inside a cmdtool,
2. Use shelltool instead of cmdtool. the short-cut key sequence to clear log (i.e. Meta-e or Diamond-e) doesn't
3. Unset edit in tcsh. work: it just echos e; or
_________________________________________________________________
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
Unset edit in tcsh. Unset edit in tcsh.
_________________________________________________________________
9. On a SPARCstation running Solaris 2.x and OpenWindows 3.1, maketool On a SPARCstation running Solaris 2.x and OpenWindows 3.1, maketool (within
(within SPARCworks) doesn't work: it just does a `cd' to the working SPARCworks) doesn't work: it just does a `cd to the working directory then
directory then stops. 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. this.
_________________________________________________________________
10. I rlogin to another machine, and then no matter what I tell 'stty' I rlogin to another machine, and then no matter what I tell stty I cannot get
I cannot get it to pass 8 bit characters? 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. 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: I compiled tcsh using gcc, and when I start up it says: tcsh: Warning no
Warning no access to tty (Invalid Argument). Thus no job control in access to tty (Invalid Argument). Thus no job control in this shell
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: choices:
* Run fixincludes from the gcc distribution.
* Add -traditional to the gcc flags.
* Compile with cc.
1. Run fixincludes from the gcc distribution. I compiled tcsh with the SunOS unbundled compiler and now things get echoed
2. Add -traditional to the gcc flags. twice.
3. Compile with cc.
_________________________________________________________________
13. I compiled tcsh with the SunOS unbundled compiler and now things
get echo'ed twice.
It is a bug in the unbundled optimizer. Lower the optimization level. 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 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 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: precmd, or inside the prompt:
if ($term == "hp") then if ($term == "hp") then
set prompt="%{`echotc smkx`%}$prompt" set prompt="%{`echotc smkx`%}$prompt"
endif endif
Note that by doing that you cannot use pgup and pgdn to scroll... Also Note that by doing that you cannot use pgup and pgdn to scroll… Also if
if you are using termcap, replace "smkx" with "ks"... you are using termcap, replace smkx with ks.
_________________________________________________________________
15. On POSIX machines ^C and ^Z will do not work when tcsh is a login On POSIX machines ^C and ^Z do not work when tcsh is a login shell?
shell?
Make sure that the interrupt character is set to ^C and suspend is set 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 to ^Z; stty -a will show you the current stty settings; stty intr ^C
^C susp ^Z' will set them to ^C and ^Z respectively. susp ^Z will set them to ^C and ^Z respectively.
_________________________________________________________________
16. I am trying to compile tcsh and I am getting compile errors that I am trying to compile tcsh and I am getting compile errors that look like:
look like:
>sh.c:???: `STR???' undeclared, outside of functions [gcc] sh.c:???: `STR???' undeclared, outside of functions [gcc]
>"sh.c", line ???: STR??? undefined [cc] "sh.c", line ???: STR??? undefined [cc]
You interrupted make, while it was making the automatically generated You interrupted make, while it was making the automatically generated
headers. Type 'make clean; make' 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 You are probably logged in to the cray via telnet. Cray's telnetd
implements line mode selection the telnet client you are using does implements line mode selection the telnet client you are using does not
not implement telnet line mode. This cause the Cray's telnetd to try implement telnet line mode. This cause the Cray's telnetd to try to use
to use KLUDGELINEMODE. You can turn off telnet line mode from the cray KLUDGELINEMODE. You can turn off telnet line mode from the cray side by
side by doing a "stty -extproc", or you can get the Cray AIC to build doing a stty -extproc, or you can get the Cray AIC to build a telnetd
a telnetd without KLUDGELINEMODE, or you can compile a new telnet without KLUDGELINEMODE, or you can compile a new telnet client (from
client (from the BSD net2 tape), or at least on the suns use: 'mode the BSD net2 tape), or at least on the suns use: mode character.
character'.
_________________________________________________________________
18. On AU/X, I made tcsh my startup shell, but the mac desktop is not On AU/X, I made tcsh my startup shell, but the mac desktop is not starting up
starting up (no X11 or Finder), and I only get console emulation. (no X11 or Finder), and I only get console emulation.
This is another manifestation of item 5. Just add the pathname to tcsh Add the pathname to tcsh in /etc/shells and everything should work
in /etc/shells and everything should work fine. fine.
_________________________________________________________________
19. On machines that use YP (NIS) tilde expansion might end up in On machines that use YP (NIS) tilde expansion might end up in /dev/null
/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 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 Script on SGI 4.0.5 does not give us a tty, so we cannot have job control.
control.
Their csh does not have job control either. Try: Their csh does not have job control either. Try:
% script % script
% cat > /dev/tty % 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. 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 On POSIX systems the kernel will send hup signals to all the processes in the
http://www.dotfiles.com foreground process group if stty hupcl is set.
_________________________________________________________________
23. 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 For example
./tcsh ./tcsh
echo $$ echo $$
591 591
@ -240,65 +193,51 @@
Will kill everything, since hup will be sent to all tcsh processes. To 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. 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 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 works. If that does not work, get and use ssh/sshd. You'll be better
off from a security point of view anyway. off from a security point of view anyway.
_________________________________________________________________
25. Tcsh compiled under hp/ux-10.x does not pass resource limits Tcsh compiled under hp/ux-10.x does not pass resource limits correctly when
correctly when ran on hp/ux-11.x systems. 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. 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 This is because the termcap/terminfo description lies about the ability
ability of the terminal to use tabs. At least on Compaq/DEC Alpha of the terminal to use tabs. At least on Compaq/DEC Alpha OSF/1 3.x and
OSF/1 3.x and 4.x systems, stty -tabs will cause problems. 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. features that tcsh adds to csh.
You can read Tom Christiansen's [Csh Programming Considered Harmful], You can read Tom Christiansen's Csh Programming Considered Harmful, a
a document advocating that csh (and by extension, tcsh) should not be document advocating that csh (and by extension, tcsh) should not be
used for writing shell scripts. used for writing shell scripts.
XXX: Need to find something about [bash], but bash is sh-compatible XXX: Need to find something about bash, but bash is sh-compatible and
and has many of the same interactive features of tcsh (command has many of the same interactive features of tcsh (command completion
completion does not appear to be as flexible, though). does not appear to be as flexible, though).
[Curtains up: introducing the Z shell] has a pretty good rundown on Curtains up: introducing the Z shell has a pretty good rundown on zsh.
zsh. Aside from the arguments about csh being evil, tcsh appears to Aside from the arguments about csh being evil, tcsh appears to compare
compare well with zsh [zsh]. Zsh is sh and ksh compatible, with many well with zsh. Zsh is sh and ksh compatible, with many of the
of the interactive features of tcsh. interactive features of tcsh.
_________________________________________________________________
28. Why does FreeBSD's tcsh do history browsing differently than I Why does FreeBSD's tcsh do history browsing differently than I expect?
expect?
On FreeBSD, by default, the up arrow is set to On FreeBSD, by default, the up arrow is set to history-search-backward,
"history-search-backward", rather than the default "up-history". As a rather than the default up-history. As a result, if you type (part of)
result, if you type (part of) a word and press up arrow, you'll see a word and press up arrow, you'll see previous commands that match the
previous commands that match the prefix. Pretty useful, actually, prefix. Pretty useful, actually, although it takes some getting used
although it takes some getting used to. You can use bindkey to see to. You can use bindkey to see your settings, and to rebind up & down
your settings, and to rebind up & down differently if desired. differently if desired.
_________________________________________________________________ __________________________________________________________________
Everything else is a bug :-( Page content last updated on 2019-12-31
Christos
_________________________________________________________________
Home | RecentChanges | Preferences
Edit text of this page | View other revisions
Last edited April 29, 2004 15:02 (diff)
Search: ____________________

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 5. PR/113: Sobomax: avoid infinite loops for -c commands when stdout is
not a tty. not a tty.
4. Avoid infinite loops during history loads when merging, print a better 4. Avoid infinite loops during history loads when merging, print a better
@ -6,6 +28,7 @@
2. PR/94: Small apple issues (SAVESIGVEC, HOSTTYPE) 2. PR/94: Small apple issues (SAVESIGVEC, HOSTTYPE)
1. PR/81: Fix range matching issue where we were comparing with the 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 range character instead of the start of range. [l-z]* would match foo
12. V6.21.00 - 20190508 12. V6.21.00 - 20190508
11. Abort history loading on words and lines too long 11. Abort history loading on words and lines too long
https://bugzilla.redhat.com/show_bug.cgi?id=1598502 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.char.c sh.exp.c sh.file.c sh.func.c \
sh.glob.c sh.hist.c sh.init.c sh.lex.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.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.char.h sh.dir.h sh.proc.h sh.h \
sh.decls.h glob.h ${SYSSRCS} sh.decls.h glob.h ${SYSSRCS}
SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \ 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.char.${SUF} sh.exp.${SUF} sh.file.${SUF} sh.func.${SUF} \
sh.glob.${SUF} sh.hist.${SUF} sh.init.${SUF} sh.lex.${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.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 \ TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
tw.comp.c tw.color.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} 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 \ 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.func.c tc.nls.c tc.nls.h 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.disc.${SUF} tc.func.${SUF} tc.nls.${SUF} tc.os.${SUF} \
tc.who.c tc.h 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} \ 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.disc.${SUF} tc.func.${SUF} tc.os.${SUF} tc.printf.${SUF} \
tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${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 \ FAQ WishList config_f.h eight-bit.me glob.3 patchlevel.h pathnames.h \
tcsh.man Ported src.desc Imakefile imake.config complete.tcsh \ tcsh.man Ported src.desc Imakefile imake.config complete.tcsh \
Makefile.vms termcap.vms snames.h host.defs gethost.c tcsh.man2html \ 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]* 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 # things; Paul Placeway, CIS Dept., Ohio State University
# #
SHELL=/bin/sh SHELL=/bin/sh
ENVCMD=/usr/bin/env
VERSION=@PACKAGE_VERSION@ VERSION=@PACKAGE_VERSION@
BUILD=tcsh$(EXEEXT) BUILD=tcsh$(EXEEXT)
VPATH=@srcdir@ 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 \ pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \
gethost.c tcsh.man2html configure.ac configure config.h.in \ 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 \ TESTFILES= tests/aliases.at tests/arguments.at tests/commands.at \
tests/expr.at tests/lexical.at tests/mb-eucjp.at \ tests/expr.at tests/lexical.at tests/mb-eucjp.at \
tests/mb-utf8.at tests/noexec.at tests/parenthesis.at tests/syntax.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 Makefile config.h config_p.h
${RM} -f config.status config.cache config.log tcsh.ps ${RM} -f config.status config.cache config.log tcsh.ps
${RM} -f missing ${RM} -f missing
${RM} -f testsuite.log
${RM} -rf testsuite.dir
${RM} -rf autom4te.cache ${RM} -rf autom4te.cache
${RM} -f *~ #* ${RM} -f *~ #*
@ -735,8 +738,10 @@ $(srcdir)/stamp-h.in: $(srcdir)/configure.ac
cd $(srcdir) && autoheader cd $(srcdir) && autoheader
@echo timestamp > $(srcdir)/stamp-h.in @echo timestamp > $(srcdir)/stamp-h.in
check: atconfig $(srcdir)/tests/testsuite check test: atconfig $(srcdir)/tests/testsuite
$(SHELL) $(srcdir)/tests/testsuite $(ENVCMD) - \
USER="$(USER)" \
$(SHELL) $(srcdir)/tests/testsuite
# #
# Dependencies # 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 \ pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \
gethost.c tcsh.man2html configure.ac configure config.h.in \ gethost.c tcsh.man2html configure.ac configure config.h.in \
aclocal.m4 aclocal.m4 dot.login dot.tcshrc
VHSRCS=${PVSRCS} ${AVSRCS} 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 \ WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ 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} VHSRCS=${PVSRCS} ${AVSRCS}

View File

@ -5,7 +5,7 @@
The Tcsh source code is available on GitHub as a read-only repo The Tcsh source code is available on GitHub as a read-only repo
mirror at: mirror at:
> http://github.com/tcsh-org/tcsh > https://github.com/tcsh-org/tcsh
Instructions for compiling Tcsh can be found in [BUILDING]. Instructions for compiling Tcsh can be found in [BUILDING].
@ -20,7 +20,10 @@ the tcsh mailing list:
> https://mailman.astron.com/mailman/listinfo/tcsh > https://mailman.astron.com/mailman/listinfo/tcsh
[![Build Status][status]][travis] [![Build Status][status]][travis]
[![Coverity Scan][badge]][coverity]
[BUILDING]: BUILDING [BUILDING]: BUILDING
[status]: https://travis-ci.org/tcsh-org/tcsh.svg?branch=master [badge]: https://scan.coverity.com/projects/20307/badge.svg
[travis]: https://travis-ci.org/tcsh-org/tcsh [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; Char *new;
while (prev < p) { /* Skip initial non-word chars */ 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; break;
prev++; 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 = c_endword(prev-1, p, 1, delim); /* Skip to next non-word char */
new++; /* Step away from end of word */ new++; /* Step away from end of word */
while (new <= p) { /* Skip trailing non-word chars */ 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; break;
new++; new++;
} }
@ -795,19 +795,19 @@ c_endword(Char *p, Char *high, int n, Char *delim)
while (n--) { while (n--) {
while (p < high) { /* Skip non-word chars */ while (p < high) { /* Skip non-word chars */
if (!Strchr(delim, *p) || *(p-1) == (Char)'\\') if (!Strchr(delim, *p) || p[-1] == (Char)'\\')
break; break;
p++; p++;
} }
while (p < high) { /* Skip string */ while (p < high) { /* Skip string */
if ((*p == (Char)'\'' || *p == (Char)'"')) { /* Quotation marks? */ 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; if (inquote == 0) inquote = *p;
else if (inquote == *p) inquote = 0; else if (inquote == *p) inquote = 0;
} }
} }
/* Break if unquoted non-word char */ /* Break if unquoted non-word char */
if (!inquote && Strchr(delim, *p) && *(p-1) != (Char)'\\') if (!inquote && Strchr(delim, *p) && p[-1] != (Char)'\\')
break; break;
p++; p++;
} }
@ -1472,8 +1472,8 @@ e_insert(Char c)
else { else {
if (inputmode != MODE_INSERT) { if (inputmode != MODE_INSERT) {
int i; int i;
for(i = 0; i < Argument; i++) for (i = 0; i < Argument; i++)
UndoBuf[UndoSize++] = *(Cursor + i); UndoBuf[UndoSize++] = Cursor[i];
UndoBuf[UndoSize] = '\0'; UndoBuf[UndoSize] = '\0';
c_delafter(Argument); /* Do NOT use the saving ONE */ c_delafter(Argument); /* Do NOT use the saving ONE */
@ -2923,7 +2923,7 @@ v_csearch_fwd(Char ch, int count, int tflag)
cp = Cursor; cp = Cursor;
while (count--) { while (count--) {
if(*cp == ch) if (*cp == ch)
cp++; cp++;
while (cp < LastChar && *cp != ch) while (cp < LastChar && *cp != ch)
cp++; cp++;
@ -3771,7 +3771,7 @@ v_undo(Char c)
size = (int)(Cursor-LastChar); /* NOT NSL independant */ size = (int)(Cursor-LastChar); /* NOT NSL independant */
if (size < UndoSize) if (size < UndoSize)
size = UndoSize; size = UndoSize;
for(loop = 0; loop < size; loop++) { for (loop = 0; loop < size; loop++) {
temp = *kp; temp = *kp;
*kp++ = *cp; *kp++ = *cp;
*cp++ = temp; *cp++ = temp;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -179,7 +179,7 @@ add_localedir_to_nlspath(const char *path)
if (path == NULL) if (path == NULL)
return; return;
(void) xsnprintf(trypath, sizeof(trypath), "%s/en/LC_MESSAGES/tcsh.cat", (void) xsnprintf(trypath, sizeof(trypath), "%s/C/LC_MESSAGES/tcsh.cat",
path); path);
if (stat(trypath, &st) == -1) if (stat(trypath, &st) == -1)
return; return;
@ -1249,7 +1249,7 @@ main(int argc, char **argv)
* was a session leader . * was a session leader .
*/ */
else if (shpgrp != mygetpgrp()) { else if (shpgrp != mygetpgrp()) {
if(setpgid(0, shpgrp) == -1) { if (setpgid(0, shpgrp) == -1) {
xprintf("setpgid:"); xprintf("setpgid:");
goto notty; goto notty;
} }
@ -1839,6 +1839,10 @@ exitstat(void)
void void
phup(void) phup(void)
{ {
static int again = 0;
if (again++)
return;
if (loginsh) { if (loginsh) {
setcopy(STRlogout, STRhangup, VAR_READWRITE); setcopy(STRlogout, STRhangup, VAR_READWRITE);
#ifdef _PATH_DOTLOGOUT #ifdef _PATH_DOTLOGOUT
@ -2516,11 +2520,20 @@ defaultpath(void)
static void static void
record(void) record(void)
{ {
static int again = 0;
int ophup_disabled;
if (again++)
return;
ophup_disabled = phup_disabled;
phup_disabled = 1;
if (!fast) { if (!fast) {
recdirs(NULL, adrof(STRsavedirs) != NULL); recdirs(NULL, adrof(STRsavedirs) != NULL);
rechist(NULL, adrof(STRsavehist) != NULL); rechist(NULL, adrof(STRsavehist) != NULL);
} }
displayHistStats("Exiting"); /* no-op unless DEBUG_HIST */ 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 *, static int skipargs (Char ***, const char *,
const char *); const char *);
static void dgetstack (void); static void dgetstack (void);
static Char *dcanon_internal(Char *, Char *);
static struct directory dhead INIT_ZERO_STRUCT; /* "head" of loop */ static struct directory dhead INIT_ZERO_STRUCT; /* "head" of loop */
static int printd; /* force name to be printed */ static int printd; /* force name to be printed */
@ -148,16 +149,10 @@ dinit(Char *hp)
cleanup_push(tcp, xfree); cleanup_push(tcp, xfree);
} }
} }
cleanup_push(tcp, xfree);
cp = dcanon(tcp, STRNULL); cp = dcanon(tcp, STRNULL);
cleanup_ignore(tcp);
cleanup_until(tcp);
} }
#else /* S_IFLNK */ #else /* S_IFLNK */
cleanup_push(tcp, xfree);
cp = dcanon(tcp, STRNULL); cp = dcanon(tcp, STRNULL);
cleanup_ignore(tcp);
cleanup_until(tcp);
#endif /* S_IFLNK */ #endif /* S_IFLNK */
} }
@ -313,7 +308,7 @@ dtilde(void)
do { do {
if (d == &dhead) if (d == &dhead)
continue; continue;
d->di_name = dcanon(d->di_name, STRNULL); d->di_name = dcanon_internal(d->di_name, STRNULL);
} while ((d = d->di_prev) != dcwd); } while ((d = d->di_prev) != dcwd);
dset(dcwd->di_name); dset(dcwd->di_name);
@ -571,16 +566,10 @@ dgoto(Char *cp)
if (ABSOLUTEP(cp) && cp[1] == ':') { /* Only DOS paths are treated that way */ if (ABSOLUTEP(cp) && cp[1] == ':') { /* Only DOS paths are treated that way */
return agetcwd(); return agetcwd();
} else { } else {
cleanup_push(cp, xfree);
ret = dcanon(cp, dp); ret = dcanon(cp, dp);
cleanup_ignore(cp);
cleanup_until(cp);
} }
#else /* !WINNT_NATIVE */ #else /* !WINNT_NATIVE */
cleanup_push(cp, xfree);
ret = dcanon(cp, dp); ret = dcanon(cp, dp);
cleanup_ignore(cp);
cleanup_until(cp);
#endif /* WINNT_NATIVE */ #endif /* WINNT_NATIVE */
return ret; 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 * we are of course assuming that the file system is standardly
* constructed (always have ..'s, directories have links) * constructed (always have ..'s, directories have links)
*/ */
Char * static Char *
dcanon(Char *cp, Char *p) dcanon_internal(Char *cp, Char *p)
{ {
Char *sp; Char *sp;
Char *p1, *p2; /* general purpose */ Char *p1, *p2; /* general purpose */
@ -1356,7 +1359,7 @@ loaddirs(Char *fname)
void void
recdirs(Char *fname, int def) recdirs(Char *fname, int def)
{ {
int fp, ftmp, oldidfds; int fp, ftmp, oldidfds, ophup_disabled;
int cdflag = 0; int cdflag = 0;
struct directory *dp; struct directory *dp;
unsigned int num; unsigned int num;
@ -1366,6 +1369,8 @@ recdirs(Char *fname, int def)
if (fname == NULL && !def) if (fname == NULL && !def)
return; return;
ophup_disabled = phup_disabled;
phup_disabled = 1;
if (fname == NULL) { if (fname == NULL) {
if ((fname = varval(STRdirsfile)) == STRNULL) if ((fname = varval(STRdirsfile)) == STRNULL)
fname = Strspl(varval(STRhome), &STRtildotdirs[1]); fname = Strspl(varval(STRhome), &STRtildotdirs[1]);
@ -1378,6 +1383,7 @@ recdirs(Char *fname, int def)
if ((fp = xcreat(short2str(fname), 0600)) == -1) { if ((fp = xcreat(short2str(fname), 0600)) == -1) {
cleanup_until(fname); cleanup_until(fname);
phup_disabled = ophup_disabled;
return; return;
} }
@ -1413,4 +1419,5 @@ recdirs(Char *fname, int def)
SHOUT = ftmp; SHOUT = ftmp;
didfds = oldidfds; didfds = oldidfds;
cleanup_until(fname); 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 Char **dolnxt; /* Further words */
static int dolcnt; /* Count of further words */ static int dolcnt; /* Count of further words */
static struct Strbuf dolmod; /* = Strbuf_INIT; : modifier characters */ 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 Char **Dfix2 (Char *const *);
static int Dpack (struct Strbuf *); static int Dpack (struct Strbuf *);
@ -378,7 +380,7 @@ Dgetdol(void)
static Char *dolbang = NULL; static Char *dolbang = NULL;
cleanup_push(name, Strbuf_free); cleanup_push(name, Strbuf_free);
dolmod.len = dolmcnt = dol_flag_a = 0; dolmod.len = ndolflags = 0;
c = sc = DgetC(0); c = sc = DgetC(0);
if (c == DEOF) { if (c == DEOF) {
stderror(ERR_SYNTAX); stderror(ERR_SYNTAX);
@ -718,21 +720,27 @@ fixDolMod(void)
c = DgetC(0); c = DgetC(0);
if (c == ':') { if (c == ':') {
ndolflags = 0;
do { 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' || c == 'a') {
if (c == 'g') if (c == 'g') {
dolmcnt = INT_MAX; dolmcnts[ndolflags - 1] = INT_MAX;
else } else {
dol_flag_a = 1; dolaflags[ndolflags - 1] = 1;
}
c = DgetC(0); c = DgetC(0);
} }
if ((c == 'g' && dolmcnt != INT_MAX) || if ((c == 'g' && dolmcnts[ndolflags - 1] != INT_MAX) ||
(c == 'a' && dol_flag_a == 0)) { (c == 'a' && dolaflags[ndolflags - 1] == 0)) {
if (c == 'g') if (c == 'g') {
dolmcnt = INT_MAX; dolmcnts[ndolflags - 1] = INT_MAX;
else } else {
dol_flag_a = 1; dolaflags[ndolflags - 1] = 1;
}
c = DgetC(0); c = DgetC(0);
} }
@ -749,20 +757,21 @@ fixDolMod(void)
} }
while ((c = DgetC(0)) != DEOF) { while ((c = DgetC(0)) != DEOF) {
Strbuf_append1(&dolmod, (Char) c); Strbuf_append1(&dolmod, (Char) c);
if(c == delim) delimcnt--; if (c == delim) delimcnt--;
if(!delimcnt) break; if (!delimcnt) break;
} }
if(delimcnt) { if (delimcnt) {
seterror(ERR_BADSUBST); seterror(ERR_BADSUBST);
break; break;
} }
continue; continue;
} }
if (!any("luhtrqxes", c)) if (!any(TCSH_MODIFIERS, c))
stderror(ERR_BADMOD, (int)c); stderror(ERR_BADMOD, (int)c);
Strbuf_append1(&dolmod, (Char) c); Strbuf_append1(&dolmod, (Char) c);
if (c == 'q') if (c == 'q') {
dolmcnt = INT_MAX; dolmcnts[ndolflags - 1] = INT_MAX;
}
} }
while ((c = DgetC(0)) == ':'); while ((c = DgetC(0)) == ':');
unDredc(c); unDredc(c);
@ -771,13 +780,25 @@ fixDolMod(void)
unDredc(c); 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 static void
setDolp(Char *cp) setDolp(Char *cp)
{ {
Char *dp; Char *dp;
size_t i; size_t i;
int nthMod = 0;
if (dolmod.len == 0 || dolmcnt == 0) { if (dolmod.len == 0 || all_dolmcnts_are_0()) {
dolp = cp; dolp = cp;
return; return;
} }
@ -786,10 +807,12 @@ setDolp(Char *cp)
int didmod = 0; int didmod = 0;
/* handle s// [eichin:19910926.0510EST] */ /* handle s// [eichin:19910926.0510EST] */
if(dolmod.s[i] == 's') { if (dolmod.s[i] == 's') {
Char delim; Char delim;
Char *lhsub, *rhsub, *np; Char *lhsub, *rhsub, *np;
size_t lhlen = 0, rhlen = 0; size_t lhlen = 0, rhlen = 0;
/* keep track of where the last :a match hit */
ptrdiff_t last_match = 0;
delim = dolmod.s[++i]; delim = dolmod.s[++i];
if (!delim || letter(delim) if (!delim || letter(delim)
@ -798,47 +821,50 @@ setDolp(Char *cp)
break; break;
} }
lhsub = &dolmod.s[++i]; lhsub = &dolmod.s[++i];
while(dolmod.s[i] != delim && dolmod.s[++i]) { while (dolmod.s[i] != delim && dolmod.s[++i]) {
lhlen++; lhlen++;
} }
dolmod.s[i] = 0; dolmod.s[i] = 0;
rhsub = &dolmod.s[++i]; rhsub = &dolmod.s[++i];
while(dolmod.s[i] != delim && dolmod.s[++i]) { while (dolmod.s[i] != delim && dolmod.s[++i]) {
rhlen++; rhlen++;
} }
dolmod.s[i] = 0; dolmod.s[i] = 0;
strip(lhsub); strip(lhsub);
strip(rhsub); strip(rhsub);
strip(cp); if (dolmcnts[nthMod] != 0) {
dp = cp; strip(cp);
do { dp = cp;
dp = Strstr(dp, lhsub); do {
if (dp) { dp = Strstr(dp + last_match, lhsub);
ptrdiff_t diff = dp - cp; if (dp) {
size_t len = (Strlen(cp) + 1 - lhlen + rhlen); ptrdiff_t diff = dp - cp;
np = xmalloc(len * sizeof(Char)); size_t len = (Strlen(cp) + 1 - lhlen + rhlen);
(void) Strncpy(np, cp, diff); np = xmalloc(len * sizeof(Char));
(void) Strcpy(np + diff, rhsub); (void) Strncpy(np, cp, diff);
(void) Strcpy(np + diff + rhlen, dp + lhlen); (void) Strcpy(np + diff, rhsub);
(void) Strcpy(np + diff + rhlen, dp + lhlen);
last_match = diff + rhlen;
xfree(cp); xfree(cp);
dp = cp = np; dp = cp = np;
cp[--len] = '\0'; cp[--len] = '\0';
didmod = 1; didmod = 1;
if (diff >= (ssize_t)len) if (diff >= (ssize_t)len)
break; break;
} else { } else {
/* should this do a seterror? */ /* should this do a seterror? */
break; break;
} }
} }
while (dol_flag_a != 0); while (dolaflags[nthMod] != 0);
}
/* /*
* restore dolmod for additional words * restore dolmod for additional words
*/ */
dolmod.s[i] = rhsub[-1] = (Char) delim; dolmod.s[i] = rhsub[-1] = (Char) delim;
} else { } else if (dolmcnts[nthMod] != 0) {
do { do {
if ((dp = domod(cp, dolmod.s[i])) != NULL) { if ((dp = domod(cp, dolmod.s[i])) != NULL) {
@ -856,14 +882,16 @@ setDolp(Char *cp)
else else
break; break;
} }
while (dol_flag_a != 0); while (dolaflags[nthMod] != 0);
} }
if (didmod && dolmcnt != INT_MAX) if (didmod && dolmcnts[nthMod] != INT_MAX)
dolmcnt--; dolmcnts[nthMod]--;
#ifdef notdef #ifdef notdef
else else
break; break;
#endif #endif
++nthMod;
} }
addla(cp); addla(cp);

View File

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

View File

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

View File

@ -75,8 +75,13 @@ globtilde(Char *s)
Char *name, *u, *home, *res; Char *name, *u, *home, *res;
u = s; u = s;
if (s[1] == '~')
return Strsave(s);
for (s++; *s && *s != '/' && *s != ':'; s++) for (s++; *s && *s != '/' && *s != ':'; s++)
continue; continue;
name = Strnsave(u + 1, s - (u + 1)); name = Strnsave(u + 1, s - (u + 1));
cleanup_push(name, xfree); cleanup_push(name, xfree);
home = gethdir(name); home = gethdir(name);
@ -513,14 +518,16 @@ globone(Char *str, int action)
} }
result: result:
if (vl && vl[0] == NULL) { if (vl && vl[0] == NULL) {
xfree(vl); if (vl != v)
xfree(vl);
return (Strsave(STRNULL)); return (Strsave(STRNULL));
} }
if (vl && vl[1]) if (vl && vl[1])
return (handleone(str, vl, action)); return (handleone(str, vl, action));
else { else {
str = strip(*vl); str = strip(*vl);
xfree(vl); if (vl != v)
xfree(vl);
return (str); 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; typedef struct { const char *f; size_t l; sigjmp_buf j; } jmp_buf_t;
# define tcsh_setjmp() sigsetjmp(reslab.j, 1) # define tcsh_setjmp() sigsetjmp(reslab.j, 1)
# define tcsh_longjmp() siglongjmp(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 #else
typedef struct { const char *f; size_t l; jmp_buf j; } jmp_buf_t; typedef struct { const char *f; size_t l; jmp_buf j; } jmp_buf_t;
# define tcsh_setjmp() setjmp(reslab.j) # 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) #define Strstr(a, b) s_strstr(a, b)
#endif #endif
#define TCSH_MODIFIERS "ehlqrstuxQ"
/* /*
* setname is a macro to save space (see sh.err.c) * setname is a macro to save space (see sh.err.c)
*/ */

View File

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

View File

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

View File

@ -288,7 +288,7 @@ closem(void)
{ {
xclose(f); xclose(f);
#ifdef NISPLUS #ifdef NISPLUS
if(f < 3) if (f < 3)
(void) xopen(_PATH_DEVNULL, O_RDONLY|O_LARGEFILE); (void) xopen(_PATH_DEVNULL, O_RDONLY|O_LARGEFILE);
#endif /* NISPLUS */ #endif /* NISPLUS */
} }
@ -531,6 +531,25 @@ areadlink(const char *path)
char *buf; char *buf;
size_t size; size_t size;
ssize_t res; 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; size = MAXPATHLEN + 1;
buf = xmalloc(size); buf = xmalloc(size);

View File

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

View File

@ -655,3 +655,13 @@ showall(Char **v, struct command *c)
USE(c); USE(c);
USE(v); 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"; char strPOSIX[] = "posix";
#endif /* _IBMR2 */ #endif /* _IBMR2 */
#ifdef __IBMC__
# define HAVE_DISC /* Z/OS TIOCGETD returns no such device */
#endif /* __IBMC__ */
#if !defined(HAVE_DISC) && defined(TIOCGETD) && defined(NTTYDISC) #if !defined(HAVE_DISC) && defined(TIOCGETD) && defined(NTTYDISC)
static int oldisc; static int oldisc;
#endif /* !HAVE_DISC && TIOCGETD && NTTYDISC */ #endif /* !HAVE_DISC && TIOCGETD && NTTYDISC */

View File

@ -831,7 +831,7 @@ dobs2cmd(Char **v, struct command *c)
xexit(bs2cmdlist(cmd)); xexit(bs2cmdlist(cmd));
} }
cleanup_until(&pvec[1]); cleanup_until(&pvec[1]);
for(;;) { for (;;) {
int old_pintr_disabled; int old_pintr_disabled;
if (setintr) 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++); Strbuf_append1(&buf, attributes | *z++);
do { do {
Strbuf_append1(&buf, attributes | *z++); Strbuf_append1(&buf, attributes | *z++);
} while(*z != '/'); } while (*z != '/');
} }
#endif /* WINNT_NATIVE */ #endif /* WINNT_NATIVE */
q = z; q = z;

View File

@ -77,7 +77,7 @@
.\" used here if you can. In particular, please don't use nroff commands .\" used here if you can. In particular, please don't use nroff commands
.\" which aren't already used herein. .\" 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 .SH NAME
tcsh \- C shell with file name completion and command line editing tcsh \- C shell with file name completion and command line editing
.SH SYNOPSIS .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 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. can be made part of the prompt by placing an `!' in the \fBprompt\fR shell variable.
.PP .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. The shell actually saves history in expanded and literal (unexpanded) forms.
If the \fBhistlit\fR shell variable is set, commands that display and store If the \fBhistlit\fR shell variable is set, commands that display and store
history use the literal form. history use the literal form.
@ -1133,6 +1137,18 @@ Print the new command line but do not execute it.
q q
Quote the substituted words, preventing further substitutions. Quote the substituted words, preventing further substitutions.
.TP 8 .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 x
Like q, but break into words at blanks, tabs and newlines. Like q, but break into words at blanks, tabs and newlines.
.PD .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), 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 the tty is a pseudo-tty (pty) or the shell was not so compiled (see the
\fBversion\fR shell variable). \fBversion\fR shell variable).
Unset or set to `0' to disable automatic logout.
See also the \fBafsuser\fR and \fBlogout\fR shell variables. See also the \fBafsuser\fR and \fBlogout\fR shell variables.
.TP 8 .TP 8
.B autorehash \fR(+) .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), malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7),
termio(7), Introduction to the C Shell termio(7), Introduction to the C Shell
.SH VERSION .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 .SH AUTHORS
.PD 0 .PD 0
.TP 2 .TP 2

View File

@ -64,9 +64,9 @@
.\" used here if you can. In particular, please don't use nroff commands .\" used here if you can. In particular, please don't use nroff commands
.\" which aren't already used herein. .\" which aren't already used herein.
.\" .\"
.Dd May 8, 2019 .Dd Noverber 18, 2020
.Dt TCSH 1 .Dt TCSH 1
.Os Astron 6.21.00 .Os Astron 6.22.02
.Sh NAME .Sh NAME
.Nm tcsh .Nm tcsh
.Nd C shell with file name completion and command line editing .Nd C shell with file name completion and command line editing
@ -1494,6 +1494,11 @@ in the
.Va prompt .Va prompt
shell variable. shell variable.
.Pp .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. The shell actually saves history in expanded and literal (unexpanded) forms.
If the If the
.Va histlit .Va histlit
@ -1849,6 +1854,16 @@ substituted, not patterns that contain any substitution result.
Print the new command line but do not execute it. Print the new command line but do not execute it.
.It Ar q .It Ar q
Quote the substituted words, preventing further substitutions. 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 .It Ar x
Like Like
.Ar q , .Ar q ,
@ -3358,17 +3373,15 @@ by an unambiguous prefix of the string typed in to start it:
.Sq %ex .Sq %ex
would would
normally restart a suspended normally restart a suspended
.Va ex .Xr ex 1
(1) job, if there were only one suspended job, if there were only one suspended
job whose name began with the string job whose name began with the string
.Sq ex .Sq ex .
It is also possible to say It is also possible to say
`%? .Va %?string
.Va string to specify a job whose text contains
' to specify a job whose text contains .Va string ,
.Va string if there is only one such job.
, if there
is only one such job.
.Pp .Pp
The shell maintains a notion of the current and previous jobs. The shell maintains a notion of the current and previous jobs.
In output In output
@ -3855,7 +3868,7 @@ are optional.
Components of Components of
.Va expr .Va expr
must be separated by spaces. must be separated by spaces.
.It Ar alias[name[wordlist]] .It Ar alias [name [wordlist]]
Without arguments, prints all aliases. Without arguments, prints all aliases.
With With
.Va name .Va name
@ -3884,26 +3897,21 @@ memory.
With an argument shows the number of free and used blocks in each size With an argument shows the number of free and used blocks in each size
category. category.
The categories start at size 8 and double at each step. The categories start at size 8 and double at each step.
This This command's output may vary across system types, because systems other
command's output may vary across system types, because systems other than the VAX than the VAX may use a different memory allocator.
may use a different memory allocator. .It Ar bg [%job...]
.TP 8
.It Ar bg[%job...]
Puts the specified jobs (or, without arguments, the current job) Puts the specified jobs (or, without arguments, the current job)
into the background, continuing each if it is stopped. into the background, continuing each if it is stopped.
.Va job .Va job
may be a number, a string, may be a number, a string,
.Sq .Sq \&, ,
, .Sq % ,
.Sq % .Sq + ,
,
.Sq +
or or
.Sq \- .Sq \&-
as described as described
under under
.Va Jobs .Va Jobs .
.Pp
.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 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 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 (+) .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 the tty is a pseudo-tty (pty) or the shell was not so compiled (see the
.Va version .Va version
shell variable). shell variable).
Unset
.Va autologout or set it to
.Dv 0
to disable automatic logout.
See also the See also the
.Va afsuser .Va afsuser
and 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), malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7),
termio(7), Introduction to the C Shell termio(7), Introduction to the C Shell
.Sh VERSION .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 .Sh AUTHORS
.PD 0 .PD 0
.TP 2 .TP 2

View File

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