xref: /freebsd/contrib/tcsh/FAQ (revision 5224c2a3bc95b431f729f3692f264395248d8acc)
1*5224c2a3SDmitry Chagin     * Home
2*5224c2a3SDmitry Chagin     * FAQ
3*5224c2a3SDmitry Chagin     * Y2K
4*5224c2a3SDmitry Chagin     __________________________________________________________________
5c80476e4SDavid E. O'Brien
6*5224c2a3SDmitry ChaginFAQ
76767bd61SMark Peek
8*5224c2a3SDmitry Chagin   For the people who do not read the manual!
9c80476e4SDavid E. O'Brien
10*5224c2a3SDmitry Chagin  Why is the meta key broken in tcsh-5.20 and up?
11c80476e4SDavid E. O'Brien
126767bd61SMark Peek   On some machines the tty is not set up to pass 8 bit characters by
136767bd61SMark Peek   default. Tcsh 5.19 used to try to determine if pass8 should be set by
146767bd61SMark Peek   looking at the terminal's meta key. Unfortunately there is no good way
156767bd61SMark Peek   of determining if the terminal can really pass 8 characters or not.
166767bd61SMark Peek   Consider if you are logged in through a modem line with 7 bits and
176767bd61SMark Peek   parity and your terminal has a meta key. Then tcsh 5.19 would set
186767bd61SMark Peek   wrongly set pass8.
19c80476e4SDavid E. O'Brien
20*5224c2a3SDmitry Chagin   If you did like the previous behavior you can add in /etc/csh.login, or
21*5224c2a3SDmitry Chagin   in .login:
22c80476e4SDavid E. O'Brien    if ( $?tcsh && $?prompt ) then
23c80476e4SDavid E. O'Brien        if ( "`echotc meta`" == "yes" ) then
24c80476e4SDavid E. O'Brien             stty pass8
25c80476e4SDavid E. O'Brien        endif
26c80476e4SDavid E. O'Brien    endif
27c80476e4SDavid E. O'Brien
28*5224c2a3SDmitry Chagin   If you don't have pass8, maybe one of these would work:
29c80476e4SDavid E. O'Brien    stty -parity -evenp -oddp cs8 -istrip   (rs6000)
30c80476e4SDavid E. O'Brien    stty -parenb -istrip cs8
31c80476e4SDavid E. O'Brien
323b6eaa7bSAndrey A. Chernov   Finally, tcsh will bind all printable meta characters to the self
336767bd61SMark Peek   insert command. If you don't want that to happen (i.e. use the
346767bd61SMark Peek   printable meta characters for commands) setenv NOREBIND.
353b6eaa7bSAndrey A. Chernov
36*5224c2a3SDmitry Chagin  I ran dbxtool & and shelltool & from tcsh, and they end up in cbreak and no
37*5224c2a3SDmitry Chagin  echo mode?
38c80476e4SDavid E. O'Brien
396767bd61SMark Peek   These programs are broken. Background jobs should not try to look at
406767bd61SMark Peek   the tty. What happens is that dbxtool looks in stderr to inherit the
41*5224c2a3SDmitry Chagin   tty setups, but tcsh sets up the tty in cbreak and -echo modes, so that
42*5224c2a3SDmitry Chagin   it can do line editing. This cannot be fixed because tcsh cannot give
43*5224c2a3SDmitry Chagin   away the tty. Pick one of the following as a workaround:
44c80476e4SDavid E. O'Brien    dbxtool < /dev/null >& /dev/null &
45c80476e4SDavid E. O'Brien    /usr/etc/setsid dbxtool &
46c80476e4SDavid E. O'Brien
47*5224c2a3SDmitry Chagin   If that does not work, for dbxtool at least you can add sh stty sane in
48*5224c2a3SDmitry Chagin   your .dbxinit file.
49c80476e4SDavid E. O'Brien
50*5224c2a3SDmitry Chagin  I tried to compile tcsh and it cannot find <locale.h>?
51c80476e4SDavid E. O'Brien
52c80476e4SDavid E. O'Brien   Your system does not support NLS. Undefine NLS in config_f.h and it
53c80476e4SDavid E. O'Brien   should work fine.
54c80476e4SDavid E. O'Brien
55*5224c2a3SDmitry Chagin  Where can I get csh sources?
56c80476e4SDavid E. O'Brien
57*5224c2a3SDmitry Chagin   Csh sources are now available with the 4.4BSD networking distributions.
58*5224c2a3SDmitry Chagin   You don't need csh sources to compile tcsh-6.0x.
59c80476e4SDavid E. O'Brien
60*5224c2a3SDmitry Chagin  I just made tcsh my login shell, and I cannot ftp any more?
61c80476e4SDavid E. O'Brien
626767bd61SMark Peek   Newer versions of the ftp daemon check for the validity of the user's
636767bd61SMark Peek   shell before they allow logins. The list of valid login shells is
646767bd61SMark Peek   either hardcoded or it is usually in a file called /etc/shells. If it
656767bd61SMark Peek   is hard-coded, then you are out of luck and your best bet is to get a
66*5224c2a3SDmitry Chagin   newer version of ftpd. Otherwise add tcsh to the list of shells. (For
67*5224c2a3SDmitry Chagin   AIX this file is called /etc/security/login.cfg.) Remember that the
68*5224c2a3SDmitry Chagin   full path is required. If there is no /etc/shells, and you are creating
69*5224c2a3SDmitry Chagin   one, remember to add /bin/csh, /bin/sh, and any other valid shells for
70*5224c2a3SDmitry Chagin   your system, so that other people can ftp too.
71c80476e4SDavid E. O'Brien
72*5224c2a3SDmitry Chagin  I am using SunView or OpenWindows and editing is screwed up. In particular my
73*5224c2a3SDmitry Chagin  arrow keys and backspace don't work right. What am I doing wrong?
74c80476e4SDavid E. O'Brien
756767bd61SMark Peek   Well, cmdtool tries to do its own command line editing and the effect
766767bd61SMark Peek   you get is one of using an editor inside an editor. Both try to
776767bd61SMark Peek   interpret the arrow key sequences and cmdtool wins since it gets them
786767bd61SMark Peek   first. The solutions are in my order of preference:
79*5224c2a3SDmitry Chagin     * Don't use suntools
80*5224c2a3SDmitry Chagin     * Use shelltool instead of cmdtool.
81*5224c2a3SDmitry Chagin     * Unset edit in tcsh.
82c80476e4SDavid E. O'Brien
83*5224c2a3SDmitry Chagin  On a SPARCstation running Solaris 2.x and OpenWindows 3.1, inside a cmdtool,
84*5224c2a3SDmitry Chagin  the short-cut key sequence to clear log (i.e. Meta-e or Diamond-e) doesn't
85*5224c2a3SDmitry Chagin  work: it just echos ‘e’; or
86b2d5d167SMark Peek
87b2d5d167SMark Peek   Unset edit in tcsh.
88b2d5d167SMark Peek
89*5224c2a3SDmitry Chagin  On a SPARCstation running Solaris 2.x and OpenWindows 3.1, maketool (within
90*5224c2a3SDmitry Chagin  SPARCworks) doesn't work: it just does a `cd’ to the working directory then
91*5224c2a3SDmitry Chagin  stops.
92b2d5d167SMark Peek
93b2d5d167SMark Peek   Unset edit in tcsh. Using shelltool instead of cmdtool does not fix
94b2d5d167SMark Peek   this.
95b2d5d167SMark Peek
96*5224c2a3SDmitry Chagin  I rlogin to another machine, and then no matter what I tell stty I cannot get
97*5224c2a3SDmitry Chagin  it to pass 8 bit characters?
98c80476e4SDavid E. O'Brien
99*5224c2a3SDmitry Chagin   Maybe you need to use rlogin -8 to tell rlogin to pass 8 bit
1006767bd61SMark Peek   characters.
101c80476e4SDavid E. O'Brien
102*5224c2a3SDmitry Chagin  Where do I get the public domain directory library?
103c80476e4SDavid E. O'Brien
104*5224c2a3SDmitry Chagin   Anonymous ftp to ftp://prep.ai.mit.edu/pub/gnu/dirent.tar.Z
105c80476e4SDavid E. O'Brien
106*5224c2a3SDmitry Chagin  I compiled tcsh using gcc, and when I start up it says: tcsh: Warning no
107*5224c2a3SDmitry Chagin  access to tty (Invalid Argument). Thus no job control in this shell
108c80476e4SDavid E. O'Brien
1096767bd61SMark Peek   Your <sys/ioctl.h> file is not ansi compliant. You have one of 3
1106767bd61SMark Peek   choices:
111*5224c2a3SDmitry Chagin     * Run fixincludes from the gcc distribution.
112*5224c2a3SDmitry Chagin     * Add -traditional to the gcc flags.
113*5224c2a3SDmitry Chagin     * Compile with cc.
114c80476e4SDavid E. O'Brien
115*5224c2a3SDmitry Chagin  I compiled tcsh with the SunOS unbundled compiler and now things get echoed
116*5224c2a3SDmitry Chagin  twice.
117c80476e4SDavid E. O'Brien
118c80476e4SDavid E. O'Brien   It is a bug in the unbundled optimizer. Lower the optimization level.
119c80476e4SDavid E. O'Brien
120*5224c2a3SDmitry Chagin  How can I use the arrow keys with hpterm?
1216767bd61SMark Peek
1226767bd61SMark Peek   Hp terminals use the arrow keys internally. You can tell hpterm not to
1236767bd61SMark Peek   do that, by sending it the termcap sequence smkx. Since this has to be
1246767bd61SMark Peek   done all the time, the easiest thing is to put it as an alias for
1256767bd61SMark Peek   precmd, or inside the prompt:
126c80476e4SDavid E. O'Brien    if ($term == "hp") then
127c80476e4SDavid E. O'Brien        set prompt="%{`echotc smkx`%}$prompt"
128c80476e4SDavid E. O'Brien    endif
129c80476e4SDavid E. O'Brien
130*5224c2a3SDmitry Chagin   Note that by doing that you cannot use pgup and pgdn to scroll… Also if
131*5224c2a3SDmitry Chagin   you are using termcap, replace smkx with ks.
132c80476e4SDavid E. O'Brien
133*5224c2a3SDmitry Chagin  On POSIX machines ^C and ^Z do not work when tcsh is a login shell?
1346767bd61SMark Peek
1356767bd61SMark Peek   Make sure that the interrupt character is set to ^C and suspend is set
136*5224c2a3SDmitry Chagin   to ^Z; stty -a will show you the current stty settings; stty intr ^C
137*5224c2a3SDmitry Chagin   susp ^Z will set them to ^C and ^Z respectively.
138c80476e4SDavid E. O'Brien
139*5224c2a3SDmitry Chagin  I am trying to compile tcsh and I am getting compile errors that look like:
140c80476e4SDavid E. O'Brien
141*5224c2a3SDmitry Chagin    sh.c:???: `STR???' undeclared, outside of functions [gcc]
142*5224c2a3SDmitry Chagin    "sh.c", line ???: STR??? undefined [cc]
143c80476e4SDavid E. O'Brien
1446767bd61SMark Peek   You interrupted make, while it was making the automatically generated
145*5224c2a3SDmitry Chagin   headers. Type make clean; make
146c80476e4SDavid E. O'Brien
147*5224c2a3SDmitry Chagin  On the cray, sometimes the CR/LF mapping gets screwed up.
148c80476e4SDavid E. O'Brien
1496767bd61SMark Peek   You are probably logged in to the cray via telnet. Cray's telnetd
150*5224c2a3SDmitry Chagin   implements line mode selection the telnet client you are using does not
151*5224c2a3SDmitry Chagin   implement telnet line mode. This cause the Cray's telnetd to try to use
152*5224c2a3SDmitry Chagin   KLUDGELINEMODE. You can turn off telnet line mode from the cray side by
153*5224c2a3SDmitry Chagin   doing a stty -extproc, or you can get the Cray AIC to build a telnetd
154*5224c2a3SDmitry Chagin   without KLUDGELINEMODE, or you can compile a new telnet client (from
155*5224c2a3SDmitry Chagin   the BSD net2 tape), or at least on the suns use: mode character.
156c80476e4SDavid E. O'Brien
157*5224c2a3SDmitry Chagin  On AU/X, I made tcsh my startup shell, but the mac desktop is not starting up
158*5224c2a3SDmitry Chagin  (no X11 or Finder), and I only get console emulation.
159c80476e4SDavid E. O'Brien
160*5224c2a3SDmitry Chagin   Add the pathname to tcsh in /etc/shells and everything should work
161*5224c2a3SDmitry Chagin   fine.
162c80476e4SDavid E. O'Brien
163*5224c2a3SDmitry Chagin  On machines that use YP (NIS) tilde expansion might end up in /dev/null
1646767bd61SMark Peek
165c80476e4SDavid E. O'Brien   If this happens complain to your vendor, to get a new version of NIS.
166c80476e4SDavid E. O'Brien   You can fix that in tcsh by defining YPBUGS in config.h
167c80476e4SDavid E. O'Brien
168*5224c2a3SDmitry Chagin  Script on SGI 4.0.5 does not give us a tty, so we cannot have job control.
1696767bd61SMark Peek
1706767bd61SMark Peek   Their csh does not have job control either. Try:
171c80476e4SDavid E. O'Brien        % script
172c80476e4SDavid E. O'Brien        % cat > /dev/tty
173c80476e4SDavid E. O'Brien
174*5224c2a3SDmitry Chagin  I start tcsh and it takes a couple of minutes to get the prompt.
1756767bd61SMark Peek
176c80476e4SDavid E. O'Brien   You have defined REMOTEHOST and your DNS is not responding. Either
177c80476e4SDavid E. O'Brien   undefine REMOTEHOST and recompile or fix your DNS.
178c80476e4SDavid E. O'Brien
179*5224c2a3SDmitry Chagin  If you need help generating your .cshrc file, check out:
180c80476e4SDavid E. O'Brien
181*5224c2a3SDmitry Chagin     * https://github.com/tcsh-org/tcsh/blob/master/dot.tcshrc
182*5224c2a3SDmitry Chagin     * https://github.com/tcsh-org/tcsh/blob/master/dot.login
183b2d5d167SMark Peek
184*5224c2a3SDmitry Chagin  On POSIX systems the kernel will send hup signals to all the processes in the
185*5224c2a3SDmitry Chagin  foreground process group if ‘stty hupcl’ is set.
1866767bd61SMark Peek
1876767bd61SMark Peek   For example
188c80476e4SDavid E. O'Brien    ./tcsh
189c80476e4SDavid E. O'Brien    echo $$
190c80476e4SDavid E. O'Brien    591
191c80476e4SDavid E. O'Brien    ./tcsh
192c80476e4SDavid E. O'Brien    kill -6 591
193c80476e4SDavid E. O'Brien
1946767bd61SMark Peek   Will kill everything, since hup will be sent to all tcsh processes. To
1956767bd61SMark Peek   avoid that you can set stty -hupcl, but it is not recommended.
196c80476e4SDavid E. O'Brien
197*5224c2a3SDmitry Chagin  When I rsh the meta key stops working on the remote machine.
198c80476e4SDavid E. O'Brien
1996767bd61SMark Peek   Try using rsh -8; this option is undocumented on some systems, but it
2006767bd61SMark Peek   works. If that does not work, get and use ssh/sshd. You'll be better
2016767bd61SMark Peek   off from a security point of view anyway.
202c80476e4SDavid E. O'Brien
203*5224c2a3SDmitry Chagin  Tcsh compiled under hp/ux-10.x does not pass resource limits correctly when
204*5224c2a3SDmitry Chagin  ran on hp/ux-11.x systems.
205c80476e4SDavid E. O'Brien
2066767bd61SMark Peek   This is a problem with lack of ABI compatibility between the two
2076767bd61SMark Peek   systems. The only solution is to recompile.
2086767bd61SMark Peek
209*5224c2a3SDmitry Chagin  Refreshing in command line editing can appear broken on some OS's
2106767bd61SMark Peek
211*5224c2a3SDmitry Chagin   This is because the termcap/terminfo description lies about the ability
212*5224c2a3SDmitry Chagin   of the terminal to use tabs. At least on Compaq/DEC Alpha OSF/1 3.x and
213*5224c2a3SDmitry Chagin   4.x systems, stty -tabs will cause problems.
214c80476e4SDavid E. O'Brien
215*5224c2a3SDmitry Chagin  Where can I learn the merits of tcsh vs. bash vs. csh vs. sh etc?
216b2d5d167SMark Peek
217b2d5d167SMark Peek   You can read the manual page section titled [NEW FEATURES] listing
218b2d5d167SMark Peek   features that tcsh adds to csh.
219b2d5d167SMark Peek
220*5224c2a3SDmitry Chagin   You can read Tom Christiansen's Csh Programming Considered Harmful, a
221*5224c2a3SDmitry Chagin   document advocating that csh (and by extension, tcsh) should not be
222b2d5d167SMark Peek   used for writing shell scripts.
223b2d5d167SMark Peek
224*5224c2a3SDmitry Chagin   XXX: Need to find something about bash, but bash is sh-compatible and
225*5224c2a3SDmitry Chagin   has many of the same interactive features of tcsh (command completion
226*5224c2a3SDmitry Chagin   does not appear to be as flexible, though).
227b2d5d167SMark Peek
228*5224c2a3SDmitry Chagin   Curtains up: introducing the Z shell has a pretty good rundown on zsh.
229*5224c2a3SDmitry Chagin   Aside from the arguments about csh being evil, tcsh appears to compare
230*5224c2a3SDmitry Chagin   well with zsh. Zsh is sh and ksh compatible, with many of the
231*5224c2a3SDmitry Chagin   interactive features of tcsh.
232b2d5d167SMark Peek
233*5224c2a3SDmitry Chagin  Why does FreeBSD's tcsh do history browsing differently than I expect?
234b2d5d167SMark Peek
235*5224c2a3SDmitry Chagin   On FreeBSD, by default, the up arrow is set to history-search-backward,
236*5224c2a3SDmitry Chagin   rather than the default up-history. As a result, if you type (part of)
237*5224c2a3SDmitry Chagin   a word and press up arrow, you'll see previous commands that match the
238*5224c2a3SDmitry Chagin   prefix. Pretty useful, actually, although it takes some getting used
239*5224c2a3SDmitry Chagin   to. You can use bindkey to see your settings, and to rebind up & down
240*5224c2a3SDmitry Chagin   differently if desired.
241*5224c2a3SDmitry Chagin     __________________________________________________________________
242b2d5d167SMark Peek
243*5224c2a3SDmitry Chagin   Page content last updated on 2019-12-31
244