This commit was generated by cvs2svn to compensate for changes in r59243,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
David E. O'Brien 2000-04-15 04:41:27 +00:00
commit d1ff3bba52
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=59244
299 changed files with 78108 additions and 0 deletions

211
contrib/tcsh/FAQ Normal file
View File

@ -0,0 +1,211 @@
Last Updated:
Fri Mar 12 12:53:43 EST 1999
This is for people who do not read the manual!
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. 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 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 ( $?tcsh && $?prompt ) then
if ( "`echotc meta`" == "yes" ) then
stty pass8
endif
endif
If you don't have pass8, maybe something like
stty -parity -evenp -oddp cs8 -istrip (rs6000)
or
stty -parenb -istrip cs8
would work..
2. 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. A work-around is:
dbxtool < /dev/null >& /dev/null &
or
/usr/etc/setsid dbxtool &
If that does not work, for dbxtool at least you can add "sh stty sane"
in your .dbxinit
3. 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
should work fine.
4. 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.
5. 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 :-)
6. I am using SunView/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 first. The solutions are in my order of preference:
1 Don't use suntools
2 Use shelltool instead of cmdtool.
3 Unset edit in tcsh.
6b. 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'
6c. 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.
The workaround for 6b and 6c is doing "unset edit."
Using shelltool instead of cmdtool doesn't fix 6c.
7. 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 characters.
8. Where do I get the public domain directory library?
Anonymous ftp to prep.ai.mit.edu:/pub/gnu/dirent.tar.Z
9. 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 choices:
a. Run fixincludes from the gcc distribution.
b. Add -traditional to the gcc flags.
c. Compile with cc.
10. 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.
11. 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 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"...
12. On POSIX machines ^C and ^Z will 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.
13. I am trying to compile tcsh and I am getting compile errors that
look like:
>sh.c:???: `STR???' undeclared, outside of functions [gcc]
or
>"sh.c", line ???: STR??? undefined [cc]
You interrupted make, while it was making the automatically
generated headers. Type 'make clean; make'
14. 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'.
15. 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.
16. 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.
You can fix that in tcsh by defining YPBUGS in config.h
17. 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
18. 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
undefine REMOTEHOST and recompile or fix your DNS.
19. If you need help generating your .cshrc file, check out:
http://www.imada.ou.dk/~blackie/dotfile/
20. 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
./tcsh
kill -6 591
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.
21. 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 off from a security point of view anyway.
22. 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 systems. The only solution is to recompile.
christos
Everything else is a bug :-(

1435
contrib/tcsh/Fixes Normal file

File diff suppressed because it is too large Load Diff

622
contrib/tcsh/Imakefile Normal file
View File

@ -0,0 +1,622 @@
XCOMM
XCOMM $Id: Imakefile,v 1.76 1999/06/09 19:26:36 christos Exp $
XCOMM
XCOMM Imakefile for tcsh 6.08
XCOMM Marc Horowitz, MIT SIPB
XCOMM
#ifdef DestDir
#undef DestDir
#endif
#ifdef ManSuffix
#undef ManSuffix
#endif
/* All config options go in a separate file. */
#include "imake.config"
#ifndef HasGcc
# define HasGcc 0
#endif
#ifndef HasGcc2
# define HasGcc2 0
#endif
/* This is a giant conditional block. It should be set up right for
platforms which are in here, but it may need to be changed for new
ones. Please send in your fixes and additions! */
/**** tcsh configuration defines ****/
/* specific platforms */
#ifndef ConfigH
# ifdef UltrixArchitecture
# define ConfigH ultrix
# endif
# ifdef UxpArchitecture
# define ConfigH sysv4
# endif
# ifdef LinuxArchitecture
# define ConfigH linux
# endif
# ifdef AlphaArchitecture
# ifndef LinuxArchitecture
# define ConfigH decosf1
# endif
# if !HasGcc
# define MyCflags -std1 -Olimit 2000
# else
# define NoCombineRegs
# endif
# endif
# if defined(VaxArchitecture) && !defined(UltrixArchitecture)
# define ConfigH bsd
# endif
# ifdef NeXTArchitecture
# define ConfigH mach
# endif
# if defined(SunArchitecture)
# if (OSMajorVersion == 3)
# define ConfigH sunos35
# else
# if (OSMajorVersion == 4)
# if (OSMinorVersion == 0)
# define ConfigH sunos40
# else /* OSMinorVersion == 1 */
# if (OSTeenyVersion == 3)
# define ConfigH sunos413
# else /* OsTeenyVersion in [0,1,2] */
# define ConfigH sunos41
# endif
# endif
# define NoCombineRegs
# else /* OSMajorVersion == 5 */
# if (OSMinorVersion < 3)
# if (OSMinorVersion < 2)
# define ConfigH sol2
# else
# define ConfigH sol22
# endif
# else
# if (OSMinorVersion < 4)
# define ConfigH sol23
# else
# if (OSMinorVersion < 6)
# define ConfigH sol24
# else
# define ConfigH sol26
# endif
# endif
# endif
# define NoCombineRegs
# endif
# endif
# endif
# ifdef HPArchitecture
/* For some stupid reason makedepend on HP requires this */
DEPENDFLAGS = -o.o
# if (OSMajorVersion >= 8)
# define ConfigH hpux8
# else
# define ConfigH hpux7
# endif
# endif
# ifdef CrayArchitecture
# define ConfigH cray
# endif
# ifdef SGIArchitecture
# define ConfigH irix
# define UseLibBSD
# if (OSMajorVersion < 5)
# ifdef you_are_using_yp
# define UseSunLib
# endif
# if !HasGCC
# define MyStdc -D__STDC__
# if SGICompilerMajorVersion < 4
CCOPTIONS=-float # We don't want -cckr and -prototypes
# endif
# endif
# endif
# if (OSMajorVersion == 6)
# if (OSMinorVersion >= 2)
# undef UseLibBSD
# define ConfigH irix62
# endif
# endif
# endif
# ifdef IBMArchitecture
# undef UseLibBSD
# if (SystemV == YES)
# define ConfigH aix
# if OSMajorVersion < 3
# if OSMinorVersion < 2
# define UseLibBSD
# endif
# endif
# else
# define ConfigH bsd
# define AOSArchitecture
# endif
# endif
#ifdef AOSArchitecture
#define MyStdc -U__STDC__
#endif
# if defined(MipsBsdArchitecture) || defined(MipsSysvArchitecture)
# define ConfigH mips
# endif
# ifdef DguxArchitecture
# define ConfigH dgux
# endif
# ifdef ConvexArchitecture
# define ConfigH convex
# endif
# if defined(SQNTArchitecture) || defined(SequentArchitecture)
# define ConfigH sequent
# endif
# ifdef MacIIArchitecture
# define ConfigH mac2
# endif
# ifdef MinixArchitecture
/* Maybe conditional on MACH? */
SYSSRCS=mi.termios.c mi.wait.h mi.varargs.h
SYSOBJS=mi.termios.${SUF}
EXTF=ma.setp.c vms.termcap.c
# else
/* Maybe conditional on MACH? */
SYSSRCS=ma.setp.c
SYSOBJS=ma.setp.${SUF}
EXTF=mi.termios.c mi.wait.h mi.varargs.h vms.termcap.c
# endif
# ifdef i386Isc
# if IscVersion != 202
# define ConfigH isc
# define UseLibCposix
# else
# define ConfigH isc202
# endif
# endif /* i386Isc */
# ifdef OpenBSDArchitecture
# define ConfigH bsd4.4
# endif /* OpenBsdArchitecture */
# ifdef NetBSDArchitecture
# define ConfigH bsd4.4
# endif /* NetBsdArchitecture */
# ifdef FreeBSDArchitecture
# define ConfigH bsd4.4
# endif /* FreeBsdArchitecture */
# ifdef i386SVR4Architecture
# define ConfigH sysv4
# ifdef DELL
# define NoCombineRegs
# endif
# endif
#endif /* !ConfigH */
/* generic os's */
#ifndef ConfigH
#if (SystemV == YES)
#define ConfigH sysv3
#else
/* why this as a default? Why not? */
#define ConfigH bsd
#endif
#endif /* !ConfigH */
/**** libraries ****/
#if (SystemV == NO) || defined(HPArchitecture) || \
defined(SQNTArchitecture) || defined(SequentArchitecture) || \
defined(MacIIArchitecture) || defined(UseLibTermcap)
LIBTERMCAP = -ltermcap
#else
LIBTERMCAP =
#endif
#if defined(SQNTArchitecture) || defined(SequentArchitecture)
LIBSQNT=-lsocket -linet -lnsl -lseq
#endif
/* This may not be good enough - I don't have access to enough systems
to really test it. */
#if (SystemV == YES) || defined(UseLibCurses) && !defined(HPArchitecture)
LIBCURSES = -lcurses
#else
LIBCURSES =
#endif
#if defined(UseLibNet)
LIBNET = -lnet
#else
LIBNET =
#endif
#if defined(UseLibSocket)
LIBSOCKET = -lsocket
#else
LIBSOCKET =
#endif
#if defined(UseLibBSD)
LIBBSD = -lbsd
#else
LIBBSD =
#endif
#if (defined(SGIArchitecture) && \
(OSMajorVersion == 3) && (OSMinorVersion == 3)) || \
defined(UseLibC_S)
LIBC_S = -lc_s
#else
LIBC_S =
#endif
#if defined(UseLibSun)
LIBSUN = -lsun
#else
LIBSUN =
#endif
#if defined(UseLibCposix)
LIBCPOSIX = -lcposix
#else
LIBCPOSIX =
#endif
#if defined(UseLibInet)
LIBINET = -linet
#else
LIBINET =
#endif
#if defined(UseLibDir)
LIBDIRECT = -ldir
#else
LIBDIRECT =
#endif
#if defined(UseLibX)
LIBX = -lx
#else
LIBX =
#endif
#if defined(UseLibIntl)
LIBINTL = -lintl
#else
LIBINTL =
#endif
#if (HasLibCrypt == YES)
LIBCRYPT = -lcrypt
#else
LIBCRYPT =
#endif
#if defined(MacIIArchitecture) || defined(UseLibPosix)
LIBPOSIX = -lposix
#else
LIBPOSIX =
#endif
#if defined(ATTArchitecture) || defined(UseLibDirent)
LIBDIRECTENT = -ldirent
#else
LIBDIRECTENT =
#endif
/* The order here is significant. Although nothing uses all of these,
some platforms which use more than one do care about the order. */
SYSLIBS = $(LIBPOSIX) $(LIBDIRECTENT) $(LIBTERMCAP) $(LIBCURSES) \
$(LIBNET) $(LIBINTL) $(LIBSOCKET) $(LIBSUN) $(LIBBSD) $(LIBCPOSIX) \
$(LIBINET) $(LIBDIRECT) $(LIBX) $(LIBC_S) $(LIBSQNT) $(LIBCRYPT)
/* Past here, nothing should need to be changed to compile on a different
platform, unless you have a really weird architecture. */
#ifdef MyCC
CC = MyCC
#else
# if HasGcc
# if HasGcc2
CC = gcc
# else
# ifdef NoCombineRegs
CC = gcc -finline-functions -fstrength-reduce
# else
CC = gcc -fcombine-regs -finline-functions -fstrength-reduce
# endif
# endif
# else
CC = cc
# endif
#endif
#ifdef HESIOD
HESLIB = -L/usr/athena/lib -lhesiod
/* it seems to me that the -I shouldn't be necessary, but there seems
to be a bug in the Imake stuff, so here it is. */
HESDEF = -DHESIOD -I/usr/athena/include
#else
HESLIB =
HESDEF =
#endif
#ifdef AFS
#ifndef AFSDIR
AFSDIR = /usr/afsws
#endif
#ifdef AFS33
#define AFS33LIB -laudit
#else
#define AFS33LIB
#endif
/* Auxilliary libs needed for AFS */
/* Both HPUX and Solaris need the BSD libraries. We need -lc before
* the bsd library to avoid using any more of it than is necessary.
*/
#if defined(HPArchitecture)
#define AFSAUXLIB -lc -lBSD
/* This is probably a kludge, but so is imake. */
#else
#if defined(SunArchitecture) && (OSMajorVersion == 5)
#define AFSAUXLIB -lsocket -lnsl -lc -lucb
#else
#define AFSAUXLIB
#endif
#endif /* AFSAUXLIB */
AFSLIB = -L$(AFSDIR)/lib -L$(AFSDIR)/lib/afs -lkauth -lprot -lubik\
-lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err\
$(AFSDIR)/lib/afs/util.a AFS33LIB AFSAUXLIB
AFSDEF = -DAFS -I$(AFSDIR)/include
#else
AFSLIB =
AFSDEF =
#endif
/* This is encore specific, but I don't know what encore's #define is,
and it shouldn't hurt to have it here, so here it is */
PARALLEL=12 # Make the multi-max run fast.
#ifndef TcshTop
#define TcshTop /usr/local
#endif
TCSHTOP = TcshTop
#ifndef ManSuffix
#define ManSuffix 1
#endif
MANSUFFIX = ManSuffix
#ifdef TcshPath
PATH_TCSHELL = TcshPath
TCSHPATH = -D_PATH_TCSHELL='"$(PATH_TCSHELL)"'
#else
TCSHPATH =
#endif
#ifdef DestBin
TCSH_BINDIR = DestBin
#else
TCSH_BINDIR = $(TCSHTOP)/bin
#endif
#ifdef DestMan
TCSH_MANDIR = DestMan
#else
TCSH_MANDIR = $(TCSHTOP)/man/man$(MANSUFFIX)
#endif
LOCALLIBS =
#ifndef MyCflags
#define MyCflags
#endif
#ifndef MyDefines
#define MyDefines
#endif
#ifndef MyIncludes
#define MyIncludes
#endif
#ifndef MyStdc
#define MyStdc
#endif
#ifdef CDebugFlags
CDEBUGFLAGS = CDebugFlags
#else
# if HasGcc2
CDEBUGFLAGS = -O2
# else
CDEBUGFLAGS = -O
# endif
#endif
#ifdef HostType
HOSTTYPE=HostType
HTDEF = -DHOSTTYPE='"$(HOSTTYPE)"'
#else
HTDEF =
#endif
DEFINES = $(TCSHPATH) $(HESDEF) $(AFSDEF) $(HTDEF) MyDefines MyCflags MyStdc
INCLUDES = -I. MyIncludes
#ifdef MyLibs
LDLIBS = MyLibs
#endif
SUF = o
VERSION = 6.08
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 sh.char.h sh.dir.h sh.proc.h sh.h \
sh.decls.h glob.c 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.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}
TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
tw.comp.c tw.color.c
TWOBJS= tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \
tw.comp.${SUF} tw.color.${SUF}
EDSRCS= ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \
ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h
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
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} \
tc.vers.${SUF} tc.who.${SUF}
MISCF = Makefile.std Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
README.imake complete.tcsh vmsreadme.txt Makefile.vms termcap.vms \
snames.h host.defs gethost.c tcsh.man2html Makefile.in configure.in \
Makefile.win32
CONFSRCS=config/[a-z]*
SRCS = $(SHSRCS) $(TWSRCS) $(EDSRCS) $(TCSRCS)
OBJS = $(SHOBJS) $(TWOBJS) $(EDOBJS) $(TCOBJS)
ALLSRCS= $(MISCF) $(SRCS) $(EXTF)
AllTarget(tcsh)
ed.defns.h: config.h ed.defns.c
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '#ifndef _h_ed_defns' >> $@
@echo '#define _h_ed_defns' >> $@
egrep '[FV]_' ed.defns.c | egrep '^#define' >> $@
@echo '#endif /* _h_ed_defns */' >> $@
sh.err.h: config.h sh.err.c
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '#ifndef _h_sh_err' >> $@
@echo '#define _h_sh_err' >> $@
egrep 'ERR_' sh.err.c | egrep '^#define' >> $@
@echo '#endif /* _h_sh_err */' >> $@
tc.const.h: config.h tc.const.c
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '#ifndef _h_tc_const' >> $@
@echo '#define _h_tc_const' >> $@
${CC} -E $(INCLUDES) ${DEFINES} -D_h_tc_const tc.const.c | \
grep 'Char STR' | \
sed -e 's/Char \([a-zA-Z0-9_]*\)\[\].*/extern Char \1[];/' | \
sort >> $@
@echo '#endif /* _h_tc_const */' >> $@
config.h: config_f.h
cp config/ConfigH config.h
$(OBJS): sh.err.h tc.const.h ed.defns.h
tar.Z:
rm -f tcsh-${VERSION}.tar.Z
rm -rf tcsh-${VERSION}
mkdir tcsh-${VERSION} tcsh-${VERSION}/config
cp ${ALLSRCS} tcsh-${VERSION}
cp ${CONFSRCS} tcsh-${VERSION}/config
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z
rm -rf tcsh-${VERSION}
tar.gz:
rm -f tcsh-${VERSION}.tar.gz
rm -rf tcsh-${VERSION}
mkdir tcsh-${VERSION} tcsh-${VERSION}/config
cp ${ALLSRCS} tcsh-${VERSION}
cp ${CONFSRCS} tcsh-${VERSION}/config
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh-${VERSION} | gzip > tcsh-${VERSION}.tar.gz
rm -rf tcsh-${VERSION}
shar:
rm -f tcsh-*.shar
rm -rf tcsh-${VERSION}
mkdir tcsh-${VERSION} tcsh-${VERSION}/config
cp ${ALLSRCS} tcsh-${VERSION}
cp ${CONFSRCS} tcsh-${VERSION}/config
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
MAKESHAR -v -n tcsh-${VERSION} tcsh-${VERSION} \
tcsh-${VERSION}/?* tcsh-${VERSION}/config/?* \
tcsh-${VERSION}/?*/set?*
rm -rf tcsh-${VERSION}
catalogs:
@(cd nls; make catalogs)
world:
$(MAKE) clean ; $(MAKE) depend ; $(MAKE) tcsh ; $(MAKE) install
clean::
rm -f ed.defns.h sh.err.h tc.const.h config.h tc.defs.*
rm -f tcsh.*.m tcsh.*.cat
depend:: config.h ed.defns.h sh.err.h tc.const.h $(SRCS) tc.defs.c
tc.defs.${SUF}: tc.defs.c sh.h
tc.defs.c: gethost host.defs
@rm -f $@
@echo "/* Do not edit this file, make creates it */" > $@
./gethost host.defs >> $@
ALIB=$(HESLIB) $(AFSLIB) $(SYSLIBS)
AINC=ed.defns.h sh.err.h tc.const.h sh.h
NormalProgramTarget(tcsh, $(OBJS), $(AINC), $(LOCALLIBS), $(ALIB))
NormalProgramTarget(gethost, gethost.${SUF}, $(AINC), $(LOCALLIBS), $(ALIB))
InstallProgram(tcsh,$(TCSH_BINDIR))
InstallManPage(tcsh,$(TCSH_MANDIR))
DependTarget()

41
contrib/tcsh/MAKEDIFFS Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
#
# MAKEDIFFS.sh: Make context diffs for the csh sources
#
# $Id: MAKEDIFFS,v 3.0 1991/07/04 21:57:47 christos Exp $
XINUDIR=/usr/share/src/mtXinu/bin/csh
BSDDIR=/usr/share/src/mtXinu/BSD/bin/csh
TAHOEDIR=/usr/share/src/mtXinu/TAHOE/bin/csh
RENODIR=/usr/share/src/mtXinu/RENO/bin/csh
TCSHDIR=`pwd`
case "x$1" in
xxinu)
CSHDIR=$XINUDIR;;
xbsd)
CSHDIR=$BSDDIR;;
xtahoe)
CSHDIR=$TAHOEDIR;;
xreno)
CSHDIR=$RENODIR;;
x*)
echo "Usage: `basename $0` [bsd|tahoe|xinu|reno]";exit 1;;
esac
DIFF1='sh.c sh.char.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.exp.c sh.file.c'
DIFF2='sh.func.c sh.glob.c sh.hist.c sh.init.c sh.lex.c sh.misc.c sh.parse.c sh.print.c'
DIFF3='sh.proc.c sh.sem.c sh.set.c sh.time.c sh.char.h sh.dir.h sh.h sh.local.h sh.proc.h'
for i in $DIFF1
do
diff -c $CSHDIR/$i $TCSHDIR/$i
done > DIFFS.1
for i in $DIFF2
do
diff -c $CSHDIR/$i $TCSHDIR/$i
done > DIFFS.2
for i in $DIFF3
do
diff -c $CSHDIR/$i $TCSHDIR/$i
done > DIFFS.3
exit 0

121
contrib/tcsh/MAKESHAR Executable file
View File

@ -0,0 +1,121 @@
#!/bin/sh
#
# MAKESHAR.sh: Make a shar file for the sources
#
# $Id: MAKESHAR,v 3.1 1992/05/09 04:03:53 christos Exp $
AWK=/usr/bin/nawk # Must be nawk or gawk cause of 2D arrays
WC=/usr/ucb/wc
GREP=/usr/bin/egrep
SORT=/usr/bin/sort
SH=/bin/sh
dirs=
name=kit
files=
verbose=0
size=45000
for i
do
case $i in
-n)
name=;;
-v)
verbose=1;;
-d)
SH=/bin/cat;;
-s)
size=$1;;
*)
if [ -z "$name" ]
then
name=$i
elif [ -d $i ]
then
dirs="$dirs $i"
elif [ -f $i ]
then
files="$files $i"
else
echo "$0: File `$i' not found." 1>&2
exit 1
fi;;
esac
done
if [ \( -z "$files" \) -a \( -z "$dirs" \) ]
then
echo "Usage: $0 [-n name] [-s size] [-vd] <files>." 1>&2
exit 1
fi
$WC $files | $GREP -v total | $SORT +2 | $AWK '
BEGIN {
i = 0;
seq = 1;
size = 0;
name = 1;
used = 2;
verbose='"$verbose"';
tty = "/dev/tty";
maxsize = '"$size"';
dirs = "'"$dirs"'";
};
{
a[i, size] = $3;
a[i, name] = $4;
a[i, used] = 0;
i++;
};
END {
for (maxi = i--; i >= 0; i--) {
idx = 0;
if (a[i, used] == 0) {
if (verbose && a[i, size] > maxsize)
printf("Warning: File %s is %d > %d\n",
a[i, name], a[i, size], maxsize) > tty;
s = a[i, size];
a[i, used] = 1;
kit[seq, idx++] = i;
j = 0;
while (j < maxi) {
# Find the greatest file we can add
j = maxi;
for (k = 0; k < maxi; k++)
if (a[k, used] == 0 && a[k, size] + s < maxsize)
j = k;
if (j < maxi) {
s += a[j, size];
a[j, used] = 1;
kit[seq, idx++] = j;
}
}
sizes[seq] = s;
kit[seq++, idx] = -1;
}
}
for (i = 1; i < seq; i++) {
printf("shar -n%d -e%d %s ", i, seq - 1, dirs);
if (verbose) {
printf("%3d of %3d: ", i, seq - 1) > tty;
len = 12;
}
for (j = 0; kit[i, j] != -1; j++) {
s = a[kit[i, j], name];
if (verbose) {
clen = length(s) + 1;
len += clen;
if (len > 70) {
printf("\n ") > tty;
len = 12 + clen;
}
printf("%s ", s) > tty;
}
printf("%s ", s);
}
printf("> '"$name"'-%d.shar;", i);
if (verbose)
printf("= %5d\n", sizes[i]) > tty;
}
}' | $SH

628
contrib/tcsh/Makefile.in Normal file
View File

@ -0,0 +1,628 @@
# $Id: Makefile.in,v 3.12 1998/11/24 18:17:08 christos Exp $
# Makefile.in 4.3 6/11/83
#
# C Shell with process control; VM/UNIX VAX Makefile
# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
#
# With an input editor, command completion, etc. and ported to all sorts of
# things; Paul Placeway, CIS Dept., Ohio State University
#
SHELL=/bin/sh
VERSION=6.08
BUILD=tcsh
VPATH=@srcdir@
srcdir=@srcdir@
################################################################
## CFLAGS. For various -D things, see config.h
################################################################
#
# These are the default suffixes from .c to .o and -c to get there
# but to use the global optimizer on the mips boxes, see below
#
SUF=o
CF=-c
CPPFLAGS=-I. -I$(srcdir)
LFLAGS=
#LFLAGS= -Zn10000 # hpux lint
CFLAGS = @CFLAGS@ # This is set by autoconf.
#CFLAGS= -g # debug
#CFLAGS= -O # production
#CFLAGS= # Broken optimizers....
#CFLAGS= -g -pg -DPROF
#CFLAGS= -O -pg -DPROF
# gcc 1.00-1.37
#CFLAGS= -O -finline-functions -fstrength-reduce
# gcc 1.37-1.40
#CFLAGS= -O -fcombine-regs -finline-functions -fstrength-reduce
# add -msoft-float for 68881 machines.
# gcc 2.0
# On the sparc, don't use -O2; it breaks setjmp() and vfork()
#CFLAGS= -O
# gcc-2.1+
#CFLAGS= -O2
# lucid c on suns
#CFLAGS= -O5
# gcc 2.1 on linux
#CFLAGS= -O6 -fomit-frame-pointer
# HP/UX 8.0, 9.0
#CFLAGS= +O3 -Aa
# Ultrix 4.2a
#CFLAGS= -O -Olimit 2000
# Intel Paragon OSF/1 with PGI compilers
#CFLAGS= -O -Mnodebug -Mnoperfmon
# DEC Alpha OSF/1
#CFLAGS= -O2 -Olimit 2000 ## Normal Optimization
#CFLAGS= -O3 -Olimit 2000 ## Full Optimization - may not work
#CF=-j
#SUF=u
#.SUFFIXES: .u
# for silicon graphics (and other mips compilers) -- use the
# global optimizer! (-O3).
# On SGI 4.0+ you need to add -D__STDC__ too.
#CFLAGS= -O3
#CFLAGS= -O3 -Olimit 2000 ## Ultrix 4.2a
#CF=-j
#SUF=u
#.SUFFIXES: .u ## Ultrix and gnu-make need that
# mips systems
# CFLAGS= -O -systype bsd43 -Wf,-XNd5000 -Wf,-XNp6000 -Olimit 2000
# for at&t machines
#CFLAGS= -O -Ksd
# Stardent Titan
#CFLAGS = -O -43
# Stardent Stellar or sunos4 /bin/cc or Solaris2.1 /opt/SUNWspro/bin/cc
#CFLAGS = -O4
# Intergraph clipper CLIX 3.1
#CFLAGS= -w -O2
# Dnix 5.3
#CFLAGS = -O -X7
# Pyramid OS/x
#CFLAGS = -OG
# Multiflow (5M binary... if you choose -O5!)
#CFLAGS = -O5 -sb_trace 0
# DDE Supermax Unix SYSV Rel III.
# CFLAGS= -O3
# SINIX RMx00
#CFLAGS= -O # -D_POSIX_SOURCE # -kansi
# Apollo's with cc [apollo builtins don't work with gcc]
# and apollo should not define __STDC__ if it does not have
# the standard header files. RT's (aos4.3) need that too;
# you might want to skip the -O on the rt's... Not very wise.
# AIX/ESA needs -D_IBMESA on command line (this may disappear by GA)
#DFLAGS=-U__STDC__
#DFLAGS=-D_IBMESA
# On aix2.2.1 we need more compiler space.
#DFLAGS=-Nd4000 -Nn3000
# AU/X 2.0 needs a flag for POSIX (read the config file)
#DFLAGS=-Zp
# Tektronix 4300 running UTek 4.0 (BSD 4.2) needs:
#DFLAGS = -DUTek -DBSD
# VMS_POSIX needs:
#DFLAGS=-D_VMS_POSIX
# Multiflow and PCC compilers don't like void typedefs.
# You may also need -U__STDC__ if you use pcc (i.e. ibmrt aos4.3).
#DFLAGS=-DMULTIFLOW
#DFLAGS=-DPCC
# DELL SVR4
#DFLAGS=-DDELL
#DFLAGS=
#DFLAGS=-D_PATH_TCSHELL='"${DESTBIN}/tcsh"'
## The following is set by autoconf.
DFLAGS = -D_PATH_TCSHELL='"${DESTBIN}/tcsh"' @DFLAGS@ @CPPFLAGS@
################################################################
## LDFLAGS. Define something here if you need to
################################################################
LDFLAGS= @LDFLAGS@ ## This is set by autoconf.
#LDFLAGS= ## The simplest, suitable for all.
#LDFLAGS= -s ## Stripped. Takes less space on disk.
#LDFLAGS= -s -n ## Pure executable. Spares paging over
# ## the network for machines with local
# ## swap but external /usr/local/bin .
#LDFLAGS= -s -n -Bstatic ## Without dynamic linking. (SunOS/cc)
#LDFLAGS= -s -n -static ## Without dynamic linking. (SunOS/gcc)
#LDFLAGS= -Wl,-s,-n ## Stripped, shared text (Unicos)
#LDFLAGS= -s -static ## Link statically. (linux)
#LDFLAGS= -s -N ## Impure executable (linux)
################################################################
## LIBES. Pick one, or roll your own.
################################################################
LIBES= @LIBS@ ## This is set by autoconf.
#LIBES= -ltermcap ## BSD style things
#LIBES= -ltermcap ## SunOS, HP-UX, pyramid
#LIBES= -ltermcap ## Linux
#LIBES= -ltermcap -lshadow ## Linux with PW_SHADOW
#LIBES= -ltermcap -lsec ## Tek XD88/10 (UTekV) with PW_SHADOW
#LIBES= -ltermcap -lsec ## Motorola MPC (sysV88) with PW_SHADOW
#LIBES= -ltermcap -lcs ## Mach
#LIBES= -ltermcap -lbsd ## DEC osf1 on the alpha
#LIBES= -ltermcap -lbsd ## Intel paragon
#LIBES= -ltermcap -lbsd ## Clipper intergraph
#LIBES= -ltermcap -lseq ## Sequent's Dynix
#LIBES= -ltermcap -lauth ## Ultrix with Enhanced Security
#LIBES= -ltermcap -ldir -lx ## Xenix 386 style things
#LIBES= -ltermcap -lndir -lsocket -ljobs ## masscomp RTU6.0
#LIBES= -lcurses ## AIX on the rt
#LIBES= -lcurses ## TitanOS on the stellar
#LIBES= -ltermlib -lsocket -lnsl ## SysV4 w/o BSDTIMES or Solaris 2
#LIBES= -lcurses ## SysV3 w/o networking
#LIBES= -lcurses -lnet ## SysV3 with networking
#LIBES= -lcurses -ldir ## SysV2 w/o networking & dirlib
#LIBES= -lcurses -ldir -lnet ## SysV2 with networking & dirlib
#LIBES= -lcurses -lbsd ## AIX on the IBM 370 or rs6000 or ps2
#LIBES= -lcurses -lbsd ## ETA10
#LIBES= -lcurses -lbsd ## Irix3.1 on the SGI-IRIS4D
#LIBES= -lcurses -lbsd -lc_s ## Irix3.3 on the SGI-IRIS4D w/o yp
#LIBES= -lcurses -lsun -lbsd -lc_s ## Irix3.3 on the SGI-IRIS4D with yp
#LIBES= -lcurses -lsocket -lbsd ## Amdahl UTS 2.1
#LIBES= -lcurses -lsocket ## Intel's hypercube.
#LIBES= -lcurses -lsocket ## ns32000 based Opus.
#LIBES= -lcurses -lcposix ## ISC 2.2 without networking
#LIBES= -lcposix -lc_s -lcurses -linet ## ISC 2.2 with networking
#LIBES= -lcurses -lsec -lc_s ## ISC 2.0.2 without networking
#LIBES= -lcurses -linet -lsec -lc_s ## ISC 2.0.2 with networking
#LIBES= -lcurses -lintl -lcrypt ## SCO SysVR3.2v2.0
#LIBES= -lcurses -lintl -lsocket -lcrypt ## SCO+ODT1.1
#LIBES= -lposix -ltermcap ## A/UX 2.0
#LIBES= -lposix -ltermcap -lc_s ## A/UX 3.0
#LIBES= -ldirent -lcurses ## att3b1 cc w/o shared lib & dirlib
#LIBES= -shlib -ldirent -lcurses ## att3b1 gcc with shared lib & dirlib
#LIBES= -ltermlib -lsocket -lnsl -lc /usr/ucblib/libucb.a ## SysV4 with BSDTIMES
#LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a ## Stardent Vistra
#LIBES= -ltermc ## emx under OS/2
#LIBES= ## Minix, VMS_POSIX
#LIBES= -ltermcap -lcrypt ## Multiflow
#LIBES= -ltermcap -lcrypt ## NetBSD
#LIBES= -lcurses ## DDE Supermax
################################################################
## EXTRAFLAGS and EXTRALIBS
################################################################
# Compiling for AFS with kerberos authentication
#AFSLIBDIR = /usr/afsws/lib
#AFSDEF = -DAFS -I/usr/afsws/include
#AFS33LIB = -laudit
#
#Solaris and HPUX require the BSD libraries with AFS.
#We use -lc to use only what we require.
#AFSAUXLIB = -lsocket -lnsl -lc -lucb # Solaris
#AFSAUXLIB = -lc -lBSD # HPUX
#
#AFSLIB = -L$(AFSLIBDIR) -L$(AFSLIBDIR)/afs -lkauth -lprot -lubik\
# -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err\
# $(AFSLIBDIR)/afs/util.a $(AFS33LIB) $(AFSAUXLIB)
#
EXTRAFLAGS = @HESDEF@ $(AFSDEF)
EXTRALIBS = @HESLIB@ $(AFSLIB)
# The difficult choice of a c-compiler...
# First, you should try your own c-compiler.
# Gcc -traditional is also a safe choice.
# If you think that you have good include files try gcc -Wall...
# If you want to take out -traditional, make sure that your sys/ioctl.h
# is fixed correctly, otherwise you'll be stopped for tty input, or you
# will lose the editor and job control.
# This is for setting your C preprocessor value.
CPP = @CPP@ # This is set by autoconf.
# The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which
# on the suns does not know how to make dynamically linked binaries.
CC = @CC@ # This is set by autoconf.
#CC= gcc -Wall -pipe -B/bin/ # -ansi -pedantic
#CC= gcc -m486 -pipe -Wall # Generate code for Intel 486 (linux)
#CC= shlicc # BSDI2.1 w/ shared libraries
#CC= cc
#CC= occ
#CC= acc
#CC= pcc
#CC= hc -w
#CC= c89 # For VMS/POSIX
#CC= /bin/cc # For suns, w/o gcc and SVR4
#CC= /usr/lib/sun.compile/cc # FPS 500 (+FPX) with Sun C compiler
#CC= /opt/SUNWspro/bin/cc # Solaris 2.1
#CC= scc # Alliant fx2800
#CC= cc -h0,ansi,novector,float0 # for NEC SX-4
#CC= lcc -wa
ED= ed
AS= as
RM= rm
CXREF= /usr/ucb/cxref
VGRIND= csh /usr/ucb/vgrind
CTAGS= /usr/ucb/ctags
#XSTR= /usr/ucb/xstr
SCCS= /usr/local/sccs
PARALLEL=12 # Make the multi-max run fast.
#P=& # Use Sequent's parallel make
P=
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
mandir=@mandir@
MANSECT=1
DESTBIN=${DESTDIR}${bindir}
DESTMAN=${DESTDIR}${mandir}/man${MANSECT}
# DESTMAN=${DESTDIR}/catman/man${MANSECT} # A/UX
# DESTMAN=${DESTDIR}/usr/share/man/man${MANSECT} # Stardent Vistra (SysVR4)
# DESTMAN=/usr/catman/1l # Amiga unix (SysVR4)
FTPAREA=/usr/spool/ftp
ASSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \
sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \
sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h \
tw.color.c
PSSRCS= sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
vms.termcap.c
SHSRCS= ${ASSRCS} ${PSSRCS}
SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \
sh.char.${SUF} sh.exp.${SUF} sh.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} mi.termios.${SUF} \
ma.setp.${SUF} vms.termcap.${SUF}
TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
tw.comp.c tw.color.c
TWOBJS= tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \
tw.comp.${SUF} tw.color.${SUF}
EDSRCS= ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \
ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h
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
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} \
tc.vers.${SUF} tc.who.${SUF}
PVSRCS= Makefile.std Makefile.vms Makefile.in Makefile.win32
AVSRCS= Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
host.defs gethost.c tcsh.man2html configure.in configure config.h.in
VHSRCS=${PVSRCS} ${AVSRCS}
CONFSRCS=config/*
ALLSRCS= ${SHSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${VHSRCS}
DISTSRCS= ${PSSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${AVSRCS}
OBJS= ${SHOBJS} ${TWOBJS} ${EDOBJS} ${TCOBJS}
all: ${BUILD}
tcsh:$(P) ${OBJS}
rm -f tcsh core
${CC} -o tcsh ${LDFLAGS} ${CFLAGS} ${CPPFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS}
# Purify
pure:$(P) ${OBJS}
rm -f tcsh core
purify `echo ${CC} | sed -e s,-B/bin/,,` -o tcsh ${LDFLAGS} ${CFLAGS} ${CPPFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS}
# OS/2
tcsh.exe: tcsh
emxbind tcsh
gethost: gethost.c sh.err.h tc.const.h sh.h
rm -f gethost
${CC} -o gethost ${LDFLAGS} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} $(srcdir)/gethost.c ${LIBES} ${EXTRALIBS}
tc.defs.c: gethost host.defs
@rm -f $@
@echo "/* Do not edit this file, make creates it */" > $@
./gethost $(srcdir)/host.defs >> $@
tcsh.ps: tcsh.man
rm -f tcsh.ps
-ptroff -t -man $(srcdir)/tcsh.man > tcsh.ps
.c.${SUF}:
${CC} ${CF} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $<
# _VMS_POSIX #module addition
#.c.${SUF}:
# @(echo '#module '`echo $< | sed -e 's/\./_/g'`; cat $<) > $*..c
# @echo ${CC} ${CF} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*.c
# @${CC} ${CF} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*..c
# @mv $*..o $*.o
# @rm -f $*..c
# Don't do any special massaging of C files for sharing of strings!!
# it causes weird segmentation faults on some systems.
#.c.o:
# ${CPP} ${CFLAGS} ${CPPFLAGS} $*.c | ${XSTR} -c -
# ${CC} ${CF} ${CFLAGS} ${CPPFLAGS} x.c
# mv -f x.o $*.o
# rm -f x.c
#ed.init.o: ed.init.c
# ${CPP} ${CFLAGS} ${CPPFLAGS} $*.c | ${XSTR} -c -
# ${CC} -R ${CF} ${CFLAGS} ${CPPFLAGS} x.c
# mv -f x.o $*.o
# rm -f x.c
#strings.o: strings
# ${XSTR}
# ${CC} -c -R xs.c
# mv -f xs.o strings.o
# rm -f xs.c
##.DEFAULT:
## ${SCCS} get $<
##.DEFAULT:
## co $<
ed.defns.h: ed.defns.c
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '#ifndef _h_ed_defns' >> $@
@echo '#define _h_ed_defns' >> $@
grep '[FV]_' $(srcdir)/ed.defns.c | grep '^#define' >> $@
@echo '#endif /* _h_ed_defns */' >> $@
sh.err.h: sh.err.c
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '#ifndef _h_sh_err' >> $@
@echo '#define _h_sh_err' >> $@
grep 'ERR_' $(srcdir)/sh.err.c | grep '^#define' >> $@
@echo '#endif /* _h_sh_err */' >> $@
tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '#ifndef _h_tc_const' >> $@
@echo '#define _h_tc_const' >> $@
${CPP} $(CPPFLAGS) ${DFLAGS} ${EXTRAFLAGS} -D_h_tc_const\
$(srcdir)/tc.const.c | grep 'Char STR' | \
sed -e 's/Char \([a-zA-Z0-9_]*\)\[\].*/extern Char \1[];/' | \
sort >> $@
@echo '#endif /* _h_tc_const */' >> $@
csh.prof: ${OBJS} sh.prof.${SUF} mcrt0.${SUF}
rm -f csh.prof
ld -X mcrt0.${SUF} ${OBJS} -o csh.prof ${LIBES} -lc
sh.prof.${SUF}:
cp sh.c sh.prof.c
${CC} ${CF} ${CFLAGS} ${CPPFLAGS} -DPROF sh.prof.c
lint: tc.const.h ed.defns.h
lint ${DFLAGS} ${CPPFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES}
alint: tc.const.h ed.defns.h
alint ${DFLAGS} ${CPPFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES}
print:
@pr READ_ME
@pr makefile makefile.*
@(size -l a.out; size *.${SUF}) | pr -h SIZES
@${CXREF} sh*.c | pr -h XREF
@ls -l | pr
@pr sh*.h [a-rt-z]*.h sh*.c alloc.c
vprint:
@pr -l84 READ_ME TODO
@pr -l84 makefile makefile.*
@(size -l a.out; size *.${SUF}) | pr -l84 -h SIZES
@${CXREF} sh*.c | pr -l84 -h XREF
@ls -l | pr -l84
@${CXREF} sh*.c | pr -l84 -h XREF
@pr -l84 sh*.h [a-rt-z]*.h sh*.c alloc.c
vgrind:
@cp /dev/null index
@for i in *.h; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done
@for i in *.c; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done
@vgrind -t -x -h Index index >/crp/bill/csh/index.t
install-strip: install
install: tcsh
mkdir -p ${DESTBIN}
-mv -f ${DESTBIN}/tcsh ${DESTBIN}/tcsh.old
cp tcsh ${DESTBIN}/tcsh
-strip ${DESTBIN}/tcsh
chmod 555 ${DESTBIN}/tcsh
install.man: tcsh.man
mkdir -p ${DESTMAN}
-rm -f ${DESTMAN}/tcsh.${MANSECT}
cp $(srcdir)/tcsh.man ${DESTMAN}/tcsh.${MANSECT}
chmod 444 ${DESTMAN}/tcsh.${MANSECT}
# Amiga Unix
#install.man: tcsh.man
# compress tcsh.man
# cp tcsh.man.Z ${DESTMAN}/tcsh.Z
# chmod 444 ${DESTMAN}/tcsh.Z
# Apple A/UX
#install.man: tcsh.man
# -rm -f ${DESTMAN}/tcsh.${MANSECT}.Z
# nroff -man tcsh.man | compress > ${DESTMAN}/tcsh.${MANSECT}.Z
# chmod 444 ${DESTMAN}/tcsh.${MANSECT}.Z
clean:
${RM} -f a.out strings x.c xs.c tcsh tcsh.a _MAKE_LOG core gethost
${RM} -f *.${SUF} sh.prof.c ed.defns.h tc.const.h sh.err.h tc.defs.c
${RM} -f tcsh.*.m tcsh.*.cat
veryclean: clean
${RM} -f config.h config.status config.cache config.log Makefile tcsh.ps
${RM} -f *~ #*
distclean: veryclean
tags: /tmp
${CTAGS} sh*.c
tar.Z:
rm -f tcsh-${VERSION}.tar.Z
rm -rf tcsh-${VERSION}
mkdir tcsh-${VERSION} tcsh-${VERSION}/config
cp ${ALLSRCS} tcsh-${VERSION}
cp ${CONFSRCS} tcsh-${VERSION}/config
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z
rm -rf tcsh-${VERSION}
tar.gz:
rm -f tcsh-${VERSION}.tar.gz
rm -rf tcsh-${VERSION}
mkdir tcsh-${VERSION} tcsh-${VERSION}/config
cp ${ALLSRCS} tcsh-${VERSION}
cp ${CONFSRCS} tcsh-${VERSION}/config
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh-${VERSION} | gzip > tcsh-${VERSION}.tar.gz
rm -rf tcsh-${VERSION}
shar:
rm -f tcsh-*.shar
rm -rf tcsh-${VERSION}
mkdir tcsh-${VERSION} tcsh-${VERSION}/config
cp ${ALLSRCS} tcsh-${VERSION}
cp ${CONFSRCS} tcsh-${VERSION}/config
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
MAKESHAR -v -n tcsh-${VERSION} tcsh-${VERSION} \
tcsh-${VERSION}/?* tcsh-${VERSION}/config/?* \
tcsh-${VERSION}/?*/set?*
rm -rf tcsh-${VERSION}
catalogs:
@(cd nls; make catalogs)
tcsh-${VERSION}.tar.Z:
rm -rf tcsh-${VERSION}
rm -f tcsh-${VERSION}.tar tcsh-${VERSION}.tar.Z DIFFS.[123]
mkdir tcsh-${VERSION}
./MAKEDIFFS bsd
mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh-${VERSION}
cp ${DISTSRCS} tcsh-${VERSION}
mkdir tcsh-${VERSION}/config
cp ${CONFSRCS} tcsh-${VERSION}/config
cp Makefile tcsh-${VERSION}/Makefile.new
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z
rm -rf tcsh-${VERSION}
tcsh.tahoe-${VERSION}.tar.Z:
rm -rf tcsh.tahoe-${VERSION}
rm -f tcsh.tahoe-${VERSION}.tar tcsh.tahoe-${VERSION}.tar.Z DIFFS.[123]
mkdir tcsh.tahoe-${VERSION}
./MAKEDIFFS tahoe
mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.tahoe-${VERSION}
cp ${DISTSRCS} tcsh.tahoe-${VERSION}
mkdir tcsh.tahoe-${VERSION}/config
cp ${CONFSRCS} tcsh.tahoe-${VERSION}/config
cp Makefile tcsh.tahoe-${VERSION}/Makefile.new
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh.tahoe-${VERSION} | compress > tcsh.tahoe-${VERSION}.tar.Z
rm -rf tcsh.tahoe-${VERSION}
tcsh.reno-${VERSION}.tar.Z:
rm -rf tcsh.reno-${VERSION}
rm -f tcsh.reno-${VERSION}.tar tcsh.reno-${VERSION}.tar.Z DIFFS.[123]
mkdir tcsh.reno-${VERSION}
./MAKEDIFFS reno
mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.reno-${VERSION}
cp ${DISTSRCS} tcsh.reno-${VERSION}
mkdir tcsh.reno-${VERSION}/config
cp ${CONFSRCS} tcsh.reno-${VERSION}/config
cp Makefile tcsh.reno-${VERSION}/Makefile.new
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh.reno-${VERSION} | compress > tcsh.reno-${VERSION}.tar.Z
rm -rf tcsh.reno-${VERSION}
ftp: tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z
cp tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z ${FTPAREA}
cp tcsh.man ${FTPAREA}
autoconfigure: $(srcdir)/configure $(srcdir)/config.h.in
$(srcdir)/configure: $(srcdir)/configure.in
cd $(srcdir) && autoconf
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
$(srcdir)/stamp-h.in: $(srcdir)/configure.in
cd $(srcdir) && autoheader
@echo timestamp > $(srcdir)/stamp-h.in
#
# Dependencies
#
config.h: config_f.h
TCH=tc.h tc.const.h tc.decls.h tc.os.h tc.sig.h
SHH=sh.h sh.types.h sh.char.h sh.err.h sh.dir.h sh.proc.h pathnames.h \
sh.decls.h ${TCH}
TWH=tw.h tw.decls.h
EDH=ed.h ed.decls.h
# EDH
EDINC=sh.${SUF} sh.func.${SUF} sh.lex.${SUF} sh.print.${SUF} sh.proc.${SUF} \
sh.set.${SUF} tc.bind.${SUF} tc.os.${SUF} tc.prompt.${SUF} \
tc.sched.${SUF} tw.parse.${SUF} tw.color.${SUF}
${EDOBJS} ${EDINC} : ${EDH}
# SHH
${OBJS}: config.h ${SHH}
# TWH
TWINC=ed.chared.${SUF} ed.inputl.${SUF} sh.exec.${SUF} sh.func.${SUF} \
sh.set.${SUF} tc.func.${SUF} tw.color.${SUF}
${TWOBJS} ${TWINC}: ${TWH}
# glob.h
glob.${SUF} sh.glob.${SUF}: glob.h
# ed.defns.h
EDDINC=tc.bind.${SUF} tc.func.${SUF} tc.os.${SUF}
${EDOBJS} ${EDDINC}: ed.defns.h
# tc.defs.o
tc.defs.${SUF}: tc.defs.c sh.h

625
contrib/tcsh/Makefile.std Normal file
View File

@ -0,0 +1,625 @@
# $Id: Makefile.std,v 1.88 1998/10/02 10:56:47 christos Exp $
# Makefile.std 4.3 6/11/83
#
# C Shell with process control; VM/UNIX VAX Makefile
# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
#
# With an input editor, command completion, etc. and ported to all sorts of
# things; Paul Placeway, CIS Dept., Ohio State University
#
SHELL=/bin/sh
VERSION=6.08
BUILD=tcsh
srcdir=.
################################################################
## CFLAGS. For various -D things, see config.h
################################################################
#
# These are the default suffixes from .c to .o and -c to get there
# but to use the global optimizer on the mips boxes, see below
#
SUF=o
CF=-c
INCLUDES=-I. -I$(srcdir)
LFLAGS=$(INCLUDES)
#LFLAGS=$(INCLUDES) -Zn10000 # hpux lint
#CFLAGS= $(INCLUDES) -g # debug
#CFLAGS= $(INCLUDES) -O # production
#CFLAGS= $(INCLUDES) # Broken optimizers....
#CFLAGS= -g -pg $(INCLUDES) -DPROF
#CFLAGS= -O -pg $(INCLUDES) -DPROF
# gcc 1.00-1.37
#CFLAGS=-O $(INCLUDES) -finline-functions -fstrength-reduce
# gcc 1.37-1.40
#CFLAGS=-O $(INCLUDES) -fcombine-regs -finline-functions -fstrength-reduce
# add -msoft-float for 68881 machines.
# gcc 2.0
# On the sparc, don't use -O2; it breaks setjmp() and vfork()
#CFLAGS=-O $(INCLUDES)
# gcc-2.1+
CFLAGS=-O2 $(INCLUDES)
# lucid c on suns
#CFLAGS=-O5 $(INCLUDES)
# gcc 2.1 on linux
#CFLAGS=-O6 -fomit-frame-pointer $(INCLUDES)
# HP/UX 8.0, 9.0
#CFLAGS= $(INCLUDES) +O3 -Aa
# Ultrix 4.2a
#CFLAGS= $(INCLUDES) -O -Olimit 2000
# Intel Paragon OSF/1 with PGI compilers
#CFLAGS=-O -Mnodebug -Mnoperfmon $(INCLUDES)
# DEC Alpha OSF/1
#CFLAGS= -O2 $(INCLUDES) -Olimit 2000 ## Normal Optimization
#CFLAGS= -O3 $(INCLUDES) -Olimit 2000 ## Full Optimization - may not work
#CF=-j
#SUF=u
#.SUFFIXES: .u
# for silicon graphics (and other mips compilers) -- use the
# global optimizer! (-O3).
# On SGI 4.0+ you need to add -D__STDC__ too.
#CFLAGS= -O3 $(INCLUDES)
#CFLAGS= -O3 $(INCLUDES) -Olimit 2000 ## Ultrix 4.2a
#CF=-j
#SUF=u
#.SUFFIXES: .u ## Ultrix and gnu-make need that
# mips systems
# CFLAGS= $(INCLUDES) -O -systype bsd43 -Wf,-XNd5000 -Wf,-XNp6000 -Olimit 2000
# for at&t machines
#CFLAGS= -O -Ksd $(INCLUDES)
# Stardent Titan
#CFLAGS = $(INCLUDES) -O -43
# Stardent Stellar or sunos4 /bin/cc or Solaris2.1 /opt/SUNWspro/bin/cc
#CFLAGS = $(INCLUDES) -O4
# Intergraph clipper CLIX 3.1
#CFLAGS= -w -O2 $(INCLUDES)
# Dnix 5.3
#CFLAGS = -O -X7
# Pyramid OS/x
#CFLAGS = -OG
# Multiflow (5M binary... if you choose -O5!)
#CFLAGS = -O5 -sb_trace 0
# DDE Supermax Unix SYSV Rel III.
# CFLAGS= -O3
# SINIX RMx00
#CFLAGS= -O # -D_POSIX_SOURCE # -kansi
# Apollo's with cc [apollo builtins don't work with gcc]
# and apollo should not define __STDC__ if it does not have
# the standard header files. RT's (aos4.3) need that too;
# you might want to skip the -O on the rt's... Not very wise.
# AIX/ESA needs -D_IBMESA on command line (this may disappear by GA)
#DFLAGS=-U__STDC__
#DFLAGS=-D_IBMESA
# On aix2.2.1 we need more compiler space.
#DFLAGS=-Nd4000 -Nn3000
# AU/X 2.0 needs a flag for POSIX (read the config file)
#DFLAGS=-Zp
# Tektronix 4300 running UTek 4.0 (BSD 4.2) needs:
#DFLAGS = -DUTek -DBSD
# VMS_POSIX needs:
#DFLAGS=-D_VMS_POSIX
# Multiflow and PCC compilers don't like void typedefs.
# You may also need -U__STDC__ if you use pcc (i.e. ibmrt aos4.3).
#DFLAGS=-DMULTIFLOW
#DFLAGS=-DPCC
# DELL SVR4
#DFLAGS=-DDELL
# SCO_SV
#DFLAGS=-D_SPEED_T -DSCO
DFLAGS=
#DFLAGS=-D_PATH_TCSHELL='"${DESTBIN}/tcsh"'
################################################################
## LDFLAGS. Define something here if you need to
################################################################
LDFLAGS= ## The simplest, suitable for all.
#LDFLAGS= -s ## Stripped. Takes less space on disk.
#LDFLAGS= -s -n ## Pure executable. Spares paging over
# ## the network for machines with local
# ## swap but external /usr/local/bin .
#LDFLAGS= -s -n -Bstatic ## Without dynamic linking. (SunOS/cc)
#LDFLAGS= -s -n -static ## Without dynamic linking. (SunOS/gcc)
#LDFLAGS= -Wl,-s,-n ## Stripped, shared text (Unicos)
#LDFLAGS= -s -static ## Link statically. (linux)
#LDFLAGS= -s -N ## Impure executable (linux)
#LDFLAGS= -Bdynamic -dy ## SCO_SV
################################################################
## LIBES. Pick one, or roll your own.
################################################################
LIBES= -ltermcap ## BSD style things
#LIBES= -ltermcap ## SunOS, HP-UX, pyramid
#LIBES= -ltermcap ## Linux
#LIBES= -ltermcap -lshadow ## Linux with PW_SHADOW
#LIBES= -ltermcap -lsec ## Tek XD88/10 (UTekV) with PW_SHADOW
#LIBES= -ltermcap -lsec ## Motorola MPC (sysV88) with PW_SHADOW
#LIBES= -ltermcap -lcs ## Mach
#LIBES= -ltermcap -lbsd ## DEC osf1 on the alpha
#LIBES= -ltermcap -lbsd ## Intel paragon
#LIBES= -ltermcap -lbsd ## Clipper intergraph
#LIBES= -ltermcap -lseq ## Sequent's Dynix
#LIBES= -ltermcap -lauth ## Ultrix with Enhanced Security
#LIBES= -ltermcap -ldir -lx ## Xenix 386 style things
#LIBES= -ltermcap -lndir -lsocket -ljobs ## masscomp RTU6.0
#LIBES= -lcurses ## AIX on the rt
#LIBES= -lcurses ## TitanOS on the stellar
#LIBES= -ltermlib -lsocket -lnsl ## SysV4 w/o BSDTIMES or Solaris 2
#LIBES= -lcurses ## SysV3 w/o networking
#LIBES= -lcurses -lnet ## SysV3 with networking
#LIBES= -lcurses -ldir ## SysV2 w/o networking & dirlib
#LIBES= -lcurses -ldir -lnet ## SysV2 with networking & dirlib
#LIBES= -lcurses -lbsd ## AIX on the IBM 370 or rs6000 or ps2
#LIBES= -lcurses -lbsd ## ETA10
#LIBES= -lcurses -lbsd ## Irix3.1 on the SGI-IRIS4D
#LIBES= -lcurses -lbsd -lc_s ## Irix3.3 on the SGI-IRIS4D w/o yp
#LIBES= -lcurses -lsun -lbsd -lc_s ## Irix3.3 on the SGI-IRIS4D with yp
#LIBES= -lcurses -lsocket -lbsd ## Amdahl UTS 2.1
#LIBES= -lcurses -lsocket ## Intel's hypercube.
#LIBES= -lcurses -lsocket ## ns32000 based Opus.
#LIBES= -lcurses -lcposix ## ISC 2.2 without networking
#LIBES= -lcposix -lc_s -lcurses -linet ## ISC 2.2 with networking
#LIBES= -lcurses -lsec -lc_s ## ISC 2.0.2 without networking
#LIBES= -lcurses -linet -lsec -lc_s ## ISC 2.0.2 with networking
#LIBES= -lcurses -lintl -lcrypt ## SCO SysVR3.2v2.0
#LIBES= -lcurses -lintl -lsocket -lcrypt ## SCO+ODT1.1
#LIBES= -lcurses -lsocket -lcrypt ## SCO_SV
#LIBES= -lposix -ltermcap ## A/UX 2.0
#LIBES= -lposix -ltermcap -lc_s ## A/UX 3.0
#LIBES= -ldirent -lcurses ## att3b1 cc w/o shared lib & dirlib
#LIBES= -shlib -ldirent -lcurses ## att3b1 gcc with shared lib & dirlib
#LIBES= -ltermlib -lsocket -lnsl -lc /usr/ucblib/libucb.a ## SysV4 with BSDTIMES
#LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a ## Stardent Vistra
#LIBES= -ltermc ## emx under OS/2
#LIBES= ## Minix, VMS_POSIX
#LIBES= -ltermcap -lcrypt ## Multiflow
#LIBES= -ltermcap -lcrypt ## NetBSD
#LIBES= -lcurses ## DDE Supermax
################################################################
## EXTRAFLAGS and EXTRALIBS
################################################################
# Compiling for HESIOD
#HESDEF = -DHESIOD -I/usr/athena/include
#HESLIB = -L/usr/athena/lib -lhesiod
#
# Compiling for AFS with kerberos authentication
#AFSLIBDIR = /usr/afsws/lib
#AFSDEF = -DAFS -I/usr/afsws/include
#AFS33LIB = -laudit
#
#Solaris and HPUX require the BSD libraries with AFS.
#We use -lc to use only what we require.
#AFSAUXLIB = -lsocket -lnsl -lc -lucb # Solaris
#AFSAUXLIB = -lc -lBSD # HPUX
#
#AFSLIB = -L$(AFSLIBDIR) -L$(AFSLIBDIR)/afs -lkauth -lprot -lubik\
# -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err\
# $(AFSLIBDIR)/afs/util.a $(AFS33LIB) $(AFSAUXLIB)
#
EXTRAFLAGS = $(HESDEF) $(AFSDEF)
EXTRALIBS = $(HESLIB) $(AFSLIB)
# The difficult choice of a c-compiler...
# First, you should try your own c-compiler.
# Gcc -traditional is also a safe choice.
# If you think that you have good include files try gcc -Wall...
# If you want to take out -traditional, make sure that your sys/ioctl.h
# is fixed correctly, otherwise you'll be stopped for tty input, or you
# will lose the editor and job control.
# This is for setting your C preprocessor value.
CPP = ${CC} -E
# The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which
# on the suns does not know how to make dynamically linked binaries.
CC= gcc -Wall -pipe -B/bin/ # -ansi -pedantic
#CC= gcc -m486 -pipe -Wall # Generate code for Intel 486 (linux)
#CC= shlicc # BSDI2.1 w/ shared libraries
#CC= cc
#CC= occ
#CC= acc
#CC= pcc
#CC= hc -w
#CC= c89 # For VMS/POSIX
#CC= /bin/cc # For suns, w/o gcc and SVR4
#CC= /usr/lib/sun.compile/cc # FPS 500 (+FPX) with Sun C compiler
#CC= /opt/SUNWspro/bin/cc # Solaris 2.1
#CC= scc # Alliant fx2800
#CC= lcc -wa
#CC= cc -b elf -Kpic # SCO_SV
ED= ed
AS= as
RM= rm
CXREF= /usr/ucb/cxref
#CXREF= /bin/cxref # SCO_SV
VGRIND= csh /usr/ucb/vgrind
CTAGS= /usr/ucb/ctags
#CTAGS= /usr/bin/ctags # SCO_SV
#XSTR= /usr/ucb/xstr
#XSTR= /usr/bin/xstr # SCO_SV
SCCS= /usr/local/sccs
PARALLEL=12 # Make the multi-max run fast.
#P=& # Use Sequent's parallel make
P=
DESTDIR=/usr/local
#DESTDIR=/usr/contrib
MANSECT=1
DESTBIN=${DESTDIR}/bin
DESTMAN=${DESTDIR}/man/man${MANSECT}
# DESTMAN=${DESTDIR}/catman/man${MANSECT} # A/UX
# DESTMAN=${DESTDIR}/usr/share/man/man${MANSECT} # Stardent Vistra (SysVR4)
# DESTMAN=/usr/catman/1l # Amiga unix (SysVR4)
FTPAREA=/usr/spool/ftp
ASSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \
sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \
sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h
PSSRCS= sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
vms.termcap.c
SHSRCS= ${ASSRCS} ${PSSRCS}
SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \
sh.char.${SUF} sh.exp.${SUF} sh.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} mi.termios.${SUF} \
ma.setp.${SUF} vms.termcap.${SUF}
TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
tw.comp.c tw.color.c
TWOBJS= tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \
tw.comp.${SUF} tw.color.${SUF}
EDSRCS= ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \
ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h
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
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} \
tc.vers.${SUF} tc.who.${SUF}
PVSRCS= Makefile.std Makefile.vms Makefile.in Makefile.win32
AVSRCS= Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
host.defs gethost.c tcsh.man2html configure.in configure config.h.in
VHSRCS=${PVSRCS} ${AVSRCS}
CONFSRCS=config/*
ALLSRCS= ${SHSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${VHSRCS}
DISTSRCS= ${PSSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${AVSRCS}
OBJS= ${SHOBJS} ${TWOBJS} ${EDOBJS} ${TCOBJS}
all: ${BUILD}
tcsh:$(P) ${OBJS}
rm -f tcsh core
${CC} -o tcsh ${LDFLAGS} ${CFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS}
# Purify
pure:$(P) ${OBJS}
rm -f tcsh core
purify `echo ${CC} | sed -e s,-B/bin/,,` -o tcsh ${LDFLAGS} ${CFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS}
# OS/2
tcsh.exe: tcsh
emxbind tcsh
gethost: gethost.c sh.err.h tc.const.h sh.h
rm -f gethost
${CC} -o gethost ${LDFLAGS} ${CFLAGS} ${DFLAGS} $(srcdir)/gethost.c ${LIBES} ${EXTRALIBS}
tc.defs.c: gethost host.defs
@rm -f $@
@echo "/* Do not edit this file, make creates it */" > $@
./gethost $(srcdir)/host.defs >> $@
tcsh.ps: tcsh.man
rm -f tcsh.ps
-ptroff -t -man $(srcdir)/tcsh.man > tcsh.ps
.c.${SUF}:
${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $<
# _VMS_POSIX #module addition
#.c.${SUF}:
# @(echo '#module '`echo $< | sed -e 's/\./_/g'`; cat $<) > $*..c
# @echo ${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*.c
# @${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*..c
# @mv $*..o $*.o
# @rm -f $*..c
# Don't do any special massaging of C files for sharing of strings!!
# it causes weird segmentation faults on some systems.
#.c.o:
# ${CPP} ${CFLAGS} $*.c | ${XSTR} -c -
# ${CC} ${CF} ${CFLAGS} x.c
# mv -f x.o $*.o
# rm -f x.c
#ed.init.o: ed.init.c
# ${CPP} ${CFLAGS} $*.c | ${XSTR} -c -
# ${CC} -R ${CF} ${CF} x.c
# mv -f x.o $*.o
# rm -f x.c
#strings.o: strings
# ${XSTR}
# ${CC} -c -R xs.c
# mv -f xs.o strings.o
# rm -f xs.c
##.DEFAULT:
## ${SCCS} get $<
##.DEFAULT:
## co $<
ed.defns.h: ed.defns.c
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '#ifndef _h_ed_defns' >> $@
@echo '#define _h_ed_defns' >> $@
grep '[FV]_' $(srcdir)/ed.defns.c | grep '^#define' >> $@
@echo '#endif /* _h_ed_defns */' >> $@
sh.err.h: sh.err.c
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '#ifndef _h_sh_err' >> $@
@echo '#define _h_sh_err' >> $@
grep 'ERR_' $(srcdir)/sh.err.c | grep '^#define' >> $@
@echo '#endif /* _h_sh_err */' >> $@
tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '#ifndef _h_tc_const' >> $@
@echo '#define _h_tc_const' >> $@
${CPP} $(INCLUDES) ${DFLAGS} ${EXTRAFLAGS} -D_h_tc_const\
$(srcdir)/tc.const.c | grep 'Char STR' | \
sed -e 's/Char \([a-zA-Z0-9_]*\)\[\].*/extern Char \1[];/' | \
sort >> $@
@echo '#endif /* _h_tc_const */' >> $@
csh.prof: ${OBJS} sh.prof.${SUF} mcrt0.${SUF}
rm -f csh.prof
ld -X mcrt0.${SUF} ${OBJS} -o csh.prof ${LIBES} -lc
sh.prof.${SUF}:
cp sh.c sh.prof.c
${CC} ${CF} ${CFLAGS} -DPROF sh.prof.c
lint: tc.const.h ed.defns.h
lint ${DFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES}
alint: tc.const.h ed.defns.h
alint ${DFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES}
print:
@pr READ_ME
@pr makefile makefile.*
@(size -l a.out; size *.${SUF}) | pr -h SIZES
@${CXREF} sh*.c | pr -h XREF
@ls -l | pr
@pr sh*.h [a-rt-z]*.h sh*.c alloc.c
vprint:
@pr -l84 READ_ME TODO
@pr -l84 makefile makefile.*
@(size -l a.out; size *.${SUF}) | pr -l84 -h SIZES
@${CXREF} sh*.c | pr -l84 -h XREF
@ls -l | pr -l84
@${CXREF} sh*.c | pr -l84 -h XREF
@pr -l84 sh*.h [a-rt-z]*.h sh*.c alloc.c
vgrind:
@cp /dev/null index
@for i in *.h; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done
@for i in *.c; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done
@vgrind -t -x -h Index index >/crp/bill/csh/index.t
install: tcsh
-mv -f ${DESTBIN}/tcsh ${DESTBIN}/tcsh.old
cp tcsh ${DESTBIN}/tcsh
-strip ${DESTBIN}/tcsh
chmod 555 ${DESTBIN}/tcsh
install.man: tcsh.man
-rm -f ${DESTMAN}/tcsh.${MANSECT}
cp $(srcdir)/tcsh.man ${DESTMAN}/tcsh.${MANSECT}
chmod 444 ${DESTMAN}/tcsh.${MANSECT}
# Amiga Unix
#install.man: tcsh.man
# compress tcsh.man
# cp tcsh.man.Z ${DESTMAN}/tcsh.Z
# chmod 444 ${DESTMAN}/tcsh.Z
# Apple A/UX
#install.man: tcsh.man
# -rm -f ${DESTMAN}/tcsh.${MANSECT}.Z
# nroff -man tcsh.man | compress > ${DESTMAN}/tcsh.${MANSECT}.Z
# chmod 444 ${DESTMAN}/tcsh.${MANSECT}.Z
clean:
${RM} -f a.out strings x.c xs.c tcsh tcsh.a _MAKE_LOG core gethost
${RM} -f *.${SUF} sh.prof.c ed.defns.h tc.const.h sh.err.h tc.defs.c
${RM} -f tcsh.*.m tcsh.*.cat
veryclean: clean
${RM} -f config.h config.status config.cache config.log Makefile tcsh.ps
${RM} -f *~ #*
distclean: veryclean
tags: /tmp
${CTAGS} sh*.c
tar.Z:
rm -f tcsh-${VERSION}.tar.Z
rm -rf tcsh-${VERSION}
mkdir tcsh-${VERSION} tcsh-${VERSION}/config
cp ${ALLSRCS} tcsh-${VERSION}
cp ${CONFSRCS} tcsh-${VERSION}/config
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z
rm -rf tcsh-${VERSION}
tar.gz:
rm -f tcsh-${VERSION}.tar.gz
rm -rf tcsh-${VERSION}
mkdir tcsh-${VERSION} tcsh-${VERSION}/config
cp ${ALLSRCS} tcsh-${VERSION}
cp ${CONFSRCS} tcsh-${VERSION}/config
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh-${VERSION} | gzip > tcsh-${VERSION}.tar.gz
rm -rf tcsh-${VERSION}
shar:
rm -f tcsh-*.shar
rm -rf tcsh-${VERSION}
mkdir tcsh-${VERSION} tcsh-${VERSION}/config
cp ${ALLSRCS} tcsh-${VERSION}
cp ${CONFSRCS} tcsh-${VERSION}/config
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
MAKESHAR -v -n tcsh-${VERSION} tcsh-${VERSION} \
tcsh-${VERSION}/?* tcsh-${VERSION}/config/?* \
tcsh-${VERSION}/?*/set?*
rm -rf tcsh-${VERSION}
catalogs:
@(cd nls; make catalogs)
tcsh-${VERSION}.tar.Z:
rm -rf tcsh-${VERSION}
rm -f tcsh-${VERSION}.tar tcsh-${VERSION}.tar.Z DIFFS.[123]
mkdir tcsh-${VERSION}
./MAKEDIFFS bsd
mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh-${VERSION}
cp ${DISTSRCS} tcsh-${VERSION}
mkdir tcsh-${VERSION}/config
cp ${CONFSRCS} tcsh-${VERSION}/config
cp Makefile tcsh-${VERSION}/Makefile.new
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z
rm -rf tcsh-${VERSION}
tcsh.tahoe-${VERSION}.tar.Z:
rm -rf tcsh.tahoe-${VERSION}
rm -f tcsh.tahoe-${VERSION}.tar tcsh.tahoe-${VERSION}.tar.Z DIFFS.[123]
mkdir tcsh.tahoe-${VERSION}
./MAKEDIFFS tahoe
mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.tahoe-${VERSION}
cp ${DISTSRCS} tcsh.tahoe-${VERSION}
mkdir tcsh.tahoe-${VERSION}/config
cp ${CONFSRCS} tcsh.tahoe-${VERSION}/config
cp Makefile tcsh.tahoe-${VERSION}/Makefile.new
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh.tahoe-${VERSION} | compress > tcsh.tahoe-${VERSION}.tar.Z
rm -rf tcsh.tahoe-${VERSION}
tcsh.reno-${VERSION}.tar.Z:
rm -rf tcsh.reno-${VERSION}
rm -f tcsh.reno-${VERSION}.tar tcsh.reno-${VERSION}.tar.Z DIFFS.[123]
mkdir tcsh.reno-${VERSION}
./MAKEDIFFS reno
mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.reno-${VERSION}
cp ${DISTSRCS} tcsh.reno-${VERSION}
mkdir tcsh.reno-${VERSION}/config
cp ${CONFSRCS} tcsh.reno-${VERSION}/config
cp Makefile tcsh.reno-${VERSION}/Makefile.new
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh.reno-${VERSION} | compress > tcsh.reno-${VERSION}.tar.Z
rm -rf tcsh.reno-${VERSION}
ftp: tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z
cp tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z ${FTPAREA}
cp tcsh.man ${FTPAREA}
autoconfigure: $(srcdir)/configure $(srcdir)/config.h.in
$(srcdir)/configure: $(srcdir)/configure.in
cd $(srcdir) && autoconf
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
$(srcdir)/stamp-h.in: $(srcdir)/configure.in
cd $(srcdir) && autoheader
@echo timestamp > $(srcdir)/stamp-h.in
#
# Dependencies
#
config.h: config_f.h
TCH=tc.h tc.const.h tc.decls.h tc.os.h tc.sig.h
SHH=sh.h sh.types.h sh.char.h sh.err.h sh.dir.h sh.proc.h pathnames.h \
sh.decls.h ${TCH}
TWH=tw.h tw.decls.h
EDH=ed.h ed.decls.h
# EDH
EDINC=sh.${SUF} sh.func.${SUF} sh.lex.${SUF} sh.print.${SUF} sh.proc.${SUF} \
sh.set.${SUF} tc.bind.${SUF} tc.os.${SUF} tc.prompt.${SUF} \
tc.sched.${SUF} tw.parse.${SUF} tw.color.${SUF}
${EDOBJS} ${EDINC} : ${EDH}
# SHH
${OBJS}: config.h ${SHH}
# TWH
TWINC=ed.chared.${SUF} ed.inputl.${SUF} sh.exec.${SUF} sh.func.${SUF} \
sh.set.${SUF} tc.func.${SUF} tw.color.${SUF}
${TWOBJS} ${TWINC}: ${TWH}
# glob.h
glob.${SUF} sh.glob.${SUF}: glob.h
# ed.defns.h
EDDINC=tc.bind.${SUF} tc.func.${SUF} tc.os.${SUF}
${EDOBJS} ${EDDINC}: ed.defns.h
# tc.defs.o
tc.defs.${SUF}: tc.defs.c sh.h

594
contrib/tcsh/Makefile.vms Normal file
View File

@ -0,0 +1,594 @@
# $Id: Makefile.vms,v 1.32 1998/10/02 10:56:49 christos Exp $
# Makefile.vms 4.3 6/11/83
#
# C Shell with process control; VM/UNIX VAX Makefile
# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria
#
# With an input editor, command completion, etc. and ported to all sorts of
# things; Paul Placeway, CIS Dept., Ohio State University
#
SHELL=/bin/sh
VERSION=6.08
BUILD=tcsh
################################################################
## CFLAGS. For various -D things, see config.h
################################################################
#
# These are the default suffixes from .c to .o and -c to get there
# but to use the global optimizer on the mips boxes, see below
#
SUF=o
CF=-c
INCLUDES=-I. -I..
LFLAGS=$(INCLUDES)
#LFLAGS=$(INCLUDES) -Zn10000 # hpux lint
#CFLAGS= $(INCLUDES) -g # debug
#CFLAGS= $(INCLUDES) -O # production
#CFLAGS= $(INCLUDES) # Broken optimizers....
#CFLAGS= -g -pg $(INCLUDES) -DPROF
#CFLAGS= -O -pg $(INCLUDES) -DPROF
# gcc 1.00-1.37
#CFLAGS=-O $(INCLUDES) -finline-functions -fstrength-reduce
# gcc 1.37-1.40
#CFLAGS=-O $(INCLUDES) -fcombine-regs -finline-functions -fstrength-reduce
# add -msoft-float for 68881 machines.
# gcc 2.0
# On the sparc, don't use -O2; it breaks setjmp() and vfork()
#CFLAGS=-O $(INCLUDES)
# gcc-2.1+
#CFLAGS=-O2 $(INCLUDES)
# lucid c on suns
#CFLAGS=-O5 $(INCLUDES)
# gcc 2.1 on linux
#CFLAGS=-O6 -fomit-frame-pointer $(INCLUDES)
# HP/UX 8.0, 9.0
#CFLAGS= $(INCLUDES) +O3 -Aa
# Ultrix 4.2a
#CFLAGS= $(INCLUDES) -O -Olimit 2000
# Intel Paragon OSF/1 with PGI compilers
#CFLAGS=-O -Mnodebug -Mnoperfmon $(INCLUDES)
# DEC Alpha OSF/1
#CFLAGS= -O2 $(INCLUDES) -Olimit 2000 ## Normal Optimization
#CFLAGS= -O3 $(INCLUDES) -Olimit 2000 ## Full Optimization - may not work
#CF=-j
#SUF=u
#.SUFFIXES: .u
# for silicon graphics (and other mips compilers) -- use the
# global optimizer! (-O3).
# On SGI 4.0+ you need to add -D__STDC__ too.
#CFLAGS= -O3 $(INCLUDES)
#CFLAGS= -O3 $(INCLUDES) -Olimit 2000 ## Ultrix 4.2a
#CF=-j
#SUF=u
#.SUFFIXES: .u ## Ultrix and gnu-make need that
# mips systems
# CFLAGS= $(INCLUDES) -O -systype bsd43 -Wf,-XNd5000 -Wf,-XNp6000 -Olimit 2000
# for at&t machines
#CFLAGS= -O -Ksd $(INCLUDES)
# Stardent Titan
#CFLAGS = $(INCLUDES) -O -43
# Stardent Stellar or sunos4 /bin/cc or Solaris2.1 /opt/SUNWspro/bin/cc
#CFLAGS = $(INCLUDES) -O4
# Intergraph clipper CLIX 3.1
#CFLAGS= -w -O2 $(INCLUDES)
# Dnix 5.3
#CFLAGS = -O -X7
# Pyramid OS/x
#CFLAGS = -OG
# Multiflow (5M binary... if you choose -O5!)
#CFLAGS = -O5 -sb_trace 0
# DDE Supermax Unix SYSV Rel III.
# CFLAGS= -O3
# Apollo's with cc [apollo builtins don't work with gcc]
# and apollo should not define __STDC__ if it does not have
# the standard header files. RT's (aos4.3) need that too;
# you might want to skip the -O on the rt's... Not very wise.
# AIX/ESA needs -D_IBMESA on command line (this may disappear by GA)
#DFLAGS=-U__STDC__
#DFLAGS=-D_IBMESA
# On aix2.2.1 we need more compiler space.
#DFLAGS=-Nd4000 -Nn3000
# AU/X 2.0 needs a flag for POSIX (read the config file)
#DFLAGS=-Zp
# Tektronix 4300 running UTek 4.0 (BSD 4.2) needs:
#DFLAGS = -DUTek -DBSD
# VMS_POSIX needs:
#DFLAGS=-D_VMS_POSIX
# Multiflow
#DFLAGS=-DMULTIFLOW
# DELL SVR4
#DFLAGS=-DDELL
DFLAGS=
#DFLAGS=-D_PATH_TCSHELL='"${DESTBIN}/tcsh"'
################################################################
## LDFLAGS. Define something here if you need to
################################################################
LDFLAGS= ## The simplest, suitable for all.
#LDFLAGS= -s ## Stripped. Takes less space on disk.
#LDFLAGS= -s -n ## Pure executable. Spares paging over
# ## the network for machines with local
# ## swap but external /usr/local/bin .
#LDFLAGS= -s -n -Bstatic ## Without dynamic links. (SunOS)
#LDFLAGS= -Wl,-s,-n ## Stripped, shared text (Unicos)
#LDFLAGS= -s -static ## Link statically. (linux)
#LDFLAGS= -s -N ## Impure executable (linux)
################################################################
## LIBES. Pick one, or roll your own.
################################################################
#LIBES= -ltermcap ## BSD style things
#LIBES= -ltermcap ## SunOS, HP-UX, pyramid
#LIBES= -ltermcap ## Linux
#LIBES= -ltermcap -lshadow ## Linux with PW_SHADOW
#LIBES= -ltermcap -lsec ## Tek XD88/10 (UTekV) with PW_SHADOW
#LIBES= -ltermcap -lsec ## Motorola MPC (sysV88) with PW_SHADOW
#LIBES= -ltermcap -lcs ## Mach
#LIBES= -ltermcap -lbsd ## DEC osf1 on the alpha
#LIBES= -ltermcap -lbsd ## Intel paragon
#LIBES= -ltermcap -lbsd ## Clipper intergraph
#LIBES= -ltermcap -lseq ## Sequent's Dynix
#LIBES= -ltermcap -lauth ## Ultrix with Enhanced Security
#LIBES= -ltermcap -ldir -lx ## Xenix 386 style things
#LIBES= -ltermcap -lndir -lsocket -ljobs ## masscomp RTU6.0
#LIBES= -lcurses ## AIX on the rt
#LIBES= -lcurses ## TitanOS on the stellar
#LIBES= -ltermlib -lsocket -lnsl ## SysV4 w/o BSDTIMES or Solaris 2
#LIBES= -lcurses ## SysV3 w/o networking
#LIBES= -lcurses -lnet ## SysV3 with networking
#LIBES= -lcurses -ldir ## SysV2 w/o networking & dirlib
#LIBES= -lcurses -ldir -lnet ## SysV2 with networking & dirlib
#LIBES= -lcurses -lbsd ## AIX on the IBM 370 or rs6000 or ps2
#LIBES= -lcurses -lbsd ## ETA10
#LIBES= -lcurses -lbsd ## Irix3.1 on the SGI-IRIS4D
#LIBES= -lcurses -lbsd -lc_s ## Irix3.3 on the SGI-IRIS4D w/o yp
#LIBES= -lcurses -lsun -lbsd -lc_s ## Irix3.3 on the SGI-IRIS4D with yp
#LIBES= -lcurses -lsocket -lbsd ## Amdahl UTS 2.1
#LIBES= -lcurses -lsocket ## Intel's hypercube.
#LIBES= -lcurses -lsocket ## ns32000 based Opus.
#LIBES= -lcurses -lcposix ## ISC 2.2 without networking
#LIBES= -lcposix -lc_s -lcurses -linet ## ISC 2.2 with networking
#LIBES= -lcurses -lsec -lc_s ## ISC 2.0.2 without networking
#LIBES= -lcurses -linet -lsec -lc_s ## ISC 2.0.2 with networking
#LIBES= -lcurses -lintl -lcrypt ## SCO SysVR3.2v2.0
#LIBES= -lcurses -lintl -lsocket -lcrypt ## SCO+ODT1.1
#LIBES= -lposix -ltermcap ## A/UX 2.0
#LIBES= -lposix -ltermcap -lc_s ## A/UX 3.0
#LIBES= -ldirent -lcurses ## att3b1 cc w/o shared lib & dirlib
#LIBES= -shlib -ldirent -lcurses ## att3b1 gcc with shared lib & dirlib
#LIBES= -ltermlib -lsocket -lnsl -lc /usr/ucblib/libucb.a ## SysV4 with BSDTIMES
#LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a ## Stardent Vistra
#LIBES= -ltermc ## emx under OS/2
LIBES= ## Minix, VMS_POSIX
#LIBES= -ltermcap -lcrypt ## Multiflow
#LIBES= -ltermcap -lcrypt ## NetBSD
#LIBES= -lcurses ## DDE Supermax
################################################################
## EXTRAFLAGS and EXTRALIBS
################################################################
# Compiling for HESIOD
#HESDEF = -DHESIOD -I/usr/athena/include
#HESLIB = -L/usr/athena/lib -lhesiod
#
# Compiling for AFS with kerberos authentication
#AFSLIBDIR = /usr/afsws/lib
#AFSDEF = -DAFS -I/usr/afsws/include
#AFS33LIB = -laudit
#
#Solaris and HPUX require the BSD libraries with AFS.
#We use -lc to use only what we require.
#AFSAUXLIB = -lsocket -lnsl -lc -lucb # Solaris
#AFSAUXLIB = -lc -lBSD # HPUX
#
#AFSLIB = -L$(AFSLIBDIR) -L$(AFSLIBDIR)/afs -lkauth -lprot -lubik\
# -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err\
# $(AFSLIBDIR)/afs/util.a $(AFS33LIB) $(AFSAUXLIB)
#
EXTRAFLAGS = $(HESDEF) $(AFSDEF)
EXTRALIBS = $(HESLIB) $(AFSLIB)
# The difficult choice of a c-compiler...
# First, you should try your own c-compiler.
# Gcc -traditional is also a safe choice.
# If you think that you have good include files try gcc -Wall...
# If you want to take out -traditional, make sure that your sys/ioctl.h
# is fixed correctly, otherwise you'll be stopped for tty input, or you
# will lose the editor and job control.
# The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which
# on the suns does not know how to make dynamically linked binaries.
#CC= gcc -Wall -pipe -B/bin/ # -ansi -pedantic
#CC= gcc -m486 -pipe -Wall # Generate code for Intel 486 (linux)
#CC= cc
#CC= occ
#CC= acc
#CC= pcc
#CC= hc -w
CC= c89 # For VMS/POSIX
#CC= /bin/cc # For suns, w/o gcc and SVR4
#CC= /usr/lib/sun.compile/cc # FPS 500 (+FPX) with Sun C compiler
#CC= /opt/SUNWspro/bin/cc # Solaris 2.1
#CC= scc # Alliant fx2800
#CC= lcc -wa
ED= ed
AS= as
RM= rm
CXREF= /usr/ucb/cxref
VGRIND= csh /usr/ucb/vgrind
CTAGS= /usr/ucb/ctags
#XSTR= /usr/ucb/xstr
SCCS= /usr/local/sccs
PARALLEL=12 # Make the multi-max run fast.
#P=& # Use Sequent's parallel make
P=
DESTDIR=/usr/local
MANSECT=1
DESTBIN=${DESTDIR}/bin
DESTMAN=${DESTDIR}/man/man${MANSECT}
# DESTMAN=${DESTDIR}/catman/man${MANSECT} # A/UX
# DESTMAN=${DESTDIR}/usr/share/man/man${MANSECT} # Stardent Vistra (SysVR4)
# DESTMAN=/usr/catman/1l # Amiga unix (SysVR4)
FTPAREA=/usr/spool/ftp
ASSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \
sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \
sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h
PSSRCS= sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
vms.termcap.c
SHSRCS= ${ASSRCS} ${PSSRCS}
SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \
sh.char.${SUF} sh.exp.${SUF} sh.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} mi.termios.${SUF} \
ma.setp.${SUF} vms.termcap.${SUF}
TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
tw.comp.c tw.color.c
TWOBJS= tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \
tw.comp.${SUF} tw.color.${SUF}
EDSRCS= ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \
ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h
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
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} \
tc.vers.${SUF} tc.who.${SUF}
PVSRCS= Makefile.std Makefile.vms Makefile.in Makefile.win32
AVSRCS= Fixes MAKEDIFFS MAKESHAR NewThings README FAQ \
WishList config_f.h eight-bit.me glob.3 patchlevel.h \
pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
host.defs gethost.c tcsh.man2html configure.in
VHSRCS=${PVSRCS} ${AVSRCS}
CONFSRCS=config/*
ALLSRCS= ${SHSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${VHSRCS}
DISTSRCS= ${PSSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${AVSRCS}
OBJS= ${SHOBJS} ${TWOBJS} ${EDOBJS} ${TCOBJS}
all: ${BUILD}
tcsh:$(P) ${OBJS}
rm -f tcsh core
${CC} -o tcsh ${LDFLAGS} ${CFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS}
# Purify
pure:$(P) ${OBJS}
rm -f tcsh core
purify `echo ${CC} | sed -e s,-B/bin/,,` -o tcsh ${LDFLAGS} ${CFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS}
# OS/2
tcsh.exe: tcsh
emxbind tcsh
gethost: gethost.c sh.err.h tc.const.h sh.h
rm -f gethost
${CC} -o gethost ${LDFLAGS} ${CFLAGS} ${DFLAGS} gethost.c ${LIBES} ${EXTRALIBS}
tc.defs.c: gethost host.defs
@rm -f $@
@echo "/* Do not edit this file, make creates it */" > $@
./gethost host.defs >> $@
tcsh.ps: tcsh.man
rm -f tcsh.ps
-ptroff -man tcsh.man > tcsh.ps
#.c.${SUF}:
# ${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $<
# _VMS_POSIX #module addition
.c.${SUF}:
@(echo '\#module '`echo $< | sed -e 's/\./_/g'`; cat $<) > $*..c
@echo ${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*.c
@${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*..c
@mv $*..o $*.o
@rm -f $*..c
# Don't do any special massaging of C files for sharing of strings!!
# it causes weird segmentation faults on some systems.
#.c.o:
# ${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
# ${CC} ${CF} ${CFLAGS} x.c
# mv -f x.o $*.o
# rm -f x.c
#ed.init.o: ed.init.c
# ${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
# ${CC} -R ${CF} ${CF} x.c
# mv -f x.o $*.o
# rm -f x.c
#strings.o: strings
# ${XSTR}
# ${CC} -c -R xs.c
# mv -f xs.o strings.o
# rm -f xs.c
##.DEFAULT:
## ${SCCS} get $<
##.DEFAULT:
## co $<
ed.defns.h: ed.defns.c
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '\#ifndef _h_ed_defns' >> $@
@echo '\#define _h_ed_defns' >> $@
grep '[FV]_' ed.defns.c | grep '^\#define' >> $@
@echo '\#endif /* _h_ed_defns */' >> $@
sh.err.h: sh.err.c
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '\#ifndef _h_sh_err' >> $@
@echo '\#define _h_sh_err' >> $@
grep 'ERR_' sh.err.c | grep '^#define' >> $@
@echo '\#endif /* _h_sh_err */' >> $@
tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
@rm -f $@
@echo '/* Do not edit this file, make creates it. */' > $@
@echo '\#ifndef _h_tc_const' >> $@
@echo '\#define _h_tc_const' >> $@
${CC} -E $(INCLUDES) ${DFLAGS} -D_h_tc_const tc.const.c | \
grep 'Char STR' | \
sed -e 's/Char \([a-zA-Z0-9_]*\)\[\].*/extern Char \1[];/' | \
sort >> $@
@echo '\#endif /* _h_tc_const */' >> $@
csh.prof: ${OBJS} sh.prof.${SUF} mcrt0.${SUF}
rm -f csh.prof
ld -X mcrt0.${SUF} ${OBJS} -o csh.prof ${LIBES} -lc
sh.prof.${SUF}:
cp sh.c sh.prof.c
${CC} ${CF} ${CFLAGS} -DPROF sh.prof.c
lint: tc.const.h ed.defns.h
lint ${DFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES}
alint: tc.const.h ed.defns.h
alint ${DFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES}
print:
@pr READ_ME
@pr makefile makefile.*
@(size -l a.out; size *.${SUF}) | pr -h SIZES
@${CXREF} sh*.c | pr -h XREF
@ls -l | pr
@pr sh*.h [a-rt-z]*.h sh*.c alloc.c
vprint:
@pr -l84 READ_ME TODO
@pr -l84 makefile makefile.*
@(size -l a.out; size *.${SUF}) | pr -l84 -h SIZES
@${CXREF} sh*.c | pr -l84 -h XREF
@ls -l | pr -l84
@${CXREF} sh*.c | pr -l84 -h XREF
@pr -l84 sh*.h [a-rt-z]*.h sh*.c alloc.c
vgrind:
@cp /dev/null index
@for i in *.h; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done
@for i in *.c; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done
@vgrind -t -x -h Index index >/crp/bill/csh/index.t
install: tcsh
-mv -f ${DESTBIN}/tcsh ${DESTBIN}/tcsh.old
cp tcsh ${DESTBIN}/tcsh
-strip ${DESTBIN}/tcsh
chmod 555 ${DESTBIN}/tcsh
install.man: tcsh.man
-rm -f ${DESTMAN}/tcsh.${MANSECT}
cp tcsh.man ${DESTMAN}/tcsh.${MANSECT}
chmod 444 ${DESTMAN}/tcsh.${MANSECT}
# Amiga Unix
#install.man: tcsh.man
# compress tcsh.man
# cp tcsh.man.Z ${DESTMAN}/tcsh.Z
# chmod 444 ${DESTMAN}/tcsh.Z
# Apple A/UX
#install.man: tcsh.man
# -rm -f ${DESTMAN}/tcsh.${MANSECT}.Z
# nroff -man tcsh.man | compress > ${DESTMAN}/tcsh.${MANSECT}.Z
# chmod 444 ${DESTMAN}/tcsh.${MANSECT}.Z
clean:
${RM} -f a.out strings x.c xs.c tcsh tcsh.a _MAKE_LOG core gethost
${RM} -f *.${SUF} sh.prof.c ed.defns.h tc.const.h sh.err.h tc.defs.c
${RM} -f tcsh.*.m tcsh.*.cat
veryclean: clean
${RM} -f config.h
${RM} -f *~ #*
tags: /tmp
${CTAGS} sh*.c
tar.Z:
rm -f tcsh-${VERSION}.tar.Z
rm -rf tcsh-${VERSION}
mkdir tcsh-${VERSION} tcsh-${VERSION}/config
cp ${ALLSRCS} tcsh-${VERSION}
cp ${CONFSRCS} tcsh-${VERSION}/config
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z
rm -rf tcsh-${VERSION}
tar.gz:
rm -f tcsh-${VERSION}.tar.gz
rm -rf tcsh-${VERSION}
mkdir tcsh-${VERSION} tcsh-${VERSION}/config
cp ${ALLSRCS} tcsh-${VERSION}
cp ${CONFSRCS} tcsh-${VERSION}/config
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh-${VERSION} | gzip > tcsh-${VERSION}.tar.gz
rm -rf tcsh-${VERSION}
shar:
rm -f tcsh-*.shar
rm -rf tcsh-${VERSION}
mkdir tcsh-${VERSION} tcsh-${VERSION}/config
cp ${ALLSRCS} tcsh-${VERSION}
cp ${CONFSRCS} tcsh-${VERSION}/config
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
MAKESHAR -v -n tcsh-${VERSION} tcsh-${VERSION} \
tcsh-${VERSION}/?* tcsh-${VERSION}/config/?* \
tcsh-${VERSION}/?*/set?*
rm -rf tcsh-${VERSION}
catalogs:
@(cd nls; make catalogs)
tcsh-${VERSION}.tar.Z:
rm -rf tcsh-${VERSION}
rm -f tcsh-${VERSION}.tar tcsh-${VERSION}.tar.Z DIFFS.[123]
mkdir tcsh-${VERSION}
./MAKEDIFFS bsd
mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh-${VERSION}
cp ${DISTSRCS} tcsh-${VERSION}
mkdir tcsh-${VERSION}/config
cp ${CONFSRCS} tcsh-${VERSION}/config
cp Makefile tcsh-${VERSION}/Makefile.new
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z
rm -rf tcsh-${VERSION}
tcsh.tahoe-${VERSION}.tar.Z:
rm -rf tcsh.tahoe-${VERSION}
rm -f tcsh.tahoe-${VERSION}.tar tcsh.tahoe-${VERSION}.tar.Z DIFFS.[123]
mkdir tcsh.tahoe-${VERSION}
./MAKEDIFFS tahoe
mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.tahoe-${VERSION}
cp ${DISTSRCS} tcsh.tahoe-${VERSION}
mkdir tcsh.tahoe-${VERSION}/config
cp ${CONFSRCS} tcsh.tahoe-${VERSION}/config
cp Makefile tcsh.tahoe-${VERSION}/Makefile.new
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh.tahoe-${VERSION} | compress > tcsh.tahoe-${VERSION}.tar.Z
rm -rf tcsh.tahoe-${VERSION}
tcsh.reno-${VERSION}.tar.Z:
rm -rf tcsh.reno-${VERSION}
rm -f tcsh.reno-${VERSION}.tar tcsh.reno-${VERSION}.tar.Z DIFFS.[123]
mkdir tcsh.reno-${VERSION}
./MAKEDIFFS reno
mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.reno-${VERSION}
cp ${DISTSRCS} tcsh.reno-${VERSION}
mkdir tcsh.reno-${VERSION}/config
cp ${CONFSRCS} tcsh.reno-${VERSION}/config
cp Makefile tcsh.reno-${VERSION}/Makefile.new
tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -)
tar cvf - tcsh.reno-${VERSION} | compress > tcsh.reno-${VERSION}.tar.Z
rm -rf tcsh.reno-${VERSION}
ftp: tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z
cp tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z ${FTPAREA}
cp tcsh.man ${FTPAREA}
#
# Dependencies
#
config.h: config_f.h
TCH=tc.h tc.const.h tc.decls.h tc.os.h tc.sig.h
SHH=sh.h sh.types.h sh.char.h sh.err.h sh.dir.h sh.proc.h pathnames.h \
sh.decls.h ${TCH}
TWH=tw.h tw.decls.h
EDH=ed.h ed.decls.h
# EDH
EDINC=sh.${SUF} sh.func.${SUF} sh.lex.${SUF} sh.print.${SUF} sh.proc.${SUF} \
sh.set.${SUF} tc.bind.${SUF} tc.os.${SUF} tc.prompt.${SUF} \
tc.sched.${SUF} tw.parse.${SUF}
${EDOBJS} ${EDINC} : ${EDH}
# SHH
${OBJS}: config.h ${SHH}
# TWH
TWINC=ed.chared.${SUF} ed.inputl.${SUF} sh.exec.${SUF} sh.func.${SUF} \
sh.set.${SUF} tc.func.${SUF}
${TWOBJS} ${TWINC}: ${TWH}
# glob.h
glob.${SUF} sh.glob.${SUF}: glob.h
# ed.defns.h
EDDINC=tc.bind.${SUF} tc.func.${SUF} tc.os.${SUF}
${EDOBJS} ${EDDINC}: ed.defns.h
# tc.defs.o
tc.defs.${SUF}: tc.defs.c sh.h

169
contrib/tcsh/NewThings Normal file
View File

@ -0,0 +1,169 @@
This file contains visible (incompatible) changes to the users.
This version of tcsh has the following new things:
6.08
* %$variables are now expanded in the prompt.
* print_by_columns prints in a single column if the output is not a tty.
* REMOTEHOST contains only the IP address, not the host name of the machine.
* names in .cshdirs are quoted.
* exit value from 0..255 not -128..127 as posix mandates.
6.07
* Implicit cd when the variable implicitcd is set or set to verbose
6.06
* NLS Message Catalog support.
6.05
* The bind, aliases, linedit builtins are not used anymore; they are
#ifdef'ed OBSOLETE and will be really removed in the next version
* new filetest builtin
* new hup builtin
* =x obeys nonomatch
* tcsh.man2html nroff to HTML converter for the tcsh manpage
* prompt is now %# by default.
* $REMOTEHOST contains the name of the remote host (optional)
* $HOSTTYPE is going away. New variables $OSTYPE, $MACHTYPE, $VENDOR similar
to the gnu ones.
* $< can be interrupted and takes modifiers. Does not quote args by default
like csh.
6.04
* Variable modifiers do not stop processing after the first one fails
> set i=aabbcc
> echo $i:s/a/A/:s/b/B/
AaBbcc
> echo $i:s/x/A/:s/b/B/
aabbcc
* set -r makes variables readonly
* set nonomatch, echo ~notaser returns ~notauser instead of an error
* file operators: Changed -s == !-z and -S == socket
* $?0 returns false now on interactive shells for csh compatibility.
* %p%P include seconds in prompt strings.
6.03
* $%var contains the number of characters in $var.
* Shell -w -x are now POSIX compliant on POSIX machines.
* Imported environment variables are not globbed.
* $dirstack can be used to set and examine the directory stack.
* $? == $status and $# == $#argv like in the bourne shell.
* expand variables expands arrays too (but not array elements yet).
* $0 contains argv[0] on interactive shells.
* new -b -c etc file operators from SGI csh.
* nostat takes a list of shell patterns.
* symbolic names for arrow key bindings [left, right, up, down]
* shift, left operators update variables correctly.
* builtins builtin.
* history and dirs accept now -LSc flags.
* $history accepts an optional second argument, that can change the
history builtin output similar to the $time format.
* History timestamps preserved in .history. The history file contains
now the timestamps as csh comments.
6.02
* ignore_symlinks and chase_symlinks are replaced with symlinks=ignore
and symlinks=chase; symlinks=expand addition
* complete and uncomplete builtins; user-programmable completion additions.
* Tcsh now uses the rightmost column of the terminal, allowing cut-and-paste
operations in terminal emulators that work [xterm R5 not R4]
* echo_style controls now the behaviour of the builtin echo; the default
should match the builtin echo of /bin/csh; if your system does not
come with csh, then the default echo should match /bin/echo.
* cd -; changes to the previous directory.
* setting dunique variable pushes only unique directories on the directory
stack.
* source builtin allows additional arguments that get passed in $argv in
the sourced script.
* tcsh now mirrors correctly all exported csh variables [term=TERM,path=PATH
etc.]
* showdots=-A makes listing behave like ls -A.
* directory stack access =<num> allows for entries > 9.
* $a:u uppercase the first character in $a, $a:l downcases the first
character in $a.
* Shorthand for file tests in 'if' expressions ( -dx file ) is the
same as ( -d file && -x file )
6.01
* Nothing new.
6.00 PL3
* %d in the prompt is the week-day and no longer $cwd; use %/ instead.
* changes in the prompt format. Date changes to accomodate people from
down under.
* vi insert mode to command mode transition does not move the cursor.
6.00 PL2
* setty builtin
This is used to specify what tcsh modes can be altered using stty,
Modes that should be set are specified as +<mode>, modes that should
be cleared are specified as -<mode>, and the ones that should be
untouched are specified as <mode>. setty with no arguments prints
the modes that are affected by tcsh, and setty -a prints all modes.
* multiple : modifiers in variables and ! escapes. Things like:
> set prompt="$host:r:$cwd>"
don't work any more, they should be replaced with
> set prompt="${host:r}:$cwd>"
or
> set prompt="$host:r"":$cwd>"
the reason is that now you can
> set foo=/usr/local/a.b.c
> echo $foo:t:r:e
b
If for some reason you don't like this change you can disable it with
-DCOMPAT. -DCOMPAT may go away in future tcsh versions and the way tcsh
works now is the way the 4.4BSD csh works.
6.00 PL1
* There is no more config.iris4d, use config.sgi instead
6.00
* History searching searches using shell patterns too.
* The autolist values that controlled beeping are not supported any more;
used matchbeep instead.
* /etc/Login and /etc/Logout were renamed to /etc/csh.login /etc/csh.logout
and /etc/csh.cshrc was added
* prompt2 and prompt3 can have prompt escapes.
* eval pipes work
* ignore_symlinks works
5.20 PL2
* %{..%} escapes in prompt
5.20 PL0
* bindkey -r
* history -t
* shell variables in paths expand correctly.
* variable expansion
* quoted expansions now work.
* new version and tcsh variable format
5.19 PL2
* NLS support
* New bindkey and echotc builtins
* Underline and Bold in the prompt; additions and changes to the prompt and
who syntax (%u is now %n, so that %u can be used to turn undeline off,
and %n is now \n).
* rmstar needs to be set to protect from accidental removal
* Fixed editor, and spell line.
* Glob-expand, on arguments.
* Added process migration builtins for aix370
5.19 PL1
* Maintainance release for mainly the rs6000
5.19 PL0
* 8 bit clean code, by using 16 bit strings.
* Mostly shared strings (a side-effect)
* Highlights everywhere (and in ls-F) filenames that contain characters
with the eighth bit set (or passes them unchanged depending on the
variable 'nometa')
* Newline in the prompt via %n.
* dirs takes also a -v flag for `vertical display'
* There is a new variable `listjobs' which controls if and how jobs
are displayed when a new job is suspended. [Idea from the mtXinu
code, very useful for novice users who hit control-Z 10 times on
the same job!]
set listjobs=long, jobs -l is executed every time a job is suspended.
set listjobs=short, jobs is executed every time a job is suspended.
* Passes lint... At least on a sun.

1016
contrib/tcsh/Ported Normal file

File diff suppressed because it is too large Load Diff

207
contrib/tcsh/README Normal file
View File

@ -0,0 +1,207 @@
This is tcsh version 6.08. Tcsh is a version of the Berkeley
C-Shell, with the addition of: a command line editor, command and file
name completion, listing, etc. and a bunch of small additions to the
shell itself.
Tcsh has been ported to most unix variants, and can be tinkered to work
in unix systems that it has not ported yet. See the Ported file for
a more complete list of ported systems and in the config directory for
a configuration file that matches your system.
Tcsh also runs under VMS/POSIX and OS/2+emx; the OS/2 port is not
complete yet.
Feel free to use it. These changes to csh may only be included in a
commercial product if the inclusion or exclusion does not change the
purchase price, level of support, etc. Please respect the individual
authors by giving credit where credit is due (in other words, don't
claim that you wrote portions that you haven't, and don't delete the
names of the authors from the source code or documentation).
To install tcsh:
0) Try running "configure". If that works, goto step 6.
If you are using imake, try xmkmf and goto step 3.
If imake does not work, copy Makefile.std to Makefile.
1) Look at the Makefile and make sure that you are using the right
compilation flags.
2) Copy the appropriate for your machine and OS config file from the
config subdirectory into config.h. Consult the file "Ported" for
settings known to work on various machines. If you are trying to
compile tcsh on a machine for which there is no config file yet,
you will need to create a config file using as a template one of
the supplied ones. If you get tcsh working on a new machine, I'd
appreciate a copy of the config file plus additional information
about the architecture/OS. If you are creating a new config file,
look very hard at BSDJOBS, BSDSIGS, and BSDTIMES if you are running
a non-BSD machine. For vanila SysV, these would all be #undef-ed,
but others may vary (such as A/UX or HPUX). On a pyramid, compile
in the UCB universe even if you are running under the ATT universe
usually; it will work anyway, and you get job control for free.
3) Look at config_f.h, and enable or disable any features you want.
It is configured the way I like it, but you may disagree.
If you do not have NLS, then locale.h will not be found. Undefine it
and things should work ok. On the other hand, if you have NLS you
might as well use it...
4) Look at host.defs to make sure that you have the right defines to set
the environment variables "HOSTTYPE", "MACHTYPE", "OSTYPE" and
"VENDOR" correctly. If you need to make changes, PLEASE SEND THEM
BACK TO ME.
5) You may want to adjust the TCSH_BINDIR and TCSH_MANDIR entries in
the Makefile. These are the directories that tcsh, and the tcsh.1
man entry will be placed in when you do a "make install" and "make
install.man" respectively. If you decide to install tcsh somewhere
other than in /usr/local/bin/tcsh, you should #define _PATH_TCSHELL
"/your/installation/directory/tcsh" in pathnames.h.
6) make
7) Read the documentation while you are waiting. The file tcsh.man
is in standard [nt]roff -man format. If you like, you can run the
tcsh.man2html script (requires Perl) to generate an HTML version of
the manpage which you can read with Mosaic, lynx or other HTML browser.
8) Test tcsh by typing ./tcsh to see that it has compiled correctly.
The history command should give a time stamp on every entry.
Typing normal characters should echo each exactly once. Control-A
should put the cursor at the beginning of the input line, but after
the prompt. Typing characters after that should insert them into
the line. If you have job control make sure that stopping and
restarting jobs works. Make sure you can ^C in the middle of the
input line. Also make sure that pipelines work correctly and there
are no races. Try 'echo | cat | cat | cat | cat | more' a couple of
times. If you have job control, try this command in the background
and bring it in the foreground when it stops for tty output. Also
make sure that the ioctl() modes are preserved. Get into vi, enter
and exit input mode and suspend it, background it and foreground it
again. After all that, lastly make sure that the tty process group
manipulation is happening correctly. Try ftp to some host. If your
passwd appears on the screen, you have lost /dev/tty. Otherwise
everything is fine.
9) Once satisfied that tcsh is working correctly, complete the installation
by typing "make install" to install the binary, and "make install.man" to
install the documentation. Don't forget to look at complete.tcsh for
useful completions...
10) Enjoy.
11) PLEASE send any bug reports (and fixes), code for new features,
comments, questions, etc. (even flames) to:
The tcsh mailing list
tcsh@mx.gw.com
Various:
***************************************************************************
On sysv versions < 3.0 (not hpux) Doug Gwyn's public domain directory
manipulation library has to be installed. This library is available
for anonymous ftp from prep.ai.mit.edu:/pub/gnu/dirent.tar.Z
If the network is not installed, then there is a gethostname()
routine is tc.os.c, enabled by defining NEEDgethostname
***************************************************************************
On BSDreno, in ttyname() closedir() is called twice and so the same
pointer gets free'd twice. tcsh's malloc is picky and it prints an
error message to that effect. If you don't like the message:
1. Apply the following patch:
*** /usr/src/lib/libc/gen/ttyname.c.orig Fri Jun 1 17:17:15 1990
--- /usr/src/lib/libc/gen/ttyname.c Tue Oct 29 16:33:12 1991
***************
*** 51,57 ****
if (stat(buf, &sb2) < 0 || sb1.st_dev != sb2.st_dev ||
sb1.st_ino != sb2.st_ino)
continue;
- closedir(dp);
rval = buf;
break;
}
--- 51,56 ----
Or: Comment the error printing out in tc.alloc.c
Or: Compile -DSYSMALLOC
***************************************************************************
From: Scott Krotz <krotz@honey.rtsg.mot.com>
Tcsh has been ported to minix by Scott Krotz (krotz@honey.rtsg.mot.com).
Unfortunately the minix sed is broken, so you'll have to find a way to
make tc.const.h, sh.err.h, ed.defns.h which are automatically generated.
The easiest way to create them is to make a copy from unix, copying
minix to config.h, and then 'make sh.err.h tc.const.h ed.defns.h'
The OS/dependent files are in mi.termios.h, mi.wait.h, mi.varargs.h
You will get some warnings, but dont worry about them, just ignore
them. After tcsh has compiled and the gcc binary is converted to a
minix binary, remember to chmem it to give it more memory - it will
need it! How much you need depends on how many aliases you have, etc..
Add at least 50000 to it.
One last thing. You might have to make some links for include files so
that they are in the directories that tcsh is expecting while compiling.
I forget if I had to do this or not, but it should be fairly easy to sort
out. If it cant find any include files this is probably the reason.
If you have any problems, please tell me. I can be contacted through
e-mail at:
krotz@honey.rtsg.mot.com
I also read comp.os.minix on a regular basis, so a note there will get
my attention also.
Have fun!
ps. The termios functions are provided by Magnus Doell and Bruce Evans.
Thanks, guys!
From: Bob Byrnes <byrnes@ee.cornell.edu>
This is for minix 1.5 (straight out of the box from P-H) plus the i386
patches from Bruce Evans.
I cross-compiled on a Sun using gcc 2.1 with a target of i386-bsd
(using the minix include files instead of the bsd versions), and then
linked the resulting object files with similarly compiled crtso.o and
libc.a on vax (little endian) using a hacked version of ld which I put
together to generate minix executables instead of bsd a.out format.
What a kludge ...
I compiled with -O2 -Wall ... So far I haven't noticed any problems
with the optimizer.
In case anyone is contemplating compiling tcsh with bcc (Bruce Evan's
i386 compiler that comes with the minix386 upgrade package), don't bother.
It is some serious bugs that kill tcsh when compiled for 16-bit characters.
I can provide more details of bugs that I noticed for brave souls who want
to try, but it would be hard (and why bother if you can get gcc?).
I can make the binary available to anyone who wants it (for example people
who can't get access to a cross-compiling environment, and who don't yet
have gcc running under minix).
***************************************************************************
If your compiler cannot handle long symbol names, add
#include "snames.h"
to your config.h file
-- Christos Zoulas
christos@zoulas.com

View File

@ -0,0 +1,9 @@
If you have imake running on your machine, you may skip steps 1 and 2
described in the README file and try instead the process described here.
Note that imake is not supported for all the platforms yet, so this
might not work on your machine. If that is the case please let us know.
If you can send a patch that fixes the problem we would appreciate it.
1. edit imake.config and modify the configurable parameters to your liking.
2. 'xmkmf; make depend; make'

40
contrib/tcsh/WishList Normal file
View File

@ -0,0 +1,40 @@
* Fix memory leak related to aliasrun(). Precmd, Cwdcmd etc. leak memory.
* Fix migrate -site $$... Seems to hang... (aix370)
* Fix history in loops.
* New idea.
Lots of people seem to like the idea to be able to do sed type
operations on shell variables. Maybe we can extend the syntax
of the variable editing to understand string operations.
So I would like to be able to use:
> set a="this is a STRING"
> echo $a:[3-]
is is a STRING
> echo $a:[#]
16
> echo $a:[6-7]
is
> echo $a:[-2]
ng
> echo $a:[-20]
Subscript out of bounds.
> echo $a:[2-20]
Subscript out of bounds.
> echo $a:[1-1]:u$a:[2-].
This is a string.
* Fix pipelines that contain builtins so that they behave correctly.
I tried to fix that (most of the code is in sh.sem.c, but it works
only for non POSIX machines cause otherwise the setpgid() I added
fails).
* Fix the correct code... How to do that involves A.I....
* Rewrite the whole thing. It has taken to much beating over the years...
* Add another hook like precmd to be executed after the prompt but before the
command.
* Add instructions for using configure in the README file.

10
contrib/tcsh/Y2K Normal file
View File

@ -0,0 +1,10 @@
The tcsh code has been tested on a solaris-2.6 machine and a
NetBSD-1.3H machine running before, and after the year 2000. The
code has been also visually inspected for Y2K compliance problems.
Tcsh does not use time functions for anything but display purposes,
so its operation should not be affected assuming that the time
related functions of the c library work properly.
Note: Since the last audit, tcsh-6.08.00 has been found to have
a minor problem with %y in the prompt (it will print 10 instead
of 00 in y2k). This has been fixed in tcsh-6.09.00.

708
contrib/tcsh/complete.tcsh Normal file
View File

@ -0,0 +1,708 @@
#
# $Id: complete.tcsh,v 1.32 1999/06/09 19:09:12 christos Exp $
# example file using the new completion code
#
onintr -
if (! $?prompt) goto end
if ($?tcsh) then
if ($tcsh != 1) then
set rev=$tcsh:r
set rel=$rev:e
set pat=$tcsh:e
set rev=$rev:r
endif
if ($rev > 5 && $rel > 1) then
set complete=1
endif
unset rev rel pat
endif
if ($?complete) then
set noglob
set hosts
foreach f ($HOME/.hosts /usr/local/etc/csh.hosts $HOME/.rhosts /etc/hosts.equiv)
if ( -r $f ) then
set hosts = ($hosts `grep -v "+" $f | tr -s " " " " | cut -f 1`)
endif
end
if ( -r $HOME/.netrc ) then
set f=`awk '/machine/ { print $2 }' < $HOME/.netrc` >& /dev/null
set hosts=($hosts $f)
endif
unset f
if ( ! $?hosts ) then
set hosts=(hyperion.ee.cornell.edu phaeton.ee.cornell.edu \
guillemin.ee.cornell.edu vangogh.cs.berkeley.edu \
ftp.uu.net prep.ai.mit.edu export.lcs.mit.edu \
labrea.stanford.edu sumex-aim.stanford.edu \
tut.cis.ohio-state.edu)
endif
complete ywho n/*/\$hosts/ # argument from list in $hosts
complete rsh p/1/\$hosts/ c/-/"(l n)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
complete ssh p/1/\$hosts/ c/-/"(l n)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
complete xrsh p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
complete rlogin p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/
complete telnet p/1/\$hosts/ p/2/x:'<port>'/ n/*/n/
complete cd p/1/d/ # Directories only
complete chdir p/1/d/
complete pushd p/1/d/
complete popd p/1/d/
complete pu p/1/d/
complete po p/1/d/
complete complete p/1/X/ # Completions only
complete uncomplete n/*/X/
complete exec p/1/c/ # Commands only
complete trace p/1/c/
complete strace p/1/c/
complete which n/*/c/
complete where n/*/c/
complete skill p/1/c/
complete dde p/1/c/
complete adb c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
complete sdb p/1/c/
complete dbx c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
complete xdb p/1/c/
complete gdb n/-d/d/ n/*/c/
complete ups p/1/c/
complete set 'c/*=/f/' 'p/1/s/=' 'n/=/f/'
complete unset n/*/s/
complete alias p/1/a/ # only aliases are valid
complete unalias n/*/a/
complete xdvi n/*/f:*.dvi/ # Only files that match *.dvi
complete dvips n/*/f:*.dvi/
complete tex n/*/f:*.tex/ # Only files that match *.tex
complete latex n/*/f:*.{tex,ltx}/
complete su c/--/"(login fast preserve-environment command shell \
help version)"/ c/-/"(f l m p c s -)"/ \
n/{-c,--command}/c/ \
n@{-s,--shell}@'`cat /etc/shells`'@ n/*/u/
complete cc c/-[IL]/d/ \
c@-l@'`\ls -1 /usr/lib/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
complete acc c/-[IL]/d/ \
c@-l@'`\ls -1 /usr/lang/SC1.0/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
complete gcc c/-[IL]/d/ \
c/-f/"(caller-saves cse-follow-jumps delayed-branch \
elide-constructors expensive-optimizations \
float-store force-addr force-mem inline \
inline-functions keep-inline-functions \
memoize-lookups no-default-inline \
no-defer-pop no-function-cse omit-frame-pointer \
rerun-cse-after-loop schedule-insns \
schedule-insns2 strength-reduce \
thread-jumps unroll-all-loops \
unroll-loops syntax-only all-virtual \
cond-mismatch dollars-in-identifiers \
enum-int-equiv no-asm no-builtin \
no-strict-prototype signed-bitfields \
signed-char this-is-variable unsigned-bitfields \
unsigned-char writable-strings call-saved-reg \
call-used-reg fixed-reg no-common \
no-gnu-binutils nonnull-objects \
pcc-struct-return pic PIC shared-data \
short-enums short-double volatile)"/ \
c/-W/"(all aggregate-return cast-align cast-qual \
comment conversion enum-clash error format \
id-clash-len implicit missing-prototypes \
no-parentheses pointer-arith return-type shadow \
strict-prototypes switch uninitialized unused \
write-strings)"/ \
c/-m/"(68000 68020 68881 bitfield fpa nobitfield rtd \
short c68000 c68020 soft-float g gnu unix fpu \
no-epilogue)"/ \
c/-d/"(D M N)"/ \
c/-/"(f W vspec v vpath ansi traditional \
traditional-cpp trigraphs pedantic x o l c g L \
I D U O O2 C E H B b V M MD MM i dynamic \
nodtdlib static nostdinc undef)"/ \
c/-l/f:*.a/ \
n/*/f:*.{c,C,cc,o,a,s,i}/
complete g++ n/*/f:*.{C,cc,o,s,i}/
complete CC n/*/f:*.{C,cc,o,s,i}/
complete rm c/--/"(directory force interactive verbose \
recursive help version)"/ c/-/"(d f i v r R -)"/ \
n/*/f:^*.{c,cc,C,h,in}/ # Protect precious files
complete vi n/*/f:^*.[oa]/
complete bindkey N/-a/b/ N/-c/c/ n/-[ascr]/'x:<key-sequence>'/ \
n/-[svedlr]/n/ c/-[vedl]/n/ c/-/"(a s k c v e d l r)"/\
n/-k/"(left right up down)"/ p/2-/b/ \
p/1/'x:<key-sequence or option>'/
complete find n/-fstype/"(nfs 4.2)"/ n/-name/f/ \
n/-type/"(c b d f p l s)"/ n/-user/u/ n/-group/g/ \
n/-exec/c/ n/-ok/c/ n/-cpio/f/ n/-ncpio/f/ n/-newer/f/ \
c/-/"(fstype name perm prune type user nouser \
group nogroup size inum atime mtime ctime exec \
ok print ls cpio ncpio newer xdev depth \
daystart follow maxdepth mindepth noleaf version \
anewer cnewer amin cmin mmin true false uid gid \
ilname iname ipath iregex links lname empty path \
regex used xtype fprint fprint0 fprintf \
print0 printf not a and o or)"/ \
n/*/d/
complete -%* c/%/j/ # fill in the jobs builtin
complete {fg,bg,stop} c/%/j/ p/1/"(%)"//
complete limit c/-/"(h)"/ n/*/l/
complete unlimit c/-/"(h)"/ n/*/l/
complete -co* p/0/"(compress)"/ # make compress completion
# not ambiguous
complete zcat n/*/f:*.Z/
complete nm n/*/f:^*.{h,C,c,cc}/
complete finger c/*@/\$hosts/ n/*/u/@
complete ping p/1/\$hosts/
complete traceroute p/1/\$hosts/
complete {talk,ntalk,phone} p/1/'`users | tr " " "\012" | uniq`'/ \
n/*/\`who\ \|\ grep\ \$:1\ \|\ awk\ \'\{\ print\ \$2\ \}\'\`/
complete ftp c/-/"(d i g n v)"/ n/-/\$hosts/ p/1/\$hosts/ n/*/n/
# this one is simple...
#complete rcp c/*:/f/ C@[./\$~]*@f@ n/*/\$hosts/:
# From Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de>
# This one will rsh to the file to fetch the list of files!
complete rcp 'c%*@*:%`set q=$:-0;set q="$q:s/@/ /";set q="$q:s/:/ /";set q=($q " ");rsh $q[2] -l $q[1] ls -dp $q[3]\*`%' 'c%*:%`set q=$:-0;set q="$q:s/:/ /";set q=($q " ");rsh $q[1] ls -dp $q[2]\*`%' 'c%*@%$hosts%:' 'C@[./$~]*@f@' 'n/*/$hosts/:'
complete dd c/--/"(help version)"/ c/[io]f=/f/ \
c/conv=*,/"(ascii ebcdic ibm block unblock \
lcase notrunc ucase swab noerror sync)"/,\
c/conv=/"(ascii ebcdic ibm block unblock \
lcase notrunc ucase swab noerror sync)"/,\
c/*=/x:'<number>'/ \
n/*/"(if of conv ibs obs bs cbs files skip file seek count)"/=
complete nslookup p/1/x:'<host>'/ p/2/\$hosts/
complete ar c/[dmpqrtx]/"(c l o u v a b i)"/ p/1/"(d m p q r t x)"// \
p/2/f:*.a/ p/*/f:*.o/
# these should be merged with the MH completion hacks below - jgotts
complete {sprev,snext} \
c@+@F:$HOME/Mail/@
# these and interrupt handling from Jaap Vermeulen <jaap@sequent.com>
complete {rexec,rxexec,rxterm,rmterm} \
'p/1/$hosts/' 'c/-/(l L E)/' 'n/-l/u/' 'n/-L/f/' \
'n/-E/e/' 'n/*/c/'
complete kill 'c/-/S/' 'c/%/j/' \
'n/*/`ps -u $LOGNAME | awk '"'"'{print $1}'"'"'`/'
# these from Marc Horowitz <marc@cam.ov.com>
complete attach 'n/-mountpoint/d/' 'n/-m/d/' 'n/-type/(afs nfs rvd ufs)/' \
'n/-t/(afs nfs rvd ufs)/' 'n/-user/u/' 'n/-U/u/' \
'c/-/(verbose quiet force printpath lookup debug map \
nomap remap zephyr nozephyr readonly write \
mountpoint noexplicit explicit type mountoptions \
nosetuid setuid override skipfsck lock user host)/' \
'n/-e/f/' 'n/*/()/'
complete hesinfo 'p/1/u/' \
'p/2/(passwd group uid grplist pcap pobox cluster \
filsys sloc service)/'
# these from E. Jay Berkenbilt <ejb@ERA.COM>
# = isn't always followed by a filename or a path anymore - jgotts
complete ./configure 'c/--*=/f/' 'c/--{cache-file,prefix,exec-prefix,\
bindir,sbindir,libexecdir,datadir,\
sysconfdir,sharedstatedir,localstatedir,\
libdir,includedir,oldincludedir,infodir,\
mandir,srcdir}/(=)//' \
'c/--/(cache-file verbose prefix exec-prefix bindir \
sbindir libexecdir datadir sysconfdir \
sharedstatedir localstatedir libdir \
includedir oldincludedir infodir mandir \
srcdir)//'
complete gs 'c/-sDEVICE=/(x11 cdjmono cdj550 epson eps9high epsonc \
dfaxhigh dfaxlow laserjet ljet4 sparc pbm \
pbmraw pgm pgmraw ppm ppmraw bit)/' \
'c/-sOutputFile=/f/' 'c/-s/(DEVICE OutputFile)/=' \
'c/-d/(NODISPLAY NOPLATFONTS NOPAUSE)/' 'n/*/f/'
complete perl 'n/-S/c/'
complete printenv 'n/*/e/'
complete sccs p/1/"(admin cdc check clean comb deledit delget \
delta diffs edit enter fix get help info \
print prs prt rmdel sccsdiff tell unedit \
unget val what)"/
complete setenv 'p/1/e/' 'c/*:/f/'
# these and method of setting hosts from Kimmo Suominen <kim@tac.nyc.ny.us>
if ( -f $HOME/.mh_profile && -x "`which folders`" ) then
if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`"
if ( ! $?MHA ) setenv MHA "`ali | sed -e '/^ /d' -e 's/:.*//'`"
set folders = ( $FOLDERS )
set mha = ( $MHA )
complete ali \
'c/-/(alias nolist list nonormalize normalize nouser user help)/' \
'n,-alias,f,'
complete anno \
'c/-/(component noinplace inplace nodate date text help)/' \
'c,+,$folders,' \
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete burst \
'c/-/(noinplace inplace noquiet quiet noverbose verbose help)/' \
'c,+,$folders,' \
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete comp \
'c/-/(draftfolder draftmessage nodraftfolder editor noedit file form nouse use whatnowproc nowhatnowproc help)/' \
'c,+,$folders,' \
'n,-whatnowproc,c,' \
'n,-file,f,'\
'n,-form,f,'\
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete dist \
'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit form noinplace inplace whatnowproc nowhatnowproc help)/' \
'c,+,$folders,' \
'n,-whatnowproc,c,' \
'n,-form,f,'\
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete folder \
'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
'c,+,$folders,' \
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete folders \
'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
'c,+,$folders,' \
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete forw \
'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit filter form noformat format noinplace inplace digest issue volume whatnowproc nowhatnowproc help)/' \
'c,+,$folders,' \
'n,-whatnowproc,c,' \
'n,-filter,f,'\
'n,-form,f,'\
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete inc \
'c/-/(audit file noaudit nochangecur changecur file form format nosilent silent notruncate truncate width help)/' \
'c,+,$folders,' \
'n,-audit,f,'\
'n,-form,f,'
complete mark \
'c/-/(add delete list sequence nopublic public nozero zero help)/' \
'c,+,$folders,' \
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete mhmail \
'c/-/(body cc from subject help)/' \
'n,-cc,$mha,' \
'n,-from,$mha,' \
'n/*/$mha/'
complete mhpath \
'c/-/(help)/' \
'c,+,$folders,' \
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete msgchk \
'c/-/(nodate date nonotify notify help)/'
complete msh \
'c/-/(prompt noscan scan notopcur topcur help)/'
complete next \
'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
'c,+,$folders,' \
'n,-moreproc,c,' \
'n,-showproc,c,' \
'n,-form,f,'
complete packf \
'c/-/(file help)/' \
'c,+,$folders,' \
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete pick \
'c/-/(and or not lbrace rbrace cc date from search subject to othercomponent after before datefield sequence nopublic public nozero zero nolist list help)/' \
'c,+,$folders,' \
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete prev \
'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
'c,+,$folders,' \
'n,-moreproc,c,' \
'n,-showproc,c,' \
'n,-form,f,'
complete prompter \
'c/-/(erase kill noprepend prepend norapid rapid nodoteof doteof help)/'
complete refile \
'c/-/(draft nolink link nopreserve preserve src file help)/' \
'c,+,$folders,' \
'n,-file,f,'\
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete rmf \
'c/-/(nointeractive interactive help)/' \
'c,+,$folders,'
complete rmm \
'c/-/(help)/' \
'c,+,$folders,' \
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete scan \
'c/-/(noclear clear form format noheader header width noreverse reverse file help)/' \
'c,+,$folders,' \
'n,-form,f,'\
'n,-file,f,'\
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete send \
'c/-/(alias draft draftfolder draftmessage nodraftfolder filter nofilter noformat format noforward forward nomsgid msgid nopush push noverbose verbose nowatch watch width help)/' \
'n,-alias,f,'\
'n,-filter,f,'
complete show \
'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
'c,+,$folders,' \
'n,-moreproc,c,' \
'n,-showproc,c,' \
'n,-form,f,'\
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete sortm \
'c/-/(datefield textfield notextfield limit nolimit noverbose verbose help)/' \
'c,+,$folders,' \
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete vmh \
'c/-/(prompt vmhproc novmhproc help)/' \
'n,-vmhproc,c,'
complete whatnow \
'c/-/(draftfolder draftmessage nodraftfolder editor noedit prompt help)/'
complete whom \
'c/-/(alias nocheck check draft draftfolder draftmessage nodraftfolder help)/' \
'n,-alias,f,'
complete plum \
'c/-/()/' \
'c,+,$folders,' \
'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
complete mail \
'c/-/()/' \
'n/*/$mha/'
endif
#from Dan Nicolaescu <dann@ics.uci.edu>
if ( $?MODULESHOME ) then
alias Compl_module ' set q = "$MODULEPATH:as/:/ /" ; find $q -name .version -o -name .modulea\* -prune -o -print | sed `echo "-e s@"$MODULEPATH:as%:%/\*@@g -e s@%"/\*@@g"`'
complete module 'p%1%(add load unload switch display avail use unuse update purge list clear help initadd initrm initswitch initlist initclear)%' \
'n%unload%`echo "$LOADEDMODULES:as/:/ /"`%' \
'n%{lo*,sw*,di*,he*,inita*,initr*,inits*}%`eval Compl_module`%' \
'N%{sw*,initsw*}%`eval Compl_module`%' 'C%-%(-append)%' 'n%{use,unu*,av*}%d%' 'n%-append%d%' \
'C%[^-]*%`eval Compl_module`%'
endif
# these from Tom Warzeka <waz@quahog.npt.nuwc.navy.mil>
# you may need to set the following variables for your host
set _elispdir = /usr/local/share/emacs/20.2/lisp # GNU Emacs lisp directory
set _maildir = /var/spool/mail # Post Office: /var/spool/mail or /usr/mail
set _ypdir = /var/yp # directory where NIS (YP) maps are kept
set _domain = "`domainname`"
# this one works but is slow and doesn't descend into subdirectories
# complete cd C@[./\$~]*@d@ \
# p@1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@
if ( -r /etc/shells ) then
complete setenv p@1@e@ n@DISPLAY@\$hosts@: n@SHELL@'`cat /etc/shells`'@
else
complete setenv p@1@e@ n@DISPLAY@\$hosts@:
endif
complete unsetenv n/*/e/
if (-r $HOME/.mailrc) then
complete mail c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
n@-u@T:$_maildir@ n/-f/f/ \
n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " " " | cut -f 2`'@
else
complete mail c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
n@-u@T:$_maildir@ n/-f/f/ n/*/u/
endif
complete man n@1@'`\ls -1 /usr/man/man1 | sed s%\\.1.\*\$%%`'@ \
n@2@'`\ls -1 /usr/man/man2 | sed s%\\.2.\*\$%%`'@ \
n@3@'`\ls -1 /usr/man/man3 | sed s%\\.3.\*\$%%`'@ \
n@4@'`\ls -1 /usr/man/man4 | sed s%\\.4.\*\$%%`'@ \
n@5@'`\ls -1 /usr/man/man5 | sed s%\\.5.\*\$%%`'@ \
n@6@'`\ls -1 /usr/man/man6 | sed s%\\.6.\*\$%%`'@ \
n@7@'`\ls -1 /usr/man/man7 | sed s%\\.7.\*\$%%`'@ \
n@8@'`\ls -1 /usr/man/man8 | sed s%\\.8.\*\$%%`'@ \
n@9@'`[ -r /usr/man/man9 ] && \ls -1 /usr/man/man9 | sed s%\\.9.\*\$%%`'@ \
n@0@'`[ -r /usr/man/man0 ] && \ls -1 /usr/man/man0 | sed s%\\.0.\*\$%%`'@ \
n@new@'`[ -r /usr/man/mann ] && \ls -1 /usr/man/mann | sed s%\\.n.\*\$%%`'@ \
n@old@'`[ -r /usr/man/mano ] && \ls -1 /usr/man/mano | sed s%\\.o.\*\$%%`'@ \
n@local@'`[ -r /usr/man/manl ] && \ls -1 /usr/man/manl | sed s%\\.l.\*\$%%`'@ \
n@public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \
c/-/"(- f k M P s t)"/ n/-f/c/ n/-k/x:'<keyword>'/ n/-[MP]/d/ \
N@-[MP]@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n/*/c/
complete ps c/-t/x:'<tty>'/ c/-/"(a c C e g k l S t u v w x)"/ \
n/-k/x:'<kernel>'/ N/-k/x:'<core_file>'/ n/*/x:'<PID>'/
complete compress c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/
complete uncompress c/-/"(c f v)"/ n/*/f:*.Z/
complete xhost c/[+-]/\$hosts/ n/*/\$hosts/
# these conform to the latest GNU versions available at press time ...
# updates by John Gotts <jgotts@engin.umich.edu>
complete emacs c/-/"(batch d f funcall i insert kill l load \
no-init-file nw q t u user)"/ c/+/x:'<line_number>'/ \
n/-d/x:'<display>'/ n/-f/x:'<lisp_function>'/ n/-i/f/ \
n@-l@F:$_elispdir@ n/-t/x:'<terminal>'/ \
n/-u/u/ n/*/f:^*[\#~]/
complete gzcat c/--/"(force help license quiet version)"/ \
c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
complete gzip c/--/"(stdout to-stdout decompress uncompress \
force help list license no-name quiet recurse \
suffix test verbose version fast best)"/ \
c/-/"(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)"/\
n/{-S,--suffix}/x:'<file_name_suffix>'/ \
n/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
N/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
n/*/f:^*.{gz,Z,z,zip,taz,tgz}/
complete {gunzip,ungzip} c/--/"(stdout to-stdout force help list license \
no-name quiet recurse suffix test verbose version)"/ \
c/-/"(c f h l L n q r S t v V -)"/ \
n/{-S,--suffix}/x:'<file_name_suffix>'/ \
n/*/f:*.{gz,Z,z,zip,taz,tgz}/
complete zgrep c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
c/-/"(A b B c C e f h i l n s v V w x)"/ \
p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
complete zegrep c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
c/-/"(A b B c C e f h i l n s v V w x)"/ \
p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
complete zfgrep c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
c/-/"(A b B c C e f h i l n s v V w x)"/ \
p/1/x:'<fixed_string>'/ N/-*e/f/ \
n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
complete znew c/-/"(f t v 9 P K)"/ n/*/f:*.Z/
complete zmore n/*/f:*.{gz,Z,z,zip}/
complete zfile n/*/f:*.{gz,Z,z,zip,taz,tgz}/
complete ztouch n/*/f:*.{gz,Z,z,zip,taz,tgz}/
complete zforce n/*/f:^*.{gz,tgz}/
complete grep c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
c/--/"(extended-regexp fixed-regexp basic-regexp \
regexp file ignore-case word-regexp line-regexp \
no-messages revert-match version help byte-offset \
line-number with-filename no-filename quiet silent \
text directories recursive files-without-match \
files-with-matches count before-context after-context \
context binary unix-byte-offsets)"/ \
c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
v w x)"/ \
p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
complete egrep c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
c/--/"(extended-regexp fixed-regexp basic-regexp \
regexp file ignore-case word-regexp line-regexp \
no-messages revert-match version help byte-offset \
line-number with-filename no-filename quiet silent \
text directories recursive files-without-match \
files-with-matches count before-context after-context \
context binary unix-byte-offsets)"/ \
c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
v w x)"/ \
p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
complete fgrep c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
c/--/"(extended-regexp fixed-regexp basic-regexp \
regexp file ignore-case word-regexp line-regexp \
no-messages revert-match version help byte-offset \
line-number with-filename no-filename quiet silent \
text directories recursive files-without-match \
files-with-matches count before-context after-context \
context binary unix-byte-offsets)"/ \
c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
v w x)"/ \
p/1/x:'<fixed_string>'/ N/-*e/f/ \
n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
complete users c/--/"(help version)"/ p/1/x:'<accounting_file>'/
complete who c/--/"(heading idle count mesg message writable help \
version)"/ c/-/"(H i m q s T w u -)"/ \
p/1/x:'<accounting_file>'/ n/am/"(i)"/ n/are/"(you)"/
complete chown c/--/"(changes dereference no-dereference silent \
quiet reference recursive verbose help version)"/ \
c/-/"(c f h R v -)"/ C@[./\$~]@f@ c/*[.:]/g/ \
n/-/u/. p/1/u/. n/*/f/
complete chgrp c/--/"(changes no-dereference silent quiet reference \
recursive verbose help version)"/ \
c/-/"(c f h R v -)"/ n/-/g/ p/1/g/ n/*/f/
complete chmod c/--/"(changes silent quiet verbose reference \
recursive help version)"/ c/-/"(c f R v)"/
complete df c/--/"(all block-size human-readable si inodes \
kilobytes local megabytes no-sync portability sync \
type print-type exclude-type help version)"/ \
c/-/"(a H h i k l m P T t v x)"/
complete du c/--/"(all block-size bytes total dereference-args \
human-readable si kilobytes count-links dereference \
megabytes separate-dirs summarize one-file-system \
exclude-from exclude max-depth help version"/ \
c/-/"(a b c D H h k L l m S s X x)"/
complete cat c/--/"(number-nonblank number squeeze-blank show-all \
show-nonprinting show-ends show-tabs help version)"/ \
c/-/"(A b E e n s T t u v -)"/ n/*/f/
complete mv c/--/"(backup force interactive update verbose suffix \
version-control help version)"/ \
c/-/"(b f i S u V v -)"/ \
n/{-S,--suffix}/x:'<suffix>'/ \
n/{-V,--version-control}/"(t numbered nil existing \
never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
complete cp c/--/"(archive backup no-dereference force \
interactive link preserve parents sparse recursive \
symbolic-link suffix update verbose version-control \
one-file-system help version)"/ \
c/-/"(a b d f i l P p R r S s u V v x -)"/ \
n/-*r/d/ n/{-S,--suffix}/x:'<suffix>'/ \
n/{-V,--version-control}/"(t numbered nil existing \
never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
complete ln c/--/"(backup directory force no-dereference \
interactive symbolic suffix verbose version-control \
help version)"/ \
c/-/"(b d F f i n S s V v -)"/ \
n/{-S,--suffix}/x:'<suffix>'/ \
n/{-V,--version-control}/"(t numbered nil existing \
never simple)"/ n/-/f/ N/-/x:'<link_name>'/ \
p/1/f/ p/2/x:'<link_name>'/
complete touch c/--/"(date reference time help version)"/ \
c/-/"(a c d f m r t -)"/ \
n/{-d,--date}/x:'<date_string>'/ \
c/--time/"(access atime mtime modify use)"/ \
n/{-r,--file}/f/ n/-t/x:'<time_stamp>'/ n/*/f/
complete mkdir c/--/"(mode parents verbose help version)"/ \
c/-/"(p m -)"/ \
n/{-m,--mode}/x:'<mode>'/ n/*/d/
complete rmdir c/--/"(ignore-fail-on-non-empty parents verbose help \
version)"/ c/-/"(p -)"/ n/*/d/
complete tar c/-[Acru]*/"(b B C f F g G h i l L M N o P \
R S T v V w W X z Z)"/ \
c/-[dtx]*/"( B C f F g G i k K m M O p P \
R s S T v w x X z Z)"/ \
p/1/"(A c d r t u x -A -c -d -r -t -u -x \
--catenate --concatenate --create --diff --compare \
--delete --append --list --update --extract --get \
--help --version)"/ \
c/--/"(catenate concatenate create diff compare \
delete append list update extract get atime-preserve \
block-size read-full-blocks directory checkpoint file \
force-local info-script new-volume-script incremental \
listed-incremental dereference ignore-zeros \
ignore-failed-read keep-old-files starting-file \
one-file-system tape-length modification-time \
multi-volume after-date newer old-archive portability \
to-stdout same-permissions preserve-permissions \
absolute-paths preserve record-number remove-files \
same-order preserve-order same-owner sparse \
files-from null totals verbose label version \
interactive confirmation verify exclude exclude-from \
compress uncompress gzip ungzip use-compress-program \
block-compress help version)"/ \
c/-/"(b B C f F g G h i k K l L m M N o O p P R s S \
T v V w W X z Z 0 1 2 3 4 5 6 7 -)"/ \
n/-c*f/x:'<new_tar_file, device_file, or "-">'/ \
n/{-[Adrtux]*f,--file}/f:*.tar/ \
N/{-x*f,--file}/'`tar -tf $:-1`'/ \
n/--use-compress-program/c/ \
n/{-b,--block-size}/x:'<block_size>'/ \
n/{-V,--label}/x:'<volume_label>'/ \
n/{-N,--{after-date,newer}}/x:'<date>'/ \
n/{-L,--tape-length}/x:'<tape_length_in_kB>'/ \
n/{-C,--directory}/d/ \
N/{-C,--directory}/'`\ls $:-1`'/ \
n/-[0-7]/"(l m h)"/
# SVR4 filesystems
#complete mount c/-/"(a F m o O p r v V)"/ n/-p/n/ n/-v/n/ \
# n/-o/x:'<FSType_options>'/ \
# n@-F@'`\ls -1 /usr/lib/fs`'@ \
# n@*@'`grep -v "^#" /etc/vfstab | tr -s " " " " | cut -f 3`'@
#complete umount c/-/"(a o V)"/ n/-o/x:'<FSType_options>'/ \
# n/*/'`mount | cut -d " " -f 1`'/
#complete mountall c/-/"(F l r)"/ n@-F@'`\ls -1 /usr/lib/fs`'@
#complete umountall c/-/"(F h k l r s)"/ n@-F@'`\ls -1 /usr/lib/fs`'@ \
# n/-h/'`df -k | cut -s -d ":" -f 1 | sort -u`'/
# BSD 4.3 filesystems
complete mount c/-/"(a r t v)"/ n/-t/"(4.2 nfs)"/ \
n@*@'`grep -v "^#" /etc/fstab | tr -s " " " " | cut -f 2`'@
complete umount c/-/"(a h t v)"/ n/-t/"(4.2 nfs)"/ \
n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
n/*/'`mount | cut -d " " -f 3`'/
# BSD 4.2 filesystems
#complete mount c/-/"(a r t v)"/ n/-t/"(ufs nfs)"/ \
# n@*@'`cut -d ":" -f 2 /etc/fstab`'@
#complete umount c/-/"(a h t v)"/ n/-t/"(ufs nfs)"/ \
# n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
# n/*/'`mount | cut -d " " -f 3`'/
# these deal with NIS (formerly YP); if it's not running you don't need 'em
complete domainname p@1@D:$_ypdir@" " n@*@n@
complete ypcat c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
N@-d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
complete ypmatch c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
N@-d@x:'<key ...>'@ n@-@x:'<key ...>'@ p@1@x:'<key ...>'@ \
n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
complete ypwhich c@-@"(d m t x V1 V2)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
n@-m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
N@-m@n@ n@*@\$hosts@
# there's no need to clutter the user's shell with these
unset _elispdir _maildir _ypdir _domain
complete make \
'n/-f/f/' \
'c/*=/f/' \
'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^ #].*:/s/:.*//p"`@'
if ( -f /etc/printcap ) then
set printers=(`sed -n -e "/^[^ #].*:/s/:.*//p" /etc/printcap`)
complete lpr 'c/-P/$printers/'
complete lpq 'c/-P/$printers/'
complete lprm 'c/-P/$printers/'
complete lpquota 'p/1/(-Qprlogger)/' 'c/-P/$printers/'
complete dvips 'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/'
endif
unset noglob
unset complete
endif
end:
onintr

1
contrib/tcsh/config.h.in Normal file
View File

@ -0,0 +1 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */

193
contrib/tcsh/config_f.h Normal file
View File

@ -0,0 +1,193 @@
/* $Header: /src/pub/tcsh/config_f.h,v 3.22 1999/05/11 13:07:42 christos Exp $ */
/*
* config_f.h -- configure various defines for tcsh
*
* This is included by config.h.
*
* Edit this to match your particular feelings; this is set up to the
* way I like it.
*/
/*-
* Copyright (c) 1980, 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _h_config_f
#define _h_config_f
/*
* SHORT_STRINGS Use 16 bit characters instead of 8 bit chars
* This fixes up quoting problems and eases implementation
* of nls...
*
*/
#define SHORT_STRINGS
/*
* NLS: Use Native Language System
* Routines like setlocale() are needed
* if you don't have <locale.h>, you don't want
* to define this.
*/
#define NLS
/*
* NLS_CATALOGS:Use Native Language System catalogs for
* international messages.
* Routines like catopen() are needed
* if you don't have <nl_types.h>, you don't want
* to define this.
*/
#undef NLS_CATALOGS
/*
* LOGINFIRST Source ~/.login before ~/.cshrc
*/
#undef LOGINFIRST
/*
* VIDEFAULT Make the VI mode editor the default
*/
#undef VIDEFAULT
/*
* KAI use "bye" command and rename "log" to "watchlog"
*/
#undef KAI
/*
* TESLA drops DTR on logout. Historical note:
* tesla.ee.cornell.edu was a vax11/780 with a develcon
* switch that sometimes would not hang up.
*/
#undef TESLA
/*
* DOTLAST put "." last in the default path, for security reasons
*/
#define DOTLAST
/*
* NODOT Don't put "." in the default path, for security reasons
*/
#undef NODOT
/*
* AUTOLOGOUT tries to determine if it should set autologout depending
* on the name of the tty, and environment.
* Does not make sense in the modern window systems!
*/
#define AUTOLOGOUT
/*
* SUSPENDED Newer shells say 'Suspended' instead of 'Stopped'.
* Define to get the same type of messages.
*/
#define SUSPENDED
/*
* KANJI Ignore meta-next, and the ISO character set. Should
* be used with SHORT_STRINGS
*
*/
#undef KANJI
/*
* DSPMBYTE add variable "dspmbyte" and display multi-byte string at
* only output, when "dspmbyte" is set. Should be used with
* KANJI
*/
#undef DSPMBYTE
/*
* MBYTEDEBUG when "dspmbyte" is changed, set multi-byte checktable to
* variable "mbytemap".
* (use for multi-byte table check)
*/
#undef MBYTEDEBUG
/*
* NEWGRP Provide a newgrp builtin.
*/
#undef NEWGRP
/*
* SYSMALLOC Use the system provided version of malloc and friends.
* This can be much slower and no memory statistics will be
* provided.
*/
#if defined(__MACHTEN__) || defined(PURIFY) || defined(MALLOC_TRACE) || defined(_OSD_POSIX)
# define SYSMALLOC
#else
# undef SYSMALLOC
#endif
/*
* USE_ACCESS Use access(2) rather than stat(2) when POSIX is defined.
* POSIX says to use stat, but stat(2) is less accurate
* than access(2) for determining file access.
*/
#undef USE_ACCESS
/*
* REMOTEHOST Try to determine the remote host that we logged in from
* using first getpeername, and then the utmp file. If
* successful, set $REMOTEHOST to the name or address of the
* host
*/
#define REMOTEHOST
/*
* COLOR_LS_F Do you want to use builtin color ls-F ?
*
*/
#define COLOR_LS_F
/*
* COLORCAT Do you want to colorful message ?
*
*/
#undef COLORCAT
/*
* RCSID This defines if we want rcs strings in the binary or not
*
*/
#if !defined(lint) && !defined(SABER) && !defined(__CLCC__)
# ifndef __GNUC__
# define RCSID(id) static char *rcsid = (id);
# else
# define RCSID(id) static char *rcsid(const char *a) { return rcsid(a = id); }
# endif /* !__GNUC__ */
#else
# define RCSID(id) /* Nothing */
#endif /* !lint && !SABER */
#endif /* _h_config_f */

935
contrib/tcsh/csh-mode.el Normal file
View File

@ -0,0 +1,935 @@
;; csh-mode.el --- csh (and tcsh) script editing mode for Emacs.
;;
;; Version: 1.2
;; Date: April 2, 1999
;; Maintainer: Dan Harkless <dan@wave.eng.uci.edu>
;;
;; Description:
;; csh and tcsh script editing mode for Emacs.
;;
;; Installation:
;; Put csh-mode.el in some directory in your load-path and load it.
;;
;; Usage:
;; This major mode assists shell script writers with indentation
;; control and control structure construct matching in much the same
;; fashion as other programming language modes. Invoke describe-mode
;; for more information.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Author key:
;; DH - Dan Harkless <dan@wave.eng.uci.edu>
;; CM - Carlo Migliorini <migliorini@sodalia.it>
;; JR - Jack Repenning <jackr@sgi.com>
;; GE - Gary Ellison <Gary.F.Ellison@att.com>
;;
;; *** REVISION HISTORY ***
;;
;; DATE MOD. BY REASON FOR MODIFICATION
;; --------- -- --------------------------------------------------------------
;; 2 Apr 99 DH 1.2: Noticed an out-of-date comment referencing .bashrc etc.
;; 11 Dec 96 DH 1.1: ksh-mode just indented continuation lines by 1 space.
;; csh-mode looks at the first line and indents properly to line
;; up under the open-paren, quote, or command.
;; 11 Dec 96 DH Added fontification for history substitutions.
;; 10 Dec 96 DH Added indentation and fontification for labels. Added
;; fontification for variables and backquoted strings.
;; 9 Dec 96 DH 1.0: Brought csh-mode up to the level of functionality of
;; the original ksh-mode.
;; 7 Oct 96 CM 0.1: Hacked ksh-mode.el into minimally functional csh-mode.el
;; by doing search-and-replace and some keyword changes.
;; 8 Aug 96 JR (Last modification to ksh-mode 2.6.)
;; [...]
;; 19 Jun 92 GE (Conception of ksh-mode.)
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst csh-mode-version "1.2"
"*Version number of this version of csh-mode")
(defvar csh-mode-hook
'(lambda ()
(auto-fill-mode 1))
"Hook to run each time csh-mode is entered.")
;;
;; -------------------------------------------> Variables controlling completion
;;
(defvar csh-completion-list '())
(make-variable-buffer-local 'csh-completion-list)
(set-default 'csh-completion-list '())
;;
;; -type- : type number, 0:misc, 1:variable, 2:function
;; -regexp-: regexp used to parse the script
;; -match- : used by match-beginning/end to pickup target
;;
(defvar csh-completion-type-misc 0)
(defvar csh-completion-regexp-var "\\([A-Za-z_0-9]+\\)=")
(defvar csh-completion-type-var 1)
(defvar csh-completion-match-var 1)
(defvar csh-completion-regexp-var2 "\\$\\({\\|{#\\)?\\([A-Za-z_0-9]+\\)[#%:}]?")
(defvar csh-completion-match-var2 2)
(defvar csh-completion-regexp-function
"\\(function\\)?[ \t]*\\([A-Za-z_0-9]+\\)[ \t]*([ \t]*)")
(defvar csh-completion-type-function 2)
(defvar csh-completion-match-function 2)
;;
;; ------------------------------------> Variables controlling indentation style
;;
(defvar csh-indent 4
"*Indentation of csh statements with respect to containing block. A value
of nil indicates compound list keyword \(\"do\" and \"then\"\) alignment.")
(defvar csh-case-item-offset csh-indent
"*Additional indentation for case items within a case statement.")
(defvar csh-case-indent nil
"*Additional indentation for statements under case items.")
(defvar csh-comment-regexp "^\\s *#"
"*Regular expression used to recognize comments. Customize to support
csh-like languages.")
(defvar csh-match-and-tell t
"*If non-nil echo in the minibuffer the matching compound command
for the \"breaksw\", \"end\", or \"endif\".")
(defvar csh-tab-always-indent t
"*Controls the operation of the TAB key. If t (the default), always
reindent the current line. If nil, indent the current line only if
point is at the left margin or in the line's indentation; otherwise
insert a tab.")
;;
;; ----------------------------------------> Constants containing syntax regexps
;;
(defconst csh-case-default-re
"^\\s *\\(case\\|default\\)\\b"
"Regexp used to locate grouping keywords case and default" )
(defconst csh-case-item-re "^\\s *\\(case .*\\|default\\):"
"Regexp used to match case-items")
(defconst csh-end-re "^\\s *end\\b"
"Regexp used to match keyword: end")
(defconst csh-endif-re "^\\s *endif\\b"
"Regexp used to match keyword: endif")
(defconst csh-endsw-re "^\\s *endsw\\b"
"Regexp used to match keyword: endsw")
(defconst csh-else-re "^\\s *\\belse\\(\\b\\|$\\)"
"Regexp used to match keyword: else")
(defconst csh-else-if-re "^\\s *\\belse if\\(\\b\\|$\\)"
"Regexp used to match keyword pair: else if")
(defconst csh-if-re "^\\s *if\\b.+\\(\\\\\\|\\bthen\\b\\)"
"Regexp used to match non-one-line if statements")
(defconst csh-iteration-keywords-re "^[^#\n]*\\s\"*\\b\\(while\\|foreach\\)\\b"
"Match one of the keywords: while, foreach")
(defconst csh-keywords-re
"^\\s *\\(else\\b\\|foreach\\b\\|if\\b.+\\(\\\\\\|\\bthen\\b\\)\\|switch\\b\\|while\\b\\)"
"Regexp used to detect compound command keywords: else, if, foreach, while")
(defconst csh-label-re "^\\s *[^!#$\n ]+:"
"Regexp used to match flow-control labels")
(defconst csh-multiline-re "^.*\\\\$"
"Regexp used to match a line with a statement using more lines.")
(defconst csh-switch-re "^\\s *switch\\b"
"Regexp used to match keyword: switch")
;;
;; ----------------------------------------> Variables controlling fontification
;;
(defvar csh-keywords '("@" "alias" "bg" "break" "breaksw" "case" "cd" "chdir"
"continue" "default" "dirs" "echo" "else" "end" "endif"
"endsw" "eval" "exec" "exit" "fg" "foreach" "glob" "goto"
"hashstat" "history" "if" "jobs" "kill" "limit" "login"
"logout" "limit" "notify" "onintr" "popd" "printenv"
"pushd" "rehash" "repeat" "set" "setenv" "shift" "source"
"stop" "suspend" "switch" "then" "time" "umask" "unalias"
"unhash" "unlimit" "unset" "unsetenv" "wait" "while"
;; tcsh-keywords
"alloc" "bindkey" "builtins" "complete" "echotc"
"filetest" "hup" "log" "ls-F" "nice" "nohup" "sched"
"settc" "setty" "telltc" "uncomplete" "where" "which"))
(require 'font-lock) ; need to do this before referring to font-lock-* below
(defconst csh-font-lock-keywords
;; NOTE: The order of some of the items in this list is significant. Do not
;; alphabetize or otherwise blindly rearrange.
(list
;; Comments on line 1, which are missed by syntactic fontification.
'("^#.*" 0 font-lock-comment-face)
;; Label definitions (1 means first parenthesized exp in regexp).
'("^\\s *\\([^!#$\n ]+\\):" 1 font-lock-function-name-face)
;; Label references.
'("\\b\\(goto\\|onintr\\)\\b\\s +\\([^!#$ \n\t]+\\)"
2 font-lock-function-name-face)
;; Variable settings.
'("\\(@\\|set\\|setenv\\)\\s +\\([0-9A-Za-z_]+\\b\\)"
2 font-lock-variable-name-face)
;; Variable references not inside of strings.
'("\\$[][0-9A-Za-z_#:?]+" 0 font-lock-variable-name-face)
;; Backquoted strings. 'keep' means to just fontify non-fontified text.
'("`\\(.*\\)`" 1 font-lock-reference-face keep)
;; NOTE: The following variables need to be anchored to the beginning of
;; line to prevent re-fontifying text in comments. Due to this, we
;; can only catch a finite number of occurrences. More can be added.
;; The 't' means to override previous fontification.
;;
;; Variable references inside of " strings.
'("^[^#\n]*\".*\\(\\$[][0-9A-Za-z_#:?]+\\).*\""
1 font-lock-variable-name-face t) ; 1
'("^[^#\n]*\".*\\(\\$[][0-9A-Za-z_#:?]+\\).*\\$[][0-9A-Za-z_#:?]+.*\""
1 font-lock-variable-name-face t) ; 2
(cons (concat "^[^#\n]*\".*\\(\\$[][0-9A-Za-z_#:?]+\\).*"
"\\$[][0-9A-Za-z_#:?]+.*\\$[][0-9A-Za-z_#:?]+.*\"")
(list 1 font-lock-variable-name-face t)) ; 3
;;
;; History substitutions.
'("^![^~= \n\t]+" 0 font-lock-reference-face t) ; BOL
'("^[^#\n]*[^#\\\n]\\(![^~= \n\t]+\\)" 1 font-lock-reference-face t) ; 1
'("^[^#\n]*[^#\\\n]\\(![^~= \n\t]+\\).*![^~= \n\t]+"
1 font-lock-reference-face t) ; 2
;; Keywords.
(cons (concat
"\\(\\<"
(mapconcat 'identity csh-keywords "\\>\\|\\<")
"\\>\\)")
1)
))
(put 'csh-mode 'font-lock-keywords 'csh-font-lock-keywords)
;;
;; -------------------------------------------------------> Mode-specific tables
;;
(defvar csh-mode-abbrev-table nil
"Abbrev table used while in csh mode.")
(define-abbrev-table 'csh-mode-abbrev-table ())
(defvar csh-mode-map nil
"Keymap used in csh mode")
(if csh-mode-map
()
(setq csh-mode-map (make-sparse-keymap))
;;(define-key csh-mode-map "\177" 'backward-delete-char-untabify)
(define-key csh-mode-map "\C-c\t" 'csh-completion-init-and-pickup)
(define-key csh-mode-map "\C-j" 'reindent-then-newline-and-indent)
(define-key csh-mode-map "\e\t" 'csh-complete-symbol)
(define-key csh-mode-map "\n" 'reindent-then-newline-and-indent)
(define-key csh-mode-map '[return] 'reindent-then-newline-and-indent)
(define-key csh-mode-map "\t" 'csh-indent-command)
;;(define-key csh-mode-map "\t" 'csh-indent-line)
)
(defvar csh-mode-syntax-table nil
"Syntax table used while in csh mode.")
(if csh-mode-syntax-table
;; If it's already set up, don't change it.
()
;; Else, create it from the standard table and modify entries that need to be.
(setq csh-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?& "." csh-mode-syntax-table) ; & -punctuation
(modify-syntax-entry ?* "." csh-mode-syntax-table) ; * -punctuation
(modify-syntax-entry ?- "." csh-mode-syntax-table) ; - -punctuation
(modify-syntax-entry ?= "." csh-mode-syntax-table) ; = -punctuation
(modify-syntax-entry ?+ "." csh-mode-syntax-table) ; + -punctuation
(modify-syntax-entry ?| "." csh-mode-syntax-table) ; | -punctuation
(modify-syntax-entry ?< "." csh-mode-syntax-table) ; < -punctuation
(modify-syntax-entry ?> "." csh-mode-syntax-table) ; > -punctuation
(modify-syntax-entry ?/ "." csh-mode-syntax-table) ; / -punctuation
(modify-syntax-entry ?\' "\"" csh-mode-syntax-table) ; ' -string quote
(modify-syntax-entry ?. "w" csh-mode-syntax-table) ; . -word constituent
(modify-syntax-entry ?? "w" csh-mode-syntax-table) ; ? -word constituent
;; \n - comment ender, first character of 2-char comment sequence
(modify-syntax-entry ?\n "> 1" csh-mode-syntax-table) ; # -word constituent
;; - whitespace, first character of 2-char comment sequence
(modify-syntax-entry ? " 1" csh-mode-syntax-table) ;
;; \t - whitespace, first character of 2-char comment sequence
(modify-syntax-entry ?\t " 1" csh-mode-syntax-table) ; # -word constituent
;; # - word constituent, second character of 2-char comment sequence
(modify-syntax-entry ?# "w 2" csh-mode-syntax-table) ; # -word constituent
)
;;
;; ------------------------------------------------------------------> Functions
;;
(defun csh-current-line ()
"Return the vertical position of point in the buffer.
Top line is 1."
(+ (count-lines (point-min) (point))
(if (= (current-column) 0) 1 0))
)
(defun csh-get-compound-level
(begin-re end-re anchor-point &optional balance-list)
"Determine how much to indent this structure. Return a list (level line)
of the matching compound command or nil if no match found."
(let*
(;; Locate the next compound begin keyword bounded by point-min
(match-point (if (re-search-backward begin-re (point-min) t)
(match-beginning 0) 0))
(nest-column (if (zerop match-point)
1
(progn
(goto-char match-point)
(current-indentation))))
(nest-list (cons 0 0)) ;; sentinel cons since cdr is >= 1
)
(if (zerop match-point)
nil ;; graceful exit from recursion
(progn
(if (nlistp balance-list)
(setq balance-list (list)))
;; Now search forward from matching start keyword for end keyword
(while (and (consp nest-list) (zerop (cdr nest-list))
(re-search-forward end-re anchor-point t))
(if (not (memq (point) balance-list))
(progn
(setq balance-list (cons (point) balance-list))
(goto-char match-point) ;; beginning of compound cmd
(setq nest-list
(csh-get-compound-level begin-re end-re
anchor-point balance-list))
)))
(cond ((consp nest-list)
(if (zerop (cdr nest-list))
(progn
(goto-char match-point)
(cons nest-column (csh-current-line)))
nest-list))
(t nil)
)
)
)
)
)
(defun csh-get-nest-level ()
"Return a 2 element list (nest-level nest-line) describing where the
current line should nest."
(let ((case-fold-search)
(level))
(save-excursion
(forward-line -1)
(while (and (not (bobp))
(null level))
(if (and (not (looking-at "^\\s *$"))
(not (save-excursion
(forward-line -1)
(beginning-of-line)
(looking-at csh-multiline-re)))
(not (looking-at csh-comment-regexp)))
(setq level (cons (current-indentation)
(csh-current-line)))
(forward-line -1)
);; if
);; while
(if (null level)
(cons (current-indentation) (csh-current-line))
level)
)
)
)
(defun csh-get-nester-column (nest-line)
"Return the column to indent to with respect to nest-line taking
into consideration keywords and other nesting constructs."
(save-excursion
(let ((fence-post)
(case-fold-search)
(start-line (csh-current-line)))
;;
;; Handle case item indentation constructs for this line
(cond ((looking-at csh-case-item-re)
;; This line is a case item...
(save-excursion
(goto-line nest-line)
(let ((fence-post (save-excursion (end-of-line) (point))))
(cond ((re-search-forward csh-switch-re fence-post t)
;; If this is the first case under the switch, indent.
(goto-char (match-beginning 0))
(+ (current-indentation) csh-case-item-offset))
((re-search-forward csh-case-item-re fence-post t)
;; If this is another case right under a previous case
;; without intervening code, stay at the same
;; indentation.
(goto-char (match-beginning 0))
(current-indentation))
(t
;; Else, this is a new case. Outdent.
(- (current-indentation) csh-case-item-offset))
)
)))
(t;; Not a case-item. What to do relative to the nest-line?
(save-excursion
(goto-line nest-line)
(setq fence-post (save-excursion (end-of-line) (point)))
(save-excursion
(cond
;;
;; Check if we are in a continued statement
((and (looking-at csh-multiline-re)
(save-excursion
(goto-line (1- start-line))
(looking-at csh-multiline-re)))
(if (looking-at ".*[\'\"]\\\\")
;; If this is a continued string, indent under
;; opening quote.
(progn
(re-search-forward "[\'\"]")
(forward-char -1))
(if (looking-at ".*([^\)\n]*\\\\")
;; Else if this is a continued parenthesized
;; list, indent after paren.
(re-search-forward "(" fence-post t)
;; Else, indent after whitespace after first word.
(re-search-forward "[^ \t]+[ \t]+" fence-post t)))
(current-column))
;; In order to locate the column of the keyword,
;; which might be embedded within a case-item,
;; it is necessary to use re-search-forward.
;; Search by literal case, since shell is
;; case-sensitive.
((re-search-forward csh-keywords-re fence-post t)
(goto-char (match-beginning 1))
(if (looking-at csh-switch-re)
(+ (current-indentation) csh-case-item-offset)
(+ (current-indentation)
(if (null csh-indent)
2 csh-indent)
)))
((re-search-forward csh-case-default-re fence-post t)
(if (null csh-indent)
(progn
(goto-char (match-end 1))
(+ (current-indentation) 1))
(progn
(goto-char (match-beginning 1))
(+ (current-indentation) csh-indent))
))
;;
;; Now detect first statement under a case item
((looking-at csh-case-item-re)
(if (null csh-case-indent)
(progn
(re-search-forward csh-case-item-re fence-post t)
(goto-char (match-end 1))
(+ (current-column) 1))
(+ (current-indentation) csh-case-indent)))
;;
;; If this is the first statement under a control-flow
;; label, indent one level.
((csh-looking-at-label)
(+ (current-indentation) csh-indent))
;; This is hosed when using current-column
;; and there is a multi-command expression as the
;; nester.
(t (current-indentation)))
)
));; excursion over
);; Not a case-item
);;let
);; excursion
);; defun
(defun csh-indent-command ()
"Indent current line relative to containing block and allow for
csh-tab-always-indent customization"
(interactive)
(let (case-fold-search)
(cond ((save-excursion
(skip-chars-backward " \t")
(bolp))
(csh-indent-line))
(csh-tab-always-indent
(save-excursion
(csh-indent-line)))
(t (insert-tab))
))
)
(defun csh-indent-line ()
"Indent current line as far as it should go according
to the syntax/context"
(interactive)
(let (case-fold-search)
(save-excursion
(beginning-of-line)
(if (bobp)
nil
;;
;; Align this line to current nesting level
(let*
(
(level-list (csh-get-nest-level)) ; Where to nest against
;; (last-line-level (car level-list))
(this-line-level (current-indentation))
(nester-column (csh-get-nester-column (cdr level-list)))
(struct-match (csh-match-structure-and-reindent))
)
(if struct-match
(setq nester-column struct-match))
(if (eq nester-column this-line-level)
nil
(beginning-of-line)
(let ((beg (point)))
(back-to-indentation)
(delete-region beg (point)))
(indent-to nester-column))
);; let*
);; if
);; excursion
;;
;; Position point on this line
(let*
(
(this-line-level (current-indentation))
(this-bol (save-excursion
(beginning-of-line)
(point)))
(this-point (- (point) this-bol))
)
(cond ((> this-line-level this-point);; point in initial white space
(back-to-indentation))
(t nil)
);; cond
);; let*
);; let
);; defun
(defun csh-indent-region (start end)
"From start to end, indent each line."
;; The algorithm is just moving through the region line by line with
;; the match noise turned off. Only modifies nonempty lines.
(save-excursion
(let (csh-match-and-tell
(endmark (copy-marker end)))
(goto-char start)
(beginning-of-line)
(setq start (point))
(while (> (marker-position endmark) start)
(if (not (and (bolp) (eolp)))
(csh-indent-line))
(forward-line 1)
(setq start (point)))
(set-marker endmark nil)
)
)
)
(defun csh-line-to-string ()
"From point, construct a string from all characters on
current line"
(skip-chars-forward " \t") ;; skip tabs as well as spaces
(buffer-substring (point)
(progn
(end-of-line 1)
(point))))
(defun csh-looking-at-label ()
"Return true if current line is a label (not the default: case label)."
(and
(looking-at csh-label-re)
(not (looking-at "^\\s *default:"))))
(defun csh-match-indent-level (begin-re end-re)
"Match the compound command and indent. Return nil on no match,
indentation to use for this line otherwise."
(interactive)
(let* ((case-fold-search)
(nest-list
(save-excursion
(csh-get-compound-level begin-re end-re (point))
))
) ;; bindings
(if (null nest-list)
(progn
(if csh-match-and-tell
(message "No matching compound command"))
nil) ;; Propagate a miss.
(let* (
(nest-level (car nest-list))
(match-line (cdr nest-list))
) ;; bindings
(if csh-match-and-tell
(save-excursion
(goto-line match-line)
(message "Matched ... %s" (csh-line-to-string))
) ;; excursion
) ;; if csh-match-and-tell
nest-level ;;Propagate a hit.
) ;; let*
) ;; if
) ;; let*
) ;; defun csh-match-indent-level
(defun csh-match-structure-and-reindent ()
"If the current line matches one of the indenting keywords
or one of the control structure ending keywords then reindent. Also
if csh-match-and-tell is non-nil the matching structure will echo in
the minibuffer"
(interactive)
(let (case-fold-search)
(save-excursion
(beginning-of-line)
(cond ((looking-at csh-else-re)
(csh-match-indent-level csh-if-re csh-endif-re))
((looking-at csh-else-if-re)
(csh-match-indent-level csh-if-re csh-endif-re))
((looking-at csh-endif-re)
(csh-match-indent-level csh-if-re csh-endif-re))
((looking-at csh-end-re)
(csh-match-indent-level csh-iteration-keywords-re csh-end-re))
((looking-at csh-endsw-re)
(csh-match-indent-level csh-switch-re csh-endsw-re))
((csh-looking-at-label)
;; Flush control-flow labels left since they don't nest.
0)
;;
(t nil)
);; cond
)
))
;;;###autoload
(defun csh-mode ()
"csh-mode 2.0 - Major mode for editing csh and tcsh scripts.
Special key bindings and commands:
\\{csh-mode-map}
Variables controlling indentation style:
csh-indent
Indentation of csh statements with respect to containing block.
Default value is 4.
csh-case-indent
Additional indentation for statements under case items.
Default value is nil which will align the statements one position
past the \")\" of the pattern.
csh-case-item-offset
Additional indentation for case items within a case statement.
Default value is 2.
csh-tab-always-indent
Controls the operation of the TAB key. If t (the default), always
reindent the current line. If nil, indent the current line only if
point is at the left margin or in the line's indentation; otherwise
insert a tab.
csh-match-and-tell
If non-nil echo in the minibuffer the matching compound command
for the \"done\", \"}\", \"fi\", or \"endsw\". Default value is t.
csh-comment-regexp
Regular expression used to recognize comments. Customize to support
csh-like languages. Default value is \"\^\\\\s *#\".
Style Guide.
By setting
(setq csh-indent default-tab-width)
The following style is obtained:
if [ -z $foo ]
then
bar # <-- csh-group-offset is additive to csh-indent
foo
fi
By setting
(setq csh-indent default-tab-width)
(setq csh-group-offset (- 0 csh-indent))
The following style is obtained:
if [ -z $foo ]
then
bar
foo
fi
By setting
(setq csh-case-item-offset 1)
(setq csh-case-indent nil)
The following style is obtained:
case x in *
foo) bar # <-- csh-case-item-offset
baz;; # <-- csh-case-indent aligns with \")\"
foobar) foo
bar;;
endsw
By setting
(setq csh-case-item-offset 1)
(setq csh-case-indent 6)
The following style is obtained:
case x in *
foo) bar # <-- csh-case-item-offset
baz;; # <-- csh-case-indent
foobar) foo
bar;;
endsw
Installation:
Put csh-mode.el in some directory in your load-path.
Put the following forms in your .emacs file.
(setq auto-mode-alist
(append auto-mode-alist
(list
'(\"\\\\.csh$\" . csh-mode)
'(\"\\\\.login\" . csh-mode))))
(setq csh-mode-hook
(function (lambda ()
(font-lock-mode 1) ;; font-lock the buffer
(setq csh-indent 8)
(setq csh-tab-always-indent t)
(setq csh-match-and-tell t)
(setq csh-align-to-keyword t) ;; Turn on keyword alignment
)))"
(interactive)
(kill-all-local-variables)
(use-local-map csh-mode-map)
(setq major-mode 'csh-mode)
(setq mode-name "Csh")
(setq local-abbrev-table csh-mode-abbrev-table)
(set-syntax-table csh-mode-syntax-table)
(make-local-variable 'indent-line-function)
(setq indent-line-function 'csh-indent-line)
(make-local-variable 'indent-region-function)
(setq indent-region-function 'csh-indent-region)
(make-local-variable 'comment-start)
(setq comment-start "# ")
(make-local-variable 'comment-end)
(setq comment-end "")
(make-local-variable 'comment-column)
(setq comment-column 32)
(make-local-variable 'comment-start-skip)
(setq comment-start-skip "#+ *")
;;
;; config font-lock mode
(make-local-variable 'font-lock-keywords)
(setq font-lock-keywords csh-font-lock-keywords)
;;
;; Let the user customize
(run-hooks 'csh-mode-hook)
) ;; defun
;;
;; Completion code supplied by Haavard Rue <hrue@imf.unit.no>.
;;
;;
;; add a completion with a given type to the list
;;
(defun csh-addto-alist (completion type)
(setq csh-completion-list
(append csh-completion-list
(list (cons completion type)))))
(defun csh-bol-point ()
(save-excursion
(beginning-of-line)
(point)))
(defun csh-complete-symbol ()
"Perform completion."
(interactive)
(let* ((case-fold-search)
(end (point))
(beg (unwind-protect
(save-excursion
(backward-sexp 1)
(while (= (char-syntax (following-char)) ?\')
(forward-char 1))
(point))))
(pattern (buffer-substring beg end))
(predicate
;;
;; ` or $( mark a function
;;
(save-excursion
(goto-char beg)
(if (or
(save-excursion
(backward-char 1)
(looking-at "`"))
(save-excursion
(backward-char 2)
(looking-at "\\$(")))
(function (lambda (sym)
(equal (cdr sym) csh-completion-type-function)))
;;
;; a $, ${ or ${# mark a variable
;;
(if (or
(save-excursion
(backward-char 1)
(looking-at "\\$"))
(save-excursion
(backward-char 2)
(looking-at "\\${"))
(save-excursion
(backward-char 3)
(looking-at "\\${#")))
(function (lambda (sym)
(equal (cdr sym)
csh-completion-type-var)))
;;
;; don't know. use 'em all
;;
(function (lambda (sym) t))))))
;;
(completion (try-completion pattern csh-completion-list predicate)))
;;
(cond ((eq completion t))
;;
;; oops, what is this ?
;;
((null completion)
(message "Can't find completion for \"%s\"" pattern))
;;
;; insert
;;
((not (string= pattern completion))
(delete-region beg end)
(insert completion))
;;
;; write possible completion in the minibuffer,
;; use this instead of a seperate buffer (usual)
;;
(t
(let ((list (all-completions pattern csh-completion-list predicate))
(string ""))
(while list
(progn
(setq string (concat string (format "%s " (car list))))
(setq list (cdr list))))
(message string))))))
;;
;; init the list and pickup all
;;
(defun csh-completion-init-and-pickup ()
(interactive)
(let (case-fold-search)
(csh-completion-list-init)
(csh-pickup-all)))
;;
;; init the list
;;
(defun csh-completion-list-init ()
(interactive)
(setq csh-completion-list
(list
(cons "break" csh-completion-type-misc)
(cons "breaksw" csh-completion-type-misc)
(cons "case" csh-completion-type-misc)
(cons "continue" csh-completion-type-misc)
(cons "endif" csh-completion-type-misc)
(cons "exit" csh-completion-type-misc)
(cons "foreach" csh-completion-type-misc)
(cons "if" csh-completion-type-misc)
(cons "while" csh-completion-type-misc))))
(defun csh-eol-point ()
(save-excursion
(end-of-line)
(point)))
(defun csh-pickup-all ()
"Pickup all completions in buffer."
(interactive)
(csh-pickup-completion-driver (point-min) (point-max) t))
(defun csh-pickup-completion (regexp type match pmin pmax)
"Pickup completion in region and addit to the list, if not already
there."
(let ((i 0) kw obj)
(save-excursion
(goto-char pmin)
(while (and
(re-search-forward regexp pmax t)
(match-beginning match)
(setq kw (buffer-substring
(match-beginning match)
(match-end match))))
(progn
(setq obj (assoc kw csh-completion-list))
(if (or (equal nil obj)
(and (not (equal nil obj))
(not (= type (cdr obj)))))
(progn
(setq i (1+ i))
(csh-addto-alist kw type))))))
i))
(defun csh-pickup-completion-driver (pmin pmax message)
"Driver routine for csh-pickup-completion."
(if message
(message "pickup completion..."))
(let* (
(i1
(csh-pickup-completion csh-completion-regexp-var
csh-completion-type-var
csh-completion-match-var
pmin pmax))
(i2
(csh-pickup-completion csh-completion-regexp-var2
csh-completion-type-var
csh-completion-match-var2
pmin pmax))
(i3
(csh-pickup-completion csh-completion-regexp-function
csh-completion-type-function
csh-completion-match-function
pmin pmax)))
(if message
(message "pickup %d variables and %d functions." (+ i1 i2) i3))))
(defun csh-pickup-this-line ()
"Pickup all completions in current line."
(interactive)
(csh-pickup-completion-driver (csh-bol-point) (csh-eol-point) nil))
(provide 'csh-mode)
;;; csh-mode.el ends here

4005
contrib/tcsh/ed.chared.c Normal file

File diff suppressed because it is too large Load Diff

274
contrib/tcsh/ed.decls.h Normal file
View File

@ -0,0 +1,274 @@
/* $Header: /src/pub/tcsh/ed.decls.h,v 3.28 1998/09/04 21:16:38 christos Exp $ */
/*
* ed.decls.h: Editor external definitions
*/
/*-
* Copyright (c) 1980, 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _h_ed_decls
#define _h_ed_decls
/*
* ed.chared.c
*/
extern int InsertStr __P((Char *));
extern void DeleteBack __P((int));
/*
* ed.init.c
*/
#ifdef SIG_WINDOW
extern void check_window_size __P((int));
extern sigret_t window_change __P((int));
#endif /* SIG_WINDOW */
extern int ed_Setup __P((int));
extern void ed_Init __P((void));
extern int Cookedmode __P((void));
extern int Rawmode __P((void));
extern void ed_set_tty_eight_bit __P((void));
extern void QuoteModeOn __P((void));
extern void QuoteModeOff __P((void));
extern void ResetInLine __P((int));
extern int Load_input_line __P((void));
/*
* ed.term.c:
*/
extern void dosetty __P((Char **, struct command *));
extern int tty_getty __P((int, ttydata_t *));
extern int tty_setty __P((int, ttydata_t *));
extern void tty_getchar __P((ttydata_t *, unsigned char *));
extern void tty_setchar __P((ttydata_t *, unsigned char *));
extern speed_t tty_getspeed __P((ttydata_t *));
extern int tty_gettabs __P((ttydata_t *));
extern int tty_geteightbit __P((ttydata_t *));
extern int tty_cooked_mode __P((ttydata_t *));
#ifdef _IBMR2
extern void tty_setdisc __P((int, int));
#endif /* _IBMR2 */
/*
* ed.screen.c
*/
extern void terminit __P((void));
extern void SetAttributes __P((int));
extern void so_write __P((Char *, int));
extern void ClearScreen __P((void));
extern void MoveToLine __P((int));
extern void MoveToChar __P((int));
extern void ClearEOL __P((int));
extern void Insert_write __P((Char *, int));
extern void DeleteChars __P((int));
extern void TellTC __P((char *));
extern void SetTC __P((char *, char *));
extern void EchoTC __P((Char **));
extern int SetArrowKeys __P((CStr *, XmapVal *, int));
extern int IsArrowKey __P((Char *));
extern void ResetArrowKeys __P((void));
extern void DefaultArrowKeys __P((void));
extern int ClearArrowKeys __P((CStr *));
extern void PrintArrowKeys __P((CStr *));
extern void BindArrowKeys __P((void));
extern void SoundBeep __P((void));
extern int CanWeTab __P((void));
extern void ChangeSize __P((int, int));
#ifdef SIG_WINDOW
extern int GetSize __P((int *, int *));
#endif /* SIG_WINDOW */
extern void ClearToBottom __P((void));
extern void GetTermCaps __P((void));
/*
* ed.defns.c
*/
extern void editinit __P((void));
extern void ed_InitNLSMaps __P((void));
#ifdef DEBUG_EDIT
extern void CheckMaps __P((void));
#endif
extern void ed_InitMaps __P((void));
extern void ed_InitEmacsMaps __P((void));
extern void ed_InitVIMaps __P((void));
extern CCRETVAL e_unassigned __P((int));
extern CCRETVAL e_insert __P((int));
extern CCRETVAL e_newline __P((int));
extern CCRETVAL e_delprev __P((int));
extern CCRETVAL e_delnext __P((int));
/* added by mtk@ari.ncl.omron.co.jp (920818) */
extern CCRETVAL e_delnext_eof __P((int));
extern CCRETVAL e_delnext_list __P((int));
extern CCRETVAL e_delnext_list_eof __P((int)); /* for ^D */
extern CCRETVAL e_toend __P((int));
extern CCRETVAL e_tobeg __P((int));
extern CCRETVAL e_charback __P((int));
extern CCRETVAL e_charfwd __P((int));
extern CCRETVAL e_quote __P((int));
extern CCRETVAL e_startover __P((int));
extern CCRETVAL e_redisp __P((int));
extern CCRETVAL e_wordback __P((int));
extern CCRETVAL e_wordfwd __P((int));
extern CCRETVAL v_wordbegnext __P((int));
extern CCRETVAL e_uppercase __P((int));
extern CCRETVAL e_lowercase __P((int));
extern CCRETVAL e_capitolcase __P((int));
extern CCRETVAL e_cleardisp __P((int));
extern CCRETVAL e_complete __P((int));
extern CCRETVAL e_correct __P((int));
extern CCRETVAL e_correctl __P((int));
extern CCRETVAL e_up_hist __P((int));
extern CCRETVAL e_down_hist __P((int));
extern CCRETVAL e_up_search_hist __P((int));
extern CCRETVAL e_down_search_hist __P((int));
extern CCRETVAL e_helpme __P((int));
extern CCRETVAL e_list_choices __P((int));
extern CCRETVAL e_delwordprev __P((int));
extern CCRETVAL e_delwordnext __P((int));
extern CCRETVAL e_digit __P((int));
extern CCRETVAL e_argdigit __P((int));
extern CCRETVAL v_zero __P((int));
extern CCRETVAL e_killend __P((int));
extern CCRETVAL e_killbeg __P((int));
extern CCRETVAL e_metanext __P((int));
#ifdef notdef
extern CCRETVAL e_extendnext __P((int));
#endif
extern CCRETVAL e_send_eof __P((int));
extern CCRETVAL e_charswitch __P((int));
extern CCRETVAL e_gcharswitch __P((int));
extern CCRETVAL e_which __P((int));
extern CCRETVAL e_yank_kill __P((int));
extern CCRETVAL e_tty_dsusp __P((int));
extern CCRETVAL e_tty_flusho __P((int));
extern CCRETVAL e_tty_quit __P((int));
extern CCRETVAL e_tty_tsusp __P((int));
extern CCRETVAL e_tty_stopo __P((int));
extern CCRETVAL e_tty_starto __P((int));
extern CCRETVAL e_argfour __P((int));
extern CCRETVAL e_set_mark __P((int));
extern CCRETVAL e_exchange_mark __P((int));
extern CCRETVAL e_last_item __P((int));
extern CCRETVAL v_cmd_mode __P((int));
extern CCRETVAL v_insert __P((int));
extern CCRETVAL v_replmode __P((int));
extern CCRETVAL v_replone __P((int));
extern CCRETVAL v_substline __P((int));
extern CCRETVAL v_substchar __P((int));
extern CCRETVAL v_add __P((int));
extern CCRETVAL v_addend __P((int));
extern CCRETVAL v_insbeg __P((int));
extern CCRETVAL v_chgtoend __P((int));
extern CCRETVAL e_killregion __P((int));
extern CCRETVAL e_killall __P((int));
extern CCRETVAL e_copyregion __P((int));
extern CCRETVAL e_tty_int __P((int));
extern CCRETVAL e_run_fg_editor __P((int));
extern CCRETVAL e_list_eof __P((int));
extern CCRETVAL e_expand_history __P((int));
extern CCRETVAL e_magic_space __P((int));
extern CCRETVAL e_list_glob __P((int));
extern CCRETVAL e_expand_glob __P((int));
extern CCRETVAL e_insovr __P((int));
extern CCRETVAL v_cm_complete __P((int));
extern CCRETVAL e_copyprev __P((int));
extern CCRETVAL v_change_case __P((int));
extern CCRETVAL e_expand __P((int));
extern CCRETVAL e_expand_vars __P((int));
extern CCRETVAL e_toggle_hist __P((int));
extern CCRETVAL e_load_average __P((int));
extern CCRETVAL v_delprev __P((int));
extern CCRETVAL v_delmeta __P((int));
extern CCRETVAL v_wordfwd __P((int));
extern CCRETVAL v_wordback __P((int));
extern CCRETVAL v_endword __P((int));
extern CCRETVAL v_eword __P((int));
extern CCRETVAL v_undo __P((int));
extern CCRETVAL v_ush_meta __P((int));
extern CCRETVAL v_dsh_meta __P((int));
extern CCRETVAL v_rsrch_fwd __P((int));
extern CCRETVAL v_rsrch_back __P((int));
extern CCRETVAL v_char_fwd __P((int));
extern CCRETVAL v_char_back __P((int));
extern CCRETVAL v_chgmeta __P((int));
extern CCRETVAL e_inc_fwd __P((int));
extern CCRETVAL e_inc_back __P((int));
extern CCRETVAL v_rchar_fwd __P((int));
extern CCRETVAL v_rchar_back __P((int));
extern CCRETVAL v_charto_fwd __P((int));
extern CCRETVAL v_charto_back __P((int));
extern CCRETVAL e_normalize_path __P((int));
extern CCRETVAL e_normalize_command __P((int));
extern CCRETVAL e_stuff_char __P((int));
extern CCRETVAL e_list_all __P((int));
extern CCRETVAL e_complete_all __P((int));
extern CCRETVAL e_complete_fwd __P((int));
extern CCRETVAL e_complete_back __P((int));
extern CCRETVAL e_dabbrev_expand __P((int));
extern CCRETVAL e_copy_to_clipboard __P((int));
extern CCRETVAL e_paste_from_clipboard __P((int));
extern CCRETVAL e_dosify_next __P((int));
extern CCRETVAL e_dosify_prev __P((int));
/*
* ed.inputl.c
*/
extern int Inputl __P((void));
extern int GetNextChar __P((Char *));
extern void PushMacro __P((Char *));
/*
* ed.refresh.c
*/
extern void ClearLines __P((void));
extern void ClearDisp __P((void));
extern void Refresh __P((void));
extern void RefCursor __P((void));
extern void RefPlusOne __P((void));
extern void PastBottom __P((void));
/*
* ed.xmap.c
*/
extern XmapVal *XmapStr __P((CStr *));
extern XmapVal *XmapCmd __P((int));
extern void AddXkey __P((CStr *, XmapVal *, int));
extern void ClearXkey __P((KEYCMD *, CStr *));
extern int GetXkey __P((CStr *, XmapVal *));
extern void ResetXmap __P((void));
extern int DeleteXkey __P((CStr *));
extern void PrintXkey __P((CStr *));
extern int printOne __P((CStr *, XmapVal *, int));
extern int parseescape __P((const Char **));
extern unsigned char *unparsestring __P((CStr *, unsigned char *, Char *));
#endif /* _h_ed_decls */

1949
contrib/tcsh/ed.defns.c Normal file

File diff suppressed because it is too large Load Diff

254
contrib/tcsh/ed.h Normal file
View File

@ -0,0 +1,254 @@
/* $Header: /src/pub/tcsh/ed.h,v 3.28 1998/11/24 18:17:21 christos Exp $ */
/*
* ed.h: Editor declarations and globals
*/
/*-
* Copyright (c) 1980, 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _h_ed
#define _h_ed
#ifndef EXTERN
# define EXTERN extern
#endif
#define TABSIZE 8 /* usually 8 spaces/tab */
#define MAXMACROLEVELS 10 /* max number of nested kbd macros */
#ifndef WINNT
# define NT_NUM_KEYS 256
#endif /* WINNT */
extern int errno;
/****************************************************************************/
/* stuff for the different states returned by the character editor routines */
/****************************************************************************/
#define CCRETVAL char /* size needed for the different char editor */
/* return values */
#define KEYCMD unsigned char /* size needed to index into CcFuncTbl */
/* Must be unsigned */
typedef CCRETVAL(*PFCmd) __P((int)); /* pointer to function returning CCRETVAL */
struct KeyFuncs { /* for the "bind" shell command */
char *name; /* function name for bind command */
int func; /* function numeric value */
char *desc; /* description of function */
};
extern PFCmd CcFuncTbl[]; /* table of available commands */
extern KEYCMD CcKeyMap[]; /* keymap table, each index into above tbl */
extern KEYCMD CcAltMap[]; /* Alt keymap table */
extern KEYCMD CcEmacsMap[]; /* keymap table for Emacs default bindings */
extern KEYCMD CcViCmdMap[]; /* for Vi command mode defaults */
extern struct KeyFuncs FuncNames[]; /* string names vs. CcFuncTbl indices */
extern KEYCMD NumFuns; /* number of KEYCMDs in above table */
#define CC_ERROR 100 /* there should NOT be 100 different... */
#define CC_FATAL 101 /* fatal error: inconsistant, must
* reset */
#define CC_NORM 0
#define CC_NEWLINE 1
#define CC_EOF 2
#define CC_COMPLETE 3
#define CC_LIST_CHOICES 4
#define CC_LIST_GLOB 5
#define CC_EXPAND_GLOB 6
#define CC_HELPME 9
#define CC_CORRECT 10
#define CC_WHICH 11
#define CC_ARGHACK 12
#define CC_CORRECT_L 13
#define CC_REFRESH 14
#define CC_EXPAND_VARS 15
#define CC_NORMALIZE_PATH 16
#define CC_LIST_ALL 17
#define CC_COMPLETE_ALL 18
#define CC_COMPLETE_FWD 19
#define CC_COMPLETE_BACK 20
#define CC_NORMALIZE_COMMAND 21
typedef struct {
Char *buf;
int len;
} CStr;
typedef union Xmapval { /* value passed to the Xkey routines */
KEYCMD cmd;
CStr str;
} XmapVal;
#define XK_NOD -1 /* Internal tree node */
#define XK_CMD 0 /* X-key was an editor command */
#define XK_STR 1 /* X-key was a string macro */
#define XK_EXE 2 /* X-key was a unix command */
/****************************/
/* Editor state and buffers */
/****************************/
EXTERN KEYCMD *CurrentKeyMap; /* current command key map */
EXTERN int inputmode; /* insert, replace, replace1 mode */
EXTERN Char GettingInput; /* true if getting an input line (mostly) */
EXTERN Char NeedsRedraw; /* for editor and twenex error messages */
EXTERN Char InputBuf[INBUFSIZE]; /* the real input data */
EXTERN Char *LastChar, *Cursor; /* point to the next open space */
EXTERN Char *InputLim; /* limit of size of InputBuf */
EXTERN Char MetaNext; /* flags for ^V and ^[ functions */
EXTERN Char AltKeyMap; /* Using alternative command map (for vi mode) */
EXTERN Char VImode; /* true if running in vi mode (PWP 6-27-88) */
EXTERN Char *Mark; /* the emacs "mark" (dot is Cursor) */
EXTERN Char DoingArg; /* true if we have an argument */
EXTERN int Argument; /* "universal" argument value */
EXTERN KEYCMD LastCmd; /* previous command executed */
EXTERN Char KillBuf[INBUFSIZE]; /* kill buffer */
EXTERN Char *LastKill; /* points to end of kill buffer */
EXTERN Char UndoBuf[INBUFSIZE];
EXTERN Char *UndoPtr;
EXTERN int UndoSize;
EXTERN int UndoAction;
EXTERN Char HistBuf[INBUFSIZE]; /* history buffer */
EXTERN Char *LastHist; /* points to end of history buffer */
EXTERN int Hist_num; /* what point up the history we are at now. */
EXTERN Char WhichBuf[INBUFSIZE]; /* buffer for which command */
EXTERN Char *LastWhich; /* points to end of which buffer */
EXTERN Char *CursWhich; /* points to the cursor point in which buf */
EXTERN int HistWhich; /* Hist_num is saved in this */
EXTERN char Expand; /* true if we are expanding a line */
extern Char HistLit; /* true if history lines are shown literal */
EXTERN Char CurrentHistLit; /* Literal status of current show history line */
/*
* These are truly extern
*/
extern int MacroLvl;
EXTERN Char *KeyMacro[MAXMACROLEVELS];
EXTERN Char **Display; /* display buffer seed vector */
EXTERN int CursorV, /* real cursor vertical (line) */
CursorH, /* real cursor horisontal (column) */
TermV, /* number of real screen lines
* (sizeof(DisplayBuf) / width */
TermH; /* screen width */
EXTERN Char **Vdisplay; /* new buffer */
/* Variables that describe terminal ability */
EXTERN int T_Lines, T_Cols; /* Rows and Cols of the terminal */
EXTERN Char T_CanIns; /* true if I can insert characters */
EXTERN Char T_CanDel; /* dito for delete characters */
EXTERN Char T_Tabs; /* true if tty interface is passing tabs */
EXTERN Char T_Margin;
#define MARGIN_AUTO 1 /* term has auto margins */
#define MARGIN_MAGIC 2 /* concept glitch */
EXTERN speed_t T_Speed; /* Tty input Baud rate */
EXTERN Char T_CanCEOL; /* true if we can clear to end of line */
EXTERN Char T_CanUP; /* true if this term can do reverse linefeen */
EXTERN Char T_HasMeta; /* true if we have a meta key */
/* note the extra characters in the Strchr() call in this macro */
#define isword(c) (Isalpha(c)||Isdigit(c)||Strchr(word_chars,c))
#define min(x,y) (((x)<(y))?(x):(y))
#define max(x,y) (((x)>(y))?(x):(y))
/*
* Terminal dependend data structures
*/
typedef struct {
#ifdef WINNT
int dummy;
#else /* !WINNT */
# if defined(POSIX) || defined(TERMIO)
# ifdef POSIX
struct termios d_t;
# else
struct termio d_t;
# endif /* POSIX */
# else /* SGTTY */
# ifdef TIOCGETP
struct sgttyb d_t;
# endif /* TIOCGETP */
# ifdef TIOCGETC
struct tchars d_tc;
# endif /* TIOCGETC */
# ifdef TIOCGPAGE
struct ttypagestat d_pc;
# endif /* TIOCGPAGE */
# ifdef TIOCLGET
int d_lb;
# endif /* TIOCLGET */
# endif /* POSIX || TERMIO */
# ifdef TIOCGLTC
struct ltchars d_ltc;
# endif /* TIOCGLTC */
#endif /* WINNT */
} ttydata_t;
#define MODE_INSERT 0
#define MODE_REPLACE 1
#define MODE_REPLACE_1 2
#define EX_IO 0 /* while we are executing */
#define ED_IO 1 /* while we are editing */
#define TS_IO 2 /* new mode from terminal */
#define QU_IO 2 /* used only for quoted chars */
#define NN_IO 3 /* The number of entries */
#if defined(POSIX) || defined(TERMIO)
# define M_INPUT 0
# define M_OUTPUT 1
# define M_CONTROL 2
# define M_LINED 3
# define M_CHAR 4
# define M_NN 5
#else /* GSTTY */
# define M_CONTROL 0
# define M_LOCAL 1
# define M_CHAR 2
# define M_NN 3
#endif /* TERMIO */
typedef struct {
char *t_name;
int t_setmask;
int t_clrmask;
} ttyperm_t[NN_IO][M_NN];
extern ttyperm_t ttylist;
#include "ed.decls.h"
#endif /* _h_ed */

736
contrib/tcsh/ed.init.c Normal file
View File

@ -0,0 +1,736 @@
/* $Header: /src/pub/tcsh/ed.init.c,v 3.41 1999/02/06 15:01:16 christos Exp $ */
/*
* ed.init.c: Editor initializations
*/
/*-
* Copyright (c) 1980, 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTS_ION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "sh.h"
RCSID("$Id: ed.init.c,v 3.41 1999/02/06 15:01:16 christos Exp $")
#include "ed.h"
#include "ed.term.h"
#include "tc.h"
#include "ed.defns.h"
/* ed.init.c -- init routines for the line editor */
/* #define DEBUG_TTY */
int Tty_raw_mode = 0; /* Last tty change was to raw mode */
int MacroLvl = -1; /* pointer to current macro nesting level; */
/* (-1 == none) */
static int Tty_quote_mode = 0; /* Last tty change was to quote mode */
static unsigned char vdisable; /* The value of _POSIX_VDISABLE from
* pathconf(2) */
int Tty_eight_bit = -1; /* does the tty handle eight bits */
extern bool GotTermCaps;
static ttydata_t extty, edtty, tstty;
#define qutty tstty
extern int insource;
#define SHTTY (insource ? OLDSTD : SHIN)
#define uc unsigned char
static unsigned char ttychars[NN_IO][C_NCC] = {
{
(uc)CINTR, (uc)CQUIT, (uc)CERASE, (uc)CKILL,
(uc)CEOF, (uc)CEOL, (uc)CEOL2, (uc)CSWTCH,
(uc)CDSWTCH, (uc)CERASE2, (uc)CSTART, (uc)CSTOP,
(uc)CWERASE, (uc)CSUSP, (uc)CDSUSP, (uc)CREPRINT,
(uc)CDISCARD, (uc)CLNEXT, (uc)CSTATUS, (uc)CPAGE,
(uc)CPGOFF, (uc)CKILL2, (uc)CBRK, (uc)CMIN,
(uc)CTIME
},
{
CINTR, CQUIT, CERASE, CKILL,
_POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
_POSIX_VDISABLE, CERASE2, CSTART, CSTOP,
_POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
CDISCARD, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
_POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, 1,
0
},
{
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0
}
};
#ifdef SIG_WINDOW
void
check_window_size(force)
int force;
{
#ifdef BSDSIGS
sigmask_t omask;
#endif /* BSDSIGS */
int lins, cols;
/* don't want to confuse things here */
#ifdef BSDSIGS
omask = sigblock(sigmask(SIG_WINDOW)) & ~sigmask(SIG_WINDOW);
#else /* BSDSIGS */
(void) sighold(SIG_WINDOW);
#endif /* BSDSIGS */
/*
* From: bret@shark.agps.lanl.gov (Bret Thaeler) Avoid sunview bug, where a
* partially hidden window gets a SIG_WINDOW every time the text is
* scrolled
*/
if (GetSize(&lins, &cols) || force) {
if (GettingInput) {
ClearLines();
ClearDisp();
MoveToLine(0);
MoveToChar(0);
ChangeSize(lins, cols);
Refresh();
}
else
ChangeSize(lins, cols);
}
#ifdef BSDSIGS
(void) sigsetmask(omask); /* can change it again */
#else /* BSDSIGS */
(void) sigrelse(SIG_WINDOW);
#endif /* BSDSIGS */
}
sigret_t
/*ARGSUSED*/
window_change(snum)
int snum;
{
#ifdef UNRELSIGS
/* If we were called as a signal handler, restore it. */
if (snum > 0)
sigset(snum, window_change);
#endif /* UNRELSIGS */
check_window_size(0);
#ifndef SIGVOID
return (snum);
#endif
}
#endif /* SIG_WINDOW */
void
ed_set_tty_eight_bit()
{
if (tty_getty(SHTTY, &extty) == -1) {
#ifdef DEBUG_TTY
xprintf("ed_set_tty_eight_bit: tty_getty: %s\n", strerror(errno));
#endif /* DEBUG_TTY */
return;
}
Tty_eight_bit = tty_geteightbit(&extty);
}
int
ed_Setup(rst)
int rst;
{
static int havesetup = 0;
struct varent *imode;
if (havesetup) /* if we have never been called */
return(0);
#if defined(POSIX) && defined(_PC_VDISABLE) && !defined(BSD4_4) && \
!defined(WINNT)
{
long pcret;
if ((pcret = fpathconf(SHTTY, _PC_VDISABLE)) == -1L)
vdisable = (unsigned char) _POSIX_VDISABLE;
else
vdisable = (unsigned char) pcret;
if (vdisable != (unsigned char) _POSIX_VDISABLE && rst != 0)
for (rst = 0; rst < C_NCC; rst++) {
if (ttychars[ED_IO][rst] == (unsigned char) _POSIX_VDISABLE)
ttychars[ED_IO][rst] = vdisable;
if (ttychars[EX_IO][rst] == (unsigned char) _POSIX_VDISABLE)
ttychars[EX_IO][rst] = vdisable;
}
}
#else /* ! POSIX || !_PC_VDISABLE || BSD4_4 || WINNT */
vdisable = (unsigned char) _POSIX_VDISABLE;
#endif /* POSIX && _PC_VDISABLE && !BSD4_4 && !WINNT */
if ((imode = adrof(STRinputmode)) != NULL) {
if (!Strcmp(*(imode->vec), STRinsert))
inputmode = MODE_INSERT;
else if (!Strcmp(*(imode->vec), STRoverwrite))
inputmode = MODE_REPLACE;
}
else
inputmode = MODE_INSERT;
ed_InitMaps();
Hist_num = 0;
Expand = 0;
#ifndef WINNT
if (tty_getty(SHTTY, &extty) == -1) {
# ifdef DEBUG_TTY
xprintf("ed_Setup: tty_getty: %s\n", strerror(errno));
# endif /* DEBUG_TTY */
return(-1);
}
tstty = edtty = extty;
T_Speed = tty_getspeed(&extty);
T_Tabs = tty_gettabs(&extty);
Tty_eight_bit = tty_geteightbit(&extty);
# if defined(POSIX) || defined(TERMIO)
extty.d_t.c_iflag &= ~ttylist[EX_IO][M_INPUT].t_clrmask;
extty.d_t.c_iflag |= ttylist[EX_IO][M_INPUT].t_setmask;
extty.d_t.c_oflag &= ~ttylist[EX_IO][M_OUTPUT].t_clrmask;
extty.d_t.c_oflag |= ttylist[EX_IO][M_OUTPUT].t_setmask;
extty.d_t.c_cflag &= ~ttylist[EX_IO][M_CONTROL].t_clrmask;
extty.d_t.c_cflag |= ttylist[EX_IO][M_CONTROL].t_setmask;
extty.d_t.c_lflag &= ~ttylist[EX_IO][M_LINED].t_clrmask;
extty.d_t.c_lflag |= ttylist[EX_IO][M_LINED].t_setmask;
# if defined(IRIX3_3) && SYSVREL < 4
extty.d_t.c_line = NTTYDISC;
# endif /* IRIX3_3 && SYSVREL < 4 */
# else /* GSTTY */ /* V7, Berkeley style tty */
if (T_Tabs) { /* order of &= and |= is important to XTABS */
extty.d_t.sg_flags &= ~(ttylist[EX_IO][M_CONTROL].t_clrmask|XTABS);
extty.d_t.sg_flags |= ttylist[EX_IO][M_CONTROL].t_setmask;
}
else {
extty.d_t.sg_flags &= ~ttylist[EX_IO][M_CONTROL].t_clrmask;
extty.d_t.sg_flags |= (ttylist[EX_IO][M_CONTROL].t_setmask|XTABS);
}
extty.d_lb &= ~ttylist[EX_IO][M_LOCAL].t_clrmask;
extty.d_lb |= ttylist[EX_IO][M_LOCAL].t_setmask;
# endif /* GSTTY */
/*
* Reset the tty chars to reasonable defaults
* If they are disabled, then enable them.
*/
if (rst) {
if (tty_cooked_mode(&tstty)) {
tty_getchar(&tstty, ttychars[TS_IO]);
/*
* Don't affect CMIN and CTIME for the editor mode
*/
for (rst = 0; rst < C_NCC - 2; rst++)
if (ttychars[TS_IO][rst] != vdisable &&
ttychars[ED_IO][rst] != vdisable)
ttychars[ED_IO][rst] = ttychars[TS_IO][rst];
for (rst = 0; rst < C_NCC; rst++)
if (ttychars[TS_IO][rst] != vdisable &&
ttychars[EX_IO][rst] != vdisable)
ttychars[EX_IO][rst] = ttychars[TS_IO][rst];
}
tty_setchar(&extty, ttychars[EX_IO]);
if (tty_setty(SHTTY, &extty) == -1) {
# ifdef DEBUG_TTY
xprintf("ed_Setup: tty_setty: %s\n", strerror(errno));
# endif /* DEBUG_TTY */
return(-1);
}
}
else
tty_setchar(&extty, ttychars[EX_IO]);
# ifdef SIG_WINDOW
(void) sigset(SIG_WINDOW, window_change); /* for window systems */
# endif
#else /* WINNT */
# ifdef DEBUG
if (rst)
xprintf("rst received in ed_Setup() %d\n", rst);
# endif
#endif /* WINNT */
havesetup = 1;
return(0);
}
void
ed_Init()
{
ResetInLine(1); /* reset the input pointers */
GettingInput = 0; /* just in case */
LastKill = KillBuf; /* no kill buffer */
#ifdef DEBUG_EDIT
CheckMaps(); /* do a little error checking on key maps */
#endif
if (ed_Setup(0) == -1)
return;
/*
* if we have been called before but GotTermCaps isn't set, our TERM has
* changed, so get new termcaps and try again
*/
if (!GotTermCaps)
GetTermCaps(); /* does the obvious, but gets term type each
* time */
#ifndef WINNT
# if defined(TERMIO) || defined(POSIX)
edtty.d_t.c_iflag &= ~ttylist[ED_IO][M_INPUT].t_clrmask;
edtty.d_t.c_iflag |= ttylist[ED_IO][M_INPUT].t_setmask;
edtty.d_t.c_oflag &= ~ttylist[ED_IO][M_OUTPUT].t_clrmask;
edtty.d_t.c_oflag |= ttylist[ED_IO][M_OUTPUT].t_setmask;
edtty.d_t.c_cflag &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
edtty.d_t.c_cflag |= ttylist[ED_IO][M_CONTROL].t_setmask;
edtty.d_t.c_lflag &= ~ttylist[ED_IO][M_LINED].t_clrmask;
edtty.d_t.c_lflag |= ttylist[ED_IO][M_LINED].t_setmask;
# if defined(IRIX3_3) && SYSVREL < 4
edtty.d_t.c_line = NTTYDISC;
# endif /* IRIX3_3 && SYSVREL < 4 */
# else /* GSTTY */
if (T_Tabs) { /* order of &= and |= is important to XTABS */
edtty.d_t.sg_flags &= ~(ttylist[ED_IO][M_CONTROL].t_clrmask | XTABS);
edtty.d_t.sg_flags |= ttylist[ED_IO][M_CONTROL].t_setmask;
}
else {
edtty.d_t.sg_flags &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
edtty.d_t.sg_flags |= (ttylist[ED_IO][M_CONTROL].t_setmask | XTABS);
}
edtty.d_lb &= ~ttylist[ED_IO][M_LOCAL].t_clrmask;
edtty.d_lb |= ttylist[ED_IO][M_LOCAL].t_setmask;
# endif /* POSIX || TERMIO */
tty_setchar(&edtty, ttychars[ED_IO]);
#endif /* WINNT */
}
/*
* Check and re-init the line. set the terminal into 1 char at a time mode.
*/
int
Rawmode()
{
if (Tty_raw_mode)
return (0);
#ifdef WINNT
do_nt_raw_mode();
#else /* !WINNT */
# ifdef _IBMR2
tty_setdisc(SHTTY, ED_IO);
# endif /* _IBMR2 */
if (tty_getty(SHTTY, &tstty) == -1) {
# ifdef DEBUG_TTY
xprintf("Rawmode: tty_getty: %s\n", strerror(errno));
# endif /* DEBUG_TTY */
return(-1);
}
/*
* We always keep up with the eight bit setting and the speed of the
* tty. But only we only believe changes that are made to cooked mode!
*/
# if defined(POSIX) || defined(TERMIO)
Tty_eight_bit = tty_geteightbit(&tstty);
T_Speed = tty_getspeed(&tstty);
# ifdef POSIX
/*
* Fix from: Steven (Steve) B. Green <xrsbg@charney.gsfc.nasa.gov>
* Speed was not being set up correctly under POSIX.
*/
if (tty_getspeed(&extty) != T_Speed || tty_getspeed(&edtty) != T_Speed) {
(void) cfsetispeed(&extty.d_t, T_Speed);
(void) cfsetospeed(&extty.d_t, T_Speed);
(void) cfsetispeed(&edtty.d_t, T_Speed);
(void) cfsetospeed(&edtty.d_t, T_Speed);
}
# endif /* POSIX */
# else /* GSTTY */
T_Speed = tty_getspeed(&tstty);
Tty_eight_bit = tty_geteightbit(&tstty);
if (extty.d_t.sg_ispeed != tstty.d_t.sg_ispeed) {
extty.d_t.sg_ispeed = tstty.d_t.sg_ispeed;
edtty.d_t.sg_ispeed = tstty.d_t.sg_ispeed;
}
if (extty.d_t.sg_ospeed != tstty.d_t.sg_ospeed) {
extty.d_t.sg_ospeed = tstty.d_t.sg_ospeed;
edtty.d_t.sg_ospeed = tstty.d_t.sg_ospeed;
}
# endif /* POSIX || TERMIO */
if (tty_cooked_mode(&tstty)) {
/*
* re-test for some things here (like maybe the user typed
* "stty -tabs"
*/
if (tty_gettabs(&tstty) == 0)
T_Tabs = 0;
else
T_Tabs = CanWeTab();
# if defined(POSIX) || defined(TERMIO)
extty.d_t.c_cflag = tstty.d_t.c_cflag;
extty.d_t.c_cflag &= ~ttylist[EX_IO][M_CONTROL].t_clrmask;
extty.d_t.c_cflag |= ttylist[EX_IO][M_CONTROL].t_setmask;
edtty.d_t.c_cflag = tstty.d_t.c_cflag;
edtty.d_t.c_cflag &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
edtty.d_t.c_cflag |= ttylist[ED_IO][M_CONTROL].t_setmask;
extty.d_t.c_lflag = tstty.d_t.c_lflag;
extty.d_t.c_lflag &= ~ttylist[EX_IO][M_LINED].t_clrmask;
extty.d_t.c_lflag |= ttylist[EX_IO][M_LINED].t_setmask;
edtty.d_t.c_lflag = tstty.d_t.c_lflag;
edtty.d_t.c_lflag &= ~ttylist[ED_IO][M_LINED].t_clrmask;
edtty.d_t.c_lflag |= ttylist[ED_IO][M_LINED].t_setmask;
extty.d_t.c_iflag = tstty.d_t.c_iflag;
extty.d_t.c_iflag &= ~ttylist[EX_IO][M_INPUT].t_clrmask;
extty.d_t.c_iflag |= ttylist[EX_IO][M_INPUT].t_setmask;
edtty.d_t.c_iflag = tstty.d_t.c_iflag;
edtty.d_t.c_iflag &= ~ttylist[ED_IO][M_INPUT].t_clrmask;
edtty.d_t.c_iflag |= ttylist[ED_IO][M_INPUT].t_setmask;
extty.d_t.c_oflag = tstty.d_t.c_oflag;
extty.d_t.c_oflag &= ~ttylist[EX_IO][M_OUTPUT].t_clrmask;
extty.d_t.c_oflag |= ttylist[EX_IO][M_OUTPUT].t_setmask;
edtty.d_t.c_oflag = tstty.d_t.c_oflag;
edtty.d_t.c_oflag &= ~ttylist[ED_IO][M_OUTPUT].t_clrmask;
edtty.d_t.c_oflag |= ttylist[ED_IO][M_OUTPUT].t_setmask;
# else /* GSTTY */
extty.d_t.sg_flags = tstty.d_t.sg_flags;
extty.d_t.sg_flags &= ~ttylist[EX_IO][M_CONTROL].t_clrmask;
extty.d_t.sg_flags |= ttylist[EX_IO][M_CONTROL].t_setmask;
if (T_Tabs) /* order of &= and |= is important to XTABS */
extty.d_t.sg_flags &= ~XTABS;
else
extty.d_t.sg_flags |= XTABS;
extty.d_lb = tstty.d_lb;
extty.d_lb &= ~ttylist[EX_IO][M_LOCAL].t_clrmask;
extty.d_lb |= ttylist[EX_IO][M_LOCAL].t_setmask;
edtty.d_t.sg_flags = extty.d_t.sg_flags;
if (T_Tabs) { /* order of &= and |= is important to XTABS */
edtty.d_t.sg_flags &=
~(ttylist[ED_IO][M_CONTROL].t_clrmask|XTABS);
edtty.d_t.sg_flags |= ttylist[ED_IO][M_CONTROL].t_setmask;
}
else {
edtty.d_t.sg_flags &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
edtty.d_t.sg_flags |=
(ttylist[ED_IO][M_CONTROL].t_setmask|XTABS);
}
edtty.d_lb = tstty.d_lb;
edtty.d_lb &= ~ttylist[ED_IO][M_LOCAL].t_clrmask;
edtty.d_lb |= ttylist[ED_IO][M_LOCAL].t_setmask;
# endif /* TERMIO || POSIX */
{
extern int didsetty;
int i;
tty_getchar(&tstty, ttychars[TS_IO]);
/*
* Check if the user made any changes.
* If he did, then propagate the changes to the
* edit and execute data structures.
*/
for (i = 0; i < C_NCC; i++)
if (ttychars[TS_IO][i] != ttychars[EX_IO][i])
break;
if (i != C_NCC || didsetty) {
didsetty = 0;
/*
* Propagate changes only to the unprotected chars
* that have been modified just now.
*/
for (i = 0; i < C_NCC; i++) {
if (!((ttylist[ED_IO][M_CHAR].t_setmask & C_SH(i))) &&
(ttychars[TS_IO][i] != ttychars[EX_IO][i]))
ttychars[ED_IO][i] = ttychars[TS_IO][i];
if (ttylist[ED_IO][M_CHAR].t_clrmask & C_SH(i))
ttychars[ED_IO][i] = vdisable;
}
tty_setchar(&edtty, ttychars[ED_IO]);
for (i = 0; i < C_NCC; i++) {
if (!((ttylist[EX_IO][M_CHAR].t_setmask & C_SH(i))) &&
(ttychars[TS_IO][i] != ttychars[EX_IO][i]))
ttychars[EX_IO][i] = ttychars[TS_IO][i];
if (ttylist[EX_IO][M_CHAR].t_clrmask & C_SH(i))
ttychars[EX_IO][i] = vdisable;
}
tty_setchar(&extty, ttychars[EX_IO]);
}
}
}
if (tty_setty(SHTTY, &edtty) == -1) {
# ifdef DEBUG_TTY
xprintf("Rawmode: tty_setty: %s\n", strerror(errno));
# endif /* DEBUG_TTY */
return(-1);
}
#endif /* WINNT */
Tty_raw_mode = 1;
flush(); /* flush any buffered output */
return (0);
}
int
Cookedmode()
{ /* set tty in normal setup */
#ifdef WINNT
do_nt_cooked_mode();
#else
signalfun_t orig_intr;
# ifdef _IBMR2
tty_setdisc(SHTTY, EX_IO);
# endif /* _IBMR2 */
if (!Tty_raw_mode)
return (0);
/* hold this for reseting tty */
# ifdef BSDSIGS
orig_intr = (signalfun_t) signal(SIGINT, SIG_IGN);
# else
# ifdef SIG_HOLD
/*
* sigset doesn't return the previous handler if the signal is held,
* it will return SIG_HOLD instead. So instead of restoring the
* the signal we would end up installing a blocked SIGINT with a
* SIG_IGN signal handler. This is what happened when Cookedmode
* was called from sched_run, disabling interrupt for the rest
* of your session.
*
* This is what we do:
* - if the signal is blocked, keep it that way
* - else set it to SIG_IGN
*
* Casper Dik (casper@fwi.uva.nl)
*/
orig_intr = (signalfun_t) sigset(SIGINT, SIG_HOLD);
if (orig_intr != SIG_HOLD)
(void) sigset(SIGINT, SIG_IGN); /* returns SIG_HOLD */
# else /* !SIG_HOLD */
/*
* No SIG_HOLD; probably no reliable signals as well.
*/
orig_intr = (signalfun_t) sigset(SIGINT, SIG_IGN);
# endif /* SIG_HOLD */
# endif /* BSDSIGS */
if (tty_setty(SHTTY, &extty) == -1) {
# ifdef DEBUG_TTY
xprintf("Cookedmode: tty_setty: %s\n", strerror(errno));
# endif /* DEBUG_TTY */
return -1;
}
# ifdef BSDSIGS
(void) signal(SIGINT, orig_intr); /* take these again */
# else
(void) sigset(SIGINT, orig_intr); /* take these again */
# endif /* BSDSIGS */
#endif /* WINNT */
Tty_raw_mode = 0;
return (0);
}
void
ResetInLine(macro)
int macro;
{
Cursor = InputBuf; /* reset cursor */
LastChar = InputBuf;
InputLim = &InputBuf[INBUFSIZE - 2];
Mark = InputBuf;
MetaNext = 0;
CurrentKeyMap = CcKeyMap;
AltKeyMap = 0;
Hist_num = 0;
DoingArg = 0;
Argument = 1;
#ifdef notdef
LastKill = KillBuf; /* no kill buffer */
#endif
LastCmd = F_UNASSIGNED; /* previous command executed */
if (macro)
MacroLvl = -1; /* no currently active macros */
}
static Char *Input_Line = NULL;
int
Load_input_line()
{
#ifdef SUNOS4
long chrs = 0;
#else /* !SUNOS4 */
/*
* *Everyone* else has an int, but SunOS wants long!
* This breaks where int != long (alpha)
*/
int chrs = 0;
#endif /* SUNOS4 */
if (Input_Line)
xfree((ptr_t) Input_Line);
Input_Line = NULL;
if (Tty_raw_mode)
return 0;
#if defined(FIONREAD) && !defined(OREO)
(void) ioctl(SHIN, FIONREAD, (ioctl_t) &chrs);
if (chrs > 0) {
char buf[BUFSIZE];
chrs = read(SHIN, buf, (size_t) min(chrs, BUFSIZE - 1));
if (chrs > 0) {
buf[chrs] = '\0';
Input_Line = Strsave(str2short(buf));
PushMacro(Input_Line);
}
#ifdef convex
/* need to print errno message in case file is migrated */
if (chrs < 0)
stderror(ERR_SYSTEM, progname, strerror(errno));
#endif
}
#endif /* FIONREAD && !OREO */
return chrs > 0;
}
/*
* Bugfix (in Swedish) by:
* Johan Widen
* SICS, PO Box 1263, S-163 13 SPANGA, SWEDEN
* {mcvax,munnari,cernvax,diku,inria,prlb2,penet,ukc,unido}!enea!sics.se!jw
* Internet: jw@sics.se
*
* (via Hans J Albertsson (thanks))
*/
void
QuoteModeOn()
{
if (MacroLvl >= 0)
return;
#ifndef WINNT
qutty = edtty;
#if defined(TERMIO) || defined(POSIX)
qutty.d_t.c_iflag &= ~ttylist[QU_IO][M_INPUT].t_clrmask;
qutty.d_t.c_iflag |= ttylist[QU_IO][M_INPUT].t_setmask;
qutty.d_t.c_oflag &= ~ttylist[QU_IO][M_OUTPUT].t_clrmask;
qutty.d_t.c_oflag |= ttylist[QU_IO][M_OUTPUT].t_setmask;
qutty.d_t.c_cflag &= ~ttylist[QU_IO][M_CONTROL].t_clrmask;
qutty.d_t.c_cflag |= ttylist[QU_IO][M_CONTROL].t_setmask;
qutty.d_t.c_lflag &= ~ttylist[QU_IO][M_LINED].t_clrmask;
qutty.d_t.c_lflag |= ttylist[QU_IO][M_LINED].t_setmask;
#else /* GSTTY */
qutty.d_t.sg_flags &= ~ttylist[QU_IO][M_CONTROL].t_clrmask;
qutty.d_t.sg_flags |= ttylist[QU_IO][M_CONTROL].t_setmask;
qutty.d_lb &= ~ttylist[QU_IO][M_LOCAL].t_clrmask;
qutty.d_lb |= ttylist[QU_IO][M_LOCAL].t_setmask;
#endif /* TERMIO || POSIX */
if (tty_setty(SHTTY, &qutty) == -1) {
#ifdef DEBUG_TTY
xprintf("QuoteModeOn: tty_setty: %s\n", strerror(errno));
#endif /* DEBUG_TTY */
return;
}
#endif /* !WINNT */
Tty_quote_mode = 1;
return;
}
void
QuoteModeOff()
{
if (!Tty_quote_mode)
return;
Tty_quote_mode = 0;
if (tty_setty(SHTTY, &edtty) == -1) {
#ifdef DEBUG_TTY
xprintf("QuoteModeOff: tty_setty: %s\n", strerror(errno));
#endif /* DEBUG_TTY */
return;
}
return;
}

903
contrib/tcsh/ed.inputl.c Normal file
View File

@ -0,0 +1,903 @@
/* $Header: /src/pub/tcsh/ed.inputl.c,v 3.47 1999/04/20 07:48:39 christos Exp $ */
/*
* ed.inputl.c: Input line handling.
*/
/*-
* Copyright (c) 1980, 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "sh.h"
RCSID("$Id: ed.inputl.c,v 3.47 1999/04/20 07:48:39 christos Exp $")
#include "ed.h"
#include "ed.defns.h" /* for the function names */
#include "tw.h" /* for twenex stuff */
#define OKCMD (INBUFSIZE+INBUFSIZE)
/* ed.inputl -- routines to get a single line from the input. */
extern bool tellwhat;
extern bool MapsAreInited;
extern bool Tty_raw_mode;
/* mismatched first character */
static Char mismatch[] =
{'!', '^' , '\\', '-', '%', '\0', '"', '\'', '`', '\0' };
static int Repair __P((void));
static int GetNextCommand __P((KEYCMD *, Char *));
static int SpellLine __P((int));
static int CompleteLine __P((void));
static void RunCommand __P((Char *));
static void doeval1 __P((Char **));
static bool rotate = 0;
static int
Repair()
{
if (NeedsRedraw) {
ClearLines();
ClearDisp();
NeedsRedraw = 0;
}
Refresh();
Argument = 1;
DoingArg = 0;
curchoice = -1;
return (int) (LastChar - InputBuf);
}
/* CCRETVAL */
int
Inputl()
{
CCRETVAL retval;
KEYCMD cmdnum = 0;
extern KEYCMD NumFuns;
unsigned char tch; /* the place where read() goes */
Char ch;
int num; /* how many chars we have read at NL */
int expnum;
struct varent *crct = inheredoc ? NULL : adrof(STRcorrect);
struct varent *autol = adrof(STRautolist);
struct varent *matchbeep = adrof(STRmatchbeep);
struct varent *imode = adrof(STRinputmode);
Char *SaveChar, *CorrChar;
Char Origin[INBUFSIZE], Change[INBUFSIZE];
int matchval; /* from tenematch() */
COMMAND fn;
int curlen = 0;
int newlen;
int idx;
if (!MapsAreInited) /* double extra just in case */
ed_InitMaps();
ClearDisp(); /* reset the display stuff */
ResetInLine(0); /* reset the input pointers */
if (GettingInput)
MacroLvl = -1; /* editor was interrupted during input */
if (imode) {
if (!Strcmp(*(imode->vec), STRinsert))
inputmode = MODE_INSERT;
else if (!Strcmp(*(imode->vec), STRoverwrite))
inputmode = MODE_REPLACE;
}
#if defined(FIONREAD) && !defined(OREO)
if (!Tty_raw_mode && MacroLvl < 0) {
# ifdef SUNOS4
long chrs = 0;
# else /* !SUNOS4 */
/*
* *Everyone* else has an int, but SunOS wants long!
* This breaks where int != long (alpha)
*/
int chrs = 0;
# endif /* SUNOS4 */
(void) ioctl(SHIN, FIONREAD, (ioctl_t) & chrs);
if (chrs == 0) {
if (Rawmode() < 0)
return 0;
}
}
#endif /* FIONREAD && !OREO */
GettingInput = 1;
NeedsRedraw = 0;
if (tellwhat) {
copyn(InputBuf, WhichBuf, INBUFSIZE);
LastChar = InputBuf + (LastWhich - WhichBuf);
Cursor = InputBuf + (CursWhich - WhichBuf);
tellwhat = 0;
Hist_num = HistWhich;
}
if (Expand) {
(void) e_up_hist(0);
Expand = 0;
}
Refresh(); /* print the prompt */
for (num = OKCMD; num == OKCMD;) { /* while still editing this line */
#ifdef DEBUG_EDIT
if (Cursor > LastChar)
xprintf("Cursor > LastChar\r\n");
if (Cursor < InputBuf)
xprintf("Cursor < InputBuf\r\n");
if (Cursor > InputLim)
xprintf("Cursor > InputLim\r\n");
if (LastChar > InputLim)
xprintf("LastChar > InputLim\r\n");
if (InputLim != &InputBuf[INBUFSIZE - 2])
xprintf("InputLim != &InputBuf[INBUFSIZE-2]\r\n");
if ((!DoingArg) && (Argument != 1))
xprintf("(!DoingArg) && (Argument != 1)\r\n");
if (CcKeyMap[0] == 0)
xprintf("CcKeyMap[0] == 0 (maybe not inited)\r\n");
#endif
/* if EOF or error */
if ((num = GetNextCommand(&cmdnum, &ch)) != OKCMD) {
break;
}
if (cmdnum >= NumFuns) {/* BUG CHECK command */
#ifdef DEBUG_EDIT
xprintf(CGETS(6, 1, "ERROR: illegal command from key 0%o\r\n"), ch);
#endif
continue; /* try again */
}
/* now do the real command */
retval = (*CcFuncTbl[cmdnum]) (ch);
/* save the last command here */
LastCmd = cmdnum;
/* make sure fn is initialized */
fn = (retval == CC_COMPLETE_ALL) ? LIST_ALL : LIST;
/* use any return value */
switch (retval) {
case CC_REFRESH:
Refresh();
/*FALLTHROUGH*/
case CC_NORM: /* normal char */
Argument = 1;
DoingArg = 0;
/*FALLTHROUGH*/
case CC_ARGHACK: /* Suggested by Rich Salz */
/* <rsalz@pineapple.bbn.com> */
curchoice = -1;
curlen = (int) (LastChar - InputBuf);
break; /* keep going... */
case CC_EOF: /* end of file typed */
curchoice = -1;
curlen = (int) (LastChar - InputBuf);
num = 0;
break;
case CC_WHICH: /* tell what this command does */
tellwhat = 1;
copyn(WhichBuf, InputBuf, INBUFSIZE);
LastWhich = WhichBuf + (LastChar - InputBuf);
CursWhich = WhichBuf + (Cursor - InputBuf);
*LastChar++ = '\n'; /* for the benifit of CSH */
HistWhich = Hist_num;
Hist_num = 0; /* for the history commands */
num = (int) (LastChar - InputBuf); /* number characters read */
break;
case CC_NEWLINE: /* normal end of line */
curlen = 0;
curchoice = -1;
matchval = 1;
if (crct && (!Strcmp(*(crct->vec), STRcmd) ||
!Strcmp(*(crct->vec), STRall))) {
PastBottom();
copyn(Origin, InputBuf, INBUFSIZE);
SaveChar = LastChar;
if (SpellLine(!Strcmp(*(crct->vec), STRcmd)) == 1) {
PastBottom();
copyn(Change, InputBuf, INBUFSIZE);
*Strchr(Change, '\n') = '\0';
CorrChar = LastChar; /* Save the corrected end */
LastChar = InputBuf; /* Null the current line */
SoundBeep();
printprompt(2, short2str(Change));
Refresh();
if (read(SHIN, (char *) &tch, 1) < 0)
#ifdef convex
/*
* need to print error message in case file
* is migrated
*/
if (errno && errno != EINTR)
stderror(ERR_SYSTEM, progname, strerror(errno));
#else
break;
#endif
ch = tch;
if (ch == 'y' || ch == ' ') {
LastChar = CorrChar; /* Restore the corrected end */
xprintf(CGETS(6, 2, "yes\n"));
}
else {
copyn(InputBuf, Origin, INBUFSIZE);
LastChar = SaveChar;
if (ch == 'e') {
xprintf(CGETS(6, 3, "edit\n"));
*LastChar-- = '\0';
Cursor = LastChar;
printprompt(3, NULL);
ClearLines();
ClearDisp();
Refresh();
break;
}
else if (ch == 'a') {
xprintf(CGETS(6, 4, "abort\n"));
LastChar = InputBuf; /* Null the current line */
Cursor = LastChar;
printprompt(0, NULL);
Refresh();
break;
}
xprintf(CGETS(6, 5, "no\n"));
}
flush();
}
} else if (crct && !Strcmp(*(crct->vec), STRcomplete)) {
if (LastChar > InputBuf && LastChar[-1] == '\n') {
LastChar[-1] = '\0';
LastChar--;
Cursor = LastChar;
}
match_unique_match = 1; /* match unique matches */
matchval = CompleteLine();
match_unique_match = 0;
curlen = (int) (LastChar - InputBuf);
if (matchval != 1) {
PastBottom();
}
if (matchval == 0) {
xprintf(CGETS(6, 6, "No matching command\n"));
} else if (matchval == 2) {
xprintf(CGETS(6, 7, "Ambiguous command\n"));
}
if (NeedsRedraw) {
ClearLines();
ClearDisp();
NeedsRedraw = 0;
}
Refresh();
Argument = 1;
DoingArg = 0;
if (matchval == 1) {
PastBottom();
*LastChar++ = '\n';
*LastChar = '\0';
}
curlen = (int) (LastChar - InputBuf);
}
else
PastBottom();
if (matchval == 1) {
tellwhat = 0; /* just in case */
Hist_num = 0; /* for the history commands */
/* return the number of chars read */
num = (int) (LastChar - InputBuf);
/*
* For continuation lines, we set the prompt to prompt 2
*/
printprompt(1, NULL);
}
break;
case CC_CORRECT:
if (tenematch(InputBuf, Cursor - InputBuf, SPELL) < 0)
SoundBeep(); /* Beep = No match/ambiguous */
curlen = Repair();
break;
case CC_CORRECT_L:
if (SpellLine(FALSE) < 0)
SoundBeep(); /* Beep = No match/ambiguous */
curlen = Repair();
break;
case CC_COMPLETE:
case CC_COMPLETE_ALL:
case CC_COMPLETE_FWD:
case CC_COMPLETE_BACK:
switch (retval) {
case CC_COMPLETE:
fn = RECOGNIZE;
curlen = (int) (LastChar - InputBuf);
curchoice = -1;
rotate = 0;
break;
case CC_COMPLETE_ALL:
fn = RECOGNIZE_ALL;
curlen = (int) (LastChar - InputBuf);
curchoice = -1;
rotate = 0;
break;
case CC_COMPLETE_FWD:
fn = RECOGNIZE_SCROLL;
curchoice++;
rotate = 1;
break;
case CC_COMPLETE_BACK:
fn = RECOGNIZE_SCROLL;
curchoice--;
rotate = 1;
break;
default:
abort();
}
if (InputBuf[curlen] && rotate) {
newlen = (int) (LastChar - InputBuf);
for (idx = (int) (Cursor - InputBuf);
idx <= newlen; idx++)
InputBuf[idx - newlen + curlen] =
InputBuf[idx];
LastChar = InputBuf + curlen;
Cursor = Cursor - newlen + curlen;
}
curlen = (int) (LastChar - InputBuf);
if (adrof(STRautoexpand))
(void) e_expand_history(0);
/*
* Modified by Martin Boyer (gamin@ireq-robot.hydro.qc.ca):
* A separate variable now controls beeping after
* completion, independently of autolisting.
*/
expnum = (int) (Cursor - InputBuf);
switch (matchval = tenematch(InputBuf, Cursor-InputBuf, fn)){
case 1:
if (non_unique_match && matchbeep &&
(Strcmp(*(matchbeep->vec), STRnotunique) == 0))
SoundBeep();
break;
case 0:
if (matchbeep) {
if (Strcmp(*(matchbeep->vec), STRnomatch) == 0 ||
Strcmp(*(matchbeep->vec), STRambiguous) == 0 ||
Strcmp(*(matchbeep->vec), STRnotunique) == 0)
SoundBeep();
}
else
SoundBeep();
break;
default:
if (matchval < 0) { /* Error from tenematch */
curchoice = -1;
SoundBeep();
break;
}
if (matchbeep) {
if ((Strcmp(*(matchbeep->vec), STRambiguous) == 0 ||
Strcmp(*(matchbeep->vec), STRnotunique) == 0))
SoundBeep();
}
else
SoundBeep();
/*
* Addition by David C Lawrence <tale@pawl.rpi.edu>: If an
* attempted completion is ambiguous, list the choices.
* (PWP: this is the best feature addition to tcsh I have
* seen in many months.)
*/
if (autol && (Strcmp(*(autol->vec), STRambiguous) != 0 ||
expnum == Cursor - InputBuf)) {
PastBottom();
fn = (retval == CC_COMPLETE_ALL) ? LIST_ALL : LIST;
(void) tenematch(InputBuf, Cursor-InputBuf, fn);
}
break;
}
if (NeedsRedraw) {
PastBottom();
ClearLines();
ClearDisp();
NeedsRedraw = 0;
}
Refresh();
Argument = 1;
DoingArg = 0;
break;
case CC_LIST_CHOICES:
case CC_LIST_ALL:
if (InputBuf[curlen] && rotate) {
newlen = (int) (LastChar - InputBuf);
for (idx = (int) (Cursor - InputBuf);
idx <= newlen; idx++)
InputBuf[idx - newlen + curlen] =
InputBuf[idx];
LastChar = InputBuf + curlen;
Cursor = Cursor - newlen + curlen;
}
curlen = (int) (LastChar - InputBuf);
if (curchoice >= 0)
curchoice--;
fn = (retval == CC_LIST_ALL) ? LIST_ALL : LIST;
/* should catch ^C here... */
if (tenematch(InputBuf, Cursor - InputBuf, fn) < 0)
SoundBeep();
Refresh();
Argument = 1;
DoingArg = 0;
break;
case CC_LIST_GLOB:
if (tenematch(InputBuf, Cursor - InputBuf, GLOB) < 0)
SoundBeep();
curlen = Repair();
break;
case CC_EXPAND_GLOB:
if (tenematch(InputBuf, Cursor - InputBuf, GLOB_EXPAND) <= 0)
SoundBeep(); /* Beep = No match */
curlen = Repair();
break;
case CC_NORMALIZE_PATH:
if (tenematch(InputBuf, Cursor - InputBuf, PATH_NORMALIZE) <= 0)
SoundBeep(); /* Beep = No match */
curlen = Repair();
break;
case CC_EXPAND_VARS:
if (tenematch(InputBuf, Cursor - InputBuf, VARS_EXPAND) <= 0)
SoundBeep(); /* Beep = No match */
curlen = Repair();
break;
case CC_NORMALIZE_COMMAND:
if (tenematch(InputBuf, Cursor - InputBuf, COMMAND_NORMALIZE) <= 0)
SoundBeep(); /* Beep = No match */
curlen = Repair();
break;
case CC_HELPME:
xputchar('\n');
/* should catch ^C here... */
(void) tenematch(InputBuf, LastChar - InputBuf, PRINT_HELP);
Refresh();
Argument = 1;
DoingArg = 0;
curchoice = -1;
curlen = (int) (LastChar - InputBuf);
break;
case CC_FATAL: /* fatal error, reset to known state */
#ifdef DEBUG_EDIT
xprintf(CGETS(7, 8, "*** editor fatal ERROR ***\r\n\n"));
#endif /* DEBUG_EDIT */
/* put (real) cursor in a known place */
ClearDisp(); /* reset the display stuff */
ResetInLine(1); /* reset the input pointers */
Refresh(); /* print the prompt again */
Argument = 1;
DoingArg = 0;
curchoice = -1;
curlen = (int) (LastChar - InputBuf);
break;
case CC_ERROR:
default: /* functions we don't know about */
DoingArg = 0;
Argument = 1;
SoundBeep();
flush();
curchoice = -1;
curlen = (int) (LastChar - InputBuf);
break;
}
}
(void) Cookedmode(); /* make sure the tty is set up correctly */
GettingInput = 0;
flush(); /* flush any buffered output */
return num;
}
void
PushMacro(str)
Char *str;
{
if (str != NULL && MacroLvl + 1 < MAXMACROLEVELS) {
MacroLvl++;
KeyMacro[MacroLvl] = str;
}
else {
SoundBeep();
flush();
}
}
/*
* Like eval, only using the current file descriptors
*/
static Char **gv = NULL, **gav = NULL;
static void
doeval1(v)
Char **v;
{
Char **oevalvec;
Char *oevalp;
int my_reenter;
Char **savegv;
jmp_buf_t osetexit;
oevalvec = evalvec;
oevalp = evalp;
savegv = gv;
gav = v;
gflag = 0, tglob(gav);
if (gflag) {
gv = gav = globall(gav);
gargv = 0;
if (gav == 0)
stderror(ERR_NOMATCH);
gav = copyblk(gav);
}
else {
gv = NULL;
gav = copyblk(gav);
trim(gav);
}
getexit(osetexit);
/* PWP: setjmp/longjmp bugfix for optimizing compilers */
#ifdef cray
my_reenter = 1; /* assume non-zero return val */
if (setexit() == 0) {
my_reenter = 0; /* Oh well, we were wrong */
#else /* !cray */
if ((my_reenter = setexit()) == 0) {
#endif /* cray */
evalvec = gav;
evalp = 0;
process(0);
}
evalvec = oevalvec;
evalp = oevalp;
doneinp = 0;
if (gv)
blkfree(gv);
gv = savegv;
resexit(osetexit);
if (my_reenter)
stderror(ERR_SILENT);
}
static void
RunCommand(str)
Char *str;
{
Char *cmd[2];
xputchar('\n'); /* Start on a clean line */
cmd[0] = str;
cmd[1] = NULL;
(void) Cookedmode();
GettingInput = 0;
doeval1(cmd);
(void) Rawmode();
GettingInput = 1;
ClearLines();
ClearDisp();
NeedsRedraw = 0;
Refresh();
}
static int
GetNextCommand(cmdnum, ch)
KEYCMD *cmdnum;
register Char *ch;
{
KEYCMD cmd = 0;
int num;
while (cmd == 0 || cmd == F_XKEY) {
if ((num = GetNextChar(ch)) != 1) { /* if EOF or error */
return num;
}
#ifdef KANJI
if (!adrof(STRnokanji) && (*ch & META)) {
MetaNext = 0;
cmd = F_INSERT;
break;
}
else
#endif /* KANJI */
if (MetaNext) {
MetaNext = 0;
*ch |= META;
}
/* XXX: This needs to be fixed so that we don't just truncate
* the character, we unquote it.
*/
if (*ch < NT_NUM_KEYS)
cmd = CurrentKeyMap[*ch];
else
cmd = CurrentKeyMap[(unsigned char) *ch];
if (cmd == F_XKEY) {
XmapVal val;
CStr cstr;
cstr.buf = ch;
cstr.len = Strlen(ch);
switch (GetXkey(&cstr, &val)) {
case XK_CMD:
cmd = val.cmd;
break;
case XK_STR:
PushMacro(val.str.buf);
break;
case XK_EXE:
RunCommand(val.str.buf);
break;
default:
abort();
break;
}
}
if (!AltKeyMap)
CurrentKeyMap = CcKeyMap;
}
*cmdnum = cmd;
return OKCMD;
}
int
GetNextChar(cp)
register Char *cp;
{
register int num_read;
int tried = 0;
unsigned char tcp;
for (;;) {
if (MacroLvl < 0) {
if (!Load_input_line())
break;
}
if (*KeyMacro[MacroLvl] == 0) {
MacroLvl--;
continue;
}
*cp = *KeyMacro[MacroLvl]++ & CHAR;
if (*KeyMacro[MacroLvl] == 0) { /* Needed for QuoteMode On */
MacroLvl--;
}
return (1);
}
if (Rawmode() < 0) /* make sure the tty is set up correctly */
return 0; /* oops: SHIN was closed */
#ifdef WINNT
__nt_want_vcode = 1;
#endif /* WINNT */
while ((num_read = read(SHIN, (char *) &tcp, 1)) == -1) {
if (errno == EINTR)
continue;
if (!tried && fixio(SHIN, errno) != -1)
tried = 1;
else {
#ifdef convex
/* need to print error message in case the file is migrated */
if (errno != EINTR)
stderror(ERR_SYSTEM, progname, strerror(errno));
#endif /* convex */
#ifdef WINNT
__nt_want_vcode = 0;
#endif /* WINNT */
*cp = '\0';
return -1;
}
}
#ifdef WINNT
if (__nt_want_vcode == 2)
*cp = __nt_vcode;
else
*cp = tcp;
__nt_want_vcode = 0;
#else
*cp = tcp;
#endif /* WINNT */
return num_read;
}
/*
* SpellLine - do spelling correction on the entire command line
* (which may have trailing newline).
* If cmdonly is set, only check spelling of command words.
* Return value:
* -1: Something was incorrectible, and nothing was corrected
* 0: Everything was correct
* 1: Something was corrected
*/
static int
SpellLine(cmdonly)
int cmdonly;
{
int endflag, matchval;
Char *argptr, *OldCursor, *OldLastChar;
OldLastChar = LastChar;
OldCursor = Cursor;
argptr = InputBuf;
endflag = 1;
matchval = 0;
do {
while (ismetahash(*argptr) || iscmdmeta(*argptr))
argptr++;
for (Cursor = argptr;
*Cursor != '\0' && ((Cursor != argptr && Cursor[-1] == '\\') ||
(!ismetahash(*Cursor) && !iscmdmeta(*Cursor)));
Cursor++)
continue;
if (*Cursor == '\0') {
Cursor = LastChar;
if (LastChar[-1] == '\n')
Cursor--;
endflag = 0;
}
/* Obey current history character settings */
mismatch[0] = HIST;
mismatch[1] = HISTSUB;
if (!Strchr(mismatch, *argptr) &&
(!cmdonly || starting_a_command(argptr, InputBuf))) {
#ifdef WINNT
/*
* This hack avoids correcting drive letter changes
*/
if((Cursor - InputBuf) != 2 || (char)InputBuf[1] != ':')
#endif /* WINNT */
{
#ifdef HASH_SPELL_CHECK
Char save;
size_t len = Cursor - InputBuf;
save = InputBuf[len];
InputBuf[len] = '\0';
if (find_cmd(InputBuf, 0) != 0) {
InputBuf[len] = save;
argptr = Cursor;
continue;
}
InputBuf[len] = save;
#endif /* HASH_SPELL_CHECK */
switch (tenematch(InputBuf, Cursor - InputBuf, SPELL)) {
case 1: /* corrected */
matchval = 1;
break;
case -1: /* couldn't be corrected */
if (!matchval)
matchval = -1;
break;
default: /* was correct */
break;
}
}
if (LastChar != OldLastChar) {
if (argptr < OldCursor)
OldCursor += (LastChar - OldLastChar);
OldLastChar = LastChar;
}
}
argptr = Cursor;
} while (endflag);
Cursor = OldCursor;
return matchval;
}
/*
* CompleteLine - do command completion on the entire command line
* (which may have trailing newline).
* Return value:
* 0: No command matched or failure
* 1: One command matched
* 2: Several commands matched
*/
static int
CompleteLine()
{
int endflag, tmatch;
Char *argptr, *OldCursor, *OldLastChar;
OldLastChar = LastChar;
OldCursor = Cursor;
argptr = InputBuf;
endflag = 1;
do {
while (ismetahash(*argptr) || iscmdmeta(*argptr))
argptr++;
for (Cursor = argptr;
*Cursor != '\0' && ((Cursor != argptr && Cursor[-1] == '\\') ||
(!ismetahash(*Cursor) && !iscmdmeta(*Cursor)));
Cursor++)
continue;
if (*Cursor == '\0') {
Cursor = LastChar;
if (LastChar[-1] == '\n')
Cursor--;
endflag = 0;
}
if (!Strchr(mismatch, *argptr) && starting_a_command(argptr, InputBuf)) {
tmatch = tenematch(InputBuf, Cursor - InputBuf, RECOGNIZE);
if (tmatch <= 0) {
return 0;
} else if (tmatch > 1) {
return 2;
}
if (LastChar != OldLastChar) {
if (argptr < OldCursor)
OldCursor += (LastChar - OldLastChar);
OldLastChar = LastChar;
}
}
argptr = Cursor;
} while (endflag);
Cursor = OldCursor;
return 1;
}

1317
contrib/tcsh/ed.refresh.c Normal file

File diff suppressed because it is too large Load Diff

1706
contrib/tcsh/ed.screen.c Normal file

File diff suppressed because it is too large Load Diff

1150
contrib/tcsh/ed.term.c Normal file

File diff suppressed because it is too large Load Diff

492
contrib/tcsh/ed.term.h Normal file
View File

@ -0,0 +1,492 @@
/* $Header: /src/pub/tcsh/ed.term.h,v 1.13 1996/09/24 16:57:20 christos Exp $ */
/*
* ed.term.h: Local terminal header
*/
/*-
* Copyright (c) 1980, 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _h_ed_term
#define _h_ed_term
#define TO_CONTROL(A) ((A) & 037)
#if defined(TERMIO) || defined(POSIX)
/*
* Aix compatible names
*/
# if defined(VWERSE) && !defined(VWERASE)
# define VWERASE VWERSE
# endif /* VWERSE && !VWERASE */
# if defined(VDISCRD) && !defined(VDISCARD)
# define VDISCARD VDISCRD
# endif /* VDISCRD && !VDISCARD */
# if defined(VFLUSHO) && !defined(VDISCARD)
# define VDISCARD VFLUSHO
# endif /* VFLUSHO && VDISCARD */
# if defined(VSTRT) && !defined(VSTART)
# define VSTART VSTRT
# endif /* VSTRT && ! VSTART */
# if defined(VSTAT) && !defined(VSTATUS)
# define VSTATUS VSTAT
# endif /* VSTAT && ! VSTATUS */
# ifndef ONLRET
# define ONLRET 0
# endif /* ONLRET */
# ifndef TAB3
# ifdef OXTABS
# define TAB3 OXTABS
# else
# define TAB3 0
# endif /* OXTABS */
# endif /* !TAB3 */
# if defined(OXTABS) && !defined(XTABS)
# define XTABS OXTABS
# endif /* OXTABS && !XTABS */
# ifndef ONLCR
# define ONLCR 0
# endif /* ONLCR */
# ifndef IEXTEN
# define IEXTEN 0
# endif /* IEXTEN */
/*
* emx garbage
*/
# ifndef IDEFAULT
# define IDEFAULT 0
# endif /* IDEFAULT */
# ifndef IDELETE
# define IDELETE 0
# endif /* IDELETE */
# ifndef ECHOCTL
# define ECHOCTL 0
# endif /* ECHOCTL */
# ifndef PARENB
# define PARENB 0
# endif /* PARENB */
# ifndef EXTPROC
# define EXTPROC 0
# endif /* EXTPROC */
# ifndef FLUSHO
# define FLUSHO 0
# endif /* FLUSHO */
# if defined(VDISABLE) && !defined(_POSIX_VDISABLE)
# define _POSIX_VDISABLE VDISABLE
# endif /* VDISABLE && ! _POSIX_VDISABLE */
/*
* Work around ISC's definition of IEXTEN which is
* XCASE!
*/
# ifdef ISC
# if defined(IEXTEN) && defined(XCASE)
# if IEXTEN == XCASE
# undef IEXTEN
# define IEXTEN 0
# endif /* IEXTEN == XCASE */
# endif /* IEXTEN && XCASE */
# if defined(IEXTEN) && !defined(XCASE)
# define XCASE IEXTEN
# undef IEXTEN
# define IEXTEN 0
# endif /* IEXTEN && !XCASE */
# endif /* ISC */
/*
* Work around convex weirdness where turning off IEXTEN makes us
* lose all postprocessing!
*/
#ifdef convex
# if defined(IEXTEN) && IEXTEN != 0
# undef IEXTEN
# define IEXTEN 0
# endif /* IEXTEN != 0 */
#endif /* convex */
# else /* SGTTY */
# ifndef LPASS8
# define LPASS8 0
# endif /* LPASS8 */
#endif /* TERMIO || POSIX */
#ifndef _POSIX_VDISABLE
# define _POSIX_VDISABLE ((unsigned char) -1)
#endif /* _POSIX_VDISABLE */
#if !defined(CREPRINT) && defined(CRPRNT)
# define CREPRINT CRPRNT
#endif /* !CREPRINT && CRPRNT */
#if !defined(CDISCARD) && defined(CFLUSH)
# define CDISCARD CFLUSH
#endif /* !CDISCARD && CFLUSH */
#if !defined(CDISCARD) && defined(CFLUSHO)
# define CDISCARD CFLUSHO
#endif /* !CDISCARD && CFLUSHO */
/*
* IRIX4.0 control macro is broken!
* Ignore and undef all default tty chars defined and redefine only
* the ones that are different in the IRIX file.
*/
#if __STDC__ && defined(IRIS4D)
# undef CINTR
# define CINTR 0177 /* ^? */
# undef CQUIT
# undef CERASE
# define CERASE TO_CONTROL('h')
# undef CKILL
# undef CEOF
# undef CEOL
# undef CEOL2
# undef CSWTCH
# define CSWTCH TO_CONTROL('z')
# undef CDSWTCH
# undef CERASE2
# undef CSTART
# undef CSTOP
# undef CWERASE
# undef CSUSP
# undef CDSUSP
# undef CREPRINT
# undef CDISCARD
# undef CLNEXT
# undef CSTATUS
# undef CPAGE
# undef CPGOFF
# undef CKILL2
# undef CBRK
# undef CMIN
# undef CTIME
#endif /* __STDC__ && IRIS4D */
#ifndef CINTR
# define CINTR TO_CONTROL('c')
#endif /* CINTR */
#ifndef CQUIT
# define CQUIT 034 /* ^\ */
#endif /* CQUIT */
#ifndef CERASE
# define CERASE 0177 /* ^? */
#endif /* CERASE */
#ifndef CKILL
# define CKILL TO_CONTROL('u')
#endif /* CKILL */
#ifndef CEOF
# define CEOF TO_CONTROL('d')
#endif /* CEOF */
#ifndef CEOL
# define CEOL _POSIX_VDISABLE
#endif /* CEOL */
#ifndef CEOL2
# define CEOL2 _POSIX_VDISABLE
#endif /* CEOL2 */
#ifndef CSWTCH
# define CSWTCH _POSIX_VDISABLE
#endif /* CSWTCH */
#ifndef CDSWTCH
# define CDSWTCH _POSIX_VDISABLE
#endif /* CDSWTCH */
#ifndef CERASE2
# define CERASE2 _POSIX_VDISABLE
#endif /* CERASE2 */
#ifndef CSTART
# define CSTART TO_CONTROL('q')
#endif /* CSTART */
#ifndef CSTOP
# define CSTOP TO_CONTROL('s')
#endif /* CSTOP */
#ifndef CSUSP
# define CSUSP TO_CONTROL('z')
#endif /* CSUSP */
#ifndef CDSUSP
# define CDSUSP TO_CONTROL('y')
#endif /* CDSUSP */
#ifdef hpux
# ifndef CREPRINT
# define CREPRINT _POSIX_VDISABLE
# endif /* CREPRINT */
# ifndef CDISCARD
# define CDISCARD _POSIX_VDISABLE
# endif /* CDISCARD */
# ifndef CLNEXT
# define CLNEXT _POSIX_VDISABLE
# endif /* CLNEXT */
# ifndef CWERASE
# define CWERASE _POSIX_VDISABLE
# endif /* CWERASE */
#else /* !hpux */
# ifndef CREPRINT
# define CREPRINT TO_CONTROL('r')
# endif /* CREPRINT */
# ifndef CDISCARD
# define CDISCARD TO_CONTROL('o')
# endif /* CDISCARD */
# ifndef CLNEXT
# define CLNEXT TO_CONTROL('v')
# endif /* CLNEXT */
# ifndef CWERASE
# define CWERASE TO_CONTROL('w')
# endif /* CWERASE */
#endif /* hpux */
#ifndef CSTATUS
# define CSTATUS TO_CONTROL('t')
#endif /* CSTATUS */
#ifndef CPAGE
# define CPAGE ' '
#endif /* CPAGE */
#ifndef CPGOFF
# define CPGOFF TO_CONTROL('m')
#endif /* CPGOFF */
#ifndef CKILL2
# define CKILL2 _POSIX_VDISABLE
#endif /* CKILL2 */
#ifndef CBRK
# ifndef masscomp
# define CBRK 0377
# else
# define CBRK '\0'
# endif /* masscomp */
#endif /* CBRK */
#ifndef CMIN
# define CMIN CEOF
#endif /* CMIN */
#ifndef CTIME
# define CTIME CEOL
#endif /* CTIME */
/*
* Fix for sun inconsistency. On termio VSUSP and the rest of the
* ttychars > NCC are defined. So we undefine them.
*/
#if defined(TERMIO) || defined(POSIX)
# if defined(POSIX) && defined(NCCS)
# define NUMCC NCCS
# else
# ifdef NCC
# define NUMCC NCC
# endif /* NCC */
# endif /* POSIX && NCCS */
# ifdef NUMCC
# ifdef VINTR
# if NUMCC <= VINTR
# undef VINTR
# endif /* NUMCC <= VINTR */
# endif /* VINTR */
# ifdef VQUIT
# if NUMCC <= VQUIT
# undef VQUIT
# endif /* NUMCC <= VQUIT */
# endif /* VQUIT */
# ifdef VERASE
# if NUMCC <= VERASE
# undef VERASE
# endif /* NUMCC <= VERASE */
# endif /* VERASE */
# ifdef VKILL
# if NUMCC <= VKILL
# undef VKILL
# endif /* NUMCC <= VKILL */
# endif /* VKILL */
# ifdef VEOF
# if NUMCC <= VEOF
# undef VEOF
# endif /* NUMCC <= VEOF */
# endif /* VEOF */
# ifdef VEOL
# if NUMCC <= VEOL
# undef VEOL
# endif /* NUMCC <= VEOL */
# endif /* VEOL */
# ifdef VEOL2
# if NUMCC <= VEOL2
# undef VEOL2
# endif /* NUMCC <= VEOL2 */
# endif /* VEOL2 */
# ifdef VSWTCH
# if NUMCC <= VSWTCH
# undef VSWTCH
# endif /* NUMCC <= VSWTCH */
# endif /* VSWTCH */
# ifdef VDSWTCH
# if NUMCC <= VDSWTCH
# undef VDSWTCH
# endif /* NUMCC <= VDSWTCH */
# endif /* VDSWTCH */
# ifdef VERASE2
# if NUMCC <= VERASE2
# undef VERASE2
# endif /* NUMCC <= VERASE2 */
# endif /* VERASE2 */
# ifdef VSTART
# if NUMCC <= VSTART
# undef VSTART
# endif /* NUMCC <= VSTART */
# endif /* VSTART */
# ifdef VSTOP
# if NUMCC <= VSTOP
# undef VSTOP
# endif /* NUMCC <= VSTOP */
# endif /* VSTOP */
# ifdef VWERASE
# if NUMCC <= VWERASE
# undef VWERASE
# endif /* NUMCC <= VWERASE */
# endif /* VWERASE */
# ifdef VSUSP
# if NUMCC <= VSUSP
# undef VSUSP
# endif /* NUMCC <= VSUSP */
# endif /* VSUSP */
# ifdef VDSUSP
# if NUMCC <= VDSUSP
# undef VDSUSP
# endif /* NUMCC <= VDSUSP */
# endif /* VDSUSP */
# ifdef VREPRINT
# if NUMCC <= VREPRINT
# undef VREPRINT
# endif /* NUMCC <= VREPRINT */
# endif /* VREPRINT */
# ifdef VDISCARD
# if NUMCC <= VDISCARD
# undef VDISCARD
# endif /* NUMCC <= VDISCARD */
# endif /* VDISCARD */
# ifdef VLNEXT
# if NUMCC <= VLNEXT
# undef VLNEXT
# endif /* NUMCC <= VLNEXT */
# endif /* VLNEXT */
# ifdef VSTATUS
# if NUMCC <= VSTATUS
# undef VSTATUS
# endif /* NUMCC <= VSTATUS */
# endif /* VSTATUS */
# ifdef VPAGE
# if NUMCC <= VPAGE
# undef VPAGE
# endif /* NUMCC <= VPAGE */
# endif /* VPAGE */
# ifdef VPGOFF
# if NUMCC <= VPGOFF
# undef VPGOFF
# endif /* NUMCC <= VPGOFF */
# endif /* VPGOFF */
# ifdef VKILL2
# if NUMCC <= VKILL2
# undef VKILL2
# endif /* NUMCC <= VKILL2 */
# endif /* VKILL2 */
# ifdef VBRK
# if NUMCC <= VBRK
# undef VBRK
# endif /* NUMCC <= VBRK */
# endif /* VBRK */
# ifdef VMIN
# if NUMCC <= VMIN
# undef VMIN
# endif /* NUMCC <= VMIN */
# endif /* VMIN */
# ifdef VTIME
# if NUMCC <= VTIME
# undef VTIME
# endif /* NUMCC <= VTIME */
# endif /* VTIME */
# endif /* NUMCC */
#endif /* !POSIX */
/*
* fix for hpux10 inconsistency: it has VWERASE, but TIOCSLTC returns
* EINVAL if one tries to change it
*/
#if defined(hpux) && defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && d
efined(VLNEXT)
# undef TIOCGLTC /* not really needed */
# undef TIOCSLTC
#endif
#define C_INTR 0
#define C_QUIT 1
#define C_ERASE 2
#define C_KILL 3
#define C_EOF 4
#define C_EOL 5
#define C_EOL2 6
#define C_SWTCH 7
#define C_DSWTCH 8
#define C_ERASE2 9
#define C_START 10
#define C_STOP 11
#define C_WERASE 12
#define C_SUSP 13
#define C_DSUSP 14
#define C_REPRINT 15
#define C_DISCARD 16
#define C_LNEXT 17
#define C_STATUS 18
#define C_PAGE 19
#define C_PGOFF 20
#define C_KILL2 21
#define C_BRK 22
#define C_MIN 23
#define C_TIME 24
#define C_NCC 25
#define C_SH(A) (1 << (A))
#endif /* _h_ed_term */

844
contrib/tcsh/ed.xmap.c Normal file
View File

@ -0,0 +1,844 @@
/* $Header: /src/pub/tcsh/ed.xmap.c,v 3.21 1999/06/01 20:01:32 christos Exp $ */
/*
* ed.xmap.c: This module contains the procedures for maintaining
* the extended-key map.
*
* An extended-key (Xkey) is a sequence of keystrokes
* introduced with an sequence introducer and consisting
* of an arbitrary number of characters. This module maintains
* a map (the Xmap) to convert these extended-key sequences
* into input strings (XK_STR), editor functions (XK_CMD), or
* unix commands (XK_EXE). It contains the
* following externally visible functions.
*
* int GetXkey(ch,val);
* CStr *ch;
* XmapVal *val;
*
* Looks up *ch in map and then reads characters until a
* complete match is found or a mismatch occurs. Returns the
* type of the match found (XK_STR, XK_CMD, or XK_EXE).
* Returns NULL in val.str and XK_STR for no match.
* The last character read is returned in *ch.
*
* void AddXkey(Xkey, val, ntype);
* CStr *Xkey;
* XmapVal *val;
* int ntype;
*
* Adds Xkey to the Xmap and associates the value in val with it.
* If Xkey is already is in Xmap, the new code is applied to the
* existing Xkey. Ntype specifies if code is a command, an
* out string or a unix command.
*
* int DeleteXkey(Xkey);
* CStr *Xkey;
*
* Delete the Xkey and all longer Xkeys staring with Xkey, if
* they exists.
*
* Warning:
* If Xkey is a substring of some other Xkeys, then the longer
* Xkeys are lost!! That is, if the Xkeys "abcd" and "abcef"
* are in Xmap, adding the key "abc" will cause the first two
* definitions to be lost.
*
* void ResetXmap();
*
* Removes all entries from Xmap and resets the defaults.
*
* void PrintXkey(Xkey);
* CStr *Xkey;
*
* Prints all extended keys prefixed by Xkey and their associated
* commands.
*
* Restrictions:
* -------------
* 1) It is not possible to have one Xkey that is a
* substring of another.
*/
/*-
* Copyright (c) 1980, 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "sh.h"
RCSID("$Id: ed.xmap.c,v 3.21 1999/06/01 20:01:32 christos Exp $")
#include "ed.h"
#include "ed.defns.h"
#ifndef NULL
#define NULL 0
#endif
/* Internal Data types and declarations */
/* The Nodes of the Xmap. The Xmap is a linked list of these node
* elements
*/
typedef struct Xmapnode {
Char ch; /* single character of Xkey */
int type;
XmapVal val; /* command code or pointer to string, if this
* is a leaf */
struct Xmapnode *next; /* ptr to next char of this Xkey */
struct Xmapnode *sibling; /* ptr to another Xkey with same prefix */
} XmapNode;
static XmapNode *Xmap = NULL; /* the current Xmap */
#define MAXXKEY 100 /* max length of a Xkey for print putposes */
static Char printbuf[MAXXKEY]; /* buffer for printing */
/* Some declarations of procedures */
static int TraverseMap __P((XmapNode *, CStr *, XmapVal *));
static int TryNode __P((XmapNode *, CStr *, XmapVal *, int));
static XmapNode *GetFreeNode __P((CStr *));
static void PutFreeNode __P((XmapNode *));
static int TryDeleteNode __P((XmapNode **, CStr *));
static int Lookup __P((CStr *, XmapNode *, int));
static int Enumerate __P((XmapNode *, int));
static int unparsech __P((int, Char *));
XmapVal *
XmapCmd(cmd)
int cmd;
{
static XmapVal xm;
xm.cmd = (KEYCMD) cmd;
return &xm;
}
XmapVal *
XmapStr(str)
CStr *str;
{
static XmapVal xm;
xm.str.len = str->len;
xm.str.buf = str->buf;
return &xm;
}
/* ResetXmap():
* Takes all nodes on Xmap and puts them on free list. Then
* initializes Xmap with arrow keys
*/
void
ResetXmap()
{
PutFreeNode(Xmap);
Xmap = NULL;
DefaultArrowKeys();
return;
}
/* GetXkey():
* Calls the recursive function with entry point Xmap
*/
int
GetXkey(ch, val)
CStr *ch;
XmapVal *val;
{
return (TraverseMap(Xmap, ch, val));
}
/* TraverseMap():
* recursively traverses node in tree until match or mismatch is
* found. May read in more characters.
*/
static int
TraverseMap(ptr, ch, val)
XmapNode *ptr;
CStr *ch;
XmapVal *val;
{
Char tch;
if (ptr->ch == *(ch->buf)) {
/* match found */
if (ptr->next) {
/* Xkey not complete so get next char */
if (GetNextChar(&tch) != 1) { /* if EOF or error */
val->cmd = F_SEND_EOF;
return XK_CMD;/* PWP: Pretend we just read an end-of-file */
}
*(ch->buf) = tch;
return (TraverseMap(ptr->next, ch, val));
}
else {
*val = ptr->val;
if (ptr->type != XK_CMD)
*(ch->buf) = '\0';
return ptr->type;
}
}
else {
/* no match found here */
if (ptr->sibling) {
/* try next sibling */
return (TraverseMap(ptr->sibling, ch, val));
}
else {
/* no next sibling -- mismatch */
val->str.buf = NULL;
val->str.len = 0;
return XK_STR;
}
}
}
void
AddXkey(Xkey, val, ntype)
CStr *Xkey;
XmapVal *val;
int ntype;
{
CStr cs;
cs.buf = Xkey->buf;
cs.len = Xkey->len;
if (Xkey->len == 0) {
xprintf(CGETS(9, 1, "AddXkey: Null extended-key not allowed.\n"));
return;
}
if (ntype == XK_CMD && val->cmd == F_XKEY) {
xprintf(CGETS(9, 2, "AddXkey: sequence-lead-in command not allowed\n"));
return;
}
if (Xmap == NULL)
/* tree is initially empty. Set up new node to match Xkey[0] */
Xmap = GetFreeNode(&cs); /* it is properly initialized */
/* Now recurse through Xmap */
(void) TryNode(Xmap, &cs, val, ntype);
return;
}
static int
TryNode(ptr, str, val, ntype)
XmapNode *ptr;
CStr *str;
XmapVal *val;
int ntype;
{
/*
* Find a node that matches *string or allocate a new one
*/
if (ptr->ch != *(str->buf)) {
XmapNode *xm;
for (xm = ptr; xm->sibling != NULL; xm = xm->sibling)
if (xm->sibling->ch == *(str->buf))
break;
if (xm->sibling == NULL)
xm->sibling = GetFreeNode(str); /* setup new node */
ptr = xm->sibling;
}
str->buf++;
str->len--;
if (str->len == 0) {
/* we're there */
if (ptr->next != NULL) {
PutFreeNode(ptr->next); /* lose longer Xkeys with this prefix */
ptr->next = NULL;
}
switch (ptr->type) {
case XK_STR:
case XK_EXE:
if (ptr->val.str.buf != NULL)
xfree((ptr_t) ptr->val.str.buf);
ptr->val.str.len = 0;
break;
case XK_NOD:
case XK_CMD:
break;
default:
abort();
break;
}
switch (ptr->type = ntype) {
case XK_CMD:
ptr->val = *val;
break;
case XK_STR:
case XK_EXE:
ptr->val.str.len = (val->str.len + 1) * sizeof(Char);
ptr->val.str.buf = (Char *) xmalloc((size_t) ptr->val.str.len);
(void) memmove((ptr_t) ptr->val.str.buf, (ptr_t) val->str.buf,
(size_t) ptr->val.str.len);
ptr->val.str.len = val->str.len;
break;
default:
abort();
break;
}
}
else {
/* still more chars to go */
if (ptr->next == NULL)
ptr->next = GetFreeNode(str); /* setup new node */
(void) TryNode(ptr->next, str, val, ntype);
}
return (0);
}
void
ClearXkey(map, in)
KEYCMD *map;
CStr *in;
{
unsigned char c = (unsigned char) *(in->buf);
if ((map[c] == F_XKEY) &&
((map == CcKeyMap && CcAltMap[c] != F_XKEY) ||
(map == CcAltMap && CcKeyMap[c] != F_XKEY)))
(void) DeleteXkey(in);
}
int
DeleteXkey(Xkey)
CStr *Xkey;
{
if (Xkey->len == 0) {
xprintf(CGETS(9, 3, "DeleteXkey: Null extended-key not allowed.\n"));
return (-1);
}
if (Xmap == NULL)
return (0);
(void) TryDeleteNode(&Xmap, Xkey);
return (0);
}
static int
TryDeleteNode(inptr, str)
XmapNode **inptr;
CStr *str;
{
XmapNode *ptr;
XmapNode *prev_ptr = NULL;
ptr = *inptr;
/*
* Find a node that matches *string or allocate a new one
*/
if (ptr->ch != *(str->buf)) {
XmapNode *xm;
for (xm = ptr; xm->sibling != NULL; xm = xm->sibling)
if (xm->sibling->ch == *(str->buf))
break;
if (xm->sibling == NULL)
return (0);
prev_ptr = xm;
ptr = xm->sibling;
}
str->buf++;
str->len--;
if (str->len == 0) {
/* we're there */
if (prev_ptr == NULL)
*inptr = ptr->sibling;
else
prev_ptr->sibling = ptr->sibling;
ptr->sibling = NULL;
PutFreeNode(ptr);
return (1);
}
else if (ptr->next != NULL && TryDeleteNode(&ptr->next, str) == 1) {
if (ptr->next != NULL)
return (0);
if (prev_ptr == NULL)
*inptr = ptr->sibling;
else
prev_ptr->sibling = ptr->sibling;
ptr->sibling = NULL;
PutFreeNode(ptr);
return (1);
}
else {
return (0);
}
}
/* PutFreeNode():
* Puts a tree of nodes onto free list using free(3).
*/
static void
PutFreeNode(ptr)
XmapNode *ptr;
{
if (ptr == NULL)
return;
if (ptr->next != NULL) {
PutFreeNode(ptr->next);
ptr->next = NULL;
}
PutFreeNode(ptr->sibling);
switch (ptr->type) {
case XK_CMD:
case XK_NOD:
break;
case XK_EXE:
case XK_STR:
if (ptr->val.str.buf != NULL)
xfree((ptr_t) ptr->val.str.buf);
break;
default:
abort();
break;
}
xfree((ptr_t) ptr);
}
/* GetFreeNode():
* Returns pointer to an XmapNode for ch.
*/
static XmapNode *
GetFreeNode(ch)
CStr *ch;
{
XmapNode *ptr;
ptr = (XmapNode *) xmalloc((size_t) sizeof(XmapNode));
ptr->ch = ch->buf[0];
ptr->type = XK_NOD;
ptr->val.str.buf = NULL;
ptr->val.str.len = 0;
ptr->next = NULL;
ptr->sibling = NULL;
return (ptr);
}
/* PrintXKey():
* Print the binding associated with Xkey key.
* Print entire Xmap if null
*/
void
PrintXkey(key)
CStr *key;
{
CStr cs;
if (key) {
cs.buf = key->buf;
cs.len = key->len;
}
else {
cs.buf = STRNULL;
cs.len = 0;
}
/* do nothing if Xmap is empty and null key specified */
if (Xmap == NULL && cs.len == 0)
return;
printbuf[0] = '"';
if (Lookup(&cs, Xmap, 1) <= -1)
/* key is not bound */
xprintf(CGETS(9, 4, "Unbound extended key \"%S\"\n"), cs.buf);
return;
}
/* Lookup():
* look for the string starting at node ptr.
* Print if last node
*/
static int
Lookup(str, ptr, cnt)
CStr *str;
XmapNode *ptr;
int cnt;
{
int ncnt;
if (ptr == NULL)
return (-1); /* cannot have null ptr */
if (str->len == 0) {
/* no more chars in string. Enumerate from here. */
(void) Enumerate(ptr, cnt);
return (0);
}
else {
/* If match put this char into printbuf. Recurse */
if (ptr->ch == *(str->buf)) {
/* match found */
ncnt = unparsech(cnt, &ptr->ch);
if (ptr->next != NULL) {
/* not yet at leaf */
CStr tstr;
tstr.buf = str->buf + 1;
tstr.len = str->len - 1;
return (Lookup(&tstr, ptr->next, ncnt + 1));
}
else {
/* next node is null so key should be complete */
if (str->len == 1) {
CStr pb;
printbuf[ncnt + 1] = '"';
printbuf[ncnt + 2] = '\0';
pb.buf = printbuf;
pb.len = ncnt + 2;
(void) printOne(&pb, &ptr->val, ptr->type);
return (0);
}
else
return (-1);/* mismatch -- string still has chars */
}
}
else {
/* no match found try sibling */
if (ptr->sibling)
return (Lookup(str, ptr->sibling, cnt));
else
return (-1);
}
}
}
static int
Enumerate(ptr, cnt)
XmapNode *ptr;
int cnt;
{
int ncnt;
if (cnt >= MAXXKEY - 5) { /* buffer too small */
printbuf[++cnt] = '"';
printbuf[++cnt] = '\0';
xprintf(CGETS(9, 5,
"Some extended keys too long for internal print buffer"));
xprintf(" \"%S...\"\n", printbuf);
return (0);
}
if (ptr == NULL) {
#ifdef DEBUG_EDIT
xprintf(CGETS(9, 6, "Enumerate: BUG!! Null ptr passed\n!"));
#endif
return (-1);
}
ncnt = unparsech(cnt, &ptr->ch); /* put this char at end of string */
if (ptr->next == NULL) {
CStr pb;
/* print this Xkey and function */
printbuf[++ncnt] = '"';
printbuf[++ncnt] = '\0';
pb.buf = printbuf;
pb.len = ncnt;
(void) printOne(&pb, &ptr->val, ptr->type);
}
else
(void) Enumerate(ptr->next, ncnt + 1);
/* go to sibling if there is one */
if (ptr->sibling)
(void) Enumerate(ptr->sibling, cnt);
return (0);
}
/* PrintOne():
* Print the specified key and its associated
* function specified by val
*/
int
printOne(key, val, ntype)
CStr *key;
XmapVal *val;
int ntype;
{
struct KeyFuncs *fp;
unsigned char unparsbuf[200];
static char *fmt = "%s\n";
xprintf("%-15S-> ", key->buf);
if (val != NULL)
switch (ntype) {
case XK_STR:
case XK_EXE:
xprintf(fmt, unparsestring(&val->str, unparsbuf,
ntype == XK_STR ? STRQQ : STRBB));
break;
case XK_CMD:
for (fp = FuncNames; fp->name; fp++)
if (val->cmd == fp->func)
xprintf(fmt, fp->name);
break;
default:
abort();
break;
}
else
xprintf(fmt, key, CGETS(9, 7, "no input"));
return (0);
}
static int
unparsech(cnt, ch)
int cnt;
Char *ch;
{
if (ch == 0) {
printbuf[cnt++] = '^';
printbuf[cnt] = '@';
return cnt;
}
if (Iscntrl(*ch)) {
#ifndef _OSD_POSIX
printbuf[cnt++] = '^';
if (*ch == CTL_ESC('\177'))
printbuf[cnt] = '?';
else
printbuf[cnt] = *ch | 0100;
#else /*_OSD_POSIX*/
if (*ch == CTL_ESC('\177'))
{
printbuf[cnt++] = '^';
printbuf[cnt] = '?';
}
else if (Isupper(_toebcdic[_toascii[*ch]|0100])
|| strchr("@[\\]^_", _toebcdic[_toascii[*ch]|0100]) != NULL)
{
printbuf[cnt++] = '^';
printbuf[cnt] = _toebcdic[_toascii[*ch]|0100];
}
else
{
printbuf[cnt++] = '\\';
printbuf[cnt++] = ((*ch >> 6) & 7) + '0';
printbuf[cnt++] = ((*ch >> 3) & 7) + '0';
printbuf[cnt] = (*ch & 7) + '0';
}
#endif /*_OSD_POSIX*/
}
else if (*ch == '^') {
printbuf[cnt++] = '\\';
printbuf[cnt] = '^';
}
else if (*ch == '\\') {
printbuf[cnt++] = '\\';
printbuf[cnt] = '\\';
}
else if (*ch == ' ' || (Isprint(*ch) && !Isspace(*ch))) {
printbuf[cnt] = *ch;
}
else {
printbuf[cnt++] = '\\';
printbuf[cnt++] = ((*ch >> 6) & 7) + '0';
printbuf[cnt++] = ((*ch >> 3) & 7) + '0';
printbuf[cnt] = (*ch & 7) + '0';
}
return cnt;
}
int
parseescape(ptr)
const Char **ptr;
{
const Char *p;
Char c;
p = *ptr;
if ((p[1] & CHAR) == 0) {
xprintf(CGETS(9, 8, "Something must follow: %c\n"), *p);
return -1;
}
if ((*p & CHAR) == '\\') {
p++;
switch (*p & CHAR) {
case 'a':
c = CTL_ESC('\007'); /* Bell */
break;
case 'b':
c = CTL_ESC('\010'); /* Backspace */
break;
case 'e':
c = CTL_ESC('\033'); /* Escape */
break;
case 'f':
c = CTL_ESC('\014'); /* Form Feed */
break;
case 'n':
c = CTL_ESC('\012'); /* New Line */
break;
case 'r':
c = CTL_ESC('\015'); /* Carriage Return */
break;
case 't':
c = CTL_ESC('\011'); /* Horizontal Tab */
break;
case 'v':
c = CTL_ESC('\013'); /* Vertical Tab */
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
{
register int cnt, val, ch;
for (cnt = 0, val = 0; cnt < 3; cnt++) {
ch = *p++ & CHAR;
if (ch < '0' || ch > '7') {
p--;
break;
}
val = (val << 3) | (ch - '0');
}
if ((val & 0xffffff00) != 0) {
xprintf(CGETS(9, 9,
"Octal constant does not fit in a char.\n"));
return 0;
}
#ifdef _OSD_POSIX
if (CTL_ESC(val) != val && adrof(STRwarnebcdic))
xprintf(/*CGETS(9, 9, no NLS-String yet!*/
"Warning: Octal constant \\%3.3o is interpreted as EBCDIC value.\n", val/*)*/);
#endif
c = (Char) val;
--p;
}
break;
default:
c = *p;
break;
}
}
else if ((*p & CHAR) == '^' && (Isalpha(p[1] & CHAR) ||
strchr("@^_?\\|[{]}", p[1] & CHAR))) {
p++;
#ifndef _OSD_POSIX
c = ((*p & CHAR) == '?') ? CTL_ESC('\177') : ((*p & CHAR) & 0237);
#else /*_OSD_POSIX*/
c = ((*p & CHAR) == '?') ? CTL_ESC('\177') : _toebcdic[_toascii[*p & CHAR] & 0237];
if (adrof(STRwarnebcdic))
xprintf(/*CGETS(9, 9, no NLS-String yet!*/
"Warning: Control character ^%c may be interpreted differently in EBCDIC.\n", *p & CHAR /*)*/);
#endif /*_OSD_POSIX*/
}
else
c = *p;
*ptr = p;
return (c);
}
unsigned char *
unparsestring(str, buf, sep)
CStr *str;
unsigned char *buf;
Char *sep;
{
unsigned char *b;
Char p;
int l;
b = buf;
if (sep[0])
#ifndef WINNT
*b++ = sep[0];
#else /* WINNT */
*b++ = CHAR & sep[0];
#endif /* !WINNT */
for (l = 0; l < str->len; l++) {
p = str->buf[l];
if (Iscntrl(p)) {
#ifndef _OSD_POSIX
*b++ = '^';
if (p == CTL_ESC('\177'))
*b++ = '?';
else
*b++ = (unsigned char) (p | 0100);
#else /*_OSD_POSIX*/
if (_toascii[p] == '\177' || Isupper(_toebcdic[_toascii[p]|0100])
|| strchr("@[\\]^_", _toebcdic[_toascii[p]|0100]) != NULL)
{
*b++ = '^';
*b++ = (_toascii[p] == '\177') ? '?' : _toebcdic[_toascii[p]|0100];
}
else
{
*b++ = '\\';
*b++ = ((p >> 6) & 7) + '0';
*b++ = ((p >> 3) & 7) + '0';
*b++ = (p & 7) + '0';
}
#endif /*_OSD_POSIX*/
}
else if (p == '^' || p == '\\') {
*b++ = '\\';
*b++ = (unsigned char) p;
}
else if (p == ' ' || (Isprint(p) && !Isspace(p))) {
*b++ = (unsigned char) p;
}
else {
*b++ = '\\';
*b++ = ((p >> 6) & 7) + '0';
*b++ = ((p >> 3) & 7) + '0';
*b++ = (p & 7) + '0';
}
}
if (sep[0] && sep[1])
#ifndef WINNT
*b++ = sep[1];
#else /* WINNT */
*b++ = CHAR & sep[1];
#endif /* !WINNT */
*b++ = 0;
return buf; /* should check for overflow */
}

143
contrib/tcsh/eight-bit.me Normal file
View File

@ -0,0 +1,143 @@
.\" $Id: eight-bit.me,v 3.1 1991/09/12 09:25:57 christos Exp $
How to use 8 bit characters
by
Johan Widen
(jw@sics.se)
and
Per Hedeland
(per@erix.ericsson.se)
.pp
(Disclaimer: This is really a sketch of an approach rather
than a "how-to" document.
Also, it is mostly relevant to Swedish X Window users...)
.pp
The way I use this facility at present is to add lines such as the following
to my .cshrc:
.nf
setenv NOREBIND
setenv LC_CTYPE iso_8859_1
foreach key ( \\\\304 \\\\305 \\\\326 \\\\344 \\\\345 \\\\366 )
bindkey $key self-insert-command
end
.fi
.pp
Note that if I used a system with a reasonably complete NLS
(and a tcsh compiled to use it),
all of the above could be replaced with simply setting the LANG environment
variable to an appropriate value - the NLS would then indicate exactly which
characters should be considered printable, and tcsh would do the rebinding
of these automatically. The above works for tcsh's simulated NLS and for
the NLS in SunOS 4.1 - without the NOREBIND setting, all of the
Meta-<non-control-character> bindings would be undone in these cases.
.pp
These keybindings are the codes for my national characters, but the bindings
(M-d, M-e etc) are not conveniently placed.
They are however consistent with what other programs will see.
.pp
Now: I actually want the character \\304 to be inserted when I press say '{'
together with a modifier key. I want the behavior to be the same not only
in tcsh but in say cat, an editor and all other programs. I fix this by
performing a keyboard remapping with the
.i xmodmap
program (I use X Windows).
.pp
I give xmodmap an input something like the following:
.nf
keycode 26 = Mode_switch
add mod2 = Mode_switch
! if you want Mode_switch to toggle, at the expense of losing
! Caps- or whatever Lock you currently have, add the two lines below
! clear Lock
! add Lock = Mode_switch
! Binds swedish characters on ][\\
!
keycode 71 = bracketleft braceleft adiaeresis Adiaeresis
keycode 72 = bracketright braceright aring Aring
keycode 95 = backslash bar odiaeresis Odiaeresis
.fi
or:
.nf
keysym Alt_R = Mode_switch
add mod2 = Mode_switch
keysym bracketleft = bracketleft braceleft Adiaeresis adiaeresis
keysym bracketright = bracketright braceright Aring aring
keysym backslash = backslash bar Odiaeresis odiaeresis
.fi
Another, more portable way of doing the same thing is:
.nf
#!/bin/sh
# Make Alt-] etc produce the "appropriate" Swedish iso8859/1 keysym values
# Should handle fairly strange initial mappings
xmodmap -pk | sed -e 's/[()]//g' | \\
awk 'BEGIN {
alt["bracketright"] = "Aring"; alt["braceright"] = "aring";
alt["bracketleft"] = "Adiaeresis"; alt["braceleft"] = "adiaeresis";
alt["backslash"] = "Odiaeresis"; alt["bar"] = "odiaeresis";
}
NF >= 5 && (alt[$3] != "" || alt[$5] != "") {
printf "keycode %s = %s %s ", $1, $3, $5;
if (alt[$3] != "") printf "%s ", alt[$3];
else printf "%s ", $3;
printf "%s\\n", alt[$5];
next;
}
alt[$3] != "" {
printf "keycode %s = %s %s %s\\n", $1, $3, $3, alt[$3];
}
NF >= 5 && ($3 ~ /^Alt_[LR]$/ || $5 ~ /^Alt_[LR]$/) {
printf "keycode %s = %s %s Mode_switch\\n", $1, $3, $5;
if ($3 ~ /^Alt_[LR]$/) altkeys = altkeys " " $3;
else altkeys = altkeys " " $5;
next;
}
$3 ~ /^Alt_[LR]$/ {
printf "keycode %s = %s %s Mode_switch\\n", $1, $3, $3;
altkeys = altkeys " " $3;
}
END {
if (altkeys != "") printf "clear mod2\\nadd mod2 =%s\\n", altkeys;
}' | xmodmap -
.fi
.pp
Finally, with the binding of the codes of my national characters to
self-insert-command, I lost the ability to use the Meta key to call the
functions previously bound to M-d, M-e, and M-v (<esc>d etc still works).
However, with the assumption that
most of my input to tcsh will be through the
.i xterm
terminal emulator, I can get that ability back via xterm bindings!
Since M-d is the only one of the "lost" key combinations that was
actually bound to a function in my case,
and it had the same binding as M-D, I can use the following in
my .Xdefaults file:
.nf
XTerm*VT100.Translations: #override \\n\\
Meta ~Ctrl<Key>d: string(0x1b) string(d)
.fi
- or, if I really want a complete mapping:
.nf
XTerm*VT100.Translations: #override \\n\\
:Meta ~Ctrl<Key>d: string(0x1b) string(d) \\n\\
:Meta ~Ctrl<Key>D: string(0x1b) string(D) \\n\\
:Meta ~Ctrl<Key>e: string(0x1b) string(e) \\n\\
:Meta ~Ctrl<Key>E: string(0x1b) string(E) \\n\\
:Meta ~Ctrl<Key>v: string(0x1b) string(v) \\n\\
:Meta ~Ctrl<Key>V: string(0x1b) string(V)
.fi

344
contrib/tcsh/gethost.c Normal file
View File

@ -0,0 +1,344 @@
/* $Header: /src/pub/tcsh/gethost.c,v 1.7 1997/10/28 22:34:19 christos Exp $ */
/*
* gethost.c: Create version file from prototype
*/
/*-
* Copyright (c) 1980, 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "sh.h"
RCSID("$Id: gethost.c,v 1.7 1997/10/28 22:34:19 christos Exp $")
#ifdef SCO
# define perror __perror
# define rename __rename
# define getopt __getopt
# define system __system
#endif
#include <stdio.h>
#ifdef SCO
# undef perror
# undef rename
# undef getopt
# undef system
#endif
#include <ctype.h>
/* Some people don't bother to declare these */
#if defined(SUNOS4) || defined(ibm032)
extern int fprintf();
extern int fclose();
#endif /* SUNOS4 || ibm032 */
#define ISSPACE(p) (isspace((unsigned char) (p)) && (p) != '\n')
/*
* We cannot do that, because some compilers like #line and others
* like # <lineno>
* #define LINEDIRECTIVE
*/
static const char *keyword[] =
{
"vendor",
#define T_VENDOR 0
"hosttype",
#define T_HOSTTYPE 1
"machtype",
#define T_MACHTYPE 2
"ostype",
#define T_OSTYPE 3
"newdef",
#define T_NEWDEF 4
"enddef",
#define T_ENDDEF 5
"newcode",
#define T_NEWCODE 6
"endcode",
#define T_ENDCODE 7
"comment",
#define T_COMMENT 8
"macro",
#define T_MACRO 9
NULL
#define T_NONE 10
};
#define S_DISCARD 0
#define S_COMMENT 1
#define S_CODE 2
#define S_KEYWORD 3
static int findtoken __P((char *));
static char *gettoken __P((char **, char *));
int main __P((int, char *[]));
/* findtoken():
* Return the token number of the given token
*/
static int
findtoken(ptr)
char *ptr;
{
int i;
if (ptr == NULL || *ptr == '\0')
return T_NONE;
for (i = 0; keyword[i] != NULL; i++)
if (strcmp(keyword[i], ptr) == 0)
return i;
return T_NONE;
}
/* gettoken():
* Get : delimited token and remove leading/trailing blanks/newlines
*/
static char *
gettoken(pptr, token)
char **pptr;
char *token;
{
char *ptr = *pptr;
char *tok = token;
for (; *ptr && ISSPACE(*ptr); ptr++)
continue;
for (; *ptr && *ptr != ':'; *tok++ = *ptr++)
continue;
if (*ptr == ':')
ptr++;
else
tok--;
for (tok--; tok >= token && *tok && ISSPACE(*tok); tok--)
continue;
*++tok = '\0';
*pptr = ptr;
return token;
}
int
main(argc, argv)
int argc;
char *argv[];
{
char line[INBUFSIZE];
char *pname;
char *fname = "stdin";
char *ptr, *tok;
char defs[INBUFSIZE];
char stmt[INBUFSIZE];
FILE *fp = stdin;
int lineno = 0;
int inprocess = 0;
int token, state;
int errs = 0;
if ((pname = strrchr(argv[0], '/')) == NULL)
pname = argv[0];
else
pname++;
if (argc > 2) {
(void) fprintf(stderr, "Usage: %s [<filename>]\n", pname);
return 1;
}
if (argc == 2)
if ((fp = fopen(fname = argv[1], "r")) == NULL) {
(void) fprintf(stderr, "%s: Cannot open `%s'\n", pname, fname);
return 1;
}
state = S_DISCARD;
while ((ptr = fgets(line, sizeof(line), fp)) != NULL) {
lineno++;
switch (token = findtoken(gettoken(&ptr, defs))) {
case T_NEWCODE:
state = S_CODE;
break;
case T_ENDCODE:
state = S_DISCARD;
break;
case T_COMMENT:
state = S_COMMENT;
break;
case T_NEWDEF:
state = S_KEYWORD;
break;
case T_ENDDEF:
state = S_DISCARD;
break;
case T_VENDOR:
state = S_KEYWORD;
break;
case T_HOSTTYPE:
state = S_KEYWORD;
break;
case T_MACHTYPE:
state = S_KEYWORD;
break;
case T_OSTYPE:
state = S_KEYWORD;
break;
case T_MACRO:
if (gettoken(&ptr, defs) == NULL) {
(void) fprintf(stderr, "%s: \"%s\", %d: Missing macro name\n",
pname, fname, lineno);
break;
}
if (gettoken(&ptr, stmt) == NULL) {
(void) fprintf(stderr, "%s: \"%s\", %d: Missing macro body\n",
pname, fname, lineno);
break;
}
(void) fprintf(stdout, "\n#if %s\n# define %s\n#endif\n\n", stmt,
defs);
break;
case T_NONE:
if (state != S_CODE && defs && *defs != '\0') {
(void) fprintf(stderr, "%s: \"%s\", %d: Discarded\n",
pname, fname, lineno);
if (++errs == 30) {
(void) fprintf(stderr, "%s: Too many errors\n", pname);
return 1;
}
break;
}
(void) fprintf(stdout, "%s", line);
break;
default:
(void) fprintf(stderr, "%s: \"%s\", %d: Unexpected token\n",
pname, fname, lineno);
return 1;
}
switch (state) {
case S_DISCARD:
if (inprocess) {
inprocess = 0;
(void) fprintf(stdout, "#endif\n");
}
break;
case S_KEYWORD:
tok = gettoken(&ptr, defs);
if (token == T_NEWDEF) {
if (inprocess) {
(void) fprintf(stderr, "%s: \"%s\", %d: Missing enddef\n",
pname, fname, lineno);
return 1;
}
if (tok == NULL) {
(void) fprintf(stderr, "%s: \"%s\", %d: No defs\n",
pname, fname, lineno);
return 1;
}
(void) fprintf(stdout, "\n\n");
#ifdef LINEDIRECTIVE
(void) fprintf(stdout, "# %d \"%s\"\n", lineno + 1, fname);
#endif /* LINEDIRECTIVE */
(void) fprintf(stdout, "#if %s\n", defs);
inprocess = 1;
}
else {
if (tok && *tok)
(void) fprintf(stdout, "# if (%s) && !defined(_%s_)\n",
defs, keyword[token]);
else
(void) fprintf(stdout, "# if !defined(_%s_)\n",
keyword[token]);
if (gettoken(&ptr, stmt) == NULL) {
(void) fprintf(stderr, "%s: \"%s\", %d: No statement\n",
pname, fname, lineno);
return 1;
}
(void) fprintf(stdout, "# define _%s_\n", keyword[token]);
(void) fprintf(stdout, " %s = %s;\n", keyword[token], stmt);
(void) fprintf(stdout, "# endif\n");
}
break;
case S_COMMENT:
if (gettoken(&ptr, defs))
(void) fprintf(stdout, " /* %s */\n", defs);
break;
case S_CODE:
if (token == T_NEWCODE) {
#ifdef LINEDIRECTIVE
(void) fprintf(stdout, "# %d \"%s\"\n", lineno + 1, fname);
#endif /* LINEDIRECTIVE */
}
break;
default:
(void) fprintf(stderr, "%s: \"%s\", %d: Unexpected state\n",
pname, fname, lineno);
return 1;
}
}
if (inprocess) {
(void) fprintf(stderr, "%s: \"%s\", %d: Missing enddef\n",
pname, fname, lineno);
return 1;
}
if (fp != stdin)
(void) fclose(fp);
return 0;
}

326
contrib/tcsh/glob.3 Normal file
View File

@ -0,0 +1,326 @@
.\" Copyright (c) 1989 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Guido van Rossum.
.\"
.\" Redistribution and use in source and binary forms are permitted provided
.\" that: (1) source distributions retain this entire copyright notice and
.\" comment, and (2) distributions including binaries display the following
.\" acknowledgement: ``This product includes software developed by the
.\" University of California, Berkeley and its contributors'' in the
.\" documentation or other materials provided with the distribution and in
.\" all advertising materials mentioning features or use of this software.
.\" Neither the name of the University nor the names of its contributors may
.\" be used to endorse or promote products derived from this software without
.\" specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\" @(#)glob.3 5.3 (Berkeley) 3/19/91
.\"
.TH GLOB 3 "March 19, 1991"
.UC 7
.SH NAME
glob, globfree \- generate pathnames matching a pattern
.SH SYNOPSIS
.nf
#include <glob.h>
glob(const char *pattern, int flags,
const int (*errfunc)(char *, int), glob_t *pglob);
void globfree(glob_t *pglob);
.fi
.SH DESCRIPTION
.I Glob
is a pathname generator that implements the rules for file name pattern
matching used by the shell.
.PP
The include file
.I glob.h
defines the structure type
.IR glob_t ,
which contains at least the following fields:
.sp
.RS
.nf
.ta .5i +\w'char **gl_pathv;\0\0\0'u
typedef struct {
int gl_pathc; /* count of total paths so far */
int gl_matchc; /* count of paths matching pattern */
int gl_offs; /* reserved at beginning of gl_pathv */
int gl_flags; /* returned flags */
char **gl_pathv; /* list of paths matching pattern */
} glob_t;
.fi
.RE
.PP
The argument
.I pattern
is a pointer to a pathname pattern to be expanded.
.I Glob
matches all accessible pathnames against the pattern and creates
a list of the pathnames that match.
In order to have access to a pathname,
.I glob
requires search permission on every component of a path except the last
and read permission on each directory of any filename component of
.I pattern
that contains any of the special characters ``*'', ``?'' or ``[''.
.PP
.I Glob
stores the number of matched pathnames into the
.I gl_pathc
field, and a pointer to a list of pointers to pathnames into the
.I gl_pathv
field.
The first pointer after the last pathname is NULL.
If the pattern does not match any pathnames, the returned number of
matched paths is set to zero.
.PP
It is the caller's responsibility to create the structure pointed to by
.IR pglob .
The
.I glob
function allocates other space as needed, including the memory pointed
to by
.IR gl_pathv .
.PP
The argument
.I flags
is used to modify the behavior of
.IR glob .
The value of
.I flags
is the bitwise inclusive OR of any of the following
values defined in
.IR glob.h :
.TP
GLOB_APPEND
Append pathnames generated to the ones from a previous call (or calls)
to
.IR glob .
The value of
.I gl_pathc
will be the total matches found by this call and the previous call(s).
The pathnames are appended to, not merged with the pathnames returned by
the previous call(s).
Between calls, the caller must not change the setting of the
GLOB_DOOFFS flag, nor change the value of
.I gl_offs
when
GLOB_DOOFFS is set, nor (obviously) call
.I globfree
for
.I pglob.
.TP
GLOB_DOOFFS
Make use of the
.I gl_offs
field.
If this flag is set,
.I gl_offs
is used to specify how many NULL pointers to prepend to the beginning
of the
.I gl_pathv
field.
In other words,
.I gl_pathv
will point to
.I gl_offs
NULL pointers,
followed by
.I gl_pathc
pathname pointers, followed by a NULL pointer.
.TP
GLOB_ERR
Causes
.I glob
to return when it encounters a directory that it cannot open or read.
Ordinarily,
.I glob
continues to find matches.
.TP
GLOB_MARK
Each pathname that is a directory that matches
.I pattern
has a slash
appended.
.TP
GLOB_NOSORT
By default, the pathnames are sorted in ascending ASCII order;
this flag prevents that sorting (speeding up
.IR glob ).
.TP
GLOB_NOCHECK
If
.I pattern
does not match any pathname, then
.I glob
returns a list
consisting of only
.IR pattern ,
with the number of total pathnames is set to 1, and the number of matched
pathnames set to 0.
If
.I GLOB_QUOTE
is set, its effect is present in the pattern returned.
.TP
GLOB_QUOTE
Use the backslash (``\e'') character for quoting: every occurrence of
a backslash followed by a character in the pattern is replaced by that
character, avoiding any special interpretation of the character.
.TP
GLOB_NOMAGIC
Is the same as GLOB_NOCHECK but it only appends the
.IR pattern
if it does not contain any of the special characters ``*'', ``?'' or ``[''.
GLOB_NOMAGIC is used to simplify implementing the globbing behavior in
.IR csh(1).
.PP
If, during the search, a directory is encountered that cannot be opened
or read and
.I errfunc
is non-NULL,
.I glob
calls (*\fIerrfunc\fP)(\fIpath\fP, \fIerrno\fP).
This may be unintuitive: a pattern like ``*/Makefile'' will try to
.IR stat (2)
``foo/Makefile'' even if ``foo'' is not a directory, resulting in a
call to
.IR errfunc .
The error routine can suppress this action by testing for ENOENT and
ENOTDIR; however, the GLOB_ERR flag will still cause an immediate
return when this happens.
.PP
If
.I errfunc
returns non-zero,
.I glob
stops the scan and returns
.I GLOB_ABEND
after setting
.I gl_pathc
and
.I gl_pathv
to reflect any paths already matched.
This also happens if an error is encountered and
.I GLOB_ERR
is set in
.IR flags ,
regardless of the return value of
.IR errfunc ,
if called.
If
.I GLOB_ERR
is not set and either
.I errfunc
is NULL or
.I errfunc
returns zero, the error is ignored.
.PP
The
.I globfree
function frees any space associated with
.I pglob
from a previous call(s) to
.IR glob .
.SH RETURNS
On successful completion,
.I glob
returns zero.
In addition the fields of
.I pglob
contain the values described below:
.TP
.I gl_pathc
contains the total number of matched pathnames so far.
This includes other matches from previous invocations of
.I glob
if
.I GLOB_APPEND
was specified.
.TP
.I gl_matchc
contains the number of matched pathnames in the current invocation of
.I glob.
.TP
.I gl_flags
contains a copy of the
.I flags
parameter with the bit GLOB_MAGCHAR set if
.I pattern
contained any of the special characters ``*'', ``?'' or ``['', cleared
if not.
.TP
.I gl_pathv
contains a pointer to a NULL-terminated list of matched pathnames.
However, if
.I gl_pathc
is zero, the contents of
.I gl_pathv
are undefined.
.PP
If
.I glob
terminates due to an error, it sets errno and returns one of the
following non-zero constants, which are defined in the include
file <glob.h>:
.TP
GLOB_NOSPACE
An attempt to allocate memory failed.
.TP
GLOB_ABEND
The scan was stopped because an error was encountered and either
GLOB_ERR was set or (*\fIerrfunc\fR)() returned non-zero.
.PP
The arguments
.I pglob->gl_pathc
and
.I pglob->gl_pathv
are still set as specified above.
.SH STANDARDS
The
.I glob
function is expected to be POSIX 1003.2 compatible with the exception
that the flag
.I GLOB_QUOTE
and the fields
.I gl_matchc
and
.I gl_flags
should not be used by applications striving for strict POSIX conformance.
.SH EXAMPLE
A rough equivalent of ``ls -l *.c *.h'' can be obtained with the
following code:
.sp
.nf
.RS
glob_t g;
g.gl_offs = 2;
glob("*.c", GLOB_DOOFFS, NULL, &g);
glob("*.h", GLOB_DOOFFS | GLOB_APPEND, NULL, &g);
g.gl_pathv[0] = "ls";
g.gl_pathv[1] = "-l";
execvp("ls", g.gl_pathv);
.RE
.fi
.SH SEE ALSO
sh(1), fnmatch(3), wordexp(3), regexp(3)
.SH BUGS
Patterns longer than MAXPATHLEN may cause unchecked errors.
.PP
.I Glob
may fail and set errno for any of the errors specified for the
library routines
.I stat (2),
.I closedir (3),
.I opendir (3),
.I readdir (3),
.I malloc (3),
and
.I free (3).

723
contrib/tcsh/glob.c Normal file
View File

@ -0,0 +1,723 @@
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Guido van Rossum.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)glob.c 5.12 (Berkeley) 6/24/91";
#endif /* LIBC_SCCS and not lint */
/*
* Glob: the interface is a superset of the one defined in POSIX 1003.2,
* draft 9.
*
* The [!...] convention to negate a range is supported (SysV, Posix, ksh).
*
* Optional extra services, controlled by flags not defined by POSIX:
*
* GLOB_QUOTE:
* Escaping convention: \ inhibits any special meaning the following
* character might have (except \ at end of string is retained).
* GLOB_MAGCHAR:
* Set in gl_flags if pattern contained a globbing character.
* GLOB_ALTNOT:
* Use ^ instead of ! for "not".
* gl_matchc:
* Number of matches in the current invocation of glob.
*/
#ifdef notdef
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <dirent.h>
#include <ctype.h>
typedef void * ptr_t;
#endif
#ifdef WINNT
#pragma warning(disable:4244)
#endif /* WINNT */
#define Char __Char
#include "sh.h"
#undef Char
#undef QUOTE
#undef TILDE
#undef META
#undef CHAR
#undef ismeta
#undef Strchr
#include "glob.h"
#ifndef S_ISDIR
#define S_ISDIR(a) (((a) & S_IFMT) == S_IFDIR)
#endif
#if !defined(S_ISLNK) && defined(S_IFLNK)
#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
#endif
#if !defined(S_ISLNK) && !defined(lstat)
#define lstat stat
#endif
typedef unsigned short Char;
static int glob1 __P((Char *, glob_t *, int));
static int glob2 __P((Char *, Char *, Char *, glob_t *, int));
static int glob3 __P((Char *, Char *, Char *, Char *,
glob_t *, int));
static int globextend __P((Char *, glob_t *));
static int match __P((Char *, Char *, Char *, int));
#ifndef __clipper__
static int compare __P((const ptr_t, const ptr_t));
#endif
static DIR *Opendir __P((Char *));
#ifdef S_IFLNK
static int Lstat __P((Char *, struct stat *));
#endif
static int Stat __P((Char *, struct stat *sb));
static Char *Strchr __P((Char *, int));
#ifdef DEBUG
static void qprintf __P((Char *));
#endif
#define DOLLAR '$'
#define DOT '.'
#define EOS '\0'
#define LBRACKET '['
#define NOT '!'
#define ALTNOT '^'
#define QUESTION '?'
#define QUOTE '\\'
#define RANGE '-'
#define RBRACKET ']'
#define SEP '/'
#define STAR '*'
#define TILDE '~'
#define UNDERSCORE '_'
#define M_META 0x8000
#define M_PROTECT 0x4000
#define M_MASK 0xffff
#define M_ASCII 0x00ff
#define CHAR(c) ((c)&M_ASCII)
#define META(c) ((c)|M_META)
#define M_ALL META('*')
#define M_END META(']')
#define M_NOT META('!')
#define M_ALTNOT META('^')
#define M_ONE META('?')
#define M_RNG META('-')
#define M_SET META('[')
#define ismeta(c) (((c)&M_META) != 0)
#ifndef BUFSIZE
#define GLOBBUFLEN MAXPATHLEN
#else
#define GLOBBUFLEN BUFSIZE
#endif
int
globcharcoll(c1, c2)
int c1, c2;
{
#if defined(NLS) && defined(LC_COLLATE) && !defined(NOSTRCOLL)
char s1[2], s2[2];
if (c1 == c2)
return (0);
s1[0] = c1;
s2[0] = c2;
s1[1] = s2[1] = '\0';
return strcoll(s1, s2);
#else
return (c1 - c2);
#endif
}
/*
* Need to dodge two kernel bugs:
* opendir("") != opendir(".")
* NAMEI_BUG: on plain files trailing slashes are ignored in some kernels.
* POSIX specifies that they should be ignored in directories.
*/
static DIR *
Opendir(str)
register Char *str;
{
char buf[GLOBBUFLEN];
register char *dc = buf;
#if defined(hpux) || defined(__hpux)
struct stat st;
#endif
if (!*str)
return (opendir("."));
while ((*dc++ = *str++) != '\0')
continue;
#if defined(hpux) || defined(__hpux)
/*
* Opendir on some device files hangs, so avoid it
*/
if (stat(buf, &st) == -1 || !S_ISDIR(st.st_mode))
return NULL;
#endif
return (opendir(buf));
}
#ifdef S_IFLNK
static int
Lstat(fn, sb)
register Char *fn;
struct stat *sb;
{
char buf[GLOBBUFLEN];
register char *dc = buf;
while ((*dc++ = *fn++) != '\0')
continue;
# ifdef NAMEI_BUG
{
int st;
st = lstat(buf, sb);
if (*buf)
dc--;
return (*--dc == '/' && !S_ISDIR(sb->st_mode) ? -1 : st);
}
# else
return (lstat(buf, sb));
# endif /* NAMEI_BUG */
}
#else
#define Lstat Stat
#endif /* S_IFLNK */
static int
Stat(fn, sb)
register Char *fn;
struct stat *sb;
{
char buf[GLOBBUFLEN];
register char *dc = buf;
while ((*dc++ = *fn++) != '\0')
continue;
#ifdef NAMEI_BUG
{
int st;
st = stat(buf, sb);
if (*buf)
dc--;
return (*--dc == '/' && !S_ISDIR(sb->st_mode) ? -1 : st);
}
#else
return (stat(buf, sb));
#endif /* NAMEI_BUG */
}
static Char *
Strchr(str, ch)
Char *str;
int ch;
{
do
if (*str == ch)
return (str);
while (*str++);
return (NULL);
}
#ifdef DEBUG
static void
qprintf(s)
Char *s;
{
Char *p;
for (p = s; *p; p++)
printf("%c", *p & 0xff);
printf("\n");
for (p = s; *p; p++)
printf("%c", *p & M_PROTECT ? '"' : ' ');
printf("\n");
for (p = s; *p; p++)
printf("%c", *p & M_META ? '_' : ' ');
printf("\n");
}
#endif /* DEBUG */
static int
compare(p, q)
const ptr_t p, q;
{
#if defined(NLS) && !defined(NOSTRCOLL)
errno = 0; /* strcoll sets errno, another brain-damage */
return (strcoll(*(char **) p, *(char **) q));
#else
return (strcmp(*(char **) p, *(char **) q));
#endif /* NLS && !NOSTRCOLL */
}
/*
* The main glob() routine: compiles the pattern (optionally processing
* quotes), calls glob1() to do the real pattern matching, and finally
* sorts the list (unless unsorted operation is requested). Returns 0
* if things went well, nonzero if errors occurred. It is not an error
* to find no matches.
*/
int
glob(pattern, flags, errfunc, pglob)
const char *pattern;
int flags;
int (*errfunc) __P((const char *, int));
glob_t *pglob;
{
int err, oldpathc;
Char *bufnext, *bufend, *compilebuf, m_not;
const unsigned char *compilepat, *patnext;
int c, not;
Char patbuf[GLOBBUFLEN + 1], *qpatnext;
int no_match;
patnext = (unsigned char *) pattern;
if (!(flags & GLOB_APPEND)) {
pglob->gl_pathc = 0;
pglob->gl_pathv = NULL;
if (!(flags & GLOB_DOOFFS))
pglob->gl_offs = 0;
}
pglob->gl_flags = flags & ~GLOB_MAGCHAR;
pglob->gl_errfunc = errfunc;
oldpathc = pglob->gl_pathc;
pglob->gl_matchc = 0;
if (pglob->gl_flags & GLOB_ALTNOT) {
not = ALTNOT;
m_not = M_ALTNOT;
}
else {
not = NOT;
m_not = M_NOT;
}
bufnext = patbuf;
bufend = bufnext + GLOBBUFLEN;
compilebuf = bufnext;
compilepat = patnext;
no_match = *patnext == not;
if (no_match)
patnext++;
if (flags & GLOB_QUOTE) {
/* Protect the quoted characters */
while (bufnext < bufend && (c = *patnext++) != EOS)
if (c == QUOTE) {
if ((c = *patnext++) == EOS) {
c = QUOTE;
--patnext;
}
*bufnext++ = (Char) (c | M_PROTECT);
}
else
*bufnext++ = (Char) c;
}
else
while (bufnext < bufend && (c = *patnext++) != EOS)
*bufnext++ = (Char) c;
*bufnext = EOS;
bufnext = patbuf;
qpatnext = patbuf;
/* we don't need to check for buffer overflow any more */
while ((c = *qpatnext++) != EOS) {
switch (c) {
case LBRACKET:
c = *qpatnext;
if (c == not)
++qpatnext;
if (*qpatnext == EOS ||
Strchr(qpatnext + 1, RBRACKET) == NULL) {
*bufnext++ = LBRACKET;
if (c == not)
--qpatnext;
break;
}
pglob->gl_flags |= GLOB_MAGCHAR;
*bufnext++ = M_SET;
if (c == not)
*bufnext++ = m_not;
c = *qpatnext++;
do {
*bufnext++ = CHAR(c);
if (*qpatnext == RANGE &&
(c = qpatnext[1]) != RBRACKET) {
*bufnext++ = M_RNG;
*bufnext++ = CHAR(c);
qpatnext += 2;
}
} while ((c = *qpatnext++) != RBRACKET);
*bufnext++ = M_END;
break;
case QUESTION:
pglob->gl_flags |= GLOB_MAGCHAR;
*bufnext++ = M_ONE;
break;
case STAR:
pglob->gl_flags |= GLOB_MAGCHAR;
/* collapse adjacent stars to one, to avoid
* exponential behavior
*/
if (bufnext == patbuf || bufnext[-1] != M_ALL)
*bufnext++ = M_ALL;
break;
default:
*bufnext++ = CHAR(c);
break;
}
}
*bufnext = EOS;
#ifdef DEBUG
qprintf(patbuf);
#endif
if ((err = glob1(patbuf, pglob, no_match)) != 0)
return (err);
/*
* If there was no match we are going to append the pattern
* if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified
* and the pattern did not contain any magic characters
* GLOB_NOMAGIC is there just for compatibility with csh.
*/
if (pglob->gl_pathc == oldpathc &&
((flags & GLOB_NOCHECK) ||
((flags & GLOB_NOMAGIC) && !(pglob->gl_flags & GLOB_MAGCHAR)))) {
if (!(flags & GLOB_QUOTE)) {
Char *dp = compilebuf;
const unsigned char *sp = compilepat;
while ((*dp++ = *sp++) != '\0')
continue;
}
else {
/*
* copy pattern, interpreting quotes; this is slightly different
* than the interpretation of quotes above -- which should prevail?
*/
while (*compilepat != EOS) {
if (*compilepat == QUOTE) {
if (*++compilepat == EOS)
--compilepat;
}
*compilebuf++ = (unsigned char) *compilepat++;
}
*compilebuf = EOS;
}
return (globextend(patbuf, pglob));
}
else if (!(flags & GLOB_NOSORT))
qsort((char *) (pglob->gl_pathv + pglob->gl_offs + oldpathc),
pglob->gl_pathc - oldpathc, sizeof(char *),
(int (*) __P((const void *, const void *))) compare);
return (0);
}
static int
glob1(pattern, pglob, no_match)
Char *pattern;
glob_t *pglob;
int no_match;
{
Char pathbuf[GLOBBUFLEN + 1];
/*
* a null pathname is invalid -- POSIX 1003.1 sect. 2.4.
*/
if (*pattern == EOS)
return (0);
return (glob2(pathbuf, pathbuf, pattern, pglob, no_match));
}
/*
* functions glob2 and glob3 are mutually recursive; there is one level
* of recursion for each segment in the pattern that contains one or
* more meta characters.
*/
static int
glob2(pathbuf, pathend, pattern, pglob, no_match)
Char *pathbuf, *pathend, *pattern;
glob_t *pglob;
int no_match;
{
struct stat sbuf;
int anymeta;
Char *p, *q;
/*
* loop over pattern segments until end of pattern or until segment with
* meta character found.
*/
anymeta = 0;
for (;;) {
if (*pattern == EOS) { /* end of pattern? */
*pathend = EOS;
if (Lstat(pathbuf, &sbuf))
return (0);
if (((pglob->gl_flags & GLOB_MARK) &&
pathend[-1] != SEP) &&
(S_ISDIR(sbuf.st_mode)
#ifdef S_IFLNK
|| (S_ISLNK(sbuf.st_mode) &&
(Stat(pathbuf, &sbuf) == 0) &&
S_ISDIR(sbuf.st_mode))
#endif
)) {
*pathend++ = SEP;
*pathend = EOS;
}
++pglob->gl_matchc;
return (globextend(pathbuf, pglob));
}
/* find end of next segment, copy tentatively to pathend */
q = pathend;
p = pattern;
while (*p != EOS && *p != SEP) {
if (ismeta(*p))
anymeta = 1;
*q++ = *p++;
}
if (!anymeta) { /* no expansion, do next segment */
pathend = q;
pattern = p;
while (*pattern == SEP)
*pathend++ = *pattern++;
}
else /* need expansion, recurse */
return (glob3(pathbuf, pathend, pattern, p, pglob, no_match));
}
/* NOTREACHED */
}
static int
glob3(pathbuf, pathend, pattern, restpattern, pglob, no_match)
Char *pathbuf, *pathend, *pattern, *restpattern;
glob_t *pglob;
int no_match;
{
extern int errno;
DIR *dirp;
struct dirent *dp;
int err;
Char m_not = (pglob->gl_flags & GLOB_ALTNOT) ? M_ALTNOT : M_NOT;
char cpathbuf[GLOBBUFLEN], *ptr;;
*pathend = EOS;
errno = 0;
if (!(dirp = Opendir(pathbuf))) {
/* todo: don't call for ENOENT or ENOTDIR? */
for (ptr = cpathbuf; (*ptr++ = (char) *pathbuf++) != EOS;)
continue;
if ((pglob->gl_errfunc && (*pglob->gl_errfunc) (cpathbuf, errno)) ||
(pglob->gl_flags & GLOB_ERR))
return (GLOB_ABEND);
else
return (0);
}
err = 0;
/* search directory for matching names */
while ((dp = readdir(dirp)) != NULL) {
register unsigned char *sc;
register Char *dc;
/* initial DOT must be matched literally */
if (dp->d_name[0] == DOT && *pattern != DOT)
continue;
for (sc = (unsigned char *) dp->d_name, dc = pathend;
(*dc++ = *sc++) != '\0';)
continue;
if (match(pathend, pattern, restpattern, (int) m_not) == no_match) {
*pathend = EOS;
continue;
}
err = glob2(pathbuf, --dc, restpattern, pglob, no_match);
if (err)
break;
}
/* todo: check error from readdir? */
(void) closedir(dirp);
return (err);
}
/*
* Extend the gl_pathv member of a glob_t structure to accomodate a new item,
* add the new item, and update gl_pathc.
*
* This assumes the BSD realloc, which only copies the block when its size
* crosses a power-of-two boundary; for v7 realloc, this would cause quadratic
* behavior.
*
* Return 0 if new item added, error code if memory couldn't be allocated.
*
* Invariant of the glob_t structure:
* Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
* gl_pathv points to (gl_offs + gl_pathc + 1) items.
*/
static int
globextend(path, pglob)
Char *path;
glob_t *pglob;
{
register char **pathv;
register int i;
unsigned int newsize;
char *copy;
Char *p;
newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
pathv = (char **) (pglob->gl_pathv ?
xrealloc((ptr_t) pglob->gl_pathv, (size_t) newsize) :
xmalloc((size_t) newsize));
if (pathv == NULL)
return (GLOB_NOSPACE);
if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
/* first time around -- clear initial gl_offs items */
pathv += pglob->gl_offs;
for (i = pglob->gl_offs; --i >= 0;)
*--pathv = NULL;
}
pglob->gl_pathv = pathv;
for (p = path; *p++;)
continue;
if ((copy = (char *) xmalloc((size_t) (p - path))) != NULL) {
register char *dc = copy;
register Char *sc = path;
while ((*dc++ = *sc++) != '\0')
continue;
pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
}
pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
return ((copy == NULL) ? GLOB_NOSPACE : 0);
}
/*
* pattern matching function for filenames. Each occurrence of the *
* pattern causes a recursion level.
*/
static int
match(name, pat, patend, m_not)
register Char *name, *pat, *patend;
int m_not;
{
int ok, negate_range;
Char c, k;
while (pat < patend) {
c = *pat++;
switch (c & M_MASK) {
case M_ALL:
if (pat == patend)
return (1);
do
if (match(name, pat, patend, m_not))
return (1);
while (*name++ != EOS);
return (0);
case M_ONE:
if (*name++ == EOS)
return (0);
break;
case M_SET:
ok = 0;
if ((k = *name++) == EOS)
return (0);
if ((negate_range = ((*pat & M_MASK) == m_not)) != 0)
++pat;
while (((c = *pat++) & M_MASK) != M_END) {
if ((*pat & M_MASK) == M_RNG) {
if (globcharcoll(CHAR(c), CHAR(k)) <= 0 &&
globcharcoll(CHAR(k), CHAR(pat[1])) <= 0)
ok = 1;
pat += 2;
}
else if (c == k)
ok = 1;
}
if (ok == negate_range)
return (0);
break;
default:
k = *name++;
if (samecase(k) != samecase(c))
return (0);
break;
}
}
return (*name == EOS);
}
/* free allocated data belonging to a glob_t structure */
void
globfree(pglob)
glob_t *pglob;
{
register int i;
register char **pp;
if (pglob->gl_pathv != NULL) {
pp = pglob->gl_pathv + pglob->gl_offs;
for (i = pglob->gl_pathc; i--; ++pp)
if (*pp)
xfree((ptr_t) *pp), *pp = NULL;
xfree((ptr_t) pglob->gl_pathv), pglob->gl_pathv = NULL;
}
}

71
contrib/tcsh/glob.h Normal file
View File

@ -0,0 +1,71 @@
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Guido van Rossum.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)glob.h 5.6 (Berkeley) 4/3/91
*/
#ifndef _GLOB_H_
#define _GLOB_H_
typedef struct {
int gl_pathc; /* count of total paths so far */
int gl_matchc; /* count of paths matching pattern */
int gl_offs; /* reserved at beginning of gl_pathv */
int gl_flags; /* copy of flags parameter to glob() */
/* copy of errfunc parameter to glob() */
int (*gl_errfunc) __P((const char *, int));
char **gl_pathv; /* list of paths matching pattern */
} glob_t;
#define GLOB_APPEND 0x001 /* append to output from previous call */
#define GLOB_DOOFFS 0x002 /* use gl_offs */
#define GLOB_ERR 0x004 /* return on error */
#define GLOB_MAGCHAR 0x008 /* pattern had globbing characters */
#define GLOB_MARK 0x010 /* append / to matching directories */
#define GLOB_NOCHECK 0x020 /* return pattern itself if nothing matches */
#define GLOB_NOSORT 0x040 /* don't sort */
#define GLOB_QUOTE 0x080 /* quote special chars with \ */
#define GLOB_NOMAGIC 0x100 /* like GLOB_NOCHECK but only if the pattern
* did not have any magic characters */
#define GLOB_ALTNOT 0x200 /* use alternate glob character [^ not !] */
#define GLOB_NOSPACE (-1) /* malloc call failed */
#define GLOB_ABEND (-2) /* unignored error */
int glob __P((const char *, int, int (*)(const char *, int), glob_t *));
void globfree __P((glob_t *));
int globcharcoll __P((int, int));
#endif /* !_GLOB_H_ */

1121
contrib/tcsh/host.defs Normal file

File diff suppressed because it is too large Load Diff

65
contrib/tcsh/imake.config Normal file
View File

@ -0,0 +1,65 @@
/*
* $Id: imake.config,v 1.4 1995/03/05 03:18:09 christos Exp $
*
* config.Imakefile for for tcsh 6.00
* Marc Horowitz, MIT SIPB
*/
/* installed location of tcsh, if different than the default in
pathnames.h */
/* #define TcshPath /afs/sipb/project/tcsh/tcsh */
/* The following #define's may be used to cause tcsh to link against
these libraries. If you have one of the machines which is defined in
the Imakefile, the correct libraries will automatically be used. It's
better to set up new definitions in the Imakefile than to put them
here if you're defining support for a new machine, rather than
configuring for local hacks. */
/* #define UseLibTermcap */
/* #define UseLibCurses */
/* #define UseLibNet */
/* #define UseLibSocket */
/* #define UseLibBsd */
/* #define UseLibC_S */
/* #define UseLibSun */
/* #define UseLibCposix */
/* #define UseLibInet */
/* #define UseLibDir */
/* #define UseLibX */
/* #define UseLibIntl */
/* #define UseLibPosix */
/* #define UseLibDirent */
/* define if you want to use gcc. Your site.def file may already do
this, but it shouldn't hurt. */
/* #define HasGcc */
/* define if you have some different compiler than cc or gcc */
/* #define MyCC xlc */
/* define if you have Hesiod passwd information, and want tcsh to use it */
/* #define HESIOD */
/* define if you have AFS and want to use kerberos passwd authentication */
/* #define AFS */
/* define as well if your version of AFS is 3.3 or higher */
/* #define AFS33 */
/* defines installation dir if different from /usr/local. The
executable will be put in TcshTop/bin/tcsh, and the man page in
TcshTop/man/man1/tcsh.1 */
/* #define TcshTop /afs/sipb/project/tcsh */
/* define any of the following if you want to change the compiler flags */
/* #define MyCflags */
/* #define MyDefines */
/* #define MyIncludes */
/* #define MyLibs */
/* By default, the compiler debug flags are -O. Define this if you
want them to be something else. */
/* #define CDebugFlags -g -O */
/* If you want HOSTTYPE to be something other than the default in
tc.vers.c, define it here */
/* #define HostType decmips */

251
contrib/tcsh/install-sh Executable file
View File

@ -0,0 +1,251 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

618
contrib/tcsh/ma.setp.c Normal file
View File

@ -0,0 +1,618 @@
/*
* Copyright (c) 1990 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND CARNEGIE MELLON UNIVERSITY
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
* SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Users of this software agree to return to Carnegie Mellon any
* improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* Export of this software is permitted only after complying with the
* regulations of the U.S. Deptartment of Commerce relating to the
* Export of Technical Data.
*/
/*
* setpath --- smart interface for setting path variables
*
* usage: setpath(paths, cmds, localsyspath, dosuffix, printerrors)
* char **paths, **cmds, *localsyspath;
* int dosuffix, printerrors;
*
* The 'paths' argument is a list of pointers to path lists of the
* form "name=value" where name is the name of the path and value
* is a colon separated list of directories. There can never be
* more than MAXDIRS (64) directories in a path.
*
* The 'cmds' argument may be a sequence of any of the following:
* -r reset path to default
* -i newpath insert newpath before localsyspath
* -ia oldpath newpath insert newpath after oldpath
* -ib oldpath newpath insert newpath before oldpath
* -i# newpath insert newpath at position #
* -d oldpath delete oldpath
* -d# delete path at position #
* -c oldpath newpath change oldpath to newpath
* -c# newpath change position # to newpath
*
* The "-i newpath" command is equivilent to "-ib 'localsyspath' newpath".
*
* If 'dosuffix' is true, the appropriate suffix will be added to
* all command operands for any system path in 'paths'.
*
* Both of the 'paths' and 'cmds' lists are terminated by a NULL
* entry.
*
* if 'printerrors' is true, setpath will printf error diagnostics.
*
* WARNING !!!: Under no circumstances should anyone change this
* module without fully understanding the impact on the C shell.
* The C shell has it's own malloc and printf routines and this
* module was carefully written taking that into account. Do not
* use any stdio routines from this module except printf.
*
**********************************************************************
* HISTORY
*
* Revision 1.4 90/12/11 17:58:44 mja
* Add copyright/disclaimer for distribution.
*
* 05-Jun-88 Glenn Marcy (gm0w) at Carnegie-Mellon University
* Make all non-entry points static.
*
* 30-Apr-88 Glenn Marcy (gm0w) at Carnegie-Mellon University
* Added -r switch to reset paths to their default values.
*
* 06-Jan-86 Glenn Marcy (gm0w) at Carnegie-Mellon University
* Created from old setpath program for the shell.
*
**********************************************************************
*/
#include "sh.h"
RCSID("$Id: ma.setp.c,v 1.12 1996/04/26 19:18:36 christos Exp $")
#ifdef MACH
#define MAXDIRS 64 /* max directories on a path */
#ifndef NULL
# define NULL 0
#endif
static int npaths; /* # pathlist arguments */
static struct pelem {
struct pelem *pnext; /* pointer to next path */
char *pname; /* name of pathlist */
char *psuf; /* suffix for pathlist */
char *pdef; /* default for pathlist */
int pdirs; /* # directories on each pathlist */
char *pdir[MAXDIRS]; /* directory names for each pathlist */
} *pathhead = NULL;
static struct {
char *name;
char *suffix;
char *defalt;
} syspath[] = {
"PATH", "/bin", ":/usr/ucb:/bin:/usr/bin",
"CPATH", "/include", ":/usr/include",
"LPATH", "/lib", ":/lib:/usr/lib",
"MPATH", "/man", ":/usr/man",
"EPATH", "/maclib", "",
0, 0, 0
};
static int sflag;
static int eflag;
#define INVALID { \
if (eflag) xprintf(CGETS(10, 1, \
"setpath: invalid command '%s'.\n"), cmd); \
freepaths(); \
return(-1); \
}
#define TOOFEW { \
if (eflag) xprintf(CGETS(10, 2, \
"setpath: insufficient arguments to command '%s'.\n"), cmd); \
freepaths(); \
return(-1); \
}
static int initpaths __P((char **));
static void savepaths __P((char **));
static void freepaths __P((void));
static void rcmd __P((char *));
static void icmd __P((char *, char *));
static void iacmd __P((char *, char *));
static void ibcmd __P((char *, char *));
static void incmd __P((char *, int));
static void insert __P((struct pelem *, int, char *));
static void dcmd __P((char *));
static void dncmd __P((int));
static void delete __P((struct pelem *, int));
static void ccmd __P((char *, char *));
static void cncmd __P((char *, int));
static void change __P((struct pelem *, int, char *));
static int locate __P((struct pelem *, char *));
int
setpath(paths, cmds, localsyspath, dosuffix, printerrors)
register char **paths, **cmds, *localsyspath;
int dosuffix, printerrors;
{
register char *cmd, *cmd1, *cmd2;
register int ncmd;
sflag = dosuffix;
eflag = printerrors;
if (initpaths(paths) < 0)
return(-1);
if (npaths == 0)
return(0);
for (ncmd = 0; cmd = cmds[ncmd]; ncmd++) {
if (cmd[0] != '-')
INVALID;
cmd1 = cmds[ncmd+1];
cmd2 = cmds[ncmd+2];
switch (cmd[1]) {
case 'r':
if (cmd[2] != '\0')
INVALID;
rcmd(localsyspath);
break;
case 'i':
if (cmd[2] == '\0') {
ncmd++;
if (cmd1 == NULL) TOOFEW;
icmd(cmd1, localsyspath);
} else if (isdigit(cmd[2])) {
ncmd++;
if (cmd1 == NULL) TOOFEW;
incmd(cmd1, atoi(cmd+2));
} else if (cmd[3] != '\0' || (cmd[2] != 'a' && cmd[2] != 'b')) {
INVALID;
} else {
ncmd += 2;
if (cmd1 == NULL || cmd2 == NULL) TOOFEW;
if (cmd[2] == 'a')
iacmd(cmd1, cmd2);
else
ibcmd(cmd1, cmd2);
}
break;
case 'd':
if (cmd[2] == '\0') {
ncmd++;
if (cmd1 == NULL) TOOFEW;
dcmd(cmd1);
} else if (isdigit(cmd[2]))
dncmd(atoi(cmd+2));
else {
INVALID;
}
break;
case 'c':
if (cmd[2] == '\0') {
ncmd += 2;
if (cmd1 == NULL || cmd2 == NULL) TOOFEW;
ccmd(cmd1, cmd2);
} else if (isdigit(cmd[2])) {
ncmd++;
if (cmd1 == NULL) TOOFEW;
cncmd(cmd1, atoi(cmd+2));
} else {
INVALID;
}
break;
default:
INVALID;
}
}
savepaths(paths);
freepaths();
return(0);
}
static int
initpaths(paths)
register char **paths;
{
register char *path, *val, *p, *q;
register int i, done;
register struct pelem *pe, *pathend;
freepaths();
for (npaths = 0; path = paths[npaths]; npaths++) {
val = index(path, '=');
if (val == NULL) {
if (eflag)
xprintf(CGETS(10, 3,
"setpath: value missing in path '%s'\n"), path);
freepaths();
return(-1);
}
*val++ = '\0';
pe = (struct pelem *)xmalloc((unsigned)(sizeof(struct pelem)));
setzero((char *) pe, sizeof(struct pelem));
if (pathhead == NULL)
pathhead = pathend = pe;
else {
pathend->pnext = pe;
pathend = pe;
}
p = strsave(path);
pe->pname = p;
pe->psuf = "";
pe->pdef = "";
for (i = 0; syspath[i].name; i++)
if (strcmp(pe->pname, syspath[i].name) == 0) {
pe->psuf = syspath[i].suffix;
pe->pdef = syspath[i].defalt;
break;
}
q = val;
for (;;) {
q = index(p = q, ':');
done = (q == NULL);
if (!done)
*q++ = '\0';
p = strsave(p);
pe->pdir[pe->pdirs] = p;
pe->pdirs++;
if (done)
break;
}
}
return(0);
}
static void
savepaths(paths)
register char **paths;
{
register char *p, *q;
register int npath, i, len;
register struct pelem *pe;
for (npath = 0, pe = pathhead; pe; npath++, pe = pe->pnext) {
len = strlen(pe->pname) + 1;
if (pe->pdirs == 0)
len++;
else for (i = 0; i < pe->pdirs; i++)
len += strlen(pe->pdir[i]) + 1;
p = xmalloc((unsigned)len);
paths[npath] = p;
for (q = pe->pname; *p = *q; p++, q++);
*p++ = '=';
if (pe->pdirs != 0) {
for (i = 0; i < pe->pdirs; i++) {
for (q = pe->pdir[i]; *p = *q; p++, q++);
*p++ = ':';
}
p--;
}
*p = '\0';
}
}
static void
freepaths()
{
register char *p;
register int i;
register struct pelem *pe;
if (npaths == 0 || pathhead == NULL)
return;
while (pe = pathhead) {
if (pe->pname) {
for (i = 0; i < pe->pdirs; i++) {
if (pe->pdir[i] == NULL)
continue;
p = pe->pdir[i];
pe->pdir[i] = NULL;
xfree((ptr_t) p);
}
pe->pdirs = 0;
p = pe->pname;
pe->pname = NULL;
xfree((ptr_t) p);
}
pathhead = pe->pnext;
xfree((ptr_t) pe);
}
npaths = 0;
}
/***********************************************
*** R E S E T A P A T H N A M E ***
***********************************************/
static void
rcmd(localsyspath) /* reset path with localsyspath */
char *localsyspath;
{
register int n, done;
register char *new, *p;
register struct pelem *pe;
char newbuf[MAXPATHLEN+1];
for (pe = pathhead; pe; pe = pe->pnext) {
new = newbuf;
*new = '\0';
if (localsyspath != NULL) {
*new = ':';
(void) strcpy(new + 1, localsyspath);
(void) strcat(new, pe->psuf);
}
(void) strcat(new, pe->pdef);
for (n = 0; n < pe->pdirs; n++) {
if (pe->pdir[n] == NULL)
continue;
p = pe->pdir[n];
pe->pdir[n] = NULL;
xfree((ptr_t) p);
}
pe->pdirs = 0;
for (;;) {
new = index(p = new, ':');
done = (new == NULL);
if (!done)
*new++ = '\0';
p = strsave(p);
pe->pdir[pe->pdirs] = p;
pe->pdirs++;
if (done)
break;
}
}
}
/***********************************************
*** I N S E R T A P A T H N A M E ***
***********************************************/
static void
icmd(path, localsyspath) /* insert path before localsyspath */
char *path, *localsyspath;
{
register int n;
register char *new;
register struct pelem *pe;
char newbuf[MAXPATHLEN+1];
for (pe = pathhead; pe; pe = pe->pnext) {
if (sflag)
new = localsyspath;
else {
new = newbuf;
(void) strcpy(new, localsyspath);
(void) strcat(new, pe->psuf);
}
n = locate(pe, new);
if (n >= 0)
insert(pe, n, path);
else
insert(pe, 0, path);
}
}
static void
iacmd(inpath, path) /* insert path after inpath */
char *inpath, *path;
{
register int n;
register struct pelem *pe;
for (pe = pathhead; pe; pe = pe->pnext) {
n = locate(pe, inpath);
if (n >= 0)
insert(pe, n + 1, path);
else
xprintf(CGETS(10, 4, "setpath: %s not found in %s\n"),
inpath, pe->pname);
}
}
static void
ibcmd(inpath, path) /* insert path before inpath */
char *inpath, *path;
{
register int n;
register struct pelem *pe;
for (pe = pathhead; pe; pe = pe->pnext) {
n = locate(pe, inpath);
if (n >= 0)
insert(pe, n, path);
else
xprintf(CGETS(10, 4, "setpath: %s not found in %s\n",
inpath, pe->pname));
}
}
static void
incmd(path, n) /* insert path at position n */
char *path;
int n;
{
register struct pelem *pe;
for (pe = pathhead; pe; pe = pe->pnext)
insert(pe, n, path);
}
static void
insert(pe, loc, key)
register struct pelem *pe;
register int loc;
register char *key;
{
register int i;
register char *new;
char newbuf[2000];
if (sflag) { /* add suffix */
new = newbuf;
(void) strcpy(new, key);
(void) strcat(new, pe->psuf);
} else
new = key;
new = strsave(new);
for (i = pe->pdirs; i > loc; --i)
pe->pdir[i] = pe->pdir[i-1];
if (loc > pe->pdirs)
loc = pe->pdirs;
pe->pdir[loc] = new;
pe->pdirs++;
}
/***********************************************
*** D E L E T E A P A T H N A M E ***
***********************************************/
static void
dcmd(path) /* delete path */
char *path;
{
register int n;
register struct pelem *pe;
for (pe = pathhead; pe; pe = pe->pnext) {
n = locate(pe, path);
if (n >= 0)
delete(pe, n);
else
xprintf(CGETS(10, 4, "setpath: %s not found in %s\n"),
path, pe->pname);
}
}
static void
dncmd(n) /* delete at position n */
int n;
{
register struct pelem *pe;
for (pe = pathhead; pe; pe = pe->pnext) {
if (n < pe->pdirs)
delete(pe, n);
else
xprintf(CGETS(10, 5,
"setpath: %d not valid position in %s\n"),
n, pe->pname);
}
}
static void
delete(pe, n)
register struct pelem *pe;
int n;
{
register int d;
xfree((ptr_t) (pe->pdir[n]));
for (d = n; d < pe->pdirs - 1; d++)
pe->pdir[d] = pe->pdir[d+1];
--pe->pdirs;
}
/***********************************************
*** C H A N G E A P A T H N A M E ***
***********************************************/
static void
ccmd(inpath, path) /* change inpath to path */
char *inpath, *path;
{
register int n;
register struct pelem *pe;
for (pe = pathhead; pe; pe = pe->pnext) {
n = locate(pe, inpath);
if (n >= 0)
change(pe, n, path);
else
xprintf(CGETS(10, 4, "setpath: %s not found in %s\n"),
inpath, pe->pname);
}
}
static void
cncmd(path, n) /* change at position n to path */
char *path;
int n;
{
register struct pelem *pe;
for (pe = pathhead; pe; pe = pe->pnext) {
if (n < pe->pdirs)
change(pe, n, path);
else
xprintf(CGETS(10, 5,
"setpath: %d not valid position in %s\n"),
n, pe->pname);
}
}
static void
change(pe, loc, key)
register struct pelem *pe;
register int loc;
register char *key;
{
register char *new;
char newbuf[MAXPATHLEN+1];
if (sflag) { /* append suffix */
new = newbuf;
(void) strcpy(new, key);
(void) strcat(new, pe->psuf);
} else
new = key;
new = strsave(new);
xfree((ptr_t) (pe->pdir[loc]));
pe->pdir[loc] = new;
}
/***************************************
*** F I N D P A T H N A M E ***
***************************************/
static int
locate(pe, key)
register struct pelem *pe;
register char *key;
{
register int i;
register char *realkey;
char keybuf[MAXPATHLEN+1];
if (sflag) {
realkey = keybuf;
(void) strcpy(realkey, key);
(void) strcat(realkey, pe->psuf);
} else
realkey = key;
for (i = 0; i < pe->pdirs; i++)
if (strcmp(pe->pdir[i], realkey) == 0)
break;
return((i < pe->pdirs) ? i : -1);
}
#endif

393
contrib/tcsh/mi.termios.c Normal file
View File

@ -0,0 +1,393 @@
/* $Header: /src/pub/tcsh/mi.termios.c,v 1.3 1996/04/26 19:18:38 christos Exp $ */
/* termios.c - fake termios interface using sgtty interface
* by Magnus Doell and Bruce Evans.
*
*/
#include "sh.h"
RCSID("$Id: mi.termios.c,v 1.3 1996/04/26 19:18:38 christos Exp $")
#ifdef _MINIX
/* Undefine everything that clashes with sgtty.h. */
#undef B0
#undef B50
#undef B75
#undef B110
#undef B134
#undef B150
#undef B200
#undef B300
#undef B600
#undef B1200
#undef B1800
#undef B2400
#undef B4800
#undef B9600
#undef B19200
#undef B28800
#undef B38400
#undef B57600
#undef B115200
/* Do not #undef CRMOD. We want a warning when they differ! */
#undef ECHO
/* Do not #undef XTABS. We want a warning when they differ! */
/* Redefine some of the termios.h names just undefined with 'T_' prefixed
* to the name. Don't bother with the low speeds - Minix does not support
* them. Add support for higher speeds (speeds are now easy and don't need
* defines because they are not encoded).
*/
#define T_ECHO 000001
#include <errno.h>
#include <sgtty.h>
static _PROTOTYPE( int tc_to_sg_speed, (speed_t speed) );
static _PROTOTYPE( speed_t sg_to_tc_speed, (int speed) );
#define B19200 192
/* The speed get/set functions could be macros in the Minix implementation
* because there are speed fields in the structure with no fancy packing
* and it is not practical to check the values outside the driver.
* Where tests are necessary because the driver acts different from what
* POSIX requires, they are done in tcsetattr.
*/
speed_t cfgetispeed(termios_p)
struct termios *termios_p;
{
return termios_p->c_ispeed;
}
speed_t cfgetospeed(termios_p)
struct termios *termios_p;
{
return termios_p->c_ospeed;
}
speed_t cfsetispeed(termios_p, speed)
struct termios *termios_p;
speed_t speed;
{
termios_p->c_ispeed = speed;
return 0;
}
speed_t cfsetospeed(termios_p, speed)
struct termios *termios_p;
speed_t speed;
{
termios_p->c_ospeed = speed;
return 0;
}
static speed_t sg_to_tc_speed(speed)
int speed;
{
/* The speed encodings in sgtty.h and termios.h are different. Both are
* inflexible. Minix doesn't really support B0 but we map it through
* anyway. It doesn't support B50, B75 or B134.
*/
switch (speed) {
case B0: return 0;
case B110: return 110;
case B200: return 200;
case B300: return 300;
case B600: return 600;
case B1200: return 1200;
case B1800: return 1800;
case B2400: return 2400;
case B4800: return 4800;
case B9600: return 9600;
case B19200: return 19200;
#ifdef B28800
case B28800: return 28800;
#endif
#ifdef B38400
case B38400: return 38400;
#endif
#ifdef B57600
case B57600: return 57600;
#endif
#ifdef B115200
case B115200: return 115200;
#endif
default: return (speed_t)-1;
}
}
static int tc_to_sg_speed(speed)
speed_t speed;
{
/* Don't use a switch here in case the compiler is 16-bit and doesn't
* properly support longs (speed_t's) in switches. It turns out the
* switch is larger and slower for most compilers anyway!
*/
if (speed == 0) return 0;
if (speed == 110) return B110;
if (speed == 200) return B200;
if (speed == 300) return B300;
if (speed == 600) return B600;
if (speed == 1200) return B1200;
if (speed == 1800) return B1800;
if (speed == 2400) return B2400;
if (speed == 4800) return B4800;
if (speed == 9600) return B9600;
if (speed == 19200) return B19200;
#ifdef B28800
if (speed == 28800) return B28800;
#endif
#ifdef B38400
if (speed == 38400) return B38400;
#endif
#ifdef B57600
if (speed == 57600) return B57600;
#endif
#ifdef B115200
if (speed == 115200) return B115200;
#endif
return -1;
}
int tcgetattr(filedes, termios_p)
int filedes;
struct termios *termios_p;
{
struct sgttyb sgbuf;
struct tchars tcbuf;
if (ioctl(filedes, TIOCGETP, &sgbuf) < 0
|| ioctl(filedes, TIOCGETC, (struct sgttyb *) &tcbuf) < 0)
{
return -1;
}
/* Minix input flags:
* BRKINT: forced off (break is not recognized)
* IGNBRK: forced on (break is not recognized)
* ICRNL: set if CRMOD is set and not RAW (CRMOD also controls output)
* IGNCR: forced off (ignoring cr's is not supported)
* INLCR: forced off (mapping nl's to cr's is not supported)
* ISTRIP: forced off (should be off for consoles, on for rs232 no RAW)
* IXOFF: forced off (rs232 uses CTS instead of XON/XOFF)
* IXON: forced on if not RAW
* PARMRK: forced off (no '\377', '\0', X sequence on errors)
* ? IGNPAR: forced off (input with parity/framing errors is kept)
* ? INPCK: forced off (input parity checking is not supported)
*/
termios_p->c_iflag = IGNBRK;
if (!(sgbuf.sg_flags & RAW))
{
termios_p->c_iflag |= IXON;
if (sgbuf.sg_flags & CRMOD)
{
termios_p->c_iflag |= ICRNL;
}
}
/* Minix output flags:
* OPOST: set if CRMOD or XTABS is set
* XTABS: copied from sg_flags
* CRMOD: copied from sg_flags
*/
termios_p->c_oflag = sgbuf.sg_flags & (CRMOD | XTABS);
if (termios_p->c_oflag)
{
termios_p->c_oflag |= OPOST;
}
/* Minix local flags:
* ECHO: set if ECHO is set
* ECHOE: set if ECHO is set (ERASE echoed as error-corecting backspace)
* ECHOK: set if ECHO is set ('\n' echoed after KILL char)
* ECHONL: forced off ('\n' not echoed when ECHO isn't set)
* ICANON: set if neither CBREAK nor RAW
* IEXTEN: forced off
* ISIG: set if not RAW
* NOFLSH: forced off (input/output queues are always flushed)
* TOSTOP: forced off (no job control)
*/
termios_p->c_lflag = 0;
if (sgbuf.sg_flags & ECHO)
{
termios_p->c_lflag |= T_ECHO | ECHOE | ECHOK;
}
if (!(sgbuf.sg_flags & RAW))
{
termios_p->c_lflag |= ISIG;
if (!(sgbuf.sg_flags & CBREAK))
{
termios_p->c_lflag |= ICANON;
}
}
/* Minix control flags:
* CLOCAL: forced on (ignore modem status lines - not quite right)
* CREAD: forced on (receiver is always enabled)
* CSIZE: CS5-CS8 correspond directly to BITS5-BITS8
* CSTOPB: set for B110 (driver will generate 2 stop-bits than)
* HUPCL: forced off
* PARENB: set if EVENP or ODDP is set
* PARODD: set if ODDP is set
*/
termios_p->c_cflag = CLOCAL | CREAD;
switch (sgbuf.sg_flags & BITS8)
{
case BITS5: termios_p->c_cflag |= CS5; break;
case BITS6: termios_p->c_cflag |= CS6; break;
case BITS7: termios_p->c_cflag |= CS7; break;
case BITS8: termios_p->c_cflag |= CS8; break;
}
if (sgbuf.sg_flags & ODDP)
{
termios_p->c_cflag |= PARENB | PARODD;
}
if (sgbuf.sg_flags & EVENP)
{
termios_p->c_cflag |= PARENB;
}
if (sgbuf.sg_ispeed == B110)
{
termios_p->c_cflag |= CSTOPB;
}
/* Minix may give back different input and output baudrates,
* but only the input baudrate is valid for both.
* As our termios emulation will fail, if input baudrate differs
* from output baudrate, force them to be equal.
* Otherwise it would be very suprisingly not to be able to set
* the terminal back to the state returned by tcgetattr :).
*/
termios_p->c_ospeed =
termios_p->c_ispeed =
sg_to_tc_speed((unsigned char) sgbuf.sg_ispeed);
/* Minix control characters correspond directly except VSUSP and the
* important VMIN and VTIME are not really supported.
*/
termios_p->c_cc[VEOF] = tcbuf.t_eofc;
termios_p->c_cc[VEOL] = tcbuf.t_brkc;
termios_p->c_cc[VERASE] = sgbuf.sg_erase;
termios_p->c_cc[VINTR] = tcbuf.t_intrc;
termios_p->c_cc[VKILL] = sgbuf.sg_kill;
termios_p->c_cc[VQUIT] = tcbuf.t_quitc;
termios_p->c_cc[VSTART] = tcbuf.t_startc;
termios_p->c_cc[VSTOP] = tcbuf.t_stopc;
termios_p->c_cc[VMIN] = 1;
termios_p->c_cc[VTIME] = 0;
termios_p->c_cc[VSUSP] = 0;
return 0;
}
int tcsetattr(filedes, opt_actions, termios_p)
int filedes;
int opt_actions;
struct termios *termios_p;
{
struct sgttyb sgbuf;
struct tchars tcbuf;
int sgspeed;
/* Posix 1003.1-1988 page 135 says:
* Attempts to set unsupported baud rates shall be ignored, and it is
* implementation-defined whether an error is returned by any or all of
* cfsetispeed(), cfsetospeed(), or tcsetattr(). This refers both to
* changes to baud rates not supported by the hardware, and to changes
* setting the input and output baud rates to different values if the
* hardware does not support it.
* Ignoring means not to change the existing settings, doesn't it?
*/
if ((termios_p->c_ispeed != 0 && termios_p->c_ispeed != termios_p->c_ospeed)
|| (sgspeed = tc_to_sg_speed(termios_p->c_ospeed)) < 0)
{
errno = EINVAL;
return -1;
}
sgbuf.sg_ispeed = sgbuf.sg_ospeed = sgspeed;
sgbuf.sg_flags = 0;
/* I don't know what should happen with requests that are not supported by
* old Minix drivers and therefore cannot be emulated.
* Returning an error may confuse the application (the values aren't really
* invalid or unsupported by the hardware, they just couldn't be satisfied
* by the driver). Not returning an error might be even worse because the
* driver will act different to what the application requires it to act
* after sucessfully setting the attributes as specified.
* Settings that cannot be emulated fully include:
* c_ospeed != 110 && c_cflag & CSTOPB
* c_ospeed == 110 && ! c_cflag & CSTOPB
* (c_cc[VMIN] != 1 || c_cc[VTIME] != 0) && ! c_lflag & ICANON
* c_lflag & ICANON && ! c_lflag & ISIG
* For the moment I just ignore these conflicts.
*/
if (termios_p->c_oflag & OPOST)
{
/* CRMOD isn't Posix and may conflict with ICRNL, which is Posix,
* so we just ignore it.
*/
if (termios_p->c_oflag & XTABS)
{
sgbuf.sg_flags |= XTABS;
}
}
if (termios_p->c_iflag & ICRNL)
{
/* We couldn't do it better :-(. */
sgbuf.sg_flags |= CRMOD;
}
if (termios_p->c_lflag & T_ECHO)
{
sgbuf.sg_flags |= ECHO;
}
if (!(termios_p->c_lflag & ICANON))
{
if (termios_p->c_lflag & ISIG)
{
sgbuf.sg_flags |= CBREAK;
}
else
{
sgbuf.sg_flags |= RAW;
}
}
switch (termios_p->c_cflag & CSIZE)
{
case CS5: sgbuf.sg_flags |= BITS5; break;
case CS6: sgbuf.sg_flags |= BITS6; break;
case CS7: sgbuf.sg_flags |= BITS7; break;
case CS8: sgbuf.sg_flags |= BITS8; break;
}
if (termios_p->c_cflag & PARENB)
{
if (termios_p->c_cflag & PARODD)
{
sgbuf.sg_flags |= ODDP;
}
else
{
sgbuf.sg_flags |= EVENP;
}
}
sgbuf.sg_erase = termios_p->c_cc[VERASE];
sgbuf.sg_kill = termios_p->c_cc[VKILL];
tcbuf.t_intrc = termios_p->c_cc[VINTR];
tcbuf.t_quitc = termios_p->c_cc[VQUIT];
tcbuf.t_startc = termios_p->c_cc[VSTART];
tcbuf.t_stopc = termios_p->c_cc[VSTOP];
tcbuf.t_eofc = termios_p->c_cc[VEOF];
tcbuf.t_brkc = termios_p->c_cc[VEOL];
return ioctl(filedes, TIOCSETP, &sgbuf) < 0 &&
ioctl(filedes, TIOCSETC, (struct sgttyb *) &tcbuf) < 0 ?
-1 : 0;
}
#endif /* _MINIX */

15
contrib/tcsh/mi.varargs.h Normal file
View File

@ -0,0 +1,15 @@
/* $Header: /src/pub/tcsh/mi.varargs.h,v 1.2 1996/04/26 19:18:39 christos Exp $ */
/*
* mi.varargs.h: Correct varargs for minix
*/
#ifndef _h_mi_varargs
#define _h_mi_varargs
typedef char *va_list;
#define va_dcl int va_alist;
#define va_start(p) (p) = (va_list) &va_alist;
#define va_arg(p,type) ( (type *) ((p)+=sizeof(type)) )[-1]
#define va_end(p)
#endif /* _h_mi_varargs */

44
contrib/tcsh/mi.wait.h Normal file
View File

@ -0,0 +1,44 @@
/* The <sys/wait.h> header contains macros related to wait(). The value
* returned by wait() and waitpid() depends on whether the process
* terminated by an exit() call, was killed by a signal, or was stopped
* due to job control, as follows:
*
* High byte Low byte
* +---------------------+
* exit(status) | status | 0 |
* +---------------------+
* killed by signal | 0 | signal |
* +---------------------+
* stopped (job control) | signal | 0177 |
* +---------------------+
*/
#ifndef _WAIT_H
#define _WAIT_H
#ifndef _TYPES_H /* not quite right */
#include <sys/types.h>
#endif
#define __LOW(v) ((v) & 0377)
#define __HIGH(v) (((v) >> 8) & 0377)
#define WNOHANG 1 /* do not wait for child to exit */
#define WUNTRACED 2 /* for job control; not implemented */
#define WIFEXITED(s) (__LOW(s) == 0) /* normal exit */
#define WEXITSTATUS(s) (__HIGH(s)) /* exit status */
#define WTERMSIG(s) (__LOW(s) & 0177) /* sig value */
#define WIFSIGNALED(s) ((((unsigned int)(s)-1) & 0xFFFF) < 0xFF) /* signaled */
#define WIFSTOPPED(s) (__LOW(s) == 0177) /* stopped */
#define WSTOPSIG(s) (__HIGH(s) & 0377) /* stop signal */
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( pid_t wait, (int *_stat_loc) );
_PROTOTYPE( pid_t waitpid, (pid_t _pid, int *_stat_loc, int _options) );
#endif /* _WAIT_H */

140
contrib/tcsh/nls/C/set1 Normal file
View File

@ -0,0 +1,140 @@
$ $Id: set1,v 1.5 1998/06/27 12:27:55 christos Exp $
$ Error messages
$set 1
1 Syntax Error
2 %s is not allowed
3 Word too long
4 $< line too long
5 No file for $0
6 Incomplete [] modifier
7 $ expansion must end before ]
8 Bad : modifier in $ (%c)
9 Subscript error
10 Badly formed number
11 No more words
12 Missing file name
13 Internal glob error
14 Command not found
15 Too few arguments
16 Too many arguments
17 Too dangerous to alias that
18 Empty if
19 Improper then
20 Words not parenthesized
21 %s not found
22 Improper mask
23 No such limit
24 Argument too large
25 Improper or unknown scale factor
26 Undefined variable
27 Directory stack not that deep
28 Bad signal number
29 Unknown signal; kill -l lists signals
30 Variable name must begin with a letter
31 Variable name too long
32 Variable name must contain alphanumeric characters
33 No job control in this shell
34 Expression Syntax
35 No home directory
36 Can't change to home directory
37 Invalid null command
38 Assignment missing expression
39 Unknown operator
40 Ambiguous
41 %s: File exists
42 Argument for -c ends in backslash
43 Interrupted
44 Subscript out of range
45 Line overflow
46 No such job
47 Can't from terminal
48 Not in while/foreach
49 No more processes
50 No match
51 Missing %c
52 Unmatched %c
53 Out of memory
54 Can't make pipe
55 %s: %s
56 %s
57 Usage: jobs [ -l ]
58 Arguments should be jobs or process id's
59 No current job
60 No previous job
61 No job matches pattern
62 Fork nesting > %d; maybe `...` loop
63 No job control in subshells
64 Sync fault: Process %d not found
65 %sThere are suspended jobs
66 %sThere are stopped jobs
67 No other directory
68 Directory stack empty
69 Bad directory
70 Usage: %s [-%s]%s
71 No operand for -h flag
72 Not a login shell
73 Division by 0
74 Mod by 0
75 Bad scaling; did you mean "%s"?
76 Can't suspend a login shell (yet)
77 Unknown user: %s
78 No $home variable set
79 Usage: history [-%s] [# number of events]
80 $, ! or < not allowed with $# or $?
81 Newline in variable name
82 * not allowed with $# or $?
83 $?<digit> or $#<digit> not allowed
84 Illegal variable name
85 Newline in variable index
86 Expansion buffer overflow
87 Variable syntax
88 Bad ! form
89 No previous substitute
90 Bad substitute
91 No previous left hand side
92 Right hand side too long
93 Bad ! modifier: %c
94 Modifier failed
95 Substitution buffer overflow
96 Bad ! arg selector
97 No prev search
98 %s: Event not found
99 Too many )'s
100 Too many ('s
101 Badly placed (
102 Missing name for redirect
103 Ambiguous output redirect
104 Can't << within ()'s
105 Ambiguous input redirect
106 Badly placed ()'s
107 Alias loop
108 No $watch variable set
109 No scheduled events
110 Usage: sched -<item#>.\nUsage: sched [+]hh:mm <command>
111 Not that many scheduled events
112 No command to run
113 Invalid time for event
114 Relative time inconsistent with am/pm
115 Out of termcap string space
116 Usage: settc %s [yes|no]
117 Unknown capability `%s'
118 Unknown termcap parameter `%%%c'
119 Too many arguments for `%s' (%d)
120 `%s' requires %d arguments
121 Usage: echotc [-v|-s] [<capability> [<args>]]
122 %s: %s. Wrong Architecture
123 !# History loop
124 Malformed file inquiry
125 Selector overflow
126 Unknown option: `-%s'\nUsage: %s [ -bcdefilmnqstvVxX -Dname[=value] ] [ argument ... ]
127 Unknown option: `-%s'\nUsage: %s [ -bcdefFilmnqstvVxX ] [ argument ... ]
128 Unknown option: `-%s'\nUsage: %s [ -bcdefilmnqstvVxX ] [ argument ... ]
129 \nInvalid completion: "%s"
130 \nInvalid %s: '%c'
131 \nMissing separator '%c' after %s "%s"
132 \nIncomplete %s: "%s"
133 No operand for -m flag
134 Usage: unlimit [-fh] [limits]
135 $%S is read-only
136 No such job
137 Unknown colorls variable `%c%c'

8
contrib/tcsh/nls/C/set10 Normal file
View File

@ -0,0 +1,8 @@
$ $Id: set10,v 1.2 1995/03/19 18:07:15 christos Exp $
$ ma.setp.c
$set 10
1 setpath: invalid command '%s'.\n
2 setpath: insufficient arguments to command '%s'.\n
3 setpath: value missing in path '%s'\n
4 setpath: %s not found in %s\n
5 setpath: %d not valid position in %s\n

10
contrib/tcsh/nls/C/set11 Normal file
View File

@ -0,0 +1,10 @@
$ $Id: set11,v 1.2 1995/03/19 18:07:15 christos Exp $
$ sh.c
$set 11
1 Warning: no access to tty (%s).\n
2 Thus no job control in this shell.\n
3 You have %d mail messages.\n
4 You have %d mail messages in %s.\n
5 You have %smail.\n
6 new
7 You have %smail in %s.\n

4
contrib/tcsh/nls/C/set12 Normal file
View File

@ -0,0 +1,4 @@
$ $Id: set12,v 1.3 1996/04/26 20:31:52 christos Exp $
$ sh.dir.c
$set 12
1 %s: Trying to start from "%s"\n

13
contrib/tcsh/nls/C/set13 Normal file
View File

@ -0,0 +1,13 @@
$ $Id: set13,v 1.2 1995/03/19 18:07:15 christos Exp $
$ sh.exec.c
$set 13
1 hash=%-4d dir=%-2d prog=%s\n
2 %d hash buckets of %d bits each\n
3 debug mask = 0x%08x\n
4 %d hits, %d misses, %d%%\n
5 %S: shell built-in command.\n
6 %S: Command not found.\n
7 where: / in command makes no sense\n
8 %S is aliased to
9 %S is a shell built-in\n
10 hash miss:

6
contrib/tcsh/nls/C/set14 Normal file
View File

@ -0,0 +1,6 @@
$ $Id: set14,v 1.3 1998/11/24 18:18:06 christos Exp $
$ sh.file.c
$set 14
1 \nYikes!! Too many %s!!\n
2 names in password file
3 files

7
contrib/tcsh/nls/C/set15 Normal file
View File

@ -0,0 +1,7 @@
$ $Id: set15,v 1.3 1996/10/19 17:52:32 christos Exp $
$ sh.func.c
$set 15
1 %s: %s: Can't %s%s limit\n
2 remove
3 set
4 \040hard

13
contrib/tcsh/nls/C/set16 Normal file
View File

@ -0,0 +1,13 @@
$ $Id: set16,v 1.3 1996/04/26 20:31:55 christos Exp $
$ sh.lex.c
$set 16
1 Reset tty pgrp from %d to %d\n
2 \nUse "logout" to logout.\n
3 \nUse "exit" to leave %s.\n
4 seek to eval %x %x\n
5 seek to alias %x %x\n
6 seek to file %x\n
7 Bad seek type %d\n
8 tell eval %x %x\n
9 tell alias %x %x\n
10 tell file %x\n

16
contrib/tcsh/nls/C/set17 Normal file
View File

@ -0,0 +1,16 @@
$ $Id: set17,v 1.3 1996/10/19 17:52:33 christos Exp $
$ sh.proc.c
$set 17
1 BUG: waiting for background job!\n
2 Exit %d\n
3 BUG: process flushed twice
4 Running
5 Signal
6 Exit %-25d
7 Done
8 BUG: status=%-9o
9 \040(core dumped)
10 \040(wd:
11 wd now:
12 %S: Already suspended\n
13 %S: Already stopped\n

4
contrib/tcsh/nls/C/set18 Normal file
View File

@ -0,0 +1,4 @@
$ $Id: set18,v 1.2 1995/03/19 18:07:15 christos Exp $
$ sh.set.c
$set 18
1 Warning: ridiculously long PATH truncated\n

15
contrib/tcsh/nls/C/set19 Normal file
View File

@ -0,0 +1,15 @@
$ $Id: set19,v 1.3 1996/04/26 20:31:58 christos Exp $
$ tc.alloc.c
$set 19
1 nbytes=%d: Out of memory\n
2 free(%lx) called before any allocations.
3 free(%lx) above top of memory.
4 free(%lx) below bottom of memory.
5 free(%lx) bad block.
6 free(%lx) bad range check.
7 free(%lx) bad block index.
8 %s current memory allocation:\nfree:\t
9 \nused:\t
10 \n\tTotal in use: %d, total free: %d\n
11 \tAllocated memory from 0x%lx to 0x%lx. Real top at 0x%lx\n
12 Allocated memory from 0x%lx to 0x%lx (%ld).\n

111
contrib/tcsh/nls/C/set2 Normal file
View File

@ -0,0 +1,111 @@
$ $Id: set2,v 1.4 1998/10/25 15:12:38 christos Exp $
$ Signal names
$set 2
1 Null signal
2 Hangup
3 Interrupt
4 Quit
5 Illegal instruction
6 Trace/BPT trap
7 Abort
8 IOT trap
9 System Crash Imminent
10 Error exit
11 EMT trap
12 Floating exception
13 Killed
14 User signal 1
15 User signal 2
16 Segmentation fault
17 Bus error
18 Program range error
19 Operand range error
20 Bad system call
21 Broken pipe
22 Alarm clock
23 Terminated
24 Child status change
25 Death of child
26 Apollo-specific fault
27 Child stopped or exited
28 Child exited
29 Power failure
30 Resource Lost
31 Break (Ctrl-Break)
32 Input/output possible signal
33 Asynchronous I/O (select)
34 Urgent condition on I/O channel
35 Multitasking wake-up
36 Multitasking kill
37 Fortran asynchronous I/O completion
38 Recovery
39 Uncorrectable memory error
40 CPU time limit exceeded
41 System shutdown imminent
42 micro-tasking group-no wakeup flag set
43 Thread error - (use cord -T for detailed info)
44 CRAY Y-MP register parity error
45 Information request
46 Suspended (signal)
47 Stopped (signal)
48 Suspended
49 Stopped
50 Continued
51 Suspended (tty input)
52 Stopped (tty input)
53 Suspended (tty output)
54 Stopped (tty output)
55 Window status changed
56 Window size changed
57 Phone status changed
58 Cputime limit exceeded
59 Filesize limit exceeded
60 Virtual time alarm
61 Profiling time alarm
62 DIL signal
63 Pollable event occured
64 Process's lwps are blocked
65 Special LWP signal
66 Special CPR Signal
67 Special CPR Signal
68 First Realtime Signal
69 Second Realtime Signal
70 Third Realtime Signal
71 Fourth Realtime Signal
72 Fourth Last Realtime Signal
73 Third Last Realtime Signal
74 Second Last Realtime Signal
75 Last Realtime Signal
76 LAN Asyncronous I/O
77 PTY read/write availability
78 I/O intervention required
79 HFT monitor mode granted
80 HFT monitor mode should be relinguished
81 HFT sound control has completed
82 Data in HFT ring buffer
83 Migrate process
84 Secure attention key
85 Reschedule
86 Signaling SS$_DEBUG
87 Priority changed
88 True deadlock detected
89 New input character
90 Stack limit exceeded
91 Unused signal
92 LM overlay
93 system freeze
94 system defreeze
95 dead lock
96 exceeded memory size limit
97 exceeded data size limit
98 exceeded memory size limit of 32KB
99 exce error for no memory
100 check point start
101 check point start of kernel
102 restart start
103 restart of kernel
104 exeeded XMU size limit
105 exeeded RLG0 limit
106 exeeded RLG1 limit
107 exeeded RLG2 limit
108 exeeded RLG3 limit

41
contrib/tcsh/nls/C/set20 Normal file
View File

@ -0,0 +1,41 @@
$ $Id: set20,v 1.2 1995/03/19 18:07:15 christos Exp $
$ tc.bind.c
$set 20
1 Invalid key name `%S'\n
2 Bad key name: %S\n
3 Bad command name: %S\n
4 Bad key spec %S\n
5 Null string specification\n
6 Standard key bindings\n
7 Alternative key bindings\n
8 Multi-character bindings\n
9 Arrow key bindings\n
10 %-15s-> is undefined\n
11 BUG!!! %s isn't bound to anything.\n
12 Usage: bindkey [options] [--] [KEY [COMMAND]]\n
13 -a list or bind KEY in alternative key map\n
14 -b interpret KEY as a C-, M-, F- or X- key name\n
15 -s interpret COMMAND as a literal string to be output\n
16 -c interpret COMMAND as a builtin or external command\n
17 -v bind all keys to vi bindings\n
18 -e bind all keys to emacs bindings\n
19 -d bind all keys to default editor's bindings\n
20 -l list editor commands with descriptions\n
21 -r remove KEY's binding\n
22 -k interpret KEY as a symbolic arrow-key name\n
23 -- force a break from option processing\n
24 -u (or any invalid option) this message\n
25 Without KEY or COMMAND, prints all bindings\n
26 Without COMMAND, prints the binding for KEY.\n
27 bad key specification -- null string\n
28 bad key specification -- empty string\n
29 Bad function-key specification. Null key not allowed\n
30 bad key specification -- malformed hex number\n
31 bad key specification -- malformed octal number\n
32 bad key specification -- malformed decimal number\n
33 Bad function-key specification.\n
34 Null key not allowed\n
35 bad key specification -- unknown name "%S"\n
36 usage: bind [KEY | COMMAND KEY | "emacs" | "vi" | "-a"]\n
37 Invalid function
38 %s\t\tis undefined\n

5
contrib/tcsh/nls/C/set21 Normal file
View File

@ -0,0 +1,5 @@
$ $Id: set21,v 1.2 1995/03/19 18:07:15 christos Exp $
$ tc.disc.c
$set 21
1 Couldn't get local chars.\n
2 Couldn't set local chars.\n

17
contrib/tcsh/nls/C/set22 Normal file
View File

@ -0,0 +1,17 @@
$ $Id: set22,v 1.2 1995/03/19 18:07:15 christos Exp $
$ tc.func.c
$set 22
1 %S: \t aliased to
2 \nIncorrect passwd for %s\n
3 Faulty alias 'precmd' removed.\n
4 Faulty alias 'cwdcmd' removed.\n
5 Faulty alias 'beepcmd' removed.\n
6 Faulty alias 'periodic' removed.\n
7 parsing command line\n
8 Do you really want to delete all files? [n/y]
9 skipping deletion of files!\n
10 command line now is:\n
11 parsing command line\n
12 in one of the lists\n
13 command line now is:\n
14 yY

34
contrib/tcsh/nls/C/set23 Normal file
View File

@ -0,0 +1,34 @@
$ $Id: set23,v 1.3 1996/04/26 20:32:00 christos Exp $
$ tc.os.c
$set 23
1 Bad cpu/site name
2 Site path too long
3 unknown
4 site: %s\n
5 %d: Site not found\n
6 setlocal: %s: %s\n
7 Site not found
8 You're trapped in a universe you never made
9 Getwarp failed
10 Invalid warp
11 Setwarp failed
12 Illegal universe
13 Unknown Error: %d
14 sysname: %s\n
15 nodename: %s\n
16 release: %s\n
17 version: %s\n
18 machine: %s\n
19 getwd: Cannot open ".." (%s)
20 getwd: Cannot chdir to ".." (%s)
21 getwd: Read error in ".." (%s)
22 getwd: Cannot change back to "." (%s)
23 getwd: Cannot stat "/" (%s)
24 getwd: Cannot stat "." (%s)
25 getwd: Cannot stat directory "%s" (%s)
26 getwd: Cannot open directory "%s" (%s)
27 getwd: Cannot find "." in ".." (%s)
28 Invalid system type
29 System type is not set
30 Too many arguments
31 Invalid argument

4
contrib/tcsh/nls/C/set24 Normal file
View File

@ -0,0 +1,4 @@
$ $Id: set24,v 1.2 1995/03/19 18:07:15 christos Exp $
$ tc.sched.c
$set 24
1 kludge

6
contrib/tcsh/nls/C/set25 Normal file
View File

@ -0,0 +1,6 @@
$ $Id: set25,v 1.2 1995/03/19 18:07:15 christos Exp $
$ tc.sig.c
$set 25
1 our wait %d\n
2 error: bsd_signal(%d) signal out of range\n
3 error: bsd_signal(%d) - sigaction failed, errno %d\n

15
contrib/tcsh/nls/C/set26 Normal file
View File

@ -0,0 +1,15 @@
$ $Id: set26,v 1.2 1995/03/19 18:07:15 christos Exp $
$ tc.who.c
$set 26
1 cannot stat %s. Please "unset watch".\n
2 %s cannot be opened. Please "unset watch".\n
3 BUG! last element is not whotail!\n
4 backward:
5 BUG! first element is not whohead!\n
6 new: %s/%s\n
7 %n has %a %l from %m.
8 %n has %a %l.
9 logged on
10 logged off
11 replaced %s on
12 local

8
contrib/tcsh/nls/C/set27 Normal file
View File

@ -0,0 +1,8 @@
$ $Id: set27,v 1.2 1995/03/19 18:07:15 christos Exp $
$ tw.comp.c
$set 27
1 command
2 separator
3 pattern
4 range
5 completion

4
contrib/tcsh/nls/C/set29 Normal file
View File

@ -0,0 +1,4 @@
$ $Id: set29,v 1.2 1995/03/19 18:07:15 christos Exp $
$ tw.help.c
$set 29
1 No help file for %S\n

117
contrib/tcsh/nls/C/set3 Normal file
View File

@ -0,0 +1,117 @@
$ $Id: set3,v 1.3 1995/04/24 14:12:51 christos Exp $
$ Editor function descriptions
$set 3
1 Move back a character
2 Delete the character behind cursor
3 Cut from beginning of current word to cursor - saved in cut buffer
4 Cut from beginning of line to cursor - save in cut buffer
5 Move to beginning of current word
6 Move to beginning of line
7 Capitalize the characters from cursor to end of current word
8 Vi change case of character under cursor and advance one character
9 Vi change to end of line
10 Clear screen leaving current line on top
11 Complete current word
12 Tab forward through files
13 Tab backward through files
14 Complete current word ignoring programmable completions
15 Copy current word to cursor
16 Copy area between mark and cursor to cut buffer
17 Expand to preceding word for which this is a prefix
18 Delete character under cursor
19 Delete character under cursor or signal end of file on an empty line
20 Delete character under cursor or list completions if at end of line
21 Delete character under cursor, list completions or signal end of file
22 Cut from cursor to end of current word - save in cut buffer
23 Adds to argument if started or enters digit
24 Digit that starts argument
25 Move to next history line
26 Lowercase the characters from cursor to end of current word
27 Indicate end of file
28 Move cursor to end of line
29 Exchange the cursor and mark
30 Expand file name wildcards
31 Expand history escapes
32 Expand the history escapes in a line
33 Expand variables
34 Move forward one character
35 Move forward to end of current word
36 Exchange the two characters before the cursor
37 Search in history backward for line beginning as current
38 Search in history forward for line beginning as current
39 Insert last item of previous command
40 Incremental search forward
41 Incremental search backward
42 Clear line
43 Cut to end of line and save in cut buffer
44 Cut area between mark and cursor and save in cut buffer
45 Cut the entire line and save in cut buffer
46 List choices for completion
47 List choices for completion overriding programmable completion
48 List file name wildcard matches
49 List choices for completion or indicate end of file if empty line
50 Display load average and current process status
51 Expand history escapes and insert a space
52 Execute command
53 Expand pathnames, eliminating leading .'s and ..'s
54 Expand commands to the resulting pathname or alias
55 Switch from insert to overwrite mode or vice versa
56 Add 8th bit to next character typed
57 Add the next character typed to the line verbatim
58 Redisplay everything
59 Restart stopped editor
60 Look for help on current command
61 This character is added to the line
62 This character is the first in a character sequence
63 Set the mark at cursor
64 Correct the spelling of current word
65 Correct the spelling of entire line
66 Send character to tty in cooked mode
67 Toggle between literal and lexical current history line
68 Exchange the character to the left of the cursor with the one under
69 Exchange the two characters before the cursor
70 Tty delayed suspend character
71 Tty flush output character
72 Tty interrupt character
73 Tty quit character
74 Tty suspend character
75 Tty allow output character
76 Tty disallow output character
77 Indicates unbound character
78 Emacs universal argument (argument times 4)
79 Move to previous history line
80 Uppercase the characters from cursor to end of current word
81 Vi goto the beginning of next word
82 Vi enter insert mode after the cursor
83 Vi enter insert mode at end of line
84 Vi change case of character under cursor and advance one character
85 Vi change prefix command
86 Vi change to end of line
87 Enter vi command mode (use alternative key bindings)
88 Vi command mode complete current word
89 Vi move to previous character (backspace)
90 Vi delete prefix command
91 Vi move to the end of the current space delimited word
92 Vi move to the end of the current word
93 Vi move to the character specified backward
94 Vi move to the character specified forward
95 Vi move up to the character specified backward
96 Vi move up to the character specified forward
97 Enter vi insert mode
98 Enter vi insert mode at beginning of line
99 Vi repeat current character search in the same search direction
100 Vi repeat current character search in the opposite search direction
101 Vi repeat current search in the same search direction
102 Vi repeat current search in the opposite search direction
103 Vi replace character under the cursor with the next character typed
104 Vi replace mode
105 Vi search history backward
106 Vi search history forward
107 Vi replace character under the cursor and enter insert mode
108 Vi replace entire line
109 Vi move to the previous word
110 Vi move to the next word
111 Vi undo last change
112 Vi goto the beginning of line
113 Perform which of current command
114 Paste cut buffer at cursor position

16
contrib/tcsh/nls/C/set30 Normal file
View File

@ -0,0 +1,16 @@
$ $Id: set30,v 1.4 1996/10/19 17:52:34 christos Exp $
$ tw.parse.c
$set 30
1 starting_a_command %d\n
2 complete %d
3 complete %d %S\n
4 %s: Internal match error.\n
5 items
6 rows
7 There are %d %s, list them anyway? [n/y]
8 looking = %d\n
9 \ntcsh internal error: I don't know what I'm looking for!\n
10 not a directory
11 not found
12 unreadable
13 yY

7
contrib/tcsh/nls/C/set31 Normal file
View File

@ -0,0 +1,7 @@
$ $Id: set31,v 1.2 1995/03/19 18:07:15 christos Exp $
$ vms.termcap.c
$set 31
1 Can't open TERMCAP: [%s]\n
2 Can't open %s.\n
3 Found %s in %s.\n
4 No match found for %s in file %s\n

45
contrib/tcsh/nls/C/set4 Normal file
View File

@ -0,0 +1,45 @@
$ $Id: set4,v 1.2 1995/03/19 18:07:15 christos Exp $
$ Termcap strings
$set 4
1 add new blank line
2 audible bell
3 clear to bottom
4 clear to end of line
5 cursor to horiz pos
6 clear screen
7 delete a character
8 delete a line
9 start delete mode
10 end delete mode
11 end insert mode
12 cursor from status line
13 home cursor
14 insert character
15 start insert mode
16 insert padding
17 sends cursor down
18 sends cursor left
19 sends cursor right
20 sends cursor up
21 begin bold
22 end attributes
23 non destructive space
24 end standout
25 begin standout
26 cursor to status line
27 cursor up one
28 begin underline
29 end underline
30 visible bell
31 delete multiple chars
32 cursor down multiple
33 insert multiple chars
34 cursor left multiple
35 cursor right multiple
36 cursor up multiple
37 Has automatic margins
38 Can use physical tabs
39 Number of lines
40 Number of columns
41 Has meta key
42 Newline ignored at right margin

4
contrib/tcsh/nls/C/set5 Normal file
View File

@ -0,0 +1,4 @@
$ $Id: set5,v 1.2 1995/03/19 18:07:15 christos Exp $
$ ed.chared.c
$set 5
1 Load average unavailable\n

11
contrib/tcsh/nls/C/set6 Normal file
View File

@ -0,0 +1,11 @@
$ $Id: set6,v 1.2 1995/03/19 18:07:15 christos Exp $
$ ed.inputl.c
$set 6
1 ERROR: illegal command from key 0%o\r\n
2 yes\n
3 edit\n
4 abort\n
5 no\n
6 No matching command\n
7 Ambiguous command\n
8 *** editor fatal ERROR ***\r\n\n

30
contrib/tcsh/nls/C/set7 Normal file
View File

@ -0,0 +1,30 @@
$ $Id: set7,v 1.3 1996/04/26 20:32:04 christos Exp $
$ ed.screen.c
$set 7
1 \n\tTcsh thinks your terminal has the\n
2 \tfollowing characteristics:\n\n
3 \tIt has %d columns and %d lines\n
4 \tIt has %s meta key\n
5 a
6 no
7 \tIt can%s use tabs\n
8 not
9 \tIt %s automatic margins\n
10 has
11 does not have
12 \tIt %s magic margins\n
13 (empty)
14 yes
15 no
16 ERROR: cannot delete\r\n
17 DeleteChars: num is riduculous: %d\r\n
18 ERROR: cannot insert\r\n
19 StartInsert: num is riduculous: %d\r\n
20 %s: Cannot open /etc/termcap.\n
21 %s: No entry for terminal type "%s"\n
22 %s: using dumb terminal settings.\n
23 %s: WARNING: Your terminal cannot move up.\n
24 Editing may be odd for long lines.\n
25 no clear EOL capability.\n
26 no delete char capability.\n
27 no insert char capability.\n

5
contrib/tcsh/nls/C/set8 Normal file
View File

@ -0,0 +1,5 @@
$ $Id: set8,v 1.2 1995/03/19 18:07:15 christos Exp $
$ ed.term.c
$set 8
1 Unknown switch
2 Invalid argument

12
contrib/tcsh/nls/C/set9 Normal file
View File

@ -0,0 +1,12 @@
$ $Id: set9,v 1.2 1995/03/19 18:07:15 christos Exp $
$ ed.xmap.c
$set 9
1 AddXkey: Null extended-key not allowed.\n
2 AddXkey: sequence-lead-in command not allowed\n
3 DeleteXkey: Null extended-key not allowed.\n
4 Unbound extended key "%S"\n
5 Some extended keys too long for internal print buffer
6 Enumerate: BUG!! Null ptr passed\n!
7 no input
8 Something must follow: %c\n
9 Octal constant does not fit in a char.\n

21
contrib/tcsh/nls/Makefile Normal file
View File

@ -0,0 +1,21 @@
SUBDIRS= C german french italian ja greek spanish
#GENCAT= gencat -new
GENCAT= gencat
catalogs:
@for i in ${SUBDIRS} ; \
do \
echo "$$i"; \
cd $$i; \
cat set[0-9] set[0-9][0-9] > ../../tcsh.$$i.m; \
cd ..; \
${GENCAT} ../tcsh.$$i.cat ../tcsh.$$i.m; \
done
clean:
@for i in ${SUBDIRS} ; \
do \
rm -f $$i/*~; \
rm -f ../tcsh.$$i.cat ../tcsh.$$i.m; \
done

View File

@ -0,0 +1,140 @@
$ $Id: set1,v 1.3 1998/06/27 12:27:57 christos Exp $
$ Messages d 'erreur
$set 1
1 Erreur de syntaxe
2 %s n'est pas autorisé
3 Mot trop long
4 $< ligne trop longue
5 Pas de fichier pour $0
6 Modificateur [] incomplet
7 $ l'expansion doit se terminer avant ]
8 Mauvais : modificateur dans $ (%c)
9 Erreur d'indice
10 Numéro mal formé
11 Plus de mots
12 Nom de fichier manquant
13 Erreur globale interne
14 Commande introuvable
15 Trop peu d'arguments
16 Trop d'arguments
17 Trop dangereux d'attribuer un alias à cela
18 `If' vide
19 `Then' incorrect
20 Les mots ne sont pas placés entre parenthèses
21 %s introuvable
22 Masque incorrect
23 Pas de limite de ce type
24 Argument trop long
25 Facteur d'échelle incorrect ou inconnu
26 Variable pas définie
27 La pile de répertoires n'a pas cette taille
28 Mauvais numéro de signal
29 Signal inconnu; "kill -l" permet de lister les signaux
30 Le nom de la variable doit commencer par une lettre
31 Le nom de la variable est trop long
32 Le nom de la variable ne doit contenir que des caractères alphanumériques
33 Pas de gestion des travaux dans ce shell
34 Syntaxe de l'expression
35 Pas de répertoire personnel
36 Impossible de passer dans le répertoire personnel
37 Commande nulle incorrecte
38 Il manque l'affectation dans l'expression
39 Opérateur inconnu
40 ambigu
41 %s: Le fichier existe
42 L'argument pour -c se termine avec un anti-slash
43 Interrompu
44 Indice hors limites
45 Dépassement de capacité de ligne
46 Pas de travail de ce type
47 Impossible à partir d'un terminal
48 Vous n'êtes pas dans une boucle while ou foreach
49 Plus de processus
50 Pas de correspondance
51 %c manquant
52 %c sans correspondance
53 Mémoire insuffisante
54 Impossible de créer un tube
55 %s: %s
56 %s
57 Syntaxe: jobs [ -l ]
58 Les arguments doivent être des ID de processus ou des numéros de travaux
59 Pas de travail en cours
60 Pas de travail précédent
61 Pas de travail de cette forme
62 Emboîtement des `Fork' > %d; peut-être une boucle `...`
63 Pas de gestion des travaux dans les sous-shells
64 Faute `Sync': Processus %d pas trouvé
65 %s Il y a des travaux interrompus
66 %s Il y a des travaux arrêtés
67 Pas d'autre répertoire
68 La pile de répertoires est vide
69 Répertoire incorrect
70 Syntaxe: %s [-%s]%s
71 Pas d'opérande pour l'indicateur -h
72 Ce n'est pas un shell de connexion
73 Division par zéro
74 Modulo par zéro
75 Mise à l'échelle incorrecte ; cela signifie-t-il ``%s'' ?
76 Impossible d'interrompre un shell de connexion
77 Utilisateur inconnu : %s
78 Pas de variable `$home' définie
79 Syntaxe: history [-%s] [# nombre d'évènements]
80 $, ! ou < pas autorisés avec $# or $?
81 Retour-chariot dans un nom de variable
82 * pas autorisé avec $# or $?
83 $?<digit> ou $#<digit> pas autorisé
84 Nom de variable incorrect
85 Retour-chariot dans l'index de variable
86 Dépassement de capacité de la mémoire tampon d'expansion
87 Syntaxe de variable
88 Forme ! incorrecte
89 Pas de remplacement précédent
90 Remplacement incorrect
91 Pas de partie gauche précédente
92 Partie droite trop longue
93 Modificateur ! incorrect: %c
94 Echec du modificateur
95 Dépassement de capacité de la mémoire tampon de substitution
96 Sélecteur d'argument ! incorrect
97 Pas de recherche précédente
98 %s: événement introuvable
99 Trop de caractères )
100 Trop de caractères (
101 Caractère ( mal placé
102 Il manque un nom pour rediriger
103 Redirection de sortie ambigue
104 Pas de << entre les caractères ( et )
105 Redirection d'entrée ambigue
106 Caractères () mal placés
107 Boucle dans les alias
108 Pas de variable `$watch' définie
109 Pas d'évènement prévu
110 Syntaxe: sched -<#numéro>.\nSyntaxe: sched [+]hh:mm <commande>
111 Pas tant d'évènements prévus
112 Pas de commande à lancer
113 Temps incorrect pour l'évènement
114 Temps relatif incompatible avec am/pm
115 Pas assez de place pour la chaine termcap
116 Syntaxe: settc %s [yes|no]
117 Capacité `%s' inconnue
118 Paramètre termcap inconnu `%%%c'
119 Trop d'arguments pour `%s' (%d)
120 `%s' nécessite %d arguments
121 Syntaxe: echotc [-v|-s] [<capacité> [<args>]]
122 %s: %s. Mauvaise Architecture
123 !# Boucle dans l'historique
124 Mauvaise recherche de fichier
125 Dépassement de capacité de sélecteur
126 Option inconnue: `-%s'\nSyntaxe: %s [ -bcdefilmnqstvVxX -Dnom[=valeur] ] [ argument ... ]
127 Option inconnue: `-%s'\nSyntaxe: %s [ -bcdefFilmnqstvVxX ] [ argument ... ]
128 Option inconnue: `-%s'\nSyntaxe: %s [ -bcdefilmnqstvVxX ] [ argument ... ]
129 \nComplément incorrect: "%s"
130 \n%s incorrect: '%c'
131 \nIl manque le séparateur '%c' après %s "%s"
132 \n%s incomplet: "%s"
133 Pas d'opérande pour l'indicateur -m
134 Syntaxe: unlimit [-fh] [limites]
135 $%S est en lecture seule
136 Pas de travail de ce type
137 Unknown colorls variable `%c%c'

View File

@ -0,0 +1,8 @@
$ $Id: set10,v 1.1 1995/04/25 14:04:35 christos Exp $
$ ma.setp.c
$set 10
1 setpath: commande incorrecte '%s'.\n
2 setpath: pas assez d'arguments pour la commande '%s'.\n
3 setpath: donnée manquante dans le chemin '%s'\n
4 setpath: %s pas trouvé dans %s\n
5 setpath: %d pas une position correcte dans %s\n

View File

@ -0,0 +1,10 @@
$ $Id: set11,v 1.1 1995/04/25 14:04:35 christos Exp $
$ sh.c
$set 11
1 Attention: pas d'accès au tty (%s).\n
2 Ainsi pas de contrôle de job dans ce shell.\n
3 Vous avez%d messages courrier (mail).\n
4 Vous avez %d messages courrier (mail) dans %s.\n
5 Vous avez du %scourrier.\n
6 nouveau
7 Vous avez du %scourrier dans %s.\n

View File

@ -0,0 +1,4 @@
$ $Id: set12,v 1.2 1996/04/26 20:45:51 christos Exp $
$ sh.dir.c
$set 12
1 %s: Essaie de démarrer à partir de "%s"\n

View File

@ -0,0 +1,13 @@
$ $Id: set13,v 1.1 1995/04/25 14:04:35 christos Exp $
$ sh.exec.c
$set 13
1 hash=%-4d dir=%-2d prog=%s\n
2 %d groupes de hashage de %d bits chacun\n
3 masque de déboguage = 0x%08x\n
4 %d réussis, %d manqués, %d%%\n
5 %S: commande intégrée au shell.\n
6 %S: Commande pas trouvée.\n
7 où: / dans la commande n'a pas de sens\n
8 %S est un alias avec
9 %S est intégré(e) au shell\n
10 hashage manqués:

View File

@ -0,0 +1,6 @@
$ $Id: set14,v 1.1 1995/04/25 14:04:35 christos Exp $
$ sh.file.c
$set 14
1 \nTrop de %s !!\n
2 noms dans le fichier des mots de passe
3 fichiers

View File

@ -0,0 +1,7 @@
$ $Id: set15,v 1.1 1995/04/25 14:04:35 christos Exp $
$ sh.func.c
$set 15
1 %s: %s: ne peut %s la limite%s\n
2 enlever
3 positionner
4 matérielle

View File

@ -0,0 +1,13 @@
$ $Id: set16,v 1.2 1996/04/26 20:45:55 christos Exp $
$ sh.lex.c
$set 16
1 Réinitialise le groupe de processus des terminaux de %d à %d\n
2 \nUtilisez "logout" pour vous déconnecter.\n
3 \nUtilisez "exit" pour quitter %s.\n
4 seek to eval %x %x\n
5 seek to alias %x %x\n
6 seek to file %x\n
7 Mauvais type pour seek %d\n
8 tell eval %x %x\n
9 tell alias %x %x\n
10 tell file %x\n

View File

@ -0,0 +1,16 @@
$ $Id: set17,v 1.2 1996/10/19 17:52:38 christos Exp $
$ sh.proc.c
$set 17
1 BUG: attente de travail en tâche de fond !\n
2 Sortie %d\n
3 BUG: processus vidé deux fois
4 Tourne
5 Signal
6 Sortie %-25d
7 Fait
8 BUG: état=%-9o
9 \040(core dumped)
10 \040(wd:
11 wd maintenant:
12 %S: Déjà suspendu\n
13 %S: Déjà arrêté\n

View File

@ -0,0 +1,4 @@
$ $Id: set18,v 1.1 1995/04/25 14:04:35 christos Exp $
$ sh.set.c
$set 18
1 Attention: le PATH exagérément long est tronqué\n

View File

@ -0,0 +1,15 @@
$ $Id: set19,v 1.2 1996/04/26 20:45:59 christos Exp $
$ tc.alloc.c
$set 19
1 nbytes=%d: Plus de mémoire\n
2 free(%lx) appelé avant allocation.
3 free(%lx) au delà de la limite memoire.
4 free(%lx) en deçà de la limite memoire.
5 free(%lx) mauvais bloc.
6 free(%lx) limites incorrectes.
7 free(%lx) index de bloc incorrect.
8 %s allocation mémoire actuelle:\nfree:\t
9 \nutilisé:\t
10 \n\tTotal utilisé: %d, total libre: %d\n
11 \tMémoire allouée de 0x%lx à 0x%lx. Limite réelle supérieure à 0x%lx\n
12 Mémoire allouée de 0x%lx à 0x%lx (%ld).\n

View File

@ -0,0 +1,94 @@
$ $Id: set2,v 1.2 1997/10/27 23:33:53 christos Exp $
$ Messages Signaux
$set 2
1 Signal nul
2 Interrompu
3 Arrêté
4 Sortie
5 Instruction interdite
6 Piège Trace/BPT
7 Abandon
8 Piège IOT
9 Plantage système imminent
10 Sortie erreur
11 Piège EMT
12 Exception de calcul en virgule flottante
13 Supprimé
14 Signal utilisateur 1
15 Signal utilisateur 2
16 Incident de segmentation
17 Erreur de bus
18 Program range error
19 Operand range error
20 Appel système incorrect
21 Tube détruit
22 Alarme
23 Terminé
24 L'état du fils a changé
25 Mort du fils
26 Faute spécifique Apollo
27 Fils arrêté ou sorti
28 Fils sorti
29 Coupure d'alimentation
30 Ressource perdue
31 Break (Ctrl-Break)
32 Signal d'E-S possible
33 Entrée-Sortie asynchrone (select)
34 Condition urgente sur canal d'E-S
35 Reprise multi-tâche
36 Terminaison multi-tâche
37 Achèvement d'E-S asynchrone Fortran
38 Reprise
39 Erreur mémoire irrécupérable
40 Limite temps CPU dépassée
41 Arrêt du système imminent
42 Groupe micro-tasking-pas d'option de réveil définie
43 Erreur de thread - (utilisez cord -T pour plus d'infos)
44 Erreur de parité de registre du CRAY Y-MP
45 Demande d'information
46 Interrompu (Signal)
47 Stoppé (Signal)
48 Interrompu
49 Stoppé
50 Continue
51 Entrée tty suspendue
52 Entrée tty arrêtée
53 Sortie tty suspendue
54 Sortie tty arrêtée
55 Etat de la fenêtre modifié
56 Taille de la fenêtre modifiée
57 Etat du téléphone modifié
58 Limite temps CPU dépassée
59 Taille limite de fichier dépassée
60 Signal de l'horloge virtuelle
61 Signal de profil
62 Signal DIL
63 Un évènement à scruter est arrivé
64 Process's lwps are blocked
65 Signal Special LWP
66 Signal Special CPR
67 Signal Special CPR
68 Premier signal temps réel
69 Deuxième signal temps réel
70 Troisième signal temps réel
71 Quatrième signal temps réel
72 Quatrième signal temps réel avant la fin
73 Antépénultième signal temps réel
74 Avant-dernier signal temps réel
75 Dernier signal temps réel
76 E-S asynchrone LAN
77 Lecture/Ecriture PTY disponible
78 Intervention E-S nécessaire
79 Mode moniteur HFT accordé
80 Le mode moniteur HFT doit être abandonné
81 Le contrôle du son HFT est terminé
82 Données en buffer circulaire HFT
83 Processus de transfert
84 Touche d'attention sécurisée
85 Re-séquencement
86 Signal SS$_DEBUG
87 Priorité modifiée
88 detecté
89 Nouveau caractère d'entrée
90 Stack limit exceeded
91 Unused signal

View File

@ -0,0 +1,41 @@
$ $Id: set20,v 1.1 1995/04/25 14:04:35 christos Exp $
$ tc.bind.c
$set 20
1 Nom de touche incorrect `%S'\n
2 Mauvais nom de touche: %S\n
3 Mauvais nom de commande: %S\n
4 Mauvaise touche spécifiée %S\n
5 Chaine nulle spécifiée\n
6 Définition de touches standard\n
7 Définition de touches alternatives\n
8 Définition Multi-caractères\n
9 Définition des touches de direction\n
10 %-15s-> n'est pas défini\n
11 BUG!!! %s n'est lié à rien.\n
12 Usage: bindkey [options] [--] [TOUCHE [COMMANDE]]\n
13 -a liste ou définit la TOUCHE dans la table des touches alternatives\n
14 -b interprète TOUCHE comme un nom de touche C-, M-, F- or X-\n
15 -s interprète COMMANDE comme une chaine littérale devant être sortie\n
16 -c interprète COMMANDE comme une commande intégrée ou externe\n
17 -v redéfinit toutes les touches pour vi\n
18 -e redéfinit toutes les touches pour emacs\n
19 -d redéfinit toutes les touches pour de l'éditeur par defaut\n
20 -l liste les commandes de l'éditeur avec descriptions\n
21 -r enlève la correspondance pour la TOUCHE\n
22 -k interprète TOUCHE comme un nom de touche de direction symbolique\n
23 -- force un arrêt dans le traitement de l'option\n
24 -u (ou toute option incorrecte) ce message\n
25 Sans TOUCHE ni COMMANDE, imprime toutes les associations\n
26 Sans COMMANDE, imprime l'association pour TOUCHE.\n
27 mauvaise spécification de touche -- chaine nulle\n
28 mauvaise spécification de touche -- chaine vide\n
29 mauvaise spécification de touche de fonction. Touche nulle pas autorisé\n
30 mauvaise spécification de touche -- nombre hexa mal formé\n
31 mauvaise spécification de touche -- nombre octal mal formé\n
32 mauvaise spécification de touche -- nombre décimal mal formé\n
33 Mauvaise spécification de touche de fonction.\n
34 Touche nulle pas autorisé\n
35 Mauvaise spécification de touche -- nom inconnu "%S"\n
36 Syntaxe: bind [TOUCHE | COMMANDE TOUCHE | "emacs" | "vi" | "-a"]\n
37 Fonction incorrecte
38 %s\t\tn'est pas défini\n

View File

@ -0,0 +1,5 @@
$ $Id: set21,v 1.1 1995/04/25 14:04:35 christos Exp $
$ tc.disc.c
$set 21
1 ne peut obtenir les caractères locaux.\n
2 ne peut définir les catactères locaux.\n

View File

@ -0,0 +1,17 @@
$ $Id: set22,v 1.1 1995/04/25 14:04:35 christos Exp $
$ tc.func.c
$set 22
1 %S: \t a comme alias
2 \nMot de passe incorrect pour %s\n
3 Erreur alias 'precmd' enlevé.\n
4 Erreur alias 'cwdcmd' enlevé.\n
5 Erreur alias 'beepcmd' enlevé.\n
6 Erreur alias 'periodic' enlevé.\n
7 étude de la ligne de commande\n
8 Voulez vous vraiment supprimer tous les fichiers? [n/y]
9 passe la suppression des fichiers!\n
10 la ligne de commande est maintenant :\n
11 étude de la ligne de commande\n
12 dans une des listes\n
13 la ligne de commande est maintenant :\n
14 OoyY

View File

@ -0,0 +1,34 @@
$ $Id: set23,v 1.2 1996/04/26 20:46:04 christos Exp $
$ tc.os.c
$set 23
1 Mauvais nom de cpu/site
2 Chemin du site trop mong
3 inconnu
4 site: %s\n
5 %d: Site pas trouvé\n
6 setlocal: %s: %s\n
7 Site pas trouvé
8 Vous êtes piégé dans un univers que vous n'avez jamais créé
9 Getwarp a échoué
10 warp invalide
11 Setwarp a échoué
12 Univers incorrect
13 Erreur inconnue : %d
14 sysname: %s\n
15 nodename: %s\n
16 release: %s\n
17 version: %s\n
18 machine: %s\n
19 getwd: Ne peut ouvrir ".." (%s)
20 getwd: Ne peut effectuer chdir vers ".." (%s)
21 getwd: Erreur en lecture dans ".." (%s)
22 getwd: Ne peut revenir à "." (%s)
23 getwd: Ne peut effectuer stat "/" (%s)
24 getwd: Ne peut effectuer stat "." (%s)
25 getwd: Ne peut effectuer stat sur répertoire "%s" (%s)
26 getwd: Ne peut ouvrir le répertoire "%s" (%s)
27 getwd: Ne peut trouver "." dans ".." (%s)
28 Type de système incorrect
29 Le type de système n'est pas défini
30 XXX: Too many arguments
31 XXX: Invalid argument

View File

@ -0,0 +1,4 @@
$ $Id: set24,v 1.1 1995/04/25 14:04:35 christos Exp $
$ tc.sched.c
$set 24
1 kludge

View File

@ -0,0 +1,6 @@
$ $Id: set25,v 1.1 1995/04/25 14:04:35 christos Exp $
$ tc.sig.c
$set 25
1 notre attente %d\n
2 erreur: bsd_signal(%d) signal hors limites\n
3 erreur: bsd_signal(%d) - sigaction a échoué, errno %d\n

View File

@ -0,0 +1,15 @@
$ $Id: set26,v 1.1 1995/04/25 14:04:35 christos Exp $
$ tc.who.c
$set 26
1 ne peut effectuer stat %s. S.V.P effectuez "unset watch".\n
2 %s ne peut être ouvert. S.V.P effectuez "unset watch".\n
3 BUG! le dernier élément n'est pas whotail!\n
4 arrière:
5 BUG! le premier élément n'est pas whohead!\n
6 nouveau: %s/%s\n
7 %n a %a %l from %m.
8 %n a %a %l.
9 connecté
10 déconnecté
11 remplacé %s
12 local

View File

@ -0,0 +1,8 @@
$ $Id: set27,v 1.1 1995/04/25 14:04:35 christos Exp $
$ tw.comp.c
$set 27
1 commande
2 séparateur
3 motif
4 intervalle
5 complément

View File

@ -0,0 +1,4 @@
$ $Id: set29,v 1.1 1995/04/25 14:04:35 christos Exp $
$ tw.help.c
$set 29
1 Pas de fichier d'aide pour %S\n

View File

@ -0,0 +1,117 @@
$ $Id: set3,v 1.1 1995/04/25 14:04:35 christos Exp $
$ Description des fonctions éditeur
$set 3
1 Recule d'un caractère
2 Efface le caractère derrière le curseur
3 Coupe depuis le début du mot jusqu'au curseur - sauvegardé dans le tampon de copie
4 Coupe depuis le début de la ligne jusqu'au curseur - sauvegardé dans le tampon de copie
5 Va au début du mot courant
6 Va au début de la ligne
7 Met en majuscules les caractères depuis le curseur jusqu'à la fin du mot
8 Vi change la casse du caractère sous le curseur et avance d'un caractère
9 Vi change jusqu'à la fin de la ligne
10 Efface l'écran en laissant la ligne courant au dessus
11 Complète le mot courant
12 Tab avance parmi les fichiers
13 Tab recule parmi les fichiers
14 Complète le mot courant en ignorant les compléments programmables
15 Copie le mot courant jusqu'au curseur
16 Copie la zone entre la marque et le curseur dans le tampon de copie
17 Développe vers le mot précédent pour lequel c'est un préfixe
18 Efface le caractère sous le curseur
19 Efface le caractère sous le curseur, ou signale la fin de fichier si ligne vide
20 Efface le caractère sous le curseur, ou liste les compléments si fin de ligne
21 Efface le caractère sous le curseur, liste les compléments ou signale la fin de fichier
22 Coupe depuis le curseur jusqu'à la fin du mot courant - sauvegardé dans le tampon de copie
23 Ajoute aux arguments si démarré ou entre le chiffre
24 Chiffre au début de l'argument
25 Va à la prochaine ligne de l'historique
26 Met en minuscules les caractères depuis le curseur jusqu'à la fin du mot
27 Indique la fin de fichier
28 Déplace le curseur à la fin de la ligne
29 Echange le curseur et la marque
30 Développe les jokers du nom de fichier
31 Développe les échappements de l'historique
32 Développe les échappements de l'historique en une ligne
33 Développe les variables
34 Avance d'un caractère
35 Avance à la fin du mot courant
36 Echange les deux caractères avant le curseur
37 Cherche en arrière dans l'historique une ligne commençant comme la ligne courante
38 Cherche en avant dans l'historique une ligne commençant comme la ligne courante
39 Insère le dernier elément de la commande précédente
40 Recherche en avant incrémentale
41 Recherche en arrière incrémentale
42 Efface la ligne
43 Coupe jusqu'à la fin de la ligne et sauvegarde dans le tampon de copie
44 Coupe la zone entre la marque et le curseur et sauvegarde dans le tampon de copie
45 Coupe toute la ligne et sauvegarde dans le tampon de copie
46 Liste les choix pour le complément
47 Liste les choix pour le complément sur-définissant le complément programmable
48 Liste les correspondances pour le nom de fichier avec joker
49 Liste les choix pour le complément ou indique la fin de fichier si ligne vide
50 Affiche la charge moyenne et l'état courant des processus
51 Développe les échappements de l'historique et insère une espace
52 Exécute la commande
53 Développe les nom de répertoires, éliminant les `.' et `..' en tête
54 Développe les commandes pour le chemin ou l'alias résultant
55 Passe du mode insertion au mode recouvrement et vice-versa
56 Ajoute le 8ième bit au prochain caractère saisi
57 Ajoute le prochain caractère saisi à la ligne
58 Réaffiche tout
59 Redémarre l'éditeur
60 Cherche de l'aide pour la commande courante
61 Ce caractère est ajouté à la ligne
62 Ca caractère est le premier dans une séquence de caractères
63 Définit la marque à la position du curseur
64 Corrige la syntaxe du mot courant
65 Corrige la syntaxe de la ligne complète
66 Envoie le caractère au tty en mode
67 Bascule la ligne courante de l'historique entre le mode littéral et lexical
68 Echange le caractère à la gauche du curseur avec celui en dessous du curseur
69 Echange les deux caractères avant le curseur
70 Caractère tty de suspension différé
71 Caractère tty de vidage de sortie
72 Caractère tty d'interruption
73 Caractère tty de sortie
74 Caractère tty de suspension
75 Caractère tty de validation de sortie
76 Caractère tty d'invalidation de sortie
77 Indique un caractère pas attaché
78 Argument universel Emacs (argument x 4)
79 Va à la ligne précédente de l'historique
80 Met en majuscule les caractères depuis le curseur jusqu'à la fin du mot courant
81 Vi va au début du prochain mot
82 Vi passe en mode insertion après le curseur
83 Vi passe en mode insertion à la fin de la ligne
84 Vi change la casse du caractère sous le curseur et avance d'un caractère
85 Vi change la commande `prefix'
86 Vi change jusqu'à la fin de la ligne
87 Passe au mode de commande Vi (redéfinition des touches alternatives)
88 Le mode commande de Vi complète le mot courant
89 Vi va au caractère précédent (retour-arrière)
90 Vi efface la commande `prefix'
91 Vi va à la fin du mot courant délimité par des espaces
92 Vi va à la fin du mot courant
93 Vi va vers le caractère spécifié avant
94 Vi va vers le caractère spécifié après
95 Vi remonte vers le caractère spécifié avant
96 Vi remonte vers le caractère spécifié après
97 Passe en mode insertion Vi
98 Passe en mode insertion Vi au début de la ligne
99 Vi répète la recherche du caractère en cours dans la même direction
100 Vi répète la recherche du caractère en cours dans la direction opposée
101 Vi répète la recherche en cours dans la même direction
102 Vi répète la recherche en cours dans la direction opposée
103 Vi remplace le caractère sous le curseur avec le prochain caractère saisi
104 Mode de remplacement Vi
105 Vi cherche dans l'historique en arrière
106 Vi cherche dans l'historique en avant
107 Vi remplace le caractère sous le curseur et passe en mode insertion
108 Vi remplace la ligne entière
109 Vi va au mot précédent
110 Vi va au prochain mot
111 Vi défait la dernière modification
112 Vi va au début de la ligne
113 Exécute quelle commande en cours
114 Colle le tampon de copie à la position du curseur

View File

@ -0,0 +1,16 @@
$ $Id: set30,v 1.2 1996/04/26 20:46:09 christos Exp $
$ tw.parse.c
$set 30
1 démarre une commande %d\n
2 complete %d
3 complete %d %S\n
4 %s: Erreur interne de correspondance.\n
5 éléments
6 colonnes
7 Il y a %d %s, les lister quand même ? [n/y]
8 looking = %d\n
9 \nerreur interne %s: Je ne sais pas ce que je recherche !\n
10 pas un répertoire
11 pas trouvé
12 pas lisible
13 oOyY

View File

@ -0,0 +1,7 @@
$ $Id: set31,v 1.1 1995/04/25 14:04:35 christos Exp $
$ vms.termcap.c
$set 31
1 Ne peut ouvrir TERMCAP: [%s]\n
2 Ne peut ouvrir %s.\n
3 Trouvé %s dans %s.\n
4 Pas de correspondance trouvée pour %s dans le fichier %s\n

View File

@ -0,0 +1,45 @@
$ $Id: set4,v 1.1 1995/04/25 14:04:35 christos Exp $
$ Termcap strings
$set 4
1 ajoute une nouvelle ligne vide
2 bip audible
3 efface jusqu'en bas
4 efface jusqu'à la fin de la ligne
5 curseur vers un position horizontale
6 efface l'écran
7 efface un caractère
8 efface une ligne
9 commence le mode d'effacement
10 termine le mode d'effacement
11 termine le mode d'insertion
12 curseur de la ligne d'état
13 curseur origine
14 insère caractère
15 commence le mode insertion
16 insère du remplissage
17 curseur vers le bas
18 curseur vers la gauche
19 curseur vers la droite
20 curseur vers le haut
21 commence le gras
22 fin attributs
23 espaces non-destructives
24 fin mise en évidence
25 commence mise en évidence
26 curseur à la ligne d'état
27 curseur d'une vers le haut
28 commence souligné
29 fin souligné
30 bip `visible'
31 efface plusiseurs caractères
32 curseur vers le bas (plusieurs)
33 insert plusieurs caractères
34 curseur vers la gauche (plusieurs)
35 curseur vers la droite (plusieurs)
36 curseur vers le haut (plusieurs)
37 A les marge automatiques
38 Peut utiliser les tabulations physiques
39 Nombre de lignes
40 Nombre de colonnes
41 A les touches `alternatives'
42 retoure-chariot ignoré à la droite de la marge

View File

@ -0,0 +1,4 @@
$ $Id: set5,v 1.1 1995/04/25 14:04:35 christos Exp $
$ ed.chared.c
$set 5
1 Charge moyenne indisponible\n

View File

@ -0,0 +1,11 @@
$ $Id: set6,v 1.1 1995/04/25 14:04:35 christos Exp $
$ ed.inputl.c
$set 6
1 ERREUR: commande interdite de la touche 0%o\r\n
2 oui\n
3 edit\n
4 arrête\n
5 non\n
6 Pas de commande correspondante\n
7 Commande ambigue\n
8 *** ERREUR fatale de l'éditeur ***\r\n\n

View File

@ -0,0 +1,30 @@
$ $Id: set7,v 1.2 1996/04/26 20:46:12 christos Exp $
$ ed.screen.c
$set 7
1 \n\tTcsh a déterminé que votre terminal a les\n
2 \tcaractéristiques suivantes :\n\n
3 \tIl a %d colonnes et %d lignes\n
4 \tIl %s touche `alternative'\n
5 a une
6 n'a pas de
7 \tIl %speut utiliser les tabulations\n
8 ne
9 \tIl %s les marges automatiques\n
10 a
11 n'a pas
12 \tIl %s les marges magiques\n
13 (vide)
14 oui
15 non
16 ERREUR: ne peut pas effacer\r\n
17 DeleteChars: num est ridicule: %d\r\n
18 ERREUR: ne peut insérer\r\n
19 StartInsert: num est ridicule: %d\r\n
20 %s: Ne peut ouvrir /etc/termcap.\n
21 %s: Pas d'entrée pour le type de terminal "%s"\n
22 %s: utilise la configuration d'un terminal banal.\n
23 %s: ATTENTION: Votre terminal ne peut effectuer de déplacement vers le haut.\n
24 L'édition peut être incorrecte pour les longues lignes.\n
25 pas de capacité d'effacement jusqu'à fin de ligne.\n
26 pas de capacité d'effacement de caractère.\n
27 pas de capacité d'insertion de caractère.\n

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