Import of tcsh-6.14.00
This commit is contained in:
parent
b2d5d167ed
commit
23338178da
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/tcsh/dist/; revision=145479
@ -1,3 +1,93 @@
|
||||
76. V6.14.00 - 20050325
|
||||
75. Additional messages for the ja (Japanese) locale (NAKAMURA Takeshi)
|
||||
74. V6.13.10 - 20050321
|
||||
73. Implement --help (Tom Warzeka)
|
||||
72. Clamp solaris autologout time
|
||||
71. Add support for "limit heapsize" (Martin Kraemer)
|
||||
70. Improved autoconf for utmp/utmpx (Miloslav Trmac)
|
||||
69. V6.13.09 - 20050303
|
||||
68. Autoconf additions (Miloslav Trmac and Jean-Luc Leger)
|
||||
67. Fix erroneous sign extension when printing huge numbers (Martin Kraemer)
|
||||
66. Handle delay in termcap entries (Martin Kraemer)
|
||||
65. EBCDIC and BS2000 fixes (Martin Kraemer)
|
||||
64. Avoid the SCCS percent-S-percent sequence differently (Kimmo Suominen)
|
||||
63. Mark position update fixes (Martin Kraemer)
|
||||
62. Define BSDLIMIT and BSDTIMES for Cygwin (Corinna Vinschen)
|
||||
61. Fix NLSFrom prototype (Martin Kraemer)
|
||||
60. V6.13.08 - 20050303
|
||||
59. Add test for socklen_t in autoconf
|
||||
58. Fix problems with NLSFrom prototype
|
||||
57. Deal with AIX's utmpx lossage
|
||||
56. V6.13.07 - 20050118
|
||||
55. constifications, XXX: duplicate prototype on setpgrp().
|
||||
54. iconv fixes (Miloslav Trmac)
|
||||
53. literal code cleanups (Miloslav Trmac)
|
||||
52. move intptr_t definition to sh.h and include both stdint.h and inttypes.h
|
||||
51. Fix dup2() issues, and introduce FSAFE as the highest file descriptor
|
||||
to be left untouched. This is to avoid closing hesiod/nis etc file
|
||||
descriptors behind their backs. I need to really fix file descriptor
|
||||
handling one day.
|
||||
50. forward<->reverse char conversion verification (Miloslav Trmac)
|
||||
49. japanese locale additions (Yoshiyuki Sakakibara)
|
||||
48. wide character/utf 8 cleanups (Michael Schroeder)
|
||||
47. V6.13.06 - 20050105
|
||||
46. autoconf cleanup (Miloslav Trmac)
|
||||
45. Fix literal refresh code (Michael Schroeder)
|
||||
44. Fix history printing bug with WIDE_STRINGS
|
||||
43. V6.13.05 - 20041121
|
||||
42. deal with not having intptr_t
|
||||
41. get rid of bool.
|
||||
40. Protect HAVE_ICONV with NLS_CATALOGS
|
||||
39. Deal with wchar_t being unsigned.
|
||||
38. If we HAVEUTMPX redefine some utmp functions in terms of utmpx ones.
|
||||
37. V6.13.04 - 20041120
|
||||
36. Fix display problems with two-column characters when using WIDE_STRINGS.
|
||||
(Miloslav Trmac)
|
||||
35. Change charset declarations for some of the translations.
|
||||
(Miloslav Trmac)
|
||||
34. Set O_LARGEFILE properly (Miloslav Trmac)
|
||||
33. Use libc functions to access utmp data (Miloslav Trmac)
|
||||
32. t_pmatch() was not really case-insensitive when cs == 8
|
||||
(Miloslav Trmac)
|
||||
31. Fix escaping of "control" bytes 0x80..0x9F when they are actually
|
||||
parts of UTF-8 character representation. (Miloslav Trmac)
|
||||
30. V6.13.03 - 20041120
|
||||
29. More close_on_exec fixes (Miloslav Trmac)
|
||||
28. SUSE dspmbyte fixes (via Harald)
|
||||
27. Newline handling in command substitution controlled by csubstnonl
|
||||
(Miloslav Trmac)
|
||||
26. Fix UNC prompt expansion (WIN32) (Yasuhiro Matsumoto)
|
||||
25. Fix incorrect xprintf() usage (Miloslav Trmac)
|
||||
24. Additional architectures support for $HOSTTYPE and $MACHTYPE
|
||||
(Miloslav Trmac)
|
||||
23. Use nl_langinfo(CODESET) to determine $dspmbyte (Miloslav Trmac)
|
||||
22. Complete arguments that contant a # (Steven Grady)
|
||||
21. Set close-on-exec in subshells
|
||||
20. Compilation fixes (Miloslav Trmac)
|
||||
19. V6.13.02 - 20040804
|
||||
18. de-register, de-extern, de-shadow, and const poison.
|
||||
17. WIDE_STRINGS support (Miloslav Trmac)
|
||||
16. warning cleanups (Miloslav Trmac)
|
||||
15. nlsclose() arg passing, exp2 is now a gcc builtin (Mark Peek)
|
||||
14. iconv malloc portability fix.
|
||||
13. make automatic dspmbyte determination case insensitive
|
||||
12. V6.13.01 - 20040724
|
||||
11. bug fix in automatic dspmbyte setting (Miloslav Trmac)
|
||||
10. iconv patches (Miloslav Trmac)
|
||||
9. cygwin signal fixes; only init 32 signals, don't set bit flag on error;
|
||||
breaks SIGHUP. (Corinna Vinschen)
|
||||
8. Make sure terminal size change takes effect immediately.
|
||||
7. Obey $printexitvalue for builtins.
|
||||
6. FreeBSD PR/66420: Allow history parsing to be special so that it
|
||||
can handle inline # characters (Oliver Eikemeier)
|
||||
5. new termname builtin from (Andrew Stevenson)
|
||||
4. if ($var =~ *[^0-9]*) echo not numeric, fix (Andrew Stevenson)
|
||||
3. completion fix to avoid dup hosts from ssh_known_hosts
|
||||
(Eric D. Hendrickson)
|
||||
2. vc++ 7.1 compilation fix (Steve Schockley)
|
||||
1. UTF-8 handling for both single and double width characters, but
|
||||
no combining character support. (Michael Schroeder)
|
||||
|
||||
36. V6.13.00 - 20040519
|
||||
35. V6.12.03 - 20040322
|
||||
34. turn on kanji and dspmbyte by default; add check for utf8 locales,
|
||||
|
@ -1,5 +1,5 @@
|
||||
XCOMM
|
||||
XCOMM $Id: Imakefile,v 1.83 2003/02/08 20:03:25 christos Exp $
|
||||
XCOMM $Id: Imakefile,v 1.84 2004/12/25 21:15:05 christos Exp $
|
||||
XCOMM
|
||||
XCOMM Imakefile for tcsh 6.12
|
||||
XCOMM Marc Horowitz, MIT SIPB
|
||||
@ -41,12 +41,12 @@ ones. Please send in your fixes and additions! */
|
||||
# define ConfigH sysv4
|
||||
# endif
|
||||
|
||||
# ifdef LinuxArchitecture
|
||||
# if defined(LinuxArchitecture) || defined(GNUArchitecture)
|
||||
# define ConfigH linux
|
||||
# endif
|
||||
|
||||
# ifdef AlphaArchitecture
|
||||
# ifndef LinuxArchitecture
|
||||
# if !defined(LinuxArchitecture) && !defined(GNUArchitecture)
|
||||
# define ConfigH decosf1
|
||||
# endif
|
||||
# if !HasGcc
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.in,v 3.20 2003/03/12 19:14:50 christos Exp $
|
||||
# $Id: Makefile.in,v 3.27 2005/03/23 13:20:30 kim Exp $
|
||||
# Makefile.in 4.3 6/11/83
|
||||
#
|
||||
# C Shell with process control; VM/UNIX VAX Makefile
|
||||
@ -247,7 +247,7 @@ 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 -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Werror
|
||||
#CC= gcc -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Werror -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wsign-compare -Wcast-qual -Wreturn-type -Wswitch -Wshadow -Wwrite-strings
|
||||
#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
|
||||
@ -313,11 +313,11 @@ 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.func.c tc.nls.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \
|
||||
tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \
|
||||
tc.who.c tc.h
|
||||
TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \
|
||||
tc.disc.${SUF} tc.func.${SUF} tc.os.${SUF} tc.printf.${SUF} \
|
||||
tc.disc.${SUF} tc.func.${SUF} tc.nls.${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}
|
||||
|
||||
@ -431,8 +431,8 @@ tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h
|
||||
@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[];/' | \
|
||||
$(srcdir)/tc.const.c | \
|
||||
sed -n -e 's/^\(Char STR[a-zA-Z0-9_]*\) *\[ *\].*/extern \1[];/p' | \
|
||||
sort >> $@
|
||||
@echo '#endif /* _h_tc_const */' >> $@
|
||||
|
||||
@ -514,12 +514,15 @@ install.cygwin: install install.man
|
||||
# chmod 444 ${DESTMAN}/tcsh.${MANSECT}.Z
|
||||
|
||||
clean:
|
||||
${RM} -f a.out strings x.c xs.c tcsh$(EXEEXT) tcsh.a _MAKE_LOG core gethost
|
||||
${RM} -f a.out strings x.c xs.c tcsh$(EXEEXT) tcsh.a _MAKE_LOG 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 Makefile config.h config_p.h
|
||||
${RM} -f config.status config.cache config.log tcsh.ps
|
||||
${RM} -f missing
|
||||
${RM} -rf autom4te.cache
|
||||
${RM} -f *~ #*
|
||||
|
||||
distclean: veryclean
|
||||
@ -623,7 +626,7 @@ $(srcdir)/stamp-h.in: $(srcdir)/configure.in
|
||||
#
|
||||
config.h: config_f.h
|
||||
|
||||
TCH=tc.h tc.const.h tc.decls.h tc.os.h tc.sig.h
|
||||
TCH=tc.h tc.const.h tc.decls.h tc.nls.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
|
||||
@ -640,7 +643,7 @@ ${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}
|
||||
sh.set.${SUF} tc.func.${SUF} tc.nls.${SUF} tw.color.${SUF}
|
||||
${TWOBJS} ${TWINC}: ${TWH}
|
||||
|
||||
# glob.h
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.std,v 1.95 2002/07/23 16:13:21 christos Exp $
|
||||
# $Id: Makefile.std,v 1.96 2004/12/25 21:15:05 christos Exp $
|
||||
# Makefile.std 4.3 6/11/83
|
||||
#
|
||||
# C Shell with process control; VM/UNIX VAX Makefile
|
||||
@ -308,11 +308,11 @@ 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.func.c tc.nls.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \
|
||||
tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \
|
||||
tc.who.c tc.h
|
||||
TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \
|
||||
tc.disc.${SUF} tc.func.${SUF} tc.os.${SUF} tc.printf.${SUF} \
|
||||
tc.disc.${SUF} tc.func.${SUF} tc.nls.${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}
|
||||
|
||||
@ -597,7 +597,7 @@ $(srcdir)/stamp-h.in: $(srcdir)/configure.in
|
||||
#
|
||||
config.h: config_f.h
|
||||
|
||||
TCH=tc.h tc.const.h tc.decls.h tc.os.h tc.sig.h
|
||||
TCH=tc.h tc.const.h tc.decls.h tc.nls.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
|
||||
@ -614,7 +614,7 @@ ${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}
|
||||
sh.set.${SUF} tc.func.${SUF} tc.nls.${SUF} tw.color.${SUF}
|
||||
${TWOBJS} ${TWINC}: ${TWH}
|
||||
|
||||
# glob.h
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.vms,v 1.37 2002/07/23 16:13:21 christos Exp $
|
||||
# $Id: Makefile.vms,v 1.38 2004/12/25 21:15:05 christos Exp $
|
||||
# Makefile.vms 4.3 6/11/83
|
||||
#
|
||||
# C Shell with process control; VM/UNIX VAX Makefile
|
||||
@ -286,11 +286,11 @@ 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.func.c tc.os.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.disc.${SUF} tc.func.${SUF} tc.os.${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}
|
||||
|
||||
@ -563,7 +563,7 @@ ftp: tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z
|
||||
#
|
||||
config.h: config_f.h
|
||||
|
||||
TCH=tc.h tc.const.h tc.decls.h tc.os.h tc.sig.h
|
||||
TCH=tc.h tc.const.h tc.decls.h tc.nls.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
|
||||
@ -580,7 +580,7 @@ ${OBJS}: config.h ${SHH}
|
||||
|
||||
# TWH
|
||||
TWINC=ed.chared.${SUF} ed.inputl.${SUF} sh.exec.${SUF} sh.func.${SUF} \
|
||||
sh.set.${SUF} tc.func.${SUF}
|
||||
sh.set.${SUF} tc.func.${SUF} tc.nls.${SUF}
|
||||
${TWOBJS} ${TWINC}: ${TWH}
|
||||
|
||||
# glob.h
|
||||
|
@ -1,4 +1,4 @@
|
||||
This is tcsh version 6.12. Tcsh is a version of the Berkeley
|
||||
This is tcsh version 6.14. 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.
|
||||
@ -86,15 +86,18 @@ To install tcsh:
|
||||
passwd appears on the screen, you have lost /dev/tty. Otherwise
|
||||
everything is fine.
|
||||
|
||||
10) Once satisfied that tcsh is working correctly, complete the installation
|
||||
10) 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...
|
||||
|
||||
11) Enjoy.
|
||||
|
||||
12) PLEASE send any bug reports (and fixes), code for new features,
|
||||
comments, questions, etc. (even flames) to:
|
||||
12) PLEASE file any bug reports (and fixes), code for new features at:
|
||||
|
||||
http://bugs.gw.com/
|
||||
|
||||
Comments, questions, etc. (even flames) are welcome via email to:
|
||||
|
||||
The tcsh bugs mailing list
|
||||
tcsh-bugs@mx.gw.com
|
||||
@ -107,7 +110,7 @@ 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
|
||||
routine is tc.os.c
|
||||
|
||||
***************************************************************************
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#
|
||||
# $Id: complete.tcsh,v 1.43 2004/02/22 15:57:15 christos Exp $
|
||||
# $Id: complete.tcsh,v 1.46 2005/03/21 21:26:08 kim Exp $
|
||||
# example file using the new completion code
|
||||
#
|
||||
# Debian GNU/Linux
|
||||
# /usr/share/doc/tcsh/examples/complete.gz
|
||||
#
|
||||
# This file may be read from user's ~/.cshrc or ~/.tcsh file by
|
||||
# This file may be read from user's ~/.cshrc or ~/.tcshrc file by
|
||||
# decompressing it into the home directory as ~/.complete and
|
||||
# then adding the line "source ~/.complete" and maybe defining
|
||||
# some of the shell variables described below.
|
||||
@ -49,6 +49,7 @@ if ($?_complete) then
|
||||
endif
|
||||
if ( -r $HOME/.ssh/known_hosts ) then
|
||||
set f=`cat $HOME/.ssh/known_hosts | cut -f 1 -d \ ` >& /dev/null
|
||||
set f=`cat $HOME/.ssh/known_hosts | cut -f 1 -d \ | sed -e 's/,/ /g'` >& /dev/null
|
||||
set hosts=($hosts $f)
|
||||
endif
|
||||
unset f
|
||||
@ -94,11 +95,11 @@ if ($?_complete) then
|
||||
complete unalias n/*/a/
|
||||
complete xdvi n/*/f:*.dvi/ # Only files that match *.dvi
|
||||
complete dvips n/*/f:*.dvi/
|
||||
if ($?traditional_complete) then
|
||||
complete tex n/*/f:*.tex/ # Only files that match *.tex
|
||||
else
|
||||
complete tex n/*/f:*.{tex,texi}/ # Files that match *.tex and *.texi
|
||||
endif
|
||||
if ($?traditional_complete) then
|
||||
complete tex n/*/f:*.tex/ # Only files that match *.tex
|
||||
else
|
||||
complete tex n/*/f:*.{tex,texi}/ # Files that match *.tex and *.texi
|
||||
endif
|
||||
complete latex n/*/f:*.{tex,ltx}/
|
||||
complete su c/--/"(login fast preserve-environment command shell \
|
||||
help version)"/ c/-/"(f l m p c s -)"/ \
|
||||
@ -178,20 +179,20 @@ endif
|
||||
|
||||
complete -co* p/0/"(compress)"/ # make compress completion
|
||||
# not ambiguous
|
||||
if ($?traditional_complete) then
|
||||
complete zcat n/*/f:*.Z/
|
||||
else
|
||||
# "zcat" may be linked to "compress" or "gzip"
|
||||
if (-X zcat) then
|
||||
zcat --version >& /dev/null
|
||||
if ($status != 0) then
|
||||
complete zcat n/*/f:*.Z/
|
||||
else
|
||||
complete zcat c/--/"(force help license quiet version)"/ \
|
||||
if ($?traditional_complete) then
|
||||
complete zcat n/*/f:*.Z/
|
||||
else
|
||||
# "zcat" may be linked to "compress" or "gzip"
|
||||
if (-X zcat) then
|
||||
zcat --version >& /dev/null
|
||||
if ($status != 0) then
|
||||
complete zcat n/*/f:*.Z/
|
||||
else
|
||||
complete zcat c/--/"(force help license quiet version)"/ \
|
||||
c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
complete finger c/*@/\$hosts/ n/*/u/@
|
||||
complete ping p/1/\$hosts/
|
||||
@ -246,8 +247,9 @@ endif
|
||||
|
||||
# these from E. Jay Berkenbilt <ejb@ERA.COM>
|
||||
# = isn't always followed by a filename or a path anymore - jgotts
|
||||
if ($?traditional_complete) then
|
||||
complete ./configure 'c/--*=/f/' 'c/--{cache-file,prefix,exec-prefix,\
|
||||
if ($?traditional_complete) then
|
||||
complete ./configure \
|
||||
'c/--*=/f/' 'c/--{cache-file,prefix,exec-prefix,\
|
||||
bindir,sbindir,libexecdir,datadir,\
|
||||
sysconfdir,sharedstatedir,localstatedir,\
|
||||
libdir,includedir,oldincludedir,infodir,\
|
||||
@ -257,7 +259,7 @@ if ($?traditional_complete) then
|
||||
sharedstatedir localstatedir libdir \
|
||||
includedir oldincludedir infodir mandir \
|
||||
srcdir)//'
|
||||
else
|
||||
else
|
||||
complete ./configure \
|
||||
'c@--{prefix,exec-prefix,bindir,sbindir,libexecdir,datadir,sysconfdir,sharedstatedir,localstatedir,infodir,mandir,srcdir,x-includes,x-libraries}=*@x:<directory e.g. /usr/local>'@ \
|
||||
'c/--cachefile=*/x:<filename>/' \
|
||||
@ -269,7 +271,7 @@ else
|
||||
mandir= srcdir= x-includes= x-libraries= cachefile= \
|
||||
enable- disable- with- \
|
||||
help no-create quiet silent version verbose )//'
|
||||
endif
|
||||
endif
|
||||
complete gs 'c/-sDEVICE=/(x11 cdjmono cdj550 epson eps9high epsonc \
|
||||
dfaxhigh dfaxlow laserjet ljet4 sparc pbm \
|
||||
pbmraw pgm pgmraw ppm ppmraw bit)/' \
|
||||
@ -476,8 +478,16 @@ endif
|
||||
token-table verbose version yacc)/' \
|
||||
'c/-/(b d h k l n o p t v y V)/' 'n/-b/f/' 'n/-o/f/' \
|
||||
'n/-p/f/'
|
||||
complete bunzip2 'p/*/f:*.bz2/'
|
||||
complete bzip2 'n/-9/f:^*.bz2/' 'n/-d/f:*.bz2/'
|
||||
complete bzcat c/--/"(help test quiet verbose license version)"/ \
|
||||
c/-/"(h t L V -)"/ n/*/f:*.{bz2,tbz}/
|
||||
complete bunzip2 c/--/"(help keep force test stdout quiet verbose \
|
||||
license version)"/ c/-/"(h k f t c q v L V -)"/ \
|
||||
n/*/f:*.{bz2,tbz}/
|
||||
complete bzip2 c/--/"(help decompress compress keep force test \
|
||||
stdout quiet verbose license version small)"/ \
|
||||
c/-/"(h d z k f t c q v L V s 1 2 3 4 5 6 7 8 9 -)"/ \
|
||||
n/{-d,--decompress}/f:*.{bz2,tbz}/ \
|
||||
N/{-d,--decompress}/f:*.{bz2,tbz}/ n/*/f:^*.{bz2,tbz}/
|
||||
complete c++ 'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
|
||||
complete co 'p@1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
|
||||
complete crontab 'n/-u/u/'
|
||||
@ -591,14 +601,16 @@ endif
|
||||
n@*@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@
|
||||
complete ndc 'n/*/(status dumpdb reload stats trace notrace \
|
||||
querylog start stop restart )/'
|
||||
if ($?traditional_complete) then
|
||||
complete nm 'c/--/(debug-syms defined-only demangle dynamic \
|
||||
if ($?traditional_complete) then
|
||||
complete nm \
|
||||
'c/--/(debug-syms defined-only demangle dynamic \
|
||||
extern-only format= help line-numbers no-demangle \
|
||||
no-sort numeric-sort portability print-armap \
|
||||
print-file-name reverse-sort size-sort undefined-only \
|
||||
version)/' 'p/*/f:^*.{h,C,c,cc}/'
|
||||
else
|
||||
complete nm 'c/--radix=/x:<radix: _o_ctal _d_ecimal he_x_adecimal>/' \
|
||||
else
|
||||
complete nm \
|
||||
'c/--radix=/x:<radix: _o_ctal _d_ecimal he_x_adecimal>/' \
|
||||
'c/--target=/x:<bfdname>/' \
|
||||
'c/--format=/(bsd sysv posix)/n/' \
|
||||
'c/--/(debugsyms extern-only demangle dynamic print-armap \
|
||||
@ -607,7 +619,7 @@ endif
|
||||
format= defined-only\ line-numbers no-demangle version \
|
||||
help)//' \
|
||||
'n/*/f:^*.{h,c,cc,s,S}/'
|
||||
endif
|
||||
endif
|
||||
complete nmap 'n@-e@`ifconfig -l`@' 'p/*/$hostnames/'
|
||||
complete perldoc 'n@*@`\ls -1 /usr/libdata/perl/5.*/pod | sed s%\\.pod.\*\$%%`@'
|
||||
complete postfix 'n/*/(start stop reload abort flush check)/'
|
||||
@ -719,10 +731,10 @@ endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if ($?traditional_complete) then
|
||||
# use of $MANPATH from Dan Nicolaescu <dann@ics.uci.edu>
|
||||
# use of 'find' adapted from Lubomir Host <host8@kepler.fmph.uniba.sk>
|
||||
complete man \
|
||||
if ($?traditional_complete) then
|
||||
# use of $MANPATH from Dan Nicolaescu <dann@ics.uci.edu>
|
||||
# use of 'find' adapted from Lubomir Host <host8@kepler.fmph.uniba.sk>
|
||||
complete man \
|
||||
'n@1@`set q = "$MANPATH:as%:%/man1 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.1.\*\$%%`@'\
|
||||
'n@2@`set q = "$MANPATH:as%:%/man2 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.2.\*\$%%`@'\
|
||||
'n@3@`set q = "$MANPATH:as%:%/man3 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.3.\*\$%%`@'\
|
||||
@ -742,8 +754,8 @@ endif
|
||||
'n@-[sS]@`\ls -1 $MANPATH:as%:% % |& sed -n s%^man%%p | sort -u`@'\
|
||||
'n@*@`find $MANPATH:as%:% % \( -type f -o -type l \) -printf "%f " |& sed -e "s%find: .*: No such file or directory%%" -e "s%\([^\.]\+\)\.\([^ ]*\) %\1 %g"`@'
|
||||
#n@*@c@ # old way -- commands only
|
||||
else
|
||||
complete man n@1@'`\ls -1 /usr/man/man1 | sed s%\\.1.\*\$%%`'@ \
|
||||
else
|
||||
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.\*\$%%`'@ \
|
||||
@ -759,7 +771,7 @@ 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 P s t)"/ n/-f/c/ n/-k/x:'<keyword>'/ n/-P/d/ \
|
||||
N@-P@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n/*/c/
|
||||
endif
|
||||
endif
|
||||
|
||||
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>'/
|
||||
@ -1000,9 +1012,11 @@ n@public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \
|
||||
T v V w W X z Z 0 1 2 3 4 5 6 7 -)"/ \
|
||||
C@/dev@f@ \
|
||||
n/-c*f/x:'<new_tar_file, device_file, or "-">'/ \
|
||||
n/{-[Adrtux]j*f,--file}/f:*.{tar.bz2,tbz}/ \
|
||||
n/{-[Adrtux]z*f,--file}/f:*.{tar.gz,tgz}/ \
|
||||
n/{-[Adrtux]Z*f,--file}/f:*.{tar.Z,taz}/ \
|
||||
n/{-[Adrtux]*f,--file}/f:*.tar/ \
|
||||
N/{-xj*f,--file}/'`tar -tjf $:-1`'/ \
|
||||
N/{-xz*f,--file}/'`tar -tzf $:-1`'/ \
|
||||
N/{-xZ*f,--file}/'`tar -tZf $:-1`'/ \
|
||||
N/{-x*f,--file}/'`tar -tf $:-1`'/ \
|
||||
@ -1015,28 +1029,23 @@ n@public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \
|
||||
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`'/
|
||||
# Linux filesystems
|
||||
complete mount c/-/"(a f F h l n o r s t U v V w)"/ n/-[hV]/n/ \
|
||||
n/-o/x:'<options>'/ n/-t/x:'<vfstype>'/ \
|
||||
n/-L/x:'<label>'/ n/-U/x:'<uuid>'/ \
|
||||
n@*@'`grep -v "^#" /etc/fstab | tr -s " " " " | cut -f 2`'@
|
||||
complete umount c/-/"(a h n r t v V)"/ n/-t/x:'<vfstype>'/ \
|
||||
n/*/'`mount | cut -d " " -f 3`'/
|
||||
# Solaris 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`'/
|
||||
|
||||
# these deal with NIS (formerly YP); if it's not running you don't need 'em
|
||||
if (-X domainname) then
|
||||
@ -1097,19 +1106,19 @@ n@public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \
|
||||
endif
|
||||
|
||||
|
||||
if (! $?traditional_complete) then
|
||||
uncomplete vi
|
||||
uncomplete vim
|
||||
complete {vi,vim,gvim,nvi,elvis} n/*/f:^*.{o,a,so,sa,aux,dvi,log,fig,bbl,blg,bst,idx,ilg,ind,toc}/
|
||||
complete {ispell,spell,spellword} 'n@-d@`ls /usr/lib/ispell/*.aff | sed -e "s/\.aff//" `@' 'n/*/f:^*.{o,a,so,sa,aux,dvi,log,fig,bbl,blg,bst,idx,ilg,ind,toc}/'
|
||||
complete elm 'n/-[Ai]/f/' 'c@=@F:$HOME/Mail/@' 'n/-s/x:\<subject\>/'
|
||||
complete ncftp 'n@*@`sed -e '1,2d' $HOME/.ncftp/bookmarks | cut -f 1,2 -d "," | tr "," "\012" | sort | uniq ` '@
|
||||
complete bibtex 'n@*@`ls *.aux | sed -e "s/\.aux//"`'@
|
||||
complete dvi2tty n/*/f:*.dvi/ # Only files that match *.dvi
|
||||
if (! $?traditional_complete) then
|
||||
uncomplete vi
|
||||
uncomplete vim
|
||||
complete {vi,vim,gvim,nvi,elvis} n/*/f:^*.{o,a,so,sa,aux,dvi,log,fig,bbl,blg,bst,idx,ilg,ind,toc}/
|
||||
complete {ispell,spell,spellword} 'n@-d@`ls /usr/lib/ispell/*.aff | sed -e "s/\.aff//" `@' 'n/*/f:^*.{o,a,so,sa,aux,dvi,log,fig,bbl,blg,bst,idx,ilg,ind,toc}/'
|
||||
complete elm 'n/-[Ai]/f/' 'c@=@F:$HOME/Mail/@' 'n/-s/x:\<subject\>/'
|
||||
complete ncftp 'n@*@`sed -e '1,2d' $HOME/.ncftp/bookmarks | cut -f 1,2 -d "," | tr "," "\012" | sort | uniq ` '@
|
||||
complete bibtex 'n@*@`ls *.aux | sed -e "s/\.aux//"`'@
|
||||
complete dvi2tty n/*/f:*.dvi/ # Only files that match *.dvi
|
||||
uncomplete gv
|
||||
uncomplete ghostview
|
||||
complete {gv,ghostview} 'n/*/f:*.{ps,eps,epsi}/'
|
||||
complete enscript \
|
||||
complete {gv,ghostview} 'n/*/f:*.{ps,eps,epsi}/'
|
||||
complete enscript \
|
||||
'c/--/(columns= pages= header= no-header truncate-lines \
|
||||
line-numbers setpagedevice= escapes font= \
|
||||
header-font= fancy-header no-job-header \
|
||||
@ -1124,9 +1133,10 @@ n@public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \
|
||||
printer-options= ul-angle= ul-font= ul-gray= \
|
||||
ul-position= ul-style= \
|
||||
)/'
|
||||
endif
|
||||
endif
|
||||
|
||||
complete dpkg 'c/--{admindir,instdir,root}=/d/' \
|
||||
complete dpkg \
|
||||
'c/--{admindir,instdir,root}=/d/' \
|
||||
'c/--debug=/n/' \
|
||||
'c/--{admindir,debug,instdir,root}/(=)//' \
|
||||
'c/--/(admindir= debug= instdir= root= \
|
||||
@ -1152,12 +1162,13 @@ complete dpkg 'c/--{admindir,instdir,root}=/d/' \
|
||||
)//' \
|
||||
'n/{-l}/`dpkg -l|awk \{print\ \$2\}`/' \
|
||||
'n/*/f:*.deb'/
|
||||
complete dpkg-deb 'c/--{build}=/d/' \
|
||||
complete dpkg-deb 'c/--{build}=/d/' \
|
||||
'c/--/(build contents info field control extract \
|
||||
vextract fsys-tarfile help version \
|
||||
license)//' \
|
||||
'n/*/f:*.deb/'
|
||||
complete apt-get 'c/--/(build config-file diff-only download-only \
|
||||
complete apt-get \
|
||||
'c/--/(build config-file diff-only download-only \
|
||||
fix-broken fix-missing force-yes help ignore-hold no-download \
|
||||
no-upgrade option print-uris purge reinstall quiet simulate \
|
||||
show-upgraded target-release tar-only version yes )/' \
|
||||
@ -1167,7 +1178,7 @@ complete apt-get 'c/--/(build config-file diff-only download-only \
|
||||
'n/{install}/`apt-cache pkgnames | sort`/' \
|
||||
'C/*/(update upgrade dselect-upgrade source \
|
||||
build-dep check clean autoclean install remove)/'
|
||||
complete apt-cache \
|
||||
complete apt-cache \
|
||||
'c/--/(all-versions config-file generate full help important \
|
||||
names-only option pkg-cache quiet recurse src-cache version )/' \
|
||||
'c/-/(c= h i o= p= q s= v)/' \
|
||||
|
@ -1 +1,205 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define to the type of elements in the array set by `getgroups'. Usually
|
||||
this is either `int' or `gid_t'. */
|
||||
#undef GETGROUPS_T
|
||||
|
||||
/* Define to 1 if the `getpgrp' function requires zero arguments. */
|
||||
#undef GETPGRP_VOID
|
||||
|
||||
/* Define to 1 if you have the <auth.h> header file. */
|
||||
#undef HAVE_AUTH_H
|
||||
|
||||
/* Define to 1 if you have the declaration of `gethostname', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_GETHOSTNAME
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define to 1 if you have the `dup2' function. */
|
||||
#undef HAVE_DUP2
|
||||
|
||||
/* Define to 1 if you have the `getcwd' function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* Define to 1 if you have the `gethostname' function. */
|
||||
#undef HAVE_GETHOSTNAME
|
||||
|
||||
/* Define to 1 if you have the `getpwent' function. */
|
||||
#undef HAVE_GETPWENT
|
||||
|
||||
/* Define to 1 if you have the `getutent' function. */
|
||||
#undef HAVE_GETUTENT
|
||||
|
||||
/* Define to 1 if you have the iconv () interface */
|
||||
#undef HAVE_ICONV
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if the system has the type `long long'. */
|
||||
#undef HAVE_LONG_LONG
|
||||
|
||||
/* Define to 1 if you have the `memmove' function. */
|
||||
#undef HAVE_MEMMOVE
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the `nice' function. */
|
||||
#undef HAVE_NICE
|
||||
|
||||
/* Define to 1 if you have the `nl_langinfo' function. */
|
||||
#undef HAVE_NL_LANGINFO
|
||||
|
||||
/* Define to 1 if you have the `sbrk' function. */
|
||||
#undef HAVE_SBRK
|
||||
|
||||
/* Define to 1 if you have the `setpgid' function. */
|
||||
#undef HAVE_SETPGID
|
||||
|
||||
/* Define to 1 if you have the `setpriority' function. */
|
||||
#undef HAVE_SETPRIORITY
|
||||
|
||||
/* Define to 1 if you have the <shadow.h> header file. */
|
||||
#undef HAVE_SHADOW_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strstr' function. */
|
||||
#undef HAVE_STRSTR
|
||||
|
||||
/* Define to 1 if `d_ino' is member of `struct dirent'. */
|
||||
#undef HAVE_STRUCT_DIRENT_D_INO
|
||||
|
||||
/* Define to 1 if `ss_family' is member of `struct sockaddr_storage'. */
|
||||
#undef HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
|
||||
|
||||
/* Define to 1 if `ut_host' is member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_HOST
|
||||
|
||||
/* Define to 1 if `ut_tv' is member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_TV
|
||||
|
||||
/* Define to 1 if `ut_user' is member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_USER
|
||||
|
||||
/* Define to 1 if `ut_xtime' is member of `struct utmp'. */
|
||||
#undef HAVE_STRUCT_UTMP_UT_XTIME
|
||||
|
||||
/* Define to 1 if you have the `sysconf' function. */
|
||||
#undef HAVE_SYSCONF
|
||||
|
||||
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the <utmpx.h> header file. */
|
||||
#undef HAVE_UTMPX_H
|
||||
|
||||
/* Define to 1 if you have the <utmp.h> header file. */
|
||||
#undef HAVE_UTMP_H
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#undef HAVE_WCHAR_H
|
||||
|
||||
/* Define to 1 if you have the <wctype.h> header file. */
|
||||
#undef HAVE_WCTYPE_H
|
||||
|
||||
/* Define to 1 if you have the `wcwidth' function. */
|
||||
#undef HAVE_WCWIDTH
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if the C compiler supports function prototypes. */
|
||||
#undef PROTOTYPES
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define to 1 if the `setpgrp' function takes no argument. */
|
||||
#undef SETPGRP_VOID
|
||||
|
||||
/* The size of a `wchar_t', as computed by sizeof. */
|
||||
#undef SIZEOF_WCHAR_T
|
||||
|
||||
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
|
||||
#undef STAT_MACROS_BROKEN
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define like PROTOTYPES; this can be used by system headers. */
|
||||
#undef __PROTOTYPES
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef gid_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef mode_t
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* Define to `int' if neither <sys/types.h> nor <sys/socket.h> define. */
|
||||
#undef socklen_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef uid_t
|
||||
|
||||
/* Define to empty if the keyword `volatile' does not work. Warning: valid
|
||||
code using `volatile' can become incorrect without. Disable with care. */
|
||||
#undef volatile
|
||||
|
||||
#include "config_p.h"
|
||||
#include "config_f.h"
|
||||
|
@ -65,12 +65,6 @@
|
||||
*/
|
||||
#define BSDLIMIT
|
||||
|
||||
/*
|
||||
* BSDNICE Your system uses setpriority() instead of nice, to
|
||||
* change a processes scheduling priority
|
||||
*/
|
||||
#define BSDNICE
|
||||
|
||||
/*
|
||||
* TERMIO You have struct termio instead of struct sgttyb.
|
||||
* This is usually the case for SYSV systems, where
|
||||
@ -94,44 +88,13 @@
|
||||
*/
|
||||
#undef YPBUGS
|
||||
|
||||
/*
|
||||
* SIGVOID Define this if your signal handlers return void. On older
|
||||
* systems, signal returns int, but on newer ones, it returns void.
|
||||
*/
|
||||
#define SIGVOID
|
||||
|
||||
/*
|
||||
* HAVEDUP2 Define this if your system supports dup2().
|
||||
*/
|
||||
#define HAVEDUP2
|
||||
|
||||
/*
|
||||
* UTHOST Does the utmp file have a host field?
|
||||
*/
|
||||
#define UTHOST
|
||||
|
||||
/*
|
||||
* DIRENT Your system has <dirent.h> instead of <sys/dir.h>
|
||||
*/
|
||||
#define DIRENT
|
||||
/****************** local defines *********************/
|
||||
/****************** configurable hacks ****************/
|
||||
|
||||
/* have been moved to config_f.h */
|
||||
#include "config_f.h"
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#define NLS_BUGS
|
||||
#define BSD_STYLE_COLORLS
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#include <sys/param.h>
|
||||
#if __NetBSD_Version__ >= 106030000 /* NetBSD 1.6C */
|
||||
#define HAVEUTMPX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__bsdi__)
|
||||
/*
|
||||
* _PATH_TCSHELL if you've change the installation location (vix)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/config_f.h,v 3.26 2004/03/21 16:48:14 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/config_f.h,v 3.32 2005/03/04 13:46:04 christos Exp $ */
|
||||
/*
|
||||
* config_f.h -- configure various defines for tcsh
|
||||
*
|
||||
@ -39,13 +39,21 @@
|
||||
#define _h_config_f
|
||||
|
||||
/*
|
||||
* SHORT_STRINGS Use 16 bit characters instead of 8 bit chars
|
||||
* SHORT_STRINGS Use at least 16 bit characters instead of 8 bit chars
|
||||
* This fixes up quoting problems and eases implementation
|
||||
* of nls...
|
||||
*
|
||||
*/
|
||||
#define SHORT_STRINGS
|
||||
|
||||
/*
|
||||
* WIDE_STRINGS Represent strings using wide characters
|
||||
* Allows proper function in multibyte encodings like UTF-8
|
||||
*/
|
||||
#if defined (SHORT_STRINGS) && SIZEOF_WCHAR_T >= 4 && !defined (WINNT_NATIVE) && !defined(_OSD_POSIX)
|
||||
# define WIDE_STRINGS
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NLS: Use Native Language System
|
||||
* Routines like setlocale() are needed
|
||||
@ -110,7 +118,7 @@
|
||||
|
||||
/*
|
||||
* KANJI Ignore meta-next, and the ISO character set. Should
|
||||
* be used with SHORT_STRINGS
|
||||
* be used with SHORT_STRINGS (or WIDE_STRINGS)
|
||||
*
|
||||
*/
|
||||
#define KANJI
|
||||
@ -120,7 +128,9 @@
|
||||
* only output, when "dspmbyte" is set. Should be used with
|
||||
* KANJI
|
||||
*/
|
||||
#define DSPMBYTE
|
||||
#if defined (SHORT_STRINGS) && !defined (WIDE_STRINGS)
|
||||
# define DSPMBYTE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MBYTEDEBUG when "dspmbyte" is changed, set multi-byte checktable to
|
||||
@ -191,4 +201,31 @@
|
||||
# define RCSID(id) /* Nothing */
|
||||
#endif /* !lint && !SABER */
|
||||
|
||||
/* Consistency checks */
|
||||
#ifdef WIDE_STRINGS
|
||||
# if SIZEOF_WCHAR_T < 4
|
||||
#error "wchar_t must be at least 4 bytes for WIDE_STRINGS"
|
||||
# endif
|
||||
|
||||
# ifdef WINNT_NATIVE
|
||||
#error "WIDE_STRINGS cannot be used together with WINNT_NATIVE"
|
||||
# endif
|
||||
|
||||
# ifndef SHORT_STRINGS
|
||||
#error "SHORT_STRINGS must be defined if WIDE_STRINGS is defined"
|
||||
# endif
|
||||
|
||||
# ifndef NLS
|
||||
#error "NLS must be defined if WIDE_STRINGS is defined"
|
||||
# endif
|
||||
|
||||
# ifdef DSPMBYTE
|
||||
#error "DSPMBYTE must not be defined if WIDE_STRINGS is defined"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined (SHORT_STRINGS) && defined (DSPMBYTE)
|
||||
#error "SHORT_STRINGS must be defined if DSPMBYTE is defined"
|
||||
#endif
|
||||
|
||||
#endif /* _h_config_f */
|
||||
|
4552
contrib/tcsh/configure
vendored
4552
contrib/tcsh/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -8,13 +8,13 @@ dnl
|
||||
dnl Written by Kaveh Ghazi (ghazi@caip.rutgers.edu) 5/11/96.
|
||||
dnl
|
||||
|
||||
AC_PREREQ(2.13)dnl Minimum Autoconf version required.
|
||||
AC_INIT(tc.vers.c)
|
||||
AC_PREREQ([2.59])dnl Minimum Autoconf version required.
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([tc.vers.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
dnl We don't use AC_VALIDATE_CACHED_SYSTEM_TUPLE here because we only
|
||||
dnl care about the HOST value, not the HOST/BUILD/TARGET triplet.
|
||||
AC_MSG_CHECKING([cached host tuple])
|
||||
if { test x"${ac_cv_host_system_type+set}" = x"set" &&
|
||||
test x"$ac_cv_host_system_type" != x"$host"; }; then
|
||||
@ -78,7 +78,7 @@ case "${host}" in
|
||||
;;
|
||||
|
||||
## Linux
|
||||
*-*-linux* )
|
||||
*-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu)
|
||||
tcsh_config_file=linux
|
||||
;;
|
||||
|
||||
@ -198,7 +198,7 @@ case "${host}" in
|
||||
;;
|
||||
|
||||
## Siemens BS2000 Mainframe
|
||||
bs2000-siemens-posix)
|
||||
bs2000-siemens-*)
|
||||
tcsh_config_file=bs2000
|
||||
;;
|
||||
|
||||
@ -212,7 +212,7 @@ case "${host}" in
|
||||
tcsh_config_file=cray
|
||||
;;
|
||||
|
||||
## Cygnus GNU Win32
|
||||
## Red Hat Cygwin
|
||||
*-cygwin)
|
||||
tcsh_config_file=cygwin32
|
||||
;;
|
||||
@ -230,8 +230,8 @@ case "${host}" in
|
||||
* )
|
||||
changequote([, ])dnl
|
||||
AC_MSG_ERROR([Tcsh can't guess the configuration file name
|
||||
for \`${host}' systems.
|
||||
Check tcsh's \`Ported' file for manual configuration instructions.])
|
||||
for `${host}' systems.
|
||||
Check tcsh's `Ported' file for manual configuration instructions.])
|
||||
changequote(, )dnl
|
||||
;;
|
||||
|
||||
@ -239,32 +239,101 @@ esac
|
||||
|
||||
echo "Tcsh will use configuration file \`$tcsh_config_file'."
|
||||
changequote([, ])dnl
|
||||
cp ${srcdir}/config/${tcsh_config_file} config_p.h
|
||||
AH_BOTTOM(
|
||||
[#include "config_p.h"
|
||||
#include "config_f.h"])
|
||||
|
||||
AC_CONFIG_HEADER(config.h:config/${tcsh_config_file}:config.h.in)
|
||||
dnl Checks for programs
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
|
||||
if test $ac_cv_prog_gcc = no ; then
|
||||
if test "x$GCC" != xyes ; then
|
||||
DFLAGS="$DFLAGS $NON_GNU_DFLAGS"
|
||||
CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
|
||||
fi
|
||||
|
||||
case "${host}" in
|
||||
## Cygnus GNU Win32
|
||||
*-cygwin)
|
||||
CFLAGS="$CFLAGS -mno-win32"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Checks for libraries
|
||||
AC_SEARCH_LIBS(crypt, crypt)
|
||||
AC_SEARCH_LIBS(tgetent, termlib curses termcap)
|
||||
AC_SEARCH_LIBS(getspnam, sec)
|
||||
AC_SEARCH_LIBS(tgetent, termlib termcap curses ncurses)
|
||||
AC_SEARCH_LIBS(gethostbyname, nsl)
|
||||
AC_SEARCH_LIBS(connect, socket)
|
||||
AC_SEARCH_LIBS([iconv], [iconv], [AC_DEFINE([HAVE_ICONV], [1],
|
||||
[Define to 1 if you have the iconv () interface])])
|
||||
|
||||
dnl Checks for header files
|
||||
AC_CHECK_HEADERS([auth.h inttypes.h shadow.h stdint.h])
|
||||
AC_CHECK_HEADERS([utmpx.h utmp.h])
|
||||
AC_CHECK_HEADERS([wchar.h],
|
||||
[AC_CHECK_SIZEOF([wchar_t], [], [dnl
|
||||
#include <stdio.h>
|
||||
#include <wchar.h>])
|
||||
AC_CHECK_HEADERS([wctype.h])])
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STAT
|
||||
AC_HEADER_STDC
|
||||
|
||||
dnl Checks for types
|
||||
AC_CHECK_TYPES([long long])
|
||||
AC_TYPE_GETGROUPS
|
||||
AC_TYPE_MODE_T
|
||||
AC_TYPE_SIGNAL
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_UID_T
|
||||
|
||||
AC_DEFUN([AC_TYPE_SOCKLEN_T], [
|
||||
AC_CHECK_TYPE(socklen_t,,
|
||||
AC_DEFINE(socklen_t, int, [Define to `int' if neither <sys/types.h> nor <sys/socket.h> define.]),
|
||||
[
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
])
|
||||
])
|
||||
AC_TYPE_SOCKLEN_T
|
||||
|
||||
|
||||
dnl Checks for structures
|
||||
AC_CHECK_MEMBERS([struct dirent.d_ino], , ,
|
||||
[#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
#else
|
||||
# ifdef HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# else
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# define dirent direct
|
||||
#endif])
|
||||
AC_CHECK_MEMBERS([struct utmp.ut_host, struct utmp.ut_user, struct utmp.ut_tv,
|
||||
struct utmp.ut_xtime], , ,
|
||||
[#ifdef HAVE_UTMPX_H
|
||||
#include <utmpx.h>
|
||||
#define utmp utmpx
|
||||
#elif defined HAVE_UTMP_H
|
||||
#include <utmp.h>
|
||||
#endif])
|
||||
AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], , ,
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>])
|
||||
|
||||
dnl Checks for compiler characteristics
|
||||
AC_C_CONST
|
||||
AC_C_PROTOTYPES
|
||||
AC_C_VOLATILE
|
||||
|
||||
dnl checks for library functions
|
||||
AC_CHECK_DECLS([gethostname])
|
||||
AC_CHECK_FUNCS([dup2 getcwd gethostname getpwent getutent memmove memset] dnl
|
||||
[nice nl_langinfo sbrk setpgid setpriority strerror strstr sysconf] dnl
|
||||
[wcwidth])
|
||||
AC_FUNC_GETPGRP
|
||||
AC_FUNC_SETPGRP
|
||||
|
||||
dnl This is not good enough; we need sockaddr_storage too.
|
||||
dnl See whether we can use IPv6 related functions
|
||||
dnl AC_DEFUN(IPv6_CHECK_FUNC, [
|
||||
dnl AC_DEFUN([IPv6_CHECK_FUNC], [
|
||||
dnl changequote(, )dnl
|
||||
dnl ac_tr_lib=HAVE_`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
|
||||
dnl -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
|
||||
@ -308,15 +377,6 @@ dnl ifelse([$3], , :, [$3])
|
||||
dnl fi])
|
||||
dnl IPv6_CHECK_FUNC(getnameinfo, DFLAGS="$DFLAGS -DINET6")
|
||||
|
||||
AC_CACHE_CHECK([ss_family in sockaddr_storage], ac_cv_ss_family,
|
||||
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>], [struct sockaddr_storage ss; ss.ss_family;],
|
||||
ac_cv_ss_family=yes, ac_cv_ss_family=no)]
|
||||
if test "$ac_cv_ss_family" = no; then
|
||||
DFLAGS="$DFLAGS -DNO_SS_FAMILY"
|
||||
fi
|
||||
)
|
||||
|
||||
AC_SUBST(DFLAGS)
|
||||
|
||||
AC_ARG_WITH(hesiod,
|
||||
@ -335,6 +395,5 @@ fi
|
||||
AC_SUBST(HESDEF)
|
||||
AC_SUBST(HESLIB)
|
||||
|
||||
AC_EXEEXT
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/ed.decls.h,v 3.31 2002/03/08 17:36:45 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/ed.decls.h,v 3.39 2005/01/18 20:24:50 christos Exp $ */
|
||||
/*
|
||||
* ed.decls.h: Editor external definitions
|
||||
*/
|
||||
@ -45,7 +45,7 @@ extern void SetKillRing __P((int));
|
||||
*/
|
||||
#ifdef SIG_WINDOW
|
||||
extern void check_window_size __P((int));
|
||||
extern sigret_t window_change __P((int));
|
||||
extern RETSIGTYPE window_change __P((int));
|
||||
#endif /* SIG_WINDOW */
|
||||
extern int ed_Setup __P((int));
|
||||
extern void ed_Init __P((void));
|
||||
@ -78,7 +78,7 @@ extern void tty_setdisc __P((int, int));
|
||||
* ed.screen.c
|
||||
*/
|
||||
extern void terminit __P((void));
|
||||
extern void SetAttributes __P((int));
|
||||
extern void SetAttributes __P((Char));
|
||||
extern void so_write __P((Char *, int));
|
||||
extern void ClearScreen __P((void));
|
||||
extern void MoveToLine __P((int));
|
||||
@ -86,7 +86,7 @@ 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 TellTC __P((void));
|
||||
extern void SetTC __P((char *, char *));
|
||||
extern void EchoTC __P((Char **));
|
||||
extern int SetArrowKeys __P((CStr *, XmapVal *, int));
|
||||
@ -117,133 +117,134 @@ 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));
|
||||
extern CCRETVAL e_unassigned __P((Char));
|
||||
extern CCRETVAL e_insert __P((Char));
|
||||
extern CCRETVAL e_newline __P((Char));
|
||||
extern CCRETVAL e_delprev __P((Char));
|
||||
extern CCRETVAL e_delnext __P((Char));
|
||||
/* 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));
|
||||
extern CCRETVAL e_delnext_eof __P((Char));
|
||||
extern CCRETVAL e_delnext_list __P((Char));
|
||||
extern CCRETVAL e_delnext_list_eof __P((Char)); /* for ^D */
|
||||
extern CCRETVAL e_toend __P((Char));
|
||||
extern CCRETVAL e_tobeg __P((Char));
|
||||
extern CCRETVAL e_charback __P((Char));
|
||||
extern CCRETVAL e_charfwd __P((Char));
|
||||
extern CCRETVAL e_quote __P((Char));
|
||||
extern CCRETVAL e_startover __P((Char));
|
||||
extern CCRETVAL e_redisp __P((Char));
|
||||
extern CCRETVAL e_wordback __P((Char));
|
||||
extern CCRETVAL e_wordfwd __P((Char));
|
||||
extern CCRETVAL v_wordbegnext __P((Char));
|
||||
extern CCRETVAL e_uppercase __P((Char));
|
||||
extern CCRETVAL e_lowercase __P((Char));
|
||||
extern CCRETVAL e_capitolcase __P((Char));
|
||||
extern CCRETVAL e_cleardisp __P((Char));
|
||||
extern CCRETVAL e_complete __P((Char));
|
||||
extern CCRETVAL e_correct __P((Char));
|
||||
extern CCRETVAL e_correctl __P((Char));
|
||||
extern CCRETVAL e_up_hist __P((Char));
|
||||
extern CCRETVAL e_down_hist __P((Char));
|
||||
extern CCRETVAL e_up_search_hist __P((Char));
|
||||
extern CCRETVAL e_down_search_hist __P((Char));
|
||||
extern CCRETVAL e_helpme __P((Char));
|
||||
extern CCRETVAL e_list_choices __P((Char));
|
||||
extern CCRETVAL e_delwordprev __P((Char));
|
||||
extern CCRETVAL e_delwordnext __P((Char));
|
||||
extern CCRETVAL e_digit __P((Char));
|
||||
extern CCRETVAL e_argdigit __P((Char));
|
||||
extern CCRETVAL v_zero __P((Char));
|
||||
extern CCRETVAL e_killend __P((Char));
|
||||
extern CCRETVAL e_killbeg __P((Char));
|
||||
extern CCRETVAL e_metanext __P((Char));
|
||||
#ifdef notdef
|
||||
extern CCRETVAL e_extendnext __P((int));
|
||||
extern CCRETVAL e_extendnext __P((Char));
|
||||
#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));
|
||||
extern CCRETVAL e_page_up __P((int));
|
||||
extern CCRETVAL e_page_down __P((int));
|
||||
extern CCRETVAL e_yank_pop __P((int));
|
||||
extern CCRETVAL e_send_eof __P((Char));
|
||||
extern CCRETVAL e_charswitch __P((Char));
|
||||
extern CCRETVAL e_gcharswitch __P((Char));
|
||||
extern CCRETVAL e_which __P((Char));
|
||||
extern CCRETVAL e_yank_kill __P((Char));
|
||||
extern CCRETVAL e_tty_dsusp __P((Char));
|
||||
extern CCRETVAL e_tty_flusho __P((Char));
|
||||
extern CCRETVAL e_tty_quit __P((Char));
|
||||
extern CCRETVAL e_tty_tsusp __P((Char));
|
||||
extern CCRETVAL e_tty_stopo __P((Char));
|
||||
extern CCRETVAL e_tty_starto __P((Char));
|
||||
extern CCRETVAL e_argfour __P((Char));
|
||||
extern CCRETVAL e_set_mark __P((Char));
|
||||
extern CCRETVAL e_exchange_mark __P((Char));
|
||||
extern CCRETVAL e_last_item __P((Char));
|
||||
extern CCRETVAL v_cmd_mode __P((Char));
|
||||
extern CCRETVAL v_insert __P((Char));
|
||||
extern CCRETVAL v_replmode __P((Char));
|
||||
extern CCRETVAL v_replone __P((Char));
|
||||
extern CCRETVAL v_substline __P((Char));
|
||||
extern CCRETVAL v_substchar __P((Char));
|
||||
extern CCRETVAL v_add __P((Char));
|
||||
extern CCRETVAL v_addend __P((Char));
|
||||
extern CCRETVAL v_insbeg __P((Char));
|
||||
extern CCRETVAL v_chgtoend __P((Char));
|
||||
extern CCRETVAL e_killregion __P((Char));
|
||||
extern CCRETVAL e_killall __P((Char));
|
||||
extern CCRETVAL e_copyregion __P((Char));
|
||||
extern CCRETVAL e_tty_int __P((Char));
|
||||
extern CCRETVAL e_run_fg_editor __P((Char));
|
||||
extern CCRETVAL e_list_eof __P((Char));
|
||||
extern CCRETVAL e_expand_history __P((Char));
|
||||
extern CCRETVAL e_magic_space __P((Char));
|
||||
extern CCRETVAL e_list_glob __P((Char));
|
||||
extern CCRETVAL e_expand_glob __P((Char));
|
||||
extern CCRETVAL e_insovr __P((Char));
|
||||
extern CCRETVAL v_cm_complete __P((Char));
|
||||
extern CCRETVAL e_copyprev __P((Char));
|
||||
extern CCRETVAL v_change_case __P((Char));
|
||||
extern CCRETVAL e_expand __P((Char));
|
||||
extern CCRETVAL e_expand_vars __P((Char));
|
||||
extern CCRETVAL e_toggle_hist __P((Char));
|
||||
extern CCRETVAL e_load_average __P((Char));
|
||||
extern CCRETVAL v_delprev __P((Char));
|
||||
extern CCRETVAL v_delmeta __P((Char));
|
||||
extern CCRETVAL v_wordfwd __P((Char));
|
||||
extern CCRETVAL v_wordback __P((Char));
|
||||
extern CCRETVAL v_endword __P((Char));
|
||||
extern CCRETVAL v_eword __P((Char));
|
||||
extern CCRETVAL v_undo __P((Char));
|
||||
extern CCRETVAL v_ush_meta __P((Char));
|
||||
extern CCRETVAL v_dsh_meta __P((Char));
|
||||
extern CCRETVAL v_rsrch_fwd __P((Char));
|
||||
extern CCRETVAL v_rsrch_back __P((Char));
|
||||
extern CCRETVAL v_char_fwd __P((Char));
|
||||
extern CCRETVAL v_char_back __P((Char));
|
||||
extern CCRETVAL v_chgmeta __P((Char));
|
||||
extern CCRETVAL e_inc_fwd __P((Char));
|
||||
extern CCRETVAL e_inc_back __P((Char));
|
||||
extern CCRETVAL v_rchar_fwd __P((Char));
|
||||
extern CCRETVAL v_rchar_back __P((Char));
|
||||
extern CCRETVAL v_charto_fwd __P((Char));
|
||||
extern CCRETVAL v_charto_back __P((Char));
|
||||
extern CCRETVAL e_normalize_path __P((Char));
|
||||
extern CCRETVAL e_normalize_command __P((Char));
|
||||
extern CCRETVAL e_stuff_char __P((Char));
|
||||
extern CCRETVAL e_list_all __P((Char));
|
||||
extern CCRETVAL e_complete_all __P((Char));
|
||||
extern CCRETVAL e_complete_fwd __P((Char));
|
||||
extern CCRETVAL e_complete_back __P((Char));
|
||||
extern CCRETVAL e_dabbrev_expand __P((Char));
|
||||
extern CCRETVAL e_copy_to_clipboard __P((Char));
|
||||
extern CCRETVAL e_paste_from_clipboard __P((Char));
|
||||
extern CCRETVAL e_dosify_next __P((Char));
|
||||
extern CCRETVAL e_dosify_prev __P((Char));
|
||||
extern CCRETVAL e_page_up __P((Char));
|
||||
extern CCRETVAL e_page_down __P((Char));
|
||||
extern CCRETVAL e_yank_pop __P((Char));
|
||||
|
||||
/*
|
||||
* ed.inputl.c
|
||||
*/
|
||||
extern int Inputl __P((void));
|
||||
extern int GetNextChar __P((Char *));
|
||||
extern void UngetNextChar __P((Char));
|
||||
extern void PushMacro __P((Char *));
|
||||
|
||||
/*
|
||||
@ -253,7 +254,7 @@ 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 RefPlusOne __P((int));
|
||||
extern void PastBottom __P((void));
|
||||
|
||||
/*
|
||||
@ -268,7 +269,7 @@ 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 eChar parseescape __P((const Char **));
|
||||
extern unsigned char *unparsestring __P((CStr *, unsigned char *, Char *));
|
||||
|
||||
#endif /* _h_ed_decls */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/ed.defns.c,v 3.39 2002/03/08 17:36:45 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/ed.defns.c,v 3.42 2005/03/03 16:49:15 kim Exp $ */
|
||||
/*
|
||||
* ed.defns.c: Editor function definitions and initialization
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: ed.defns.c,v 3.39 2002/03/08 17:36:45 christos Exp $")
|
||||
RCSID("$Id: ed.defns.c,v 3.42 2005/03/03 16:49:15 kim Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
|
||||
@ -1812,22 +1812,22 @@ CheckMaps()
|
||||
|
||||
#endif
|
||||
|
||||
bool MapsAreInited = 0;
|
||||
bool NLSMapsAreInited = 0;
|
||||
bool NoNLSRebind;
|
||||
int MapsAreInited = 0;
|
||||
int NLSMapsAreInited = 0;
|
||||
int NoNLSRebind;
|
||||
|
||||
void
|
||||
ed_InitNLSMaps()
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (AsciiOnly)
|
||||
return;
|
||||
if (NoNLSRebind)
|
||||
return;
|
||||
for (i = 0200; i <= 0377; i++) {
|
||||
if (Isprint(i)) {
|
||||
CcKeyMap[i] = F_INSERT;
|
||||
if (Isprint(CTL_ESC(i))) {
|
||||
CcKeyMap[CTL_ESC(i)] = F_INSERT;
|
||||
}
|
||||
}
|
||||
NLSMapsAreInited = 1;
|
||||
@ -1842,13 +1842,13 @@ ed_InitMetaBindings()
|
||||
KEYCMD *map;
|
||||
|
||||
map = CcKeyMap;
|
||||
for (i = 0; i <= 0377 && CcKeyMap[i] != F_METANEXT; i++)
|
||||
for (i = 0; i <= 0377 && CcKeyMap[CTL_ESC(i)] != F_METANEXT; i++)
|
||||
continue;
|
||||
if (i > 0377) {
|
||||
for (i = 0; i <= 0377 && CcAltMap[i] != F_METANEXT; i++)
|
||||
for (i = 0; i <= 0377 && CcAltMap[CTL_ESC(i)] != F_METANEXT; i++)
|
||||
continue;
|
||||
if (i > 0377) {
|
||||
i = CTL_ESC('\033');
|
||||
i = '\033';
|
||||
if (VImode)
|
||||
map = CcAltMap;
|
||||
}
|
||||
@ -1856,18 +1856,14 @@ ed_InitMetaBindings()
|
||||
map = CcAltMap;
|
||||
}
|
||||
}
|
||||
buf[0] = (Char) i;
|
||||
buf[0] = (Char)CTL_ESC(i);
|
||||
buf[2] = 0;
|
||||
cstr.buf = buf;
|
||||
cstr.len = 2;
|
||||
for (i = 0200; i <= 0377; i++) {
|
||||
if (map[i] != F_INSERT && map[i] != F_UNASSIGNED && map[i] != F_XKEY) {
|
||||
#ifdef IS_ASCII
|
||||
buf[1] = i & ASCII;
|
||||
#else
|
||||
buf[1] = _toebcdic[_toascii[i] & ASCII];
|
||||
#endif
|
||||
AddXkey(&cstr, XmapCmd((int) map[i]), XK_CMD);
|
||||
if (map[CTL_ESC(i)] != F_INSERT && map[CTL_ESC(i)] != F_UNASSIGNED && map[CTL_ESC(i)] != F_XKEY) {
|
||||
buf[1] = CTL_ESC(i & ASCII);
|
||||
AddXkey(&cstr, XmapCmd((int) map[CTL_ESC(i)]), XK_CMD);
|
||||
}
|
||||
}
|
||||
map[buf[0]] = F_XKEY;
|
||||
@ -1876,7 +1872,7 @@ ed_InitMetaBindings()
|
||||
void
|
||||
ed_InitVIMaps()
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
VImode = 1;
|
||||
ResetXmap();
|
||||
@ -1948,7 +1944,7 @@ ed_InitMaps()
|
||||
{
|
||||
KEYCMD temp[NT_NUM_KEYS];
|
||||
static KEYCMD *const list[3] = { CcEmacsMap, CcViMap, CcViCmdMap };
|
||||
register int i, table;
|
||||
int i, table;
|
||||
|
||||
for (table=0; table<3; ++table)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/ed.h,v 3.33 2002/07/06 22:28:13 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/ed.h,v 3.44 2005/03/05 03:20:15 christos Exp $ */
|
||||
/*
|
||||
* ed.h: Editor declarations and globals
|
||||
*/
|
||||
@ -54,12 +54,12 @@
|
||||
#define KEYCMD unsigned char /* size needed to index into CcFuncTbl */
|
||||
/* Must be unsigned */
|
||||
|
||||
typedef CCRETVAL(*PFCmd) __P((int)); /* pointer to function returning CCRETVAL */
|
||||
typedef CCRETVAL(*PFCmd) __P((Char)); /* pointer to function returning CCRETVAL */
|
||||
|
||||
struct KeyFuncs { /* for the "bind" shell command */
|
||||
char *name; /* function name for bind command */
|
||||
const char *name; /* function name for bind command */
|
||||
int func; /* function numeric value */
|
||||
char *desc; /* description of function */
|
||||
const char *desc; /* description of function */
|
||||
};
|
||||
|
||||
extern PFCmd CcFuncTbl[]; /* table of available commands */
|
||||
@ -149,21 +149,28 @@ 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 */
|
||||
extern int Tty_raw_mode;
|
||||
|
||||
/*
|
||||
* These are truly extern
|
||||
*/
|
||||
extern int MacroLvl;
|
||||
extern Char *litptr; /* Entries start at offsets divisible by LIT_FACTOR */
|
||||
#define LIT_FACTOR 4
|
||||
extern int didsetty;
|
||||
|
||||
EXTERN Char *KeyMacro[MAXMACROLEVELS];
|
||||
|
||||
/* CHAR_DBWIDTH in Display and Vdisplay means the non-first column of a character
|
||||
that is wider than one "regular" position. The cursor should never point
|
||||
in the middle of a multiple-column character. */
|
||||
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 */
|
||||
EXTERN Char **Vdisplay; /* new buffer */
|
||||
|
||||
/* Variables that describe terminal ability */
|
||||
EXTERN int T_Lines, T_Cols; /* Rows and Cols of the terminal */
|
||||
@ -207,13 +214,35 @@ EXTERN Char T_HasMeta; /* true if we have a meta key */
|
||||
# define M_NN 3
|
||||
#endif /* TERMIO */
|
||||
typedef struct {
|
||||
char *t_name;
|
||||
int t_setmask;
|
||||
int t_clrmask;
|
||||
const char *t_name;
|
||||
unsigned int t_setmask;
|
||||
unsigned int t_clrmask;
|
||||
} ttyperm_t[NN_IO][M_NN];
|
||||
|
||||
extern ttyperm_t ttylist;
|
||||
#include "ed.term.h"
|
||||
#include "ed.decls.h"
|
||||
|
||||
#ifndef POSIX
|
||||
/*
|
||||
* We don't prototype these, cause some systems have them wrong!
|
||||
*/
|
||||
extern int tgetent __P(());
|
||||
extern char *tgetstr __P(());
|
||||
extern int tgetflag __P(());
|
||||
extern int tgetnum __P(());
|
||||
extern char *tgoto __P(());
|
||||
# define PUTPURE putpure
|
||||
# define PUTRAW putraw
|
||||
#else
|
||||
extern int tgetent __P((char *, const char *));
|
||||
extern char *tgetstr __P((const char *, char **));
|
||||
extern int tgetflag __P((const char *));
|
||||
extern int tgetnum __P((const char *));
|
||||
extern char *tgoto __P((const char *, int, int));
|
||||
extern void tputs __P((const char *, int, void (*)(int)));
|
||||
# define PUTPURE ((void (*)__P((int))) putpure)
|
||||
# define PUTRAW ((void (*)__P((int))) putraw)
|
||||
#endif
|
||||
|
||||
#endif /* _h_ed */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/ed.init.c,v 3.48 2002/07/06 22:28:13 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/ed.init.c,v 3.52 2005/01/18 20:24:50 christos Exp $ */
|
||||
/*
|
||||
* ed.init.c: Editor initializations
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: ed.init.c,v 3.48 2002/07/06 22:28:13 christos Exp $")
|
||||
RCSID("$Id: ed.init.c,v 3.52 2005/01/18 20:24:50 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
#include "tc.h"
|
||||
@ -50,12 +50,11 @@ static unsigned char vdisable; /* The value of _POSIX_VDISABLE from
|
||||
|
||||
int Tty_eight_bit = -1; /* does the tty handle eight bits */
|
||||
|
||||
extern bool GotTermCaps;
|
||||
extern int GotTermCaps;
|
||||
|
||||
static ttydata_t extty, edtty, tstty;
|
||||
#define qutty tstty
|
||||
|
||||
extern int insource;
|
||||
#define SHTTY (insource ? OLDSTD : SHIN)
|
||||
|
||||
#define uc unsigned char
|
||||
@ -127,9 +126,10 @@ check_window_size(force)
|
||||
#else /* BSDSIGS */
|
||||
(void) sigrelse(SIG_WINDOW);
|
||||
#endif /* BSDSIGS */
|
||||
windowchg = 0;
|
||||
}
|
||||
|
||||
sigret_t
|
||||
RETSIGTYPE
|
||||
/*ARGSUSED*/
|
||||
window_change(snum)
|
||||
int snum;
|
||||
@ -141,9 +141,6 @@ int snum;
|
||||
sigset(snum, window_change);
|
||||
#endif /* UNRELSIGS */
|
||||
windowchg = 1;
|
||||
#ifndef SIGVOID
|
||||
return (snum);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* SIG_WINDOW */
|
||||
@ -512,7 +509,6 @@ Rawmode()
|
||||
# endif /* TERMIO || POSIX */
|
||||
|
||||
{
|
||||
extern int didsetty;
|
||||
int i;
|
||||
|
||||
tty_getchar(&tstty, ttychars[TS_IO]);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/ed.inputl.c,v 3.51 2002/06/25 19:02:11 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/ed.inputl.c,v 3.57 2004/12/25 21:15:06 christos Exp $ */
|
||||
/*
|
||||
* ed.inputl.c: Input line handling.
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: ed.inputl.c,v 3.51 2002/06/25 19:02:11 christos Exp $")
|
||||
RCSID("$Id: ed.inputl.c,v 3.57 2004/12/25 21:15:06 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
#include "ed.defns.h" /* for the function names */
|
||||
@ -42,9 +42,7 @@ RCSID("$Id: ed.inputl.c,v 3.51 2002/06/25 19:02:11 christos Exp $")
|
||||
|
||||
/* ed.inputl -- routines to get a single line from the input. */
|
||||
|
||||
extern bool tellwhat;
|
||||
extern bool MapsAreInited;
|
||||
extern bool Tty_raw_mode;
|
||||
extern int MapsAreInited;
|
||||
|
||||
/* mismatched first character */
|
||||
static Char mismatch[] =
|
||||
@ -57,7 +55,7 @@ static int CompleteLine __P((void));
|
||||
static void RunCommand __P((Char *));
|
||||
static void doeval1 __P((Char **));
|
||||
|
||||
static bool rotate = 0;
|
||||
static int rotate = 0;
|
||||
|
||||
|
||||
static int
|
||||
@ -81,7 +79,6 @@ 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 */
|
||||
@ -649,7 +646,7 @@ RunCommand(str)
|
||||
static int
|
||||
GetNextCommand(cmdnum, ch)
|
||||
KEYCMD *cmdnum;
|
||||
register Char *ch;
|
||||
Char *ch;
|
||||
{
|
||||
KEYCMD cmd = 0;
|
||||
int num;
|
||||
@ -662,6 +659,8 @@ GetNextCommand(cmdnum, ch)
|
||||
if (
|
||||
#ifdef DSPMBYTE
|
||||
_enable_mbdisp &&
|
||||
#else
|
||||
MB_LEN_MAX == 1 &&
|
||||
#endif
|
||||
!adrof(STRnokanji) && (*ch & META)) {
|
||||
MetaNext = 0;
|
||||
@ -680,7 +679,11 @@ GetNextCommand(cmdnum, ch)
|
||||
if (*ch < NT_NUM_KEYS)
|
||||
cmd = CurrentKeyMap[*ch];
|
||||
else
|
||||
#ifdef WINNT_NATIVE
|
||||
cmd = CurrentKeyMap[(unsigned char) *ch];
|
||||
#else
|
||||
cmd = F_INSERT;
|
||||
#endif
|
||||
if (cmd == F_XKEY) {
|
||||
XmapVal val;
|
||||
CStr cstr;
|
||||
@ -708,14 +711,30 @@ GetNextCommand(cmdnum, ch)
|
||||
return OKCMD;
|
||||
}
|
||||
|
||||
static Char ungetchar;
|
||||
static int haveungetchar;
|
||||
|
||||
void
|
||||
UngetNextChar(Char cp)
|
||||
{
|
||||
ungetchar = cp;
|
||||
haveungetchar = 1;
|
||||
}
|
||||
|
||||
int
|
||||
GetNextChar(cp)
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
{
|
||||
register int num_read;
|
||||
int num_read;
|
||||
int tried = 0;
|
||||
unsigned char tcp;
|
||||
char cbuf[MB_LEN_MAX];
|
||||
size_t cbp;
|
||||
|
||||
if (haveungetchar) {
|
||||
haveungetchar = 0;
|
||||
*cp = ungetchar;
|
||||
return 1;
|
||||
}
|
||||
for (;;) {
|
||||
if (MacroLvl < 0) {
|
||||
if (!Load_input_line())
|
||||
@ -738,32 +757,45 @@ GetNextChar(cp)
|
||||
#ifdef WINNT_NATIVE
|
||||
__nt_want_vcode = 1;
|
||||
#endif /* WINNT_NATIVE */
|
||||
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_NATIVE
|
||||
__nt_want_vcode = 0;
|
||||
#endif /* WINNT_NATIVE */
|
||||
*cp = '\0';
|
||||
return -1;
|
||||
#ifdef SIG_WINDOW
|
||||
if (windowchg)
|
||||
(void) check_window_size(0); /* for window systems */
|
||||
#endif /* SIG_WINDOW */
|
||||
cbp = 0;
|
||||
for (;;) {
|
||||
while ((num_read = read(SHIN, cbuf + cbp, 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_NATIVE
|
||||
__nt_want_vcode = 0;
|
||||
# endif /* WINNT_NATIVE */
|
||||
*cp = '\0'; /* Loses possible partial character */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
cbp++;
|
||||
if (normal_mbtowc(cp, cbuf, cbp) == -1) {
|
||||
reset_mbtowc();
|
||||
if (cbp < MB_LEN_MAX)
|
||||
continue; /* Maybe a partial character */
|
||||
/* And drop the following bytes, if any */
|
||||
*cp = (unsigned char)*cbuf | INVALID_BYTE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifdef WINNT_NATIVE
|
||||
/* This is the part that doesn't work with WIDE_STRINGS */
|
||||
if (__nt_want_vcode == 2)
|
||||
*cp = __nt_vcode;
|
||||
else
|
||||
*cp = tcp;
|
||||
__nt_want_vcode = 0;
|
||||
#else
|
||||
*cp = tcp;
|
||||
#endif /* WINNT_NATIVE */
|
||||
return num_read;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/ed.refresh.c,v 3.30 2003/02/08 20:03:25 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/ed.refresh.c,v 3.39 2005/02/15 21:09:02 christos Exp $ */
|
||||
/*
|
||||
* ed.refresh.c: Lower level screen refreshing functions
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: ed.refresh.c,v 3.30 2003/02/08 20:03:25 christos Exp $")
|
||||
RCSID("$Id: ed.refresh.c,v 3.39 2005/02/15 21:09:02 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
/* #define DEBUG_UPDATE */
|
||||
@ -41,12 +41,13 @@ RCSID("$Id: ed.refresh.c,v 3.30 2003/02/08 20:03:25 christos Exp $")
|
||||
|
||||
/* refresh.c -- refresh the current set of lines on the screen */
|
||||
|
||||
Char *litptr[256];
|
||||
Char *litptr;
|
||||
static int vcursor_h, vcursor_v;
|
||||
static int rprompt_h, rprompt_v;
|
||||
|
||||
static void Draw __P((int));
|
||||
static void Vdraw __P((int));
|
||||
static int MakeLiteral __P((Char *, int, Char));
|
||||
static int Draw __P((Char *, int));
|
||||
static void Vdraw __P((Char, int));
|
||||
static void RefreshPromptpart __P((Char *));
|
||||
static void update_line __P((Char *, Char *, int));
|
||||
static void str_insert __P((Char *, int, int, Char *, int));
|
||||
@ -57,26 +58,27 @@ static
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
void PutPlusOne __P((int));
|
||||
void PutPlusOne __P((Char, int));
|
||||
static void cpy_pad_spaces __P((Char *, Char *, int));
|
||||
#if defined(DSPMBYTE)
|
||||
static Char *update_line_fix_mbyte_point __P((Char *, Char *, int));
|
||||
#endif
|
||||
#if defined(DEBUG_UPDATE) || defined(DEBUG_REFRESH) || defined(DEBUG_LITERAL)
|
||||
static void dprintf __P((char *, ...));
|
||||
#ifdef DEBUG_UPDATE
|
||||
static void dprintstr __P((char *, Char *, Char *));
|
||||
static void dprintstr __P((char *, const Char *, const Char *));
|
||||
|
||||
static void
|
||||
dprintstr(str, f, t)
|
||||
char *str;
|
||||
Char *f, *t;
|
||||
const Char *f, *t;
|
||||
{
|
||||
dprintf("%s:\"", str);
|
||||
while (f < t)
|
||||
dprintf("%c", *f++ & ASCII);
|
||||
while (f < t) {
|
||||
if (*f & ~ASCII)
|
||||
dprintf("[%x]", *f++);
|
||||
else
|
||||
dprintf("%c", *f++ & ASCII);
|
||||
}
|
||||
dprintf("\"\r\n");
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG_UPDATE */
|
||||
|
||||
/* dprintf():
|
||||
@ -85,7 +87,7 @@ Char *f, *t;
|
||||
* debugging cause you'll mangle up the file descriptors!
|
||||
*/
|
||||
static void
|
||||
#ifdef FUNCPROTO
|
||||
#ifdef PROTOTYPES
|
||||
dprintf(char *fmt, ...)
|
||||
#else
|
||||
dprintf(va_list)
|
||||
@ -98,7 +100,7 @@ dprintf(va_list)
|
||||
if ((dtty = getenv("DEBUGTTY"))) {
|
||||
int o;
|
||||
va_list va;
|
||||
#ifdef FUNCPROTO
|
||||
#ifdef PROTOTYPES
|
||||
va_start(va, fmt);
|
||||
#else
|
||||
char *fmt;
|
||||
@ -119,101 +121,174 @@ dprintf(va_list)
|
||||
}
|
||||
#endif /* DEBUG_UPDATE || DEBUG_REFRESH || DEBUG_LITERAL */
|
||||
|
||||
static void
|
||||
Draw(c) /* draw c, expand tabs, ctl chars */
|
||||
register int c;
|
||||
static int litlen = 0, litalloc = 0;
|
||||
|
||||
static int MakeLiteral(str, len, addlit)
|
||||
Char *str;
|
||||
int len;
|
||||
Char addlit;
|
||||
{
|
||||
register Char ch = c & CHAR;
|
||||
|
||||
if (Isprint(ch)) {
|
||||
Vdraw(c);
|
||||
return;
|
||||
int i, addlitlen = 0;
|
||||
Char *addlitptr = 0;
|
||||
if (addlit) {
|
||||
if ((addlit & LITERAL) != 0) {
|
||||
addlitptr = litptr + (addlit & ~LITERAL) * LIT_FACTOR;
|
||||
addlitlen = Strlen(addlitptr);
|
||||
} else {
|
||||
addlitptr = &addlit;
|
||||
addlitlen = 1;
|
||||
}
|
||||
for (i = 0; i < litlen; i += LIT_FACTOR)
|
||||
if (!Strncmp(addlitptr, litptr + i, addlitlen) && !Strncmp(str, litptr + i + addlitlen, len) && litptr[i + addlitlen + len] == 0)
|
||||
return (i / LIT_FACTOR) | LITERAL;
|
||||
} else {
|
||||
addlitlen = 0;
|
||||
for (i = 0; i < litlen; i += LIT_FACTOR)
|
||||
if (!Strncmp(str, litptr + i, len) && litptr[i + len] == 0)
|
||||
return (i / LIT_FACTOR) | LITERAL;
|
||||
}
|
||||
/* from wolman%crltrx.DEC@decwrl.dec.com (Alec Wolman) */
|
||||
if (ch == '\n') { /* expand the newline */
|
||||
/*
|
||||
* Don't force a newline if Vdraw does it (i.e. we're at end of line)
|
||||
* - or we will get two newlines and possibly garbage in between
|
||||
*/
|
||||
int oldv = vcursor_v;
|
||||
if (litlen + addlitlen + len + 1 + (LIT_FACTOR - 1) > litalloc) {
|
||||
Char *newlitptr;
|
||||
int add = 256;
|
||||
while (len + addlitlen + 1 + (LIT_FACTOR - 1) > add)
|
||||
add *= 2;
|
||||
if (litptr)
|
||||
newlitptr = (Char *)xrealloc(litptr, (litalloc + add) * sizeof(Char));
|
||||
else
|
||||
newlitptr = (Char *)xmalloc((litalloc + add) * sizeof(Char));
|
||||
if (!newlitptr)
|
||||
return '?';
|
||||
litptr = newlitptr;
|
||||
litalloc += add;
|
||||
if (addlitptr && addlitptr != &addlit)
|
||||
addlitptr = litptr + (addlit & ~LITERAL) * LIT_FACTOR;
|
||||
}
|
||||
i = litlen / LIT_FACTOR;
|
||||
if (i >= LITERAL || i == CHAR_DBWIDTH)
|
||||
return '?';
|
||||
if (addlitptr) {
|
||||
Strncpy(litptr + litlen, addlitptr, addlitlen);
|
||||
litlen += addlitlen;
|
||||
}
|
||||
Strncpy(litptr + litlen, str, len);
|
||||
litlen += len;
|
||||
do
|
||||
litptr[litlen++] = 0;
|
||||
while (litlen % LIT_FACTOR);
|
||||
return i | LITERAL;
|
||||
}
|
||||
|
||||
Vdraw('\0'); /* assure end of line */
|
||||
if (oldv == vcursor_v) {
|
||||
vcursor_h = 0; /* reset cursor pos */
|
||||
static int
|
||||
Draw(cp, nocomb) /* draw char at cp, expand tabs, ctl chars */
|
||||
Char *cp;
|
||||
int nocomb;
|
||||
{
|
||||
int l, w, i, lv, lh;
|
||||
Char ch, attr;
|
||||
NLSChar c;
|
||||
|
||||
attr = *cp & ~CHAR;
|
||||
l = NLSFrom(cp, NLSZEROT, &c);
|
||||
w = NLSClassify(c, nocomb);
|
||||
switch (w) {
|
||||
case NLSCLASS_NL:
|
||||
Vdraw('\0', 0); /* assure end of line */
|
||||
vcursor_h = 0; /* reset cursor pos */
|
||||
vcursor_v++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (ch == '\t') { /* expand the tab */
|
||||
for (;;) {
|
||||
Vdraw(' ');
|
||||
if ((vcursor_h & 07) == 0)
|
||||
break; /* go until tab stop */
|
||||
}
|
||||
}
|
||||
else if (Iscntrl(ch)) {
|
||||
break;
|
||||
case NLSCLASS_TAB:
|
||||
do {
|
||||
Vdraw(' ', 1);
|
||||
} while ((vcursor_h & 07) != 0);
|
||||
break;
|
||||
case NLSCLASS_CTRL:
|
||||
Vdraw('^' | attr, 1);
|
||||
if (c == CTL_ESC('\177')) {
|
||||
Vdraw('?' | attr, 1);
|
||||
} else {
|
||||
#ifdef IS_ASCII
|
||||
Vdraw('^');
|
||||
if (ch == CTL_ESC('\177')) {
|
||||
Vdraw('?');
|
||||
}
|
||||
else {
|
||||
/* uncontrolify it; works only for iso8859-1 like sets */
|
||||
Vdraw((c | 0100));
|
||||
/* uncontrolify it; works only for iso8859-1 like sets */
|
||||
Vdraw(c | 0100 | attr, 1);
|
||||
#else
|
||||
if (ch == CTL_ESC('\177')) {
|
||||
Vdraw('^');
|
||||
Vdraw('?');
|
||||
}
|
||||
else {
|
||||
if (Isupper(_toebcdic[_toascii[c]|0100])
|
||||
|| strchr("@[\\]^_", _toebcdic[_toascii[c]|0100]) != NULL)
|
||||
{
|
||||
Vdraw('^');
|
||||
Vdraw(_toebcdic[_toascii[c]|0100]);
|
||||
Vdraw(_toebcdic[_toascii[c]|0100] | attr, 1);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case NLSCLASS_ILLEGAL:
|
||||
ch = *cp & CHAR;
|
||||
Vdraw('\\' | attr, 1);
|
||||
Vdraw((((ch >> 6) & 7) + '0') | attr, 1);
|
||||
Vdraw((((ch >> 3) & 7) + '0') | attr, 1);
|
||||
Vdraw(((ch & 7) + '0') | attr, 1);
|
||||
break;
|
||||
case NLSCLASS_ILLEGAL2:
|
||||
case NLSCLASS_ILLEGAL3:
|
||||
case NLSCLASS_ILLEGAL4:
|
||||
Vdraw('\\' | attr, 1);
|
||||
Vdraw('U' | attr, 1);
|
||||
Vdraw('+' | attr, 1);
|
||||
for (i = 8 * NLSCLASS_ILLEGAL_SIZE(w) - 4; i >= 0; i -= 4)
|
||||
Vdraw("0123456789ABCDEF"[(c >> i) & 15] | attr, 1);
|
||||
break;
|
||||
case 0:
|
||||
lv = vcursor_v;
|
||||
lh = vcursor_h;
|
||||
for (;;) {
|
||||
lh--;
|
||||
if (lh < 0) {
|
||||
lv--;
|
||||
if (lv < 0)
|
||||
break;
|
||||
lh = Strlen(Vdisplay[lv]) - 1;
|
||||
}
|
||||
if (Vdisplay[lv][lh] != CHAR_DBWIDTH)
|
||||
break;
|
||||
}
|
||||
if (lv < 0) {
|
||||
int l2 = l;
|
||||
for (; l2-- > 0; cp++) {
|
||||
ch = *cp & CHAR;
|
||||
Vdraw('\\' | attr, 1);
|
||||
Vdraw((((ch >> 6) & 7) + '0') | attr, 1);
|
||||
Vdraw((((ch >> 3) & 7) + '0') | attr, 1);
|
||||
Vdraw(((ch & 7) + '0') | attr, 1);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
Vdisplay[lv][lh] = MakeLiteral(cp, l, Vdisplay[lv][lh]);
|
||||
break;
|
||||
default:
|
||||
if (l > 1)
|
||||
Vdraw(MakeLiteral(cp, l, 0), w);
|
||||
else
|
||||
{
|
||||
Vdraw('\\');
|
||||
Vdraw(((c >> 6) & 7) + '0');
|
||||
Vdraw(((c >> 3) & 7) + '0');
|
||||
Vdraw((c & 7) + '0');
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef KANJI
|
||||
else if (
|
||||
#ifdef DSPMBYTE
|
||||
_enable_mbdisp &&
|
||||
#endif
|
||||
!adrof(STRnokanji)) {
|
||||
Vdraw(c);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
Vdraw('\\');
|
||||
Vdraw(((c >> 6) & 7) + '0');
|
||||
Vdraw(((c >> 3) & 7) + '0');
|
||||
Vdraw((c & 7) + '0');
|
||||
Vdraw(*cp, w);
|
||||
break;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
static void
|
||||
Vdraw(c) /* draw char c onto V lines */
|
||||
register int c;
|
||||
Vdraw(c, width) /* draw char c onto V lines */
|
||||
Char c;
|
||||
int width;
|
||||
{
|
||||
#ifdef DEBUG_REFRESH
|
||||
# ifdef SHORT_STRINGS
|
||||
dprintf("Vdrawing %6.6o '%c'\r\n", c, c & ASCII);
|
||||
dprintf("Vdrawing %6.6o '%c' %d\r\n", (unsigned)c, (int)(c & ASCII), width);
|
||||
# else
|
||||
dprintf("Vdrawing %3.3o '%c'\r\n", c, c);
|
||||
dprintf("Vdrawing %3.3o '%c' %d\r\n", (unsigned)c, (int)c, width);
|
||||
# endif /* SHORT_STRNGS */
|
||||
#endif /* DEBUG_REFRESH */
|
||||
|
||||
/* Hopefully this is what all the terminals do with multi-column characters
|
||||
that "span line breaks". */
|
||||
while (vcursor_h + width > TermH)
|
||||
Vdraw(' ', 1);
|
||||
Vdisplay[vcursor_v][vcursor_h] = (Char) c;
|
||||
vcursor_h++; /* advance to next place */
|
||||
if (width)
|
||||
vcursor_h++; /* advance to next place */
|
||||
while (--width > 0)
|
||||
Vdisplay[vcursor_v][vcursor_h++] = CHAR_DBWIDTH;
|
||||
if (vcursor_h >= TermH) {
|
||||
Vdisplay[vcursor_v][TermH] = '\0'; /* assure end of line */
|
||||
vcursor_h = 0; /* reset it. */
|
||||
@ -236,27 +311,21 @@ static void
|
||||
RefreshPromptpart(buf)
|
||||
Char *buf;
|
||||
{
|
||||
register Char *cp;
|
||||
static unsigned int litnum = 0;
|
||||
if (buf == NULL)
|
||||
{
|
||||
litnum = 0;
|
||||
return;
|
||||
}
|
||||
Char *cp;
|
||||
NLSChar c;
|
||||
int l, w;
|
||||
|
||||
for (cp = buf; *cp; cp++) {
|
||||
for (cp = buf; *cp; ) {
|
||||
if (*cp & LITERAL) {
|
||||
if (litnum < (sizeof(litptr) / sizeof(litptr[0]))) {
|
||||
litptr[litnum] = cp;
|
||||
#ifdef DEBUG_LITERAL
|
||||
dprintf("litnum = %d, litptr = %x:\r\n",
|
||||
litnum, litptr[litnum]);
|
||||
#endif /* DEBUG_LITERAL */
|
||||
}
|
||||
Char *litstart = cp;
|
||||
while (*cp & LITERAL)
|
||||
cp++;
|
||||
if (*cp)
|
||||
Vdraw((int) (litnum++ | LITERAL));
|
||||
if (*cp) {
|
||||
l = NLSFrom(cp, NLSZEROT, &c);
|
||||
w = NLSWidth(c);
|
||||
Vdraw(MakeLiteral(litstart, cp + l - litstart, 0), w);
|
||||
cp += l;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* XXX: This is a bug, we lose the last literal, if it is not
|
||||
@ -266,7 +335,7 @@ RefreshPromptpart(buf)
|
||||
}
|
||||
}
|
||||
else
|
||||
Draw(*cp);
|
||||
cp += Draw(cp, cp == buf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,8 +354,8 @@ int OldvcV = 0;
|
||||
void
|
||||
Refresh()
|
||||
{
|
||||
register int cur_line;
|
||||
register Char *cp;
|
||||
int cur_line;
|
||||
Char *cp;
|
||||
int cur_h, cur_v = 0, new_vcv;
|
||||
int rhdiff;
|
||||
Char oldgetting;
|
||||
@ -301,7 +370,6 @@ Refresh()
|
||||
/* reset the Vdraw cursor, temporarily draw rprompt to calculate its size */
|
||||
vcursor_h = 0;
|
||||
vcursor_v = 0;
|
||||
RefreshPromptpart(NULL);
|
||||
RefreshPromptpart(RPromptBuf);
|
||||
rprompt_h = vcursor_h;
|
||||
rprompt_v = vcursor_v;
|
||||
@ -309,17 +377,17 @@ Refresh()
|
||||
/* reset the Vdraw cursor, draw prompt */
|
||||
vcursor_h = 0;
|
||||
vcursor_v = 0;
|
||||
RefreshPromptpart(NULL);
|
||||
RefreshPromptpart(PromptBuf);
|
||||
cur_h = -1; /* set flag in case I'm not set */
|
||||
|
||||
/* draw the current input buffer */
|
||||
for (cp = InputBuf; (cp < LastChar); cp++) {
|
||||
if (cp == Cursor) {
|
||||
for (cp = InputBuf; (cp < LastChar); ) {
|
||||
if (cp >= Cursor && cur_h == -1) {
|
||||
cur_h = vcursor_h; /* save for later */
|
||||
cur_v = vcursor_v;
|
||||
Cursor = cp;
|
||||
}
|
||||
Draw(*cp);
|
||||
cp += Draw(cp, cp == InputBuf);
|
||||
}
|
||||
|
||||
if (cur_h == -1) { /* if I haven't been set yet, I'm at the end */
|
||||
@ -335,7 +403,7 @@ Refresh()
|
||||
* character gap to the input buffer.
|
||||
*/
|
||||
while (--rhdiff > 0) /* pad out with spaces */
|
||||
Draw(' ');
|
||||
Vdraw(' ', 1);
|
||||
RefreshPromptpart(RPromptBuf);
|
||||
}
|
||||
else {
|
||||
@ -344,9 +412,9 @@ Refresh()
|
||||
}
|
||||
|
||||
new_vcv = vcursor_v; /* must be done BEFORE the NUL is written */
|
||||
Vdraw('\0'); /* put NUL on end */
|
||||
Vdraw('\0', 1); /* put NUL on end */
|
||||
|
||||
#ifdef DEBUG_REFRESH
|
||||
#if defined (DEBUG_REFRESH)
|
||||
dprintf("TermH=%d, vcur_h=%d, vcur_v=%d, Vdisplay[0]=\r\n:%80.80s:\r\n",
|
||||
TermH, vcursor_h, vcursor_v, short2str(Vdisplay[0]));
|
||||
#endif /* DEBUG_REFRESH */
|
||||
@ -368,10 +436,6 @@ Refresh()
|
||||
* screen line, it won't be a NUL or some old leftover stuff.
|
||||
*/
|
||||
cpy_pad_spaces(Display[cur_line], Vdisplay[cur_line], TermH);
|
||||
#ifdef notdef
|
||||
(void) Strncpy(Display[cur_line], Vdisplay[cur_line], (size_t) TermH);
|
||||
Display[cur_line][TermH] = '\0'; /* just in case */
|
||||
#endif
|
||||
}
|
||||
#ifdef DEBUG_REFRESH
|
||||
dprintf("\r\nvcursor_v = %d, OldvcV = %d, cur_line = %d\r\n",
|
||||
@ -421,12 +485,12 @@ PastBottom()
|
||||
maximum length of d is dlen */
|
||||
static void
|
||||
str_insert(d, dat, dlen, s, num)
|
||||
register Char *d;
|
||||
register int dat, dlen;
|
||||
register Char *s;
|
||||
register int num;
|
||||
Char *d;
|
||||
int dat, dlen;
|
||||
Char *s;
|
||||
int num;
|
||||
{
|
||||
register Char *a, *b;
|
||||
Char *a, *b;
|
||||
|
||||
if (num <= 0)
|
||||
return;
|
||||
@ -467,10 +531,10 @@ str_insert(d, dat, dlen, s, num)
|
||||
/* delete num characters d at dat, maximum length of d is dlen */
|
||||
static void
|
||||
str_delete(d, dat, dlen, num)
|
||||
register Char *d;
|
||||
register int dat, dlen, num;
|
||||
Char *d;
|
||||
int dat, dlen, num;
|
||||
{
|
||||
register Char *a, *b;
|
||||
Char *a, *b;
|
||||
|
||||
if (num <= 0)
|
||||
return;
|
||||
@ -500,35 +564,14 @@ str_delete(d, dat, dlen, num)
|
||||
|
||||
static void
|
||||
str_cp(a, b, n)
|
||||
register Char *a, *b;
|
||||
register int n;
|
||||
Char *a, *b;
|
||||
int n;
|
||||
{
|
||||
while (n-- && *b)
|
||||
*a++ = *b++;
|
||||
}
|
||||
|
||||
|
||||
#if defined(DSPMBYTE) /* BY TAGA Nayuta VERY THANKS */
|
||||
static Char *
|
||||
update_line_fix_mbyte_point(start, target, d)
|
||||
Char *start, *target;
|
||||
int d;
|
||||
{
|
||||
if (_enable_mbdisp) {
|
||||
while (*start) {
|
||||
if (target == start)
|
||||
break;
|
||||
if (target < start)
|
||||
return target + d;
|
||||
if (Ismbyte1(*start) && Ismbyte2(*(start + 1)))
|
||||
start++;
|
||||
start++;
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ****************************************************************
|
||||
update_line() is based on finding the middle difference of each line
|
||||
on the screen; vis:
|
||||
@ -555,16 +598,16 @@ new: eddie> Oh, my little buggy says to me, as lurgid as
|
||||
|
||||
static void /* could be changed to make it smarter */
|
||||
update_line(old, new, cur_line)
|
||||
register Char *old, *new;
|
||||
Char *old, *new;
|
||||
int cur_line;
|
||||
{
|
||||
register Char *o, *n, *p, c;
|
||||
Char *ofd, *ols, *oe, *nfd, *nls, *ne;
|
||||
Char *osb, *ose, *nsb, *nse;
|
||||
Char *o, *n, *p, c;
|
||||
Char *ofd, *ols, *oe, *nfd, *nls, *ne;
|
||||
Char *osb, *ose, *nsb, *nse;
|
||||
int fx, sx;
|
||||
|
||||
/*
|
||||
* find first diff
|
||||
* find first diff (won't be CHAR_DBWIDTH in either line)
|
||||
*/
|
||||
for (o = old, n = new; *o && (*o == *n); o++, n++)
|
||||
continue;
|
||||
@ -615,8 +658,16 @@ update_line(old, new, cur_line)
|
||||
*/
|
||||
while ((o > ofd) && (n > nfd) && (*--o == *--n))
|
||||
continue;
|
||||
ols = ++o;
|
||||
nls = ++n;
|
||||
if (*o != *n) {
|
||||
o++;
|
||||
n++;
|
||||
}
|
||||
while (*o == CHAR_DBWIDTH) {
|
||||
o++;
|
||||
n++;
|
||||
}
|
||||
ols = o;
|
||||
nls = n;
|
||||
|
||||
/*
|
||||
* find same begining and same end
|
||||
@ -785,17 +836,6 @@ update_line(old, new, cur_line)
|
||||
*/
|
||||
MoveToLine(cur_line);
|
||||
|
||||
#if defined(DSPMBYTE) /* BY TAGA Nayuta VERY THANKS */
|
||||
ofd = update_line_fix_mbyte_point(old, ofd, -1);
|
||||
osb = update_line_fix_mbyte_point(old, osb, 1);
|
||||
ose = update_line_fix_mbyte_point(old, ose, -1);
|
||||
ols = update_line_fix_mbyte_point(old, ols, 1);
|
||||
nfd = update_line_fix_mbyte_point(new, nfd, -1);
|
||||
nsb = update_line_fix_mbyte_point(new, nsb, 1);
|
||||
nse = update_line_fix_mbyte_point(new, nse, -1);
|
||||
nls = update_line_fix_mbyte_point(new, nls, 1);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* at this point we have something like this:
|
||||
*
|
||||
@ -1094,10 +1134,10 @@ update_line(old, new, cur_line)
|
||||
|
||||
static void
|
||||
cpy_pad_spaces(dst, src, width)
|
||||
register Char *dst, *src;
|
||||
register int width;
|
||||
Char *dst, *src;
|
||||
int width;
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < width; i++) {
|
||||
if (*src == (Char) 0)
|
||||
@ -1115,87 +1155,81 @@ cpy_pad_spaces(dst, src, width)
|
||||
void
|
||||
RefCursor()
|
||||
{ /* only move to new cursor pos */
|
||||
register Char *cp, c;
|
||||
register int h, th, v;
|
||||
Char *cp;
|
||||
NLSChar c;
|
||||
int l, w, h, th, v;
|
||||
|
||||
/* first we must find where the cursor is... */
|
||||
h = 0;
|
||||
v = 0;
|
||||
th = TermH; /* optimize for speed */
|
||||
|
||||
for (cp = PromptBuf; *cp; cp++) { /* do prompt */
|
||||
if (*cp & LITERAL)
|
||||
for (cp = PromptBuf; *cp; ) { /* do prompt */
|
||||
if (*cp & LITERAL) {
|
||||
cp++;
|
||||
continue;
|
||||
c = *cp & CHAR; /* extra speed plus strip the inverse */
|
||||
h++; /* all chars at least this long */
|
||||
|
||||
/* from wolman%crltrx.DEC@decwrl.dec.com (Alec Wolman) */
|
||||
/* lets handle newline as part of the prompt */
|
||||
|
||||
if (c == '\n') {
|
||||
h = 0;
|
||||
v++;
|
||||
}
|
||||
else {
|
||||
if (c == '\t') { /* if a tab, to next tab stop */
|
||||
while (h & 07) {
|
||||
h++;
|
||||
}
|
||||
}
|
||||
else if (Iscntrl(c)) { /* if control char */
|
||||
h++;
|
||||
if (h > th) { /* if overflow, compensate */
|
||||
h = 1;
|
||||
v++;
|
||||
}
|
||||
}
|
||||
else if (!Isprint(c)) {
|
||||
h += 3;
|
||||
if (h > th) { /* if overflow, compensate */
|
||||
h = h - th;
|
||||
v++;
|
||||
}
|
||||
}
|
||||
l = NLSFrom(cp, NLSZEROT, &c);
|
||||
w = NLSClassify(c, cp == PromptBuf);
|
||||
cp += l;
|
||||
switch(w) {
|
||||
case NLSCLASS_NL:
|
||||
h = 0;
|
||||
v++;
|
||||
break;
|
||||
case NLSCLASS_TAB:
|
||||
while (++h & 07)
|
||||
;
|
||||
break;
|
||||
case NLSCLASS_CTRL:
|
||||
h += 2;
|
||||
break;
|
||||
case NLSCLASS_ILLEGAL:
|
||||
h += 4;
|
||||
break;
|
||||
case NLSCLASS_ILLEGAL2:
|
||||
case NLSCLASS_ILLEGAL3:
|
||||
case NLSCLASS_ILLEGAL4:
|
||||
h += 3 + 2 * NLSCLASS_ILLEGAL_SIZE(w);
|
||||
break;
|
||||
default:
|
||||
h += w;
|
||||
}
|
||||
|
||||
if (h >= th) { /* check, extra long tabs picked up here also */
|
||||
h = 0;
|
||||
h -= th;
|
||||
v++;
|
||||
}
|
||||
}
|
||||
|
||||
for (cp = InputBuf; cp < Cursor; cp++) { /* do input buffer to Cursor */
|
||||
c = *cp & CHAR; /* extra speed plus strip the inverse */
|
||||
h++; /* all chars at least this long */
|
||||
|
||||
if (c == '\n') { /* handle newline in data part too */
|
||||
h = 0;
|
||||
v++;
|
||||
for (cp = InputBuf; cp < Cursor;) { /* do input buffer to Cursor */
|
||||
l = NLSFrom(cp, Cursor - cp, &c);
|
||||
w = NLSClassify(c, cp == InputBuf);
|
||||
cp += l;
|
||||
switch(w) {
|
||||
case NLSCLASS_NL:
|
||||
h = 0;
|
||||
v++;
|
||||
break;
|
||||
case NLSCLASS_TAB:
|
||||
while (++h & 07)
|
||||
;
|
||||
break;
|
||||
case NLSCLASS_CTRL:
|
||||
h += 2;
|
||||
break;
|
||||
case NLSCLASS_ILLEGAL:
|
||||
h += 4;
|
||||
break;
|
||||
case NLSCLASS_ILLEGAL2:
|
||||
case NLSCLASS_ILLEGAL3:
|
||||
case NLSCLASS_ILLEGAL4:
|
||||
h += 3 + 2 * NLSCLASS_ILLEGAL_SIZE(w);
|
||||
break;
|
||||
default:
|
||||
h += w;
|
||||
}
|
||||
else {
|
||||
if (c == '\t') { /* if a tab, to next tab stop */
|
||||
while (h & 07) {
|
||||
h++;
|
||||
}
|
||||
}
|
||||
else if (Iscntrl(c)) { /* if control char */
|
||||
h++;
|
||||
if (h > th) { /* if overflow, compensate */
|
||||
h = 1;
|
||||
v++;
|
||||
}
|
||||
}
|
||||
else if (!Isprint(c)) {
|
||||
h += 3;
|
||||
if (h > th) { /* if overflow, compensate */
|
||||
h = h - th;
|
||||
v++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (h >= th) { /* check, extra long tabs picked up here also */
|
||||
h = 0;
|
||||
h -= th;
|
||||
v++;
|
||||
}
|
||||
}
|
||||
@ -1208,11 +1242,22 @@ RefCursor()
|
||||
|
||||
#ifndef WINTT_NATIVE
|
||||
static void
|
||||
PutPlusOne(c)
|
||||
int c;
|
||||
PutPlusOne(c, width)
|
||||
Char c;
|
||||
int width;
|
||||
{
|
||||
(void) putraw(c);
|
||||
while (width > 1 && CursorH + width > TermH)
|
||||
PutPlusOne(' ', 1);
|
||||
if ((c & LITERAL) != 0) {
|
||||
Char *d;
|
||||
for (d = litptr + (c & ~LITERAL) * LIT_FACTOR; *d; d++)
|
||||
(void) putwraw(*d);
|
||||
} else {
|
||||
(void) putwraw(c);
|
||||
}
|
||||
Display[CursorV][CursorH++] = (Char) c;
|
||||
while (--width > 0)
|
||||
Display[CursorV][CursorH++] = CHAR_DBWIDTH;
|
||||
if (CursorH >= TermH) { /* if we must overflow */
|
||||
CursorH = 0;
|
||||
CursorV++;
|
||||
@ -1232,62 +1277,53 @@ PutPlusOne(c)
|
||||
#endif
|
||||
|
||||
void
|
||||
RefPlusOne()
|
||||
RefPlusOne(int l)
|
||||
{ /* we added just one char, handle it fast.
|
||||
* assumes that screen cursor == real cursor */
|
||||
register Char c, mc;
|
||||
Char *cp;
|
||||
int w;
|
||||
NLSChar c;
|
||||
|
||||
c = Cursor[-1] & CHAR; /* the char we just added */
|
||||
|
||||
if (c == '\t' || Cursor != LastChar) {
|
||||
if (Cursor != LastChar) {
|
||||
Refresh(); /* too hard to handle */
|
||||
return;
|
||||
}
|
||||
|
||||
if (rprompt_h != 0 && (TermH - CursorH - rprompt_h < 3)) {
|
||||
Refresh(); /* clear out rprompt if less than one char gap*/
|
||||
return;
|
||||
} /* else (only do at end of line, no TAB) */
|
||||
|
||||
if (Iscntrl(c)) { /* if control char, do caret */
|
||||
}
|
||||
cp = Cursor - l;
|
||||
NLSFrom(cp, (size_t)l, &c);
|
||||
w = NLSClassify(c, cp == InputBuf);
|
||||
switch(w) {
|
||||
case NLSCLASS_CTRL:
|
||||
PutPlusOne('^', 1);
|
||||
if (c == CTL_ESC('\177')) {
|
||||
PutPlusOne('?', 1);
|
||||
break;
|
||||
}
|
||||
#ifdef IS_ASCII
|
||||
mc = (c == '\177') ? '?' : (c | 0100);
|
||||
PutPlusOne('^');
|
||||
PutPlusOne(mc);
|
||||
/* uncontrolify it; works only for iso8859-1 like sets */
|
||||
PutPlusOne((c | 0100), 1);
|
||||
#else
|
||||
if (_toascii[c] == '\177' || Isupper(_toebcdic[_toascii[c]|0100])
|
||||
|| strchr("@[\\]^_", _toebcdic[_toascii[c]|0100]) != NULL)
|
||||
{
|
||||
mc = (_toascii[c] == '\177') ? '?' : _toebcdic[_toascii[c]|0100];
|
||||
PutPlusOne('^');
|
||||
PutPlusOne(mc);
|
||||
}
|
||||
else
|
||||
{
|
||||
PutPlusOne('\\');
|
||||
PutPlusOne(((c >> 6) & 7) + '0');
|
||||
PutPlusOne(((c >> 3) & 7) + '0');
|
||||
PutPlusOne((c & 7) + '0');
|
||||
}
|
||||
PutPlusOne(_toebcdic[_toascii[c]|0100], 1);
|
||||
#endif
|
||||
}
|
||||
else if (Isprint(c)) { /* normal char */
|
||||
PutPlusOne(c);
|
||||
}
|
||||
#ifdef KANJI
|
||||
else if (
|
||||
#ifdef DSPMBYTE
|
||||
_enable_mbdisp &&
|
||||
#endif
|
||||
!adrof(STRnokanji)) {
|
||||
PutPlusOne(c);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
PutPlusOne('\\');
|
||||
PutPlusOne(((c >> 6) & 7) + '0');
|
||||
PutPlusOne(((c >> 3) & 7) + '0');
|
||||
PutPlusOne((c & 7) + '0');
|
||||
break;
|
||||
case NLSCLASS_ILLEGAL:
|
||||
PutPlusOne('\\', 1);
|
||||
PutPlusOne(((c >> 6) & 7) + '0', 1);
|
||||
PutPlusOne(((c >> 3) & 7) + '0', 1);
|
||||
PutPlusOne((c & 7) + '0', 1);
|
||||
break;
|
||||
case 1:
|
||||
if (l > 1)
|
||||
PutPlusOne(MakeLiteral(cp, l, 0), 1);
|
||||
else
|
||||
PutPlusOne(*cp, 1);
|
||||
break;
|
||||
default:
|
||||
Refresh(); /* too hard to handle */
|
||||
return;
|
||||
}
|
||||
flush();
|
||||
}
|
||||
@ -1297,19 +1333,20 @@ RefPlusOne()
|
||||
void
|
||||
ClearDisp()
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
CursorV = 0; /* clear the display buffer */
|
||||
CursorH = 0;
|
||||
for (i = 0; i < TermV; i++)
|
||||
(void) memset(Display[i], 0, TermH * sizeof(Display[0][0]));
|
||||
OldvcV = 0;
|
||||
litlen = 0;
|
||||
}
|
||||
|
||||
void
|
||||
ClearLines()
|
||||
{ /* Make sure all lines are *really* blank */
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (T_CanCEOL) {
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/ed.screen.c,v 3.50 2003/02/08 20:03:25 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/ed.screen.c,v 3.63 2005/01/18 20:43:30 christos Exp $ */
|
||||
/*
|
||||
* ed.screen.c: Editor/termcap-curses interface
|
||||
*/
|
||||
@ -32,35 +32,12 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: ed.screen.c,v 3.50 2003/02/08 20:03:25 christos Exp $")
|
||||
RCSID("$Id: ed.screen.c,v 3.63 2005/01/18 20:43:30 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
#include "tc.h"
|
||||
#include "ed.defns.h"
|
||||
|
||||
#ifndef POSIX
|
||||
/*
|
||||
* We don't prototype these, cause some systems have them wrong!
|
||||
*/
|
||||
extern int tgetent __P(());
|
||||
extern char *tgetstr __P(());
|
||||
extern int tgetflag __P(());
|
||||
extern int tgetnum __P(());
|
||||
extern char *tgoto __P(());
|
||||
# define PUTPURE putpure
|
||||
# define PUTRAW putraw
|
||||
#else
|
||||
extern int tgetent __P((char *, char *));
|
||||
extern char *tgetstr __P((char *, char **));
|
||||
extern int tgetflag __P((char *));
|
||||
extern int tgetnum __P((char *));
|
||||
extern char *tgoto __P((char *, int, int));
|
||||
extern void tputs __P((char *, int, void (*)(int)));
|
||||
# define PUTPURE ((void (*)__P((int))) putpure)
|
||||
# define PUTRAW ((void (*)__P((int))) putraw)
|
||||
#endif
|
||||
|
||||
|
||||
/* #define DEBUG_LITERAL */
|
||||
|
||||
/*
|
||||
@ -77,8 +54,8 @@ extern void tputs __P((char *, int, void (*)(int)));
|
||||
#define Val(a) tval[a].val
|
||||
|
||||
static struct {
|
||||
char *b_name;
|
||||
int b_rate;
|
||||
const char *b_name;
|
||||
speed_t b_rate;
|
||||
} baud_rate[] = {
|
||||
|
||||
#ifdef B0
|
||||
@ -187,8 +164,8 @@ static struct {
|
||||
#define T_at7 37
|
||||
#define T_str 38
|
||||
static struct termcapstr {
|
||||
char *name;
|
||||
char *long_name;
|
||||
const char *name;
|
||||
const char *long_name;
|
||||
char *str;
|
||||
} tstr[T_str + 1];
|
||||
|
||||
@ -201,8 +178,8 @@ static struct termcapstr {
|
||||
#define T_xn 5
|
||||
#define T_val 6
|
||||
static struct termcapval {
|
||||
char *name;
|
||||
char *long_name;
|
||||
const char *name;
|
||||
const char *long_name;
|
||||
int val;
|
||||
} tval[T_val + 1];
|
||||
|
||||
@ -372,7 +349,7 @@ terminit()
|
||||
* No Wrap no -- yes yes
|
||||
*/
|
||||
|
||||
static bool me_all = 0; /* does two or more of the attributes use me */
|
||||
static int me_all = 0; /* does two or more of the attributes use me */
|
||||
|
||||
static void ReBufferDisplay __P((void));
|
||||
static void TCalloc __P((struct termcapstr *, char *));
|
||||
@ -445,33 +422,36 @@ TCalloc(t, cap)
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
TellTC(what)
|
||||
char *what;
|
||||
TellTC()
|
||||
{
|
||||
struct termcapstr *t;
|
||||
char *s;
|
||||
|
||||
USE(what);
|
||||
xprintf(CGETS(7, 1, "\n\tTcsh thinks your terminal has the\n"));
|
||||
xprintf(CGETS(7, 2, "\tfollowing characteristics:\n\n"));
|
||||
xprintf(CGETS(7, 3, "\tIt has %d columns and %d lines\n"),
|
||||
Val(T_co), Val(T_li));
|
||||
xprintf(CGETS(7, 4, "\tIt has %s meta key\n"), T_HasMeta ?
|
||||
CGETS(7, 5, "a") : CGETS(7, 6, "no"));
|
||||
xprintf(CGETS(7, 7, "\tIt can%s use tabs\n"), T_Tabs ?
|
||||
"" : CGETS(7, 8, " not"));
|
||||
xprintf(CGETS(7, 9, "\tIt %s automatic margins\n"),
|
||||
(T_Margin&MARGIN_AUTO)?
|
||||
CGETS(7, 10, "has"):
|
||||
CGETS(7, 11, "does not have"));
|
||||
if (T_Margin & MARGIN_AUTO)
|
||||
xprintf(CGETS(7, 12, "\tIt %s magic margins\n"),
|
||||
(T_Margin & MARGIN_MAGIC) ?
|
||||
CGETS(7, 10, "has"):
|
||||
CGETS(7, 11, "does not have"));
|
||||
|
||||
for (t = tstr; t->name != NULL; t++)
|
||||
xprintf("\t%36s (%s) == %s\n", t->long_name, t->name,
|
||||
t->str && *t->str ? t->str : CGETS(7, 13, "(empty)"));
|
||||
s = strsave(T_HasMeta ? CGETS(7, 5, "a") : CGETS(7, 6, "no"));
|
||||
xprintf(CGETS(7, 4, "\tIt has %s meta key\n"), s);
|
||||
xfree(s);
|
||||
s = strsave(T_Tabs ? "" : CGETS(7, 8, " not"));
|
||||
xprintf(CGETS(7, 7, "\tIt can%s use tabs\n"), s);
|
||||
xfree(s);
|
||||
s = strsave((T_Margin&MARGIN_AUTO) ?
|
||||
CGETS(7, 10, "has") : CGETS(7, 11, "does not have"));
|
||||
xprintf(CGETS(7, 9, "\tIt %s automatic margins\n"), s);
|
||||
xfree(s);
|
||||
if (T_Margin & MARGIN_AUTO) {
|
||||
s = strsave((T_Margin & MARGIN_MAGIC) ?
|
||||
CGETS(7, 10, "has") : CGETS(7, 11, "does not have"));
|
||||
xprintf(CGETS(7, 12, "\tIt %s magic margins\n"), s);
|
||||
xfree(s);
|
||||
}
|
||||
for (t = tstr; t->name != NULL; t++) {
|
||||
s = strsave(t->str && *t->str ? t->str : CGETS(7, 13, "(empty)"));
|
||||
xprintf("\t%36s (%s) == %s\n", t->long_name, t->name, s);
|
||||
xfree(s);
|
||||
}
|
||||
xputchar('\n');
|
||||
}
|
||||
|
||||
@ -479,9 +459,9 @@ TellTC(what)
|
||||
static void
|
||||
ReBufferDisplay()
|
||||
{
|
||||
register int i;
|
||||
Char **b;
|
||||
Char **bufp;
|
||||
int i;
|
||||
Char **b;
|
||||
Char **bufp;
|
||||
|
||||
b = Display;
|
||||
Display = NULL;
|
||||
@ -499,14 +479,14 @@ ReBufferDisplay()
|
||||
}
|
||||
TermH = Val(T_co);
|
||||
TermV = (INBUFSIZE * 4) / TermH + 1;
|
||||
b = (Char **) xmalloc((size_t) (sizeof(Char *) * (TermV + 1)));
|
||||
b = (Char **) xmalloc((size_t) (sizeof(*b) * (TermV + 1)));
|
||||
for (i = 0; i < TermV; i++)
|
||||
b[i] = (Char *) xmalloc((size_t) (sizeof(Char) * (TermH + 1)));
|
||||
b[i] = (Char *) xmalloc((size_t) (sizeof(*b[i]) * (TermH + 1)));
|
||||
b[TermV] = NULL;
|
||||
Display = b;
|
||||
b = (Char **) xmalloc((size_t) (sizeof(Char *) * (TermV + 1)));
|
||||
b = (Char **) xmalloc((size_t) (sizeof(*b) * (TermV + 1)));
|
||||
for (i = 0; i < TermV; i++)
|
||||
b[i] = (Char *) xmalloc((size_t) (sizeof(Char) * (TermH + 1)));
|
||||
b[i] = (Char *) xmalloc((size_t) (sizeof(*b[i]) * (TermH + 1)));
|
||||
b[TermV] = NULL;
|
||||
Vdisplay = b;
|
||||
}
|
||||
@ -595,7 +575,7 @@ EchoTC(v)
|
||||
int arg_need, arg_cols, arg_rows;
|
||||
int verbose = 0, silent = 0;
|
||||
char *area;
|
||||
static char *fmts = "%s\n", *fmtd = "%d\n";
|
||||
static const char *fmts = "%s\n", *fmtd = "%d\n";
|
||||
struct termcapstr *t;
|
||||
char buf[TC_BUFSIZE];
|
||||
|
||||
@ -798,7 +778,7 @@ EchoTC(v)
|
||||
}
|
||||
}
|
||||
|
||||
bool GotTermCaps = 0;
|
||||
int GotTermCaps = 0;
|
||||
|
||||
static struct {
|
||||
Char *name;
|
||||
@ -807,17 +787,17 @@ static struct {
|
||||
int type;
|
||||
} arrow[] = {
|
||||
#define A_K_DN 0
|
||||
{ STRdown, T_kd },
|
||||
{ STRdown, T_kd, { 0 }, 0 },
|
||||
#define A_K_UP 1
|
||||
{ STRup, T_ku },
|
||||
{ STRup, T_ku, { 0 }, 0 },
|
||||
#define A_K_LT 2
|
||||
{ STRleft, T_kl },
|
||||
{ STRleft, T_kl, { 0 }, 0 },
|
||||
#define A_K_RT 3
|
||||
{ STRright, T_kr },
|
||||
{ STRright, T_kr, { 0 }, 0 },
|
||||
#define A_K_HO 4
|
||||
{ STRhome, T_kh },
|
||||
{ STRhome, T_kh, { 0 }, 0 },
|
||||
#define A_K_EN 5
|
||||
{ STRend, T_at7}
|
||||
{ STRend, T_at7, { 0 }, 0}
|
||||
};
|
||||
#define A_K_NKEYS 6
|
||||
|
||||
@ -1021,7 +1001,7 @@ static Char cur_atr = 0; /* current attributes */
|
||||
|
||||
void
|
||||
SetAttributes(atr)
|
||||
int atr;
|
||||
Char atr;
|
||||
{
|
||||
atr &= ATTRIBUTES;
|
||||
if (atr != cur_atr) {
|
||||
@ -1115,9 +1095,14 @@ MoveToLine(where) /* move to line <where> (first line == 0) */
|
||||
if (del > 0) {
|
||||
while (del > 0) {
|
||||
if ((T_Margin & MARGIN_AUTO) && Display[CursorV][0] != '\0') {
|
||||
size_t h;
|
||||
|
||||
for (h = TermH - 1; h > 0 && Display[CursorV][h] == CHAR_DBWIDTH;
|
||||
h--)
|
||||
;
|
||||
/* move without newline */
|
||||
MoveToChar(TermH - 1);
|
||||
so_write(&Display[CursorV][CursorH], 1); /* updates CursorH/V*/
|
||||
MoveToChar(h);
|
||||
so_write(&Display[CursorV][CursorH], TermH - CursorH); /* updates CursorH/V*/
|
||||
del--;
|
||||
}
|
||||
else {
|
||||
@ -1182,16 +1167,13 @@ MoveToChar(where) /* move to character position (where) */
|
||||
(void) tputs(tgoto(Str(T_RI), del, del), del, PUTPURE);
|
||||
else {
|
||||
/* if I can do tabs, use them */
|
||||
if (T_Tabs
|
||||
#ifdef DSPMBYTE
|
||||
&& !_enable_mbdisp
|
||||
#endif /* DSPMBYTE */
|
||||
) {
|
||||
if ((CursorH & 0370) != (where & 0370)) {
|
||||
if (T_Tabs) {
|
||||
if ((CursorH & 0370) != (where & ~0x7)
|
||||
&& Display[CursorV][where & ~0x7] != CHAR_DBWIDTH) {
|
||||
/* if not within tab stop */
|
||||
for (i = (CursorH & 0370); i < (where & 0370); i += 8)
|
||||
for (i = (CursorH & 0370); i < (where & ~0x7); i += 8)
|
||||
(void) putraw('\t'); /* then tab over */
|
||||
CursorH = where & 0370;
|
||||
CursorH = where & ~0x7;
|
||||
/* Note: considering that we often want to go to
|
||||
TermH - 1 for the wrapping, it would be nice to
|
||||
optimize this case by tabbing to the last column
|
||||
@ -1226,8 +1208,8 @@ MoveToChar(where) /* move to character position (where) */
|
||||
|
||||
void
|
||||
so_write(cp, n)
|
||||
register Char *cp;
|
||||
register int n;
|
||||
Char *cp;
|
||||
int n;
|
||||
{
|
||||
if (n <= 0)
|
||||
return; /* catch bugs */
|
||||
@ -1241,21 +1223,19 @@ so_write(cp, n)
|
||||
}
|
||||
|
||||
do {
|
||||
if (*cp & LITERAL) {
|
||||
extern Char *litptr[];
|
||||
Char *d;
|
||||
|
||||
if (*cp != CHAR_DBWIDTH) {
|
||||
if (*cp & LITERAL) {
|
||||
Char *d;
|
||||
#ifdef DEBUG_LITERAL
|
||||
xprintf("so: litnum %d, litptr %x\r\n",
|
||||
*cp & CHAR, litptr[*cp & CHAR]);
|
||||
xprintf("so: litnum %d\r\n", (int)(*cp & ~LITERAL));
|
||||
#endif /* DEBUG_LITERAL */
|
||||
for (d = litptr[*cp++ & CHAR]; *d & LITERAL; d++)
|
||||
(void) putraw(*d & CHAR);
|
||||
(void) putraw(*d);
|
||||
|
||||
for (d = litptr + (*cp & ~LITERAL) * LIT_FACTOR; *d; d++)
|
||||
(void) putwraw(*d);
|
||||
}
|
||||
else
|
||||
(void) putwraw(*cp);
|
||||
}
|
||||
else
|
||||
(void) putraw(*cp++);
|
||||
cp++;
|
||||
CursorH++;
|
||||
} while (--n);
|
||||
|
||||
@ -1266,11 +1246,15 @@ so_write(cp, n)
|
||||
if (T_Margin & MARGIN_MAGIC) {
|
||||
/* force the wrap to avoid the "magic" situation */
|
||||
Char c;
|
||||
if ((c = Display[CursorV][CursorH]) != '\0')
|
||||
if ((c = Display[CursorV][CursorH]) != '\0') {
|
||||
so_write(&c, 1);
|
||||
else
|
||||
while(Display[CursorV][CursorH] == CHAR_DBWIDTH)
|
||||
CursorH++;
|
||||
}
|
||||
else {
|
||||
(void) putraw(' ');
|
||||
CursorH = 1;
|
||||
CursorH = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* no wrap, but cursor stays on screen */
|
||||
@ -1321,8 +1305,8 @@ DeleteChars(num) /* deletes <num> characters */
|
||||
|
||||
void
|
||||
Insert_write(cp, num) /* Puts terminal in insert character mode, */
|
||||
register Char *cp;
|
||||
register int num; /* or inserts num characters in the line */
|
||||
Char *cp;
|
||||
int num; /* or inserts num characters in the line */
|
||||
{
|
||||
if (num <= 0)
|
||||
return;
|
||||
@ -1352,10 +1336,7 @@ Insert_write(cp, num) /* Puts terminal in insert character mode, */
|
||||
if (GoodStr(T_im) && GoodStr(T_ei)) { /* if I have insert mode */
|
||||
(void) tputs(Str(T_im), 1, PUTPURE);
|
||||
|
||||
CursorH += num;
|
||||
do
|
||||
(void) putraw(*cp++);
|
||||
while (--num);
|
||||
so_write(cp, num); /* this updates CursorH/V */
|
||||
|
||||
if (GoodStr(T_ip)) /* have to make num chars insert */
|
||||
(void) tputs(Str(T_ip), 1, PUTPURE);
|
||||
@ -1368,9 +1349,7 @@ Insert_write(cp, num) /* Puts terminal in insert character mode, */
|
||||
if (GoodStr(T_ic)) /* have to make num chars insert */
|
||||
(void) tputs(Str(T_ic), 1, PUTPURE); /* insert a char */
|
||||
|
||||
(void) putraw(*cp++);
|
||||
|
||||
CursorH++;
|
||||
so_write(cp++, 1); /* this updates CursorH/V */
|
||||
|
||||
if (GoodStr(T_ip)) /* have to make num chars insert */
|
||||
(void) tputs(Str(T_ip), 1, PUTPURE);/* pad the inserted char */
|
||||
@ -1383,7 +1362,7 @@ void
|
||||
ClearEOL(num) /* clear to end of line. There are num */
|
||||
int num; /* characters to clear */
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (num <= 0)
|
||||
return;
|
||||
@ -1442,8 +1421,8 @@ ClearToBottom()
|
||||
void
|
||||
GetTermCaps()
|
||||
{ /* read in the needed terminal capabilites */
|
||||
register int i;
|
||||
char *ptr;
|
||||
int i;
|
||||
const char *ptr;
|
||||
char buf[TC_BUFSIZE];
|
||||
static char bp[TC_BUFSIZE];
|
||||
char *area;
|
||||
@ -1657,7 +1636,6 @@ ChangeSize(lins, cols)
|
||||
if ((tptr = getenv("TERMCAP")) != NULL) {
|
||||
/* Leave 64 characters slop in case we enlarge the termcap string */
|
||||
Char termcap[1024+64], backup[1024+64], *ptr;
|
||||
int i;
|
||||
|
||||
ptr = str2short(tptr);
|
||||
(void) Strncpy(termcap, ptr, 1024);
|
||||
@ -1672,11 +1650,11 @@ ChangeSize(lins, cols)
|
||||
(void) Strcpy(backup, termcap);
|
||||
}
|
||||
else {
|
||||
i = (int) (ptr - termcap + Strlen(buf));
|
||||
(void) Strncpy(backup, termcap, (size_t) i);
|
||||
backup[i] = '\0';
|
||||
size_t len = (ptr - termcap) + Strlen(buf);
|
||||
(void) Strncpy(backup, termcap, len);
|
||||
backup[len] = '\0';
|
||||
(void) Itoa(Val(T_co), buf, 0, 0);
|
||||
(void) Strcat(backup + i, buf);
|
||||
(void) Strcat(backup + len, buf);
|
||||
ptr = Strchr(ptr, ':');
|
||||
(void) Strcat(backup, ptr);
|
||||
}
|
||||
@ -1690,9 +1668,9 @@ ChangeSize(lins, cols)
|
||||
(void) Strcpy(termcap, backup);
|
||||
}
|
||||
else {
|
||||
i = (int) (ptr - backup + Strlen(buf));
|
||||
(void) Strncpy(termcap, backup, (size_t) i);
|
||||
termcap[i] = '\0';
|
||||
size_t len = (ptr - backup) + Strlen(buf);
|
||||
(void) Strncpy(termcap, backup, len);
|
||||
termcap[len] = '\0';
|
||||
(void) Itoa(Val(T_li), buf, 0, 0);
|
||||
(void) Strcat(termcap, buf);
|
||||
ptr = Strchr(ptr, ':');
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/ed.term.c,v 1.29 2003/05/26 07:11:06 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/ed.term.c,v 1.31 2004/11/23 02:10:48 christos Exp $ */
|
||||
/*
|
||||
* ed.term.c: Low level terminal interface
|
||||
*/
|
||||
@ -33,7 +33,7 @@
|
||||
#include "sh.h"
|
||||
#ifndef WINNT_NATIVE
|
||||
|
||||
RCSID("$Id: ed.term.c,v 1.29 2003/05/26 07:11:06 christos Exp $")
|
||||
RCSID("$Id: ed.term.c,v 1.31 2004/11/23 02:10:48 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
|
||||
@ -85,7 +85,7 @@ ttyperm_t ttylist = {
|
||||
};
|
||||
|
||||
static struct tcshmodes {
|
||||
char *m_name;
|
||||
const char *m_name;
|
||||
#ifdef SOLARIS2
|
||||
unsigned long m_value;
|
||||
#else /* !SOLARIS2 */
|
||||
@ -1092,7 +1092,7 @@ tty_setdisc(fd, dis)
|
||||
int fd;
|
||||
int dis;
|
||||
{
|
||||
static bool edit_discipline = 0;
|
||||
static int edit_discipline = 0;
|
||||
static union txname tx_disc;
|
||||
extern char strPOSIX[];
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/ed.term.h,v 1.16 2002/07/06 22:28:13 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/ed.term.h,v 1.17 2004/12/25 21:15:06 christos Exp $ */
|
||||
/*
|
||||
* ed.term.h: Local terminal header
|
||||
*/
|
||||
@ -453,7 +453,7 @@
|
||||
* Also for RH6.2 on the alpha, defined TIOCGLTC, but does not have
|
||||
* struct ltchars
|
||||
*/
|
||||
#if (defined(hpux) && defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT)) || defined(__linux__)
|
||||
#if (defined(hpux) && defined(VSUSP) && defined(VDSUSP) && defined(VWERASE) && defined(VLNEXT)) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
|
||||
# undef TIOCGLTC /* not really needed */
|
||||
# undef TIOCSLTC
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/ed.xmap.c,v 3.25 2002/03/08 17:36:45 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/ed.xmap.c,v 3.28 2005/01/05 18:06:43 christos Exp $ */
|
||||
/*
|
||||
* ed.xmap.c: This module contains the procedures for maintaining
|
||||
* the extended-key map.
|
||||
@ -88,7 +88,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: ed.xmap.c,v 3.25 2002/03/08 17:36:45 christos Exp $")
|
||||
RCSID("$Id: ed.xmap.c,v 3.28 2005/01/05 18:06:43 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
#include "ed.defns.h"
|
||||
@ -592,7 +592,7 @@ printOne(key, val, ntype)
|
||||
{
|
||||
struct KeyFuncs *fp;
|
||||
unsigned char unparsbuf[200];
|
||||
static char *fmt = "%s\n";
|
||||
static const char *fmt = "%s\n";
|
||||
|
||||
xprintf("%-15S-> ", key->buf);
|
||||
if (val != NULL)
|
||||
@ -675,7 +675,7 @@ unparsech(cnt, ch)
|
||||
return cnt;
|
||||
}
|
||||
|
||||
int
|
||||
eChar
|
||||
parseescape(ptr)
|
||||
const Char **ptr;
|
||||
{
|
||||
@ -686,7 +686,7 @@ parseescape(ptr)
|
||||
|
||||
if ((p[1] & CHAR) == 0) {
|
||||
xprintf(CGETS(9, 8, "Something must follow: %c\n"), *p);
|
||||
return -1;
|
||||
return CHAR_ERR;
|
||||
}
|
||||
if ((*p & CHAR) == '\\') {
|
||||
p++;
|
||||
@ -727,7 +727,8 @@ parseescape(ptr)
|
||||
case '6':
|
||||
case '7':
|
||||
{
|
||||
register int cnt, val, ch;
|
||||
int cnt, val;
|
||||
Char ch;
|
||||
|
||||
for (cnt = 0, val = 0; cnt < 3; cnt++) {
|
||||
ch = *p++ & CHAR;
|
||||
@ -822,9 +823,8 @@ unparsestring(str, buf, sep)
|
||||
*b++ = '\\';
|
||||
*b++ = (unsigned char) p;
|
||||
}
|
||||
else if (p == ' ' || (Isprint(p) && !Isspace(p))) {
|
||||
*b++ = (unsigned char) p;
|
||||
}
|
||||
else if (p == ' ' || (Isprint(p) && !Isspace(p)))
|
||||
b += one_wctomb((char *)b, p & CHAR);
|
||||
else {
|
||||
*b++ = '\\';
|
||||
*b++ = ((p >> 6) & 7) + '0';
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/gethost.c,v 1.9 2002/12/04 12:30:55 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/gethost.c,v 1.10 2005/01/05 16:06:13 christos Exp $ */
|
||||
/*
|
||||
* gethost.c: Create version file from prototype
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: gethost.c,v 1.9 2002/12/04 12:30:55 christos Exp $")
|
||||
RCSID("$Id: gethost.c,v 1.10 2005/01/05 16:06:13 christos Exp $")
|
||||
|
||||
#ifdef SCO
|
||||
# define perror __perror
|
||||
@ -50,12 +50,6 @@ RCSID("$Id: gethost.c,v 1.9 2002/12/04 12:30:55 christos Exp $")
|
||||
|
||||
#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')
|
||||
|
||||
/*
|
||||
|
@ -51,20 +51,14 @@ static char sccsid[] = "@(#)glob.c 5.12 (Berkeley) 6/24/91";
|
||||
* 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_NATIVE
|
||||
#pragma warning(disable:4244)
|
||||
#endif /* WINNT_NATIVE */
|
||||
|
||||
#define Char __Char
|
||||
#include "sh.h"
|
||||
#include "glob.h"
|
||||
|
||||
#undef Char
|
||||
#undef QUOTE
|
||||
#undef TILDE
|
||||
@ -73,8 +67,6 @@ typedef void * ptr_t;
|
||||
#undef ismeta
|
||||
#undef Strchr
|
||||
|
||||
#include "glob.h"
|
||||
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(a) (((a) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
@ -147,9 +139,31 @@ static void qprintf __P((Char *));
|
||||
|
||||
int
|
||||
globcharcoll(c1, c2, cs)
|
||||
int c1, c2, cs;
|
||||
NLSChar c1, c2;
|
||||
int cs;
|
||||
{
|
||||
#if defined(NLS) && defined(LC_COLLATE) && !defined(NOSTRCOLL)
|
||||
# if defined(SHORT_STRINGS)
|
||||
wchar_t s1[2], s2[2];
|
||||
|
||||
if (c1 == c2)
|
||||
return (0);
|
||||
if (cs) {
|
||||
c1 = towlower(c1);
|
||||
c2 = towlower(c2);
|
||||
} else {
|
||||
/* This should not be here, but I'll rather leave it in than engage in
|
||||
a LC_COLLATE flamewar about a shell I don't use... */
|
||||
if (iswlower(c1) && iswupper(c2))
|
||||
return (1);
|
||||
if (iswupper(c1) && iswlower(c2))
|
||||
return (-1);
|
||||
}
|
||||
s1[0] = c1;
|
||||
s2[0] = c2;
|
||||
s1[1] = s2[1] = '\0';
|
||||
return wcscoll(s1, s2);
|
||||
# else /* not SHORT_STRINGS */
|
||||
char s1[2], s2[2];
|
||||
|
||||
if (c1 == c2)
|
||||
@ -164,11 +178,14 @@ globcharcoll(c1, c2, cs)
|
||||
} else {
|
||||
if (islower(c1) && isupper(c2))
|
||||
return (1);
|
||||
if (isupper(c1) && islower(c2))
|
||||
return (-1);
|
||||
}
|
||||
s1[0] = c1;
|
||||
s2[0] = c2;
|
||||
s1[1] = s2[1] = '\0';
|
||||
return strcoll(s1, s2);
|
||||
# endif
|
||||
#else
|
||||
return (c1 - c2);
|
||||
#endif
|
||||
@ -183,10 +200,10 @@ globcharcoll(c1, c2, cs)
|
||||
|
||||
static DIR *
|
||||
Opendir(str)
|
||||
register Char *str;
|
||||
Char *str;
|
||||
{
|
||||
char buf[GLOBBUFLEN];
|
||||
register char *dc = buf;
|
||||
char *dc = buf;
|
||||
#if defined(hpux) || defined(__hpux)
|
||||
struct stat st;
|
||||
#endif
|
||||
@ -208,11 +225,11 @@ Opendir(str)
|
||||
#ifdef S_IFLNK
|
||||
static int
|
||||
Lstat(fn, sb)
|
||||
register Char *fn;
|
||||
Char *fn;
|
||||
struct stat *sb;
|
||||
{
|
||||
char buf[GLOBBUFLEN];
|
||||
register char *dc = buf;
|
||||
char *dc = buf;
|
||||
|
||||
while ((*dc++ = *fn++) != '\0')
|
||||
continue;
|
||||
@ -235,11 +252,11 @@ Lstat(fn, sb)
|
||||
|
||||
static int
|
||||
Stat(fn, sb)
|
||||
register Char *fn;
|
||||
Char *fn;
|
||||
struct stat *sb;
|
||||
{
|
||||
char buf[GLOBBUFLEN];
|
||||
register char *dc = buf;
|
||||
char *dc = buf;
|
||||
|
||||
while ((*dc++ = *fn++) != '\0')
|
||||
continue;
|
||||
@ -319,10 +336,15 @@ glob(pattern, flags, errfunc, pglob)
|
||||
Char *bufnext, *bufend, *compilebuf, m_not;
|
||||
const unsigned char *compilepat, *patnext;
|
||||
int c, not;
|
||||
Char patbuf[GLOBBUFLEN + 1], *qpatnext;
|
||||
Char *qpatnext;
|
||||
#ifdef WIDE_STRINGS
|
||||
Char patbuf[GLOBBUFLEN + MB_LEN_MAX + 1];
|
||||
#else
|
||||
Char patbuf[GLOBBUFLEN + 1];
|
||||
#endif
|
||||
int no_match;
|
||||
|
||||
patnext = (unsigned char *) pattern;
|
||||
patnext = (const unsigned char *) pattern;
|
||||
if (!(flags & GLOB_APPEND)) {
|
||||
pglob->gl_pathc = 0;
|
||||
pglob->gl_pathv = NULL;
|
||||
@ -354,15 +376,19 @@ glob(pattern, flags, errfunc, pglob)
|
||||
|
||||
if (flags & GLOB_QUOTE) {
|
||||
/* Protect the quoted characters */
|
||||
while (bufnext < bufend && (c = *patnext++) != EOS)
|
||||
#ifdef DSPMBYTE
|
||||
if (Ismbyte1(c) && *patnext != EOS)
|
||||
{
|
||||
*bufnext++ = (Char) c;
|
||||
*bufnext++ = (Char) *patnext++;
|
||||
}
|
||||
else
|
||||
#endif /* DSPMBYTE */
|
||||
while (bufnext < bufend && (c = *patnext++) != EOS) {
|
||||
#ifdef WIDE_STRINGS
|
||||
int len;
|
||||
|
||||
len = mblen((const char *)(patnext - 1), MB_LEN_MAX);
|
||||
if (len == -1)
|
||||
mblen(NULL, 0);
|
||||
if (len > 1) {
|
||||
*bufnext++ = (Char) c;
|
||||
while (--len != 0)
|
||||
*bufnext++ = (Char) (*patnext++ | M_PROTECT);
|
||||
} else
|
||||
#endif /* WIDE_STRINGS */
|
||||
if (c == QUOTE) {
|
||||
if ((c = *patnext++) == EOS) {
|
||||
c = QUOTE;
|
||||
@ -372,6 +398,7 @@ glob(pattern, flags, errfunc, pglob)
|
||||
}
|
||||
else
|
||||
*bufnext++ = (Char) c;
|
||||
}
|
||||
}
|
||||
else
|
||||
while (bufnext < bufend && (c = *patnext++) != EOS)
|
||||
@ -382,14 +409,6 @@ glob(pattern, flags, errfunc, pglob)
|
||||
qpatnext = patbuf;
|
||||
/* we don't need to check for buffer overflow any more */
|
||||
while ((c = *qpatnext++) != EOS) {
|
||||
#ifdef DSPMBYTE
|
||||
if (Ismbyte1(c) && *qpatnext != EOS)
|
||||
{
|
||||
*bufnext++ = CHAR(c);
|
||||
*bufnext++ = CHAR(*qpatnext++);
|
||||
}
|
||||
else
|
||||
#endif /* DSPMBYTE */
|
||||
switch (c) {
|
||||
case LBRACKET:
|
||||
c = *qpatnext;
|
||||
@ -593,8 +612,8 @@ glob3(pathbuf, pathend, pattern, restpattern, pglob, no_match)
|
||||
|
||||
/* search directory for matching names */
|
||||
while ((dp = readdir(dirp)) != NULL) {
|
||||
register unsigned char *sc;
|
||||
register Char *dc;
|
||||
unsigned char *sc;
|
||||
Char *dc;
|
||||
|
||||
/* initial DOT must be matched literally */
|
||||
if (dp->d_name[0] == DOT && *pattern != DOT)
|
||||
@ -635,8 +654,8 @@ globextend(path, pglob)
|
||||
Char *path;
|
||||
glob_t *pglob;
|
||||
{
|
||||
register char **pathv;
|
||||
register int i;
|
||||
char **pathv;
|
||||
int i;
|
||||
unsigned int newsize;
|
||||
char *copy;
|
||||
Char *p;
|
||||
@ -659,8 +678,8 @@ globextend(path, pglob)
|
||||
for (p = path; *p++;)
|
||||
continue;
|
||||
if ((copy = (char *) xmalloc((size_t) (p - path))) != NULL) {
|
||||
register char *dc = copy;
|
||||
register Char *sc = path;
|
||||
char *dc = copy;
|
||||
Char *sc = path;
|
||||
|
||||
while ((*dc++ = *sc++) != '\0')
|
||||
continue;
|
||||
@ -671,55 +690,88 @@ globextend(path, pglob)
|
||||
}
|
||||
|
||||
|
||||
static size_t
|
||||
One_mbtowc(NLSChar *pwc, const Char *s, size_t n)
|
||||
{
|
||||
#ifdef WIDE_STRINGS
|
||||
char buf[MB_LEN_MAX], *p;
|
||||
|
||||
if (n > MB_LEN_MAX)
|
||||
n = MB_LEN_MAX;
|
||||
p = buf;
|
||||
while (p < buf + n && (*p++ = CHAR(*s++)) != 0)
|
||||
;
|
||||
return one_mbtowc(pwc, buf, n);
|
||||
#else
|
||||
return NLSFrom(s, n, pwc);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
Char *name, *pat, *patend;
|
||||
int m_not;
|
||||
{
|
||||
int ok, negate_range;
|
||||
Char c, k;
|
||||
|
||||
while (pat < patend) {
|
||||
c = *pat++;
|
||||
size_t lwk;
|
||||
NLSChar wc, wk;
|
||||
|
||||
USE(k);
|
||||
c = *pat; /* Only for M_MASK bits */
|
||||
pat += One_mbtowc(&wc, pat, MB_LEN_MAX);
|
||||
lwk = One_mbtowc(&wk, name, MB_LEN_MAX);
|
||||
switch (c & M_MASK) {
|
||||
case M_ALL:
|
||||
if (pat == patend)
|
||||
return (1);
|
||||
do
|
||||
for (;;) {
|
||||
if (match(name, pat, patend, m_not))
|
||||
return (1);
|
||||
while (*name++ != EOS);
|
||||
if (*name == EOS)
|
||||
break;
|
||||
name += lwk;
|
||||
lwk = One_mbtowc(&wk, name, MB_LEN_MAX);
|
||||
}
|
||||
return (0);
|
||||
case M_ONE:
|
||||
if (*name++ == EOS)
|
||||
if (*name == EOS)
|
||||
return (0);
|
||||
name += lwk;
|
||||
break;
|
||||
case M_SET:
|
||||
ok = 0;
|
||||
if ((k = *name++) == EOS)
|
||||
if (*name == EOS)
|
||||
return (0);
|
||||
name += lwk;
|
||||
if ((negate_range = ((*pat & M_MASK) == m_not)) != 0)
|
||||
++pat;
|
||||
while (((c = *pat++) & M_MASK) != M_END) {
|
||||
while ((*pat & M_MASK) != M_END) {
|
||||
pat += One_mbtowc(&wc, pat, MB_LEN_MAX);
|
||||
if ((*pat & M_MASK) == M_RNG) {
|
||||
if (globcharcoll(CHAR(c), CHAR(k), 0) <= 0 &&
|
||||
globcharcoll(CHAR(k), CHAR(pat[1]), 0) <= 0)
|
||||
NLSChar wc2;
|
||||
|
||||
pat++;
|
||||
pat += One_mbtowc(&wc2, pat, MB_LEN_MAX);
|
||||
if (globcharcoll(wc, wk, 0) <= 0 &&
|
||||
globcharcoll(wk, wc2, 0) <= 0)
|
||||
ok = 1;
|
||||
pat += 2;
|
||||
}
|
||||
else if (c == k)
|
||||
} else if (wc == wk)
|
||||
ok = 1;
|
||||
}
|
||||
pat += One_mbtowc(&wc, pat, MB_LEN_MAX);
|
||||
if (ok == negate_range)
|
||||
return (0);
|
||||
break;
|
||||
default:
|
||||
k = *name++;
|
||||
if (samecase(k) != samecase(c))
|
||||
name += lwk;
|
||||
if (samecase(wk) != samecase(wc))
|
||||
return (0);
|
||||
break;
|
||||
}
|
||||
@ -732,8 +784,8 @@ void
|
||||
globfree(pglob)
|
||||
glob_t *pglob;
|
||||
{
|
||||
register int i;
|
||||
register char **pp;
|
||||
int i;
|
||||
char **pp;
|
||||
|
||||
if (pglob->gl_pathv != NULL) {
|
||||
pp = pglob->gl_pathv + pglob->gl_offs;
|
||||
|
@ -84,8 +84,10 @@ typedef struct {
|
||||
#define GLOB_ABEND GLOB_ABORTED /* source compatibility */
|
||||
/* #endif */
|
||||
|
||||
#include "tc.nls.h"
|
||||
|
||||
int glob __P((const char *, int, int (*)(const char *, int), glob_t *));
|
||||
void globfree __P((glob_t *));
|
||||
int globcharcoll __P((int, int, int));
|
||||
int globcharcoll __P((NLSChar, NLSChar, int));
|
||||
|
||||
#endif /* !_GLOB_H_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
newcode :
|
||||
/* $Header: /src/pub/tcsh/host.defs,v 1.36 2003/02/08 20:03:25 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/host.defs,v 1.40 2005/03/03 16:49:15 kim Exp $ */
|
||||
/*
|
||||
* host.defs: Hosttype/Machtype etc.
|
||||
*/
|
||||
@ -33,7 +33,7 @@ newcode :
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: host.defs,v 1.36 2003/02/08 20:03:25 christos Exp $")
|
||||
RCSID("$Id: host.defs,v 1.40 2005/03/03 16:49:15 kim Exp $")
|
||||
|
||||
endcode :
|
||||
|
||||
@ -174,10 +174,10 @@ newcode :
|
||||
void
|
||||
getmachine()
|
||||
{
|
||||
char *hosttype;
|
||||
char *ostype;
|
||||
char *vendor;
|
||||
char *machtype;
|
||||
const char *hosttype;
|
||||
const char *ostype;
|
||||
const char *vendor;
|
||||
const char *machtype;
|
||||
|
||||
endcode :
|
||||
|
||||
@ -435,14 +435,24 @@ machtype: defined(M_i386) : "i386"
|
||||
enddef :
|
||||
|
||||
|
||||
newdef : defined(linux)
|
||||
newdef : defined(linux) || defined(__GNU__) || defined(__GLIBC__)
|
||||
comment : Linus Torvalds's linux
|
||||
vendor : defined(M_intel) : "intel"
|
||||
hosttype: defined(__ia64__) : "ia64-linux"
|
||||
hosttype: defined(__powerpc64__) : "powerpc64-linux"
|
||||
hosttype: defined(__s390x__) : "s390x-linux"
|
||||
hosttype: defined(__s390__) : "s390-linux"
|
||||
hosttype: defined(__x86_64__) : "x86_64-linux"
|
||||
hosttype: defined(M_i586) : "i586-linux"
|
||||
hosttype: defined(M_i486) : "i486-linux"
|
||||
hosttype: defined(M_i386) : "i386-linux"
|
||||
ostype : !defined(PPC) : "linux"
|
||||
ostype : defined(PPC) : "mklinux"
|
||||
machtype: defined(__ia64__) : "ia64"
|
||||
machtype: defined(__powerpc64__) : "powerpc64"
|
||||
machtype: defined(__s390x__) : "s390x"
|
||||
machtype: defined(__s390__) : "s390"
|
||||
machtype: defined(__x86_64__) : "x86_64"
|
||||
machtype: defined(M_i586) : "i586"
|
||||
machtype: defined(M_i486) : "i486"
|
||||
machtype: defined(M_i386) : "i386"
|
||||
@ -996,9 +1006,9 @@ machtype: : "clipper"
|
||||
enddef :
|
||||
|
||||
|
||||
newdef : defined(SNI) || defined(sinix)
|
||||
comment : Siemens Nixdorf Informationssysteme SINIX
|
||||
vendor : : "sni"
|
||||
newdef : (defined(SNI) || defined(sinix)) && !defined(_OSD_POSIX)
|
||||
comment : Fujitsu Siemens Computers (former "Siemens Nixdorf Informationssysteme"): SINIX aka. ReliantUNIX, a SVR4 derivative
|
||||
vendor : : "fsc"
|
||||
hosttype: defined(M_intel) : "wx200i"
|
||||
hosttype: defined(MIPSEB) : "rm400"
|
||||
ostype : defined(sinix) : "sinix"
|
||||
@ -1011,10 +1021,13 @@ machtype: : "mips"
|
||||
enddef :
|
||||
|
||||
newdef : defined(_OSD_POSIX)
|
||||
comment : Siemens Nixdorf Informationssysteme BS2000 POSIX (mainframe, EBCDIC)
|
||||
vendor : : "sni"
|
||||
hosttype: defined(M_intel) : "bs2000"
|
||||
ostype : : "posix"
|
||||
comment : Fujitsu Siemens Computers (former "Siemens Nixdorf Informationssysteme"): BS2000 POSIX (mainframe, EBCDIC)
|
||||
vendor : : "fsc"
|
||||
hosttype: : "bs2000"
|
||||
ostype : : "osdposix"
|
||||
machtype: #machine(7500) : "s390"
|
||||
machtype: #machine(mips) : "mips"
|
||||
machtype: #machine(sparc) : "sparc"
|
||||
machtype: : "bs2000"
|
||||
enddef :
|
||||
|
||||
|
@ -1,19 +1,38 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
|
||||
scriptversion=2004-12-17.09
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# 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.
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
@ -23,13 +42,11 @@
|
||||
# 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}"
|
||||
@ -41,211 +58,266 @@ stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
chowncmd=
|
||||
chgrpcmd=
|
||||
stripcmd=
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dstarg=
|
||||
no_target_directory=
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
Options:
|
||||
-c (ignored)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
while test -n "$1"; do
|
||||
case $1 in
|
||||
-c) shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
--help) echo "$usage"; exit 0;;
|
||||
|
||||
*) 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
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
-s) stripcmd=$stripprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
# 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}"
|
||||
-t) dstarg=$2
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
-T) no_target_directory=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
--version) echo "$0 $scriptversion"; exit 0;;
|
||||
|
||||
*) # When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
test -n "$dir_arg$dstarg" && break
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dstarg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dstarg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dstarg=$arg
|
||||
done
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test -z "$1"; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src ;;
|
||||
esac
|
||||
|
||||
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 test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
src=
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
if test -d "$dst"; then
|
||||
mkdircmd=:
|
||||
chmodcmd=
|
||||
else
|
||||
mkdircmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
if test -z "$dstarg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
dst=$dstarg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst ;;
|
||||
esac
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dstarg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst/`basename "$src"`
|
||||
fi
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
# This sed command emulates the dirname command.
|
||||
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
# Make sure that the destination directory exists.
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if test ! -d "$dstdir"; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-$defaultIFS}"
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
oIFS=$IFS
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
shift
|
||||
IFS=$oIFS
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
pathcomp=
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
while test $# -ne 0 ; do
|
||||
pathcomp=$pathcomp$1
|
||||
shift
|
||||
if test ! -d "$pathcomp"; then
|
||||
$mkdirprog "$pathcomp"
|
||||
# mkdir can fail with a `File exist' error in case several
|
||||
# install-sh are creating the directory concurrently. This
|
||||
# is OK.
|
||||
test -d "$pathcomp" || exit
|
||||
fi
|
||||
pathcomp=$pathcomp/
|
||||
done
|
||||
fi
|
||||
|
||||
# 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 test -n "$dir_arg"; then
|
||||
$doit $mkdircmd "$dst" \
|
||||
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
|
||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
|
||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
|
||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
|
||||
|
||||
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 &&
|
||||
else
|
||||
dstfile=`basename "$dst"`
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
fi &&
|
||||
# Copy the file name to the temp name.
|
||||
$doit $cpprog "$src" "$dsttmp" &&
|
||||
|
||||
# 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 $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
|
||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
|
||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
|
||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
|
||||
|
||||
exit 0
|
||||
# Now rename the file to the real destination.
|
||||
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|
||||
|| {
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
if test -f "$dstdir/$dstfile"; then
|
||||
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|
||||
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|
||||
|| {
|
||||
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
else
|
||||
:
|
||||
fi
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
||||
}
|
||||
}
|
||||
fi || { (exit 1); exit 1; }
|
||||
done
|
||||
|
||||
# The final little trick to "correctly" pass the exit status to the exit trap.
|
||||
{
|
||||
(exit 0); exit 0
|
||||
}
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
|
@ -82,7 +82,7 @@
|
||||
**********************************************************************
|
||||
*/
|
||||
#include "sh.h"
|
||||
RCSID("$Id: ma.setp.c,v 1.13 2003/05/26 07:11:06 christos Exp $")
|
||||
RCSID("$Id: ma.setp.c,v 1.14 2004/08/04 17:12:28 christos Exp $")
|
||||
|
||||
#ifdef MACH
|
||||
|
||||
@ -153,11 +153,11 @@ static int locate __P((struct pelem *, char *));
|
||||
|
||||
int
|
||||
setpath(paths, cmds, localsyspath, dosuffix, printerrors)
|
||||
register char **paths, **cmds, *localsyspath;
|
||||
char **paths, **cmds, *localsyspath;
|
||||
int dosuffix, printerrors;
|
||||
{
|
||||
register char *cmd, *cmd1, *cmd2;
|
||||
register int ncmd;
|
||||
char *cmd, *cmd1, *cmd2;
|
||||
int ncmd;
|
||||
|
||||
sflag = dosuffix;
|
||||
eflag = printerrors;
|
||||
@ -231,11 +231,11 @@ int dosuffix, printerrors;
|
||||
|
||||
static int
|
||||
initpaths(paths)
|
||||
register char **paths;
|
||||
char **paths;
|
||||
{
|
||||
register char *path, *val, *p, *q;
|
||||
register int i, done;
|
||||
register struct pelem *pe, *pathend;
|
||||
char *path, *val, *p, *q;
|
||||
int i, done;
|
||||
struct pelem *pe, *pathend;
|
||||
|
||||
freepaths();
|
||||
for (npaths = 0; path = paths[npaths]; npaths++) {
|
||||
@ -284,11 +284,11 @@ register char **paths;
|
||||
|
||||
static void
|
||||
savepaths(paths)
|
||||
register char **paths;
|
||||
char **paths;
|
||||
{
|
||||
register char *p, *q;
|
||||
register int npath, i, len;
|
||||
register struct pelem *pe;
|
||||
char *p, *q;
|
||||
int npath, i, len;
|
||||
struct pelem *pe;
|
||||
|
||||
for (npath = 0, pe = pathhead; pe; npath++, pe = pe->pnext) {
|
||||
len = strlen(pe->pname) + 1;
|
||||
@ -314,9 +314,9 @@ register char **paths;
|
||||
static void
|
||||
freepaths()
|
||||
{
|
||||
register char *p;
|
||||
register int i;
|
||||
register struct pelem *pe;
|
||||
char *p;
|
||||
int i;
|
||||
struct pelem *pe;
|
||||
|
||||
if (npaths == 0 || pathhead == NULL)
|
||||
return;
|
||||
@ -348,9 +348,9 @@ static void
|
||||
rcmd(localsyspath) /* reset path with localsyspath */
|
||||
char *localsyspath;
|
||||
{
|
||||
register int n, done;
|
||||
register char *new, *p;
|
||||
register struct pelem *pe;
|
||||
int n, done;
|
||||
char *new, *p;
|
||||
struct pelem *pe;
|
||||
char newbuf[MAXPATHLEN+1];
|
||||
|
||||
for (pe = pathhead; pe; pe = pe->pnext) {
|
||||
@ -392,9 +392,9 @@ static void
|
||||
icmd(path, localsyspath) /* insert path before localsyspath */
|
||||
char *path, *localsyspath;
|
||||
{
|
||||
register int n;
|
||||
register char *new;
|
||||
register struct pelem *pe;
|
||||
int n;
|
||||
char *new;
|
||||
struct pelem *pe;
|
||||
char newbuf[MAXPATHLEN+1];
|
||||
|
||||
for (pe = pathhead; pe; pe = pe->pnext) {
|
||||
@ -417,8 +417,8 @@ static void
|
||||
iacmd(inpath, path) /* insert path after inpath */
|
||||
char *inpath, *path;
|
||||
{
|
||||
register int n;
|
||||
register struct pelem *pe;
|
||||
int n;
|
||||
struct pelem *pe;
|
||||
|
||||
for (pe = pathhead; pe; pe = pe->pnext) {
|
||||
n = locate(pe, inpath);
|
||||
@ -434,8 +434,8 @@ static void
|
||||
ibcmd(inpath, path) /* insert path before inpath */
|
||||
char *inpath, *path;
|
||||
{
|
||||
register int n;
|
||||
register struct pelem *pe;
|
||||
int n;
|
||||
struct pelem *pe;
|
||||
|
||||
for (pe = pathhead; pe; pe = pe->pnext) {
|
||||
n = locate(pe, inpath);
|
||||
@ -452,7 +452,7 @@ incmd(path, n) /* insert path at position n */
|
||||
char *path;
|
||||
int n;
|
||||
{
|
||||
register struct pelem *pe;
|
||||
struct pelem *pe;
|
||||
|
||||
for (pe = pathhead; pe; pe = pe->pnext)
|
||||
insert(pe, n, path);
|
||||
@ -460,12 +460,12 @@ int n;
|
||||
|
||||
static void
|
||||
insert(pe, loc, key)
|
||||
register struct pelem *pe;
|
||||
register int loc;
|
||||
register char *key;
|
||||
struct pelem *pe;
|
||||
int loc;
|
||||
char *key;
|
||||
{
|
||||
register int i;
|
||||
register char *new;
|
||||
int i;
|
||||
char *new;
|
||||
char newbuf[2000];
|
||||
|
||||
if (sflag) { /* add suffix */
|
||||
@ -491,8 +491,8 @@ static void
|
||||
dcmd(path) /* delete path */
|
||||
char *path;
|
||||
{
|
||||
register int n;
|
||||
register struct pelem *pe;
|
||||
int n;
|
||||
struct pelem *pe;
|
||||
|
||||
for (pe = pathhead; pe; pe = pe->pnext) {
|
||||
n = locate(pe, path);
|
||||
@ -508,7 +508,7 @@ static void
|
||||
dncmd(n) /* delete at position n */
|
||||
int n;
|
||||
{
|
||||
register struct pelem *pe;
|
||||
struct pelem *pe;
|
||||
|
||||
for (pe = pathhead; pe; pe = pe->pnext) {
|
||||
if (n < pe->pdirs)
|
||||
@ -522,10 +522,10 @@ int n;
|
||||
|
||||
static void
|
||||
delete(pe, n)
|
||||
register struct pelem *pe;
|
||||
struct pelem *pe;
|
||||
int n;
|
||||
{
|
||||
register int d;
|
||||
int d;
|
||||
|
||||
xfree((ptr_t) (pe->pdir[n]));
|
||||
for (d = n; d < pe->pdirs - 1; d++)
|
||||
@ -541,8 +541,8 @@ static void
|
||||
ccmd(inpath, path) /* change inpath to path */
|
||||
char *inpath, *path;
|
||||
{
|
||||
register int n;
|
||||
register struct pelem *pe;
|
||||
int n;
|
||||
struct pelem *pe;
|
||||
|
||||
for (pe = pathhead; pe; pe = pe->pnext) {
|
||||
n = locate(pe, inpath);
|
||||
@ -559,7 +559,7 @@ cncmd(path, n) /* change at position n to path */
|
||||
char *path;
|
||||
int n;
|
||||
{
|
||||
register struct pelem *pe;
|
||||
struct pelem *pe;
|
||||
|
||||
for (pe = pathhead; pe; pe = pe->pnext) {
|
||||
if (n < pe->pdirs)
|
||||
@ -573,11 +573,11 @@ int n;
|
||||
|
||||
static void
|
||||
change(pe, loc, key)
|
||||
register struct pelem *pe;
|
||||
register int loc;
|
||||
register char *key;
|
||||
struct pelem *pe;
|
||||
int loc;
|
||||
char *key;
|
||||
{
|
||||
register char *new;
|
||||
char *new;
|
||||
char newbuf[MAXPATHLEN+1];
|
||||
|
||||
if (sflag) { /* append suffix */
|
||||
@ -597,11 +597,11 @@ register char *key;
|
||||
|
||||
static int
|
||||
locate(pe, key)
|
||||
register struct pelem *pe;
|
||||
register char *key;
|
||||
struct pelem *pe;
|
||||
char *key;
|
||||
{
|
||||
register int i;
|
||||
register char *realkey;
|
||||
int i;
|
||||
char *realkey;
|
||||
char keybuf[MAXPATHLEN+1];
|
||||
|
||||
if (sflag) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
$ $Id: set11,v 1.2 1995/03/19 18:07:15 christos Exp $
|
||||
$ $Id: set11,v 1.3 2005/03/21 21:26:37 kim Exp $
|
||||
$ sh.c
|
||||
$set 11
|
||||
1 Warning: no access to tty (%s).\n
|
||||
@ -8,3 +8,24 @@ $set 11
|
||||
5 You have %smail.\n
|
||||
6 new
|
||||
7 You have %smail in %s.\n
|
||||
8 -b file batch mode, read and execute commands from `file' \n\
|
||||
-c command run `command' from next argument \n\
|
||||
-d load directory stack from `~/.cshdirs' \n\
|
||||
-Dname[=value] define environment variable `name' to `value' (DomainOS only) \n\
|
||||
-e exit on any error \n\
|
||||
-f start faster by ignoring the start-up file \n\
|
||||
-F use fork() instead of vfork() when spawning (ConvexOS only) \n\
|
||||
-i interactive, even when input is not from a terminal \n\
|
||||
-l act as a login shell, must be the only option specified \n\
|
||||
-m load the start-up file, whether or not owned by effective user \n\
|
||||
-n file no execute mode, just check syntax of the following `file' \n\
|
||||
-q accept SIGQUIT for running under a debugger \n\
|
||||
-s read commands from standard input \n\
|
||||
-t read one line from standard input \n\
|
||||
-v echo commands after history substitution \n\
|
||||
-V like -v but including commands read from the start-up file \n\
|
||||
-x echo commands immediately before execution \n\
|
||||
-X like -x but including commands read from the start-up file \n\
|
||||
--help print this message and exit \n\
|
||||
--version print the version shell variable and exit \n\
|
||||
\nSee the tcsh(1) manual page for detailed information.\n
|
||||
|
@ -1,32 +1,33 @@
|
||||
$ $Id: set1,v 1.3 1999/05/11 13:08:29 christos Exp $
|
||||
$ $Id: set1,v 1.4 2004/12/25 22:24:58 christos Exp $
|
||||
$ Error messages
|
||||
$set 1
|
||||
1 文法が間違っています
|
||||
3 文章が長すぎます
|
||||
2 %s は割り当てられていません
|
||||
3 文字列が長すぎます
|
||||
4 $< の行が長すぎます
|
||||
5 $0 用のファイルがありません
|
||||
6 [] 修飾子が不完全です
|
||||
7 $ 展開は ] の前に終わる必要があります
|
||||
8 $ 内の : 修飾子が間違っています (%c)
|
||||
9 配列の添え字が間違っています
|
||||
10 不適切に生成された番号です
|
||||
10 番号が正しい書式になっていません
|
||||
11 文字列はもうありません
|
||||
12 ファイル名が間違っています
|
||||
12 ファイル名が間違っているかファイルが存在しません
|
||||
13 globの内部エラーです
|
||||
14 コマンドが見つかりません
|
||||
15 アーギュメントが不足しています
|
||||
16 アーギュメントが多過ぎます
|
||||
15 引数が不足しています
|
||||
16 引数が多過ぎます
|
||||
17 危険なエイリアス定義です
|
||||
18 ifがありません
|
||||
18 if文の中に条件がありません
|
||||
19 間違ったthenです
|
||||
20 文字列が括弧内にありません
|
||||
21 %s が見つかりません
|
||||
22 間違ったmaskです
|
||||
23 そのようなlimit値はありません
|
||||
24 アーギュメントが長すぎます
|
||||
24 引数が長すぎます
|
||||
25 オプション単位が不明か間違っています
|
||||
26 変数を定義していません
|
||||
27 ディレクトリースタックの番号指定が深過ぎます
|
||||
26 定義されていない変数です
|
||||
27 ディレクトリースタックの指定が深過ぎます
|
||||
28 シグナル番号が間違っています
|
||||
29 シグナルの名前が間違っています "kill -l"で見る事が出来ます
|
||||
30 変数名は英字で始める必要があります
|
||||
@ -37,7 +38,7 @@ $set 1
|
||||
35 ホームディレクトリーがありません
|
||||
36 ホームディレクトリーに変更できません
|
||||
37 不正なヌルコマンドです
|
||||
38 式が間違っている割当があります
|
||||
38 代入式が欠けている箇所があります
|
||||
39 定義されていない演算子です
|
||||
40 曖昧です
|
||||
41 %sと言うファイルはすでに存在します
|
||||
@ -50,8 +51,8 @@ $set 1
|
||||
48 while/foreachの中ではありません
|
||||
49 プロセスを生成できません
|
||||
50 照合パターンに合いません
|
||||
51 間違った %c です
|
||||
52 %c が一致しません
|
||||
51 %c が欠けている箇所があります
|
||||
52 %c が対応しません
|
||||
53 メモリが不足しています
|
||||
54 パイプを作れません
|
||||
55 %s: %s
|
||||
@ -61,7 +62,7 @@ $set 1
|
||||
59 カレントのjobはありません
|
||||
60 前のjobはありません
|
||||
61 ジョブがパターンに一致しません
|
||||
62 Forkの深さが %dを超えました; おそらくループです
|
||||
62 Forkの深さが %dを超えました; おそらく``のネストが深すぎる為です。
|
||||
63 このsubshellではジョブコントロールは使用できません
|
||||
64 sync失敗: プロセス %d が見つかりません
|
||||
65 %s中断したjobが残っています
|
||||
@ -74,23 +75,23 @@ $set 1
|
||||
72 ログインシェルではありません
|
||||
73 0で割り算しました
|
||||
74 0で割り算しました(余り計算)
|
||||
75 間違ったオプション単位: "%s"の意味は?
|
||||
75 間違ったオプション単位です: "%s"ではありませんか?
|
||||
76 ログインシェルなので中断できません
|
||||
77 %sというユーザーは存在しません
|
||||
78 $home変数が設定されていません
|
||||
79 形式: history [-%s] [# number of events]
|
||||
80 $, ! もしくは < は $# もしくは $? と一緒には使用できません
|
||||
78 変数$homeが設定されていません
|
||||
79 形式: history [-%s] [イベント番号]
|
||||
80 $、 ! もしくは < は $# もしくは $? と一緒には使用できません
|
||||
81 変数名に改行が入っています
|
||||
82 * は $# もしくは $? と一緒には使用できません
|
||||
83 $?<digit> もしくは $#<digit> は使用できません
|
||||
83 $?<数字> もしくは $#<数字> は使用できません
|
||||
84 変数名が不正です
|
||||
85 変数インデックスに改行が入っています
|
||||
86 拡張バッファーオーバーフロー
|
||||
86 展開用バッファーオーバーフロー
|
||||
87 変数構文?
|
||||
88 間違った ! 形式です
|
||||
88 間違った ! の書式です
|
||||
89 前の置換はありません
|
||||
90 不正な置換です
|
||||
91 左サイドがありません
|
||||
91 直前の左サイドがありません
|
||||
92 右サイドが長過ぎます
|
||||
93 間違った ! 修飾子です: %c
|
||||
94 修飾子の失敗です
|
||||
@ -101,15 +102,15 @@ $set 1
|
||||
99 ")"が多すぎます
|
||||
100 "("が多すぎます
|
||||
101 ( の場所が間違っています
|
||||
102 リダイレクト向けの名前が間違っています
|
||||
103 曖昧なリダイレクト出力です
|
||||
104 () に対して << は使えません
|
||||
105 曖昧なリダイレクト入力です
|
||||
102 リダイレクト先の名前が欠けています
|
||||
103 曖昧な出力リダイレクトです
|
||||
104 () の中で << は使えません
|
||||
105 曖昧な入力リダイレクトです
|
||||
106 () の場所が間違っています
|
||||
107 エイリアスの無限ループが発生しました
|
||||
107 エイリアスがループしています
|
||||
108 変数"$watch"が設定されていません
|
||||
109 スケジュールにイベントは設定されていません
|
||||
110 形式: sched -<item#>.\nUsage: sched [+]hh:mm <command>
|
||||
109 スケジュールされたイベントはありません
|
||||
110 形式: sched -<項目番号>.\n形式: sched [+]hh:mm <コマンド>
|
||||
111 スケジュールされたイベントはありません
|
||||
112 実行できるコマンドはありません
|
||||
113 不正なイベント開始時間です
|
||||
@ -118,8 +119,8 @@ $set 1
|
||||
116 形式: settc %s [yes|no]
|
||||
117 知らないcapability `%s'
|
||||
118 知らないtermcapパラメタ `%%%c'
|
||||
119 `%s' 向けのアーギュメントが多過ぎます (%d)
|
||||
120 `%s' は %d アーギュメントが必要です
|
||||
119 `%s' に対する引数が多過ぎます (%d)
|
||||
120 `%s' には %d 引数が必要です
|
||||
121 形式: echotc [-v|-s] [<capability> [<args>]]
|
||||
122 %s: %s. 間違ったアーキテクチャです
|
||||
123 !# ヒストリーのループ
|
||||
@ -136,4 +137,4 @@ $set 1
|
||||
134 形式: unlimit [-fh] [limits]
|
||||
135 $%S は読取専用です
|
||||
136 jobが見つかりません
|
||||
137 不明のcolorls設定です `%c%c'
|
||||
137 不明のcolorls変数です `%c%c'
|
||||
|
124
contrib/tcsh/nls/ja/set3
Normal file
124
contrib/tcsh/nls/ja/set3
Normal file
@ -0,0 +1,124 @@
|
||||
$ $Id: set3,v 1.4 2001/04/26 19:07:48 kim Exp $
|
||||
$ Editor function descriptions
|
||||
$set 3
|
||||
1 1文字戻る
|
||||
2 カーソル位置の文字を削除
|
||||
3 現在のワードの先頭からカーソルまでを削除 - カットバッファーに保存
|
||||
4 行頭からカーソルまでを削除 - カットバッファーに保存
|
||||
5 現在のワードの先頭に移動
|
||||
6 行頭に移動
|
||||
7 カーソル位置からワードの末尾までをキャピタライズ
|
||||
8 カーソル位置の大文字小文字を変換し、1文字移動(vi)
|
||||
9 行末までを変更(vi)
|
||||
10 画面クリアして現在行を画面の最上行に
|
||||
11 現在のワードを補完
|
||||
12 Tab forward through files
|
||||
13 Tab backward through files
|
||||
14 プログラム可能な補完を使わない現在のワードの補完
|
||||
15 現在のワードのカーソル位置までをコピー
|
||||
16 マーク位置からカーソルまでの領域をカットバッファーにコピー
|
||||
17 Expand to preceding word for which this is a prefix
|
||||
18 カーソル位置の文字を削除
|
||||
19 カーソル位置の文字を削除。空行ではend of fileを示す
|
||||
20 カーソル位置の文字を削除。行末では補完候補一覧
|
||||
21 カーソル位置の文字を削除。end of fileをsignalもしくは補完候補一覧
|
||||
22 カーソル位置から現在のワードの末尾までを削除。カットバッファーに保存。
|
||||
23 Adds to argument if started or enters digit
|
||||
24 Digit that starts argument
|
||||
25 次の履歴行に移動
|
||||
26 カーソル位置から現在のワードの末尾までを小文字にする
|
||||
27 ファイル終端を表示
|
||||
28 行末にカーソルを移動
|
||||
29 カーソルとマークを入れ替える
|
||||
30 ファイル名のワイルドカードを展開
|
||||
31 履歴エスケイプを展開
|
||||
32 行中の履歴エスケイプを展開
|
||||
33 変数を展開
|
||||
34 1文字進む
|
||||
35 現在のワード末まで移動
|
||||
36 カーソルの前の2文字を入れ替える
|
||||
37 現在行と同じように始まるものを履歴中から後ろ向きに検索
|
||||
38 現在行と同じように始まるものを履歴中から前向きに検索
|
||||
39 前のコマンドの最後の項目を挿入
|
||||
40 順方向インクリメンタル検索
|
||||
41 逆方向インクリメンタル検索
|
||||
42 1行クリア
|
||||
43 行末まで削除してカットバッファーに保存
|
||||
44 マーク位置からカーソルまでの領域を削除してカットバッファーに保存
|
||||
45 1行全体を削除してカットバッファーに保存
|
||||
46 補完候補の一覧
|
||||
47 プログラム可能な補完を使用しない補完候補の一覧
|
||||
48 ワイルドカードに合致するファイル名の一覧
|
||||
49 補完候補の一覧。空行の場合はend of fileを示す。
|
||||
50 平均負荷と現在のプロセスの状態を表示
|
||||
51 履歴エスケイプを展開して空白を挿入
|
||||
52 コマンド実行
|
||||
53 パス名を展開(.や..で始まるものを除く)
|
||||
54 コマンドを実際のパス名や別名に展開
|
||||
55 挿入モードから上書きモードへの切り替えもしくはその逆
|
||||
56 次に打つ文字の8bitめを立てる
|
||||
57 次に打つ文字を行にそのまま加える
|
||||
58 すべてを再描画
|
||||
59 停止していたエディターを再起動
|
||||
60 現在のコマンドのヘルプを探す
|
||||
61 この文字は行に加えられる
|
||||
62 この文字は文字シーケンスの先頭
|
||||
63 カーソル位置をマークする
|
||||
64 現在のワードの綴りを訂正
|
||||
65 1行全体の綴りを訂正C
|
||||
66 文字をcockedモードでttyに送る
|
||||
67 Toggle between literal and lexical current history line
|
||||
68 カーソルの左の文字を1つ小さいものにする
|
||||
69 カーソルの前の2つの文字を入れ替える
|
||||
70 delayed suspend文字を試す
|
||||
71 flush output文字を試す
|
||||
72 interrupt文字を試す
|
||||
73 quit文字を試す
|
||||
74 suspend文字を試す
|
||||
75 allow output文字を試す
|
||||
76 disallow文字を試す
|
||||
77 割り当てられていない文字を表示
|
||||
78 Emacs universal argument (argument times 4)
|
||||
79 1つ前の履歴行に移動
|
||||
80 カーソル位置から現在のワードの末尾までを大文字にする
|
||||
81 次のワードの先頭へ移動(vi)
|
||||
82 カーソルの後ろへ挿入モードへ移行(vi)
|
||||
83 カーソル位置に挿入モードへ移行(vi)
|
||||
84 カーソル位置の大文字小文字を変換し、1文字進む(vi)
|
||||
85 Vi change prefix command
|
||||
86 行末までを変更(vi)
|
||||
87 コマンドモードへ移行 (キー割り当て変更)(vi)
|
||||
88 コマンドモードでの現在のワードの補完(vi)
|
||||
89 前の文字に移動(バックスペイス)(vi)
|
||||
90 Vi delete prefix command
|
||||
91 現在のワード間の空白の末尾に移動(vi)
|
||||
92 現在のワードの末尾に移動(vi)
|
||||
93 逆方向の指定された文字に移動(vi)
|
||||
94 順方法の指定された文字に移動(vi)
|
||||
95 逆方向の指定された文字の直前まで移動(vi)
|
||||
96 順方向の指定された文字の直前まで移動(vi)
|
||||
97 viの挿入モードに移行
|
||||
98 行頭でviの挿入モードに移行
|
||||
99 現在の1文字検索を同じ方向に繰り返す(vi)
|
||||
100 現在の1文字検索を反対方向に繰り返す(vi)
|
||||
101 現在の検索を同じ方向に繰り返す(vi)
|
||||
102 現在の検索を反対方向に繰り返す(vi)
|
||||
103 位置の1文字を次に打つ1文字と置換(vi)
|
||||
104 置換モードreplace mode(vi)
|
||||
105 逆方向履歴検索(vi)
|
||||
106 順方向履歴検索(vi)
|
||||
107 カーソル位置の文字を置換して挿入モードに移行(vi)
|
||||
108 1行全置換(vi)
|
||||
109 前のワードへ移動(vi)
|
||||
110 次のワードへ移行(vi)
|
||||
111 直前の変更を取り消す(vi)
|
||||
112 行の先頭へ移動(vi)
|
||||
113 Perform which of current command
|
||||
114 カットバッファーの内容をカーソル位置に貼り付ける
|
||||
115 Replace just-yanked text with yank from earlier kill
|
||||
116 (WIN32のみ) カットバッファーの内容をシステムのクリップボードにコピー
|
||||
117 (WIN32のみ) クリップボードの内容をカーソル位置に貼り付け
|
||||
118 (WIN32のみ) 次のワード中の'/'をすべて'\\\\'に変換
|
||||
119 (WIN32のみ) 前のワード中の'/'をすべて'\\\\'に変換
|
||||
120 (WIN32のみ) Page visible console window up
|
||||
121 (WIN32のみ) Page visible console window down
|
45
contrib/tcsh/nls/ja/set4
Normal file
45
contrib/tcsh/nls/ja/set4
Normal file
@ -0,0 +1,45 @@
|
||||
$ $Id: set4,v 1.2 1995/03/19 18:07:15 christos Exp $
|
||||
$ Termcap strings
|
||||
$set 4
|
||||
1 新規空行追加
|
||||
2 可聴性ベル
|
||||
3 最下行までクリア
|
||||
4 行末までクリア
|
||||
5 カーソル水平移動
|
||||
6 画面クリア
|
||||
7 1文字削除
|
||||
8 1行削除
|
||||
9 削除モード開始
|
||||
10 削除モード終了
|
||||
11 挿入モード終了
|
||||
12 cursor from status line
|
||||
13 カーソルをホーム位置へ
|
||||
14 文字挿入
|
||||
15 挿入モード開始
|
||||
16 パディング挿入
|
||||
17 カーソル下移動
|
||||
18 カーソル左移動
|
||||
19 カーソル右移動
|
||||
20 カーソル上移動
|
||||
21 ボールド開始
|
||||
22 属性終了
|
||||
23 分割禁止空白
|
||||
24 強調終了
|
||||
25 強調開始
|
||||
26 カーソルをステイタス行へ
|
||||
27 カーソルを1つ上へ
|
||||
28 下線開始
|
||||
29 下線終了
|
||||
30 視覚的ベル
|
||||
31 複数文字削除
|
||||
32 カーソル下移動(multiple)
|
||||
33 複数文字挿入
|
||||
34 カーソルj左移動(multiple)
|
||||
35 カーソル右移動(multiple)
|
||||
36 カーソル上移動(multiple)
|
||||
37 自動マージン可能
|
||||
38 物理タブ使用可能
|
||||
39 行数
|
||||
40 桁数
|
||||
41 メタキーあり
|
||||
42 右マージンを無視した改行
|
30
contrib/tcsh/nls/ja/set7
Normal file
30
contrib/tcsh/nls/ja/set7
Normal file
@ -0,0 +1,30 @@
|
||||
$ $Id: set7,v 1.1 2005/03/23 01:25:47 kim Exp $
|
||||
$ ed.screen.c
|
||||
$set 7
|
||||
1 \n\tTcsh の推測では、あなたの端末は\n
|
||||
2 \t以下の特性を持っています:\n\n
|
||||
3 \t%d 桁 %d 行\n
|
||||
4 \tmeta キーを%s\n
|
||||
5 持っています
|
||||
6 持っていません
|
||||
7 \ttab を使う%s\n
|
||||
8 ことができません
|
||||
9 \t自動マージンを%s\n
|
||||
10 持っています
|
||||
11 持っていません
|
||||
12 \tマジックマージンを%s\n
|
||||
13 (未定義)
|
||||
14 ある
|
||||
15 ない
|
||||
16 エラー: 削除できません\r\n
|
||||
17 DeleteChars: ありえない数値です: %d\r\n
|
||||
18 エラー: 挿入できません\r\n
|
||||
19 StartInsert: ありえない数値です: %d\r\n
|
||||
20 %s: /etc/termcap を開くことができません.\n
|
||||
21 %s: ターミナルタイプ "%s" は登録されていません\n
|
||||
22 %s: ダム端末の設定を使います\n
|
||||
23 %s: 警告: あなたの端末は move up できません.\n
|
||||
24 長い行のため編集がおかしくなっています.\n
|
||||
25 行末まで消去するための機能がありません.\n
|
||||
26 文字削除の機能がありません.\n
|
||||
27 文字挿入の機能がありません.\n
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/patchlevel.h,v 3.139 2004/05/19 17:13:20 kim Exp $ */
|
||||
/* $Header: /src/pub/tcsh/patchlevel.h,v 3.151 2005/03/25 17:36:08 kim Exp $ */
|
||||
/*
|
||||
* patchlevel.h: Our life story.
|
||||
*/
|
||||
@ -7,8 +7,8 @@
|
||||
|
||||
#define ORIGIN "Astron"
|
||||
#define REV 6
|
||||
#define VERS 13
|
||||
#define PATCHLEVEL 00
|
||||
#define DATE "2004-05-19"
|
||||
#define VERS 14
|
||||
#define PATCHLEVEL 0
|
||||
#define DATE "2005-03-25"
|
||||
|
||||
#endif /* _h_patchlevel */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.c,v 3.109 2004/02/21 20:34:24 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.c,v 3.123 2005/03/21 21:26:36 kim Exp $ */
|
||||
/*
|
||||
* sh.c: Main shell routines
|
||||
*/
|
||||
@ -39,15 +39,14 @@ char copyright[] =
|
||||
All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
RCSID("$Id: sh.c,v 3.109 2004/02/21 20:34:24 christos Exp $")
|
||||
RCSID("$Id: sh.c,v 3.123 2005/03/21 21:26:36 kim Exp $")
|
||||
|
||||
#include "tc.h"
|
||||
#include "ed.h"
|
||||
#include "tw.h"
|
||||
|
||||
extern bool MapsAreInited;
|
||||
extern bool NLSMapsAreInited;
|
||||
extern bool NoNLSRebind;
|
||||
extern int MapsAreInited;
|
||||
extern int NLSMapsAreInited;
|
||||
|
||||
/*
|
||||
* C Shell
|
||||
@ -94,7 +93,7 @@ int do_logout = 0;
|
||||
#endif /* TESLA */
|
||||
|
||||
|
||||
bool use_fork = 0; /* use fork() instead of vfork()? */
|
||||
int use_fork = 0; /* use fork() instead of vfork()? */
|
||||
|
||||
/*
|
||||
* Magic pointer values. Used to specify other invalid conditions aside
|
||||
@ -105,20 +104,20 @@ Char *INVPTR = &INVCHAR;
|
||||
Char **INVPPTR = &INVPTR;
|
||||
|
||||
static int nofile = 0;
|
||||
static bool reenter = 0;
|
||||
static bool nverbose = 0;
|
||||
static bool nexececho = 0;
|
||||
static bool quitit = 0;
|
||||
static bool rdirs = 0;
|
||||
bool fast = 0;
|
||||
static bool batch = 0;
|
||||
static bool mflag = 0;
|
||||
static bool prompt = 1;
|
||||
static int enterhist = 0;
|
||||
bool tellwhat = 0;
|
||||
static int reenter = 0;
|
||||
static int nverbose = 0;
|
||||
static int nexececho = 0;
|
||||
static int quitit = 0;
|
||||
static int rdirs = 0;
|
||||
int fast = 0;
|
||||
static int batch = 0;
|
||||
static int mflag = 0;
|
||||
static int prompt = 1;
|
||||
int enterhist = 0;
|
||||
int tellwhat = 0;
|
||||
time_t t_period;
|
||||
Char *ffile = NULL;
|
||||
bool dolzero = 0;
|
||||
int dolzero = 0;
|
||||
int insource = 0;
|
||||
int exitset = 0;
|
||||
static time_t chktim; /* Time mail last checked */
|
||||
@ -145,10 +144,10 @@ struct saved_state {
|
||||
Char *alvecp;
|
||||
Char **alvec;
|
||||
int onelflg;
|
||||
bool enterhist;
|
||||
int enterhist;
|
||||
Char **argv;
|
||||
Char HIST;
|
||||
bool cantell;
|
||||
int cantell;
|
||||
struct Bin B;
|
||||
/* These keep signal state and setjump state */
|
||||
#ifdef BSDSIGS
|
||||
@ -160,12 +159,12 @@ struct saved_state {
|
||||
|
||||
static int srccat __P((Char *, Char *));
|
||||
#ifndef WINNT_NATIVE
|
||||
static int srcfile __P((char *, bool, int, Char **));
|
||||
static int srcfile __P((const char *, int, int, Char **));
|
||||
#else
|
||||
int srcfile __P((char *, bool, int, Char **));
|
||||
int srcfile __P((const char *, int, int, Char **));
|
||||
#endif /*WINNT_NATIVE*/
|
||||
static sigret_t phup __P((int));
|
||||
static void srcunit __P((int, bool, int, Char **));
|
||||
static RETSIGTYPE phup __P((int));
|
||||
static void srcunit __P((int, int, int, Char **));
|
||||
static void mailchk __P((void));
|
||||
#ifndef _PATH_DEFPATH
|
||||
static Char **defaultpath __P((void));
|
||||
@ -182,13 +181,13 @@ main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
#ifdef AUTOLOGOUT
|
||||
register Char *cp2;
|
||||
Char *cp2;
|
||||
#endif
|
||||
register char *tcp, *ttyn;
|
||||
register int f;
|
||||
register char **tempv;
|
||||
char *tcp, *ttyn;
|
||||
int f;
|
||||
char **tempv;
|
||||
int osetintr;
|
||||
signalfun_t oparintr;
|
||||
|
||||
@ -212,10 +211,9 @@ main(argc, argv)
|
||||
nlsinit();
|
||||
|
||||
#ifdef MALLOC_TRACE
|
||||
mal_setstatsfile(fdopen(dup2(open("/tmp/tcsh.trace",
|
||||
O_WRONLY|O_CREAT|O_LARGEFILE, 0666), 25),
|
||||
"w"));
|
||||
mal_trace(1);
|
||||
mal_setstatsfile(fdopen(dmove(open("/tmp/tcsh.trace",
|
||||
O_WRONLY|O_CREAT|O_LARGEFILE, 0666), 25), "w"));
|
||||
mal_trace(1);
|
||||
#endif /* MALLOC_TRACE */
|
||||
|
||||
#if !(defined(BSDTIMES) || defined(_SEQUENT_)) && defined(POSIX)
|
||||
@ -364,7 +362,7 @@ main(argc, argv)
|
||||
|
||||
for (k = 0200; k <= 0377 && !Isprint(k); k++)
|
||||
continue;
|
||||
AsciiOnly = k > 0377;
|
||||
AsciiOnly = MB_CUR_MAX == 1 && k > 0377;
|
||||
}
|
||||
#else
|
||||
AsciiOnly = getenv("LANG") == NULL && getenv("LC_CTYPE") == NULL;
|
||||
@ -675,6 +673,11 @@ main(argc, argv)
|
||||
*/
|
||||
set(STRaddsuffix, Strsave(STRNULL), VAR_READWRITE);
|
||||
|
||||
/*
|
||||
* Compatibility with tcsh >= 6.12 by default
|
||||
*/
|
||||
set(STRcsubstnonl, Strsave(STRNULL), VAR_READWRITE);
|
||||
|
||||
/*
|
||||
* Random default kill ring size
|
||||
*/
|
||||
@ -801,6 +804,11 @@ main(argc, argv)
|
||||
xprintf("%S\n", varval(STRversion));
|
||||
xexit(0);
|
||||
}
|
||||
if (argc > 1 && strcmp(argv[1], "--help") == 0) {
|
||||
xprintf("%S\n\n", varval(STRversion));
|
||||
xprintf(CGETS(11, 8, HELP_STRING));
|
||||
xexit(0);
|
||||
}
|
||||
/*
|
||||
* Process the arguments.
|
||||
*
|
||||
@ -856,7 +864,7 @@ main(argc, argv)
|
||||
* ensure that you don't make * nonportable csh scripts.
|
||||
*/
|
||||
{
|
||||
register int count;
|
||||
int count;
|
||||
|
||||
cp = arginp + Strlen(arginp);
|
||||
count = 0;
|
||||
@ -877,7 +885,7 @@ main(argc, argv)
|
||||
#ifdef apollo
|
||||
case 'D': /* -D Define environment variable */
|
||||
{
|
||||
register Char *dp;
|
||||
Char *dp;
|
||||
|
||||
cp = str2short(tcp);
|
||||
if (dp = Strchr(cp, '=')) {
|
||||
@ -1391,9 +1399,9 @@ void
|
||||
importpath(cp)
|
||||
Char *cp;
|
||||
{
|
||||
register int i = 0;
|
||||
register Char *dp;
|
||||
register Char **pv;
|
||||
int i = 0;
|
||||
Char *dp;
|
||||
Char **pv;
|
||||
int c;
|
||||
|
||||
for (dp = cp; *dp; dp++)
|
||||
@ -1438,7 +1446,7 @@ srccat(cp, dp)
|
||||
if (cp[0] == '/' && cp[1] == '\0')
|
||||
return srcfile(short2str(dp), (mflag ? 0 : 1), 0, NULL);
|
||||
else {
|
||||
register Char *ep;
|
||||
Char *ep;
|
||||
char *ptr;
|
||||
int rv;
|
||||
|
||||
@ -1468,12 +1476,12 @@ static int
|
||||
int
|
||||
#endif /*WINNT_NATIVE*/
|
||||
srcfile(f, onlyown, flag, av)
|
||||
char *f;
|
||||
bool onlyown;
|
||||
const char *f;
|
||||
int onlyown;
|
||||
int flag;
|
||||
Char **av;
|
||||
{
|
||||
register int unit;
|
||||
int unit;
|
||||
|
||||
if ((unit = open(f, O_RDONLY|O_LARGEFILE)) == -1)
|
||||
return 0;
|
||||
@ -1516,12 +1524,21 @@ st_save(st, unit, hflg, al, av)
|
||||
st->OLDSTD = st->SHOUT = st->SHDIAG = -1;/* test later to restore these */
|
||||
if (didfds) {
|
||||
struct stat s1, s2;
|
||||
if (NEED_SAVE_FD(0,OLDSTD))
|
||||
st->OLDSTD = OLDSTD, OLDSTD = dmove(0, -1);
|
||||
if (NEED_SAVE_FD(1,SHOUT))
|
||||
st->SHOUT = SHOUT, SHOUT = dmove(1, -1);
|
||||
if (NEED_SAVE_FD(2,SHDIAG))
|
||||
st->SHDIAG = SHDIAG, SHDIAG = dmove(2, -1);
|
||||
if (NEED_SAVE_FD(0,OLDSTD)) {
|
||||
st->OLDSTD = OLDSTD;
|
||||
OLDSTD = dmove(0, -1);
|
||||
(void)close_on_exec(OLDSTD, 1);
|
||||
}
|
||||
if (NEED_SAVE_FD(1,SHOUT)) {
|
||||
st->SHOUT = SHOUT;
|
||||
SHOUT = dmove(1, -1);
|
||||
(void)close_on_exec(SHOUT, 1);
|
||||
}
|
||||
if (NEED_SAVE_FD(2,SHDIAG)) {
|
||||
st->SHDIAG = SHDIAG;
|
||||
SHDIAG = dmove(2, -1);
|
||||
(void)close_on_exec(SHDIAG, 1);
|
||||
}
|
||||
donefds();
|
||||
}
|
||||
|
||||
@ -1596,9 +1613,9 @@ st_restore(st, av)
|
||||
|
||||
/* Reset input arena */
|
||||
{
|
||||
register int i;
|
||||
register Char** nfbuf = fbuf;
|
||||
register int nfblocks = fblocks;
|
||||
int i;
|
||||
Char** nfbuf = fbuf;
|
||||
int nfblocks = fblocks;
|
||||
|
||||
fblocks = 0;
|
||||
fbuf = NULL;
|
||||
@ -1644,8 +1661,8 @@ st_restore(st, av)
|
||||
*/
|
||||
static void
|
||||
srcunit(unit, onlyown, hflg, av)
|
||||
register int unit;
|
||||
bool onlyown;
|
||||
int unit;
|
||||
int onlyown;
|
||||
int hflg;
|
||||
Char **av;
|
||||
{
|
||||
@ -1731,6 +1748,7 @@ goodbye(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
USE(v);
|
||||
USE(c);
|
||||
record();
|
||||
|
||||
@ -1777,7 +1795,7 @@ exitstat()
|
||||
/*
|
||||
* in the event of a HUP we want to save the history
|
||||
*/
|
||||
static sigret_t
|
||||
static RETSIGTYPE
|
||||
phup(snum)
|
||||
int snum;
|
||||
{
|
||||
@ -1846,9 +1864,6 @@ int snum;
|
||||
#endif /* POSIXJOBS */
|
||||
|
||||
xexit(snum);
|
||||
#ifndef SIGVOID
|
||||
return (snum);
|
||||
#endif
|
||||
}
|
||||
|
||||
static Char *jobargv[2] = {STRjobs, 0};
|
||||
@ -1862,29 +1877,24 @@ static Char *jobargv[2] = {STRjobs, 0};
|
||||
*/
|
||||
int just_signaled; /* bugfix by Michael Bloom (mg@ttidca.TTI.COM) */
|
||||
|
||||
#ifdef SIGVOID
|
||||
/*ARGSUSED*/
|
||||
#endif
|
||||
sigret_t
|
||||
RETSIGTYPE
|
||||
pintr(snum)
|
||||
int snum;
|
||||
{
|
||||
USE(snum);
|
||||
#ifdef UNRELSIGS
|
||||
if (snum)
|
||||
(void) sigset(snum, pintr);
|
||||
#endif /* UNRELSIGS */
|
||||
just_signaled = 1;
|
||||
pintr1(1);
|
||||
#ifndef SIGVOID
|
||||
return (snum);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
pintr1(wantnl)
|
||||
bool wantnl;
|
||||
int wantnl;
|
||||
{
|
||||
register Char **v;
|
||||
Char **v;
|
||||
#ifdef BSDSIGS
|
||||
sigmask_t omask;
|
||||
#endif
|
||||
@ -1907,15 +1917,11 @@ pintr1(wantnl)
|
||||
}
|
||||
/* MH - handle interrupted completions specially */
|
||||
{
|
||||
extern int InsideCompletion;
|
||||
|
||||
if (InsideCompletion)
|
||||
stderror(ERR_SILENT);
|
||||
}
|
||||
/* JV - Make sure we shut off inputl */
|
||||
{
|
||||
extern Char GettingInput;
|
||||
|
||||
(void) Cookedmode();
|
||||
GettingInput = 0;
|
||||
}
|
||||
@ -1927,9 +1933,9 @@ pintr1(wantnl)
|
||||
(void) sigrelse(SIGCHLD);
|
||||
#endif
|
||||
drainoline();
|
||||
#if !defined(_VMS_POSIX) && !defined(WINNT_NATIVE)
|
||||
#ifdef HAVE_GETPWENT
|
||||
(void) endpwent();
|
||||
#endif /* !_VMS_POSIX && !WINNT_NATIVE */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If we have an active "onintr" then we search for the label. Note that if
|
||||
@ -1982,9 +1988,8 @@ pintr1(wantnl)
|
||||
static struct command *savet = NULL;
|
||||
void
|
||||
process(catch)
|
||||
bool catch;
|
||||
int catch;
|
||||
{
|
||||
extern char Expand;
|
||||
jmp_buf_t osetexit;
|
||||
/* PWP: This might get nuked my longjmp so don't make it a register var */
|
||||
struct command *t = savet;
|
||||
@ -2181,7 +2186,6 @@ process(catch)
|
||||
freesyn(savet), savet = NULL;
|
||||
#ifdef SIG_WINDOW
|
||||
if (windowchg || (catch && intty && !whyles && !tellwhat)) {
|
||||
windowchg = 0;
|
||||
(void) check_window_size(0); /* for window systems */
|
||||
}
|
||||
#endif /* SIG_WINDOW */
|
||||
@ -2194,12 +2198,11 @@ process(catch)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dosource(t, c)
|
||||
register Char **t;
|
||||
Char **t;
|
||||
struct command *c;
|
||||
{
|
||||
register Char *f;
|
||||
bool hflg = 0;
|
||||
extern int bequiet;
|
||||
Char *f;
|
||||
int hflg = 0;
|
||||
char buf[BUFSIZE];
|
||||
|
||||
USE(c);
|
||||
@ -2253,12 +2256,12 @@ dosource(t, c)
|
||||
static void
|
||||
mailchk()
|
||||
{
|
||||
register struct varent *v;
|
||||
register Char **vp;
|
||||
struct varent *v;
|
||||
Char **vp;
|
||||
time_t t;
|
||||
int intvl, cnt;
|
||||
struct stat stb;
|
||||
bool new;
|
||||
int new;
|
||||
|
||||
v = adrof(STRmail);
|
||||
if (v == NULL || v->vec == NULL)
|
||||
@ -2328,16 +2331,18 @@ mailchk()
|
||||
mailcount, filename);
|
||||
}
|
||||
else {
|
||||
char *type;
|
||||
|
||||
if (stb.st_size == 0 || stb.st_atime > stb.st_mtime ||
|
||||
(stb.st_atime <= chktim && stb.st_mtime <= chktim) ||
|
||||
(loginsh && !new))
|
||||
continue;
|
||||
type = strsave(new ? CGETS(11, 6, "new ") : "");
|
||||
if (cnt == 1)
|
||||
xprintf(CGETS(11, 5, "You have %smail.\n"),
|
||||
new ? CGETS(11, 6, "new ") : "");
|
||||
xprintf(CGETS(11, 5, "You have %smail.\n"), type);
|
||||
else
|
||||
xprintf(CGETS(11, 7, "You have %smail in %s.\n"),
|
||||
new ? CGETS(11, 6, "new ") : "", filename);
|
||||
xprintf(CGETS(11, 7, "You have %smail in %s.\n"), type, filename);
|
||||
xfree(type);
|
||||
}
|
||||
}
|
||||
chktim = t;
|
||||
@ -2387,7 +2392,7 @@ initdesc()
|
||||
{
|
||||
#ifdef NLS_BUGS
|
||||
#ifdef NLS_CATALOGS
|
||||
(void)catclose(catd);
|
||||
nlsclose();
|
||||
#endif /* NLS_CATALOGS */
|
||||
#endif /* NLS_BUGS */
|
||||
|
||||
@ -2462,7 +2467,7 @@ xexit(i)
|
||||
* because messages will stop working on the parent too.
|
||||
*/
|
||||
if (child == 0)
|
||||
(void) catclose(catd);
|
||||
nlsclose();
|
||||
#endif /* NLS_CATALOGS */
|
||||
#ifdef WINNT_NATIVE
|
||||
nt_cleanup();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.char.h,v 3.20 2002/07/01 20:50:21 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.char.h,v 3.26 2005/03/03 16:49:15 kim Exp $ */
|
||||
/*
|
||||
* sh.char.h: Table for spotting special characters quickly
|
||||
* Makes for very obscure but efficient coding.
|
||||
@ -37,6 +37,13 @@
|
||||
# include <appkit/NXCType.h>
|
||||
#else
|
||||
# include <ctype.h>
|
||||
# ifdef SHORT_STRINGS
|
||||
# ifdef HAVE_WCTYPE_H
|
||||
# include <wctype.h>
|
||||
# else
|
||||
# include <wchar.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef unsigned char tcshuc;
|
||||
@ -45,7 +52,6 @@ typedef unsigned char tcshuc;
|
||||
#endif /* _MINIX */
|
||||
extern unsigned short _cmap[];
|
||||
#if defined(DSPMBYTE)
|
||||
extern unsigned short _mbmap[];
|
||||
# define CHECK_MBYTEVAR STRdspmbyte
|
||||
#endif
|
||||
extern unsigned short _cmap_c[];
|
||||
@ -75,31 +81,26 @@ extern tcshuc _cmap_lower[], _cmap_upper[];
|
||||
#define _ESC 0x0040 /* \ */
|
||||
#define _DOL 0x0080 /* $ */
|
||||
#define _DIG 0x0100 /* 0-9 */
|
||||
#define _LET 0x0200 /* a-z, A-Z, _ */
|
||||
#define _UP 0x0400 /* A-Z */
|
||||
#define _DOW 0x0800 /* a-z */
|
||||
#define _LET 0x0200 /* a-z, A-Z, _, or locale-specific */
|
||||
#define _UP 0x0400 /* A-Z, or locale-specific */
|
||||
#define _DOW 0x0800 /* a-z, or locale-specific */
|
||||
#define _XD 0x1000 /* 0-9, a-f, A-F */
|
||||
#define _CMD 0x2000 /* lex end of command chars, ;&(|` */
|
||||
#define _CTR 0x4000 /* control */
|
||||
#define _PUN 0x8000 /* punctuation */
|
||||
|
||||
#if defined(SHORT_STRINGS) && defined(KANJI)
|
||||
#ifdef IS_ASCII
|
||||
# define ASC(ch) ch
|
||||
# define CTL_ESC(ch) ch
|
||||
# define cmap(c, bits) \
|
||||
((((c) & QUOTE) || ((c & 0x80) && adrof(STRnokanji))) ? \
|
||||
0 : (_cmap[(tcshuc)(c)] & (bits)))
|
||||
#else /* SHORT_STRINGS && KANJI */
|
||||
# ifdef IS_ASCII
|
||||
# define ASC(ch) ch
|
||||
# define CTL_ESC(ch) ch
|
||||
# define cmap(c, bits) \
|
||||
(((c) & QUOTE) ? 0 : (_cmap[(tcshuc)(c)] & (bits)))
|
||||
# else /* IS_ASCII */
|
||||
#else
|
||||
# ifdef _OSD_POSIX
|
||||
/* "BS2000 OSD" is a POSIX on a main frame using a EBCDIC char set */
|
||||
# include <ascii_ebcdic.h>
|
||||
# else
|
||||
/* "OS/390 USS" is a POSIX on a main frame using an IBM1047 char set */
|
||||
extern unsigned short _toascii[256];
|
||||
extern unsigned short _toebcdic[256];
|
||||
# endif
|
||||
extern unsigned short _toascii[256];
|
||||
extern unsigned short _toebcdic[256];
|
||||
|
||||
/* mainly for comparisons if (ASC(ch)=='\177')... */
|
||||
# define ASC(ch) _toascii[(tcshuc)ch]
|
||||
@ -108,27 +109,55 @@ extern unsigned short _toebcdic[256];
|
||||
* for C-Escapes ('\b'), the compiler already does it.
|
||||
*/
|
||||
# define CTL_ESC(ch) _toebcdic[(tcshuc)ch]
|
||||
#endif /*IS_ASCII*/
|
||||
|
||||
#ifdef WIDE_STRINGS
|
||||
# define cmap(c, bits) \
|
||||
(((c) & QUOTE) || (c) >= 0x0080 ? 0 : (_cmap[(tcshuc)ASC(c)] & (bits)))
|
||||
#elif defined(SHORT_STRINGS) && defined(KANJI)
|
||||
# define cmap(c, bits) \
|
||||
(((c) & QUOTE) ? 0 : (_cmap[_toascii[(tcshuc)(c)]] & (bits)))
|
||||
# endif /* IS_ASCII */
|
||||
((((c) & QUOTE) || ((ASC(c) & 0x80) && adrof(STRnokanji))) ? \
|
||||
0 : (_cmap[(tcshuc)ASC(c)] & (bits)))
|
||||
#else /* SHORT_STRINGS && KANJI */
|
||||
# define cmap(c, bits) \
|
||||
(((c) & QUOTE) ? 0 : (_cmap[(tcshuc)ASC(c)] & (bits)))
|
||||
#endif /* SHORT_STRINGS && KANJI */
|
||||
|
||||
#define isglob(c) cmap(c, _GLOB)
|
||||
#define isspc(c) cmap(c, _SP)
|
||||
#define ismeta(c) cmap(c, _META)
|
||||
#define iscmdmeta(c) cmap(c, _CMD)
|
||||
#define letter(c) (((Char)(c) & QUOTE) ? 0 : \
|
||||
#ifdef WIDE_STRINGS
|
||||
#define letter(c) (((c) & QUOTE) ? 0 : \
|
||||
(iswalpha((tcshuc) (c)) || (c) == '_'))
|
||||
#define alnum(c) (((c) & QUOTE) ? 0 : \
|
||||
(iswalnum((tcshuc) (c)) || (c) == '_'))
|
||||
#else
|
||||
#define letter(c) (((Char)(c) & QUOTE) ? 0 : \
|
||||
(isalpha((tcshuc) (c)) || (c) == '_'))
|
||||
#define alnum(c) (((Char)(c) & QUOTE) ? 0 : \
|
||||
#define alnum(c) (((Char)(c) & QUOTE) ? 0 : \
|
||||
(isalnum((tcshuc) (c)) || (c) == '_'))
|
||||
#endif
|
||||
|
||||
#if defined(DSPMBYTE)
|
||||
# define IsmbyteU(c) (Ismbyte1((Char)(c))||(Ismbyte2((Char)(c))&&((c)&0200)))
|
||||
#endif
|
||||
|
||||
#ifdef NLS
|
||||
# ifdef NeXT
|
||||
# ifdef WIDE_STRINGS
|
||||
# define Isspace(c) (((c) & QUOTE) ? 0 : iswspace(c))
|
||||
# define Isdigit(c) (((c) & QUOTE) ? 0 : iswdigit(c))
|
||||
# define Isalpha(c) (((c) & QUOTE) ? 0 : iswalpha(c))
|
||||
# define Islower(c) (((c) & QUOTE) ? 0 : iswlower(c))
|
||||
# define Isupper(c) (((c) & QUOTE) ? 0 : iswupper(c))
|
||||
# define Tolower(c) (((c) & QUOTE) ? 0 : (wchar_t)towlower(c))
|
||||
# define Toupper(c) (((c) & QUOTE) ? 0 : (wchar_t)towupper(c))
|
||||
# define Isxdigit(c) (((c) & QUOTE) ? 0 : iswxdigit(c))
|
||||
# define Isalnum(c) (((c) & QUOTE) ? 0 : iswalnum(c))
|
||||
# define Iscntrl(c) (((c) & QUOTE) ? 0 : iswcntrl(c))
|
||||
# define Isprint(c) (((c) & QUOTE) ? 0 : iswprint(c))
|
||||
# define Ispunct(c) (((c) & QUOTE) ? 0 : iswpunct(c))
|
||||
# elif defined (NeXT)
|
||||
# define Isspace(c) (((Char)(c) & QUOTE) ? 0 : NXIsSpace((unsigned) (c)))
|
||||
# define Isdigit(c) (((Char)(c) & QUOTE) ? 0 : NXIsDigit((unsigned) (c)))
|
||||
# define Isalpha(c) (((Char)(c) & QUOTE) ? 0 : NXIsAlpha((unsigned) (c)))
|
||||
@ -218,14 +247,8 @@ extern unsigned short _toebcdic[256];
|
||||
# define Isalpha(c) (cmap(c,_LET) && !(((c) & META) && AsciiOnly))
|
||||
# define Islower(c) (cmap(c,_DOW) && !(((c) & META) && AsciiOnly))
|
||||
# define Isupper(c) (cmap(c, _UP) && !(((c) & META) && AsciiOnly))
|
||||
# ifdef IS_ASCII
|
||||
# define Tolower(c) (_cmap_lower[(tcshuc)(c)])
|
||||
# define Toupper(c) (_cmap_upper[(tcshuc)(c)])
|
||||
# else
|
||||
/* "BS2000 OSD" is a POSIX on a main frame using a EBCDIC char set */
|
||||
# define Tolower(c) (_cmap_lower[_toascii[(tcshuc)(c)]])
|
||||
# define Toupper(c) (_cmap_upper[_toascii[(tcshuc)(c)]])
|
||||
# endif
|
||||
# define Tolower(c) (_cmap_lower[ASC(c)])
|
||||
# define Toupper(c) (_cmap_upper[ASC(c)])
|
||||
# define Isxdigit(c) cmap(c, _XD)
|
||||
# define Isalnum(c) (cmap(c, _DIG|_LET) && !(((Char)(c) & META) && AsciiOnly))
|
||||
#if defined(DSPMBYTE)
|
||||
@ -241,6 +264,14 @@ extern unsigned short _toebcdic[256];
|
||||
|
||||
#endif /* !NLS */
|
||||
|
||||
#if defined (SHORT_STRINGS) && defined (NLS)
|
||||
# define Iswcntrl(c) (((c) & QUOTE) ? 0 : iswcntrl(c))
|
||||
# define Iswprint(c) (((c) & QUOTE) ? 0 : iswprint(c))
|
||||
#else
|
||||
# define Iswcntrl(c) Iscntrl(c)
|
||||
# define Iswprint(c) Isprint(c)
|
||||
#endif
|
||||
|
||||
#if defined(DSPMBYTE)
|
||||
# define Ismbyte1(c) ((_mbmap[(c) & 0377] & _MB1) ? 1 : 0)
|
||||
# define Ismbyte2(c) ((_mbmap[(c) & 0377] & _MB2) ? 1 : 0)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.decls.h,v 3.39 2004/03/21 16:48:14 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.decls.h,v 3.46 2005/03/03 17:04:01 kim Exp $ */
|
||||
/*
|
||||
* sh.decls.h External declarations from sh*.c
|
||||
*/
|
||||
@ -42,9 +42,9 @@ extern void exitstat __P((void));
|
||||
extern void goodbye __P((Char **, struct command *));
|
||||
extern void importpath __P((Char *));
|
||||
extern void initdesc __P((void));
|
||||
extern sigret_t pintr __P((int));
|
||||
extern void pintr1 __P((bool));
|
||||
extern void process __P((bool));
|
||||
extern RETSIGTYPE pintr __P((int));
|
||||
extern void pintr1 __P((int));
|
||||
extern void process __P((int));
|
||||
extern void untty __P((void));
|
||||
#ifdef PROF
|
||||
extern void done __P((int));
|
||||
@ -87,13 +87,13 @@ extern void stderror __P((unsigned int, ...));
|
||||
/*
|
||||
* sh.exec.c
|
||||
*/
|
||||
extern void doexec __P((struct command *, bool));
|
||||
extern void doexec __P((struct command *, int));
|
||||
extern void dohash __P((Char **, struct command *));
|
||||
extern void dounhash __P((Char **, struct command *));
|
||||
extern void execash __P((Char **, struct command *));
|
||||
extern void hashstat __P((Char **, struct command *));
|
||||
extern void xechoit __P((Char **));
|
||||
extern int executable __P((Char *, Char *, bool));
|
||||
extern int executable __P((Char *, Char *, int));
|
||||
extern int tellmewhat __P((struct wordent *, Char *));
|
||||
extern void dowhere __P((Char **, struct command *));
|
||||
extern int find_cmd __P((Char *, int));
|
||||
@ -101,9 +101,9 @@ extern int find_cmd __P((Char *, int));
|
||||
/*
|
||||
* sh.exp.c
|
||||
*/
|
||||
extern Char *filetest __P((Char *, Char ***, bool));
|
||||
extern Char *filetest __P((Char *, Char ***, int));
|
||||
extern int expr __P((Char ***));
|
||||
extern int exp0 __P((Char ***, bool));
|
||||
extern int exp0 __P((Char ***, int));
|
||||
|
||||
/*
|
||||
* sh.file.c
|
||||
@ -115,7 +115,7 @@ extern int tenex __P((Char *, int));
|
||||
/*
|
||||
* sh.func.c
|
||||
*/
|
||||
extern void tsetenv __P((Char *, Char *));
|
||||
extern void tsetenv __P((const Char *, const Char *));
|
||||
extern void Unsetenv __P((Char *));
|
||||
extern void doalias __P((Char **, struct command *));
|
||||
extern void dobreak __P((Char **, struct command *));
|
||||
@ -165,31 +165,40 @@ extern void reexecute __P((struct command *));
|
||||
* sh.glob.c
|
||||
*/
|
||||
extern Char *globequal __P((Char *, Char *));
|
||||
extern Char **dobackp __P((Char *, bool));
|
||||
extern Char **dobackp __P((Char *, int));
|
||||
extern void Gcat __P((Char *, Char *));
|
||||
extern Char *globone __P((Char *, int));
|
||||
extern int Gmatch __P((Char *, Char *));
|
||||
extern int Gnmatch __P((Char *, Char *, Char **));
|
||||
extern void ginit __P((void));
|
||||
extern Char **globall __P((Char **));
|
||||
extern void rscan __P((Char **, void (*)(int)));
|
||||
extern void rscan __P((Char **, void (*)(Char)));
|
||||
extern void tglob __P((Char **));
|
||||
extern void trim __P((Char **));
|
||||
#if defined(FILEC) && defined(TIOCSTI)
|
||||
extern int sortscmp __P((Char **, Char **));
|
||||
#endif
|
||||
|
||||
#ifndef WINNT_NATIVE
|
||||
#ifdef NLS_CATALOGS
|
||||
#ifdef HAVE_ICONV
|
||||
extern char *iconv_catgets __P((nl_catd, int, int, const char *));
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
extern void nlsinit __P((void));
|
||||
extern void nlsclose __P((void));
|
||||
extern int t_pmatch __P((Char *, Char *, Char **, int));
|
||||
|
||||
/*
|
||||
* sh.hist.c
|
||||
*/
|
||||
extern void dohist __P((Char **, struct command *));
|
||||
extern struct Hist *enthist __P((int, struct wordent *, bool, bool));
|
||||
extern void savehist __P((struct wordent *, bool));
|
||||
extern struct Hist *enthist __P((int, struct wordent *, int, int));
|
||||
extern void savehist __P((struct wordent *, int));
|
||||
extern void fmthist __P((int, ptr_t, char *, size_t));
|
||||
extern void rechist __P((Char *, int));
|
||||
extern void loadhist __P((Char *, bool));
|
||||
extern void loadhist __P((Char *, int));
|
||||
|
||||
/*
|
||||
* sh.init.c
|
||||
@ -205,19 +214,19 @@ extern void btell __P((struct Ain *));
|
||||
extern void btoeof __P((void));
|
||||
extern void copylex __P((struct wordent *,
|
||||
struct wordent *));
|
||||
extern Char *domod __P((Char *, int));
|
||||
extern Char *domod __P((Char *, Char));
|
||||
extern void freelex __P((struct wordent *));
|
||||
extern int lex __P((struct wordent *));
|
||||
extern void prlex __P((struct wordent *));
|
||||
extern int readc __P((bool));
|
||||
extern eChar readc __P((int));
|
||||
extern void settell __P((void));
|
||||
extern void unreadc __P((int));
|
||||
extern void unreadc __P((Char));
|
||||
|
||||
|
||||
/*
|
||||
* sh.misc.c
|
||||
*/
|
||||
extern int any __P((char *, int));
|
||||
extern int any __P((const char *, Char));
|
||||
extern Char **blkcpy __P((Char **, Char **));
|
||||
extern void blkfree __P((Char **));
|
||||
extern int blklen __P((Char **));
|
||||
@ -235,7 +244,7 @@ extern void donefds __P((void));
|
||||
extern Char lastchr __P((Char *));
|
||||
extern void lshift __P((Char **, int));
|
||||
extern int number __P((Char *));
|
||||
extern int prefix __P((Char *, Char *));
|
||||
extern int prefix __P((const Char *, const Char *));
|
||||
extern Char **saveblk __P((Char **));
|
||||
extern void setzero __P((char *, int));
|
||||
extern Char *strip __P((Char *));
|
||||
@ -247,7 +256,7 @@ extern void udvar __P((Char *));
|
||||
extern char *strstr __P((const char *, const char *));
|
||||
#endif /* !POSIX */
|
||||
#ifndef SHORT_STRINGS
|
||||
extern char *strspl __P((char *, char *));
|
||||
extern char *strspl __P((const char *, const char *));
|
||||
extern char *strend __P((char *));
|
||||
#endif /* SHORT_STRINGS */
|
||||
|
||||
@ -265,7 +274,7 @@ extern struct command *syntax __P((struct wordent *,
|
||||
extern void drainoline __P((void));
|
||||
extern void flush __P((void));
|
||||
#ifdef BSDTIMES
|
||||
extern void pcsecs __P((long));
|
||||
extern void pcsecs __P((unsigned long));
|
||||
#else /* !BSDTIMES */
|
||||
# ifdef POSIX
|
||||
extern void pcsecs __P((clock_t));
|
||||
@ -274,11 +283,18 @@ extern void pcsecs __P((time_t));
|
||||
# endif /* !POSIX */
|
||||
#endif /* BSDTIMES */
|
||||
#ifdef BSDLIMIT
|
||||
extern void psecs __P((long));
|
||||
extern void psecs __P((unsigned long));
|
||||
#endif /* BSDLIMIT */
|
||||
extern int putpure __P((int));
|
||||
extern int putraw __P((int));
|
||||
extern void xputchar __P((int));
|
||||
#ifdef WIDE_STRINGS
|
||||
extern void putwraw __P((Char));
|
||||
extern void xputwchar __P((Char));
|
||||
#else
|
||||
# define putwraw(C) putraw(C)
|
||||
# define xputwchar(C) xputchar(C)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@ -294,8 +310,8 @@ extern void donotify __P((Char **, struct command *));
|
||||
extern void dostop __P((Char **, struct command *));
|
||||
extern void dowait __P((Char **, struct command *));
|
||||
extern void palloc __P((int, struct command *));
|
||||
extern void panystop __P((bool));
|
||||
extern sigret_t pchild __P((int));
|
||||
extern void panystop __P((int));
|
||||
extern RETSIGTYPE pchild __P((int));
|
||||
extern void pendjob __P((void));
|
||||
extern int pfork __P((struct command *, int));
|
||||
extern void pgetty __P((int, int));
|
||||
@ -311,7 +327,7 @@ extern struct process *pfind __P((Char *));
|
||||
* sh.sem.c
|
||||
*/
|
||||
extern void execute __P((struct command *, int, int *,
|
||||
int *, bool));
|
||||
int *, int));
|
||||
extern void mypipe __P((int *));
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.dir.c,v 3.63 2004/05/10 19:12:37 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.dir.c,v 3.66 2005/03/03 16:40:53 kim Exp $ */
|
||||
/*
|
||||
* sh.dir.c: Directory manipulation functions
|
||||
*/
|
||||
@ -31,8 +31,9 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
#include "sh.h"
|
||||
#include "ed.h"
|
||||
|
||||
RCSID("$Id: sh.dir.c,v 3.63 2004/05/10 19:12:37 christos Exp $")
|
||||
RCSID("$Id: sh.dir.c,v 3.66 2005/03/03 16:40:53 kim Exp $")
|
||||
|
||||
/*
|
||||
* C Shell - directory management
|
||||
@ -46,7 +47,8 @@ static Char *dgoto __P((Char *));
|
||||
static void dnewcwd __P((struct directory *, int));
|
||||
static void dset __P((Char *));
|
||||
static void dextract __P((struct directory *));
|
||||
static int skipargs __P((Char ***, char *, char *));
|
||||
static int skipargs __P((Char ***, const char *,
|
||||
const char *));
|
||||
static void dgetstack __P((void));
|
||||
|
||||
static struct directory dhead INIT_ZERO_STRUCT; /* "head" of loop */
|
||||
@ -68,9 +70,9 @@ void
|
||||
dinit(hp)
|
||||
Char *hp;
|
||||
{
|
||||
register char *tcp;
|
||||
register Char *cp;
|
||||
register struct directory *dp;
|
||||
char *tcp;
|
||||
Char *cp;
|
||||
struct directory *dp;
|
||||
char path[MAXPATHLEN];
|
||||
|
||||
/* Don't believe the login shell home, because it may be a symlink */
|
||||
@ -162,8 +164,8 @@ Char *dp;
|
||||
static int
|
||||
skipargs(v, dstr, str)
|
||||
Char ***v;
|
||||
char *dstr;
|
||||
char *str;
|
||||
const char *dstr;
|
||||
const char *str;
|
||||
{
|
||||
Char **n = *v, *s;
|
||||
|
||||
@ -235,10 +237,9 @@ static void
|
||||
printdirs(dflag)
|
||||
int dflag;
|
||||
{
|
||||
register struct directory *dp;
|
||||
struct directory *dp;
|
||||
Char *s, *user;
|
||||
int idx, len, cur;
|
||||
extern int T_Cols;
|
||||
|
||||
dp = dcwd;
|
||||
idx = 0;
|
||||
@ -264,7 +265,7 @@ printdirs(dflag)
|
||||
}
|
||||
if (user)
|
||||
xprintf("~%S", user);
|
||||
xprintf("\045S%c", s, (dflag & DIR_VERT) ? '\n' : ' ');
|
||||
xprintf("%-S%c", s, (dflag & DIR_VERT) ? '\n' : ' ');
|
||||
} while ((dp = dp->di_prev) != dcwd);
|
||||
if (!(dflag & DIR_VERT))
|
||||
xputchar('\n');
|
||||
@ -276,7 +277,7 @@ dtildepr(dir)
|
||||
{
|
||||
Char* user;
|
||||
if ((user = getusername(&dir)) != NULL)
|
||||
xprintf("~\045S%S", user, dir);
|
||||
xprintf("~%-S%S", user, dir);
|
||||
else
|
||||
xprintf("%S", dir);
|
||||
}
|
||||
@ -306,9 +307,9 @@ dtilde()
|
||||
* Otherwise, a copy is made and sent back.
|
||||
*/
|
||||
Char *
|
||||
dnormalize(cp, exp)
|
||||
dnormalize(cp, expnd)
|
||||
Char *cp;
|
||||
int exp;
|
||||
int expnd;
|
||||
{
|
||||
|
||||
/* return true if dp is of the form "../xxx" or "/../xxx" */
|
||||
@ -316,12 +317,12 @@ dnormalize(cp, exp)
|
||||
#define IS_DOT(sp, p) (ISDOT(p) && ((p) == (sp) || *((p) - 1) == '/'))
|
||||
|
||||
#ifdef S_IFLNK
|
||||
if (exp) {
|
||||
if (expnd) {
|
||||
int dotdot = 0;
|
||||
Char *dp, *cwd, *start = cp, buf[MAXPATHLEN];
|
||||
struct stat sb;
|
||||
# ifdef apollo
|
||||
bool slashslash;
|
||||
int slashslash;
|
||||
# endif /* apollo */
|
||||
|
||||
/*
|
||||
@ -450,8 +451,8 @@ dochngd(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register Char *cp;
|
||||
register struct directory *dp;
|
||||
Char *cp;
|
||||
struct directory *dp;
|
||||
int dflag = skipargs(&v, "plvn", "[-|<dir>]");
|
||||
|
||||
USE(c);
|
||||
@ -504,7 +505,7 @@ dgoto(cp)
|
||||
|
||||
if (!ABSOLUTEP(cp))
|
||||
{
|
||||
register Char *p, *q;
|
||||
Char *p, *q;
|
||||
int cwdlen;
|
||||
|
||||
for (p = dcwd->di_name; *p++;)
|
||||
@ -547,9 +548,9 @@ dgoto(cp)
|
||||
*/
|
||||
static Char *
|
||||
dfollow(cp)
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
{
|
||||
register Char *dp;
|
||||
Char *dp;
|
||||
struct varent *c;
|
||||
char ebuf[MAXPATHLEN];
|
||||
int serrno;
|
||||
@ -593,7 +594,7 @@ dfollow(cp)
|
||||
if (cp[0] != '/' && !prefix(STRdotsl, cp) && !prefix(STRdotdotsl, cp)
|
||||
&& (c = adrof(STRcdpath)) && c->vec != NULL) {
|
||||
Char **cdp;
|
||||
register Char *p;
|
||||
Char *p;
|
||||
Char buf[MAXPATHLEN];
|
||||
|
||||
for (cdp = c->vec; *cdp; cdp++) {
|
||||
@ -652,8 +653,8 @@ dopushd(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct directory *dp;
|
||||
register Char *cp;
|
||||
struct directory *dp;
|
||||
Char *cp;
|
||||
int dflag = skipargs(&v, "plvn", " [-|<dir>|+<n>]");
|
||||
|
||||
USE(c);
|
||||
@ -711,7 +712,7 @@ dopushd(v, c)
|
||||
dextract(dp);
|
||||
}
|
||||
else {
|
||||
register Char *ccp;
|
||||
Char *ccp;
|
||||
|
||||
if ((ccp = dfollow(cp)) == NULL)
|
||||
return;
|
||||
@ -731,11 +732,11 @@ dopushd(v, c)
|
||||
*/
|
||||
static struct directory *
|
||||
dfind(cp)
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
{
|
||||
register struct directory *dp;
|
||||
register int i;
|
||||
register Char *ep;
|
||||
struct directory *dp;
|
||||
int i;
|
||||
Char *ep;
|
||||
|
||||
if (*cp++ != '+')
|
||||
return (0);
|
||||
@ -766,7 +767,7 @@ dopopd(v, c)
|
||||
struct command *c;
|
||||
{
|
||||
Char *cp;
|
||||
register struct directory *dp, *p = NULL;
|
||||
struct directory *dp, *p = NULL;
|
||||
int dflag = skipargs(&v, "plvn", " [-|+<n>]");
|
||||
|
||||
USE(c);
|
||||
@ -808,7 +809,7 @@ dopopd(v, c)
|
||||
*/
|
||||
void
|
||||
dfree(dp)
|
||||
register struct directory *dp;
|
||||
struct directory *dp;
|
||||
{
|
||||
|
||||
if (dp->di_count != 0) {
|
||||
@ -827,18 +828,18 @@ dfree(dp)
|
||||
*/
|
||||
Char *
|
||||
dcanon(cp, p)
|
||||
register Char *cp, *p;
|
||||
Char *cp, *p;
|
||||
{
|
||||
register Char *sp;
|
||||
register Char *p1, *p2; /* general purpose */
|
||||
bool slash;
|
||||
Char *sp;
|
||||
Char *p1, *p2; /* general purpose */
|
||||
int slash;
|
||||
#ifdef apollo
|
||||
bool slashslash;
|
||||
int slashslash;
|
||||
#endif /* apollo */
|
||||
size_t clen;
|
||||
|
||||
#ifdef S_IFLNK /* if we have symlinks */
|
||||
Char link[MAXPATHLEN];
|
||||
Char mlink[MAXPATHLEN];
|
||||
char tlink[MAXPATHLEN];
|
||||
int cc;
|
||||
Char *newcp;
|
||||
@ -935,9 +936,9 @@ dcanon(cp, p)
|
||||
(cc = readlink(short2str(cp), tlink,
|
||||
sizeof(tlink) - 1)) >= 0) {
|
||||
tlink[cc] = '\0';
|
||||
(void) Strncpy(link, str2short(tlink),
|
||||
sizeof(link) / sizeof(Char));
|
||||
link[sizeof(link) / sizeof(Char) - 1] = '\0';
|
||||
(void) Strncpy(mlink, str2short(tlink),
|
||||
sizeof(mlink) / sizeof(Char));
|
||||
mlink[sizeof(mlink) / sizeof(Char) - 1] = '\0';
|
||||
|
||||
if (slash)
|
||||
*p = '/';
|
||||
@ -950,7 +951,7 @@ dcanon(cp, p)
|
||||
*/
|
||||
for (p1 = p; *p1++;)
|
||||
continue;
|
||||
if (*link != '/') {
|
||||
if (*mlink != '/') {
|
||||
/*
|
||||
* Relative path, expand it between the "yyy/" and the
|
||||
* "/..". First, back sp up to the character past "yyy/".
|
||||
@ -960,7 +961,7 @@ dcanon(cp, p)
|
||||
sp++;
|
||||
*sp = 0;
|
||||
/*
|
||||
* New length is "yyy/" + link + "/.." and rest
|
||||
* New length is "yyy/" + mlink + "/.." and rest
|
||||
*/
|
||||
p1 = newcp = (Char *) xmalloc((size_t)
|
||||
(((sp - cp) + cc + (p1 - p)) *
|
||||
@ -970,7 +971,7 @@ dcanon(cp, p)
|
||||
*/
|
||||
for (p2 = cp; (*p1++ = *p2++) != '\0';)
|
||||
continue;
|
||||
for (p1--, p2 = link; (*p1++ = *p2++) != '\0';)
|
||||
for (p1--, p2 = mlink; (*p1++ = *p2++) != '\0';)
|
||||
continue;
|
||||
for (p1--, p2 = p; (*p1++ = *p2++) != '\0';)
|
||||
continue;
|
||||
@ -981,14 +982,14 @@ dcanon(cp, p)
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* New length is link + "/.." and rest
|
||||
* New length is mlink + "/.." and rest
|
||||
*/
|
||||
p1 = newcp = (Char *) xmalloc((size_t)
|
||||
((cc + (p1 - p)) * sizeof(Char)));
|
||||
/*
|
||||
* Copy new path into newcp
|
||||
*/
|
||||
for (p2 = link; (*p1++ = *p2++) != '\0';)
|
||||
for (p2 = mlink; (*p1++ = *p2++) != '\0';)
|
||||
continue;
|
||||
for (p1--, p2 = p; (*p1++ = *p2++) != '\0';)
|
||||
continue;
|
||||
@ -1026,9 +1027,9 @@ dcanon(cp, p)
|
||||
(cc = readlink(short2str(cp), tlink,
|
||||
sizeof(tlink) - 1)) >= 0) {
|
||||
tlink[cc] = '\0';
|
||||
(void) Strncpy(link, str2short(tlink),
|
||||
sizeof(link) / sizeof(Char));
|
||||
link[sizeof(link) / sizeof(Char) - 1] = '\0';
|
||||
(void) Strncpy(mlink, str2short(tlink),
|
||||
sizeof(mlink) / sizeof(Char));
|
||||
mlink[sizeof(mlink) / sizeof(Char) - 1] = '\0';
|
||||
|
||||
/*
|
||||
* restore the '/'.
|
||||
@ -1046,7 +1047,7 @@ dcanon(cp, p)
|
||||
*/
|
||||
for (p1 = p; *p1++;)
|
||||
continue;
|
||||
if (*link != '/') {
|
||||
if (*mlink != '/') {
|
||||
/*
|
||||
* Relative path, expand it between the "yyy/" and the
|
||||
* remainder. First, back sp up to the character past
|
||||
@ -1057,7 +1058,7 @@ dcanon(cp, p)
|
||||
sp++;
|
||||
*sp = 0;
|
||||
/*
|
||||
* New length is "yyy/" + link + "/.." and rest
|
||||
* New length is "yyy/" + mlink + "/.." and rest
|
||||
*/
|
||||
p1 = newcp = (Char *) xmalloc((size_t)
|
||||
(((sp - cp) + cc + (p1 - p))
|
||||
@ -1067,7 +1068,7 @@ dcanon(cp, p)
|
||||
*/
|
||||
for (p2 = cp; (*p1++ = *p2++) != '\0';)
|
||||
continue;
|
||||
for (p1--, p2 = link; (*p1++ = *p2++) != '\0';)
|
||||
for (p1--, p2 = mlink; (*p1++ = *p2++) != '\0';)
|
||||
continue;
|
||||
for (p1--, p2 = p; (*p1++ = *p2++) != '\0';)
|
||||
continue;
|
||||
@ -1078,14 +1079,14 @@ dcanon(cp, p)
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* New length is link + the rest
|
||||
* New length is mlink + the rest
|
||||
*/
|
||||
p1 = newcp = (Char *) xmalloc((size_t)
|
||||
((cc + (p1 - p)) * sizeof(Char)));
|
||||
/*
|
||||
* Copy new path into newcp
|
||||
*/
|
||||
for (p2 = link; (*p1++ = *p2++) != '\0';)
|
||||
for (p2 = mlink; (*p1++ = *p2++) != '\0';)
|
||||
continue;
|
||||
for (p1--, p2 = p; (*p1++ = *p2++) != '\0';)
|
||||
continue;
|
||||
@ -1099,7 +1100,7 @@ dcanon(cp, p)
|
||||
#ifdef apollo
|
||||
slashslash = (cp[0] == '/' && cp[1] == '/');
|
||||
#endif /* apollo */
|
||||
continue; /* canonicalize the link */
|
||||
continue; /* canonicalize the mlink */
|
||||
}
|
||||
#endif /* S_IFLNK */
|
||||
if (slash)
|
||||
@ -1136,8 +1137,8 @@ dcanon(cp, p)
|
||||
/*
|
||||
* Start comparing dev & ino backwards
|
||||
*/
|
||||
p2 = Strncpy(link, cp, sizeof(link) / sizeof(Char));
|
||||
link[sizeof(link) / sizeof(Char) - 1] = '\0';
|
||||
p2 = Strncpy(mlink, cp, sizeof(mlink) / sizeof(Char));
|
||||
mlink[sizeof(mlink) / sizeof(Char) - 1] = '\0';
|
||||
found = 0;
|
||||
while (*p2 && stat(short2str(p2), &statbuf) != -1) {
|
||||
if (DEV_DEV_COMPARE(statbuf.st_dev, home_dev) &&
|
||||
@ -1184,7 +1185,7 @@ dcanon(cp, p)
|
||||
*/
|
||||
static void
|
||||
dnewcwd(dp, dflag)
|
||||
register struct directory *dp;
|
||||
struct directory *dp;
|
||||
int dflag;
|
||||
{
|
||||
int print;
|
||||
@ -1353,7 +1354,6 @@ recdirs(fname, def)
|
||||
{
|
||||
int fp, ftmp, oldidfds;
|
||||
int cdflag = 0;
|
||||
extern struct directory *dcwd;
|
||||
struct directory *dp;
|
||||
unsigned int num;
|
||||
Char *snum;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.dol.c,v 3.52 2003/03/12 19:14:51 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.dol.c,v 3.55 2004/12/25 21:15:06 christos Exp $ */
|
||||
/*
|
||||
* sh.dol.c: Variable substitutions
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.dol.c,v 3.52 2003/03/12 19:14:51 christos Exp $")
|
||||
RCSID("$Id: sh.dol.c,v 3.55 2004/12/25 21:15:06 christos Exp $")
|
||||
|
||||
/*
|
||||
* C shell
|
||||
@ -47,10 +47,11 @@ RCSID("$Id: sh.dol.c,v 3.52 2003/03/12 19:14:51 christos Exp $")
|
||||
* some QUOTEing may have occurred already, so we dont "trim()" here.
|
||||
*/
|
||||
|
||||
static int Dpeekc, Dpeekrd; /* Peeks for DgetC and Dreadc */
|
||||
static Char Dpeekc; /* Peek for DgetC */
|
||||
static eChar Dpeekrd; /* Peek for Dreadc */
|
||||
static Char *Dcp, **Dvp; /* Input vector for Dreadc */
|
||||
|
||||
#define DEOF -1
|
||||
#define DEOF CHAR_ERR
|
||||
|
||||
#define unDgetC(c) Dpeekc = c
|
||||
|
||||
@ -82,13 +83,13 @@ static void Dfix2 __P((Char **));
|
||||
static Char *Dpack __P((Char *, Char *));
|
||||
static int Dword __P((void));
|
||||
static void dolerror __P((Char *));
|
||||
static int DgetC __P((int));
|
||||
static eChar DgetC __P((int));
|
||||
static void Dgetdol __P((void));
|
||||
static void fixDolMod __P((void));
|
||||
static void setDolp __P((Char *));
|
||||
static void unDredc __P((int));
|
||||
static int Dredc __P((void));
|
||||
static void Dtestq __P((int));
|
||||
static void unDredc __P((eChar));
|
||||
static eChar Dredc __P((void));
|
||||
static void Dtestq __P((Char));
|
||||
|
||||
/*
|
||||
* Fix up the $ expansions and quotations in the
|
||||
@ -96,21 +97,16 @@ static void Dtestq __P((int));
|
||||
*/
|
||||
void
|
||||
Dfix(t)
|
||||
register struct command *t;
|
||||
struct command *t;
|
||||
{
|
||||
register Char **pp;
|
||||
register Char *p;
|
||||
Char **pp;
|
||||
Char *p;
|
||||
|
||||
if (noexec)
|
||||
return;
|
||||
/* Note that t_dcom isn't trimmed thus !...:q's aren't lost */
|
||||
for (pp = t->t_dcom; (p = *pp++) != NULL;) {
|
||||
for (; *p; p++) {
|
||||
#ifdef DSPMBYTE
|
||||
if (Ismbyte1(*p) && *(p + 1))
|
||||
p ++;
|
||||
else
|
||||
#endif /* DSPMBYTE */
|
||||
if (cmap(*p, _DOL | QUOTES)) { /* $, \, ', ", ` */
|
||||
Dfix2(t->t_dcom); /* found one */
|
||||
blkfree(t->t_dcom);
|
||||
@ -127,7 +123,7 @@ Dfix(t)
|
||||
*/
|
||||
Char *
|
||||
Dfix1(cp)
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
{
|
||||
Char *Dv[2];
|
||||
|
||||
@ -170,30 +166,11 @@ static Char *
|
||||
Dpack(wbuf, wp)
|
||||
Char *wbuf, *wp;
|
||||
{
|
||||
register int c;
|
||||
register int i = MAXWLEN - (int) (wp - wbuf);
|
||||
#if defined(DSPMBYTE)
|
||||
int mbytepos = 1;
|
||||
#endif /* DSPMBYTE */
|
||||
eChar c;
|
||||
int i = MAXWLEN - (int) (wp - wbuf);
|
||||
|
||||
for (;;) {
|
||||
c = DgetC(DODOL);
|
||||
#if defined(DSPMBYTE)
|
||||
if (mbytepos == 1 && Ismbyte1(c)) {
|
||||
/* An MB1 byte that may be followed by a MB2 byte */
|
||||
mbytepos = 2;
|
||||
}
|
||||
else {
|
||||
/* check if MB1 byte followed by an MB2 byte */
|
||||
if (mbytepos == 2 && Ismbyte2(c)) {
|
||||
/* MB1 + MB2 make the character */
|
||||
mbytepos = 1; /* reset */
|
||||
goto mbyteskip;
|
||||
}
|
||||
mbytepos = 1; /* reset */
|
||||
/* wasn't followed, so the two bytes make two characters */
|
||||
}
|
||||
#endif /* DSPMBYTE */
|
||||
if (c == '\\') {
|
||||
c = DgetC(0);
|
||||
if (c == DEOF) {
|
||||
@ -221,9 +198,6 @@ Dpack(wbuf, wp)
|
||||
Gcat(STRNULL, wbuf);
|
||||
return (NULL);
|
||||
}
|
||||
#if defined(DSPMBYTE)
|
||||
mbyteskip:
|
||||
#endif /* DSPMBYTE */
|
||||
if (--i <= 0)
|
||||
stderror(ERR_WTOOLONG);
|
||||
*wp++ = (Char) c;
|
||||
@ -239,12 +213,12 @@ Dpack(wbuf, wp)
|
||||
static int
|
||||
Dword()
|
||||
{
|
||||
register int c, c1;
|
||||
eChar c, c1;
|
||||
Char wbuf[BUFSIZE];
|
||||
register Char *wp = wbuf;
|
||||
register int i = MAXWLEN;
|
||||
register bool dolflg;
|
||||
bool sofar = 0, done = 0;
|
||||
Char *wp = wbuf;
|
||||
int i = MAXWLEN;
|
||||
int dolflg;
|
||||
int sofar = 0, done = 0;
|
||||
|
||||
while (!done) {
|
||||
done = 1;
|
||||
@ -285,7 +259,7 @@ Dword()
|
||||
if (c == c1)
|
||||
break;
|
||||
if (c == '\n' || c == DEOF)
|
||||
stderror(ERR_UNMATCHED, c1);
|
||||
stderror(ERR_UNMATCHED, (int)c1);
|
||||
if ((c & (QUOTE | TRIM)) == ('\n' | QUOTE)) {
|
||||
if ((wp[-1] & TRIM) == '\\')
|
||||
--wp;
|
||||
@ -383,11 +357,11 @@ Dword()
|
||||
* Any QUOTES character which is returned from a $ expansion is
|
||||
* QUOTEd so that it will not be recognized above.
|
||||
*/
|
||||
static int
|
||||
static eChar
|
||||
DgetC(flag)
|
||||
register int flag;
|
||||
int flag;
|
||||
{
|
||||
register int c;
|
||||
Char c;
|
||||
|
||||
top:
|
||||
if ((c = Dpeekc) != 0) {
|
||||
@ -447,13 +421,12 @@ dolerror(s)
|
||||
static void
|
||||
Dgetdol()
|
||||
{
|
||||
register Char *np;
|
||||
register struct varent *vp = NULL;
|
||||
Char *np;
|
||||
struct varent *vp = NULL;
|
||||
Char name[4 * MAXVARLEN + 1];
|
||||
int c, sc;
|
||||
eChar c, sc;
|
||||
int subscr = 0, lwb = 1, upb = 0;
|
||||
bool dimen = 0, bitset = 0, length = 0;
|
||||
char tnp;
|
||||
int dimen = 0, bitset = 0, length = 0;
|
||||
Char wbuf[BUFSIZE];
|
||||
static Char *dolbang = NULL;
|
||||
|
||||
@ -492,7 +465,9 @@ Dgetdol()
|
||||
#ifdef COHERENT
|
||||
/* Coherent compiler doesn't allow case-labels that are not
|
||||
constant-expressions */
|
||||
#ifdef SHORT_STRINGS
|
||||
#ifdef WIDE_STRINGS
|
||||
case 0x4000003C: /* Does Coherent have 32-bit int at all? */
|
||||
#elif defined (SHORT_STRINGS)
|
||||
case 0100074:
|
||||
#else /* !SHORT_STRINGS */
|
||||
case 0274:
|
||||
@ -507,17 +482,45 @@ Dgetdol()
|
||||
if (length)
|
||||
stderror(ERR_NOTALLOWED, "$%<");
|
||||
{
|
||||
char cbuf[MB_LEN_MAX];
|
||||
size_t cbp = 0;
|
||||
|
||||
#ifdef BSDSIGS
|
||||
sigmask_t omask = sigsetmask(sigblock(0) & ~sigmask(SIGINT));
|
||||
#else /* !BSDSIGS */
|
||||
(void) sigrelse(SIGINT);
|
||||
#endif /* BSDSIGS */
|
||||
for (np = wbuf; force_read(OLDSTD, &tnp, 1) == 1; np++) {
|
||||
*np = (unsigned char) tnp;
|
||||
np = wbuf;
|
||||
while (force_read(OLDSTD, cbuf + cbp++, 1) == 1) {
|
||||
int len;
|
||||
|
||||
len = normal_mbtowc(np, cbuf, cbp);
|
||||
if (len == -1) {
|
||||
reset_mbtowc();
|
||||
if (cbp < MB_LEN_MAX)
|
||||
continue; /* Maybe a partial character */
|
||||
*np = (unsigned char)*cbuf | INVALID_BYTE;
|
||||
}
|
||||
if (len <= 0)
|
||||
len = 1;
|
||||
if (cbp != (size_t)len)
|
||||
memmove(cbuf, cbuf + len, cbp - len);
|
||||
cbp -= len;
|
||||
if (np >= &wbuf[BUFSIZE - 1])
|
||||
stderror(ERR_LTOOLONG);
|
||||
if (tnp == '\n')
|
||||
if (*np == '\n')
|
||||
break;
|
||||
np++;
|
||||
}
|
||||
while (cbp != 0) {
|
||||
*np = (unsigned char)*cbuf;
|
||||
if (np >= &wbuf[BUFSIZE - 1])
|
||||
stderror(ERR_LTOOLONG);
|
||||
if (*np == '\n')
|
||||
break;
|
||||
np++;
|
||||
cbp--;
|
||||
memmove(cbuf, cbuf + 1, cbp);
|
||||
}
|
||||
*np = 0;
|
||||
#ifdef BSDSIGS
|
||||
@ -592,7 +595,7 @@ Dgetdol()
|
||||
stderror(ERR_DOLZERO);
|
||||
if (length) {
|
||||
Char *cp;
|
||||
length = Strlen(ffile);
|
||||
length = NLSChars(ffile);
|
||||
cp = putn(length);
|
||||
addla(cp);
|
||||
xfree((ptr_t) cp);
|
||||
@ -692,7 +695,7 @@ Dgetdol()
|
||||
else if (*np != '-')
|
||||
stderror(ERR_MISSING, '-');
|
||||
else {
|
||||
register int i = upb;
|
||||
int i = upb;
|
||||
|
||||
np++;
|
||||
if (Isdigit(*np)) {
|
||||
@ -750,7 +753,7 @@ Dgetdol()
|
||||
int i;
|
||||
Char *cp;
|
||||
for (i = lwb - 1, length = 0; i < upb; i++)
|
||||
length += Strlen(vp->vec[i]);
|
||||
length += NLSChars(vp->vec[i]);
|
||||
#ifdef notdef
|
||||
/* We don't want that, since we can always compute it by adding $#xxx */
|
||||
length += i - 1; /* Add the number of spaces in */
|
||||
@ -776,7 +779,7 @@ Dgetdol()
|
||||
static void
|
||||
fixDolMod()
|
||||
{
|
||||
register int c;
|
||||
eChar c;
|
||||
|
||||
c = DgetC(0);
|
||||
if (c == ':') {
|
||||
@ -802,7 +805,7 @@ fixDolMod()
|
||||
|
||||
if (c == 's') { /* [eichin:19910926.0755EST] */
|
||||
int delimcnt = 2;
|
||||
int delim = DgetC(0);
|
||||
eChar delim = DgetC(0);
|
||||
dolmod[dolnmod++] = (Char) c;
|
||||
dolmod[dolnmod++] = (Char) delim;
|
||||
|
||||
@ -811,7 +814,7 @@ fixDolMod()
|
||||
seterror(ERR_BADSUBST);
|
||||
break;
|
||||
}
|
||||
while ((c = DgetC(0)) != (-1)) {
|
||||
while ((c = DgetC(0)) != DEOF) {
|
||||
dolmod[dolnmod++] = (Char) c;
|
||||
if(c == delim) delimcnt--;
|
||||
if(!delimcnt) break;
|
||||
@ -823,7 +826,7 @@ fixDolMod()
|
||||
continue;
|
||||
}
|
||||
if (!any("luhtrqxes", c))
|
||||
stderror(ERR_BADMOD, c);
|
||||
stderror(ERR_BADMOD, (int)c);
|
||||
#ifndef COMPAT
|
||||
dolmod[dolnmod++] = (Char) c;
|
||||
#else
|
||||
@ -843,9 +846,9 @@ fixDolMod()
|
||||
|
||||
static void
|
||||
setDolp(cp)
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
{
|
||||
register Char *dp;
|
||||
Char *dp;
|
||||
#ifndef COMPAT
|
||||
int i;
|
||||
#endif /* COMPAT */
|
||||
@ -855,6 +858,12 @@ setDolp(cp)
|
||||
#else
|
||||
if (dolnmod == 0 || dolmcnt == 0) {
|
||||
#endif /* COMPAT */
|
||||
for (dp = cp; *dp; dp++) {
|
||||
if (NLSSize(dp, -1) != 1) {
|
||||
addla(cp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
dolp = cp;
|
||||
return;
|
||||
}
|
||||
@ -865,7 +874,7 @@ setDolp(cp)
|
||||
for (i = 0; i < dolnmod; i++) {
|
||||
/* handle s// [eichin:19910926.0510EST] */
|
||||
if(dolmod[i] == 's') {
|
||||
int delim;
|
||||
Char delim;
|
||||
Char *lhsub, *rhsub, *np;
|
||||
size_t lhlen = 0, rhlen = 0;
|
||||
int didmod = 0;
|
||||
@ -968,16 +977,16 @@ setDolp(cp)
|
||||
|
||||
static void
|
||||
unDredc(c)
|
||||
int c;
|
||||
eChar c;
|
||||
{
|
||||
|
||||
Dpeekrd = c;
|
||||
}
|
||||
|
||||
static int
|
||||
static eChar
|
||||
Dredc()
|
||||
{
|
||||
register int c;
|
||||
Char c;
|
||||
|
||||
if ((c = Dpeekrd) != 0) {
|
||||
Dpeekrd = 0;
|
||||
@ -995,7 +1004,7 @@ Dredc()
|
||||
|
||||
static void
|
||||
Dtestq(c)
|
||||
register int c;
|
||||
Char c;
|
||||
{
|
||||
|
||||
if (cmap(c, QUOTES))
|
||||
@ -1011,13 +1020,13 @@ void
|
||||
heredoc(term)
|
||||
Char *term;
|
||||
{
|
||||
int c;
|
||||
eChar c;
|
||||
Char *Dv[2];
|
||||
Char obuf[BUFSIZE], lbuf[BUFSIZE], mbuf[BUFSIZE];
|
||||
Char obuf[BUFSIZE + 1], lbuf[BUFSIZE], mbuf[BUFSIZE];
|
||||
int ocnt, lcnt, mcnt;
|
||||
register Char *lbp, *obp, *mbp;
|
||||
Char *lbp, *obp, *mbp;
|
||||
Char **vp;
|
||||
bool quoted;
|
||||
int quoted;
|
||||
char *tmp;
|
||||
#ifndef WINNT_NATIVE
|
||||
struct timeval tv;
|
||||
@ -1062,6 +1071,7 @@ heredoc(term)
|
||||
quoted = gflag;
|
||||
ocnt = BUFSIZE;
|
||||
obp = obuf;
|
||||
obuf[BUFSIZE] = 0;
|
||||
inheredoc = 1;
|
||||
#ifdef WINNT_NATIVE
|
||||
__dup_stdin = 1;
|
||||
@ -1080,7 +1090,7 @@ heredoc(term)
|
||||
lcnt = BUFSIZE - 4;
|
||||
for (;;) {
|
||||
c = readc(1); /* 1 -> Want EOF returns */
|
||||
if (c < 0 || c == '\n')
|
||||
if (c == CHAR_ERR || c == '\n')
|
||||
break;
|
||||
if ((c &= TRIM) != 0) {
|
||||
*lbp++ = (Char) c;
|
||||
@ -1095,8 +1105,10 @@ heredoc(term)
|
||||
/*
|
||||
* Check for EOF or compare to terminator -- before expansion
|
||||
*/
|
||||
if (c < 0 || eq(lbuf, term)) {
|
||||
(void) write(0, short2str(obuf), (size_t) (BUFSIZE - ocnt));
|
||||
if (c == CHAR_ERR || eq(lbuf, term)) {
|
||||
*obp = 0;
|
||||
tmp = short2str(obuf);
|
||||
(void) write(0, tmp, strlen (tmp));
|
||||
(void) lseek(0, (off_t) 0, L_SET);
|
||||
inheredoc = 0;
|
||||
return;
|
||||
@ -1111,7 +1123,8 @@ heredoc(term)
|
||||
for (lbp = lbuf; (c = *lbp++) != 0;) {
|
||||
*obp++ = (Char) c;
|
||||
if (--ocnt == 0) {
|
||||
(void) write(0, short2str(obuf), BUFSIZE);
|
||||
tmp = short2str(obuf);
|
||||
(void) write(0, tmp, strlen (tmp));
|
||||
obp = obuf;
|
||||
ocnt = BUFSIZE;
|
||||
}
|
||||
@ -1175,14 +1188,16 @@ heredoc(term)
|
||||
for (mbp = *vp; *mbp; mbp++) {
|
||||
*obp++ = *mbp & TRIM;
|
||||
if (--ocnt == 0) {
|
||||
(void) write(0, short2str(obuf), BUFSIZE);
|
||||
tmp = short2str(obuf);
|
||||
(void) write(0, tmp, strlen (tmp));
|
||||
obp = obuf;
|
||||
ocnt = BUFSIZE;
|
||||
}
|
||||
}
|
||||
*obp++ = '\n';
|
||||
if (--ocnt == 0) {
|
||||
(void) write(0, short2str(obuf), BUFSIZE);
|
||||
tmp = short2str(obuf);
|
||||
(void) write(0, tmp, strlen (tmp));
|
||||
obp = obuf;
|
||||
ocnt = BUFSIZE;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.err.c,v 3.36 2002/03/08 17:36:46 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.err.c,v 3.39 2005/01/18 20:43:30 christos Exp $ */
|
||||
/*
|
||||
* sh.err.c: Error printing routines.
|
||||
*/
|
||||
@ -33,7 +33,7 @@
|
||||
#define _h_sh_err /* Don't redefine the errors */
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.err.c,v 3.36 2002/03/08 17:36:46 christos Exp $")
|
||||
RCSID("$Id: sh.err.c,v 3.39 2005/01/18 20:43:30 christos Exp $")
|
||||
|
||||
/*
|
||||
* C Shell
|
||||
@ -188,7 +188,7 @@ char *seterr = NULL; /* Holds last error if there was one */
|
||||
#define ERR_BADCOLORVAR 134
|
||||
#define NO_ERRORS 135
|
||||
|
||||
static char *elst[NO_ERRORS] INIT_ZERO_STRUCT;
|
||||
static const char *elst[NO_ERRORS] INIT_ZERO_STRUCT;
|
||||
|
||||
/*
|
||||
* Init the elst depending on the locale
|
||||
@ -371,7 +371,7 @@ errinit()
|
||||
*/
|
||||
void
|
||||
/*VARARGS1*/
|
||||
#ifdef FUNCPROTO
|
||||
#ifdef PROTOTYPES
|
||||
seterror(unsigned int id, ...)
|
||||
#else
|
||||
seterror(va_alist)
|
||||
@ -382,7 +382,7 @@ seterror(va_alist)
|
||||
if (seterr == 0) {
|
||||
va_list va;
|
||||
char berr[BUFSIZE];
|
||||
#ifdef FUNCPROTO
|
||||
#ifdef PROTOTYPES
|
||||
va_start(va, id);
|
||||
#else
|
||||
unsigned int id;
|
||||
@ -419,7 +419,7 @@ seterror(va_alist)
|
||||
*/
|
||||
void
|
||||
/*VARARGS*/
|
||||
#ifdef FUNCPROTO
|
||||
#ifdef PROTOTYPES
|
||||
stderror(unsigned int id, ...)
|
||||
#else
|
||||
stderror(va_alist)
|
||||
@ -427,11 +427,11 @@ stderror(va_alist)
|
||||
#endif
|
||||
{
|
||||
va_list va;
|
||||
register Char **v;
|
||||
Char **v;
|
||||
int flags;
|
||||
int vareturn;
|
||||
|
||||
#ifdef FUNCPROTO
|
||||
#ifdef PROTOTYPES
|
||||
va_start(va, id);
|
||||
#else
|
||||
unsigned int id;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.exec.c,v 3.58 2003/03/12 19:14:51 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.exec.c,v 3.63 2004/11/23 02:10:48 christos Exp $ */
|
||||
/*
|
||||
* sh.exec.c: Search, find, and execute a command!
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.exec.c,v 3.58 2003/03/12 19:14:51 christos Exp $")
|
||||
RCSID("$Id: sh.exec.c,v 3.63 2004/11/23 02:10:48 christos Exp $")
|
||||
|
||||
#include "tc.h"
|
||||
#include "tw.h"
|
||||
@ -93,9 +93,9 @@ static int hashdebug = 0;
|
||||
# define hash(a, b) (((a) * HSHMUL + (b)) % (hashlength))
|
||||
# define widthof(t) (sizeof(t) * BITS_PER_BYTE)
|
||||
# define tbit(f, i, t) (((t *) xhash)[(f)] & \
|
||||
(1L << (i & (widthof(t) - 1))))
|
||||
(1UL << (i & (widthof(t) - 1))))
|
||||
# define tbis(f, i, t) (((t *) xhash)[(f)] |= \
|
||||
(1L << (i & (widthof(t) - 1))))
|
||||
(1UL << (i & (widthof(t) - 1))))
|
||||
# define cbit(f, i) tbit(f, i, unsigned char)
|
||||
# define cbis(f, i) tbis(f, i, unsigned char)
|
||||
# define sbit(f, i) tbit(f, i, unsigned short)
|
||||
@ -148,12 +148,12 @@ static int iscommand __P((Char *));
|
||||
|
||||
void
|
||||
doexec(t, do_glob)
|
||||
register struct command *t;
|
||||
bool do_glob;
|
||||
struct command *t;
|
||||
int do_glob;
|
||||
{
|
||||
Char *dp, **pv, **av, *sav;
|
||||
struct varent *v;
|
||||
bool slash;
|
||||
int slash;
|
||||
int hashval, i;
|
||||
Char *blk[2];
|
||||
|
||||
@ -385,11 +385,11 @@ pexerr()
|
||||
static void
|
||||
texec(sf, st)
|
||||
Char *sf;
|
||||
register Char **st;
|
||||
Char **st;
|
||||
{
|
||||
register char **t;
|
||||
register char *f;
|
||||
register struct varent *v;
|
||||
char **t;
|
||||
char *f;
|
||||
struct varent *v;
|
||||
Char **vp;
|
||||
Char *lastsh[2];
|
||||
char pref[2];
|
||||
@ -444,7 +444,8 @@ texec(sf, st)
|
||||
setmode(fd, O_TEXT);
|
||||
#endif
|
||||
if ((nread = read(fd, (char *) pref, 2)) == 2) {
|
||||
if (!Isprint(pref[0]) && (pref[0] != '\n' && pref[0] != '\t')) {
|
||||
if (!isprint((unsigned char)pref[0]) &&
|
||||
(pref[0] != '\n' && pref[0] != '\t')) {
|
||||
(void) close(fd);
|
||||
/*
|
||||
* We *know* what ENOEXEC means.
|
||||
@ -554,7 +555,7 @@ texec(sf, st)
|
||||
void
|
||||
execash(t, kp)
|
||||
Char **t;
|
||||
register struct command *kp;
|
||||
struct command *kp;
|
||||
{
|
||||
int saveIN, saveOUT, saveDIAG, saveSTD;
|
||||
int oSHIN;
|
||||
@ -592,10 +593,10 @@ execash(t, kp)
|
||||
oSHDIAG = SHDIAG;
|
||||
oOLDSTD = OLDSTD;
|
||||
|
||||
saveIN = dcopy(SHIN, -1);
|
||||
saveOUT = dcopy(SHOUT, -1);
|
||||
saveDIAG = dcopy(SHDIAG, -1);
|
||||
saveSTD = dcopy(OLDSTD, -1);
|
||||
(void)close_on_exec (saveIN = dcopy(SHIN, -1), 1);
|
||||
(void)close_on_exec (saveOUT = dcopy(SHOUT, -1), 1);
|
||||
(void)close_on_exec (saveDIAG = dcopy(SHDIAG, -1), 1);
|
||||
(void)close_on_exec (saveSTD = dcopy(OLDSTD, -1), 1);
|
||||
|
||||
lshift(kp->t_dcom, 1);
|
||||
|
||||
@ -609,9 +610,9 @@ execash(t, kp)
|
||||
#else /* !cray */
|
||||
if ((my_reenter = setexit()) == 0) {
|
||||
#endif /* cray */
|
||||
SHIN = dcopy(0, -1);
|
||||
SHOUT = dcopy(1, -1);
|
||||
SHDIAG = dcopy(2, -1);
|
||||
(void)close_on_exec (SHIN = dcopy(0, -1), 1);
|
||||
(void)close_on_exec (SHOUT = dcopy(1, -1), 1);
|
||||
(void)close_on_exec (SHDIAG = dcopy(2, -1), 1);
|
||||
#ifndef CLOSE_ON_EXEC
|
||||
didcch = 0;
|
||||
#endif /* CLOSE_ON_EXEC */
|
||||
@ -639,10 +640,10 @@ execash(t, kp)
|
||||
(void) close(SHOUT);
|
||||
(void) close(SHDIAG);
|
||||
(void) close(OLDSTD);
|
||||
SHIN = dmove(saveIN, oSHIN);
|
||||
SHOUT = dmove(saveOUT, oSHOUT);
|
||||
SHDIAG = dmove(saveDIAG, oSHDIAG);
|
||||
OLDSTD = dmove(saveSTD, oOLDSTD);
|
||||
(void)close_on_exec(SHIN = dmove(saveIN, oSHIN), 1);
|
||||
(void)close_on_exec(SHOUT = dmove(saveOUT, oSHOUT), 1);
|
||||
(void)close_on_exec(SHDIAG = dmove(saveDIAG, oSHDIAG), 1);
|
||||
(void)close_on_exec(OLDSTD = dmove(saveSTD, oOLDSTD), 1);
|
||||
|
||||
resexit(osetexit);
|
||||
if (my_reenter)
|
||||
@ -675,7 +676,7 @@ dohash(vv, c)
|
||||
struct stat stb;
|
||||
#endif
|
||||
DIR *dirp;
|
||||
register struct dirent *dp;
|
||||
struct dirent *dp;
|
||||
int i = 0;
|
||||
struct varent *v = adrof(STRpath);
|
||||
Char **pv;
|
||||
@ -839,9 +840,9 @@ hashstat(v, c)
|
||||
*/
|
||||
int
|
||||
hashname(cp)
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
{
|
||||
register unsigned long h;
|
||||
unsigned long h;
|
||||
|
||||
for (h = 0; *cp; cp++)
|
||||
h = hash(h, *cp);
|
||||
@ -852,11 +853,11 @@ static int
|
||||
iscommand(name)
|
||||
Char *name;
|
||||
{
|
||||
register Char **pv;
|
||||
register Char *sav;
|
||||
register struct varent *v;
|
||||
register bool slash = any(short2str(name), '/');
|
||||
register int hashval, i;
|
||||
Char **pv;
|
||||
Char *sav;
|
||||
struct varent *v;
|
||||
int slash = any(short2str(name), '/');
|
||||
int hashval, i;
|
||||
|
||||
v = adrof(STRpath);
|
||||
if (v == NULL || v->vec == NULL || v->vec[0] == NULL || slash)
|
||||
@ -917,7 +918,7 @@ iscommand(name)
|
||||
int
|
||||
executable(dir, name, dir_ok)
|
||||
Char *dir, *name;
|
||||
bool dir_ok;
|
||||
int dir_ok;
|
||||
{
|
||||
struct stat stbuf;
|
||||
Char path[MAXPATHLEN + 1];
|
||||
@ -947,10 +948,10 @@ tellmewhat(lexp, str)
|
||||
struct wordent *lexp;
|
||||
Char *str;
|
||||
{
|
||||
register int i;
|
||||
register struct biltins *bptr;
|
||||
register struct wordent *sp = lexp->next;
|
||||
bool aliased = 0, found;
|
||||
int i;
|
||||
struct biltins *bptr;
|
||||
struct wordent *sp = lexp->next;
|
||||
int aliased = 0, found;
|
||||
Char *s0, *s1, *s2, *cmd;
|
||||
Char qc;
|
||||
|
||||
@ -1023,9 +1024,9 @@ tellmewhat(lexp, str)
|
||||
sp->word = cmd = globone(sp->word, G_IGNORE);
|
||||
|
||||
if ((i = iscommand(sp->word)) != 0) {
|
||||
register Char **pv;
|
||||
register struct varent *v;
|
||||
bool slash = any(short2str(sp->word), '/');
|
||||
Char **pv;
|
||||
struct varent *v;
|
||||
int slash = any(short2str(sp->word), '/');
|
||||
|
||||
v = adrof(STRpath);
|
||||
if (v == NULL || v->vec == NULL || v->vec[0] == NULL || slash)
|
||||
@ -1083,7 +1084,7 @@ tellmewhat(lexp, str)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dowhere(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
int found = 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.exp.c,v 3.40 2002/03/08 17:36:46 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.exp.c,v 3.45 2005/01/18 20:24:50 christos Exp $ */
|
||||
/*
|
||||
* sh.exp.c: Expression evaluations
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.exp.c,v 3.40 2002/03/08 17:36:46 christos Exp $")
|
||||
RCSID("$Id: sh.exp.c,v 3.45 2005/01/18 20:24:50 christos Exp $")
|
||||
|
||||
#include "tw.h"
|
||||
|
||||
@ -58,16 +58,16 @@ RCSID("$Id: sh.exp.c,v 3.40 2002/03/08 17:36:46 christos Exp $")
|
||||
#define NOTEQMATCH 8
|
||||
|
||||
static int sh_access __P((Char *, int));
|
||||
static int exp1 __P((Char ***, bool));
|
||||
static int exp2 __P((Char ***, bool));
|
||||
static int exp2a __P((Char ***, bool));
|
||||
static int exp2b __P((Char ***, bool));
|
||||
static int exp2c __P((Char ***, bool));
|
||||
static Char *exp3 __P((Char ***, bool));
|
||||
static Char *exp3a __P((Char ***, bool));
|
||||
static Char *exp4 __P((Char ***, bool));
|
||||
static Char *exp5 __P((Char ***, bool));
|
||||
static Char *exp6 __P((Char ***, bool));
|
||||
static int exp1 __P((Char ***, int));
|
||||
static int exp2x __P((Char ***, int));
|
||||
static int exp2a __P((Char ***, int));
|
||||
static int exp2b __P((Char ***, int));
|
||||
static int exp2c __P((Char ***, int));
|
||||
static Char *exp3 __P((Char ***, int));
|
||||
static Char *exp3a __P((Char ***, int));
|
||||
static Char *exp4 __P((Char ***, int));
|
||||
static Char *exp5 __P((Char ***, int));
|
||||
static Char *exp6 __P((Char ***, int));
|
||||
static void evalav __P((Char **));
|
||||
static int isa __P((Char *, int));
|
||||
static int egetn __P((Char *));
|
||||
@ -147,23 +147,9 @@ sh_access(fname, mode)
|
||||
|
||||
# ifdef NGROUPS_MAX
|
||||
else {
|
||||
# if defined(__386BSD__) || defined(BSD4_4)
|
||||
/*
|
||||
* These two decided that setgroup() should take an array of int's
|
||||
* and they define _SC_NGROUPS_MAX without having sysconf
|
||||
*/
|
||||
# undef _SC_NGROUPS_MAX
|
||||
# if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
|
||||
# define GID_T gid_t
|
||||
# else
|
||||
# define GID_T int
|
||||
# endif
|
||||
# else
|
||||
# define GID_T gid_t
|
||||
# endif /* __386BSD__ || BSD4_4 */
|
||||
/* you can be in several groups */
|
||||
long n;
|
||||
GID_T *groups;
|
||||
GETGROUPS_T *groups;
|
||||
|
||||
/*
|
||||
* Try these things to find a positive maximum groups value:
|
||||
@ -172,15 +158,15 @@ sh_access(fname, mode)
|
||||
* 3) getgroups(0, unused)
|
||||
* Then allocate and scan the groups array if one of these worked.
|
||||
*/
|
||||
# ifdef _SC_NGROUPS_MAX
|
||||
# if defined (HAVE_SYSCONF) && defined (_SC_NGROUPS_MAX)
|
||||
if ((n = sysconf(_SC_NGROUPS_MAX)) == -1)
|
||||
# endif /* _SC_NGROUPS_MAX */
|
||||
n = NGROUPS_MAX;
|
||||
if (n <= 0)
|
||||
n = getgroups(0, (GID_T *) NULL);
|
||||
n = getgroups(0, (GETGROUPS_T *) NULL);
|
||||
|
||||
if (n > 0) {
|
||||
groups = (GID_T *) xmalloc((size_t) (n * sizeof(GID_T)));
|
||||
groups = xmalloc((size_t) (n * sizeof(*groups)));
|
||||
n = getgroups((int) n, groups);
|
||||
while (--n >= 0)
|
||||
if (groups[n] == statb.st_gid) {
|
||||
@ -200,23 +186,23 @@ sh_access(fname, mode)
|
||||
|
||||
int
|
||||
expr(vp)
|
||||
register Char ***vp;
|
||||
Char ***vp;
|
||||
{
|
||||
return (exp0(vp, 0));
|
||||
}
|
||||
|
||||
int
|
||||
exp0(vp, ignore)
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
Char ***vp;
|
||||
int ignore;
|
||||
{
|
||||
register int p1 = exp1(vp, ignore);
|
||||
int p1 = exp1(vp, ignore);
|
||||
|
||||
#ifdef EDEBUG
|
||||
etraci("exp0 p1", p1, vp);
|
||||
#endif /* EDEBUG */
|
||||
if (**vp && eq(**vp, STRor2)) {
|
||||
register int p2;
|
||||
int p2;
|
||||
|
||||
(*vp)++;
|
||||
p2 = exp0(vp, (ignore & TEXP_IGNORE) || p1);
|
||||
@ -230,16 +216,16 @@ exp0(vp, ignore)
|
||||
|
||||
static int
|
||||
exp1(vp, ignore)
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
Char ***vp;
|
||||
int ignore;
|
||||
{
|
||||
register int p1 = exp2(vp, ignore);
|
||||
int p1 = exp2x(vp, ignore);
|
||||
|
||||
#ifdef EDEBUG
|
||||
etraci("exp1 p1", p1, vp);
|
||||
#endif /* EDEBUG */
|
||||
if (**vp && eq(**vp, STRand2)) {
|
||||
register int p2;
|
||||
int p2;
|
||||
|
||||
(*vp)++;
|
||||
p2 = exp1(vp, (ignore & TEXP_IGNORE) || !p1);
|
||||
@ -252,20 +238,20 @@ exp1(vp, ignore)
|
||||
}
|
||||
|
||||
static int
|
||||
exp2(vp, ignore)
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
exp2x(vp, ignore)
|
||||
Char ***vp;
|
||||
int ignore;
|
||||
{
|
||||
register int p1 = exp2a(vp, ignore);
|
||||
int p1 = exp2a(vp, ignore);
|
||||
|
||||
#ifdef EDEBUG
|
||||
etraci("exp3 p1", p1, vp);
|
||||
#endif /* EDEBUG */
|
||||
if (**vp && eq(**vp, STRor)) {
|
||||
register int p2;
|
||||
int p2;
|
||||
|
||||
(*vp)++;
|
||||
p2 = exp2(vp, ignore);
|
||||
p2 = exp2x(vp, ignore);
|
||||
#ifdef EDEBUG
|
||||
etraci("exp3 p2", p2, vp);
|
||||
#endif /* EDEBUG */
|
||||
@ -276,16 +262,16 @@ exp2(vp, ignore)
|
||||
|
||||
static int
|
||||
exp2a(vp, ignore)
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
Char ***vp;
|
||||
int ignore;
|
||||
{
|
||||
register int p1 = exp2b(vp, ignore);
|
||||
int p1 = exp2b(vp, ignore);
|
||||
|
||||
#ifdef EDEBUG
|
||||
etraci("exp2a p1", p1, vp);
|
||||
#endif /* EDEBUG */
|
||||
if (**vp && eq(**vp, STRcaret)) {
|
||||
register int p2;
|
||||
int p2;
|
||||
|
||||
(*vp)++;
|
||||
p2 = exp2a(vp, ignore);
|
||||
@ -299,16 +285,16 @@ exp2a(vp, ignore)
|
||||
|
||||
static int
|
||||
exp2b(vp, ignore)
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
Char ***vp;
|
||||
int ignore;
|
||||
{
|
||||
register int p1 = exp2c(vp, ignore);
|
||||
int p1 = exp2c(vp, ignore);
|
||||
|
||||
#ifdef EDEBUG
|
||||
etraci("exp2b p1", p1, vp);
|
||||
#endif /* EDEBUG */
|
||||
if (**vp && eq(**vp, STRand)) {
|
||||
register int p2;
|
||||
int p2;
|
||||
|
||||
(*vp)++;
|
||||
p2 = exp2b(vp, ignore);
|
||||
@ -322,12 +308,12 @@ exp2b(vp, ignore)
|
||||
|
||||
static int
|
||||
exp2c(vp, ignore)
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
Char ***vp;
|
||||
int ignore;
|
||||
{
|
||||
register Char *p1 = exp3(vp, ignore);
|
||||
register Char *p2;
|
||||
register int i;
|
||||
Char *p1 = exp3(vp, ignore);
|
||||
Char *p2;
|
||||
int i;
|
||||
|
||||
#ifdef EDEBUG
|
||||
etracc("exp2c p1", p1, vp);
|
||||
@ -370,11 +356,11 @@ exp2c(vp, ignore)
|
||||
|
||||
static Char *
|
||||
exp3(vp, ignore)
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
Char ***vp;
|
||||
int ignore;
|
||||
{
|
||||
register Char *p1, *p2;
|
||||
register int i;
|
||||
Char *p1, *p2;
|
||||
int i;
|
||||
|
||||
p1 = exp3a(vp, ignore);
|
||||
#ifdef EDEBUG
|
||||
@ -416,11 +402,11 @@ exp3(vp, ignore)
|
||||
|
||||
static Char *
|
||||
exp3a(vp, ignore)
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
Char ***vp;
|
||||
int ignore;
|
||||
{
|
||||
register Char *p1, *p2, *op;
|
||||
register int i;
|
||||
Char *p1, *p2, *op;
|
||||
int i;
|
||||
|
||||
p1 = exp4(vp, ignore);
|
||||
#ifdef EDEBUG
|
||||
@ -446,18 +432,18 @@ exp3a(vp, ignore)
|
||||
|
||||
static Char *
|
||||
exp4(vp, ignore)
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
Char ***vp;
|
||||
int ignore;
|
||||
{
|
||||
register Char *p1, *p2;
|
||||
register int i = 0;
|
||||
Char *p1, *p2;
|
||||
int i = 0;
|
||||
|
||||
p1 = exp5(vp, ignore);
|
||||
#ifdef EDEBUG
|
||||
etracc("exp4 p1", p1, vp);
|
||||
#endif /* EDEBUG */
|
||||
if (isa(**vp, ADDOP)) {
|
||||
register Char *op = *(*vp)++;
|
||||
Char *op = *(*vp)++;
|
||||
|
||||
p2 = exp4(vp, ignore);
|
||||
#ifdef EDEBUG
|
||||
@ -483,11 +469,11 @@ exp4(vp, ignore)
|
||||
|
||||
static Char *
|
||||
exp5(vp, ignore)
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
Char ***vp;
|
||||
int ignore;
|
||||
{
|
||||
register Char *p1, *p2;
|
||||
register int i = 0;
|
||||
Char *p1, *p2;
|
||||
int i = 0;
|
||||
|
||||
p1 = exp6(vp, ignore);
|
||||
#ifdef EDEBUG
|
||||
@ -495,7 +481,7 @@ exp5(vp, ignore)
|
||||
#endif /* EDEBUG */
|
||||
|
||||
if (isa(**vp, MULOP)) {
|
||||
register Char *op = *(*vp)++;
|
||||
Char *op = *(*vp)++;
|
||||
if ((ignore & TEXP_NOGLOB) != 0)
|
||||
/*
|
||||
* We are just trying to get the right side of
|
||||
@ -537,11 +523,11 @@ exp5(vp, ignore)
|
||||
|
||||
static Char *
|
||||
exp6(vp, ignore)
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
Char ***vp;
|
||||
int ignore;
|
||||
{
|
||||
int ccode, i = 0;
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
|
||||
if (**vp == 0)
|
||||
stderror(ERR_NAME | ERR_EXPRESSION);
|
||||
@ -577,7 +563,7 @@ exp6(vp, ignore)
|
||||
return (putn(ccode));
|
||||
}
|
||||
if (eq(**vp, STRLbrace)) {
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command faket;
|
||||
Char *fakecom[2];
|
||||
|
||||
@ -635,7 +621,7 @@ exp6(vp, ignore)
|
||||
Char *
|
||||
filetest(cp, vp, ignore)
|
||||
Char *cp, ***vp;
|
||||
bool ignore;
|
||||
int ignore;
|
||||
{
|
||||
#ifdef convex
|
||||
struct cvxstat stb, *st = NULL;
|
||||
@ -658,7 +644,7 @@ filetest(cp, vp, ignore)
|
||||
|
||||
int i = 0;
|
||||
unsigned pmask = 0xffff;
|
||||
bool altout = 0;
|
||||
int altout = 0;
|
||||
Char *ft = cp, *dp, *ep, *strdev, *strino, *strF, *str, valtest = '\0',
|
||||
*errval = STR0;
|
||||
char *string, string0[8];
|
||||
@ -990,18 +976,18 @@ filetest(cp, vp, ignore)
|
||||
|
||||
static void
|
||||
evalav(v)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
{
|
||||
struct wordent paraml1;
|
||||
register struct wordent *hp = ¶ml1;
|
||||
struct wordent *hp = ¶ml1;
|
||||
struct command *t;
|
||||
register struct wordent *wdp = hp;
|
||||
struct wordent *wdp = hp;
|
||||
|
||||
set(STRstatus, Strsave(STR0), VAR_READWRITE);
|
||||
hp->prev = hp->next = hp;
|
||||
hp->word = STRNULL;
|
||||
while (*v) {
|
||||
register struct wordent *new =
|
||||
struct wordent *new =
|
||||
(struct wordent *) xcalloc(1, sizeof *wdp);
|
||||
|
||||
new->prev = wdp;
|
||||
@ -1021,8 +1007,8 @@ evalav(v)
|
||||
|
||||
static int
|
||||
isa(cp, what)
|
||||
register Char *cp;
|
||||
register int what;
|
||||
Char *cp;
|
||||
int what;
|
||||
{
|
||||
if (cp == 0)
|
||||
return ((what & RESTOP) != 0);
|
||||
@ -1072,7 +1058,7 @@ isa(cp, what)
|
||||
|
||||
static int
|
||||
egetn(cp)
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
{
|
||||
if (*cp && *cp != '-' && !Isdigit(*cp))
|
||||
stderror(ERR_NAME | ERR_EXPRESSION);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.file.c,v 3.23 2003/02/08 20:03:26 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.file.c,v 3.28 2005/01/05 16:06:13 christos Exp $ */
|
||||
/*
|
||||
* sh.file.c: File completion for csh. This file is not used in tcsh.
|
||||
*/
|
||||
@ -33,7 +33,7 @@
|
||||
#include "sh.h"
|
||||
#include "ed.h"
|
||||
|
||||
RCSID("$Id: sh.file.c,v 3.23 2003/02/08 20:03:26 christos Exp $")
|
||||
RCSID("$Id: sh.file.c,v 3.28 2005/01/05 16:06:13 christos Exp $")
|
||||
|
||||
#if defined(FILEC) && defined(TIOCSTI)
|
||||
|
||||
@ -64,8 +64,8 @@ static void back_to_col_1 __P((void));
|
||||
static void pushback __P((Char *));
|
||||
static void catn __P((Char *, Char *, int));
|
||||
static void copyn __P((Char *, Char *, int));
|
||||
static Char filetype __P((Char *, Char *));
|
||||
static void print_by_column __P((Char *, Char *[], int));
|
||||
static int filetype __P((Char *, Char *));
|
||||
static void print_by_column __P((Char *, Char *[], size_t));
|
||||
static Char *tilde __P((Char *, Char *));
|
||||
static void retype __P((void));
|
||||
static void beep __P((void));
|
||||
@ -75,7 +75,7 @@ static Char *getitem __P((DIR *, int));
|
||||
static void free_items __P((Char **, size_t));
|
||||
static int tsearch __P((Char *, COMMAND, int));
|
||||
static int compare __P((const ptr_t, const ptr_t));
|
||||
static int recognize __P((Char *, Char *, int, int));
|
||||
static int recognize __P((Char *, Char *, int, size_t));
|
||||
static int is_prefix __P((Char *, Char *));
|
||||
static int is_suffix __P((Char *, Char *));
|
||||
static int ignored __P((Char *));
|
||||
@ -86,7 +86,7 @@ static int ignored __P((Char *));
|
||||
* completion by default. Filec controls completion, nobeep controls
|
||||
* ringing the terminal bell on incomplete expansions.
|
||||
*/
|
||||
bool filec = 0;
|
||||
int filec = 0;
|
||||
|
||||
static void
|
||||
setup_tty(on)
|
||||
@ -226,7 +226,6 @@ pushback(string)
|
||||
Char *string;
|
||||
{
|
||||
Char *p;
|
||||
char c;
|
||||
#ifdef TERMIO
|
||||
# ifdef POSIX
|
||||
struct termios tty, tty_normal;
|
||||
@ -257,8 +256,14 @@ pushback(string)
|
||||
(void) ioctl(SHOUT, TCSETAW, (ioctl_t) &tty);
|
||||
# endif /* POSIX */
|
||||
|
||||
for (p = string; (c = *p) != '\0'; p++)
|
||||
(void) ioctl(SHOUT, TIOCSTI, (ioctl_t) & c);
|
||||
for (p = string; *p != '\0'; p++) {
|
||||
char buf[MB_LEN_MAX];
|
||||
size_t i, len;
|
||||
|
||||
len = one_wctomb(buf, *p & CHAR);
|
||||
for (i = 0; i < len; i++)
|
||||
(void) ioctl(SHOUT, TIOCSTI, (ioctl_t) &buf[i]);
|
||||
}
|
||||
# ifdef POSIX
|
||||
(void) tcsetattr(SHOUT, TCSANOW, &tty_normal);
|
||||
# else
|
||||
@ -315,7 +320,7 @@ copyn(des, src, count)
|
||||
*des = '\0';
|
||||
}
|
||||
|
||||
static Char
|
||||
static int
|
||||
filetype(dir, file)
|
||||
Char *dir, *file;
|
||||
{
|
||||
@ -354,9 +359,10 @@ static struct winsize win;
|
||||
static void
|
||||
print_by_column(dir, items, count)
|
||||
Char *dir, *items[];
|
||||
int count;
|
||||
size_t count;
|
||||
{
|
||||
int i, rows, r, c, maxwidth = 0, columns;
|
||||
size_t i;
|
||||
int rows, r, c, maxwidth = 0, columns;
|
||||
|
||||
if (ioctl(SHOUT, TIOCGWINSZ, (ioctl_t) & win) < 0 || win.ws_col == 0)
|
||||
win.ws_col = 80;
|
||||
@ -516,11 +522,7 @@ extract_dir_and_name(path, dir, name)
|
||||
copyn(dir, path, p - path);
|
||||
}
|
||||
}
|
||||
/* atp vmsposix - I need to remove all the setpwent
|
||||
* getpwent endpwent stuff. VMS_POSIX has getpwnam getpwuid
|
||||
* and getlogin. This needs fixing. (There is no access to
|
||||
* pw->passwd in VMS - a secure system benefit :-| )
|
||||
*/
|
||||
|
||||
static Char *
|
||||
getitem(dir_fd, looking_for_lognames)
|
||||
DIR *dir_fd;
|
||||
@ -530,7 +532,7 @@ getitem(dir_fd, looking_for_lognames)
|
||||
struct dirent *dirp;
|
||||
|
||||
if (looking_for_lognames) {
|
||||
#ifdef _VMS_POSIX
|
||||
#ifndef HAVE_GETPWENT
|
||||
return (NULL);
|
||||
#else
|
||||
if ((pw = getpwent()) == NULL)
|
||||
@ -581,19 +583,19 @@ tsearch(word, command, max_word_length)
|
||||
COMMAND command;
|
||||
{
|
||||
DIR *dir_fd;
|
||||
int numitems = 0, ignoring = TRUE, nignored = 0;
|
||||
int ignoring = TRUE, nignored = 0;
|
||||
int name_length, looking_for_lognames;
|
||||
Char tilded_dir[MAXPATHLEN + 1], dir[MAXPATHLEN + 1];
|
||||
Char name[MAXNAMLEN + 1], extended_name[MAXNAMLEN + 1];
|
||||
Char *item;
|
||||
Char **items = NULL;
|
||||
size_t maxitems = 0;
|
||||
size_t numitems = 0, maxitems = 0;
|
||||
|
||||
looking_for_lognames = (*word == '~') && (Strchr(word, '/') == NULL);
|
||||
if (looking_for_lognames) {
|
||||
#ifndef _VMS_POSIX
|
||||
#ifdef HAVE_GETPWENT
|
||||
(void) setpwent();
|
||||
#endif /*atp vmsposix */
|
||||
#endif
|
||||
copyn(name, &word[1], MAXNAMLEN); /* name sans ~ */
|
||||
dir_fd = NULL;
|
||||
}
|
||||
@ -641,20 +643,20 @@ tsearch(word, command, max_word_length)
|
||||
if (ignoring && numitems == 0 && nignored > 0) {
|
||||
ignoring = FALSE;
|
||||
nignored = 0;
|
||||
if (looking_for_lognames)
|
||||
#ifndef _VMS_POSIX
|
||||
if (looking_for_lognames) {
|
||||
#ifdef HAVE_GETPWENT
|
||||
(void) setpwent();
|
||||
#endif /* atp vmsposix */
|
||||
else
|
||||
} else
|
||||
rewinddir(dir_fd);
|
||||
goto again;
|
||||
}
|
||||
|
||||
if (looking_for_lognames)
|
||||
#ifndef _VMS_POSIX
|
||||
if (looking_for_lognames) {
|
||||
#ifndef HAVE_GETPWENT
|
||||
(void) endpwent();
|
||||
#endif /*atp vmsposix */
|
||||
else
|
||||
#endif
|
||||
} else
|
||||
(void) closedir(dir_fd);
|
||||
if (numitems == 0)
|
||||
return (0);
|
||||
@ -669,7 +671,7 @@ tsearch(word, command, max_word_length)
|
||||
return (numitems);
|
||||
}
|
||||
else { /* LIST */
|
||||
qsort((ptr_t) items, (size_t) numitems, sizeof(items[0]),
|
||||
qsort((ptr_t) items, numitems, sizeof(items[0]),
|
||||
(int (*) __P((const void *, const void *))) compare);
|
||||
print_by_column(looking_for_lognames ? NULL : tilded_dir,
|
||||
items, numitems);
|
||||
@ -684,13 +686,26 @@ 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));
|
||||
#ifdef WIDE_STRINGS
|
||||
errno = 0;
|
||||
|
||||
return (wcscoll(*(Char **) p, *(Char **) q));
|
||||
#else
|
||||
return (strcmp(*(char **) p, *(char **) q));
|
||||
#endif /* NLS && !NOSTRCOLL */
|
||||
char *p1, *q1;
|
||||
int res;
|
||||
|
||||
p1 = strsave(short2str(*(Char **) p));
|
||||
q1 = strsave(short2str(*(Char **) q));
|
||||
# if defined(NLS) && !defined(NOSTRCOLL)
|
||||
errno = 0; /* strcoll sets errno, another brain-damage */
|
||||
res = strcoll(p1, q1);
|
||||
# else
|
||||
res = strcmp(p1, q1);
|
||||
# endif /* NLS && !NOSTRCOLL */
|
||||
xfree (p1);
|
||||
xfree (q1);
|
||||
return res;
|
||||
#endif /* not WIDE_STRINGS */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -704,7 +719,8 @@ compare(p, q)
|
||||
static int
|
||||
recognize(extended_name, item, name_length, numitems)
|
||||
Char *extended_name, *item;
|
||||
int name_length, numitems;
|
||||
int name_length;
|
||||
size_t numitems;
|
||||
{
|
||||
if (numitems == 1) /* 1st match */
|
||||
copyn(extended_name, item, MAXNAMLEN);
|
||||
@ -763,21 +779,21 @@ tenex(inputline, inputline_size)
|
||||
int inputline_size;
|
||||
{
|
||||
int numitems, num_read;
|
||||
char tinputline[BUFSIZE];
|
||||
char tinputline[BUFSIZE + 1];
|
||||
|
||||
|
||||
setup_tty(ON);
|
||||
|
||||
while ((num_read = read(SHIN, tinputline, BUFSIZE)) > 0) {
|
||||
int i;
|
||||
static Char delims[] = {' ', '\'', '"', '\t', ';', '&', '<',
|
||||
'>', '(', ')', '|', '^', '%', '\0'};
|
||||
Char *str_end, *word_start, last_Char, should_retype;
|
||||
int space_left;
|
||||
COMMAND command;
|
||||
|
||||
for (i = 0; i < num_read; i++)
|
||||
inputline[i] = (unsigned char) tinputline[i];
|
||||
tinputline[num_read] = 0;
|
||||
Strcpy(inputline, str2short(tinputline));
|
||||
num_read = Strlen(inputline);
|
||||
last_Char = inputline[num_read - 1] & ASCII;
|
||||
|
||||
if (last_Char == '\n' || num_read == inputline_size)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.func.c,v 3.111 2004/05/13 15:23:39 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.func.c,v 3.126 2005/03/20 06:35:48 christos Exp $ */
|
||||
/*
|
||||
* sh.func.c: csh builtin functions
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.func.c,v 3.111 2004/05/13 15:23:39 christos Exp $")
|
||||
RCSID("$Id: sh.func.c,v 3.126 2005/03/20 06:35:48 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
#include "tw.h"
|
||||
@ -41,36 +41,42 @@ RCSID("$Id: sh.func.c,v 3.111 2004/05/13 15:23:39 christos Exp $")
|
||||
#include "nt.const.h"
|
||||
#endif /* WINNT_NATIVE */
|
||||
|
||||
#ifdef NLS_CATALOGS
|
||||
#ifdef HAVE_ICONV
|
||||
#include <langinfo.h>
|
||||
static iconv_t catgets_iconv; /* Or (iconv_t)-1 */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* C shell
|
||||
*/
|
||||
extern int just_signaled;
|
||||
extern char **environ;
|
||||
|
||||
extern bool MapsAreInited;
|
||||
extern bool NLSMapsAreInited;
|
||||
extern bool NoNLSRebind;
|
||||
extern bool GotTermCaps;
|
||||
extern int MapsAreInited;
|
||||
extern int NLSMapsAreInited;
|
||||
extern int GotTermCaps;
|
||||
|
||||
static int zlast = -1;
|
||||
|
||||
static void islogin __P((void));
|
||||
static void preread __P((void));
|
||||
static void doagain __P((void));
|
||||
static char *isrchx __P((int));
|
||||
static const char *isrchx __P((int));
|
||||
static void search __P((int, int, Char *));
|
||||
static int getword __P((Char *));
|
||||
static void toend __P((void));
|
||||
static void xecho __P((int, Char **));
|
||||
static bool islocale_var __P((Char *));
|
||||
static int islocale_var __P((Char *));
|
||||
static void wpfree __P((struct whyle *));
|
||||
|
||||
struct biltins *
|
||||
isbfunc(t)
|
||||
struct command *t;
|
||||
{
|
||||
register Char *cp = t->t_dcom[0];
|
||||
register struct biltins *bp, *bp1, *bp2;
|
||||
Char *cp = t->t_dcom[0];
|
||||
struct biltins *bp, *bp1, *bp2;
|
||||
static struct biltins label = {"", dozip, 0, 0};
|
||||
static struct biltins foregnd = {"%job", dofg1, 0, 0};
|
||||
static struct biltins backgnd = {"%job &", dobg1, 0, 0};
|
||||
@ -131,8 +137,8 @@ isbfunc(t)
|
||||
|
||||
void
|
||||
func(t, bp)
|
||||
register struct command *t;
|
||||
register struct biltins *bp;
|
||||
struct command *t;
|
||||
struct biltins *bp;
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -152,8 +158,8 @@ doonintr(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register Char *cp;
|
||||
register Char *vv = v[1];
|
||||
Char *cp;
|
||||
Char *vv = v[1];
|
||||
|
||||
USE(c);
|
||||
if (parintr == SIG_IGN)
|
||||
@ -250,6 +256,7 @@ dofiletest(v, c)
|
||||
{
|
||||
Char **fileptr, *ftest, *res;
|
||||
|
||||
USE(c);
|
||||
if (*(ftest = *++v) != '-')
|
||||
stderror(ERR_NAME | ERR_FILEINQ);
|
||||
++v;
|
||||
@ -288,11 +295,11 @@ prvars()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
doalias(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct varent *vp;
|
||||
register Char *p;
|
||||
struct varent *vp;
|
||||
Char *p;
|
||||
|
||||
USE(c);
|
||||
v++;
|
||||
@ -400,8 +407,8 @@ doif(v, kp)
|
||||
Char **v;
|
||||
struct command *kp;
|
||||
{
|
||||
register int i;
|
||||
register Char **vv;
|
||||
int i;
|
||||
Char **vv;
|
||||
|
||||
v++;
|
||||
i = expr(&v);
|
||||
@ -437,7 +444,7 @@ doif(v, kp)
|
||||
*/
|
||||
void
|
||||
reexecute(kp)
|
||||
register struct command *kp;
|
||||
struct command *kp;
|
||||
{
|
||||
kp->t_dflg &= F_SAVE;
|
||||
kp->t_dflg |= F_REPEAT;
|
||||
@ -477,7 +484,7 @@ void
|
||||
gotolab(lab)
|
||||
Char *lab;
|
||||
{
|
||||
register struct whyle *wp;
|
||||
struct whyle *wp;
|
||||
/*
|
||||
* While we still can, locate any unknown ends of existing loops. This
|
||||
* obscure code is the WORST result of the fact that we don't really parse.
|
||||
@ -501,10 +508,10 @@ gotolab(lab)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
doswitch(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register Char *cp, *lp;
|
||||
Char *cp, *lp;
|
||||
|
||||
USE(c);
|
||||
v++;
|
||||
@ -563,11 +570,11 @@ doexit(v, c)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
doforeach(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register Char *cp, *sp;
|
||||
register struct whyle *nwp;
|
||||
Char *cp, *sp;
|
||||
struct whyle *nwp;
|
||||
|
||||
USE(c);
|
||||
v++;
|
||||
@ -617,8 +624,8 @@ dowhile(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register int status;
|
||||
register bool again = whyles != 0 &&
|
||||
int status;
|
||||
int again = whyles != 0 &&
|
||||
SEEKEQ(&whyles->w_start, &lineloc) &&
|
||||
whyles->w_fename == 0;
|
||||
|
||||
@ -635,7 +642,7 @@ dowhile(v, c)
|
||||
if (*v)
|
||||
stderror(ERR_NAME | ERR_EXPRESSION);
|
||||
if (!again) {
|
||||
register struct whyle *nwp =
|
||||
struct whyle *nwp =
|
||||
(struct whyle *) xcalloc(1, sizeof(*nwp));
|
||||
|
||||
nwp->w_start = lineloc;
|
||||
@ -734,7 +741,7 @@ dorepeat(v, kp)
|
||||
int i = 1;
|
||||
|
||||
#ifdef BSDSIGS
|
||||
register sigmask_t omask = 0;
|
||||
sigmask_t omask = 0;
|
||||
#endif /* BSDSIGS */
|
||||
|
||||
do {
|
||||
@ -808,11 +815,11 @@ srchx(cp)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
isrchx(n)
|
||||
register int n;
|
||||
int n;
|
||||
{
|
||||
register struct srch *sp, *sp2;
|
||||
struct srch *sp, *sp2;
|
||||
|
||||
for (sp = srchn, sp2 = srchn + nsrchn; sp < sp2; sp++)
|
||||
if (sp->s_value == n)
|
||||
@ -827,12 +834,12 @@ static Char *Sgoal;
|
||||
static void
|
||||
search(type, level, goal)
|
||||
int type;
|
||||
register int level;
|
||||
int level;
|
||||
Char *goal;
|
||||
{
|
||||
Char wordbuf[BUFSIZE];
|
||||
register Char *aword = wordbuf;
|
||||
register Char *cp;
|
||||
Char *aword = wordbuf;
|
||||
Char *cp;
|
||||
struct whyle *wp;
|
||||
int wlevel = 0;
|
||||
|
||||
@ -941,10 +948,10 @@ search(type, level, goal)
|
||||
|
||||
static int
|
||||
getword(wp)
|
||||
register Char *wp;
|
||||
Char *wp;
|
||||
{
|
||||
int found = 0, first;
|
||||
int c, d;
|
||||
eChar c, d;
|
||||
|
||||
c = readc(1);
|
||||
d = 0;
|
||||
@ -954,8 +961,8 @@ getword(wp)
|
||||
if (c == '#')
|
||||
do
|
||||
c = readc(1);
|
||||
while (c >= 0 && c != '\n');
|
||||
if (c < 0)
|
||||
while (c != CHAR_ERR && c != '\n');
|
||||
if (c == CHAR_ERR)
|
||||
goto past;
|
||||
if (c == '\n') {
|
||||
if (wp)
|
||||
@ -975,7 +982,7 @@ getword(wp)
|
||||
else if (d == c)
|
||||
d = 0;
|
||||
}
|
||||
if (c < 0)
|
||||
if (c == CHAR_ERR)
|
||||
goto past;
|
||||
if (wp) {
|
||||
*wp++ = (Char) c;
|
||||
@ -1078,7 +1085,7 @@ wfree()
|
||||
#endif /* FDEBUG */
|
||||
|
||||
for (; whyles; whyles = nwp) {
|
||||
register struct whyle *wp = whyles;
|
||||
struct whyle *wp = whyles;
|
||||
nwp = wp->w_next;
|
||||
|
||||
#ifdef FDEBUG
|
||||
@ -1134,9 +1141,9 @@ doglob(v, c)
|
||||
static void
|
||||
xecho(sep, v)
|
||||
int sep;
|
||||
register Char **v;
|
||||
Char **v;
|
||||
{
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
int nonl = 0;
|
||||
#ifdef ECHO_STYLE
|
||||
int echo_style = ECHO_STYLE;
|
||||
@ -1185,7 +1192,7 @@ xecho(sep, v)
|
||||
nonl++, v++;
|
||||
|
||||
while ((cp = *v++) != 0) {
|
||||
register int c;
|
||||
Char c;
|
||||
|
||||
while ((c = *cp++) != 0) {
|
||||
if ((echo_style & SYSV_ECHO) != 0 && c == '\\') {
|
||||
@ -1242,7 +1249,7 @@ xecho(sep, v)
|
||||
break;
|
||||
}
|
||||
}
|
||||
xputchar(c | QUOTE);
|
||||
xputwchar(c | QUOTE);
|
||||
|
||||
}
|
||||
if (*v)
|
||||
@ -1264,7 +1271,7 @@ xecho(sep, v)
|
||||
}
|
||||
|
||||
/* check whether an environment variable should invoke 'set_locale()' */
|
||||
static bool
|
||||
static int
|
||||
islocale_var(var)
|
||||
Char *var;
|
||||
{
|
||||
@ -1272,7 +1279,7 @@ islocale_var(var)
|
||||
STRLANG, STRLC_ALL, STRLC_CTYPE, STRLC_NUMERIC,
|
||||
STRLC_TIME, STRLC_COLLATE, STRLC_MESSAGES, STRLC_MONETARY, 0
|
||||
};
|
||||
register Char **v;
|
||||
Char **v;
|
||||
|
||||
for (v = locale_vars; *v; ++v)
|
||||
if (eq(var, *v))
|
||||
@ -1283,12 +1290,10 @@ islocale_var(var)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
doprintenv(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
Char *e;
|
||||
extern bool output_raw;
|
||||
extern bool xlate_cr;
|
||||
|
||||
USE(c);
|
||||
if (setintr)
|
||||
@ -1300,7 +1305,7 @@ doprintenv(v, c)
|
||||
|
||||
v++;
|
||||
if (*v == 0) {
|
||||
register Char **ep;
|
||||
Char **ep;
|
||||
|
||||
xlate_cr = 1;
|
||||
for (ep = STR_environ; *ep; ep++)
|
||||
@ -1322,7 +1327,7 @@ doprintenv(v, c)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dosetenv(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
Char *vp, *lp;
|
||||
@ -1379,16 +1384,16 @@ dosetenv(v, c)
|
||||
# ifdef LC_COLLATE
|
||||
(void) setlocale(LC_COLLATE, "");
|
||||
# endif
|
||||
# ifdef LC_CTYPE
|
||||
(void) setlocale(LC_CTYPE, ""); /* for iscntrl */
|
||||
# endif /* LC_CTYPE */
|
||||
# ifdef NLS_CATALOGS
|
||||
# ifdef LC_MESSAGES
|
||||
(void) setlocale(LC_MESSAGES, "");
|
||||
# endif /* LC_MESSAGES */
|
||||
(void) catclose(catd);
|
||||
nlsclose();
|
||||
nlsinit();
|
||||
# endif /* NLS_CATALOGS */
|
||||
# ifdef LC_CTYPE
|
||||
(void) setlocale(LC_CTYPE, ""); /* for iscntrl */
|
||||
# endif /* LC_CTYPE */
|
||||
# ifdef SETLOCALEBUG
|
||||
dont_free = 0;
|
||||
# endif /* SETLOCALEBUG */
|
||||
@ -1398,7 +1403,7 @@ dosetenv(v, c)
|
||||
tw_cmd_free(); /* since the collation sequence has changed */
|
||||
for (k = 0200; k <= 0377 && !Isprint(k); k++)
|
||||
continue;
|
||||
AsciiOnly = k > 0377;
|
||||
AsciiOnly = MB_CUR_MAX == 1 && k > 0377;
|
||||
#else /* !NLS */
|
||||
AsciiOnly = 0;
|
||||
#endif /* NLS */
|
||||
@ -1412,7 +1417,7 @@ dosetenv(v, c)
|
||||
|
||||
#ifdef NLS_CATALOGS
|
||||
if (eq(vp, STRNLSPATH)) {
|
||||
(void) catclose(catd);
|
||||
nlsclose();
|
||||
nlsinit();
|
||||
}
|
||||
#endif
|
||||
@ -1510,7 +1515,7 @@ dosetenv(v, c)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dounsetenv(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
Char **ep, *p, *n;
|
||||
@ -1571,16 +1576,16 @@ dounsetenv(v, c)
|
||||
# ifdef LC_COLLATE
|
||||
(void) setlocale(LC_COLLATE, "");
|
||||
# endif
|
||||
# ifdef LC_CTYPE
|
||||
(void) setlocale(LC_CTYPE, ""); /* for iscntrl */
|
||||
# endif /* LC_CTYPE */
|
||||
# ifdef NLS_CATALOGS
|
||||
# ifdef LC_MESSAGES
|
||||
(void) setlocale(LC_MESSAGES, "");
|
||||
# endif /* LC_MESSAGES */
|
||||
(void) catclose(catd);
|
||||
nlsclose();
|
||||
nlsinit();
|
||||
# endif /* NLS_CATALOGS */
|
||||
# ifdef LC_CTYPE
|
||||
(void) setlocale(LC_CTYPE, ""); /* for iscntrl */
|
||||
# endif /* LC_CTYPE */
|
||||
# ifdef SETLOCALEBUG
|
||||
dont_free = 0;
|
||||
# endif /* SETLOCALEBUG */
|
||||
@ -1590,7 +1595,7 @@ dounsetenv(v, c)
|
||||
tw_cmd_free();/* since the collation sequence has changed */
|
||||
for (k = 0200; k <= 0377 && !Isprint(k); k++)
|
||||
continue;
|
||||
AsciiOnly = k > 0377;
|
||||
AsciiOnly = MB_CUR_MAX == 1 && k > 0377;
|
||||
#else /* !NLS */
|
||||
AsciiOnly = getenv("LANG") == NULL &&
|
||||
getenv("LC_CTYPE") == NULL;
|
||||
@ -1613,7 +1618,7 @@ dounsetenv(v, c)
|
||||
#endif /* COLOR_LS_F */
|
||||
#ifdef NLS_CATALOGS
|
||||
else if (eq(name, STRNLSPATH)) {
|
||||
(void) catclose(catd);
|
||||
nlsclose();
|
||||
nlsinit();
|
||||
}
|
||||
#endif
|
||||
@ -1627,7 +1632,7 @@ dounsetenv(v, c)
|
||||
|
||||
void
|
||||
tsetenv(name, val)
|
||||
Char *name, *val;
|
||||
const Char *name, *val;
|
||||
{
|
||||
#ifdef SETENV_IN_LIB
|
||||
/*
|
||||
@ -1645,8 +1650,9 @@ tsetenv(name, val)
|
||||
(void) strcpy(nameBuf, cname);
|
||||
setenv(nameBuf, short2str(val), 1);
|
||||
#else /* !SETENV_IN_LIB */
|
||||
register Char **ep = STR_environ;
|
||||
register Char *cp, *dp;
|
||||
Char **ep = STR_environ;
|
||||
const Char *ccp;
|
||||
Char *cp, *dp;
|
||||
Char *blk[2];
|
||||
Char **oep = ep;
|
||||
|
||||
@ -1655,13 +1661,13 @@ tsetenv(name, val)
|
||||
#endif /* WINNT_NATIVE */
|
||||
for (; *ep; ep++) {
|
||||
#ifdef WINNT_NATIVE
|
||||
for (cp = name, dp = *ep; *cp && Tolower(*cp & TRIM) == Tolower(*dp);
|
||||
cp++, dp++)
|
||||
for (ccp = name, dp = *ep; *ccp && Tolower(*ccp & TRIM) == Tolower(*dp);
|
||||
ccp++, dp++)
|
||||
#else
|
||||
for (cp = name, dp = *ep; *cp && (*cp & TRIM) == *dp; cp++, dp++)
|
||||
for (ccp = name, dp = *ep; *ccp && (*ccp & TRIM) == *dp; ccp++, dp++)
|
||||
#endif /* WINNT_NATIVE */
|
||||
continue;
|
||||
if (*cp != 0 || *dp != '=')
|
||||
if (*ccp != 0 || *dp != '=')
|
||||
continue;
|
||||
cp = Strspl(STRequal, val);
|
||||
xfree((ptr_t) * ep);
|
||||
@ -1686,8 +1692,8 @@ void
|
||||
Unsetenv(name)
|
||||
Char *name;
|
||||
{
|
||||
register Char **ep = STR_environ;
|
||||
register Char *cp, *dp;
|
||||
Char **ep = STR_environ;
|
||||
Char *cp, *dp;
|
||||
Char **oep = ep;
|
||||
|
||||
#ifdef WINNT_NATIVE
|
||||
@ -1713,11 +1719,11 @@ Unsetenv(name)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
doumask(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register Char *cp = v[1];
|
||||
register int i;
|
||||
Char *cp = v[1];
|
||||
int i;
|
||||
|
||||
USE(c);
|
||||
if (cp == 0) {
|
||||
@ -1737,6 +1743,9 @@ doumask(v, c)
|
||||
#ifndef HAVENOLIMIT
|
||||
# ifndef BSDLIMIT
|
||||
typedef long RLIM_TYPE;
|
||||
# ifdef _OSD_POSIX /* BS2000 */
|
||||
# include <ulimit.h>
|
||||
# endif
|
||||
# ifndef RLIM_INFINITY
|
||||
# if !defined(_MINIX) && !defined(__clipper__) && !defined(_CRAY)
|
||||
extern RLIM_TYPE ulimit();
|
||||
@ -1752,7 +1761,7 @@ doumask(v, c)
|
||||
# define toset(a) ((a) + 1)
|
||||
# endif /* aiws */
|
||||
# else /* BSDLIMIT */
|
||||
# if (defined(BSD4_4) || defined(__linux__) || (HPUXVERSION >= 1100)) && !defined(__386BSD__)
|
||||
# if (defined(BSD4_4) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) || (HPUXVERSION >= 1100)) && !defined(__386BSD__)
|
||||
typedef rlim_t RLIM_TYPE;
|
||||
# else
|
||||
# if defined(SOLARIS2) || (defined(sgi) && SYSVREL > 3)
|
||||
@ -1804,7 +1813,7 @@ doumask(v, c)
|
||||
# endif
|
||||
# endif /* SYSVREL > 3 && BSDLIMIT */
|
||||
|
||||
# if defined(__linux__) && defined(RLIMIT_AS) && !defined(RLIMIT_VMEM)
|
||||
# if (defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && defined(RLIMIT_AS) && !defined(RLIMIT_VMEM)
|
||||
# define RLIMIT_VMEM RLIMIT_AS
|
||||
# endif
|
||||
|
||||
@ -1850,6 +1859,10 @@ struct limits limits[] =
|
||||
{ RLIMIT_VMEM, "vmemoryuse", 1024, "kbytes" },
|
||||
# endif /* RLIMIT_VMEM */
|
||||
|
||||
# if defined(RLIMIT_HEAP) /* found on BS2000/OSD systems */
|
||||
{ RLIMIT_HEAP, "heapsize", 1024, "kbytes" },
|
||||
# endif /* RLIMIT_HEAP */
|
||||
|
||||
# ifdef RLIMIT_NOFILE
|
||||
{ RLIMIT_NOFILE, "descriptors", 1, "" },
|
||||
# endif /* RLIMIT_NOFILE */
|
||||
@ -1879,7 +1892,7 @@ struct limits limits[] =
|
||||
|
||||
static struct limits *findlim __P((Char *));
|
||||
static RLIM_TYPE getval __P((struct limits *, Char **));
|
||||
static void limtail __P((Char *, char*));
|
||||
static void limtail __P((Char *, const char *));
|
||||
static void plim __P((struct limits *, int));
|
||||
static int setlim __P((struct limits *, int, RLIM_TYPE));
|
||||
|
||||
@ -1907,7 +1920,7 @@ static struct limits *
|
||||
findlim(cp)
|
||||
Char *cp;
|
||||
{
|
||||
register struct limits *lp, *res;
|
||||
struct limits *lp, *res;
|
||||
|
||||
res = (struct limits *) NULL;
|
||||
for (lp = limits; lp->limconst >= 0; lp++)
|
||||
@ -1926,11 +1939,11 @@ findlim(cp)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dolimit(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct limits *lp;
|
||||
register RLIM_TYPE limit;
|
||||
struct limits *lp;
|
||||
RLIM_TYPE limit;
|
||||
int hard = 0;
|
||||
|
||||
USE(c);
|
||||
@ -1956,13 +1969,10 @@ dolimit(v, c)
|
||||
|
||||
static RLIM_TYPE
|
||||
getval(lp, v)
|
||||
register struct limits *lp;
|
||||
struct limits *lp;
|
||||
Char **v;
|
||||
{
|
||||
register float f;
|
||||
#ifndef atof /* This can be a macro on linux */
|
||||
extern double atof __P((const char *));
|
||||
#endif /* atof */
|
||||
float f;
|
||||
Char *cp = *v++;
|
||||
|
||||
f = atof(short2str(cp));
|
||||
@ -2060,12 +2070,12 @@ getval(lp, v)
|
||||
static void
|
||||
limtail(cp, str)
|
||||
Char *cp;
|
||||
char *str;
|
||||
const char *str;
|
||||
{
|
||||
char *sp;
|
||||
const char *sp;
|
||||
|
||||
sp = str;
|
||||
while (*cp && *cp == *str)
|
||||
while (*cp && *cp == (Char)*str)
|
||||
cp++, str++;
|
||||
if (*cp)
|
||||
stderror(ERR_BADSCALE, sp);
|
||||
@ -2075,14 +2085,14 @@ limtail(cp, str)
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
plim(lp, hard)
|
||||
register struct limits *lp;
|
||||
struct limits *lp;
|
||||
int hard;
|
||||
{
|
||||
# ifdef BSDLIMIT
|
||||
struct rlimit rlim;
|
||||
# endif /* BSDLIMIT */
|
||||
RLIM_TYPE limit;
|
||||
int div = lp->limdiv;
|
||||
int xdiv = lp->limdiv;
|
||||
|
||||
xprintf("%-13.13s", lp->limname);
|
||||
|
||||
@ -2106,29 +2116,35 @@ plim(lp, hard)
|
||||
if (limit >= (RLIM_INFINITY / 512))
|
||||
limit = RLIM_INFINITY;
|
||||
else
|
||||
div = (div == 1024 ? 2 : 1);
|
||||
xdiv = (xdiv == 1024 ? 2 : 1);
|
||||
}
|
||||
# endif /* !BSDLIMIT || FILESIZE512 */
|
||||
|
||||
if (limit == RLIM_INFINITY)
|
||||
xprintf("unlimited");
|
||||
else
|
||||
# if defined(RLIMIT_CPU) && defined(_OSD_POSIX)
|
||||
if (lp->limconst == RLIMIT_CPU &&
|
||||
(unsigned long)limit >= 0x7ffffffdUL)
|
||||
xprintf("unlimited");
|
||||
else
|
||||
# endif
|
||||
# ifdef RLIMIT_CPU
|
||||
if (lp->limconst == RLIMIT_CPU)
|
||||
psecs((long) limit);
|
||||
else
|
||||
# endif /* RLIMIT_CPU */
|
||||
xprintf("%ld %s", (long) (limit / div), lp->limscale);
|
||||
xprintf("%ld %s", (long) (limit / xdiv), lp->limscale);
|
||||
xputchar('\n');
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dounlimit(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct limits *lp;
|
||||
struct limits *lp;
|
||||
int lerr = 0;
|
||||
int hard = 0;
|
||||
int force = 0;
|
||||
@ -2167,7 +2183,7 @@ dounlimit(v, c)
|
||||
|
||||
static int
|
||||
setlim(lp, hard, limit)
|
||||
register struct limits *lp;
|
||||
struct limits *lp;
|
||||
int hard;
|
||||
RLIM_TYPE limit;
|
||||
{
|
||||
@ -2201,10 +2217,17 @@ setlim(lp, hard, limit)
|
||||
# endif /* aiws */
|
||||
if (ulimit(toset(lp->limconst), limit) < 0) {
|
||||
# endif /* BSDLIMIT */
|
||||
int err;
|
||||
char *op, *type;
|
||||
|
||||
err = errno;
|
||||
op = strsave(limit == RLIM_INFINITY ? CGETS(15, 2, "remove") :
|
||||
CGETS(15, 3, "set"));
|
||||
type = strsave(hard ? CGETS(15, 4, " hard") : "");
|
||||
xprintf(CGETS(15, 1, "%s: %s: Can't %s%s limit (%s)\n"), bname,
|
||||
lp->limname, limit == RLIM_INFINITY ? CGETS(15, 2, "remove") :
|
||||
CGETS(15, 3, "set"), hard ? CGETS(14, 4, " hard") : "",
|
||||
strerror(errno));
|
||||
lp->limname, op, type, strerror(err));
|
||||
xfree(type);
|
||||
xfree(op);
|
||||
return (-1);
|
||||
}
|
||||
return (0);
|
||||
@ -2323,9 +2346,9 @@ doeval(v, c)
|
||||
trim(gav);
|
||||
}
|
||||
|
||||
saveIN = dcopy(SHIN, -1);
|
||||
saveOUT = dcopy(SHOUT, -1);
|
||||
saveDIAG = dcopy(SHDIAG, -1);
|
||||
(void)close_on_exec(saveIN = dcopy(SHIN, -1), 1);
|
||||
(void)close_on_exec(saveOUT = dcopy(SHOUT, -1), 1);
|
||||
(void)close_on_exec(saveDIAG = dcopy(SHDIAG, -1), 1);
|
||||
|
||||
getexit(osetexit);
|
||||
|
||||
@ -2339,9 +2362,9 @@ doeval(v, c)
|
||||
#endif /* cray */
|
||||
evalvec = gav;
|
||||
evalp = 0;
|
||||
SHIN = dcopy(0, -1);
|
||||
SHOUT = dcopy(1, -1);
|
||||
SHDIAG = dcopy(2, -1);
|
||||
(void)close_on_exec(SHIN = dcopy(0, -1), 1);
|
||||
(void)close_on_exec(SHOUT = dcopy(1, -1), 1);
|
||||
(void)close_on_exec(SHDIAG = dcopy(2, -1), 1);
|
||||
#ifndef CLOSE_ON_EXEC
|
||||
didcch = 0;
|
||||
#endif /* CLOSE_ON_EXEC */
|
||||
@ -2359,9 +2382,9 @@ doeval(v, c)
|
||||
(void) close(SHIN);
|
||||
(void) close(SHOUT);
|
||||
(void) close(SHDIAG);
|
||||
SHIN = dmove(saveIN, oSHIN);
|
||||
SHOUT = dmove(saveOUT, oSHOUT);
|
||||
SHDIAG = dmove(saveDIAG, oSHDIAG);
|
||||
(void)close_on_exec (SHIN = dmove(saveIN, oSHIN), 1);
|
||||
(void)close_on_exec (SHOUT = dmove(saveOUT, oSHOUT), 1);
|
||||
(void)close_on_exec (SHDIAG = dmove(saveDIAG, oSHDIAG), 1);
|
||||
|
||||
if (gv)
|
||||
blkfree(gv);
|
||||
@ -2384,12 +2407,8 @@ struct command *c;
|
||||
/* would use print_by_column() in tw.parse.c but that assumes
|
||||
* we have an array of Char * to pass.. (sg)
|
||||
*/
|
||||
extern int Tty_raw_mode;
|
||||
extern int TermH; /* from the editor routines */
|
||||
extern int lbuffed; /* from sh.print.c */
|
||||
|
||||
register struct biltins *b;
|
||||
register int row, col, columns, rows;
|
||||
struct biltins *b;
|
||||
int row, col, columns, rows;
|
||||
unsigned int w, maxwidth;
|
||||
|
||||
USE(c);
|
||||
@ -2435,6 +2454,56 @@ struct command *c;
|
||||
flush();
|
||||
}
|
||||
|
||||
#ifdef NLS_CATALOGS
|
||||
#ifdef HAVE_ICONV
|
||||
char *
|
||||
iconv_catgets(ctd, set_id, msg_id, s)
|
||||
nl_catd ctd;
|
||||
int set_id, msg_id;
|
||||
const char *s;
|
||||
{
|
||||
static char *buf = NULL;
|
||||
static size_t buf_size = 0;
|
||||
|
||||
char *orig, *dest, *p;
|
||||
#ifdef __NetBSD__
|
||||
const char *src;
|
||||
#else
|
||||
char *src;
|
||||
#endif
|
||||
size_t src_size, dest_size;
|
||||
|
||||
orig = catgets(ctd, set_id, msg_id, s);
|
||||
if (catgets_iconv == (iconv_t)-1 || orig == s)
|
||||
return orig;
|
||||
src = orig;
|
||||
src_size = strlen(src) + 1;
|
||||
if (buf == NULL && (buf = xmalloc(buf_size = src_size + 32)) == NULL)
|
||||
return orig;
|
||||
dest = buf;
|
||||
while (src_size != 0) {
|
||||
dest_size = buf + buf_size - dest;
|
||||
if (iconv(catgets_iconv, &src, &src_size, &dest, &dest_size)
|
||||
== (size_t)-1) {
|
||||
switch (errno) {
|
||||
case E2BIG:
|
||||
if ((p = xrealloc(buf, buf_size * 2)) == NULL)
|
||||
return orig;
|
||||
buf_size *= 2;
|
||||
dest = p + (dest - buf);
|
||||
buf = p;
|
||||
break;
|
||||
|
||||
case EILSEQ: case EINVAL: default:
|
||||
return orig;
|
||||
}
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void
|
||||
nlsinit()
|
||||
{
|
||||
@ -2445,6 +2514,11 @@ nlsinit()
|
||||
xsnprintf((char *)catalog, sizeof(catalog), "tcsh.%s",
|
||||
short2str(varval(STRcatalog)));
|
||||
catd = catopen(catalog, MCLoadBySet);
|
||||
#ifdef HAVE_ICONV
|
||||
/* catgets (), not CGETS, the charset name should be in ASCII anyway. */
|
||||
catgets_iconv = iconv_open (nl_langinfo (CODESET),
|
||||
catgets(catd, 255, 1, "ASCII"));
|
||||
#endif /* HAVE_ICONV */
|
||||
#endif /* NLS_CATALOGS */
|
||||
#ifdef WINNT_NATIVE
|
||||
nls_dll_init();
|
||||
@ -2455,3 +2529,17 @@ nlsinit()
|
||||
editinit(); /* init the editor messages */
|
||||
terminit(); /* init the termcap messages */
|
||||
}
|
||||
|
||||
void
|
||||
nlsclose()
|
||||
{
|
||||
#ifdef NLS_CATALOGS
|
||||
#ifdef HAVE_ICONV
|
||||
if (catgets_iconv != (iconv_t)-1) {
|
||||
iconv_close(catgets_iconv);
|
||||
catgets_iconv = (iconv_t)-1;
|
||||
}
|
||||
#endif /* HAVE_ICONV */
|
||||
catclose(catd);
|
||||
#endif /* NLS_CATALOGS */
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.glob.c,v 3.55 2004/03/21 16:48:14 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.glob.c,v 3.62 2004/12/25 21:15:07 christos Exp $ */
|
||||
/*
|
||||
* sh.glob.c: Regular expression expansion
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.glob.c,v 3.55 2004/03/21 16:48:14 christos Exp $")
|
||||
RCSID("$Id: sh.glob.c,v 3.62 2004/12/25 21:15:07 christos Exp $")
|
||||
|
||||
#include "tc.h"
|
||||
#include "tw.h"
|
||||
@ -80,8 +80,8 @@ static Char **globexpand __P((Char **));
|
||||
static int globbrace __P((Char *, Char *, Char ***));
|
||||
static void expbrace __P((Char ***, Char ***, int));
|
||||
static void pword __P((int));
|
||||
static void psave __P((int));
|
||||
static void backeval __P((Char *, bool));
|
||||
static void psave __P((Char));
|
||||
static void backeval __P((Char *, int));
|
||||
|
||||
static Char *
|
||||
globtilde(nv, s)
|
||||
@ -186,19 +186,9 @@ globbrace(s, p, bl)
|
||||
|
||||
/* check for balanced braces */
|
||||
for (i = 0, pe = ++p; *pe; pe++)
|
||||
#ifdef DSPMBYTE
|
||||
if (Ismbyte1(*pe) && *(pe + 1) != EOS)
|
||||
pe ++;
|
||||
else
|
||||
#endif /* DSPMBYTE */
|
||||
if (*pe == LBRK) {
|
||||
/* Ignore everything between [] */
|
||||
for (++pe; *pe != RBRK && *pe != EOS; pe++)
|
||||
#ifdef DSPMBYTE
|
||||
if (Ismbyte1(*pe) && *(pe + 1) != EOS)
|
||||
pe ++;
|
||||
else
|
||||
#endif /* DSPMBYTE */
|
||||
continue;
|
||||
if (*pe == EOS) {
|
||||
blkfree(nv);
|
||||
@ -219,19 +209,9 @@ globbrace(s, p, bl)
|
||||
}
|
||||
|
||||
for (i = 0, pl = pm = p; pm <= pe; pm++)
|
||||
#ifdef DSPMBYTE
|
||||
if (Ismbyte1(*pm) && pm + 1 <= pe)
|
||||
pm ++;
|
||||
else
|
||||
#endif /* DSPMBYTE */
|
||||
switch (*pm) {
|
||||
case LBRK:
|
||||
for (++pm; *pm != RBRK && *pm != EOS; pm++)
|
||||
#ifdef DSPMBYTE
|
||||
if (Ismbyte1(*pm) && *(pm + 1) != EOS)
|
||||
pm ++;
|
||||
else
|
||||
#endif /* DSPMBYTE */
|
||||
continue;
|
||||
if (*pm == EOS) {
|
||||
*vl = NULL;
|
||||
@ -303,12 +283,6 @@ expbrace(nvp, elp, size)
|
||||
Char **bl;
|
||||
int len;
|
||||
|
||||
#if defined (DSPMBYTE)
|
||||
if (b != s && Ismbyte2(*b) && Ismbyte1(*(b-1))) {
|
||||
/* The "{" is the 2nd byte of a MB character */
|
||||
continue;
|
||||
}
|
||||
#endif /* DSPMBYTE */
|
||||
if ((len = globbrace(s, b, &bl)) < 0) {
|
||||
xfree((ptr_t) nv);
|
||||
stderror(ERR_MISSING, -len);
|
||||
@ -652,10 +626,10 @@ ginit()
|
||||
|
||||
void
|
||||
rscan(t, f)
|
||||
register Char **t;
|
||||
void (*f) __P((int));
|
||||
Char **t;
|
||||
void (*f) __P((Char));
|
||||
{
|
||||
register Char *p;
|
||||
Char *p;
|
||||
|
||||
while ((p = *t++) != '\0')
|
||||
while (*p)
|
||||
@ -664,9 +638,9 @@ rscan(t, f)
|
||||
|
||||
void
|
||||
trim(t)
|
||||
register Char **t;
|
||||
Char **t;
|
||||
{
|
||||
register Char *p;
|
||||
Char *p;
|
||||
|
||||
while ((p = *t++) != '\0')
|
||||
while (*p)
|
||||
@ -675,9 +649,9 @@ trim(t)
|
||||
|
||||
void
|
||||
tglob(t)
|
||||
register Char **t;
|
||||
Char **t;
|
||||
{
|
||||
register Char *p, *c;
|
||||
Char *p, *c;
|
||||
|
||||
while ((p = *t++) != '\0') {
|
||||
if (*p == '~' || *p == '=')
|
||||
@ -732,9 +706,9 @@ tglob(t)
|
||||
Char **
|
||||
dobackp(cp, literal)
|
||||
Char *cp;
|
||||
bool literal;
|
||||
int literal;
|
||||
{
|
||||
register Char *lp, *rp;
|
||||
Char *lp, *rp;
|
||||
Char *ep, word[LONGBSIZE];
|
||||
|
||||
if (pargv) {
|
||||
@ -750,15 +724,7 @@ dobackp(cp, literal)
|
||||
pargc = 0;
|
||||
pnleft = LONGBSIZE - 4;
|
||||
for (;;) {
|
||||
#if defined(DSPMBYTE)
|
||||
for (lp = cp;; lp++) { /* } */
|
||||
if (*lp == '`' &&
|
||||
(lp-1 < cp || !Ismbyte2(*lp) || !Ismbyte1(*(lp-1)))) {
|
||||
break;
|
||||
}
|
||||
#else /* DSPMBYTE */
|
||||
for (lp = cp; *lp != '`'; lp++) {
|
||||
#endif /* DSPMBYTE */
|
||||
if (*lp == 0) {
|
||||
if (pargcp != pargs)
|
||||
pword(LONGBSIZE);
|
||||
@ -786,12 +752,12 @@ dobackp(cp, literal)
|
||||
static void
|
||||
backeval(cp, literal)
|
||||
Char *cp;
|
||||
bool literal;
|
||||
int literal;
|
||||
{
|
||||
register int icnt, c;
|
||||
register Char *ip;
|
||||
int icnt;
|
||||
Char c, *ip;
|
||||
struct command faket;
|
||||
bool hadnl;
|
||||
int hadnl;
|
||||
int pvec[2], quoted;
|
||||
Char *fakecom[2], ibuf[BUFSIZE];
|
||||
char tibuf[BUFSIZE];
|
||||
@ -824,7 +790,8 @@ backeval(cp, literal)
|
||||
*/
|
||||
mypipe(pvec);
|
||||
if (pfork(&faket, -1) == 0) {
|
||||
struct command *t;
|
||||
jmp_buf_t osetexit;
|
||||
struct command *volatile t;
|
||||
|
||||
(void) close(pvec[0]);
|
||||
(void) dmove(pvec[1], 1);
|
||||
@ -841,7 +808,7 @@ backeval(cp, literal)
|
||||
arginp = cp;
|
||||
for (arginp = cp; *cp; cp++) {
|
||||
*cp &= TRIM;
|
||||
if (*cp == '\n' || *cp == '\r')
|
||||
if (is_set(STRcsubstnonl) && (*cp == '\n' || *cp == '\r'))
|
||||
*cp = ' ';
|
||||
}
|
||||
|
||||
@ -853,26 +820,58 @@ backeval(cp, literal)
|
||||
evalvec = NULL;
|
||||
alvecp = NULL;
|
||||
evalp = NULL;
|
||||
(void) lex(¶ml);
|
||||
if (seterr)
|
||||
stderror(ERR_OLD);
|
||||
alias(¶ml);
|
||||
t = syntax(paraml.next, ¶ml, 0);
|
||||
if (seterr)
|
||||
stderror(ERR_OLD);
|
||||
if (t)
|
||||
t->t_dflg |= F_NOFORK;
|
||||
|
||||
t = NULL;
|
||||
getexit(osetexit);
|
||||
for (;;) {
|
||||
|
||||
if (paraml.next && paraml.next != ¶ml)
|
||||
freelex(¶ml);
|
||||
|
||||
paraml.next = paraml.prev = ¶ml;
|
||||
paraml.word = STRNULL;
|
||||
(void) setexit();
|
||||
justpr = 0;
|
||||
|
||||
/*
|
||||
* For the sake of reset()
|
||||
*/
|
||||
freelex(¶ml);
|
||||
if (t)
|
||||
freesyn(t), t = NULL;
|
||||
|
||||
if (haderr) {
|
||||
/* unwind */
|
||||
doneinp = 0;
|
||||
resexit(osetexit);
|
||||
reset();
|
||||
}
|
||||
if (seterr) {
|
||||
xfree((ptr_t) seterr);
|
||||
seterr = NULL;
|
||||
}
|
||||
|
||||
(void) lex(¶ml);
|
||||
if (seterr)
|
||||
stderror(ERR_OLD);
|
||||
alias(¶ml);
|
||||
t = syntax(paraml.next, ¶ml, 0);
|
||||
if (seterr)
|
||||
stderror(ERR_OLD);
|
||||
#ifdef SIGTSTP
|
||||
(void) sigignore(SIGTSTP);
|
||||
(void) sigignore(SIGTSTP);
|
||||
#endif
|
||||
#ifdef SIGTTIN
|
||||
(void) sigignore(SIGTTIN);
|
||||
(void) sigignore(SIGTTIN);
|
||||
#endif
|
||||
#ifdef SIGTTOU
|
||||
(void) sigignore(SIGTTOU);
|
||||
(void) sigignore(SIGTTOU);
|
||||
#endif
|
||||
execute(t, -1, NULL, NULL, TRUE);
|
||||
exitstat();
|
||||
execute(t, -1, NULL, NULL, TRUE);
|
||||
|
||||
freelex(¶ml);
|
||||
freesyn(t), t = NULL;
|
||||
}
|
||||
}
|
||||
xfree((ptr_t) cp);
|
||||
(void) close(pvec[1]);
|
||||
@ -880,21 +879,47 @@ backeval(cp, literal)
|
||||
ip = NULL;
|
||||
do {
|
||||
int cnt = 0;
|
||||
char *tmp;
|
||||
|
||||
tmp = tibuf;
|
||||
for (;;) {
|
||||
if (icnt == 0) {
|
||||
int i;
|
||||
while (icnt == 0) {
|
||||
int i, eof;
|
||||
|
||||
ip = ibuf;
|
||||
do
|
||||
icnt = read(pvec[0], tibuf, BUFSIZE);
|
||||
icnt = read(pvec[0], tmp, tibuf + BUFSIZE - tmp);
|
||||
while (icnt == -1 && errno == EINTR);
|
||||
eof = 0;
|
||||
if (icnt <= 0) {
|
||||
c = -1;
|
||||
break;
|
||||
if (tmp == tibuf)
|
||||
goto eof;
|
||||
icnt = 0;
|
||||
eof = 1;
|
||||
}
|
||||
for (i = 0; i < icnt; i++)
|
||||
ip[i] = (unsigned char) tibuf[i];
|
||||
icnt += tmp - tibuf;
|
||||
i = 0;
|
||||
tmp = tibuf;
|
||||
while (tmp < tibuf + icnt) {
|
||||
int len;
|
||||
|
||||
len = normal_mbtowc(&ip[i], tmp, tibuf + icnt - tmp);
|
||||
if (len == -1) {
|
||||
reset_mbtowc();
|
||||
if (!eof && (size_t)(tibuf + icnt - tmp) < MB_CUR_MAX) {
|
||||
break; /* Maybe a partial character */
|
||||
}
|
||||
ip[i] = (unsigned char) *tmp | INVALID_BYTE; /* Error */
|
||||
}
|
||||
if (len <= 0)
|
||||
len = 1;
|
||||
i++;
|
||||
tmp += len;
|
||||
}
|
||||
if (tmp != tibuf)
|
||||
memmove (tibuf, tmp, tibuf + icnt - tmp);
|
||||
tmp = tibuf + (tibuf + icnt - tmp);
|
||||
icnt = i;
|
||||
}
|
||||
if (hadnl)
|
||||
break;
|
||||
@ -925,10 +950,11 @@ backeval(cp, literal)
|
||||
* If we didn't make empty words here when literal was set then we
|
||||
* would lose blank lines.
|
||||
*/
|
||||
if (c != -1 && (cnt || literal))
|
||||
if (c != 0 && (cnt || literal))
|
||||
pword(BUFSIZE);
|
||||
hadnl = 0;
|
||||
} while (c >= 0);
|
||||
} while (c > 0);
|
||||
eof:
|
||||
(void) close(pvec[0]);
|
||||
pwait();
|
||||
prestjob();
|
||||
@ -936,7 +962,7 @@ backeval(cp, literal)
|
||||
|
||||
static void
|
||||
psave(c)
|
||||
int c;
|
||||
Char c;
|
||||
{
|
||||
if (--pnleft <= 0)
|
||||
stderror(ERR_WTOOLONG);
|
||||
@ -953,6 +979,7 @@ pword(bufsiz)
|
||||
pargv = (Char **) xrealloc((ptr_t) pargv,
|
||||
(size_t) (pargsiz * sizeof(Char *)));
|
||||
}
|
||||
NLSQuote(pargs);
|
||||
pargv[pargc++] = Strsave(pargs);
|
||||
pargv[pargc] = NULL;
|
||||
pargcp = pargs;
|
||||
@ -987,12 +1014,12 @@ Gnmatch(string, pattern, endstr)
|
||||
if (endstr == NULL)
|
||||
/* Exact matches only */
|
||||
for (p = blk; *p; p++)
|
||||
gres |= t_pmatch(string, *p, &tstring, 0) == 2 ? 1 : 0;
|
||||
gres |= t_pmatch(string, *p, &tstring, 1) == 2 ? 1 : 0;
|
||||
else {
|
||||
/* partial matches */
|
||||
int minc = 0x7fffffff;
|
||||
for (p = blk; *p; p++)
|
||||
if (t_pmatch(string, *p, &tstring, 0) != 0) {
|
||||
if (t_pmatch(string, *p, &tstring, 1) != 0) {
|
||||
int t = (int) (tstring - string);
|
||||
gres |= 1;
|
||||
if (minc == -1 || minc > t)
|
||||
@ -1016,20 +1043,22 @@ t_pmatch(string, pattern, estr, cs)
|
||||
Char *string, *pattern, **estr;
|
||||
int cs;
|
||||
{
|
||||
Char stringc, patternc;
|
||||
NLSChar stringc, patternc, rangec;
|
||||
int match, negate_range;
|
||||
Char rangec, *oestr, *pestr;
|
||||
Char *oestr, *pestr, *nstring;
|
||||
|
||||
for (;; ++string) {
|
||||
stringc = *string & TRIM;
|
||||
for (nstring = string;; string = nstring) {
|
||||
stringc = *nstring++;
|
||||
TRIM_AND_EXTEND(nstring, stringc);
|
||||
/*
|
||||
* apollo compiler bug: switch (patternc = *pattern++) dies
|
||||
*/
|
||||
patternc = *pattern++;
|
||||
TRIM_AND_EXTEND(pattern, patternc);
|
||||
switch (patternc) {
|
||||
case 0:
|
||||
case '\0':
|
||||
*estr = string;
|
||||
return (stringc == 0 ? 2 : 1);
|
||||
return (stringc == '\0' ? 2 : 1);
|
||||
case '?':
|
||||
if (stringc == 0)
|
||||
return (0);
|
||||
@ -1044,7 +1073,7 @@ t_pmatch(string, pattern, estr, cs)
|
||||
oestr = *estr;
|
||||
pestr = NULL;
|
||||
|
||||
do {
|
||||
for (;;) {
|
||||
switch(t_pmatch(string, pattern, estr, cs)) {
|
||||
case 0:
|
||||
break;
|
||||
@ -1057,8 +1086,11 @@ t_pmatch(string, pattern, estr, cs)
|
||||
abort(); /* Cannot happen */
|
||||
}
|
||||
*estr = string;
|
||||
stringc = *string++;
|
||||
if (!stringc)
|
||||
break;
|
||||
TRIM_AND_EXTEND(string, stringc);
|
||||
}
|
||||
while (*string++);
|
||||
|
||||
if (pestr) {
|
||||
*estr = pestr;
|
||||
@ -1078,22 +1110,34 @@ t_pmatch(string, pattern, estr, cs)
|
||||
break;
|
||||
if (match)
|
||||
continue;
|
||||
if (rangec == '-' && *(pattern-2) != '[' && *pattern != ']') {
|
||||
match = (globcharcoll(stringc, *pattern & TRIM, cs) <= 0 &&
|
||||
globcharcoll(*(pattern-2) & TRIM, stringc, cs) <= 0);
|
||||
TRIM_AND_EXTEND(pattern, rangec);
|
||||
if (*pattern == '-' && pattern[1] != ']') {
|
||||
NLSChar rangec2;
|
||||
pattern++;
|
||||
rangec2 = *pattern++;
|
||||
TRIM_AND_EXTEND(pattern, rangec2);
|
||||
match = (globcharcoll(stringc, rangec2, 0) <= 0 &&
|
||||
globcharcoll(rangec, stringc, 0) <= 0);
|
||||
}
|
||||
else
|
||||
match = (stringc == (rangec & TRIM));
|
||||
match = (stringc == rangec);
|
||||
}
|
||||
if (rangec == 0)
|
||||
if (rangec == '\0')
|
||||
stderror(ERR_NAME | ERR_MISSING, ']');
|
||||
if ((!match) && (stringc == '\0'))
|
||||
return (0);
|
||||
if (match == negate_range)
|
||||
return (0);
|
||||
*estr = string;
|
||||
break;
|
||||
default:
|
||||
if ((patternc & TRIM) != stringc)
|
||||
TRIM_AND_EXTEND(pattern, patternc);
|
||||
if (cs ? patternc != stringc
|
||||
#if defined (NLS) && defined (SHORT_STRINGS)
|
||||
: towlower(patternc) != towlower(stringc))
|
||||
#else
|
||||
: Tolower(patternc) != Tolower(stringc))
|
||||
#endif
|
||||
return (0);
|
||||
*estr = string;
|
||||
break;
|
||||
@ -1105,7 +1149,7 @@ void
|
||||
Gcat(s1, s2)
|
||||
Char *s1, *s2;
|
||||
{
|
||||
register Char *p, *q;
|
||||
Char *p, *q;
|
||||
int n;
|
||||
|
||||
for (p = s1; *p++;)
|
||||
@ -1129,7 +1173,7 @@ Gcat(s1, s2)
|
||||
#if defined(FILEC) && defined(TIOCSTI)
|
||||
int
|
||||
sortscmp(a, b)
|
||||
register Char **a, **b;
|
||||
Char **a, **b;
|
||||
{
|
||||
if (!a) /* check for NULL */
|
||||
return (b ? 1 : 0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.h,v 3.114 2004/02/21 20:34:25 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.h,v 3.133 2005/03/25 18:46:41 kim Exp $ */
|
||||
/*
|
||||
* sh.h: Catch it all globals and includes file!
|
||||
*/
|
||||
@ -35,10 +35,22 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef HAVE_QUAD
|
||||
#ifdef __GNUC__
|
||||
#define HAVE_QUAD 1
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
# include <iconv.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H) && !defined(WINNT_NATIVE)
|
||||
typedef unsigned long intptr_t;
|
||||
#endif
|
||||
|
||||
#ifndef EXTERN
|
||||
@ -55,7 +67,7 @@
|
||||
#endif /* IZERO */
|
||||
#ifndef IZERO_STRUCT
|
||||
# define IZERO_STRUCT
|
||||
# endif /* IZERO_STRUCT */
|
||||
#endif /* IZERO_STRUCT */
|
||||
|
||||
#ifndef WINNT_NATIVE
|
||||
# define INIT_ZERO
|
||||
@ -78,33 +90,41 @@
|
||||
#endif
|
||||
|
||||
#ifdef SHORT_STRINGS
|
||||
#include <wchar.h>
|
||||
# ifdef WIDE_STRINGS
|
||||
typedef wchar_t Char;
|
||||
typedef unsigned long uChar;
|
||||
typedef wint_t eChar; /* Can contain any Char value or CHAR_ERR */
|
||||
#define CHAR_ERR WEOF /* Pretty please, use bit 31... */
|
||||
#define normal_mbtowc(PWC, S, N) rt_mbtowc(PWC, S, N)
|
||||
#define reset_mbtowc() mbtowc(NULL, NULL, 0)
|
||||
# else
|
||||
typedef short Char;
|
||||
typedef unsigned short uChar;
|
||||
typedef int eChar;
|
||||
#define CHAR_ERR (-1)
|
||||
#define normal_mbtowc(PWC, S, N) ((void)(N), *(PWC) = (unsigned char)*(S), 1)
|
||||
#define reset_mbtowc() ((void)0)
|
||||
# endif
|
||||
# define SAVE(a) (Strsave(str2short(a)))
|
||||
#else
|
||||
typedef char Char;
|
||||
typedef unsigned char uChar;
|
||||
typedef int eChar;
|
||||
#define CHAR_ERR (-1)
|
||||
#define normal_mbtowc(PWC, S, N) ((void)(N), *(PWC) = (unsigned char)*(S), 1)
|
||||
#define reset_mbtowc() ((void)0)
|
||||
# define SAVE(a) (strsave(a))
|
||||
#endif
|
||||
#if SIZEOF_WCHAR_T >= 4
|
||||
typedef wchar_t NLSChar;
|
||||
#else
|
||||
/* Assumes sizeof (int) >= 4, unlike some parts of tcsh */
|
||||
typedef int NLSChar;
|
||||
#endif
|
||||
|
||||
/* Elide unused argument warnings */
|
||||
#define USE(a) (void) (a)
|
||||
/*
|
||||
* If your compiler complains, then you can either
|
||||
* throw it away and get gcc or, use the following define
|
||||
* and get rid of the typedef.
|
||||
* [The 4.2/3BSD vax compiler does not like that]
|
||||
* Both MULTIFLOW and PCC compilers exhbit this bug. -- sterling@netcom.com
|
||||
*/
|
||||
#ifdef SIGVOID
|
||||
# if (defined(vax) || defined(uts) || defined(MULTIFLOW) || defined(PCC)) && !defined(__GNUC__)
|
||||
# define sigret_t void
|
||||
# else /* !((vax || uts || MULTIFLOW || PCC) && !__GNUC__) */
|
||||
typedef void sigret_t;
|
||||
# endif /* (vax || uts || MULTIFLOW || PCC) && !__GNUC__ */
|
||||
#else /* !SIGVOID */
|
||||
typedef int sigret_t;
|
||||
#endif /* SIGVOID */
|
||||
|
||||
/*
|
||||
* Return true if the path is absolute
|
||||
@ -164,6 +184,7 @@ typedef int sigret_t;
|
||||
* 0, 1, and 2 so that it is easy to set up these standards for invoked
|
||||
* commands.
|
||||
*/
|
||||
#define FSAFE 5 /* We keep the first 5 descriptors untouched */
|
||||
#define FSHTTY 15 /* /dev/tty when manip pgrps */
|
||||
#define FSHIN 16 /* Preferred desc for shell input */
|
||||
#define FSHOUT 17 /* ... shell output */
|
||||
@ -269,28 +290,17 @@ typedef int sigret_t;
|
||||
#endif /* sonyrisc */
|
||||
|
||||
#if defined(POSIX) && !defined(WINNT_NATIVE)
|
||||
/*
|
||||
* We should be using setpgid and setpgid
|
||||
* by now, but in some systems we use the
|
||||
* old routines...
|
||||
*/
|
||||
# if !defined(__APPLE__)
|
||||
# define getpgrp __getpgrp
|
||||
# define setpgrp __setpgrp
|
||||
# endif
|
||||
# include <unistd.h>
|
||||
# undef getpgrp
|
||||
# undef setpgrp
|
||||
|
||||
/*
|
||||
* the gcc+protoize version of <stdlib.h>
|
||||
* redefines malloc(), so we define the following
|
||||
* to avoid it.
|
||||
*/
|
||||
# if defined(SYSMALLOC) || defined(linux) || defined(sgi) || defined(_OSD_POSIX)
|
||||
# if defined(SYSMALLOC) || defined(linux) || defined(__GNU__) || defined(__GLIBC__) || defined(sgi) || defined(_OSD_POSIX)
|
||||
# define NO_FIX_MALLOC
|
||||
# include <stdlib.h>
|
||||
# else /* linux */
|
||||
# else /* glibc */
|
||||
# define _GNU_STDLIB_H
|
||||
# define malloc __malloc
|
||||
# define free __free
|
||||
@ -301,11 +311,11 @@ typedef int sigret_t;
|
||||
# undef free
|
||||
# undef calloc
|
||||
# undef realloc
|
||||
# endif /* linux || sgi */
|
||||
# endif /* glibc || sgi */
|
||||
# include <limits.h>
|
||||
#endif /* POSIX && !WINNT_NATIVE */
|
||||
|
||||
#if SYSVREL > 0 || defined(_IBMR2) || defined(_MINIX) || defined(linux)
|
||||
#if SYSVREL > 0 || defined(_IBMR2) || defined(_MINIX) || defined(linux) || defined(__GNU__) || defined(__GLIBC__)
|
||||
# if !defined(pyr) && !defined(stellar)
|
||||
# include <time.h>
|
||||
# ifdef _MINIX
|
||||
@ -347,7 +357,7 @@ typedef int sigret_t;
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#if __STDC__ || defined(FUNCPROTO)
|
||||
#if defined(PROTOTYPES)
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
#ifdef _MINIX
|
||||
@ -357,16 +367,19 @@ typedef int sigret_t;
|
||||
#endif /* _MINIX */
|
||||
#endif
|
||||
|
||||
#ifdef DIRENT
|
||||
#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
#else
|
||||
# ifdef hp9000s500
|
||||
# ifdef HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# else
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# define dirent direct
|
||||
#endif /* DIRENT */
|
||||
#endif /* HAVE_DIRENT_H */
|
||||
#ifndef HAVE_STRUCT_DIRENT_D_INO
|
||||
# define d_ino d_fileno
|
||||
#endif
|
||||
#if defined(hpux) || defined(sgi) || defined(OREO) || defined(COHERENT)
|
||||
# include <stdio.h> /* So the fgetpwent() prototypes work */
|
||||
#endif /* hpux || sgi || OREO || COHERENT */
|
||||
@ -374,12 +387,12 @@ typedef int sigret_t;
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#endif /* WINNT_NATIVE */
|
||||
#ifdef PW_SHADOW
|
||||
#ifdef HAVE_SHADOW_H
|
||||
# include <shadow.h>
|
||||
#endif /* PW_SHADOW */
|
||||
#ifdef PW_AUTH
|
||||
#endif /* HAVE_SHADOW_H */
|
||||
#ifdef HAVE_AUTH_H
|
||||
# include <auth.h>
|
||||
#endif /* PW_AUTH */
|
||||
#endif /* HAVE_AUTH_H */
|
||||
#if defined(BSD) && !defined(POSIX)
|
||||
# include <strings.h>
|
||||
# define strchr(a, b) index(a, b)
|
||||
@ -404,7 +417,7 @@ typedef int sigret_t;
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <sys/socket.h>
|
||||
# if (defined(_SS_SIZE) || defined(_SS_MAXSIZE)) && !defined(NO_SS_FAMILY)
|
||||
# if (defined(_SS_SIZE) || defined(_SS_MAXSIZE)) && defined(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)
|
||||
# if !defined(__APPLE__) /* Damnit, where is getnameinfo() folks? */
|
||||
# if !defined(sgi)
|
||||
# define INET6
|
||||
@ -420,19 +433,10 @@ typedef int sigret_t;
|
||||
*/
|
||||
#undef __P
|
||||
#ifndef __P
|
||||
# if __STDC__ || defined(FUNCPROTO)
|
||||
# ifndef FUNCPROTO
|
||||
# define FUNCPROTO
|
||||
# endif
|
||||
# if defined(PROTOTYPES)
|
||||
# define __P(a) a
|
||||
# else
|
||||
# define __P(a) ()
|
||||
# if !defined(__STDC__)
|
||||
# define const
|
||||
# ifndef apollo
|
||||
# define volatile /* Apollo 'c' extensions need this */
|
||||
# endif /* apollo */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -456,8 +460,6 @@ typedef void pret_t;
|
||||
# endif /* (vax || uts || MULTIFLOW || PCC) && !__GNUC__ */
|
||||
#endif /* PURIFY */
|
||||
|
||||
typedef int bool;
|
||||
|
||||
/*
|
||||
* ASCII vs. EBCDIC
|
||||
*/
|
||||
@ -469,20 +471,17 @@ typedef int bool;
|
||||
|
||||
#include "sh.types.h"
|
||||
|
||||
#ifndef __NetBSD__ /* XXX */
|
||||
#ifndef WINNT_NATIVE
|
||||
# ifndef POSIX
|
||||
# ifndef GETPGRP_VOID
|
||||
extern pid_t getpgrp __P((int));
|
||||
# else /* POSIX */
|
||||
# if (defined(BSD) && !defined(BSD4_4)) || defined(SUNOS4) || defined(IRIS4D) || defined(DGUX)
|
||||
extern pid_t getpgrp __P((int));
|
||||
# else /* !(BSD || SUNOS4 || IRIS4D || DGUX) */
|
||||
# else
|
||||
extern pid_t getpgrp __P((void));
|
||||
# endif /* BSD || SUNOS4 || IRISD || DGUX */
|
||||
# endif /* POSIX */
|
||||
extern pid_t setpgrp __P((pid_t, pid_t));
|
||||
# endif
|
||||
#endif /* !WINNT_NATIVE */
|
||||
#endif
|
||||
|
||||
typedef sigret_t (*signalfun_t) __P((int));
|
||||
typedef RETSIGTYPE (*signalfun_t) __P((int));
|
||||
|
||||
#ifndef lint
|
||||
typedef ptr_t memalign_t;
|
||||
@ -575,40 +574,43 @@ extern void DebugFree __P((ptr_t, char *, int));
|
||||
/*
|
||||
* Global flags
|
||||
*/
|
||||
EXTERN bool chkstop IZERO; /* Warned of stopped jobs... allow exit */
|
||||
EXTERN int chkstop IZERO; /* Warned of stopped jobs... allow exit */
|
||||
|
||||
#if (defined(FIOCLEX) && defined(FIONCLEX)) || defined(F_SETFD)
|
||||
# define CLOSE_ON_EXEC
|
||||
#else
|
||||
EXTERN bool didcch IZERO; /* Have closed unused fd's for child */
|
||||
EXTERN int didcch IZERO; /* Have closed unused fd's for child */
|
||||
#endif /* (FIOCLEX && FIONCLEX) || F_SETFD */
|
||||
|
||||
EXTERN bool didfds IZERO; /* Have setup i/o fd's for child */
|
||||
EXTERN bool doneinp IZERO; /* EOF indicator after reset from readc */
|
||||
EXTERN bool exiterr IZERO; /* Exit if error or non-zero exit status */
|
||||
EXTERN bool child IZERO; /* Child shell ... errors cause exit */
|
||||
EXTERN bool haderr IZERO; /* Reset was because of an error */
|
||||
EXTERN bool intty IZERO; /* Input is a tty */
|
||||
EXTERN bool intact IZERO; /* We are interactive... therefore prompt */
|
||||
EXTERN bool justpr IZERO; /* Just print because of :p hist mod */
|
||||
EXTERN bool loginsh IZERO; /* We are a loginsh -> .login/.logout */
|
||||
EXTERN bool neednote IZERO; /* Need to pnotify() */
|
||||
EXTERN bool noexec IZERO; /* Don't execute, just syntax check */
|
||||
EXTERN bool pjobs IZERO; /* want to print jobs if interrupted */
|
||||
EXTERN bool setintr IZERO; /* Set interrupts on/off -> Wait intr... */
|
||||
EXTERN bool timflg IZERO; /* Time the next waited for command */
|
||||
EXTERN bool havhash IZERO; /* path hashing is available */
|
||||
EXTERN bool editing IZERO; /* doing filename expansion and line editing */
|
||||
EXTERN bool noediting IZERO; /* initial $term defaulted to noedit */
|
||||
EXTERN bool bslash_quote IZERO;/* PWP: tcsh-style quoting? (in sh.c) */
|
||||
EXTERN bool isoutatty IZERO; /* is SHOUT a tty */
|
||||
EXTERN bool isdiagatty IZERO;/* is SHDIAG a tty */
|
||||
EXTERN bool is1atty IZERO; /* is file descriptor 1 a tty (didfds mode) */
|
||||
EXTERN bool is2atty IZERO; /* is file descriptor 2 a tty (didfds mode) */
|
||||
EXTERN bool arun IZERO; /* Currently running multi-line-aliases */
|
||||
EXTERN int didfds IZERO; /* Have setup i/o fd's for child */
|
||||
EXTERN int doneinp IZERO; /* EOF indicator after reset from readc */
|
||||
EXTERN int exiterr IZERO; /* Exit if error or non-zero exit status */
|
||||
EXTERN int child IZERO; /* Child shell ... errors cause exit */
|
||||
EXTERN int haderr IZERO; /* Reset was because of an error */
|
||||
EXTERN int intty IZERO; /* Input is a tty */
|
||||
EXTERN int intact IZERO; /* We are interactive... therefore prompt */
|
||||
EXTERN int justpr IZERO; /* Just print because of :p hist mod */
|
||||
EXTERN int loginsh IZERO; /* We are a loginsh -> .login/.logout */
|
||||
EXTERN int neednote IZERO; /* Need to pnotify() */
|
||||
EXTERN int noexec IZERO; /* Don't execute, just syntax check */
|
||||
EXTERN int pjobs IZERO; /* want to print jobs if interrupted */
|
||||
EXTERN int setintr IZERO; /* Set interrupts on/off -> Wait intr... */
|
||||
EXTERN int timflg IZERO; /* Time the next waited for command */
|
||||
EXTERN int havhash IZERO; /* path hashing is available */
|
||||
EXTERN int editing IZERO; /* doing filename expansion and line editing */
|
||||
EXTERN int noediting IZERO; /* initial $term defaulted to noedit */
|
||||
EXTERN int bslash_quote IZERO;/* PWP: tcsh-style quoting? (in sh.c) */
|
||||
EXTERN int isoutatty IZERO; /* is SHOUT a tty */
|
||||
EXTERN int isdiagatty IZERO;/* is SHDIAG a tty */
|
||||
EXTERN int is1atty IZERO; /* is file descriptor 1 a tty (didfds mode) */
|
||||
EXTERN int is2atty IZERO; /* is file descriptor 2 a tty (didfds mode) */
|
||||
EXTERN int arun IZERO; /* Currently running multi-line-aliases */
|
||||
EXTERN int implicit_cd IZERO;/* implicit cd enabled?(1=enabled,2=verbose) */
|
||||
EXTERN bool inheredoc IZERO; /* Currently parsing a heredoc */
|
||||
EXTERN bool windowchg IZERO; /* We received a window change event */
|
||||
EXTERN int inheredoc IZERO; /* Currently parsing a heredoc */
|
||||
EXTERN int windowchg IZERO; /* We received a window change event */
|
||||
#if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
|
||||
EXTERN int dspmbyte_ls;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Global i/o info
|
||||
@ -616,10 +618,10 @@ EXTERN bool windowchg IZERO; /* We received a window change event */
|
||||
EXTERN Char *arginp IZERO; /* Argument input for sh -c and internal `xx` */
|
||||
EXTERN int onelflg IZERO; /* 2 -> need line for -t, 1 -> exit on read */
|
||||
extern Char *ffile; /* Name of shell file for $0 */
|
||||
extern bool dolzero; /* if $?0 should return true... */
|
||||
extern int dolzero; /* if $?0 should return true... */
|
||||
|
||||
extern char *seterr; /* Error message from scanner/parser */
|
||||
#if !defined(BSD4_4) && !defined(__linux__)
|
||||
#ifndef errno
|
||||
extern int errno; /* Error from C library routines */
|
||||
#endif
|
||||
extern int exitset;
|
||||
@ -660,9 +662,9 @@ EXTERN int backpid; /* pid of the last background job */
|
||||
* uid_t and gid_t are not defined in all the systems so I would have to
|
||||
* make special cases for them. In the future...
|
||||
*/
|
||||
EXTERN int uid, euid, /* Invokers real and effective */
|
||||
gid, egid; /* User and group ids */
|
||||
EXTERN int opgrp, /* Initial pgrp and tty pgrp */
|
||||
EXTERN uid_t uid, euid; /* Invokers real and effective */
|
||||
EXTERN gid_t gid, egid; /* User and group ids */
|
||||
EXTERN pid_t opgrp, /* Initial pgrp and tty pgrp */
|
||||
shpgrp, /* Pgrp of shell */
|
||||
tpgrp; /* Terminal process group */
|
||||
/* If tpgrp is -1, leave tty alone! */
|
||||
@ -757,14 +759,26 @@ extern signalfun_t parterm; /* Parents terminate catch */
|
||||
*/
|
||||
#define META 0200
|
||||
#define ASCII 0177
|
||||
#ifdef SHORT_STRINGS
|
||||
#ifdef WIDE_STRINGS /* Implies SHORT_STRINGS */
|
||||
/* 31st char bit used for 'ing (not 32nd, we want all values nonnegative) */
|
||||
# define QUOTE 0x40000000
|
||||
# define TRIM 0x3FFFFFFF /* Mask to strip quote bit */
|
||||
# define UNDER 0x20000000 /* Underline flag */
|
||||
# define BOLD 0x10000000 /* Bold flag */
|
||||
# define STANDOUT 0x08000000 /* Standout flag */
|
||||
# define LITERAL 0x04000000 /* Literal character flag */
|
||||
# define ATTRIBUTES 0x3C000000 /* The bits used for attributes */
|
||||
# define INVALID_BYTE 0x00200000 /* Invalid character on input */
|
||||
# define CHAR 0x003FFFFF /* Mask to mask out the character */
|
||||
#elif defined (SHORT_STRINGS)
|
||||
# define QUOTE ((Char) 0100000)/* 16nth char bit used for 'ing */
|
||||
# define TRIM 0077777 /* Mask to strip quote bit */
|
||||
# define TRIM 0073777 /* Mask to strip quote/lit bit */
|
||||
# define UNDER 0040000 /* Underline flag */
|
||||
# define BOLD 0020000 /* Bold flag */
|
||||
# define STANDOUT 0010000 /* Standout flag */
|
||||
# define LITERAL 0004000 /* Literal character flag */
|
||||
# define ATTRIBUTES 0074000 /* The bits used for attributes */
|
||||
# define INVALID_BYTE 0
|
||||
# define CHAR 0000377 /* Mask to mask out the character */
|
||||
#else
|
||||
# define QUOTE ((Char) 0200) /* Eighth char bit used for 'ing */
|
||||
@ -774,8 +788,10 @@ extern signalfun_t parterm; /* Parents terminate catch */
|
||||
# define STANDOUT META /* Standout flag */
|
||||
# define LITERAL 0000000 /* Literal character flag */
|
||||
# define ATTRIBUTES 0200 /* The bits used for attributes */
|
||||
# define INVALID_BYTE 0
|
||||
# define CHAR 0000177 /* Mask to mask out the character */
|
||||
#endif
|
||||
#define CHAR_DBWIDTH (LITERAL|(LITERAL-1))
|
||||
|
||||
EXTERN int AsciiOnly; /* If set only 7 bits expected in characters */
|
||||
|
||||
@ -787,11 +803,15 @@ EXTERN int AsciiOnly; /* If set only 7 bits expected in characters */
|
||||
* in the buffer.
|
||||
*/
|
||||
EXTERN struct Bin {
|
||||
off_t Bfseekp; /* Seek pointer */
|
||||
off_t Bfseekp; /* Seek pointer, generally != lseek() value */
|
||||
off_t Bfbobp; /* Seekp of beginning of buffers */
|
||||
off_t Bfeobp; /* Seekp of end of buffers */
|
||||
int Bfblocks; /* Number of buffer blocks */
|
||||
Char **Bfbuf; /* The array of buffer blocks */
|
||||
#ifdef WIDE_STRINGS
|
||||
/* Number of bytes in each character if (cantell) */
|
||||
unsigned char Bfclens[BUFSIZE + 1];
|
||||
#endif
|
||||
} B;
|
||||
|
||||
/*
|
||||
@ -822,6 +842,7 @@ extern int aret; /* Type of last char returned */
|
||||
#define feobp B.Bfeobp
|
||||
#define fblocks B.Bfblocks
|
||||
#define fbuf B.Bfbuf
|
||||
#define fclens B.Bfclens
|
||||
|
||||
/*
|
||||
* The shell finds commands in loops by reseeking the input
|
||||
@ -830,7 +851,7 @@ extern int aret; /* Type of last char returned */
|
||||
*/
|
||||
EXTERN struct Ain lineloc;
|
||||
|
||||
EXTERN bool cantell; /* Is current source tellable ? */
|
||||
EXTERN int cantell; /* Is current source tellable ? */
|
||||
|
||||
/*
|
||||
* Input lines are parsed into doubly linked circular
|
||||
@ -962,7 +983,7 @@ typedef void (*bfunc_t) __P((Char **, struct command *));
|
||||
#endif /* hpux && __STDC__ && !__GNUC__ */
|
||||
|
||||
extern struct biltins {
|
||||
char *bname;
|
||||
const char *bname;
|
||||
bfunc_t bfunct;
|
||||
int minargs, maxargs;
|
||||
} bfunc[];
|
||||
@ -971,11 +992,12 @@ extern int nbfunc;
|
||||
extern struct biltins nt_bfunc[];
|
||||
extern int nt_nbfunc;
|
||||
#endif /* WINNT_NATIVE*/
|
||||
extern int bequiet;
|
||||
|
||||
extern struct srch {
|
||||
char *s_name;
|
||||
int s_value;
|
||||
} srchn[];
|
||||
const char *s_name;
|
||||
int s_value;
|
||||
} srchn[];
|
||||
extern int nsrchn;
|
||||
|
||||
/*
|
||||
@ -1031,7 +1053,7 @@ EXTERN Char **alvec IZERO_STRUCT,
|
||||
*/
|
||||
EXTERN int gflag; /* After tglob -> is globbing needed? */
|
||||
|
||||
#define MAXVARLEN 30 /* Maximum number of char in a variable name */
|
||||
#define MAXVARLEN 256 /* Maximum number of char in a variable name */
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# undef MAXPATHLEN
|
||||
@ -1050,10 +1072,10 @@ EXTERN int gflag; /* After tglob -> is globbing needed? */
|
||||
* resource limits
|
||||
*/
|
||||
extern struct limits {
|
||||
int limconst;
|
||||
char *limname;
|
||||
int limdiv;
|
||||
char *limscale;
|
||||
int limconst;
|
||||
const char *limname;
|
||||
int limdiv;
|
||||
const char *limscale;
|
||||
} limits[];
|
||||
#endif /* !HAVENOLIMIT */
|
||||
|
||||
@ -1104,8 +1126,12 @@ EXTERN Char PRCHROOT; /* Prompt symbol for root */
|
||||
* For operating systems with single case filenames (OS/2)
|
||||
*/
|
||||
#ifdef CASE_INSENSITIVE
|
||||
# define samecase(x) (isupper((unsigned char)(x)) ? \
|
||||
tolower((unsigned char)(x)) : (x))
|
||||
# ifdef WIDE_STRINGS
|
||||
# define samecase(x) (towlower(x))
|
||||
# else
|
||||
# define samecase(x) (isupper((unsigned char)(x)) ? \
|
||||
tolower((unsigned char)(x)) : (x))
|
||||
# endif
|
||||
#else
|
||||
# define samecase(x) (x)
|
||||
#endif /* CASE_INSENSITIVE */
|
||||
@ -1135,6 +1161,17 @@ EXTERN Char PRCHROOT; /* Prompt symbol for root */
|
||||
#define short2blk(a) saveblk(a)
|
||||
#define short2str(a) strip(a)
|
||||
#else
|
||||
#ifdef WIDE_STRINGS
|
||||
#define Strchr(a, b) wcschr(a, b)
|
||||
#define Strrchr(a, b) wcsrchr(a, b)
|
||||
#define Strcat(a, b) wcscat(a, b)
|
||||
#define Strncat(a, b, c) wcsncat(a, b, c)
|
||||
#define Strcpy(a, b) wcscpy(a, b)
|
||||
#define Strncpy(a, b, c) wcsncpy(a, b, c)
|
||||
#define Strlen(a) wcslen(a)
|
||||
#define Strcmp(a, b) wcscmp(a, b)
|
||||
#define Strncmp(a, b, c) wcsncmp(a, b, c)
|
||||
#else
|
||||
#define Strchr(a, b) s_strchr(a, b)
|
||||
#define Strrchr(a, b) s_strrchr(a, b)
|
||||
#define Strcat(a, b) s_strcat(a, b)
|
||||
@ -1144,6 +1181,7 @@ EXTERN Char PRCHROOT; /* Prompt symbol for root */
|
||||
#define Strlen(a) s_strlen(a)
|
||||
#define Strcmp(a, b) s_strcmp(a, b)
|
||||
#define Strncmp(a, b, c) s_strncmp(a, b, c)
|
||||
#endif
|
||||
#define Strcasecmp(a, b) s_strcasecmp(a, b)
|
||||
|
||||
#define Strspl(a, b) s_strspl(a, b)
|
||||
@ -1155,7 +1193,7 @@ EXTERN Char PRCHROOT; /* Prompt symbol for root */
|
||||
/*
|
||||
* setname is a macro to save space (see sh.err.c)
|
||||
*/
|
||||
EXTERN char *bname;
|
||||
EXTERN const char *bname;
|
||||
|
||||
#define setname(a) (bname = (a))
|
||||
|
||||
@ -1170,9 +1208,9 @@ EXTERN Char **evalvec;
|
||||
EXTERN Char *evalp;
|
||||
|
||||
extern struct mesg {
|
||||
char *iname; /* name from /usr/include */
|
||||
char *pname; /* print name */
|
||||
} mesg[];
|
||||
const char *iname; /* name from /usr/include */
|
||||
const char *pname; /* print name */
|
||||
} mesg[];
|
||||
|
||||
/* word_chars is set by default to WORD_CHARS but can be overridden by
|
||||
the worchars variable--if unset, reverts to WORD_CHARS */
|
||||
@ -1196,27 +1234,26 @@ extern Char **INVPPTR;
|
||||
|
||||
extern char *progname;
|
||||
extern int tcsh;
|
||||
extern int xlate_cr;
|
||||
extern int output_raw;
|
||||
extern int lbuffed;
|
||||
extern time_t Htime;
|
||||
extern int numeof;
|
||||
extern int insource;
|
||||
extern char linbuf[];
|
||||
extern char *linp;
|
||||
extern int nsig;
|
||||
#ifdef VFORK
|
||||
extern int use_fork;
|
||||
#endif
|
||||
extern int tellwhat;
|
||||
extern int NoNLSRebind;
|
||||
|
||||
#include "tc.h"
|
||||
#include "sh.decls.h"
|
||||
|
||||
/*
|
||||
* To print system call errors...
|
||||
*/
|
||||
#ifdef BSD4_4
|
||||
# include <errno.h>
|
||||
#else
|
||||
# ifndef linux
|
||||
# ifdef NEEDstrerror
|
||||
extern char *sys_errlist[];
|
||||
# endif
|
||||
extern int errno, sys_nerr;
|
||||
# endif /* !linux */
|
||||
#endif
|
||||
|
||||
#ifndef WINNT_NATIVE
|
||||
# ifdef NLS_CATALOGS
|
||||
# ifdef linux
|
||||
# if defined(linux) || defined(__GNU__) || defined(__GLIBC__)
|
||||
# include <locale.h>
|
||||
# ifdef notdef
|
||||
# include <localeinfo.h> /* Has this changed ? */
|
||||
@ -1245,7 +1282,11 @@ extern int errno, sys_nerr;
|
||||
# define MCLoadBySet 0
|
||||
# endif
|
||||
EXTERN nl_catd catd;
|
||||
# define CGETS(b, c, d) catgets(catd, b, c, d)
|
||||
# ifdef HAVE_ICONV
|
||||
# define CGETS(b, c, d) iconv_catgets(catd, b, c, d)
|
||||
# else
|
||||
# define CGETS(b, c, d) catgets(catd, b, c, d)
|
||||
# endif
|
||||
# define CSAVS(b, c, d) strsave(CGETS(b, c, d))
|
||||
# else
|
||||
# define CGETS(b, c, d) d
|
||||
@ -1257,9 +1298,10 @@ EXTERN nl_catd catd;
|
||||
#endif /* WINNT_NATIVE */
|
||||
|
||||
#if defined(FILEC)
|
||||
extern bool filec;
|
||||
extern int filec;
|
||||
#endif /* FILEC */
|
||||
|
||||
#include "sh.decls.h"
|
||||
/*
|
||||
* Since on some machines characters are unsigned, and the signed
|
||||
* keyword is not universally implemented, we treat all characters
|
||||
@ -1267,4 +1309,32 @@ extern bool filec;
|
||||
*/
|
||||
#define SIGN_EXTEND_CHAR(a) (((a) & 0x80) ? ((a) | ~0x7f) : (a))
|
||||
|
||||
/*
|
||||
* explanation for use by the "--help" option
|
||||
*/
|
||||
#define HELP_STRING "\
|
||||
-b file batch mode, read and execute commands from `file' \n\
|
||||
-c command run `command' from next argument \n\
|
||||
-d load directory stack from `~/.cshdirs' \n\
|
||||
-Dname[=value] define environment variable `name' to `value' (DomainOS only) \n\
|
||||
-e exit on any error \n\
|
||||
-f start faster by ignoring the start-up file \n\
|
||||
-F use fork() instead of vfork() when spawning (ConvexOS only) \n\
|
||||
-i interactive, even when input is not from a terminal \n\
|
||||
-l act as a login shell, must be the only option specified \n\
|
||||
-m load the start-up file, whether or not owned by effective user \n\
|
||||
-n file no execute mode, just check syntax of the following `file' \n\
|
||||
-q accept SIGQUIT for running under a debugger \n\
|
||||
-s read commands from standard input \n\
|
||||
-t read one line from standard input \n\
|
||||
-v echo commands after history substitution \n\
|
||||
-V like -v but including commands read from the start-up file \n\
|
||||
-x echo commands immediately before execution \n\
|
||||
-X like -x but including commands read from the start-up file \n\
|
||||
--help print this message and exit \n\
|
||||
--version print the version shell variable and exit \n\
|
||||
\nSee the tcsh(1) manual page for detailed information.\n"
|
||||
|
||||
#include "tc.nls.h"
|
||||
|
||||
#endif /* _h_sh */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.hist.c,v 3.29 2002/06/25 19:02:11 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.hist.c,v 3.33 2004/12/25 21:15:07 christos Exp $ */
|
||||
/*
|
||||
* sh.hist.c: Shell history expansions and substitutions
|
||||
*/
|
||||
@ -32,15 +32,15 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.hist.c,v 3.29 2002/06/25 19:02:11 christos Exp $")
|
||||
RCSID("$Id: sh.hist.c,v 3.33 2004/12/25 21:15:07 christos Exp $")
|
||||
|
||||
#include "tc.h"
|
||||
|
||||
extern bool histvalid;
|
||||
extern int histvalid;
|
||||
extern Char histline[];
|
||||
Char HistLit = 0;
|
||||
|
||||
static bool heq __P((struct wordent *, struct wordent *));
|
||||
static int heq __P((struct wordent *, struct wordent *));
|
||||
static void hfree __P((struct Hist *));
|
||||
static void dohist1 __P((struct Hist *, int *, int));
|
||||
static void phist __P((struct Hist *, int));
|
||||
@ -60,10 +60,10 @@ static void phist __P((struct Hist *, int));
|
||||
void
|
||||
savehist(sp, mflg)
|
||||
struct wordent *sp;
|
||||
bool mflg;
|
||||
int mflg;
|
||||
{
|
||||
register struct Hist *hp, *np;
|
||||
register int histlen = 0;
|
||||
struct Hist *hp, *np;
|
||||
int histlen = 0;
|
||||
Char *cp;
|
||||
|
||||
/* throw away null lines */
|
||||
@ -71,7 +71,7 @@ savehist(sp, mflg)
|
||||
return;
|
||||
cp = varval(STRhistory);
|
||||
if (*cp) {
|
||||
register Char *p = cp;
|
||||
Char *p = cp;
|
||||
|
||||
while (*p) {
|
||||
if (!Isdigit(*p)) {
|
||||
@ -90,7 +90,7 @@ savehist(sp, mflg)
|
||||
hp = np;
|
||||
}
|
||||
|
||||
static bool
|
||||
static int
|
||||
heq(a0, b0)
|
||||
struct wordent *a0, *b0;
|
||||
{
|
||||
@ -112,14 +112,13 @@ heq(a0, b0)
|
||||
struct Hist *
|
||||
enthist(event, lp, docopy, mflg)
|
||||
int event;
|
||||
register struct wordent *lp;
|
||||
bool docopy;
|
||||
bool mflg;
|
||||
struct wordent *lp;
|
||||
int docopy;
|
||||
int mflg;
|
||||
{
|
||||
extern time_t Htime;
|
||||
struct Hist *p = NULL, *pp = &Histlist;
|
||||
int n, r;
|
||||
register struct Hist *np;
|
||||
struct Hist *np;
|
||||
Char *dp;
|
||||
|
||||
if ((dp = varval(STRhistdup)) != STRNULL) {
|
||||
@ -210,7 +209,7 @@ enthist(event, lp, docopy, mflg)
|
||||
|
||||
static void
|
||||
hfree(hp)
|
||||
register struct Hist *hp;
|
||||
struct Hist *hp;
|
||||
{
|
||||
|
||||
freelex(&hp->Hlex);
|
||||
@ -296,7 +295,7 @@ dohist1(hp, np, hflg)
|
||||
struct Hist *hp;
|
||||
int *np, hflg;
|
||||
{
|
||||
bool print = (*np) > 0;
|
||||
int print = (*np) > 0;
|
||||
|
||||
for (; hp != 0; hp = hp->Hnext) {
|
||||
(*np)--;
|
||||
@ -313,10 +312,9 @@ dohist1(hp, np, hflg)
|
||||
|
||||
static void
|
||||
phist(hp, hflg)
|
||||
register struct Hist *hp;
|
||||
struct Hist *hp;
|
||||
int hflg;
|
||||
{
|
||||
extern bool output_raw;
|
||||
if (hflg & HIST_ONLY) {
|
||||
/*
|
||||
* Control characters have to be written as is (output_raw).
|
||||
@ -349,7 +347,7 @@ phist(hp, hflg)
|
||||
|
||||
tprintf(FMT_HISTORY, buf, cp, INBUFSIZE, NULL, hp->Htime, (ptr_t) hp);
|
||||
for (cp = buf; *cp;)
|
||||
xputchar(*cp++);
|
||||
xputwchar(*cp++);
|
||||
}
|
||||
}
|
||||
|
||||
@ -373,8 +371,20 @@ fmthist(fmt, ptr, buf, bufsiz)
|
||||
Char ibuf[INBUFSIZE], *ip;
|
||||
char *p;
|
||||
(void) sprlex(ibuf, sizeof(ibuf) / sizeof(Char), &hp->Hlex);
|
||||
for (p = buf, ip = ibuf; (*p++ = (CHAR & *ip++)) != '\0'; )
|
||||
continue;
|
||||
p = buf;
|
||||
ip = ibuf;
|
||||
do {
|
||||
char xbuf[MB_LEN_MAX];
|
||||
size_t len;
|
||||
|
||||
len = one_wctomb(xbuf, CHAR & *ip);
|
||||
if ((size_t)((p - buf) + len) >= bufsiz)
|
||||
break;
|
||||
memcpy(p, xbuf, len);
|
||||
p += len;
|
||||
} while ((CHAR & *ip++) != 0);
|
||||
if (p <= buf + bufsiz - 1)
|
||||
*p = '\0';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -457,7 +467,7 @@ rechist(fname, ref)
|
||||
void
|
||||
loadhist(fname, mflg)
|
||||
Char *fname;
|
||||
bool mflg;
|
||||
int mflg;
|
||||
{
|
||||
static Char *loadhist_cmd[] = {STRsource, NULL, NULL, NULL};
|
||||
loadhist_cmd[1] = mflg ? STRmm : STRmh;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.init.c,v 3.51 2004/02/21 20:34:25 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.init.c,v 3.55 2005/01/18 20:43:31 christos Exp $ */
|
||||
/*
|
||||
* sh.init.c: Function and signal tables
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.init.c,v 3.51 2004/02/21 20:34:25 christos Exp $")
|
||||
RCSID("$Id: sh.init.c,v 3.55 2005/01/18 20:43:31 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
#include "tw.h"
|
||||
@ -155,6 +155,9 @@ struct biltins bfunc[] = {
|
||||
{ "suspend", dosuspend, 0, 0 },
|
||||
{ "switch", doswitch, 1, INF },
|
||||
{ "telltc", dotelltc, 0, INF },
|
||||
#ifndef WINNT_NATIVE
|
||||
{ "termname", dotermname, 0, 1 },
|
||||
#endif
|
||||
{ "time", dotime, 0, INF },
|
||||
#if defined(_CX_UX)
|
||||
{ "ucb", doucb, 0, INF },
|
||||
@ -217,7 +220,7 @@ int nsrchn = sizeof srchn / sizeof *srchn;
|
||||
*/
|
||||
|
||||
/* We define NUMSIG to avoid changing NSIG or MAXSIG */
|
||||
#ifdef POSIX
|
||||
#if defined(POSIX) && !defined(__CYGWIN__)
|
||||
# define NUMSIG 65
|
||||
#else /* !POSIX */
|
||||
# define NUMSIG 33
|
||||
@ -225,7 +228,7 @@ int nsrchn = sizeof srchn / sizeof *srchn;
|
||||
|
||||
int nsig = NUMSIG - 1; /* This should be the number of real signals */
|
||||
/* not counting signal 0 */
|
||||
struct mesg mesg[NUMSIG]; /* Arrays start at [0] so we initialize from */
|
||||
struct mesg mesg[NUMSIG]; /* Arrays start at [0] so we initialize from */
|
||||
/* 0 to 32 or 64, the max real signal number */
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.lex.c,v 3.57 2003/08/04 16:19:13 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.lex.c,v 3.62 2004/12/25 21:15:07 christos Exp $ */
|
||||
/*
|
||||
* sh.lex.c: Lexical analysis into tokens
|
||||
*/
|
||||
@ -32,9 +32,11 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.lex.c,v 3.57 2003/08/04 16:19:13 christos Exp $")
|
||||
RCSID("$Id: sh.lex.c,v 3.62 2004/12/25 21:15:07 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
|
||||
#include <assert.h>
|
||||
/* #define DEBUG_INP */
|
||||
/* #define DEBUG_SEEK */
|
||||
|
||||
@ -47,21 +49,22 @@ RCSID("$Id: sh.lex.c,v 3.57 2003/08/04 16:19:13 christos Exp $")
|
||||
* There is some involved processing here, because of the complications
|
||||
* of input buffering, and especially because of history substitution.
|
||||
*/
|
||||
static Char *word __P((void));
|
||||
static int getC1 __P((int));
|
||||
static Char *word __P((int));
|
||||
static eChar getC1 __P((int));
|
||||
static void getdol __P((void));
|
||||
static void getexcl __P((int));
|
||||
static struct Hist *findev __P((Char *, bool));
|
||||
static void getexcl __P((Char));
|
||||
static struct Hist *findev __P((Char *, int));
|
||||
static void setexclp __P((Char *));
|
||||
static int bgetc __P((void));
|
||||
static eChar bgetc __P((void));
|
||||
static void balloc __P((int));
|
||||
static void bfree __P((void));
|
||||
static struct wordent *gethent __P((int));
|
||||
static struct wordent *gethent __P((Char));
|
||||
static int matchs __P((Char *, Char *));
|
||||
static int getsel __P((int *, int *, int));
|
||||
static struct wordent *getsub __P((struct wordent *));
|
||||
static Char *subword __P((Char *, int, bool *));
|
||||
static struct wordent *dosub __P((int, struct wordent *, bool));
|
||||
static Char *subword __P((Char *, Char, int *));
|
||||
static struct wordent *dosub __P((Char, struct wordent *, int));
|
||||
static ssize_t wide_read __P((int, Char *, size_t, int));
|
||||
|
||||
/*
|
||||
* Peekc is a peek character for getC, peekread for readc.
|
||||
@ -111,7 +114,7 @@ static Char labuf[BUFSIZE];
|
||||
* when called by the alias routine to determine whether to keep the
|
||||
* argument list.
|
||||
*/
|
||||
static bool hadhist = 0;
|
||||
static int hadhist = 0;
|
||||
|
||||
/*
|
||||
* Avoid alias expansion recursion via \!#
|
||||
@ -121,12 +124,12 @@ int hleft;
|
||||
Char histline[BUFSIZE + 2]; /* last line input */
|
||||
|
||||
/* The +2 is to fool hp's optimizer */
|
||||
bool histvalid = 0; /* is histline valid */
|
||||
int histvalid = 0; /* is histline valid */
|
||||
static Char *histlinep = NULL; /* current pointer into histline */
|
||||
|
||||
static Char getCtmp;
|
||||
|
||||
#define getC(f) (((getCtmp = peekc) != '\0') ? (peekc = 0, getCtmp) : getC1(f))
|
||||
#define getC(f) (((getCtmp = peekc) != '\0') ? (peekc = 0, (eChar)getCtmp) : getC1(f))
|
||||
#define ungetC(c) peekc = (Char) c
|
||||
#define ungetD(c) peekd = (Char) c
|
||||
|
||||
@ -136,6 +139,11 @@ static Char getCtmp;
|
||||
time_t Htime = (time_t)0;
|
||||
static time_t a2time_t __P((Char *));
|
||||
|
||||
/*
|
||||
* special parsing rules apply for source -h
|
||||
*/
|
||||
extern int enterhist;
|
||||
|
||||
/*
|
||||
* for history event processing
|
||||
* in the command 'echo !?foo?:1 !$' we want the !$ to expand from the line
|
||||
@ -148,7 +156,8 @@ lex(hp)
|
||||
struct wordent *hp;
|
||||
{
|
||||
struct wordent *wdp;
|
||||
int c;
|
||||
eChar c;
|
||||
int parsehtime = enterhist;
|
||||
|
||||
|
||||
uselastevent = 1;
|
||||
@ -163,7 +172,7 @@ lex(hp)
|
||||
do
|
||||
c = readc(0);
|
||||
while (c == ' ' || c == '\t');
|
||||
if (c == HISTSUB && intty)
|
||||
if (c == (eChar)HISTSUB && intty)
|
||||
/* ^lef^rit from tty is short !:s^lef^rit */
|
||||
getexcl(c);
|
||||
else
|
||||
@ -183,7 +192,8 @@ lex(hp)
|
||||
wdp->next = new;
|
||||
hp->prev = new;
|
||||
wdp = new;
|
||||
wdp->word = word();
|
||||
wdp->word = word(parsehtime);
|
||||
parsehtime = 0;
|
||||
} while (wdp->word[0] != '\n');
|
||||
if (histlinep < histline + BUFSIZE) {
|
||||
*histlinep = '\0';
|
||||
@ -199,8 +209,8 @@ lex(hp)
|
||||
}
|
||||
|
||||
static time_t
|
||||
a2time_t(word)
|
||||
Char *word;
|
||||
a2time_t(wordx)
|
||||
Char *wordx;
|
||||
{
|
||||
/* Attempt to distinguish timestamps from other possible entries.
|
||||
* Format: "+NNNNNNNNNN" (10 digits, left padded with ascii '0') */
|
||||
@ -209,7 +219,7 @@ a2time_t(word)
|
||||
Char *s;
|
||||
int ct;
|
||||
|
||||
if (!word || *(s = word) != '+')
|
||||
if (!wordx || *(s = wordx) != '+')
|
||||
return (time_t)0;
|
||||
|
||||
for (++s, ret = 0, ct = 0; *s; ++s, ++ct)
|
||||
@ -282,18 +292,16 @@ freelex(vp)
|
||||
}
|
||||
|
||||
static Char *
|
||||
word()
|
||||
word(parsehtime)
|
||||
int parsehtime;
|
||||
{
|
||||
Char c, c1;
|
||||
Char *wp;
|
||||
eChar c, c1;
|
||||
Char *wp, *unfinished = 0;
|
||||
Char wbuf[BUFSIZE];
|
||||
Char hbuf[12];
|
||||
int h;
|
||||
bool dolflg;
|
||||
int dolflg;
|
||||
int i;
|
||||
#if defined(DSPMBYTE)
|
||||
int mbytepos = 1;
|
||||
#endif /* DSPMBYTE */
|
||||
|
||||
wp = wbuf;
|
||||
i = BUFSIZE - 4;
|
||||
@ -315,18 +323,20 @@ word()
|
||||
goto ret;
|
||||
|
||||
case '#':
|
||||
if (intty)
|
||||
if (intty || (enterhist && !parsehtime))
|
||||
break;
|
||||
c = 0;
|
||||
h = 0;
|
||||
do {
|
||||
c1 = c;
|
||||
c = getC(0);
|
||||
if (h < 12)
|
||||
if (h < 11 && parsehtime)
|
||||
hbuf[h++] = c;
|
||||
} while (c != '\n');
|
||||
hbuf[11] = '\0';
|
||||
Htime = a2time_t(hbuf);
|
||||
if (parsehtime) {
|
||||
hbuf[11] = '\0';
|
||||
Htime = a2time_t(hbuf);
|
||||
}
|
||||
if (c1 == '\\')
|
||||
goto loop;
|
||||
/*FALLTHROUGH*/
|
||||
@ -345,7 +355,7 @@ word()
|
||||
onelflg = 2;
|
||||
goto loop;
|
||||
}
|
||||
if (c != HIST)
|
||||
if (c != (eChar)HIST)
|
||||
*wp++ = '\\', --i;
|
||||
c |= QUOTE;
|
||||
default:
|
||||
@ -354,13 +364,6 @@ word()
|
||||
c1 = 0;
|
||||
dolflg = DOALL;
|
||||
for (;;) {
|
||||
#if defined(DSPMBYTE)
|
||||
if (mbytepos == 2)
|
||||
mbytepos = 1;
|
||||
else if (mbytepos == 1 && Ismbyte1(c) && 2 <= i)
|
||||
mbytepos = 2;
|
||||
else
|
||||
#endif /* DSPMBYTE */
|
||||
if (c1) {
|
||||
if (c == c1) {
|
||||
c1 = 0;
|
||||
@ -375,7 +378,7 @@ word()
|
||||
*
|
||||
* Actually, all I really want to be able to say is 'foo\'bar' --> foo'bar
|
||||
*/
|
||||
if (c == HIST)
|
||||
if (c == (eChar)HIST)
|
||||
c |= QUOTE;
|
||||
else {
|
||||
if (bslash_quote &&
|
||||
@ -408,7 +411,7 @@ word()
|
||||
onelflg = 2;
|
||||
break;
|
||||
}
|
||||
if (c != HIST)
|
||||
if (c != (eChar)HIST)
|
||||
*wp++ = '\\', --i;
|
||||
c |= QUOTE;
|
||||
}
|
||||
@ -416,7 +419,7 @@ word()
|
||||
c1 = c;
|
||||
dolflg = c == '"' ? DOALL : DOEXCL;
|
||||
}
|
||||
else if (c != '#' || !intty) {
|
||||
else if (c != '#' || (!intty && !enterhist)) {
|
||||
ungetC(c);
|
||||
break;
|
||||
}
|
||||
@ -424,6 +427,17 @@ word()
|
||||
if (--i > 0) {
|
||||
*wp++ = c;
|
||||
c = getC(dolflg);
|
||||
if (!unfinished)
|
||||
unfinished = wp - 1;
|
||||
switch (NLSFinished(unfinished, wp - unfinished, c)) {
|
||||
case 1:
|
||||
case 0:
|
||||
c |= QUOTE;
|
||||
break;
|
||||
default:
|
||||
unfinished = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
seterror(ERR_WTOOLONG);
|
||||
@ -436,11 +450,11 @@ word()
|
||||
return (Strsave(wbuf));
|
||||
}
|
||||
|
||||
static int
|
||||
static eChar
|
||||
getC1(flag)
|
||||
int flag;
|
||||
{
|
||||
Char c;
|
||||
eChar c;
|
||||
|
||||
for (;;) {
|
||||
if ((c = peekc) != 0) {
|
||||
@ -487,7 +501,7 @@ getC1(flag)
|
||||
getdol();
|
||||
continue;
|
||||
}
|
||||
if (c == HIST && (flag & DOEXCL)) {
|
||||
if (c == (eChar)HIST && (flag & DOEXCL)) {
|
||||
getexcl(0);
|
||||
continue;
|
||||
}
|
||||
@ -501,9 +515,9 @@ getdol()
|
||||
{
|
||||
Char *np, *ep;
|
||||
Char name[4 * MAXVARLEN + 1];
|
||||
int c;
|
||||
int sc;
|
||||
bool special = 0, toolong;
|
||||
eChar c;
|
||||
eChar sc;
|
||||
int special = 0, toolong;
|
||||
|
||||
np = name, *np++ = '$';
|
||||
c = sc = getC(DOEXCL);
|
||||
@ -664,7 +678,7 @@ getdol()
|
||||
/* scan s// [eichin:19910926.0512EST] */
|
||||
if (c == 's') {
|
||||
int delimcnt = 2;
|
||||
int delim = getC(0);
|
||||
eChar delim = getC(0);
|
||||
*np++ = (Char) delim;
|
||||
|
||||
if (!delim || letter(delim)
|
||||
@ -672,7 +686,7 @@ getdol()
|
||||
seterror(ERR_BADSUBST);
|
||||
break;
|
||||
}
|
||||
while ((c = getC(0)) != (-1)) {
|
||||
while ((c = getC(0)) != CHAR_ERR) {
|
||||
*np++ = (Char) c;
|
||||
if(c == delim) delimcnt--;
|
||||
if(!delimcnt) break;
|
||||
@ -729,6 +743,7 @@ addla(cp)
|
||||
if (lap)
|
||||
(void) Strcpy(buf, lap);
|
||||
(void) Strcpy(labuf, cp);
|
||||
NLSQuote(labuf);
|
||||
if (lap)
|
||||
(void) Strcat(labuf, buf);
|
||||
lap = labuf;
|
||||
@ -741,11 +756,11 @@ static int quesarg;
|
||||
|
||||
static void
|
||||
getexcl(sc)
|
||||
int sc;
|
||||
Char sc;
|
||||
{
|
||||
struct wordent *hp, *ip;
|
||||
int left, right, dol;
|
||||
int c;
|
||||
eChar c;
|
||||
|
||||
if (sc == 0) {
|
||||
sc = getC(0);
|
||||
@ -827,10 +842,10 @@ getsub(en)
|
||||
struct wordent *en;
|
||||
{
|
||||
Char *cp;
|
||||
int delim;
|
||||
int c;
|
||||
int sc;
|
||||
bool global;
|
||||
eChar delim;
|
||||
eChar c;
|
||||
eChar sc;
|
||||
int global;
|
||||
Char orhsb[sizeof(rhsb) / sizeof(Char)];
|
||||
|
||||
#ifndef COMPAT
|
||||
@ -953,7 +968,7 @@ getsub(en)
|
||||
default:
|
||||
if (c == '\n')
|
||||
unreadc(c);
|
||||
seterror(ERR_BADBANGMOD, c);
|
||||
seterror(ERR_BADBANGMOD, (int)c);
|
||||
return (en);
|
||||
}
|
||||
(void) Strcpy(slhs, lhsb);
|
||||
@ -980,12 +995,12 @@ getsub(en)
|
||||
#define HIST_PURGE -50000000
|
||||
static struct wordent *
|
||||
dosub(sc, en, global)
|
||||
int sc;
|
||||
Char sc;
|
||||
struct wordent *en;
|
||||
bool global;
|
||||
int global;
|
||||
{
|
||||
struct wordent lexi;
|
||||
bool didsub = 0, didone = 0;
|
||||
int didsub = 0, didone = 0;
|
||||
struct wordent *hp = &lexi;
|
||||
struct wordent *wdp;
|
||||
int i = exclc;
|
||||
@ -1041,8 +1056,8 @@ dosub(sc, en, global)
|
||||
static Char *
|
||||
subword(cp, type, adid)
|
||||
Char *cp;
|
||||
int type;
|
||||
bool *adid;
|
||||
Char type;
|
||||
int *adid;
|
||||
{
|
||||
Char wbuf[BUFSIZE];
|
||||
Char *wp, *mp, *np;
|
||||
@ -1117,7 +1132,7 @@ subword(cp, type, adid)
|
||||
Char *
|
||||
domod(cp, type)
|
||||
Char *cp;
|
||||
int type;
|
||||
Char type;
|
||||
{
|
||||
Char *wp, *xp;
|
||||
int c;
|
||||
@ -1133,22 +1148,12 @@ domod(cp, type)
|
||||
return (wp);
|
||||
|
||||
case 'l':
|
||||
wp = Strsave(cp);
|
||||
for (cp = wp; *cp; cp++)
|
||||
if (Isupper(*cp)) {
|
||||
*cp = Tolower(*cp);
|
||||
return wp;
|
||||
}
|
||||
return wp;
|
||||
wp = NLSChangeCase(cp, 1);
|
||||
return wp ? wp : Strsave(cp);
|
||||
|
||||
case 'u':
|
||||
wp = Strsave(cp);
|
||||
for (cp = wp; *cp; cp++)
|
||||
if (Islower(*cp)) {
|
||||
*cp = Toupper(*cp);
|
||||
return wp;
|
||||
}
|
||||
return wp;
|
||||
wp = NLSChangeCase(cp, 0);
|
||||
return wp ? wp : Strsave(cp);
|
||||
|
||||
case 'h':
|
||||
case 't':
|
||||
@ -1195,9 +1200,9 @@ getsel(al, ar, dol)
|
||||
int *al, *ar;
|
||||
int dol;
|
||||
{
|
||||
int c = getC(0);
|
||||
eChar c = getC(0);
|
||||
int i;
|
||||
bool first = *al < 0;
|
||||
int first = *al < 0;
|
||||
|
||||
switch (c) {
|
||||
|
||||
@ -1278,16 +1283,16 @@ getsel(al, ar, dol)
|
||||
|
||||
static struct wordent *
|
||||
gethent(sc)
|
||||
int sc;
|
||||
Char sc;
|
||||
{
|
||||
struct Hist *hp;
|
||||
Char *np;
|
||||
int c;
|
||||
eChar c;
|
||||
int event;
|
||||
bool back = 0;
|
||||
int back = 0;
|
||||
|
||||
c = sc == HISTSUB ? HIST : getC(0);
|
||||
if (c == HIST) {
|
||||
c = sc == HISTSUB ? (eChar)HIST : getC(0);
|
||||
if (c == (eChar)HIST) {
|
||||
if (alhistp)
|
||||
return (alhistp);
|
||||
event = eventno;
|
||||
@ -1405,7 +1410,7 @@ gethent(sc)
|
||||
static struct Hist *
|
||||
findev(cp, anyarg)
|
||||
Char *cp;
|
||||
bool anyarg;
|
||||
int anyarg;
|
||||
{
|
||||
struct Hist *hp;
|
||||
|
||||
@ -1465,18 +1470,17 @@ setexclp(cp)
|
||||
|
||||
void
|
||||
unreadc(c)
|
||||
int c;
|
||||
Char c;
|
||||
{
|
||||
peekread = (Char) c;
|
||||
}
|
||||
|
||||
int
|
||||
eChar
|
||||
readc(wanteof)
|
||||
bool wanteof;
|
||||
int wanteof;
|
||||
{
|
||||
int c;
|
||||
eChar c;
|
||||
static int sincereal; /* Number of real EOFs we've seen */
|
||||
extern int numeof;
|
||||
|
||||
#ifdef DEBUG_INP
|
||||
xprintf("readc\n");
|
||||
@ -1542,7 +1546,7 @@ readc(wanteof)
|
||||
do {
|
||||
if (arginp == INVPTR || onelflg == 1) {
|
||||
if (wanteof)
|
||||
return (-1);
|
||||
return CHAR_ERR;
|
||||
exitstat();
|
||||
}
|
||||
if (arginp) {
|
||||
@ -1556,7 +1560,7 @@ readc(wanteof)
|
||||
reread:
|
||||
#endif /* BSDJOBS */
|
||||
c = bgetc();
|
||||
if (c < 0) {
|
||||
if (c == CHAR_ERR) {
|
||||
#ifndef WINNT_NATIVE
|
||||
# ifndef POSIX
|
||||
# ifdef TERMIO
|
||||
@ -1569,7 +1573,7 @@ readc(wanteof)
|
||||
# endif /* POSIX */
|
||||
#endif /* !WINNT_NATIVE */
|
||||
if (wanteof)
|
||||
return (-1);
|
||||
return CHAR_ERR;
|
||||
/* was isatty but raw with ignoreeof yields problems */
|
||||
#ifndef WINNT_NATIVE
|
||||
# ifndef POSIX
|
||||
@ -1680,12 +1684,68 @@ balloc(buf)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
static ssize_t
|
||||
wide_read(fildes, buf, nchars, use_fclens)
|
||||
int fildes;
|
||||
Char *buf;
|
||||
size_t nchars;
|
||||
int use_fclens;
|
||||
{
|
||||
char cbuf[BUFSIZE + 1];
|
||||
ssize_t res, r;
|
||||
size_t partial;
|
||||
|
||||
assert (nchars <= sizeof(cbuf)/sizeof(*cbuf));
|
||||
USE(use_fclens);
|
||||
res = 0;
|
||||
partial = 0;
|
||||
do {
|
||||
size_t i;
|
||||
|
||||
do
|
||||
r = read(fildes, cbuf + partial,
|
||||
nchars > partial ? nchars - partial : 1);
|
||||
while (partial != 0 && r < 0 && errno == EINTR);
|
||||
if (partial == 0 && r <= 0)
|
||||
break;
|
||||
partial += r;
|
||||
i = 0;
|
||||
while (i < partial) {
|
||||
int len;
|
||||
|
||||
len = normal_mbtowc(buf + res, cbuf + i, partial - i);
|
||||
if (len == -1) {
|
||||
reset_mbtowc();
|
||||
if (partial < MB_LEN_MAX && r > 0)
|
||||
/* Maybe a partial character and there is still a chance
|
||||
to read more */
|
||||
break;
|
||||
buf[res] = (unsigned char)cbuf[i] | INVALID_BYTE;
|
||||
}
|
||||
if (len <= 0)
|
||||
len = 1;
|
||||
#ifdef WIDE_STRINGS
|
||||
if (use_fclens)
|
||||
fclens[res] = len;
|
||||
#endif
|
||||
i += len;
|
||||
res++;
|
||||
nchars--;
|
||||
}
|
||||
if (i != partial)
|
||||
memmove(cbuf, cbuf + i, partial - i);
|
||||
partial -= i;
|
||||
} while (partial != 0);
|
||||
/* Throwing away possible partial multibyte characters on error */
|
||||
return res != 0 ? res : r;
|
||||
}
|
||||
|
||||
static eChar
|
||||
bgetc()
|
||||
{
|
||||
Char ch;
|
||||
int c, off, buf;
|
||||
int numleft = 0, roomleft;
|
||||
char tbuf[BUFSIZE + 1];
|
||||
|
||||
if (cantell) {
|
||||
if (fseekp < fbobp || fseekp > feobp) {
|
||||
@ -1693,32 +1753,28 @@ bgetc()
|
||||
(void) lseek(SHIN, fseekp, L_SET);
|
||||
}
|
||||
if (fseekp == feobp) {
|
||||
int i;
|
||||
|
||||
fbobp = feobp;
|
||||
do
|
||||
c = read(SHIN, tbuf, BUFSIZE);
|
||||
c = wide_read(SHIN, fbuf[0], BUFSIZE, 1);
|
||||
while (c < 0 && errno == EINTR);
|
||||
#ifdef convex
|
||||
if (c < 0)
|
||||
stderror(ERR_SYSTEM, progname, strerror(errno));
|
||||
#endif /* convex */
|
||||
if (c <= 0)
|
||||
return (-1);
|
||||
for (i = 0; i < c; i++)
|
||||
fbuf[0][i] = (unsigned char) tbuf[i];
|
||||
return CHAR_ERR;
|
||||
feobp += c;
|
||||
}
|
||||
#ifndef WINNT_NATIVE
|
||||
c = fbuf[0][fseekp - fbobp];
|
||||
ch = fbuf[0][fseekp - fbobp];
|
||||
fseekp++;
|
||||
#else
|
||||
do {
|
||||
c = fbuf[0][fseekp - fbobp];
|
||||
ch = fbuf[0][fseekp - fbobp];
|
||||
fseekp++;
|
||||
} while(c == '\r');
|
||||
} while(ch == '\r');
|
||||
#endif /* !WINNT_NATIVE */
|
||||
return (c);
|
||||
return (ch);
|
||||
}
|
||||
|
||||
while (fseekp >= feobp) {
|
||||
@ -1752,29 +1808,27 @@ bgetc()
|
||||
buf = (int) feobp / BUFSIZE;
|
||||
balloc(buf);
|
||||
roomleft = BUFSIZE - off;
|
||||
c = read(SHIN, tbuf, (size_t) roomleft);
|
||||
if (c > 0) {
|
||||
int i;
|
||||
Char *ptr = fbuf[buf] + off;
|
||||
|
||||
for (i = 0; i < c; i++)
|
||||
ptr[i] = (unsigned char) tbuf[i];
|
||||
c = wide_read(SHIN, fbuf[buf] + off, (size_t) roomleft, 0);
|
||||
if (c > 0)
|
||||
feobp += c;
|
||||
}
|
||||
}
|
||||
if (c == 0 || (c < 0 && fixio(SHIN, errno) == -1))
|
||||
return (-1);
|
||||
return CHAR_ERR;
|
||||
}
|
||||
#ifdef SIG_WINDOW
|
||||
if (windowchg)
|
||||
(void) check_window_size(0); /* for window systems */
|
||||
#endif /* SIG_WINDOW */
|
||||
#ifndef WINNT_NATIVE
|
||||
c = fbuf[(int) fseekp / BUFSIZE][(int) fseekp % BUFSIZE];
|
||||
ch = fbuf[(int) fseekp / BUFSIZE][(int) fseekp % BUFSIZE];
|
||||
fseekp++;
|
||||
#else
|
||||
do {
|
||||
c = fbuf[(int) fseekp / BUFSIZE][(int) fseekp % BUFSIZE];
|
||||
ch = fbuf[(int) fseekp / BUFSIZE][(int) fseekp % BUFSIZE];
|
||||
fseekp++;
|
||||
} while(c == '\r');
|
||||
} while(ch == '\r');
|
||||
#endif /* !WINNT_NATIVE */
|
||||
return (c);
|
||||
return (ch);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1821,6 +1875,28 @@ bseek(l)
|
||||
xprintf(CGETS(16, 6, "seek to file %x\n"), fseekp);
|
||||
#endif
|
||||
fseekp = l->f_seek;
|
||||
#ifdef WIDE_STRINGS
|
||||
if (cantell) {
|
||||
if (fseekp >= fbobp) {
|
||||
size_t i;
|
||||
off_t o;
|
||||
|
||||
o = fbobp;
|
||||
for (i = 0; i < feobp - fbobp; i++) {
|
||||
if (fseekp == o) {
|
||||
fseekp = fbobp + i;
|
||||
return;
|
||||
}
|
||||
o += fclens[i];
|
||||
}
|
||||
if (fseekp == o) {
|
||||
fseekp = feobp;
|
||||
return;
|
||||
}
|
||||
}
|
||||
fbobp = feobp = fseekp + 1; /* To force lseek() */
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
default:
|
||||
xprintf(CGETS(16, 7, "Bad seek type %d\n"), aret);
|
||||
@ -1849,8 +1925,17 @@ struct Ain *l;
|
||||
#endif
|
||||
return;
|
||||
case TCSH_F_SEEK:
|
||||
/*SUPPRESS 112*/
|
||||
l->f_seek = fseekp;
|
||||
#ifdef WIDE_STRINGS
|
||||
if (cantell && fseekp >= fbobp && fseekp < feobp) {
|
||||
size_t i;
|
||||
|
||||
l->f_seek = fbobp;
|
||||
for (i = 0; i < fseekp - fbobp; i++)
|
||||
l->f_seek += fclens[i];
|
||||
} else
|
||||
#endif
|
||||
/*SUPPRESS 112*/
|
||||
l->f_seek = fseekp;
|
||||
l->a_seek = NULL;
|
||||
#ifdef DEBUG_SEEK
|
||||
xprintf(CGETS(16, 10, "tell file %x\n"), fseekp);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.misc.c,v 3.26 2003/03/12 19:14:51 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.misc.c,v 3.34 2005/01/18 20:24:50 christos Exp $ */
|
||||
/*
|
||||
* sh.misc.c: Miscelaneous functions
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.misc.c,v 3.26 2003/03/12 19:14:51 christos Exp $")
|
||||
RCSID("$Id: sh.misc.c,v 3.34 2005/01/18 20:24:50 christos Exp $")
|
||||
|
||||
static int renum __P((int, int));
|
||||
static Char **blkend __P((Char **));
|
||||
@ -44,13 +44,13 @@ static Char **blkcat __P((Char **, Char **));
|
||||
|
||||
int
|
||||
any(s, c)
|
||||
register char *s;
|
||||
register int c;
|
||||
const char *s;
|
||||
Char c;
|
||||
{
|
||||
if (!s)
|
||||
return (0); /* Check for nil pointer */
|
||||
while (*s)
|
||||
if (*s++ == c)
|
||||
if ((Char)*s++ == c)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
@ -68,25 +68,24 @@ setzero(cp, i)
|
||||
|
||||
char *
|
||||
strsave(s)
|
||||
register const char *s;
|
||||
const char *s;
|
||||
{
|
||||
char *n;
|
||||
register char *p;
|
||||
char *n, *r;
|
||||
const char *p;
|
||||
|
||||
if (s == NULL)
|
||||
s = (const char *) "";
|
||||
for (p = (char *) s; *p++ != '\0';)
|
||||
s = "";
|
||||
for (p = s; *p++ != '\0';)
|
||||
continue;
|
||||
n = p = (char *) xmalloc((size_t)
|
||||
((((const char *) p) - s) * sizeof(char)));
|
||||
while ((*p++ = *s++) != '\0')
|
||||
r = n = (char *) xmalloc((size_t)((((const char *) p) - s) * sizeof(char)));
|
||||
while ((*n++ = *s++) != '\0')
|
||||
continue;
|
||||
return (n);
|
||||
return (r);
|
||||
}
|
||||
|
||||
static Char **
|
||||
blkend(up)
|
||||
register Char **up;
|
||||
Char **up;
|
||||
{
|
||||
|
||||
while (*up)
|
||||
@ -97,7 +96,7 @@ blkend(up)
|
||||
|
||||
void
|
||||
blkpr(av)
|
||||
register Char **av;
|
||||
Char **av;
|
||||
{
|
||||
|
||||
for (; *av; av++) {
|
||||
@ -109,7 +108,7 @@ blkpr(av)
|
||||
|
||||
void
|
||||
blkexpand(av, str)
|
||||
register Char **av;
|
||||
Char **av;
|
||||
Char *str;
|
||||
{
|
||||
*str = '\0';
|
||||
@ -122,9 +121,9 @@ blkexpand(av, str)
|
||||
|
||||
int
|
||||
blklen(av)
|
||||
register Char **av;
|
||||
Char **av;
|
||||
{
|
||||
register int i = 0;
|
||||
int i = 0;
|
||||
|
||||
while (*av++)
|
||||
i++;
|
||||
@ -134,9 +133,9 @@ blklen(av)
|
||||
Char **
|
||||
blkcpy(oav, bv)
|
||||
Char **oav;
|
||||
register Char **bv;
|
||||
Char **bv;
|
||||
{
|
||||
register Char **av = oav;
|
||||
Char **av = oav;
|
||||
|
||||
while ((*av++ = *bv++) != NULL)
|
||||
continue;
|
||||
@ -156,7 +155,7 @@ void
|
||||
blkfree(av0)
|
||||
Char **av0;
|
||||
{
|
||||
register Char **av = av0;
|
||||
Char **av = av0;
|
||||
|
||||
if (!av0)
|
||||
return;
|
||||
@ -167,9 +166,9 @@ blkfree(av0)
|
||||
|
||||
Char **
|
||||
saveblk(v)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
{
|
||||
register Char **newv =
|
||||
Char **newv =
|
||||
(Char **) xcalloc((size_t) (blklen(v) + 1), sizeof(Char **));
|
||||
Char **onewv = newv;
|
||||
|
||||
@ -178,14 +177,14 @@ saveblk(v)
|
||||
return (onewv);
|
||||
}
|
||||
|
||||
#if !defined(SHORT_STRINGS) && !defined(POSIX)
|
||||
#ifndef HAVE_STRSTR
|
||||
char *
|
||||
strstr(s, t)
|
||||
register const char *s, *t;
|
||||
const char *s, *t;
|
||||
{
|
||||
do {
|
||||
register const char *ss = s;
|
||||
register const char *tt = t;
|
||||
const char *ss = s;
|
||||
const char *tt = t;
|
||||
|
||||
do
|
||||
if (*tt == '\0')
|
||||
@ -194,30 +193,25 @@ strstr(s, t)
|
||||
} while (*s++ != '\0');
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#endif /* !SHORT_STRINGS && !POSIX */
|
||||
#endif /* !HAVE_STRSTR */
|
||||
|
||||
#ifndef SHORT_STRINGS
|
||||
char *
|
||||
strspl(cp, dp)
|
||||
char *cp, *dp;
|
||||
const char *cp, *dp;
|
||||
{
|
||||
char *ep;
|
||||
register char *p, *q;
|
||||
size_t cl, dl;
|
||||
|
||||
if (!cp)
|
||||
cp = "";
|
||||
if (!dp)
|
||||
dp = "";
|
||||
for (p = cp; *p++ != '\0';)
|
||||
continue;
|
||||
for (q = dp; *q++ != '\0';)
|
||||
continue;
|
||||
ep = (char *) xmalloc((size_t) (((p - cp) + (q - dp) - 1) * sizeof(char)));
|
||||
for (p = ep, q = cp; (*p++ = *q++) != '\0';)
|
||||
continue;
|
||||
for (p--, q = dp; (*p++ = *q++) != '\0';)
|
||||
continue;
|
||||
cl = strlen(cp);
|
||||
dl = strlen(dp);
|
||||
ep = (char *) xmalloc((cl + dl + 1) * sizeof(char));
|
||||
memcpy(ep, cp, cl);
|
||||
memcpy(ep + cl, dp, dl + 1);
|
||||
return (ep);
|
||||
}
|
||||
|
||||
@ -225,9 +219,9 @@ strspl(cp, dp)
|
||||
|
||||
Char **
|
||||
blkspl(up, vp)
|
||||
register Char **up, **vp;
|
||||
Char **up, **vp;
|
||||
{
|
||||
register Char **wp =
|
||||
Char **wp =
|
||||
(Char **) xcalloc((size_t) (blklen(up) + blklen(vp) + 1),
|
||||
sizeof(Char **));
|
||||
|
||||
@ -237,7 +231,7 @@ blkspl(up, vp)
|
||||
|
||||
Char
|
||||
lastchr(cp)
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
{
|
||||
|
||||
if (!cp)
|
||||
@ -256,11 +250,11 @@ lastchr(cp)
|
||||
void
|
||||
closem()
|
||||
{
|
||||
register int f;
|
||||
int f;
|
||||
|
||||
#ifdef NLS_BUGS
|
||||
#ifdef NLS_CATALOGS
|
||||
(void)catclose(catd);
|
||||
nlsclose();
|
||||
#endif /* NLS_CATALOGS */
|
||||
#endif /* NLS_BUGS */
|
||||
#ifdef YPBUGS
|
||||
@ -298,7 +292,7 @@ closem()
|
||||
void
|
||||
closech()
|
||||
{
|
||||
register int f;
|
||||
int f;
|
||||
|
||||
if (didcch)
|
||||
return;
|
||||
@ -326,12 +320,9 @@ donefds()
|
||||
#ifdef NISPLUS
|
||||
{
|
||||
int fd = open(_PATH_DEVNULL, O_RDONLY|O_LARGEFILE);
|
||||
(void) dup2(fd, 1);
|
||||
(void) dup2(fd, 2);
|
||||
if (fd != 0) {
|
||||
(void) dup2(fd, 0);
|
||||
(void) close(fd);
|
||||
}
|
||||
(void)dcopy(fd, 1);
|
||||
(void)dcopy(fd, 2);
|
||||
(void)dmove(fd, 0);
|
||||
}
|
||||
#endif /*NISPLUS*/
|
||||
}
|
||||
@ -339,16 +330,16 @@ donefds()
|
||||
/*
|
||||
* Move descriptor i to j.
|
||||
* If j is -1 then we just want to get i to a safe place,
|
||||
* i.e. to a unit > 2. This also happens in dcopy.
|
||||
* i.e. to a unit > FSAFE. This also happens in dcopy.
|
||||
*/
|
||||
int
|
||||
dmove(i, j)
|
||||
register int i, j;
|
||||
int i, j;
|
||||
{
|
||||
|
||||
if (i == j || i < 0)
|
||||
return (i);
|
||||
#ifdef HAVEDUP2
|
||||
#ifdef HAVE_DUP2
|
||||
if (j >= 0) {
|
||||
(void) dup2(i, j);
|
||||
if (j != i)
|
||||
@ -364,13 +355,13 @@ dmove(i, j)
|
||||
|
||||
int
|
||||
dcopy(i, j)
|
||||
register int i, j;
|
||||
int i, j;
|
||||
{
|
||||
|
||||
if (i == j || i < 0 || (j < 0 && i > 2))
|
||||
if (i == j || i < 0 || (j < 0 && i > FSAFE))
|
||||
return (i);
|
||||
if (j >= 0) {
|
||||
#ifdef HAVEDUP2
|
||||
#ifdef HAVE_DUP2
|
||||
(void) dup2(i, j);
|
||||
return (j);
|
||||
#else
|
||||
@ -382,13 +373,13 @@ dcopy(i, j)
|
||||
|
||||
static int
|
||||
renum(i, j)
|
||||
register int i, j;
|
||||
int i, j;
|
||||
{
|
||||
register int k = dup(i);
|
||||
int k = dup(i);
|
||||
|
||||
if (k < 0)
|
||||
return (-1);
|
||||
if (j == -1 && k > 2)
|
||||
if (j == -1 && k > FSAFE)
|
||||
return (k);
|
||||
if (k != j) {
|
||||
j = renum(k, j);
|
||||
@ -405,10 +396,10 @@ renum(i, j)
|
||||
*/
|
||||
void
|
||||
lshift(v, c)
|
||||
register Char **v;
|
||||
register int c;
|
||||
Char **v;
|
||||
int c;
|
||||
{
|
||||
register Char **u;
|
||||
Char **u;
|
||||
|
||||
for (u = v; *u && --c >= 0; u++)
|
||||
xfree((ptr_t) *u);
|
||||
@ -434,9 +425,9 @@ number(cp)
|
||||
|
||||
Char **
|
||||
copyblk(v)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
{
|
||||
register Char **nv =
|
||||
Char **nv =
|
||||
(Char **) xcalloc((size_t) (blklen(v) + 1), sizeof(Char **));
|
||||
|
||||
return (blkcpy(nv, v));
|
||||
@ -445,7 +436,7 @@ copyblk(v)
|
||||
#ifndef SHORT_STRINGS
|
||||
char *
|
||||
strend(cp)
|
||||
register char *cp;
|
||||
char *cp;
|
||||
{
|
||||
if (!cp)
|
||||
return (cp);
|
||||
@ -460,7 +451,7 @@ Char *
|
||||
strip(cp)
|
||||
Char *cp;
|
||||
{
|
||||
register Char *dp = cp;
|
||||
Char *dp = cp;
|
||||
|
||||
if (!cp)
|
||||
return (cp);
|
||||
@ -473,7 +464,7 @@ Char *
|
||||
quote(cp)
|
||||
Char *cp;
|
||||
{
|
||||
register Char *dp = cp;
|
||||
Char *dp = cp;
|
||||
|
||||
if (!cp)
|
||||
return (cp);
|
||||
@ -508,7 +499,7 @@ udvar(name)
|
||||
|
||||
int
|
||||
prefix(sub, str)
|
||||
register Char *sub, *str;
|
||||
const Char *sub, *str;
|
||||
{
|
||||
|
||||
for (;;) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.parse.c,v 3.11 2002/03/08 17:36:46 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.parse.c,v 3.13 2004/11/23 02:10:49 christos Exp $ */
|
||||
/*
|
||||
* sh.parse.c: Interpret a list of tokens
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.parse.c,v 3.11 2002/03/08 17:36:46 christos Exp $")
|
||||
RCSID("$Id: sh.parse.c,v 3.13 2004/11/23 02:10:49 christos Exp $")
|
||||
|
||||
/*
|
||||
* C shell
|
||||
@ -60,7 +60,7 @@ static int aleft;
|
||||
extern int hleft;
|
||||
void
|
||||
alias(lexp)
|
||||
register struct wordent *lexp;
|
||||
struct wordent *lexp;
|
||||
{
|
||||
jmp_buf_t osetexit;
|
||||
|
||||
@ -80,7 +80,7 @@ alias(lexp)
|
||||
|
||||
static void
|
||||
asyntax(p1, p2)
|
||||
register struct wordent *p1, *p2;
|
||||
struct wordent *p1, *p2;
|
||||
{
|
||||
while (p1 != p2)
|
||||
if (any(";&\n", p1->word[0]))
|
||||
@ -94,10 +94,10 @@ asyntax(p1, p2)
|
||||
static void
|
||||
asyn0(p1, p2)
|
||||
struct wordent *p1;
|
||||
register struct wordent *p2;
|
||||
struct wordent *p2;
|
||||
{
|
||||
register struct wordent *p;
|
||||
register int l = 0;
|
||||
struct wordent *p;
|
||||
int l = 0;
|
||||
|
||||
for (p = p1; p != p2; p = p->next)
|
||||
switch (p->word[0]) {
|
||||
@ -137,11 +137,11 @@ asyn0(p1, p2)
|
||||
static void
|
||||
asyn3(p1, p2)
|
||||
struct wordent *p1;
|
||||
register struct wordent *p2;
|
||||
struct wordent *p2;
|
||||
{
|
||||
register struct varent *ap;
|
||||
struct varent *ap;
|
||||
struct wordent alout;
|
||||
register bool redid;
|
||||
int redid;
|
||||
|
||||
if (p1 == p2)
|
||||
return;
|
||||
@ -187,9 +187,9 @@ asyn3(p1, p2)
|
||||
|
||||
static struct wordent *
|
||||
freenod(p1, p2)
|
||||
register struct wordent *p1, *p2;
|
||||
struct wordent *p1, *p2;
|
||||
{
|
||||
register struct wordent *retp = p1->prev;
|
||||
struct wordent *retp = p1->prev;
|
||||
|
||||
while (p1 != p2) {
|
||||
xfree((ptr_t) p1->word);
|
||||
@ -213,7 +213,7 @@ freenod(p1, p2)
|
||||
*/
|
||||
struct command *
|
||||
syntax(p1, p2, flags)
|
||||
register struct wordent *p1, *p2;
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
|
||||
@ -235,8 +235,8 @@ syn0(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
register struct wordent *p;
|
||||
register struct command *t, *t1;
|
||||
struct wordent *p;
|
||||
struct command *t, *t1;
|
||||
int l;
|
||||
|
||||
l = 0;
|
||||
@ -305,8 +305,8 @@ syn1(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
register struct wordent *p;
|
||||
register struct command *t;
|
||||
struct wordent *p;
|
||||
struct command *t;
|
||||
int l;
|
||||
|
||||
l = 0;
|
||||
@ -349,9 +349,9 @@ syn1a(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
register struct wordent *p;
|
||||
register struct command *t;
|
||||
register int l = 0;
|
||||
struct wordent *p;
|
||||
struct command *t;
|
||||
int l = 0;
|
||||
|
||||
for (p = p1; p != p2; p = p->next)
|
||||
switch (p->word[0]) {
|
||||
@ -393,9 +393,9 @@ syn1b(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
register struct wordent *p;
|
||||
register struct command *t;
|
||||
register int l = 0;
|
||||
struct wordent *p;
|
||||
struct command *t;
|
||||
int l = 0;
|
||||
|
||||
for (p = p1; p != p2; p = p->next)
|
||||
switch (p->word[0]) {
|
||||
@ -436,9 +436,9 @@ syn2(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
register struct wordent *p, *pn;
|
||||
register struct command *t;
|
||||
register int l = 0;
|
||||
struct wordent *p, *pn;
|
||||
struct command *t;
|
||||
int l = 0;
|
||||
int f;
|
||||
|
||||
for (p = p1; p != p2; p = p->next)
|
||||
@ -490,13 +490,13 @@ syn3(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
register struct wordent *p;
|
||||
struct wordent *p;
|
||||
struct wordent *lp, *rp;
|
||||
register struct command *t;
|
||||
register int l;
|
||||
struct command *t;
|
||||
int l;
|
||||
Char **av;
|
||||
int n, c;
|
||||
bool specp = 0;
|
||||
int specp = 0;
|
||||
|
||||
if (p1 != p2) {
|
||||
p = p1;
|
||||
@ -668,9 +668,9 @@ syn3(p1, p2, flags)
|
||||
|
||||
void
|
||||
freesyn(t)
|
||||
register struct command *t;
|
||||
struct command *t;
|
||||
{
|
||||
register Char **v;
|
||||
Char **v;
|
||||
|
||||
if (t == 0)
|
||||
return;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.print.c,v 3.21 2002/03/08 17:36:46 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.print.c,v 3.28 2005/03/03 17:19:35 kim Exp $ */
|
||||
/*
|
||||
* sh.print.c: Primitive Output routines.
|
||||
*/
|
||||
@ -32,17 +32,15 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.print.c,v 3.21 2002/03/08 17:36:46 christos Exp $")
|
||||
RCSID("$Id: sh.print.c,v 3.28 2005/03/03 17:19:35 kim Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
|
||||
extern int Tty_eight_bit;
|
||||
extern int Tty_raw_mode;
|
||||
extern Char GettingInput;
|
||||
|
||||
int lbuffed = 1; /* true if line buffered */
|
||||
|
||||
static void p2dig __P((int));
|
||||
static void p2dig __P((unsigned int));
|
||||
|
||||
/*
|
||||
* C Shell
|
||||
@ -51,9 +49,9 @@ static void p2dig __P((int));
|
||||
#if defined(BSDLIMIT) || defined(RLIMIT_CPU)
|
||||
void
|
||||
psecs(l)
|
||||
long l;
|
||||
unsigned long l;
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
i = (int) (l / 3600);
|
||||
if (i) {
|
||||
@ -75,7 +73,7 @@ psecs(l)
|
||||
void
|
||||
pcsecs(l) /* PWP: print mm:ss.dd, l is in sec*100 */
|
||||
#ifdef BSDTIMES
|
||||
long l;
|
||||
unsigned long l;
|
||||
#else /* BSDTIMES */
|
||||
# ifndef POSIX
|
||||
time_t l;
|
||||
@ -84,7 +82,7 @@ pcsecs(l) /* PWP: print mm:ss.dd, l is in sec*100 */
|
||||
# endif /* POSIX */
|
||||
#endif /* BSDTIMES */
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
i = (int) (l / 360000);
|
||||
if (i) {
|
||||
@ -105,35 +103,60 @@ pcsecs(l) /* PWP: print mm:ss.dd, l is in sec*100 */
|
||||
|
||||
static void
|
||||
p2dig(i)
|
||||
register int i;
|
||||
unsigned int i;
|
||||
{
|
||||
|
||||
xprintf("%d%d", i / 10, i % 10);
|
||||
xprintf("%u%u", i / 10, i % 10);
|
||||
}
|
||||
|
||||
char linbuf[2048]; /* was 128 */
|
||||
char *linp = linbuf;
|
||||
bool output_raw = 0; /* PWP */
|
||||
bool xlate_cr = 0; /* HE */
|
||||
int output_raw = 0; /* PWP */
|
||||
int xlate_cr = 0; /* HE */
|
||||
|
||||
#ifdef WIDE_STRINGS
|
||||
void
|
||||
putwraw(Char c)
|
||||
{
|
||||
char buf[MB_LEN_MAX];
|
||||
size_t i, len;
|
||||
|
||||
len = one_wctomb(buf, c & CHAR);
|
||||
for (i = 0; i < len; i++)
|
||||
putraw((unsigned char)buf[i] | (c & ~CHAR));
|
||||
}
|
||||
|
||||
void
|
||||
xputwchar(Char c)
|
||||
{
|
||||
char buf[MB_LEN_MAX];
|
||||
size_t i, len;
|
||||
|
||||
len = one_wctomb(buf, c & CHAR);
|
||||
for (i = 0; i < len; i++)
|
||||
xputchar((unsigned char)buf[i] | (c & ~CHAR));
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
xputchar(c)
|
||||
register int c;
|
||||
int c;
|
||||
{
|
||||
int atr = 0;
|
||||
|
||||
atr |= c & ATTRIBUTES & TRIM;
|
||||
c &= CHAR | QUOTE;
|
||||
if (!output_raw && (c & QUOTE) == 0) {
|
||||
if (Iscntrl(c)) {
|
||||
if (iscntrl(c) && (c < 0x80 || MB_CUR_MAX == 1)) {
|
||||
#ifdef COLORCAT
|
||||
if (c != '\t' && c != '\n' && !(adrof(STRcolorcat) && c=='\033') && (xlate_cr || c != '\r')) {
|
||||
if (c != '\t' && c != '\n' && !(adrof(STRcolorcat) && c=='\033') && (xlate_cr || c != '\r'))
|
||||
#else
|
||||
if (c != '\t' && c != '\n' && (xlate_cr || c != '\r')) {
|
||||
if (c != '\t' && c != '\n' && (xlate_cr || c != '\r'))
|
||||
#endif
|
||||
{
|
||||
xputchar('^' | atr);
|
||||
#ifdef IS_ASCII
|
||||
if (c == ASCII)
|
||||
if (c == 0177)
|
||||
c = '?';
|
||||
else
|
||||
c |= 0100;
|
||||
@ -146,7 +169,7 @@ xputchar(c)
|
||||
|
||||
}
|
||||
}
|
||||
else if (!Isprint(c)) {
|
||||
else if (!isprint(c) && (c < 0x80 || MB_CUR_MAX == 1)) {
|
||||
xputchar('\\' | atr);
|
||||
xputchar((((c >> 6) & 7) + '0') | atr);
|
||||
xputchar((((c >> 3) & 7) + '0') | atr);
|
||||
@ -167,7 +190,7 @@ xputchar(c)
|
||||
|
||||
int
|
||||
putraw(c)
|
||||
register int c;
|
||||
int c;
|
||||
{
|
||||
if (haderr ? (didfds ? is2atty : isdiagatty) :
|
||||
(didfds ? is1atty : isoutatty)) {
|
||||
@ -183,7 +206,7 @@ putraw(c)
|
||||
|
||||
int
|
||||
putpure(c)
|
||||
register int c;
|
||||
int c;
|
||||
{
|
||||
c &= CHAR;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.proc.c,v 3.81 2003/11/09 03:02:46 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.proc.c,v 3.90 2005/03/03 19:57:07 kim Exp $ */
|
||||
/*
|
||||
* sh.proc.c: Job manipulations
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.proc.c,v 3.81 2003/11/09 03:02:46 christos Exp $")
|
||||
RCSID("$Id: sh.proc.c,v 3.90 2005/03/03 19:57:07 kim Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
#include "tc.h"
|
||||
@ -47,9 +47,9 @@ RCSID("$Id: sh.proc.c,v 3.81 2003/11/09 03:02:46 christos Exp $")
|
||||
# define HZ 16
|
||||
#endif /* aiws */
|
||||
|
||||
#if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid) || defined(linux)
|
||||
#if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid) || defined(linux) || defined(__GNU__) || defined(__GLIBC__)
|
||||
# define BSDWAIT
|
||||
#endif /* _BSD || (IRIS4D && __STDC__) || __lucid || linux */
|
||||
#endif /* _BSD || (IRIS4D && __STDC__) || __lucid || glibc */
|
||||
#ifndef WTERMSIG
|
||||
# define WTERMSIG(w) (((union wait *) &(w))->w_termsig)
|
||||
# ifndef BSDWAIT
|
||||
@ -91,23 +91,7 @@ static struct cvxrusage zru = {{0L, 0L}, {0L, 0L}, 0L, 0L, 0L, 0L,
|
||||
{0L, 0L}, 0LL, 0LL, 0LL, 0LL, 0L, 0L, 0L,
|
||||
0LL, 0LL, {0L, 0L, 0L, 0L, 0L}};
|
||||
# else
|
||||
# if defined(SUNOS4) || defined(hp9000) || (defined(__alpha) && defined(__osf__))
|
||||
static struct rusage zru = {{0L, 0L}, {0L, 0L}, 0L, 0L, 0L, 0L,
|
||||
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L};
|
||||
|
||||
# else /* !SUNOS4 && !hp9000 && !(__alpha && __osf__) */
|
||||
# ifdef masscomp
|
||||
/*
|
||||
* Initialization of this structure under RTU 4.1A & RTU 5.0 is problematic
|
||||
* because the first two elements are unions of a time_t and a struct timeval.
|
||||
* So we'll just have to trust the loader to do the "right thing", DAS DEC-90.
|
||||
*/
|
||||
static struct rusage zru;
|
||||
# else /* masscomp */
|
||||
static struct rusage zru = {{0L, 0L}, {0L, 0L}, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0};
|
||||
# endif /* masscomp */
|
||||
# endif /* SUNOS4 || hp9000 || (__alpha && __osf__) */
|
||||
# endif /* convex */
|
||||
#else /* !BSDTIMES */
|
||||
# ifdef _SEQUENT_
|
||||
@ -146,17 +130,14 @@ static void setttypgrp __P((int));
|
||||
* childs status. Top level routines (like pwait) must be sure
|
||||
* to mask interrupts when playing with the proclist data structures!
|
||||
*/
|
||||
sigret_t
|
||||
RETSIGTYPE
|
||||
/*ARGSUSED*/
|
||||
pchild(snum)
|
||||
int snum;
|
||||
{
|
||||
register struct process *pp;
|
||||
register struct process *fp;
|
||||
register int pid;
|
||||
#if defined(BSDJOBS) || (!defined(BSDTIMES) && (defined(ODT) || defined(aiws) || defined(uts)))
|
||||
extern int insource;
|
||||
#endif /* BSDJOBS || (!BSDTIMES && (ODT || aiws || uts)) */
|
||||
struct process *pp;
|
||||
struct process *fp;
|
||||
int pid;
|
||||
#ifdef BSDWAIT
|
||||
union wait w;
|
||||
#else /* !BSDWAIT */
|
||||
@ -173,7 +154,6 @@ int snum;
|
||||
# else /* !_SEQUENT_ */
|
||||
struct tms proctimes;
|
||||
|
||||
USE(snum);
|
||||
if (!timesdone) {
|
||||
timesdone++;
|
||||
(void) times(&shtimes);
|
||||
@ -181,6 +161,7 @@ int snum;
|
||||
# endif /* !_SEQUENT_ */
|
||||
#endif /* !BSDTIMES */
|
||||
|
||||
USE(snum);
|
||||
#ifdef JOBDEBUG
|
||||
xprintf("pchild()\n");
|
||||
#endif /* JOBDEBUG */
|
||||
@ -216,7 +197,7 @@ int snum;
|
||||
(setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG), &ru);
|
||||
# else
|
||||
/* both a wait3 and rusage */
|
||||
# if !defined(BSDWAIT) || defined(NeXT) || defined(MACH) || defined(linux) || (defined(IRIS4D) && (__STDC__ || defined(FUNCPROTO)) && SYSVREL <= 3) || defined(__lucid) || defined(__osf__)
|
||||
# if !defined(BSDWAIT) || defined(NeXT) || defined(MACH) || defined(linux) || defined(__GNU__) || defined(__GLIBC__) || (defined(IRIS4D) && (__STDC__ || defined(PROTOTYPES)) && SYSVREL <= 3) || defined(__lucid) || defined(__osf__)
|
||||
pid = wait3(&w,
|
||||
(setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG), &ru);
|
||||
# else /* BSDWAIT */
|
||||
@ -307,11 +288,7 @@ int snum;
|
||||
goto loop;
|
||||
}
|
||||
pnoprocesses = pid == -1;
|
||||
#ifndef SIGVOID
|
||||
return (0);
|
||||
#else /* !SIGVOID */
|
||||
return;
|
||||
#endif /* !SIGVOID */
|
||||
goto end;
|
||||
}
|
||||
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next)
|
||||
if (pid == pp->p_procid)
|
||||
@ -445,8 +422,6 @@ int snum;
|
||||
if ((jobflags & PSTOPPED) == 0)
|
||||
pflush(pp);
|
||||
{
|
||||
extern Char GettingInput;
|
||||
|
||||
if (GettingInput) {
|
||||
errno = 0;
|
||||
(void) Rawmode();
|
||||
@ -472,12 +447,14 @@ int snum;
|
||||
#if defined(BSDJOBS) || defined(HAVEwait3)
|
||||
goto loop;
|
||||
#endif /* BSDJOBS || HAVEwait3 */
|
||||
end:
|
||||
;
|
||||
}
|
||||
|
||||
void
|
||||
pnote()
|
||||
{
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
int flags;
|
||||
#ifdef BSDSIGS
|
||||
sigmask_t omask;
|
||||
@ -524,7 +501,7 @@ pfree(pp)
|
||||
void
|
||||
pwait()
|
||||
{
|
||||
register struct process *fp, *pp;
|
||||
struct process *fp, *pp;
|
||||
#ifdef BSDSIGS
|
||||
sigmask_t omask;
|
||||
#endif /* BSDSIGS */
|
||||
@ -562,9 +539,9 @@ pwait()
|
||||
*/
|
||||
void
|
||||
pjwait(pp)
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
{
|
||||
register struct process *fp;
|
||||
struct process *fp;
|
||||
int jobflags, reason;
|
||||
#ifdef BSDSIGS
|
||||
sigmask_t omask;
|
||||
@ -689,7 +666,7 @@ dowait(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
#ifdef BSDSIGS
|
||||
sigmask_t omask;
|
||||
#endif /* BSDSIGS */
|
||||
@ -730,7 +707,7 @@ dowait(v, c)
|
||||
static void
|
||||
pflushall()
|
||||
{
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
|
||||
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next)
|
||||
if (pp->p_procid)
|
||||
@ -744,10 +721,10 @@ pflushall()
|
||||
*/
|
||||
static void
|
||||
pflush(pp)
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
{
|
||||
register struct process *np;
|
||||
register int idx;
|
||||
struct process *np;
|
||||
int idx;
|
||||
|
||||
if (pp->p_procid == 0) {
|
||||
xprintf(CGETS(17, 3, "BUG: process flushed twice"));
|
||||
@ -778,7 +755,7 @@ pflush(pp)
|
||||
*/
|
||||
static void
|
||||
pclrcurr(pp)
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
{
|
||||
if (pp == pcurrent) {
|
||||
if (pprevious != NULL) {
|
||||
@ -804,7 +781,7 @@ static Char *cmdp;
|
||||
*/
|
||||
Char *
|
||||
unparse(t)
|
||||
register struct command *t;
|
||||
struct command *t;
|
||||
{
|
||||
cmdp = command;
|
||||
cmdlen = 0;
|
||||
@ -821,9 +798,9 @@ unparse(t)
|
||||
void
|
||||
palloc(pid, t)
|
||||
int pid;
|
||||
register struct command *t;
|
||||
struct command *t;
|
||||
{
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
int i;
|
||||
|
||||
pp = (struct process *) xcalloc(1, (size_t) sizeof(struct process));
|
||||
@ -908,7 +885,7 @@ palloc(pid, t)
|
||||
|
||||
static void
|
||||
padd(t)
|
||||
register struct command *t;
|
||||
struct command *t;
|
||||
{
|
||||
Char **argp;
|
||||
|
||||
@ -974,7 +951,7 @@ static void
|
||||
pads(cp)
|
||||
Char *cp;
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Avoid the Quoted Space alias hack! Reported by:
|
||||
@ -1028,7 +1005,7 @@ prestjob()
|
||||
void
|
||||
pendjob()
|
||||
{
|
||||
register struct process *pp, *tp;
|
||||
struct process *pp, *tp;
|
||||
|
||||
if (pcurrjob && (pcurrjob->p_flags & (PFOREGND | PSTOPPED)) == 0) {
|
||||
pp = pcurrjob;
|
||||
@ -1058,14 +1035,13 @@ pendjob()
|
||||
|
||||
static int
|
||||
pprint(pp, flag)
|
||||
register struct process *pp;
|
||||
bool flag;
|
||||
struct process *pp;
|
||||
int flag;
|
||||
{
|
||||
int status, reason;
|
||||
struct process *tp;
|
||||
extern char *linp, linbuf[];
|
||||
int jobflags, pstatus, pcond;
|
||||
char *format;
|
||||
const char *format;
|
||||
|
||||
#ifdef BACKPIPE
|
||||
struct process *pipehead = NULL, *pipetail = NULL, *pmarker = NULL;
|
||||
@ -1175,12 +1151,14 @@ pprint(pp, flag)
|
||||
&& reason != SIGINT
|
||||
&& (reason != SIGPIPE
|
||||
|| (pp->p_flags & PPOU) == 0))) {
|
||||
char *ptr;
|
||||
const char *ptr;
|
||||
char buf[1024];
|
||||
|
||||
if ((ptr = mesg[pp->p_reason & ASCII].pname) == NULL)
|
||||
xsnprintf(ptr = buf, sizeof(buf), "%s %d",
|
||||
if ((ptr = mesg[pp->p_reason & ASCII].pname) == NULL) {
|
||||
xsnprintf(buf, sizeof(buf), "%s %d",
|
||||
CGETS(17, 5, "Signal"), pp->p_reason & ASCII);
|
||||
ptr = buf;
|
||||
}
|
||||
xprintf(format, ptr);
|
||||
}
|
||||
else
|
||||
@ -1302,13 +1280,13 @@ pprint(pp, flag)
|
||||
|
||||
static void
|
||||
ptprint(tp)
|
||||
register struct process *tp;
|
||||
struct process *tp;
|
||||
{
|
||||
#ifdef BSDTIMES
|
||||
struct timeval tetime, diff;
|
||||
static struct timeval ztime;
|
||||
struct sysrusage ru;
|
||||
register struct process *pp = tp;
|
||||
struct process *pp = tp;
|
||||
|
||||
ru = zru;
|
||||
tetime = ztime;
|
||||
@ -1324,7 +1302,7 @@ ptprint(tp)
|
||||
timeval_t tetime, diff;
|
||||
static timeval_t ztime;
|
||||
struct process_stats ru;
|
||||
register struct process *pp = tp;
|
||||
struct process *pp = tp;
|
||||
|
||||
ru = zru;
|
||||
tetime = ztime;
|
||||
@ -1352,7 +1330,7 @@ ptprint(tp)
|
||||
|
||||
# endif /* POSIX */
|
||||
struct tms zts, rts;
|
||||
register struct process *pp = tp;
|
||||
struct process *pp = tp;
|
||||
|
||||
u_time = zu_time;
|
||||
s_time = zs_time;
|
||||
@ -1386,8 +1364,8 @@ dojobs(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct process *pp;
|
||||
register int flag = NUMBER | NAME | REASON;
|
||||
struct process *pp;
|
||||
int flag = NUMBER | NAME | REASON;
|
||||
int i;
|
||||
|
||||
USE(c);
|
||||
@ -1417,7 +1395,7 @@ dofg(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
|
||||
USE(c);
|
||||
okpcntl();
|
||||
@ -1448,7 +1426,7 @@ dofg1(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
|
||||
USE(c);
|
||||
okpcntl();
|
||||
@ -1476,7 +1454,7 @@ dobg(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
|
||||
USE(c);
|
||||
okpcntl();
|
||||
@ -1499,7 +1477,7 @@ dobg1(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
|
||||
USE(c);
|
||||
pp = pfind(v[0]);
|
||||
@ -1533,11 +1511,9 @@ dokill(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register int signum, len = 0;
|
||||
register char *name;
|
||||
int signum, len = 0;
|
||||
const char *name;
|
||||
Char *sigptr;
|
||||
extern int T_Cols;
|
||||
extern int nsig;
|
||||
|
||||
USE(c);
|
||||
v++;
|
||||
@ -1592,7 +1568,7 @@ pkill(v, signum)
|
||||
Char **v;
|
||||
int signum;
|
||||
{
|
||||
register struct process *pp, *np;
|
||||
struct process *pp, *np;
|
||||
int jobflags = 0, err1 = 0;
|
||||
pid_t pid;
|
||||
#ifdef BSDSIGS
|
||||
@ -1717,11 +1693,11 @@ pkill(v, signum)
|
||||
*/
|
||||
int
|
||||
pstart(pp, foregnd)
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
int foregnd;
|
||||
{
|
||||
int rv = 0;
|
||||
register struct process *np;
|
||||
struct process *np;
|
||||
#ifdef BSDSIGS
|
||||
sigmask_t omask;
|
||||
#endif /* BSDSIGS */
|
||||
@ -1792,9 +1768,9 @@ pstart(pp, foregnd)
|
||||
|
||||
void
|
||||
panystop(neednl)
|
||||
bool neednl;
|
||||
int neednl;
|
||||
{
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
|
||||
chkstop = 2;
|
||||
for (pp = proclist.p_next; pp; pp = pp->p_next)
|
||||
@ -1806,7 +1782,7 @@ struct process *
|
||||
pfind(cp)
|
||||
Char *cp;
|
||||
{
|
||||
register struct process *pp, *np;
|
||||
struct process *pp, *np;
|
||||
|
||||
if (cp == 0 || cp[1] == 0 || eq(cp, STRcent2) || eq(cp, STRcentplus)) {
|
||||
if (pcurrent == NULL)
|
||||
@ -1830,7 +1806,7 @@ pfind(cp)
|
||||
for (pp = proclist.p_next; pp; pp = pp->p_next)
|
||||
if (pp->p_procid == pp->p_jobid) {
|
||||
if (cp[1] == '?') {
|
||||
register Char *dp;
|
||||
Char *dp;
|
||||
|
||||
for (dp = pp->p_command; *dp; dp++) {
|
||||
if (*dp != cp[2])
|
||||
@ -1859,10 +1835,10 @@ pfind(cp)
|
||||
*/
|
||||
static struct process *
|
||||
pgetcurr(pp)
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
{
|
||||
register struct process *np;
|
||||
register struct process *xp = NULL;
|
||||
struct process *np;
|
||||
struct process *xp = NULL;
|
||||
|
||||
for (np = proclist.p_next; np; np = np->p_next)
|
||||
if (np != pcurrent && np != pp && np->p_procid &&
|
||||
@ -1884,7 +1860,7 @@ donotify(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
|
||||
USE(c);
|
||||
pp = pfind(*++v);
|
||||
@ -1908,8 +1884,8 @@ pfork(t, wanttty)
|
||||
struct command *t; /* command we are forking for */
|
||||
int wanttty;
|
||||
{
|
||||
register int pid;
|
||||
bool ignint = 0;
|
||||
int pid;
|
||||
int ignint = 0;
|
||||
int pgrp;
|
||||
#ifdef BSDSIGS
|
||||
sigmask_t omask = 0;
|
||||
@ -2016,12 +1992,12 @@ pfork(t, wanttty)
|
||||
(void) signal(SIGHUP, SIG_IGN);
|
||||
if (t->t_dflg & F_NICE) {
|
||||
int nval = SIGN_EXTEND_CHAR(t->t_nice);
|
||||
#ifdef BSDNICE
|
||||
#ifdef HAVE_SETPRIORITY
|
||||
if (setpriority(PRIO_PROCESS, 0, nval) == -1 && errno)
|
||||
stderror(ERR_SYSTEM, "setpriority", strerror(errno));
|
||||
#else /* !BSDNICE */
|
||||
#else /* !HAVE_SETPRIORITY */
|
||||
(void) nice(nval);
|
||||
#endif /* !BSDNICE */
|
||||
#endif /* !HAVE_SETPRIORITY */
|
||||
}
|
||||
#ifdef F_VER
|
||||
if (t->t_dflg & F_VER) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.proc.h,v 3.10 2002/03/08 17:36:46 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.proc.h,v 3.11 2004/11/23 02:10:49 christos Exp $ */
|
||||
/*
|
||||
* sh.proc.h: Process data structures and variables
|
||||
*/
|
||||
@ -116,7 +116,7 @@ struct process {
|
||||
#define AREASON 0200
|
||||
|
||||
EXTERN struct process proclist IZERO_STRUCT;/* list head of all processes */
|
||||
EXTERN bool pnoprocesses IZERO; /* pchild found nothing to wait for */
|
||||
EXTERN int pnoprocesses IZERO; /* pchild found nothing to wait for */
|
||||
|
||||
EXTERN struct process *pholdjob IZERO; /* one level stack of current jobs */
|
||||
|
||||
@ -127,7 +127,7 @@ EXTERN struct process *pprevious IZERO; /* previous job in table */
|
||||
EXTERN int pmaxindex IZERO; /* current maximum job index */
|
||||
|
||||
#ifndef BSDTIMES
|
||||
EXTERN bool timesdone; /* shtimes buffer full ? */
|
||||
EXTERN int timesdone; /* shtimes buffer full ? */
|
||||
#endif /* BSDTIMES */
|
||||
|
||||
#endif /* _h_sh_proc */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.sem.c,v 3.60 2004/02/23 15:04:36 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.sem.c,v 3.69 2005/01/18 20:24:51 christos Exp $ */
|
||||
/*
|
||||
* sh.sem.c: I/O redirections and job forking. A touchy issue!
|
||||
* Most stuff with builtins is incorrect
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.sem.c,v 3.60 2004/02/23 15:04:36 christos Exp $")
|
||||
RCSID("$Id: sh.sem.c,v 3.69 2005/01/18 20:24:51 christos Exp $")
|
||||
|
||||
#include "tc.h"
|
||||
#include "tw.h"
|
||||
@ -50,13 +50,13 @@ RCSID("$Id: sh.sem.c,v 3.60 2004/02/23 15:04:36 christos Exp $")
|
||||
#endif /* CLOSE_ON_EXEC */
|
||||
|
||||
#if defined(__sparc__) || defined(sparc)
|
||||
# if !defined(MACH) && SYSVREL == 0 && !defined(Lynx) && !defined(BSD4_4) && !defined(linux)
|
||||
# if !defined(MACH) && SYSVREL == 0 && !defined(Lynx) && !defined(BSD4_4) && !defined(linux) && !defined(__GNU__) && !defined(__GLIBC__)
|
||||
# include <vfork.h>
|
||||
# endif /* !MACH && SYSVREL == 0 && !Lynx && !BSD4_4 && !linux */
|
||||
# endif /* !MACH && SYSVREL == 0 && !Lynx && !BSD4_4 && !glibc */
|
||||
#endif /* __sparc__ || sparc */
|
||||
|
||||
#ifdef VFORK
|
||||
static sigret_t vffree __P((int));
|
||||
static RETSIGTYPE vffree __P((int));
|
||||
#endif
|
||||
static Char *splicepipe __P((struct command *, Char *));
|
||||
static void doio __P((struct command *, int *, int *));
|
||||
@ -85,16 +85,12 @@ static void chkclob __P((char *));
|
||||
/*VARARGS 1*/
|
||||
void
|
||||
execute(t, wanttty, pipein, pipeout, do_glob)
|
||||
register struct command *t;
|
||||
struct command *t;
|
||||
int wanttty;
|
||||
int *pipein, *pipeout;
|
||||
bool do_glob;
|
||||
int do_glob;
|
||||
{
|
||||
#ifdef VFORK
|
||||
extern bool use_fork; /* use fork() instead of vfork()? */
|
||||
#endif
|
||||
|
||||
bool forked = 0;
|
||||
int forked = 0;
|
||||
struct biltins *bifunc;
|
||||
int pid = 0;
|
||||
int pv[2];
|
||||
@ -522,7 +518,7 @@ execute(t, wanttty, pipein, pipeout, do_glob)
|
||||
else { /* child */
|
||||
/* this is from pfork() */
|
||||
int pgrp;
|
||||
bool ignint = 0;
|
||||
int ignint = 0;
|
||||
if (nosigchld) {
|
||||
# ifdef BSDSIGS
|
||||
(void) sigsetmask(csigmask);
|
||||
@ -579,13 +575,13 @@ execute(t, wanttty, pipein, pipeout, do_glob)
|
||||
(void) signal(SIGHUP, SIG_DFL);
|
||||
if (t->t_dflg & F_NICE) {
|
||||
int nval = SIGN_EXTEND_CHAR(t->t_nice);
|
||||
# ifdef BSDNICE
|
||||
# ifdef HAVE_SETPRIORITY
|
||||
if (setpriority(PRIO_PROCESS, 0, nval) == -1 && errno)
|
||||
stderror(ERR_SYSTEM, "setpriority",
|
||||
strerror(errno));
|
||||
# else /* !BSDNICE */
|
||||
# else /* !HAVE_SETPRIORITY */
|
||||
(void) nice(nval);
|
||||
# endif /* BSDNICE */
|
||||
# endif /* HAVE_SETPRIORITY */
|
||||
}
|
||||
# ifdef F_VER
|
||||
if (t->t_dflg & F_VER) {
|
||||
@ -654,6 +650,13 @@ execute(t, wanttty, pipein, pipeout, do_glob)
|
||||
func(t, bifunc);
|
||||
if (forked)
|
||||
exitstat();
|
||||
else {
|
||||
if (adrof(STRprintexitvalue)) {
|
||||
int rv = getn(varval(STRstatus));
|
||||
if (rv != 0)
|
||||
xprintf(CGETS(17, 2, "Exit %d\n"), rv);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (t->t_dtyp != NODE_PAREN) {
|
||||
@ -663,15 +666,19 @@ execute(t, wanttty, pipein, pipeout, do_glob)
|
||||
/*
|
||||
* For () commands must put new 0,1,2 in FSH* and recurse
|
||||
*/
|
||||
OLDSTD = dcopy(0, FOLDSTD);
|
||||
SHOUT = dcopy(1, FSHOUT);
|
||||
(void)close_on_exec(OLDSTD = dcopy(0, FOLDSTD), 1);
|
||||
(void)close_on_exec(SHOUT = dcopy(1, FSHOUT), 1);
|
||||
isoutatty = isatty(SHOUT);
|
||||
SHDIAG = dcopy(2, FSHDIAG);
|
||||
(void)close_on_exec(SHDIAG = dcopy(2, FSHDIAG), 1);
|
||||
isdiagatty = isatty(SHDIAG);
|
||||
(void) close(SHIN);
|
||||
SHIN = -1;
|
||||
#ifndef CLOSE_ON_EXEC
|
||||
didcch = 0;
|
||||
#else
|
||||
(void) close_on_exec(FSHOUT, 1);
|
||||
(void) close_on_exec(FSHDIAG, 1);
|
||||
(void) close_on_exec(FOLDSTD, 1);
|
||||
#endif /* !CLOSE_ON_EXEC */
|
||||
didfds = 0;
|
||||
wanttty = -1;
|
||||
@ -747,12 +754,12 @@ execute(t, wanttty, pipein, pipeout, do_glob)
|
||||
}
|
||||
|
||||
#ifdef VFORK
|
||||
static sigret_t
|
||||
static RETSIGTYPE
|
||||
/*ARGSUSED*/
|
||||
vffree(snum)
|
||||
int snum;
|
||||
{
|
||||
register Char **v;
|
||||
Char **v;
|
||||
|
||||
USE(snum);
|
||||
if ((v = gargv) != 0) {
|
||||
@ -766,10 +773,6 @@ int snum;
|
||||
}
|
||||
|
||||
_exit(1);
|
||||
#ifndef SIGVOID
|
||||
/*NOTREACHED*/
|
||||
return(0);
|
||||
#endif /* SIGVOID */
|
||||
}
|
||||
#endif /* VFORK */
|
||||
|
||||
@ -790,7 +793,7 @@ int snum;
|
||||
*/
|
||||
static Char *
|
||||
splicepipe(t, cp)
|
||||
register struct command *t;
|
||||
struct command *t;
|
||||
Char *cp; /* word after < or > */
|
||||
{
|
||||
Char *blk[2];
|
||||
@ -836,12 +839,12 @@ splicepipe(t, cp)
|
||||
*/
|
||||
static void
|
||||
doio(t, pipein, pipeout)
|
||||
register struct command *t;
|
||||
struct command *t;
|
||||
int *pipein, *pipeout;
|
||||
{
|
||||
register int fd;
|
||||
register Char *cp;
|
||||
register unsigned long flags = t->t_dflg;
|
||||
int fd;
|
||||
Char *cp;
|
||||
unsigned long flags = t->t_dflg;
|
||||
|
||||
if (didfds || (flags & F_REPEAT))
|
||||
return;
|
||||
@ -863,7 +866,7 @@ doio(t, pipein, pipeout)
|
||||
stderror(ERR_SYSTEM, tmp, strerror(errno));
|
||||
/* allow input files larger than 2Gb */
|
||||
#ifndef WINNT_NATIVE
|
||||
(void) fcntl(fd, O_LARGEFILE, 0);
|
||||
(void) fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_LARGEFILE);
|
||||
#endif /*!WINNT_NATIVE*/
|
||||
(void) dmove(fd, 0);
|
||||
}
|
||||
@ -923,7 +926,7 @@ doio(t, pipein, pipeout)
|
||||
stderror(ERR_SYSTEM, tmp, strerror(errno));
|
||||
/* allow input files larger than 2Gb */
|
||||
#ifndef WINNT_NATIVE
|
||||
(void) fcntl(fd, O_LARGEFILE, 0);
|
||||
(void) fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_LARGEFILE);
|
||||
#endif /*!WINNT_NATIVE*/
|
||||
}
|
||||
(void) dmove(fd, 1);
|
||||
@ -960,13 +963,13 @@ doio(t, pipein, pipeout)
|
||||
|
||||
void
|
||||
mypipe(pv)
|
||||
register int *pv;
|
||||
int *pv;
|
||||
{
|
||||
|
||||
if (pipe(pv) < 0)
|
||||
goto oops;
|
||||
pv[0] = dmove(pv[0], -1);
|
||||
pv[1] = dmove(pv[1], -1);
|
||||
(void)close_on_exec(pv[0] = dmove(pv[0], -1), 1);
|
||||
(void)close_on_exec(pv[1] = dmove(pv[1], -1), 1);
|
||||
if (pv[0] >= 0 && pv[1] >= 0)
|
||||
return;
|
||||
oops:
|
||||
@ -975,7 +978,7 @@ mypipe(pv)
|
||||
|
||||
static void
|
||||
chkclob(cp)
|
||||
register char *cp;
|
||||
char *cp;
|
||||
{
|
||||
struct stat stb;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.set.c,v 3.48 2004/03/21 16:48:14 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.set.c,v 3.61 2005/03/03 16:57:02 kim Exp $ */
|
||||
/*
|
||||
* sh.set.c: Setting and Clearing of variables
|
||||
*/
|
||||
@ -32,13 +32,16 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.set.c,v 3.48 2004/03/21 16:48:14 christos Exp $")
|
||||
RCSID("$Id: sh.set.c,v 3.61 2005/03/03 16:57:02 kim Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
#include "tw.h"
|
||||
|
||||
extern Char HistLit;
|
||||
extern bool GotTermCaps;
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
extern int GotTermCaps;
|
||||
int numeof = 0;
|
||||
|
||||
static void update_vars __P((Char *));
|
||||
@ -66,13 +69,13 @@ update_vars(vp)
|
||||
dohash(NULL, NULL);
|
||||
}
|
||||
else if (eq(vp, STRhistchars)) {
|
||||
register Char *pn = varval(vp);
|
||||
Char *pn = varval(vp);
|
||||
|
||||
HIST = *pn++;
|
||||
HISTSUB = *pn;
|
||||
}
|
||||
else if (eq(vp, STRpromptchars)) {
|
||||
register Char *pn = varval(vp);
|
||||
Char *pn = varval(vp);
|
||||
|
||||
PRCH = *pn++;
|
||||
PRCHROOT = *pn;
|
||||
@ -94,7 +97,7 @@ update_vars(vp)
|
||||
loginsh = 1;
|
||||
}
|
||||
else if (eq(vp, STRsymlinks)) {
|
||||
register Char *pn = varval(vp);
|
||||
Char *pn = varval(vp);
|
||||
|
||||
if (eq(pn, STRignore))
|
||||
symlinks = SYM_IGNORE;
|
||||
@ -192,7 +195,7 @@ update_vars(vp)
|
||||
#endif
|
||||
#ifdef NLS_CATALOGS
|
||||
else if (eq(vp, STRcatalog)) {
|
||||
(void) catclose(catd);
|
||||
nlsclose();
|
||||
nlsinit();
|
||||
}
|
||||
#if defined(FILEC) && defined(TIOCSTI)
|
||||
@ -206,18 +209,18 @@ update_vars(vp)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
doset(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register Char *p;
|
||||
Char *p;
|
||||
Char *vp, op;
|
||||
Char **vecp;
|
||||
bool hadsub;
|
||||
int hadsub;
|
||||
int subscr;
|
||||
int flags = VAR_READWRITE;
|
||||
bool first_match = 0;
|
||||
bool last_match = 0;
|
||||
bool changed = 0;
|
||||
int first_match = 0;
|
||||
int last_match = 0;
|
||||
int changed = 0;
|
||||
|
||||
USE(c);
|
||||
v++;
|
||||
@ -276,7 +279,7 @@ doset(v, c)
|
||||
if (op && op != '=')
|
||||
stderror(ERR_NAME | ERR_SYNTAX);
|
||||
if (eq(p, STRLparen)) {
|
||||
register Char **e = v;
|
||||
Char **e = v;
|
||||
|
||||
if (hadsub)
|
||||
stderror(ERR_NAME | ERR_SYNTAX);
|
||||
@ -309,8 +312,8 @@ doset(v, c)
|
||||
|
||||
static Char *
|
||||
getinx(cp, ip)
|
||||
register Char *cp;
|
||||
register int *ip;
|
||||
Char *cp;
|
||||
int *ip;
|
||||
{
|
||||
*ip = 0;
|
||||
*cp++ = 0;
|
||||
@ -327,7 +330,7 @@ asx(vp, subscr, p)
|
||||
int subscr;
|
||||
Char *p;
|
||||
{
|
||||
register struct varent *v = getvx(vp, subscr);
|
||||
struct varent *v = getvx(vp, subscr);
|
||||
|
||||
if (v->v_flags & VAR_READONLY)
|
||||
stderror(ERR_READONLY|ERR_NAME, v->v_name);
|
||||
@ -340,7 +343,7 @@ getvx(vp, subscr)
|
||||
Char *vp;
|
||||
int subscr;
|
||||
{
|
||||
register struct varent *v = adrof(vp);
|
||||
struct varent *v = adrof(vp);
|
||||
|
||||
if (v == 0)
|
||||
udvar(vp);
|
||||
@ -355,9 +358,9 @@ dolet(v, dummy)
|
||||
Char **v;
|
||||
struct command *dummy;
|
||||
{
|
||||
register Char *p;
|
||||
Char *p;
|
||||
Char *vp, c, op;
|
||||
bool hadsub;
|
||||
int hadsub;
|
||||
int subscr;
|
||||
|
||||
USE(dummy);
|
||||
@ -443,7 +446,7 @@ static Char *
|
||||
xset(cp, vp)
|
||||
Char *cp, ***vp;
|
||||
{
|
||||
register Char *dp;
|
||||
Char *dp;
|
||||
|
||||
if (*cp) {
|
||||
dp = Strsave(cp);
|
||||
@ -461,9 +464,9 @@ operate(op, vp, p)
|
||||
{
|
||||
Char opr[2];
|
||||
Char *vec[5];
|
||||
register Char **v = vec;
|
||||
Char **v = vec;
|
||||
Char **vecp = v;
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (op != '=') {
|
||||
if (*vp)
|
||||
@ -486,7 +489,7 @@ static Char *putp, nbuf[50];
|
||||
|
||||
Char *
|
||||
putn(n)
|
||||
register int n;
|
||||
int n;
|
||||
{
|
||||
int num;
|
||||
|
||||
@ -518,7 +521,7 @@ putn(n)
|
||||
|
||||
static void
|
||||
putn1(n)
|
||||
register int n;
|
||||
int n;
|
||||
{
|
||||
if (n > 9)
|
||||
putn1(n / 10);
|
||||
@ -527,9 +530,9 @@ putn1(n)
|
||||
|
||||
int
|
||||
getn(cp)
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
int sign;
|
||||
|
||||
if (!cp) /* PWP: extra error checking */
|
||||
@ -557,7 +560,7 @@ value1(var, head)
|
||||
Char *var;
|
||||
struct varent *head;
|
||||
{
|
||||
register struct varent *vp;
|
||||
struct varent *vp;
|
||||
|
||||
if (!var || !head) /* PWP: extra error checking */
|
||||
return (STRNULL);
|
||||
@ -570,9 +573,9 @@ value1(var, head)
|
||||
static struct varent *
|
||||
madrof(pat, vp)
|
||||
Char *pat;
|
||||
register struct varent *vp;
|
||||
struct varent *vp;
|
||||
{
|
||||
register struct varent *vp1;
|
||||
struct varent *vp1;
|
||||
|
||||
for (vp = vp->v_left; vp; vp = vp->v_right) {
|
||||
if (vp->v_left && (vp1 = madrof(pat, vp)) != NULL)
|
||||
@ -585,8 +588,8 @@ madrof(pat, vp)
|
||||
|
||||
struct varent *
|
||||
adrof1(name, v)
|
||||
register Char *name;
|
||||
register struct varent *v;
|
||||
Char *name;
|
||||
struct varent *v;
|
||||
{
|
||||
int cmp;
|
||||
|
||||
@ -608,7 +611,7 @@ set(var, val, flags)
|
||||
Char *var, *val;
|
||||
int flags;
|
||||
{
|
||||
register Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **)));
|
||||
Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **)));
|
||||
|
||||
vec[0] = val;
|
||||
vec[1] = 0;
|
||||
@ -621,7 +624,7 @@ set1(var, vec, head, flags)
|
||||
struct varent *head;
|
||||
int flags;
|
||||
{
|
||||
register Char **oldv = vec;
|
||||
Char **oldv = vec;
|
||||
|
||||
if ((flags & VAR_NOGLOB) == 0) {
|
||||
gflag = 0;
|
||||
@ -693,11 +696,11 @@ set1(var, vec, head, flags)
|
||||
void
|
||||
setq(name, vec, p, flags)
|
||||
Char *name, **vec;
|
||||
register struct varent *p;
|
||||
struct varent *p;
|
||||
int flags;
|
||||
{
|
||||
register struct varent *c;
|
||||
register int f;
|
||||
struct varent *c;
|
||||
int f;
|
||||
|
||||
f = 0; /* tree hangs off the header's left link */
|
||||
while ((c = p->v_link[f]) != 0) {
|
||||
@ -729,7 +732,7 @@ unset(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
bool did_roe, did_edit;
|
||||
int did_roe, did_edit;
|
||||
|
||||
USE(c);
|
||||
did_roe = adrof(STRrecognize_only_executables) != NULL;
|
||||
@ -779,18 +782,18 @@ unset(v, c)
|
||||
update_dspmbyte_vars();
|
||||
#endif
|
||||
#ifdef NLS_CATALOGS
|
||||
(void) catclose(catd);
|
||||
nlsclose();
|
||||
nlsinit();
|
||||
#endif /* NLS_CATALOGS */
|
||||
}
|
||||
|
||||
void
|
||||
unset1(v, head)
|
||||
register Char *v[];
|
||||
Char *v[];
|
||||
struct varent *head;
|
||||
{
|
||||
register struct varent *vp;
|
||||
register int cnt;
|
||||
struct varent *vp;
|
||||
int cnt;
|
||||
|
||||
while (*++v) {
|
||||
cnt = 0;
|
||||
@ -808,7 +811,7 @@ void
|
||||
unsetv(var)
|
||||
Char *var;
|
||||
{
|
||||
register struct varent *vp;
|
||||
struct varent *vp;
|
||||
|
||||
if ((vp = adrof1(var, &shvhed)) == 0)
|
||||
udvar(var);
|
||||
@ -817,10 +820,10 @@ unsetv(var)
|
||||
|
||||
static void
|
||||
unsetv1(p)
|
||||
register struct varent *p;
|
||||
struct varent *p;
|
||||
{
|
||||
register struct varent *c, *pp;
|
||||
register int f;
|
||||
struct varent *c, *pp;
|
||||
int f;
|
||||
|
||||
/*
|
||||
* Free associated memory first to avoid complications.
|
||||
@ -870,11 +873,11 @@ setNS(cp)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
shift(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct varent *argv;
|
||||
register Char *name;
|
||||
struct varent *argv;
|
||||
Char *name;
|
||||
|
||||
USE(c);
|
||||
v++;
|
||||
@ -966,15 +969,15 @@ rright(p)
|
||||
*/
|
||||
static void
|
||||
balance(p, f, d)
|
||||
register struct varent *p;
|
||||
register int f, d;
|
||||
struct varent *p;
|
||||
int f, d;
|
||||
{
|
||||
register struct varent *pp;
|
||||
struct varent *pp;
|
||||
|
||||
#ifndef lint
|
||||
register struct varent *t; /* used by the rotate macros */
|
||||
struct varent *t; /* used by the rotate macros */
|
||||
#endif /* !lint */
|
||||
register int ff;
|
||||
int ff;
|
||||
#ifdef lint
|
||||
ff = 0; /* Sun's lint is dumb! */
|
||||
#endif
|
||||
@ -1071,11 +1074,11 @@ balance(p, f, d)
|
||||
|
||||
void
|
||||
plist(p, what)
|
||||
register struct varent *p;
|
||||
struct varent *p;
|
||||
int what;
|
||||
{
|
||||
register struct varent *c;
|
||||
register int len;
|
||||
struct varent *c;
|
||||
int len;
|
||||
|
||||
if (setintr)
|
||||
#ifdef BSDSIGS
|
||||
@ -1113,7 +1116,7 @@ plist(p, what)
|
||||
}
|
||||
|
||||
#if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
|
||||
bool dspmbyte_ls;
|
||||
extern int dspmbyte_ls;
|
||||
|
||||
void
|
||||
update_dspmbyte_vars()
|
||||
@ -1126,13 +1129,13 @@ update_dspmbyte_vars()
|
||||
if ((vp = adrof(CHECK_MBYTEVAR)) && !adrof(STRnokanji)) {
|
||||
_enable_mbdisp = 1;
|
||||
dstr1 = vp->vec[0];
|
||||
if(eq (dstr1, STRKSJIS))
|
||||
if(eq (dstr1, STRsjis))
|
||||
iskcode = 1;
|
||||
else if (eq(dstr1, STRKEUC))
|
||||
else if (eq(dstr1, STReuc))
|
||||
iskcode = 2;
|
||||
else if (eq(dstr1, STRKBIG5))
|
||||
else if (eq(dstr1, STRbig5))
|
||||
iskcode = 3;
|
||||
else if (eq(dstr1, STRKUTF8))
|
||||
else if (eq(dstr1, STRutf8))
|
||||
iskcode = 4;
|
||||
else if ((dstr1[0] - '0') >= 0 && (dstr1[0] - '0') <= 3) {
|
||||
iskcode = 0;
|
||||
@ -1239,28 +1242,50 @@ autoset_dspmbyte(pcp)
|
||||
Char *n;
|
||||
Char *v;
|
||||
} dspmt[] = {
|
||||
{ STRLANGEUCJP, STRKEUC },
|
||||
{ STRLANGEUCKR, STRKEUC },
|
||||
{ STRLANGEUCZH, STRKEUC },
|
||||
{ STRLANGEUCJPB, STRKEUC },
|
||||
{ STRLANGEUCKRB, STRKEUC },
|
||||
{ STRLANGEUCZHB, STRKEUC },
|
||||
{ STRLANGEUCJP, STReuc },
|
||||
{ STRLANGEUCKR, STReuc },
|
||||
{ STRLANGEUCZH, STReuc },
|
||||
{ STRLANGEUCJPB, STReuc },
|
||||
{ STRLANGEUCKRB, STReuc },
|
||||
{ STRLANGEUCZHB, STReuc },
|
||||
#ifdef linux
|
||||
{ STRLANGEUCJPC, STRKEUC },
|
||||
{ STRLANGEUCJPC, STReuc },
|
||||
#endif
|
||||
{ STRLANGSJIS, STRKSJIS },
|
||||
{ STRLANGSJISB, STRKSJIS },
|
||||
{ STRLANGBIG5, STRKBIG5 },
|
||||
{ STRSTARKUTF8, STRKUTF8 },
|
||||
{ STRLANGSJIS, STRsjis },
|
||||
{ STRLANGSJISB, STRsjis },
|
||||
{ STRLANGBIG5, STRbig5 },
|
||||
{ STRstarutfstar8, STRutf8 },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
struct dspm_autoset_Table dspmc[] = {
|
||||
{ STRstarutfstar8, STRutf8 },
|
||||
{ STReuc, STReuc },
|
||||
{ STRGB2312, STReuc },
|
||||
{ STRLANGBIG5, STRbig5 },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
Char *codeset;
|
||||
|
||||
codeset = str2short(nl_langinfo(CODESET));
|
||||
if (*codeset != '\0') {
|
||||
for (i = 0; dspmc[i].n; i++) {
|
||||
Char *estr;
|
||||
if (dspmc[i].n[0] && t_pmatch(pcp, dspmc[i].n, &estr, 0) > 0) {
|
||||
set(CHECK_MBYTEVAR, Strsave(dspmc[i].v), VAR_READWRITE);
|
||||
update_dspmbyte_vars();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (*pcp == '\0')
|
||||
return;
|
||||
|
||||
for (i = 0; dspmt[i].n; i++) {
|
||||
Char *estr;
|
||||
if (t_pmatch(pcp, dspmt[i].n, &estr, 1) > 0) {
|
||||
if (dspmt[i].n[0] && t_pmatch(pcp, dspmt[i].n, &estr, 0) > 0) {
|
||||
set(CHECK_MBYTEVAR, Strsave(dspmt[i].v), VAR_READWRITE);
|
||||
update_dspmbyte_vars();
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.time.c,v 3.25 2002/06/25 19:02:11 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.time.c,v 3.28 2005/03/03 16:49:16 kim Exp $ */
|
||||
/*
|
||||
* sh.time.c: Shell time keeping and printing.
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: sh.time.c,v 3.25 2002/06/25 19:02:11 christos Exp $")
|
||||
RCSID("$Id: sh.time.c,v 3.28 2005/03/03 16:49:16 kim Exp $")
|
||||
|
||||
#ifdef SUNOS4
|
||||
# include <machine/param.h>
|
||||
@ -160,10 +160,10 @@ dotime(v, c)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
donice(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register Char *cp;
|
||||
Char *cp;
|
||||
int nval = 0;
|
||||
|
||||
USE(c);
|
||||
@ -172,21 +172,22 @@ donice(v, c)
|
||||
nval = 4;
|
||||
else if (*v == 0 && any("+-", cp[0]))
|
||||
nval = getn(cp);
|
||||
#ifdef BSDNICE
|
||||
#ifdef HAVE_SETPRIORITY
|
||||
if (setpriority(PRIO_PROCESS, 0, nval) == -1 && errno)
|
||||
stderror(ERR_SYSTEM, "setpriority", strerror(errno));
|
||||
#else /* BSDNICE */
|
||||
#else /* !HAVE_SETPRIORITY */
|
||||
(void) nice(nval);
|
||||
#endif /* BSDNICE */
|
||||
#endif /* HAVE_SETPRIORITY */
|
||||
}
|
||||
|
||||
#ifdef BSDTIMES
|
||||
void
|
||||
ruadd(ru, ru2)
|
||||
register struct sysrusage *ru, *ru2;
|
||||
struct sysrusage *ru, *ru2;
|
||||
{
|
||||
tvadd(&ru->ru_utime, &ru2->ru_utime);
|
||||
tvadd(&ru->ru_stime, &ru2->ru_stime);
|
||||
#ifndef _OSD_POSIX
|
||||
if (ru2->ru_maxrss > ru->ru_maxrss)
|
||||
ru->ru_maxrss = ru2->ru_maxrss;
|
||||
|
||||
@ -203,6 +204,7 @@ ruadd(ru, ru2)
|
||||
ru->ru_nsignals += ru2->ru_nsignals;
|
||||
ru->ru_nvcsw += ru2->ru_nvcsw;
|
||||
ru->ru_nivcsw += ru2->ru_nivcsw;
|
||||
#endif /*bs2000*/
|
||||
|
||||
# ifdef convex
|
||||
tvadd(&ru->ru_exutime, &ru2->ru_exutime);
|
||||
@ -217,7 +219,7 @@ ruadd(ru, ru2)
|
||||
# ifdef _SEQUENT_
|
||||
void
|
||||
ruadd(ru, ru2)
|
||||
register struct process_stats *ru, *ru2;
|
||||
struct process_stats *ru, *ru2;
|
||||
{
|
||||
tvadd(&ru->ps_utime, &ru2->ps_utime);
|
||||
tvadd(&ru->ps_stime, &ru2->ps_stime);
|
||||
@ -289,14 +291,14 @@ ruadd(ru, ru2)
|
||||
|
||||
void
|
||||
prusage(r0, r1, e, b)
|
||||
register struct sysrusage *r0, *r1;
|
||||
struct sysrusage *r0, *r1;
|
||||
timeval_t *e, *b;
|
||||
|
||||
#else /* BSDTIMES */
|
||||
# ifdef _SEQUENT_
|
||||
void
|
||||
prusage(r0, r1, e, b)
|
||||
register struct process_stats *r0, *r1;
|
||||
struct process_stats *r0, *r1;
|
||||
timeval_t *e, *b;
|
||||
|
||||
# else /* _SEQUENT_ */
|
||||
@ -315,7 +317,7 @@ prusage(bs, es, e, b)
|
||||
#endif /* BSDTIMES */
|
||||
{
|
||||
#ifdef BSDTIMES
|
||||
register time_t t =
|
||||
time_t t =
|
||||
(r1->ru_utime.tv_sec - r0->ru_utime.tv_sec) * 100 +
|
||||
(r1->ru_utime.tv_usec - r0->ru_utime.tv_usec) / 10000 +
|
||||
(r1->ru_stime.tv_sec - r0->ru_stime.tv_sec) * 100 +
|
||||
@ -323,7 +325,7 @@ prusage(bs, es, e, b)
|
||||
|
||||
#else
|
||||
# ifdef _SEQUENT_
|
||||
register time_t t =
|
||||
time_t t =
|
||||
(r1->ps_utime.tv_sec - r0->ps_utime.tv_sec) * 100 +
|
||||
(r1->ps_utime.tv_usec - r0->ps_utime.tv_usec) / 10000 +
|
||||
(r1->ps_stime.tv_sec - r0->ps_stime.tv_sec) * 100 +
|
||||
@ -331,20 +333,20 @@ prusage(bs, es, e, b)
|
||||
|
||||
# else /* _SEQUENT_ */
|
||||
# ifndef POSIX
|
||||
register time_t t = (es->tms_utime - bs->tms_utime +
|
||||
time_t t = (es->tms_utime - bs->tms_utime +
|
||||
es->tms_stime - bs->tms_stime) * 100 / HZ;
|
||||
|
||||
# else /* POSIX */
|
||||
register clock_t t = (es->tms_utime - bs->tms_utime +
|
||||
clock_t t = (es->tms_utime - bs->tms_utime +
|
||||
es->tms_stime - bs->tms_stime) * 100 / clk_tck;
|
||||
|
||||
# endif /* POSIX */
|
||||
# endif /* _SEQUENT_ */
|
||||
#endif /* BSDTIMES */
|
||||
|
||||
register char *cp;
|
||||
register long i;
|
||||
register struct varent *vp = adrof(STRtime);
|
||||
const char *cp;
|
||||
long i;
|
||||
struct varent *vp = adrof(STRtime);
|
||||
|
||||
#ifdef BSDTIMES
|
||||
# ifdef convex
|
||||
@ -461,7 +463,11 @@ prusage(bs, es, e, b)
|
||||
|
||||
#ifdef BSDTIMES
|
||||
case 'W': /* number of swaps */
|
||||
#ifdef _OSD_POSIX
|
||||
i = 0;
|
||||
#else
|
||||
i = r1->ru_nswap - r0->ru_nswap;
|
||||
#endif
|
||||
xprintf("%ld", i);
|
||||
break;
|
||||
|
||||
@ -495,20 +501,32 @@ prusage(bs, es, e, b)
|
||||
break;
|
||||
#else /* !convex */
|
||||
case 'X': /* (average) shared text size */
|
||||
#ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
#else
|
||||
xprintf("%ld", t == 0 ? 0L :
|
||||
IADJUST(r1->ru_ixrss - r0->ru_ixrss) / t);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'D': /* (average) unshared data size */
|
||||
#ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
#else
|
||||
xprintf("%ld", t == 0 ? 0L :
|
||||
IADJUST(r1->ru_idrss + r1->ru_isrss -
|
||||
(r0->ru_idrss + r0->ru_isrss)) / t);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'K': /* (average) total data memory used */
|
||||
#ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
#else
|
||||
xprintf("%ld", t == 0 ? 0L :
|
||||
IADJUST((r1->ru_ixrss + r1->ru_isrss + r1->ru_idrss) -
|
||||
(r0->ru_ixrss + r0->ru_idrss + r0->ru_isrss)) / t);
|
||||
#endif
|
||||
break;
|
||||
#endif /* convex */
|
||||
case 'M': /* max. Resident Set Size */
|
||||
@ -518,25 +536,45 @@ prusage(bs, es, e, b)
|
||||
# ifdef convex
|
||||
xprintf("%ld", r1->ru_maxrss * 4L);
|
||||
# else /* !convex */
|
||||
# ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
# else
|
||||
xprintf("%ld", r1->ru_maxrss / 2L);
|
||||
# endif
|
||||
# endif /* convex */
|
||||
#endif /* SUNOS4 */
|
||||
break;
|
||||
|
||||
case 'F': /* page faults */
|
||||
#ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
#else
|
||||
xprintf("%ld", r1->ru_majflt - r0->ru_majflt);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'R': /* page reclaims */
|
||||
#ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
#else
|
||||
xprintf("%ld", r1->ru_minflt - r0->ru_minflt);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'I': /* FS blocks in */
|
||||
#ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
#else
|
||||
xprintf("%ld", r1->ru_inblock - r0->ru_inblock);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'O': /* FS blocks out */
|
||||
#ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
#else
|
||||
xprintf("%ld", r1->ru_oublock - r0->ru_oublock);
|
||||
#endif
|
||||
break;
|
||||
|
||||
# ifdef convex
|
||||
@ -550,23 +588,43 @@ prusage(bs, es, e, b)
|
||||
break;
|
||||
# endif /* convex */
|
||||
case 'r': /* PWP: socket messages recieved */
|
||||
#ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
#else
|
||||
xprintf("%ld", r1->ru_msgrcv - r0->ru_msgrcv);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 's': /* PWP: socket messages sent */
|
||||
#ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
#else
|
||||
xprintf("%ld", r1->ru_msgsnd - r0->ru_msgsnd);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'k': /* PWP: signals received */
|
||||
#ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
#else
|
||||
xprintf("%ld", r1->ru_nsignals - r0->ru_nsignals);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'w': /* PWP: voluntary context switches (waits) */
|
||||
#ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
#else
|
||||
xprintf("%ld", r1->ru_nvcsw - r0->ru_nvcsw);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'c': /* PWP: involuntary context switches */
|
||||
#ifdef _OSD_POSIX
|
||||
xprintf("0",0);
|
||||
#else
|
||||
xprintf("%ld", r1->ru_nivcsw - r0->ru_nivcsw);
|
||||
#endif
|
||||
break;
|
||||
#else /* BSDTIMES */
|
||||
# ifdef _SEQUENT_
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/sh.types.h,v 3.40 2003/06/18 19:32:44 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/sh.types.h,v 3.42 2005/03/03 19:57:07 kim Exp $ */
|
||||
/* sh.types.h: Do the necessary typedefs for each system.
|
||||
* Up till now I avoided making this into a separate file
|
||||
* But I just wanted to eliminate the whole mess from sh.h
|
||||
@ -82,9 +82,6 @@
|
||||
typedef char * ptr_t;
|
||||
# endif /* __GNUC__ */
|
||||
# endif /* _PTR_T */
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
# ifndef __sys_stdtypes_h
|
||||
# define __sys_stdtypes_h
|
||||
# ifndef __lucid
|
||||
@ -98,18 +95,6 @@
|
||||
# ifndef _SPEED_T
|
||||
# define _SPEED_T
|
||||
# endif /* _SPEED_T */
|
||||
# ifndef SUNOS4
|
||||
# ifndef MACH
|
||||
# ifndef _UID_T
|
||||
# define _UID_T
|
||||
typedef int uid_t;
|
||||
# endif /* _UID_T */
|
||||
# ifndef _GID_T
|
||||
# define _GID_T
|
||||
typedef int gid_t;
|
||||
# endif /* _GID_T */
|
||||
# endif /* !MACH */
|
||||
# endif /* !SUNOS4 */
|
||||
#endif /* (sun || __sun__) && SYSVREL == 0 */
|
||||
|
||||
|
||||
@ -117,10 +102,6 @@
|
||||
*** Hp's running hpux 7.0 or 8.0
|
||||
***/
|
||||
#ifdef __hpux
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
typedef unsigned int size_t;
|
||||
# endif /* _SIZE_T */
|
||||
|
||||
# ifndef _PTR_T
|
||||
# define _PTR_T
|
||||
@ -160,12 +141,6 @@ extern unsigned int sleep();
|
||||
# if HPUXVERSION < 800 /* XXX: Not true for 8.0 */
|
||||
extern void sigpause();
|
||||
extern sigmask_t sigspace();
|
||||
extern int lstat();
|
||||
extern int readlink();
|
||||
extern int sigvector();
|
||||
extern int gethostname();
|
||||
extern int ioctl();
|
||||
extern int nice();
|
||||
extern char *sbrk();
|
||||
# endif /* HPUXVERSION < 800 */
|
||||
#endif /* __hpux */
|
||||
@ -188,53 +163,12 @@ typedef char * caddr_t;
|
||||
*** Data General AViiON 88000 or Pentium, running dgux 5.4R3 or R4.11
|
||||
***/
|
||||
#ifdef DGUX
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T size_t
|
||||
typedef unsigned int size_t;
|
||||
# endif /* _SIZE_T */
|
||||
# ifndef _PID_T
|
||||
# define _PID_T
|
||||
# endif /* _PID_T */
|
||||
#endif /* DGUX */
|
||||
|
||||
|
||||
/***
|
||||
*** Intel 386, ISC 386/ix v2.0.2
|
||||
***/
|
||||
#ifdef ISC202
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
#endif /* ISC202 */
|
||||
|
||||
/***
|
||||
*** a PFU/Fujitsu A-xx computer SX/A Edition 60 or later
|
||||
***/
|
||||
#ifdef SXA
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
#endif /* SXA */
|
||||
|
||||
/***
|
||||
*** a stellar 2600, running stellix 2.3
|
||||
***/
|
||||
#ifdef stellar
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
#endif /* stellar */
|
||||
|
||||
/***
|
||||
*** BSD systems, pre and post 4.3
|
||||
***/
|
||||
#ifdef BSD
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
#endif /* BSD */
|
||||
|
||||
|
||||
/***
|
||||
*** BSD RENO advertises itself as POSIX, but
|
||||
*** it is missing speed_t
|
||||
@ -284,9 +218,6 @@ typedef char * caddr_t;
|
||||
*** rs6000, ibm370, ps2, rt: running flavors of aix.
|
||||
***/
|
||||
#ifdef IBMAIX
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
# ifndef aiws
|
||||
# ifndef _PID_T
|
||||
# define _PID_T
|
||||
@ -304,9 +235,6 @@ typedef char * caddr_t;
|
||||
*** Ultrix...
|
||||
***/
|
||||
#if defined(ultrix) || defined(__ultrix)
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
# ifndef _PID_T
|
||||
# define _PID_T
|
||||
# endif /* _PID_T */
|
||||
@ -327,45 +255,21 @@ typedef char * caddr_t;
|
||||
#endif /* IRIS4D && IRIX3_3 */
|
||||
|
||||
|
||||
/***
|
||||
*** Sequent
|
||||
***/
|
||||
#ifdef sequent
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
#endif /* sequent */
|
||||
|
||||
/***
|
||||
*** Apple AUX.
|
||||
***/
|
||||
#ifdef OREO
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
# ifndef _PID_T
|
||||
# define _PID_T
|
||||
# endif /* _PID_T */
|
||||
#endif /* OREO */
|
||||
|
||||
/***
|
||||
*** Intel 386, Hypercube
|
||||
***/
|
||||
#ifdef INTEL
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
#endif /* INTEL */
|
||||
|
||||
/***
|
||||
*** Concurrent (Masscomp) running RTU 4.1A & RTU 5.0.
|
||||
**** [RTU 6.0 from mike connor]
|
||||
*** Added, DAS DEC-90.
|
||||
***/
|
||||
#ifdef masscomp
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
# ifdef RTU6
|
||||
# ifndef _PID_T
|
||||
# define _PID_T
|
||||
@ -376,34 +280,10 @@ typedef char * caddr_t;
|
||||
#endif /* RTU6 */
|
||||
#endif /* masscomp */
|
||||
|
||||
/***
|
||||
*** Encore multimax running umax 4.2
|
||||
***/
|
||||
#ifdef ns32000
|
||||
# ifdef __TYPES_DOT_H__
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
# endif /* __TYPES_DOT_H__ */
|
||||
#endif /* ns32000 */
|
||||
|
||||
/***
|
||||
*** Silicon Graphics IRIS 3000
|
||||
***
|
||||
***/
|
||||
#ifdef IRIS3D
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
#endif /* IRIS3D */
|
||||
|
||||
/*
|
||||
* Motorola MPC running R32V2 (sysV88)
|
||||
*/
|
||||
#ifdef sysV88
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
# ifndef _PID_T
|
||||
# define _PID_T
|
||||
# endif /* _PID_T */
|
||||
@ -413,63 +293,20 @@ typedef char * caddr_t;
|
||||
* Amdahl running UTS (Sys V3)
|
||||
*/
|
||||
#ifdef uts
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
# ifndef _PID_T
|
||||
# define _PID_T
|
||||
# endif /* _PID_T */
|
||||
#endif /* uts */
|
||||
|
||||
/*
|
||||
* Tektronix 4300 running UTek 4.0 (BSD 4.2)
|
||||
*/
|
||||
#ifdef UTek
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
# ifndef _UID_T
|
||||
# define _UID_T
|
||||
typedef int uid_t;
|
||||
# endif /* _UID_T */
|
||||
# ifndef _GID_T
|
||||
# define _GID_T
|
||||
typedef int gid_t;
|
||||
# endif /* _GID_T */
|
||||
#endif /* UTek */
|
||||
|
||||
/*
|
||||
* Tektronix XD88/10 running UTekV (Sys V3)
|
||||
*/
|
||||
#ifdef UTekV
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
# ifndef _PID_T
|
||||
# define _PID_T
|
||||
# endif /* _PID_T */
|
||||
#endif /* UTekV*/
|
||||
|
||||
/*
|
||||
* UnixPC aka u3b1
|
||||
*/
|
||||
#ifdef UNIXPC
|
||||
# ifdef types_h
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
# endif /* types_h */
|
||||
#endif /* UNIXPC */
|
||||
|
||||
/*
|
||||
* NS32000 OPUS
|
||||
*/
|
||||
#ifdef OPUS
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
#endif /* OPUS */
|
||||
|
||||
/*
|
||||
* BBN Butterfly gp1000
|
||||
*/
|
||||
@ -479,15 +316,6 @@ typedef char * caddr_t;
|
||||
# endif /* _PID_T */
|
||||
#endif /* butterfly */
|
||||
|
||||
/*
|
||||
* Convex
|
||||
*/
|
||||
#ifdef convex
|
||||
# if defined(__SIZE_T) && !defined(_SIZE_T)
|
||||
# define _SIZE_T
|
||||
# endif /* __SIZE_T && !_SIZE_T */
|
||||
#endif /* convex */
|
||||
|
||||
/*
|
||||
* Alliant FX-2800/FX-80
|
||||
*/
|
||||
@ -521,15 +349,6 @@ typedef char * caddr_t;
|
||||
# endif /* _PID_T */
|
||||
#endif /* apollo */
|
||||
|
||||
/*
|
||||
* Vax running VMS_POSIX
|
||||
*/
|
||||
#ifdef _VMS_POSIX
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
# endif /* _SIZE_T */
|
||||
#endif /* _VMS_POSIX */
|
||||
|
||||
/***
|
||||
*** a pdp/11, running 2BSD
|
||||
***/
|
||||
@ -554,15 +373,6 @@ typedef char * caddr_t;
|
||||
*** I am open to suggestions on how to do this correctly!
|
||||
***/
|
||||
|
||||
#ifndef __STDC__
|
||||
|
||||
# ifndef _SIZE_T
|
||||
# define _SIZE_T
|
||||
typedef int size_t; /* As sun comments ??? : meaning I take it */
|
||||
# endif /* _SIZE_T */ /* Until we make the world ANSI... */
|
||||
|
||||
#endif /* ! __STDC__ */
|
||||
|
||||
#ifndef POSIX
|
||||
|
||||
# ifndef _PID_T
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.alloc.c,v 3.36 2002/03/08 17:36:47 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.alloc.c,v 3.39 2005/01/05 16:06:14 christos Exp $ */
|
||||
/*
|
||||
* tc.alloc.c (Caltech) 2/21/82
|
||||
* Chris Kingsley, kingsley@cit-20.
|
||||
@ -40,17 +40,13 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tc.alloc.c,v 3.36 2002/03/08 17:36:47 christos Exp $")
|
||||
RCSID("$Id: tc.alloc.c,v 3.39 2005/01/05 16:06:14 christos Exp $")
|
||||
|
||||
static char *memtop = NULL; /* PWP: top of current memory */
|
||||
static char *membot = NULL; /* PWP: bottom of allocatable memory */
|
||||
|
||||
int dont_free = 0;
|
||||
|
||||
#if defined(_VMS_POSIX) || defined(_AMIGA_MEMORY)
|
||||
# define NO_SBRK
|
||||
#endif
|
||||
|
||||
#ifdef WINNT_NATIVE
|
||||
# define malloc fmalloc
|
||||
# define free ffree
|
||||
@ -161,12 +157,12 @@ static void morecore __P((int));
|
||||
|
||||
memalign_t
|
||||
malloc(nbytes)
|
||||
register size_t nbytes;
|
||||
size_t nbytes;
|
||||
{
|
||||
#ifndef lint
|
||||
register union overhead *p;
|
||||
register int bucket = 0;
|
||||
register unsigned shiftr;
|
||||
union overhead *p;
|
||||
int bucket = 0;
|
||||
unsigned shiftr;
|
||||
|
||||
/*
|
||||
* Convert amount of memory requested into closest block size stored in
|
||||
@ -237,12 +233,12 @@ malloc(nbytes)
|
||||
*/
|
||||
static void
|
||||
morecore(bucket)
|
||||
register int bucket;
|
||||
int bucket;
|
||||
{
|
||||
register union overhead *op;
|
||||
register int rnu; /* 2^rnu bytes will be requested */
|
||||
register int nblks; /* become nblks blocks of the desired size */
|
||||
register int siz;
|
||||
union overhead *op;
|
||||
int rnu; /* 2^rnu bytes will be requested */
|
||||
int nblks; /* become nblks blocks of the desired size */
|
||||
int siz;
|
||||
|
||||
if (nextf[bucket])
|
||||
return;
|
||||
@ -295,8 +291,8 @@ free(cp)
|
||||
ptr_t cp;
|
||||
{
|
||||
#ifndef lint
|
||||
register int size;
|
||||
register union overhead *op;
|
||||
int size;
|
||||
union overhead *op;
|
||||
|
||||
/*
|
||||
* the don't free flag is there so that we avoid os bugs in routines
|
||||
@ -338,7 +334,7 @@ calloc(i, j)
|
||||
size_t i, j;
|
||||
{
|
||||
#ifndef lint
|
||||
register char *cp, *scp;
|
||||
char *cp, *scp;
|
||||
|
||||
i *= j;
|
||||
scp = cp = (char *) xmalloc((size_t) i);
|
||||
@ -378,10 +374,10 @@ realloc(cp, nbytes)
|
||||
size_t nbytes;
|
||||
{
|
||||
#ifndef lint
|
||||
register U_int onb;
|
||||
U_int onb;
|
||||
union overhead *op;
|
||||
ptr_t res;
|
||||
register int i;
|
||||
int i;
|
||||
int was_alloced = 0;
|
||||
|
||||
if (cp == NULL)
|
||||
@ -454,8 +450,9 @@ findbucket(freep, srchlen)
|
||||
union overhead *freep;
|
||||
int srchlen;
|
||||
{
|
||||
register union overhead *p;
|
||||
register int i, j;
|
||||
union overhead *p;
|
||||
size_t i;
|
||||
int j;
|
||||
|
||||
for (i = 0; i < NBUCKETS; i++) {
|
||||
j = 0;
|
||||
@ -493,21 +490,21 @@ smalloc(n)
|
||||
|
||||
n = n ? n : 1;
|
||||
|
||||
#ifndef NO_SBRK
|
||||
#ifdef HAVE_SBRK
|
||||
if (membot == NULL)
|
||||
membot = (char*) sbrk(0);
|
||||
#endif /* !NO_SBRK */
|
||||
#endif /* HAVE_SBRK */
|
||||
|
||||
if ((ptr = malloc(n)) == (ptr_t) 0) {
|
||||
child++;
|
||||
stderror(ERR_NOMEM);
|
||||
}
|
||||
#ifdef NO_SBRK
|
||||
#ifndef HAVE_SBRK
|
||||
if (memtop < ((char *) ptr) + n)
|
||||
memtop = ((char *) ptr) + n;
|
||||
if (membot == NULL)
|
||||
membot = (char*) ptr;
|
||||
#endif /* NO_SBRK */
|
||||
#endif /* !HAVE_SBRK */
|
||||
return ((memalign_t) ptr);
|
||||
}
|
||||
|
||||
@ -520,21 +517,21 @@ srealloc(p, n)
|
||||
|
||||
n = n ? n : 1;
|
||||
|
||||
#ifndef NO_SBRK
|
||||
#ifdef HAVE_SBRK
|
||||
if (membot == NULL)
|
||||
membot = (char*) sbrk(0);
|
||||
#endif /* NO_SBRK */
|
||||
#endif /* HAVE_SBRK */
|
||||
|
||||
if ((ptr = (p ? realloc(p, n) : malloc(n))) == (ptr_t) 0) {
|
||||
child++;
|
||||
stderror(ERR_NOMEM);
|
||||
}
|
||||
#ifdef NO_SBRK
|
||||
#ifndef HAVE_SBRK
|
||||
if (memtop < ((char *) ptr) + n)
|
||||
memtop = ((char *) ptr) + n;
|
||||
if (membot == NULL)
|
||||
membot = (char*) ptr;
|
||||
#endif /* NO_SBRK */
|
||||
#endif /* !HAVE_SBRK */
|
||||
return ((memalign_t) ptr);
|
||||
}
|
||||
|
||||
@ -548,10 +545,10 @@ scalloc(s, n)
|
||||
n *= s;
|
||||
n = n ? n : 1;
|
||||
|
||||
#ifndef NO_SBRK
|
||||
#ifdef HAVE_SBRK
|
||||
if (membot == NULL)
|
||||
membot = (char*) sbrk(0);
|
||||
#endif /* NO_SBRK */
|
||||
#endif /* HAVE_SBRK */
|
||||
|
||||
if ((ptr = malloc(n)) == (ptr_t) 0) {
|
||||
child++;
|
||||
@ -564,12 +561,12 @@ scalloc(s, n)
|
||||
*sptr++ = 0;
|
||||
while (--n);
|
||||
|
||||
#ifdef NO_SBRK
|
||||
#ifndef HAVE_SBRK
|
||||
if (memtop < ((char *) ptr) + n)
|
||||
memtop = ((char *) ptr) + n;
|
||||
if (membot == NULL)
|
||||
membot = (char*) ptr;
|
||||
#endif /* NO_SBRK */
|
||||
#endif /* !HAVE_SBRK */
|
||||
|
||||
return ((memalign_t) ptr);
|
||||
}
|
||||
@ -598,8 +595,8 @@ showall(v, c)
|
||||
struct command *c;
|
||||
{
|
||||
#ifndef SYSMALLOC
|
||||
register int i, j;
|
||||
register union overhead *p;
|
||||
size_t i, j;
|
||||
union overhead *p;
|
||||
int totfree = 0, totused = 0;
|
||||
|
||||
xprintf(CGETS(19, 8, "%s current memory allocation:\nfree:\t"), progname);
|
||||
@ -621,9 +618,9 @@ showall(v, c)
|
||||
(unsigned long) membot, (unsigned long) memtop,
|
||||
(unsigned long) sbrk(0));
|
||||
#else
|
||||
#ifndef NO_SBRK
|
||||
#ifdef HAVE_SBRK
|
||||
memtop = (char *) sbrk(0);
|
||||
#endif /* !NO_SBRK */
|
||||
#endif /* HAVE_SBRK */
|
||||
xprintf(CGETS(19, 12, "Allocated memory from 0x%lx to 0x%lx (%ld).\n"),
|
||||
(unsigned long) membot, (unsigned long) memtop,
|
||||
(unsigned long) (memtop - membot));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.bind.c,v 3.36 2002/03/08 17:36:47 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.bind.c,v 3.39 2005/03/25 18:46:41 kim Exp $ */
|
||||
/*
|
||||
* tc.bind.c: Key binding functions
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tc.bind.c,v 3.36 2002/03/08 17:36:47 christos Exp $")
|
||||
RCSID("$Id: tc.bind.c,v 3.39 2005/03/25 18:46:41 kim Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
#include "ed.defns.h"
|
||||
@ -67,7 +67,7 @@ dobindkey(v, c)
|
||||
struct command *c;
|
||||
{
|
||||
KEYCMD *map;
|
||||
int ntype, no, remove, key, bind;
|
||||
int ntype, no, removeb, key, bindk;
|
||||
Char *par;
|
||||
Char p;
|
||||
KEYCMD cmd;
|
||||
@ -87,7 +87,7 @@ dobindkey(v, c)
|
||||
|
||||
map = CcKeyMap;
|
||||
ntype = XK_CMD;
|
||||
key = remove = bind = 0;
|
||||
key = removeb = bindk = 0;
|
||||
for (no = 1, par = v[no];
|
||||
par != NULL && (*par++ & CHAR) == '-'; no++, par = v[no]) {
|
||||
if ((p = (*par & CHAR)) == '-') {
|
||||
@ -97,7 +97,7 @@ dobindkey(v, c)
|
||||
else
|
||||
switch (p) {
|
||||
case 'b':
|
||||
bind = 1;
|
||||
bindk = 1;
|
||||
break;
|
||||
case 'k':
|
||||
key = 1;
|
||||
@ -112,7 +112,7 @@ dobindkey(v, c)
|
||||
ntype = XK_EXE;
|
||||
break;
|
||||
case 'r':
|
||||
remove = 1;
|
||||
removeb = 1;
|
||||
break;
|
||||
case 'v':
|
||||
ed_InitVIMaps();
|
||||
@ -148,7 +148,7 @@ dobindkey(v, c)
|
||||
in.len = Strlen(in.buf);
|
||||
}
|
||||
else {
|
||||
if (bind) {
|
||||
if (bindk) {
|
||||
if (parsebind(v[no++], &in) == NULL)
|
||||
return;
|
||||
}
|
||||
@ -158,9 +158,15 @@ dobindkey(v, c)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef WINNT_NATIVE
|
||||
if (in.buf[0] > 0xFF) {
|
||||
bad_spec(in.buf);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
ch = (uChar) in.buf[0];
|
||||
|
||||
if (remove) {
|
||||
if (removeb) {
|
||||
if (key) {
|
||||
(void) ClearArrowKeys(&in);
|
||||
return;
|
||||
@ -195,7 +201,7 @@ dobindkey(v, c)
|
||||
return;
|
||||
if (key) {
|
||||
if (SetArrowKeys(&in, XmapStr(&out), ntype) == -1)
|
||||
xprintf(CGETS(20, 2, "Bad key name: %S\n"), in);
|
||||
xprintf(CGETS(20, 2, "Bad key name: %S\n"), in.buf);
|
||||
}
|
||||
else
|
||||
AddXkey(&in, XmapStr(&out), ntype);
|
||||
@ -231,7 +237,7 @@ printkey(map, in)
|
||||
CStr *in;
|
||||
{
|
||||
unsigned char outbuf[100];
|
||||
register struct KeyFuncs *fp;
|
||||
struct KeyFuncs *fp;
|
||||
|
||||
if (in->len < 2) {
|
||||
(void) unparsestring(in, outbuf, STRQQ);
|
||||
@ -249,7 +255,7 @@ static KEYCMD
|
||||
parsecmd(str)
|
||||
Char *str;
|
||||
{
|
||||
register struct KeyFuncs *fp;
|
||||
struct KeyFuncs *fp;
|
||||
|
||||
for (fp = FuncNames; fp->name; fp++) {
|
||||
if (strcmp(short2str(str), fp->name) == 0) {
|
||||
@ -273,9 +279,6 @@ parsebind(s, str)
|
||||
Char *s;
|
||||
CStr *str;
|
||||
{
|
||||
#ifdef DSPMBYTE
|
||||
extern bool NoNLSRebind;
|
||||
#endif /* DSPMBYTE */
|
||||
Char *b = str->buf;
|
||||
|
||||
if (Iscntrl(*s)) {
|
||||
@ -336,20 +339,16 @@ parsebind(s, str)
|
||||
break;
|
||||
|
||||
case 'M' : case 'm': /* Turn into 0x80|c */
|
||||
#ifdef DSPMBYTE
|
||||
if (!NoNLSRebind) {
|
||||
*b++ = CTL_ESC('\033');
|
||||
*b++ = *s;
|
||||
} else {
|
||||
#endif /* DSPMBYTE */
|
||||
#ifdef IS_ASCII
|
||||
*b++ = *s | 0x80;
|
||||
#else
|
||||
*b++ = _toebcdic[_toascii[*s] | 0x80];
|
||||
#endif
|
||||
#ifdef DSPMBYTE
|
||||
}
|
||||
#endif /* DSPMBYTE */
|
||||
*b = '\0';
|
||||
break;
|
||||
#ifdef WINNT_NATIVE
|
||||
@ -390,7 +389,7 @@ parsestring(str, buf)
|
||||
{
|
||||
Char *b;
|
||||
const Char *p;
|
||||
int es;
|
||||
eChar es;
|
||||
|
||||
b = buf->buf;
|
||||
if (*str == 0) {
|
||||
@ -400,7 +399,7 @@ parsestring(str, buf)
|
||||
|
||||
for (p = str; *p != 0; p++) {
|
||||
if ((*p & CHAR) == '\\' || (*p & CHAR) == '^') {
|
||||
if ((es = parseescape(&p)) == -1)
|
||||
if ((es = parseescape(&p)) == CHAR_ERR)
|
||||
return 0;
|
||||
else
|
||||
*b++ = (Char) es;
|
||||
@ -452,7 +451,7 @@ printkeys(map, first, last)
|
||||
KEYCMD *map;
|
||||
int first, last;
|
||||
{
|
||||
register struct KeyFuncs *fp;
|
||||
struct KeyFuncs *fp;
|
||||
Char firstbuf[2], lastbuf[2];
|
||||
CStr fb, lb;
|
||||
unsigned char unparsbuf[10], extrabuf[10];
|
||||
@ -538,7 +537,7 @@ bindkey_usage()
|
||||
static void
|
||||
list_functions()
|
||||
{
|
||||
register struct KeyFuncs *fp;
|
||||
struct KeyFuncs *fp;
|
||||
|
||||
for (fp = FuncNames; fp->name; fp++) {
|
||||
xprintf("%s\n %s\n", fp->name, fp->desc);
|
||||
@ -583,9 +582,9 @@ tocontrol(c)
|
||||
|
||||
static char *
|
||||
unparsekey(c) /* 'c' -> "c", '^C' -> "^" + "C" */
|
||||
register int c;
|
||||
int c;
|
||||
{
|
||||
register char *cp;
|
||||
char *cp;
|
||||
static char tmp[10];
|
||||
|
||||
cp = tmp;
|
||||
@ -662,9 +661,9 @@ static KEYCMD
|
||||
getkeycmd(sp)
|
||||
Char **sp;
|
||||
{
|
||||
register Char *s = *sp;
|
||||
register char c;
|
||||
register KEYCMD keycmd = F_UNASSIGNED;
|
||||
Char *s = *sp;
|
||||
char c;
|
||||
KEYCMD keycmd = F_UNASSIGNED;
|
||||
KEYCMD *map;
|
||||
int meta = 0;
|
||||
Char *ret_sp = s;
|
||||
@ -709,7 +708,7 @@ parsekey(sp)
|
||||
Char **sp; /* Return position of first unparsed character
|
||||
* for return value -2 (xkeynext) */
|
||||
{
|
||||
register int c, meta = 0, control = 0, ctrlx = 0;
|
||||
int c, meta = 0, control = 0, ctrlx = 0;
|
||||
Char *s = *sp;
|
||||
KEYCMD keycmd;
|
||||
|
||||
@ -858,12 +857,12 @@ parsekey(sp)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dobind(v, dummy)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *dummy;
|
||||
{
|
||||
register int c;
|
||||
register struct KeyFuncs *fp;
|
||||
register int i, prev;
|
||||
int c;
|
||||
struct KeyFuncs *fp;
|
||||
int i, prev;
|
||||
Char *p, *l;
|
||||
CStr cstr;
|
||||
Char buf[1000];
|
||||
@ -1025,10 +1024,10 @@ dobind(v, dummy)
|
||||
|
||||
static void
|
||||
pkeys(first, last)
|
||||
register int first, last;
|
||||
int first, last;
|
||||
{
|
||||
register struct KeyFuncs *fp;
|
||||
register KEYCMD *map;
|
||||
struct KeyFuncs *fp;
|
||||
KEYCMD *map;
|
||||
int mask;
|
||||
char buf[8];
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.const.c,v 3.74 2004/03/21 16:48:15 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.const.c,v 3.81 2004/12/25 21:15:08 christos Exp $ */
|
||||
/*
|
||||
* sh.const.c: String constants for tcsh.
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tc.const.c,v 3.74 2004/03/21 16:48:15 christos Exp $")
|
||||
RCSID("$Id: tc.const.c,v 3.81 2004/12/25 21:15:08 christos Exp $")
|
||||
|
||||
Char STRlogout[] = { 'l', 'o', 'g', 'o', 'u', 't', '\0' };
|
||||
Char STRautologout[] = { 'a', 'u', 't', 'o', 'l', 'o', 'g', 'o', 'u', 't',
|
||||
@ -84,6 +84,8 @@ Char STROSTYPE[] = { 'O', 'S', 'T', 'Y', 'P', 'E', '\0' };
|
||||
Char STRedit[] = { 'e', 'd', 'i', 't', '\0' };
|
||||
Char STRaddsuffix[] = { 'a', 'd', 'd', 's', 'u', 'f', 'f', 'i', 'x',
|
||||
'\0' };
|
||||
Char STRcsubstnonl[] = { 'c', 's', 'u', 'b', 's', 't', 'n', 'o', 'n', 'l',
|
||||
'\0' };
|
||||
Char STRnostat[] = { 'n', 'o', 's', 't', 'a', 't', '\0' };
|
||||
Char STRshell[] = { 's', 'h', 'e', 'l', 'l', '\0' };
|
||||
Char STRtmpsh[] = { '/', 't', 'm', 'p', '/', 's', 'h', '\0' };
|
||||
@ -124,11 +126,12 @@ Char STRmmliteral[] = { '-', 'G', '\0' };
|
||||
# else
|
||||
Char STRmmliteral[] = { '-', '-', 'l', 'i', 't', 'e', 'r', 'a', 'l', '\0' };
|
||||
# endif
|
||||
Char STRKEUC[] = { 'e', 'u', 'c', '\0' };
|
||||
Char STRKSJIS[] = { 's', 'j', 'i', 's', '\0' };
|
||||
Char STRKBIG5[] = { 'b', 'i', 'g', '5', '\0' };
|
||||
Char STRKUTF8[] = { 'u', 't', 'f', '8', '\0' };
|
||||
Char STRSTARKUTF8[] = { '*', 'u', 't', 'f', '8', '\0' };
|
||||
Char STReuc[] = { 'e', 'u', 'c', '\0' };
|
||||
Char STRsjis[] = { 's', 'j', 'i', 's', '\0' };
|
||||
Char STRbig5[] = { 'b', 'i', 'g', '5', '\0' };
|
||||
Char STRutf8[] = { 'u', 't', 'f', '8', '\0' };
|
||||
Char STRstarutfstar8[] = { '*', 'u', 't', 'f', '*', '8', '\0' };
|
||||
Char STRGB2312[] = { 'g', 'b', '2', '3', '1', '2', '\0' };
|
||||
# ifdef MBYTEDEBUG /* Sorry, use for beta testing */
|
||||
Char STRmbytemap[] = { 'm', 'b', 'y', 't', 'e', 'm', 'a', 'p', '\0' };
|
||||
# endif /* MBYTEMAP */
|
||||
@ -158,7 +161,7 @@ Char STRLANGBIG5[] = { 'z', 'h', '_', 'T', 'W', '.', 'B', 'i', 'g', '5',
|
||||
'\0' };
|
||||
Char STRLANGEUCZH[] = { '\0' };
|
||||
Char STRLANGEUCZHB[] = { '\0' };
|
||||
# elif defined(linux)
|
||||
# elif defined(linux) || defined(__GNU__) || defined(__GLIBC__)
|
||||
Char STRLANGEUCJP[] = { 'j', 'a', '_', 'J', 'P', '.', 'E', 'U', 'C', '-',
|
||||
'J', 'P', '\0' };
|
||||
Char STRLANGEUCKR[] = { 'k', 'o', '_', 'K', 'R', '.', 'E', 'U', 'C', '\0' };
|
||||
@ -409,7 +412,6 @@ Char STRnohup[] = { 'n', 'o', 'h', 'u', 'p', '\0' };
|
||||
Char STRhup[] = { 'h', 'u', 'p', '\0' };
|
||||
Char STRnice[] = { 'n', 'i', 'c', 'e', '\0' };
|
||||
Char STRthen[] = { 't', 'h', 'e', 'n', '\0' };
|
||||
Char STReof[] = { '^', 'D', '\b', '\b', '\0' };
|
||||
Char STRlistjobs[] = { 'l', 'i', 's', 't', 'j', 'o', 'b', 's', '\0' };
|
||||
Char STRlistflags[] = { 'l', 'i', 's', 't', 'f', 'l', 'a', 'g', 's', '\0' };
|
||||
Char STRlong[] = { 'l', 'o', 'n', 'g', '\0' };
|
||||
@ -461,6 +463,7 @@ Char STRver[] = { 'v', 'e', 'r', '\0' };
|
||||
Char STRwarnebcdic[] = { 'w', 'a', 'r', 'n', 'e', 'b', 'c', 'd', 'i', 'c', '\0' };
|
||||
#endif
|
||||
|
||||
Char STRmCF[] = { '-', 'C', 'F', '\0', '\0' };
|
||||
#ifdef COLOR_LS_F
|
||||
Char STRlsmF[] = { 'l', 's', '-', 'F', '\0' };
|
||||
Char STRcolor[] = { 'c', 'o', 'l', 'o', 'r', '\0' };
|
||||
@ -487,3 +490,5 @@ Char STRcolorcat[] = { 'c', 'o', 'l', 'o', 'r', 'c', 'a', 't', '\0' };
|
||||
Char STRshwspace[] = { ' ', '\t', '\0' };
|
||||
Char STRshwordsep[] = { ' ', '\t', '&', '|', ';', '<', '>', '(', ')', '\0' };
|
||||
Char STRrepeat[] = { 'r', 'e', 'p', 'e', 'a', 't', '\0' };
|
||||
|
||||
Char STReof[] = { '^', 'D', '\b', '\b', '\0' };
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.decls.h,v 3.52 2004/02/21 20:34:25 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.decls.h,v 3.57 2005/01/18 20:24:51 christos Exp $ */
|
||||
/*
|
||||
* tc.decls.h: Function declarations from all the tcsh modules
|
||||
*/
|
||||
@ -79,6 +79,7 @@ extern Char *expand_lex __P((Char *, size_t, struct wordent *,
|
||||
extern Char *sprlex __P((Char *, size_t, struct wordent *));
|
||||
extern Char *Itoa __P((int, Char *, int, int));
|
||||
extern void dolist __P((Char **, struct command *));
|
||||
extern void dotermname __P((Char **, struct command *));
|
||||
extern void dotelltc __P((Char **, struct command *));
|
||||
extern void doechotc __P((Char **, struct command *));
|
||||
extern void dosettc __P((Char **, struct command *));
|
||||
@ -86,7 +87,7 @@ extern int cmd_expand __P((Char *, Char *));
|
||||
extern void dowhich __P((Char **, struct command *));
|
||||
extern struct process *find_stop_ed __P((void));
|
||||
extern void fg_proc_entry __P((struct process *));
|
||||
extern sigret_t alrmcatch __P((int));
|
||||
extern RETSIGTYPE alrmcatch __P((int));
|
||||
extern void precmd __P((void));
|
||||
extern void postcmd __P((void));
|
||||
extern void cwd_cmd __P((void));
|
||||
@ -174,40 +175,40 @@ extern void fix_strcoll_bug __P((void));
|
||||
|
||||
extern void osinit __P((void));
|
||||
|
||||
#ifdef NEEDmemmove
|
||||
#ifndef HAVE_MEMMOVE
|
||||
extern ptr_t xmemmove __P((ptr_t, const ptr_t, size_t));
|
||||
# define memmove(a, b, c) xmemmove((a), (b), (c))
|
||||
#endif /* NEEDmemmove */
|
||||
# define memmove(a, b, c) xmemmove(a, b, c)
|
||||
#endif /* !HAVE_MEMMOVE */
|
||||
|
||||
#ifdef NEEDmemset
|
||||
#ifndef HAVE_MEMSET
|
||||
extern ptr_t xmemset __P((ptr_t, int, size_t));
|
||||
# define memset(a, b, c) xmemset((a), (b), (c))
|
||||
#endif /* NEEDmemset */
|
||||
# define memset(a, b, c) xmemset(a, b, c)
|
||||
#endif /* !HAVE_MEMSET */
|
||||
|
||||
|
||||
#ifdef NEEDgetcwd
|
||||
#ifndef HAVE_GETCWD
|
||||
extern char *xgetcwd __P((char *, size_t));
|
||||
# undef getcwd
|
||||
# define getcwd(a, b) xgetcwd((a), (b))
|
||||
#endif /* NEEDgetcwd */
|
||||
# define getcwd(a, b) xgetcwd(a, b)
|
||||
#endif /* !HAVE_GETCWD */
|
||||
|
||||
#ifdef NEEDgethostname
|
||||
#ifndef HAVE_GETHOSTNAME
|
||||
extern int xgethostname __P((char *, int));
|
||||
# undef gethostname
|
||||
# define gethostname(a, b) xgethostname((a), (b))
|
||||
#endif /* NEEDgethostname */
|
||||
# define gethostname(a, b) xgethostname(a, b)
|
||||
#endif /* !HAVE_GETHOSTNAME */
|
||||
|
||||
#ifdef NEEDnice
|
||||
#ifndef HAVE_NICE
|
||||
extern int xnice __P((int));
|
||||
# undef nice
|
||||
# define nice(a) xnice(a)
|
||||
#endif /* NEEDnice */
|
||||
#endif /* !HAVE_NICE */
|
||||
|
||||
#ifdef NEEDstrerror
|
||||
#ifndef HAVE_STRERROR
|
||||
extern char *xstrerror __P((int));
|
||||
# undef strerror
|
||||
# define strerror(a) xstrerror(a)
|
||||
#endif /* NEEDstrerror */
|
||||
#endif /* !HAVE_STRERROR */
|
||||
|
||||
#ifdef apollo
|
||||
extern void doinlib __P((Char **, struct command *));
|
||||
@ -230,11 +231,11 @@ extern pret_t xvsnprintf __P((char *, size_t, const char *,
|
||||
* tc.prompt.c
|
||||
*/
|
||||
extern void dateinit __P((void));
|
||||
extern void printprompt __P((int, char *));
|
||||
extern void printprompt __P((int, const char *));
|
||||
extern Char *expdollar __P((Char **, const Char **, size_t *,
|
||||
int));
|
||||
extern void tprintf __P((int, Char *, const Char *, size_t,
|
||||
char *, time_t, ptr_t));
|
||||
const char *, time_t, ptr_t));
|
||||
|
||||
/*
|
||||
* tc.sched.c
|
||||
@ -249,10 +250,10 @@ extern void sched_run __P((int));
|
||||
#ifndef BSDSIGS
|
||||
# ifdef UNRELSIGS
|
||||
# ifdef COHERENT
|
||||
extern sigret_t (*xsignal __P((int, sigret_t (*)(int)))) ();
|
||||
extern RETSIGTYPE (*xsignal __P((int, RETSIGTYPE (*)(int)))) ();
|
||||
# define signal(x,y) xsignal(x,y)
|
||||
# endif /* COHERENT */
|
||||
extern sigret_t (*xsigset __P((int, sigret_t (*)(int)))) ();
|
||||
extern RETSIGTYPE (*xsigset __P((int, RETSIGTYPE (*)(int)))) ();
|
||||
# define sigset(x,y) xsigset(x,y)
|
||||
extern void xsigrelse __P((int));
|
||||
# define sigrelse(x) xsigrelse(x)
|
||||
@ -270,7 +271,7 @@ extern void sigpause __P((int));
|
||||
#endif /* !BSDSIGS */
|
||||
|
||||
#ifdef NEEDsignal
|
||||
extern sigret_t (*xsignal __P((int, sigret_t (*)(int)))) ();
|
||||
extern RETSIGTYPE (*xsignal __P((int, RETSIGTYPE (*)(int)))) ();
|
||||
# define signal(a, b) xsignal(a, b)
|
||||
#endif /* NEEDsignal */
|
||||
#if defined(_SEQUENT_) || ((SYSVREL > 3 || defined(_DGUX_SOURCE)) && defined(POSIXSIGS)) || ((defined(_AIX) || defined(__CYGWIN__)) && defined(POSIXSIGS)) || defined(WINNT_NATIVE)
|
||||
@ -279,17 +280,26 @@ extern sigmask_t sigsetmask __P((sigmask_t));
|
||||
extern sigmask_t sigblock __P((sigmask_t));
|
||||
# endif /* !DGUX */
|
||||
extern void bsd_sigpause __P((sigmask_t));
|
||||
extern sigret_t (*bsd_signal __P((int, sigret_t (*)(int)))) __P((int));
|
||||
extern RETSIGTYPE (*bsd_signal __P((int, RETSIGTYPE (*)(int)))) __P((int));
|
||||
#endif /* _SEQUENT_ */
|
||||
#ifdef SIGSYNCH
|
||||
extern sigret_t synch_handler __P((int));
|
||||
extern RETSIGTYPE synch_handler __P((int));
|
||||
#endif /* SIGSYNCH */
|
||||
|
||||
|
||||
/*
|
||||
* tc.str.c:
|
||||
*/
|
||||
#ifdef WIDE_STRINGS
|
||||
extern size_t one_mbtowc __P((wchar_t *, const char *, size_t));
|
||||
extern size_t one_wctomb __P((char *, wchar_t));
|
||||
#else
|
||||
#define one_mbtowc(PWC, S, N) \
|
||||
((void)(N), *(PWC) = (unsigned char)*(S), (size_t)1)
|
||||
#define one_wctomb(S, WCHAR) (*(S) = (WCHAR), (size_t)1)
|
||||
#endif
|
||||
#ifdef SHORT_STRINGS
|
||||
extern int rt_mbtowc __P((wchar_t *, const char *, size_t));
|
||||
extern Char *s_strchr __P((const Char *, int));
|
||||
extern Char *s_strrchr __P((const Char *, int));
|
||||
extern Char *s_strcat __P((Char *, const Char *));
|
||||
@ -323,16 +333,18 @@ extern void fix_version __P((void));
|
||||
/*
|
||||
* tc.who.c
|
||||
*/
|
||||
#ifndef HAVENOUTMP
|
||||
#if defined (HAVE_UTMP_H) || defined (HAVE_UTMPX_H) || defined (WINNT_NATIVE)
|
||||
extern void initwatch __P((void));
|
||||
extern void resetwatch __P((void));
|
||||
extern void watch_login __P((int));
|
||||
extern const char *who_info __P((ptr_t, int, char *, size_t));
|
||||
extern void dolog __P((Char **, struct command *));
|
||||
# ifdef UTHOST
|
||||
# ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
extern char *utmphost __P((void));
|
||||
extern size_t utmphostsize __P((void));
|
||||
# endif /* UTHOST */
|
||||
#endif /* HAVENOUTMP */
|
||||
# endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
||||
#else
|
||||
# define HAVENOUTMP
|
||||
#endif
|
||||
|
||||
#endif /* _h_tc_decls */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.disc.c,v 3.13 2002/07/06 22:28:13 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.disc.c,v 3.15 2004/11/23 02:10:49 christos Exp $ */
|
||||
/*
|
||||
* tc.disc.c: Functions to set/clear line disciplines
|
||||
*
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tc.disc.c,v 3.13 2002/07/06 22:28:13 christos Exp $")
|
||||
RCSID("$Id: tc.disc.c,v 3.15 2004/11/23 02:10:49 christos Exp $")
|
||||
|
||||
#ifdef OREO
|
||||
#include <compat.h>
|
||||
@ -41,7 +41,7 @@ RCSID("$Id: tc.disc.c,v 3.13 2002/07/06 22:28:13 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
|
||||
static bool add_discipline = 0; /* Did we add a line discipline */
|
||||
static int add_discipline = 0; /* Did we add a line discipline */
|
||||
|
||||
#if defined(IRIS4D) || defined(OREO) || defined(sonyrisc)
|
||||
# define HAVE_DISC
|
||||
@ -165,6 +165,7 @@ int f;
|
||||
else
|
||||
return (-1);
|
||||
# else
|
||||
USE(f);
|
||||
return (0);
|
||||
# endif /* TIOCGETD && NTTYDISC */
|
||||
#endif /* !HAVE_DISC */
|
||||
@ -192,5 +193,6 @@ int f;
|
||||
# endif /* TIOCSETD && NTTYDISC */
|
||||
#endif /* !HAVE_DISC */
|
||||
}
|
||||
USE(f);
|
||||
return (0);
|
||||
} /* end resetdisc */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.func.c,v 3.107 2003/05/16 18:10:29 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.func.c,v 3.119 2005/03/06 03:57:10 christos Exp $ */
|
||||
/*
|
||||
* tc.func.c: New tcsh builtins.
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tc.func.c,v 3.107 2003/05/16 18:10:29 christos Exp $")
|
||||
RCSID("$Id: tc.func.c,v 3.119 2005/03/06 03:57:10 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
#include "ed.defns.h" /* for the function names */
|
||||
@ -58,19 +58,19 @@ extern int do_logout;
|
||||
#endif /* TESLA */
|
||||
extern time_t t_period;
|
||||
extern int just_signaled;
|
||||
static bool precmd_active = 0;
|
||||
static bool jobcmd_active = 0; /* GrP */
|
||||
static bool postcmd_active = 0;
|
||||
static bool periodic_active = 0;
|
||||
static bool cwdcmd_active = 0; /* PWP: for cwd_cmd */
|
||||
static bool beepcmd_active = 0;
|
||||
static int precmd_active = 0;
|
||||
static int jobcmd_active = 0; /* GrP */
|
||||
static int postcmd_active = 0;
|
||||
static int periodic_active = 0;
|
||||
static int cwdcmd_active = 0; /* PWP: for cwd_cmd */
|
||||
static int beepcmd_active = 0;
|
||||
static signalfun_t alm_fun = NULL;
|
||||
|
||||
static void auto_logout __P((int));
|
||||
static char *xgetpass __P((char *));
|
||||
static char *xgetpass __P((const char *));
|
||||
static void auto_lock __P((int));
|
||||
#ifdef BSDJOBS
|
||||
static void insert __P((struct wordent *, bool));
|
||||
static void insert __P((struct wordent *, int));
|
||||
static void insert_we __P((struct wordent *, struct wordent *));
|
||||
static int inlist __P((Char *, Char *));
|
||||
#endif /* BSDJOBS */
|
||||
@ -78,7 +78,7 @@ struct tildecache;
|
||||
static int tildecompare __P((struct tildecache *, struct tildecache *));
|
||||
static Char *gethomedir __P((Char *));
|
||||
#ifdef REMOTEHOST
|
||||
static sigret_t palarm __P((int));
|
||||
static RETSIGTYPE palarm __P((int));
|
||||
static void getremotehost __P((void));
|
||||
#endif /* REMOTEHOST */
|
||||
|
||||
@ -109,10 +109,10 @@ expand_lex(buf, bufsiz, sp0, from, to)
|
||||
struct wordent *sp0;
|
||||
int from, to;
|
||||
{
|
||||
register struct wordent *sp;
|
||||
register Char *s, *d, *e;
|
||||
register Char prev_c;
|
||||
register int i;
|
||||
struct wordent *sp;
|
||||
Char *s, *d, *e;
|
||||
Char prev_c;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Make sure we have enough space to expand into. E.g. we may have
|
||||
@ -137,6 +137,19 @@ expand_lex(buf, bufsiz, sp0, from, to)
|
||||
for (i = 0; i < NCARGS; i++) {
|
||||
if ((i >= from) && (i <= to)) { /* if in range */
|
||||
for (s = sp->word; *s && d < e; s++) {
|
||||
|
||||
if (s[1] & QUOTE) {
|
||||
int l = NLSSize(s, -1);
|
||||
if (l > 1) {
|
||||
while (l-- > 0) {
|
||||
if (d < e)
|
||||
*d++ = (*s & TRIM);
|
||||
prev_c = *s++;
|
||||
}
|
||||
s--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* bugfix by Michael Bloom: anything but the current history
|
||||
* character {(PWP) and backslash} seem to be dealt with
|
||||
@ -201,7 +214,7 @@ Itoa(n, s, min_digits, attributes)
|
||||
unsigned int un; /* handle most negative # too */
|
||||
int pad = (min_digits != 0);
|
||||
|
||||
if (sizeof(buf) - 1 < min_digits)
|
||||
if ((int)(sizeof(buf) - 1) < min_digits)
|
||||
min_digits = sizeof(buf) - 1;
|
||||
|
||||
un = n;
|
||||
@ -227,17 +240,11 @@ Itoa(n, s, min_digits, attributes)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dolist(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
int i, k;
|
||||
struct stat st;
|
||||
#if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
|
||||
extern bool dspmbyte_ls;
|
||||
#endif
|
||||
#ifdef COLOR_LS_F
|
||||
extern bool color_context_ls;
|
||||
#endif /* COLOR_LS_F */
|
||||
|
||||
USE(c);
|
||||
if (*++v == NULL) {
|
||||
@ -260,8 +267,6 @@ dolist(v, c)
|
||||
/*
|
||||
* We cannot process a flag therefore we let ls do it right.
|
||||
*/
|
||||
static Char STRls[] = {'l', 's', '\0'};
|
||||
static Char STRmCF[] = {'-', 'C', 'F', '\0', '\0' };
|
||||
Char *lspath;
|
||||
struct command *t;
|
||||
struct wordent cmd, *nextword, *lastword;
|
||||
@ -423,35 +428,28 @@ dolist(v, c)
|
||||
}
|
||||
}
|
||||
|
||||
static char *defaulttell = "ALL";
|
||||
extern bool GotTermCaps;
|
||||
extern int GotTermCaps;
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dotelltc(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
USE(v);
|
||||
USE(c);
|
||||
if (!GotTermCaps)
|
||||
GetTermCaps();
|
||||
|
||||
/*
|
||||
* Avoid a compiler bug on hpux 9.05
|
||||
* Writing the following as func(a ? b : c) breaks
|
||||
*/
|
||||
if (v[1])
|
||||
TellTC(short2str(v[1]));
|
||||
else
|
||||
TellTC(defaulttell);
|
||||
TellTC();
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
doechotc(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
USE(c);
|
||||
if (!GotTermCaps)
|
||||
GetTermCaps();
|
||||
EchoTC(++v);
|
||||
@ -465,6 +463,7 @@ dosettc(v, c)
|
||||
{
|
||||
char tv[2][BUFSIZE];
|
||||
|
||||
USE(c);
|
||||
if (!GotTermCaps)
|
||||
GetTermCaps();
|
||||
|
||||
@ -521,7 +520,7 @@ cmd_expand(cmd, str)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dowhich(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
int rv = TRUE;
|
||||
@ -564,8 +563,9 @@ dowhich(v, c)
|
||||
struct process *
|
||||
find_stop_ed()
|
||||
{
|
||||
register struct process *pp, *retp;
|
||||
register char *ep, *vp, *cp, *p;
|
||||
struct process *pp, *retp;
|
||||
const char *ep, *vp;
|
||||
char *cp, *p;
|
||||
int epl, vpl, pstatus;
|
||||
|
||||
if ((ep = getenv("EDITOR")) != NULL) { /* if we have a value */
|
||||
@ -582,9 +582,9 @@ find_stop_ed()
|
||||
else
|
||||
vp = "vi";
|
||||
|
||||
for (vpl = 0; vp[vpl] && !Isspace(vp[vpl]); vpl++)
|
||||
for (vpl = 0; vp[vpl] && !isspace((unsigned char)vp[vpl]); vpl++)
|
||||
continue;
|
||||
for (epl = 0; ep[epl] && !Isspace(ep[epl]); epl++)
|
||||
for (epl = 0; ep[epl] && !isspace((unsigned char)ep[epl]); epl++)
|
||||
continue;
|
||||
|
||||
if (pcurrent == NULL) /* see if we have any jobs */
|
||||
@ -636,13 +636,13 @@ find_stop_ed()
|
||||
|
||||
void
|
||||
fg_proc_entry(pp)
|
||||
register struct process *pp;
|
||||
struct process *pp;
|
||||
{
|
||||
#ifdef BSDSIGS
|
||||
sigmask_t omask;
|
||||
#endif
|
||||
jmp_buf_t osetexit;
|
||||
bool ohaderr;
|
||||
int ohaderr;
|
||||
Char oGettingInput;
|
||||
|
||||
getexit(osetexit);
|
||||
@ -681,7 +681,7 @@ fg_proc_entry(pp)
|
||||
|
||||
static char *
|
||||
xgetpass(prm)
|
||||
char *prm;
|
||||
const char *prm;
|
||||
{
|
||||
static char pass[PASSMAX + 1];
|
||||
int fd, i;
|
||||
@ -709,6 +709,15 @@ xgetpass(prm)
|
||||
return(pass);
|
||||
}
|
||||
|
||||
#ifndef NO_CRYPT
|
||||
#ifndef __STDC__
|
||||
extern char *crypt __P(());
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#include <crypt.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Ask the user for his login password to continue working
|
||||
* On systems that have a shadow password, this will only
|
||||
@ -727,15 +736,10 @@ auto_lock(n)
|
||||
int i;
|
||||
char *srpp = NULL;
|
||||
struct passwd *pw;
|
||||
#ifdef POSIX
|
||||
extern char *crypt __P((const char *, const char *));
|
||||
#else
|
||||
extern char *crypt __P(());
|
||||
#endif
|
||||
|
||||
#undef XCRYPT
|
||||
|
||||
#if defined(PW_AUTH) && !defined(XCRYPT)
|
||||
#if defined(HAVE_AUTH_H)
|
||||
|
||||
struct authorization *apw;
|
||||
extern char *crypt16 __P((const char *, const char *));
|
||||
@ -746,9 +750,7 @@ auto_lock(n)
|
||||
(apw = getauthuid(euid)) != NULL) /* enhanced ultrix passwd */
|
||||
srpp = apw->a_password;
|
||||
|
||||
#endif /* PW_AUTH && !XCRYPT */
|
||||
|
||||
#if defined(PW_SHADOW) && !defined(XCRYPT)
|
||||
#elif defined(HAVE_SHADOW_H)
|
||||
|
||||
struct spwd *spw;
|
||||
|
||||
@ -758,9 +760,7 @@ auto_lock(n)
|
||||
(spw = getspnam(pw->pw_name)) != NULL) /* shadowed passwd */
|
||||
srpp = spw->sp_pwdp;
|
||||
|
||||
#endif /* PW_SHADOW && !XCRYPT */
|
||||
|
||||
#ifndef XCRYPT
|
||||
#else
|
||||
|
||||
#define XCRYPT(a, b) crypt(a, b)
|
||||
|
||||
@ -769,7 +769,7 @@ auto_lock(n)
|
||||
srpp = pw->pw_passwd;
|
||||
#endif /* !MVS */
|
||||
|
||||
#endif /* !XCRYPT */
|
||||
#endif
|
||||
|
||||
if (srpp == NULL) {
|
||||
auto_logout(0);
|
||||
@ -850,11 +850,12 @@ auto_logout(n)
|
||||
goodbye(NULL, NULL);
|
||||
}
|
||||
|
||||
sigret_t
|
||||
RETSIGTYPE
|
||||
/*ARGSUSED*/
|
||||
alrmcatch(snum)
|
||||
int snum;
|
||||
{
|
||||
USE(snum);
|
||||
#ifdef UNRELSIGS
|
||||
if (snum)
|
||||
(void) sigset(SIGALRM, alrmcatch);
|
||||
@ -863,9 +864,6 @@ int snum;
|
||||
(*alm_fun)(0);
|
||||
|
||||
setalarm(1);
|
||||
#ifndef SIGVOID
|
||||
return (snum);
|
||||
#endif /* !SIGVOID */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1004,7 +1002,7 @@ beep_cmd()
|
||||
void
|
||||
period_cmd()
|
||||
{
|
||||
register Char *vp;
|
||||
Char *vp;
|
||||
time_t t, interval;
|
||||
#ifdef BSDSIGS
|
||||
sigmask_t omask;
|
||||
@ -1189,6 +1187,17 @@ setalarm(lck)
|
||||
if ((vp = adrof(STRautologout)) != NULL && vp->vec != NULL) {
|
||||
if ((cp = vp->vec[0]) != 0) {
|
||||
if ((logout_time = (unsigned) atoi(short2str(cp)) * 60) > 0) {
|
||||
#ifdef SOLARIS2
|
||||
/*
|
||||
* Solaris alarm(2) uses a timer based in clock ticks
|
||||
* internally so it multiplies our value with CLK_TCK...
|
||||
* Of course that can overflow leading to unexpected
|
||||
* results, so we clip it here. Grr. Where is that
|
||||
* documented folks?
|
||||
*/
|
||||
if (logout_time >= 0x7fffffff / CLK_TCK)
|
||||
logout_time = 0x7fffffff / CLK_TCK;
|
||||
#endif /* SOLARIS2 */
|
||||
alrm_time = logout_time;
|
||||
alm_fun = auto_logout;
|
||||
}
|
||||
@ -1225,7 +1234,7 @@ rmstar(cp)
|
||||
struct wordent *cp;
|
||||
{
|
||||
struct wordent *we, *args;
|
||||
register struct wordent *tmp, *del;
|
||||
struct wordent *tmp, *del;
|
||||
|
||||
#ifdef RMDEBUG
|
||||
static Char STRrmdebug[] = {'r', 'm', 'd', 'e', 'b', 'u', 'g', '\0'};
|
||||
@ -1332,7 +1341,7 @@ continue_jobs(cp)
|
||||
struct wordent *cp;
|
||||
{
|
||||
struct wordent *we;
|
||||
register struct process *pp, *np;
|
||||
struct process *pp, *np;
|
||||
Char *cmd, *continue_list, *continue_args_list;
|
||||
|
||||
#ifdef CNDEBUG
|
||||
@ -1340,7 +1349,7 @@ continue_jobs(cp)
|
||||
static Char STRcndebug[] =
|
||||
{'c', 'n', 'd', 'e', 'b', 'u', 'g', '\0'};
|
||||
#endif /* CNDEBUG */
|
||||
bool in_cont_list, in_cont_arg_list;
|
||||
int in_cont_list, in_cont_arg_list;
|
||||
|
||||
|
||||
#ifdef CNDEBUG
|
||||
@ -1402,13 +1411,13 @@ continue_jobs(cp)
|
||||
static void
|
||||
insert(pl, file_args)
|
||||
struct wordent *pl;
|
||||
bool file_args;
|
||||
int file_args;
|
||||
{
|
||||
struct wordent *now, *last;
|
||||
Char *cmd, *bcmd, *cp1, *cp2;
|
||||
int cmd_len;
|
||||
Char *pause = STRunderpause;
|
||||
int p_len = (int) Strlen(pause);
|
||||
Char *upause = STRunderpause;
|
||||
int p_len = (int) Strlen(upause);
|
||||
|
||||
cmd_len = (int) Strlen(pl->word);
|
||||
cmd = (Char *) xcalloc(1, (size_t) ((cmd_len + 1) * sizeof(Char)));
|
||||
@ -1450,7 +1459,7 @@ insert(pl, file_args)
|
||||
while ((*cp1++ = *cp2++) != '\0')
|
||||
continue;
|
||||
cp1--;
|
||||
cp2 = pause;
|
||||
cp2 = upause;
|
||||
while ((*cp1++ = *cp2++) != '\0')
|
||||
continue;
|
||||
insert_we(now, last->prev);
|
||||
@ -1508,7 +1517,7 @@ static int
|
||||
inlist(list, name)
|
||||
Char *list, *name;
|
||||
{
|
||||
register Char *l, *n;
|
||||
Char *l, *n;
|
||||
|
||||
l = list;
|
||||
n = name;
|
||||
@ -1564,7 +1573,7 @@ static Char *
|
||||
gethomedir(us)
|
||||
Char *us;
|
||||
{
|
||||
register struct passwd *pp;
|
||||
struct passwd *pp;
|
||||
#ifdef HESIOD
|
||||
char **res, **res1, *cp;
|
||||
Char *rp;
|
||||
@ -1643,7 +1652,7 @@ gettilde(us)
|
||||
* Binary search
|
||||
*/
|
||||
for (bp1 = tcache, bp2 = tcache + tlength; bp1 < bp2;) {
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
bp = bp1 + ((bp2 - bp1) >> 1);
|
||||
if ((i = *us - *bp->user) == 0 && (i = Strcmp(us, bp->user)) == 0)
|
||||
@ -1737,7 +1746,7 @@ doaliases(v, c)
|
||||
int fd;
|
||||
Char buf[BUFSIZE], line[BUFSIZE];
|
||||
char tbuf[BUFSIZE + 1], *tmp;
|
||||
extern bool output_raw; /* PWP: in sh.print.c */
|
||||
extern int output_raw; /* PWP: in sh.print.c */
|
||||
|
||||
USE(c);
|
||||
v++;
|
||||
@ -2083,7 +2092,7 @@ hashbang(fd, vp)
|
||||
|
||||
#ifdef REMOTEHOST
|
||||
|
||||
static sigret_t
|
||||
static RETSIGTYPE
|
||||
palarm(snum)
|
||||
int snum;
|
||||
{
|
||||
@ -2094,10 +2103,6 @@ palarm(snum)
|
||||
#endif /* UNRELSIGS */
|
||||
(void) alarm(0);
|
||||
reset();
|
||||
|
||||
#ifndef SIGVOID
|
||||
return (snum);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -2112,9 +2117,9 @@ getremotehost()
|
||||
#else
|
||||
struct hostent* hp;
|
||||
struct sockaddr_in saddr;
|
||||
int len = sizeof(struct sockaddr_in);
|
||||
socklen_t len = sizeof(struct sockaddr_in);
|
||||
#endif
|
||||
#if defined(UTHOST) && !defined(HAVENOUTMP)
|
||||
#ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
char *sptr = NULL;
|
||||
#endif
|
||||
|
||||
@ -2141,7 +2146,7 @@ getremotehost()
|
||||
host = inet_ntoa(saddr.sin_addr);
|
||||
#endif
|
||||
}
|
||||
#if defined(UTHOST) && !defined(HAVENOUTMP)
|
||||
#ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
else {
|
||||
char *ptr;
|
||||
char *name = utmphost();
|
||||
@ -2176,11 +2181,7 @@ getremotehost()
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_PASSIVE | AI_CANONNAME;
|
||||
#if defined(UTHOST) && !defined(HAVENOUTMP)
|
||||
if (strlen(name) < utmphostsize())
|
||||
#else
|
||||
if (name != NULL)
|
||||
#endif
|
||||
{
|
||||
if (getaddrinfo(name, NULL, &hints, &res) != 0)
|
||||
res = NULL;
|
||||
@ -2230,7 +2231,7 @@ getremotehost()
|
||||
if (host)
|
||||
tsetenv(STRREMOTEHOST, str2short(host));
|
||||
|
||||
#if defined(UTHOST) && !defined(HAVENOUTMP)
|
||||
#ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
if (sptr)
|
||||
*sptr = ':';
|
||||
#endif
|
||||
@ -2266,3 +2267,49 @@ remotehost()
|
||||
|
||||
}
|
||||
#endif /* REMOTEHOST */
|
||||
|
||||
#ifndef WINNT_NATIVE
|
||||
/*
|
||||
* indicate if a terminal type is defined in terminfo/termcap
|
||||
* (by default the current term type). This allows ppl to look
|
||||
* for a working term type automatically in their login scripts
|
||||
* when using a terminal known as different things on different
|
||||
* platforms
|
||||
*/
|
||||
void
|
||||
dotermname(v, c)
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
char *termtype;
|
||||
/*
|
||||
* Maximum size of a termcap record. We make it twice as large.
|
||||
*/
|
||||
char termcap_buffer[2048];
|
||||
|
||||
USE(c);
|
||||
/* try to find which entry we should be looking for */
|
||||
termtype = (v[1] == NULL ? getenv("TERM") : short2str(v[1]));
|
||||
if (termtype == NULL) {
|
||||
/* no luck - the user didn't provide one and none is
|
||||
* specified in the environment
|
||||
*/
|
||||
set(STRstatus, Strsave(STR1), VAR_READWRITE);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* we use the termcap function - if we are using terminfo we
|
||||
* will end up with it's compatibility function
|
||||
* terminfo/termcap will be initialized with the new
|
||||
* type but we don't care because tcsh has cached all the things
|
||||
* it needs.
|
||||
*/
|
||||
if (tgetent(termcap_buffer, termtype) == 1) {
|
||||
xprintf("%s\n", termtype);
|
||||
set(STRstatus, Strsave(STR0), VAR_READWRITE);
|
||||
} else {
|
||||
set(STRstatus, Strsave(STR1), VAR_READWRITE);
|
||||
}
|
||||
}
|
||||
#endif /* WINNT_NATIVE */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.h,v 3.5 2002/03/08 17:36:47 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.h,v 3.6 2004/08/04 17:12:31 christos Exp $ */
|
||||
/*
|
||||
* tc.h: Tcsh includes
|
||||
*/
|
||||
@ -41,6 +41,8 @@
|
||||
#include "tc.sig.h"
|
||||
#include "tc.decls.h"
|
||||
|
||||
extern int tlength;
|
||||
|
||||
#define FMT_PROMPT 0
|
||||
#define FMT_WHO 1
|
||||
#define FMT_HISTORY 2
|
||||
|
304
contrib/tcsh/tc.nls.c
Normal file
304
contrib/tcsh/tc.nls.c
Normal file
@ -0,0 +1,304 @@
|
||||
/* $Header: /src/pub/tcsh/tc.nls.c,v 3.6 2005/02/15 21:09:02 christos Exp $ */
|
||||
/*
|
||||
* tc.nls.c: NLS 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. 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: tc.nls.c,v 3.6 2005/02/15 21:09:02 christos Exp $")
|
||||
|
||||
#ifdef SHORT_STRINGS
|
||||
int
|
||||
NLSWidth(c)
|
||||
NLSChar c;
|
||||
{
|
||||
# ifdef HAVE_WCWIDTH
|
||||
int l;
|
||||
if (c & NLS_ILLEGAL)
|
||||
return 1;
|
||||
l = wcwidth(c);
|
||||
return l >= 0 ? l : 0;
|
||||
# else
|
||||
return c != 0;
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (WIDE_STRINGS) || !defined (SHORT_STRINGS)
|
||||
Char *
|
||||
NLSChangeCase(Char *p, int mode)
|
||||
{
|
||||
Char c, *op = p, *n, c2 = 0;
|
||||
for (; (c = *p) != 0; p++) {
|
||||
if (mode == 0 && Islower(c)) {
|
||||
c2 = Toupper(c);
|
||||
break;
|
||||
} else if (mode && Isupper(c)) {
|
||||
c2 = Tolower(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!*p)
|
||||
return 0;
|
||||
n = Strsave(op);
|
||||
n[p - op] = c2;
|
||||
return n;
|
||||
}
|
||||
|
||||
int
|
||||
NLSExtend(Char *from, int max, int num)
|
||||
{
|
||||
(void)from;
|
||||
num = abs (num);
|
||||
if (num > max)
|
||||
num = max;
|
||||
return num;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIDE_STRINGS
|
||||
|
||||
int
|
||||
NLSStringWidth(Char *s)
|
||||
{
|
||||
int w = 0;
|
||||
while (*s)
|
||||
w += wcwidth(*s++);
|
||||
return w;
|
||||
}
|
||||
|
||||
#elif defined (SHORT_STRINGS)
|
||||
|
||||
int
|
||||
NLSFrom(const Char *p, size_t l, NLSChar *cp)
|
||||
{
|
||||
size_t i;
|
||||
int len;
|
||||
wchar_t c;
|
||||
char b[MB_LEN_MAX];
|
||||
|
||||
if (l == NLSZEROT) {
|
||||
for (i = 0; i < MB_CUR_MAX && *p; i++)
|
||||
b[i] = p[i] & CHAR;
|
||||
} else {
|
||||
for (i = 0; i < MB_CUR_MAX && i < l; i++)
|
||||
b[i] = p[i] & CHAR;
|
||||
}
|
||||
mbtowc(0, 0, 0);
|
||||
len = rt_mbtowc(&c, b, i);
|
||||
if (len <= 0) {
|
||||
if (cp)
|
||||
*cp = *p ? *p | NLS_ILLEGAL : 0;
|
||||
return 1;
|
||||
}
|
||||
if (cp)
|
||||
*cp = (int)c;
|
||||
return len;
|
||||
}
|
||||
|
||||
int
|
||||
NLSFinished(Char *p, size_t l, eChar extra)
|
||||
{
|
||||
size_t i, r;
|
||||
wchar_t c;
|
||||
char b[MB_LEN_MAX + 1], back[MB_LEN_MAX];
|
||||
mbstate_t state;
|
||||
for (i = 0; i < MB_CUR_MAX && i < l; i++)
|
||||
b[i] = p[i];
|
||||
if (extra != CHAR_ERR)
|
||||
b[i++] = extra;
|
||||
memset(&state, 0, sizeof(state));
|
||||
r = mbrtowc((wchar_t *)&c, b, i, (mbstate_t *)&state);
|
||||
if (r == (size_t)-2)
|
||||
return 0;
|
||||
if (r == (size_t)-1 || (size_t)wctomb(back, c) != r ||
|
||||
memcmp(b, back, r) != 0)
|
||||
return -1;
|
||||
return r == i ? 1 : 2;
|
||||
}
|
||||
|
||||
int
|
||||
NLSChars(Char *s)
|
||||
{
|
||||
int l;
|
||||
for (l = 0; *s; l++)
|
||||
s += NLSSize(s, -1);
|
||||
return l;
|
||||
}
|
||||
|
||||
int
|
||||
NLSStringWidth(Char *s)
|
||||
{
|
||||
int w = 0;
|
||||
NLSChar c;
|
||||
while (*s) {
|
||||
s += NLSFrom(s, NLSZEROT, &c);
|
||||
w += NLSWidth(c);
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
int
|
||||
NLSTo(Char *p, NLSChar c)
|
||||
{
|
||||
char b[MB_LEN_MAX];
|
||||
int i, j;
|
||||
|
||||
if (c & NLS_ILLEGAL) {
|
||||
if (p)
|
||||
*p = c;
|
||||
return 1;
|
||||
}
|
||||
i = wctomb(b, (wchar_t)c);
|
||||
if (i == -1)
|
||||
return 0;
|
||||
if (p)
|
||||
for (j = 0; j < i; j++)
|
||||
p[j] = b[j];
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
NLSExtend(Char *from, int max, int num)
|
||||
{
|
||||
int l, n, i;
|
||||
Char *p;
|
||||
|
||||
if (num == 0)
|
||||
return 0;
|
||||
if (num > 0) {
|
||||
n = 0;
|
||||
while (num > 0 && max > 0) {
|
||||
l = NLSSize(from, max);
|
||||
n += l;
|
||||
from += l;
|
||||
max -= l;
|
||||
num--;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
from -= max;
|
||||
p = from;
|
||||
i = max;
|
||||
n = 0;
|
||||
while (i > 0) {
|
||||
l = NLSSize(p, i);
|
||||
p += l;
|
||||
i -= l;
|
||||
n++;
|
||||
}
|
||||
if (n >= -num)
|
||||
n += num;
|
||||
else
|
||||
n = 0;
|
||||
i = max;
|
||||
while (n > 0) {
|
||||
l = NLSSize(from, max);
|
||||
from += l;
|
||||
max -= l;
|
||||
i -= l;
|
||||
n--;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void
|
||||
NLSQuote(Char *cp)
|
||||
{
|
||||
int l;
|
||||
while (*cp) {
|
||||
l = NLSSize(cp, -1);
|
||||
cp++;
|
||||
while (l-- > 1)
|
||||
*cp++ |= QUOTE;
|
||||
}
|
||||
}
|
||||
|
||||
Char *
|
||||
NLSChangeCase(Char *p, int mode)
|
||||
{
|
||||
Char *n, *op = p;
|
||||
NLSChar c, c2 = 0;
|
||||
int l, l2;
|
||||
|
||||
while (*p) {
|
||||
l = NLSFrom(p, NLSZEROT, &c);
|
||||
if (mode == 0 && iswlower((wint_t)c)) {
|
||||
c2 = (int)towupper((wint_t)c);
|
||||
break;
|
||||
} else if (mode && iswupper((wint_t)c)) {
|
||||
c2 = (int)towlower((wint_t)c);
|
||||
break;
|
||||
}
|
||||
p += l;
|
||||
}
|
||||
if (!*p)
|
||||
return 0;
|
||||
l2 = NLSTo((Char *)0, c2);
|
||||
n = (Char *)xmalloc((size_t)((op - p + l2 + Strlen(p + l) + 1) * sizeof(Char)));
|
||||
if (p != op)
|
||||
memcpy(n, op, (p - op) * sizeof(Char));
|
||||
NLSTo(n + (p - op), c2);
|
||||
memcpy(n + (p - op + l2), p + l, (Strlen(p + l) + 1) * sizeof(Char));
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
NLSClassify(c, nocomb)
|
||||
NLSChar c;
|
||||
int nocomb;
|
||||
{
|
||||
int w;
|
||||
if (c & NLS_ILLEGAL)
|
||||
return NLSCLASS_ILLEGAL;
|
||||
w = NLSWidth(c);
|
||||
if (w > 0 || (Iswprint(c) && !nocomb))
|
||||
return w;
|
||||
if (Iswcntrl(c) && c < 0x100) {
|
||||
if (c == '\n')
|
||||
return NLSCLASS_NL;
|
||||
if (c == '\t')
|
||||
return NLSCLASS_TAB;
|
||||
#ifndef ASCII
|
||||
if (!Isupper(_toebcdic[_toascii[c]|0100]) && !strchr("@[\\]^_", _toebcdic[_toascii[c]|0100]))
|
||||
return NLSCLASS_ILLEGAL;
|
||||
#endif
|
||||
return NLSCLASS_CTRL;
|
||||
}
|
||||
if (c >= 0x1000000)
|
||||
return NLSCLASS_ILLEGAL4;
|
||||
if (c >= 0x10000)
|
||||
return NLSCLASS_ILLEGAL3;
|
||||
if (c >= 0x100)
|
||||
return NLSCLASS_ILLEGAL2;
|
||||
return NLSCLASS_ILLEGAL;
|
||||
}
|
99
contrib/tcsh/tc.nls.h
Normal file
99
contrib/tcsh/tc.nls.h
Normal file
@ -0,0 +1,99 @@
|
||||
/* $Header: /src/pub/tcsh/tc.nls.h,v 3.9 2005/03/03 15:52:20 kim Exp $ */
|
||||
/*
|
||||
* tc.nls.h: NLS support
|
||||
*
|
||||
*/
|
||||
/*-
|
||||
* 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. 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_tc_nls
|
||||
#define _h_tc_nls
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
#define NLSZEROT ((size_t)-1)
|
||||
|
||||
#ifdef WIDE_STRINGS
|
||||
|
||||
# define NLSSize(s, l) 1
|
||||
# define NLSFrom(s, l, cp) (USE (l), (*(cp) = *(s) & CHAR), 1)
|
||||
# define NLSFinished(s, l, c) (l != 0 && c != CHAR_ERR ? 2 : 1)
|
||||
# define NLSChars(s) Strlen(s)
|
||||
# define NLSQuote(s)
|
||||
# define TRIM_AND_EXTEND(s, c) (c &= TRIM)
|
||||
|
||||
extern int NLSWidth __P((NLSChar));
|
||||
extern int NLSStringWidth __P((Char *));
|
||||
|
||||
#define NLS_ILLEGAL INVALID_BYTE
|
||||
|
||||
#else
|
||||
# ifdef SHORT_STRINGS
|
||||
|
||||
extern int NLSFrom __P((const Char *, size_t, NLSChar *));
|
||||
extern int NLSFinished __P((Char *, size_t, eChar));
|
||||
extern int NLSChars __P((Char *));
|
||||
extern int NLSStringWidth __P((Char *));
|
||||
extern int NLSWidth __P((NLSChar));
|
||||
extern int NLSTo __P((Char *, NLSChar));
|
||||
extern void NLSQuote __P((Char *));
|
||||
|
||||
#define NLSSize(s, l) NLSFrom(s, l, (NLSChar *)0)
|
||||
#define TRIM_AND_EXTEND(s, c) (s += NLSFrom(s - 1, NLSZEROT, &c) - 1)
|
||||
#define NLS_ILLEGAL 0x40000000
|
||||
|
||||
|
||||
# else
|
||||
# define NLSSize(s, l) 1
|
||||
# define NLSFrom(s, l, cp) (USE (l), (*(cp) = *(s) & CHAR), 1)
|
||||
# define NLSFinished(s, l, c) (l != 0 && c != CHAR_ERR ? 2 : 1)
|
||||
# define NLSChars(s) Strlen(s)
|
||||
# define NLSStringWidth(s) Strlen(s)
|
||||
# define NLSWidth(c) 1
|
||||
# define NLSQuote(s)
|
||||
|
||||
# define TRIM_AND_EXTEND(s, c) (c &= TRIM)
|
||||
# define NLS_ILLEGAL 0x40000000
|
||||
# endif
|
||||
#endif
|
||||
|
||||
extern int NLSExtend __P((Char *, int, int));
|
||||
extern Char *NLSChangeCase __P((Char *, int));
|
||||
extern int NLSClassify __P((NLSChar, int));
|
||||
|
||||
#define NLSCLASS_CTRL (-1)
|
||||
#define NLSCLASS_TAB (-2)
|
||||
#define NLSCLASS_NL (-3)
|
||||
#define NLSCLASS_ILLEGAL (-4)
|
||||
#define NLSCLASS_ILLEGAL2 (-5)
|
||||
#define NLSCLASS_ILLEGAL3 (-6)
|
||||
#define NLSCLASS_ILLEGAL4 (-7)
|
||||
|
||||
#define NLSCLASS_ILLEGAL_SIZE(x) (-(x) - (-(NLSCLASS_ILLEGAL) - 1))
|
||||
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.os.c,v 3.55 2004/02/21 20:34:25 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.os.c,v 3.58 2005/01/18 20:24:51 christos Exp $ */
|
||||
/*
|
||||
* tc.os.c: OS Dependent builtin functions
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tc.os.c,v 3.55 2004/02/21 20:34:25 christos Exp $")
|
||||
RCSID("$Id: tc.os.c,v 3.58 2005/01/18 20:24:51 christos Exp $")
|
||||
|
||||
#include "tw.h"
|
||||
#include "ed.h"
|
||||
@ -362,7 +362,7 @@ dosetspath(v, c)
|
||||
dont_free = 1;
|
||||
for (i = 0, v++; *v && *v[0] != '\0'; v++, i++) {
|
||||
s = short2str(*v);
|
||||
if (Isdigit(*s))
|
||||
if (isdigit(*s))
|
||||
p[i] = atoi(s);
|
||||
else if (strcmp(s, "LOCAL") == 0)
|
||||
p[i] = NULLSITE;
|
||||
@ -583,7 +583,7 @@ dodmmode(v, c)
|
||||
|
||||
static jmp_buf sigsys_buf;
|
||||
|
||||
static sigret_t
|
||||
static RETSIGTYPE
|
||||
catch_sigsys()
|
||||
{
|
||||
longjmp(sigsys_buf, 1);
|
||||
@ -653,14 +653,14 @@ dowarp(v, c)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
douniverse(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register Char *cp = v[1];
|
||||
register Char *cp2; /* dunno how many elements v comes in with */
|
||||
Char *cp = v[1];
|
||||
Char *cp2; /* dunno how many elements v comes in with */
|
||||
char ubuf[100];
|
||||
#ifdef BSDSIGS
|
||||
register sigmask_t omask = 0;
|
||||
sigmask_t omask = 0;
|
||||
#endif /* BSDSIGS */
|
||||
|
||||
if (cp == 0) {
|
||||
@ -799,11 +799,11 @@ bs2cmdlist(char *str)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dobs2cmd(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register Char *cp;
|
||||
register int i = 0, len = 0;
|
||||
Char *cp;
|
||||
int i = 0, len = 0;
|
||||
char *cmd = NULL;
|
||||
int pvec[2];
|
||||
struct command faket;
|
||||
@ -840,7 +840,7 @@ dobs2cmd(v, c)
|
||||
/* 2nd round: fill cmd buffer */
|
||||
i = 0;
|
||||
while ((cp = *v++) != 0) {
|
||||
register int c;
|
||||
int c;
|
||||
while (c = *cp++)
|
||||
cmd[i++] = (char)c;
|
||||
if (*v)
|
||||
@ -909,13 +909,13 @@ dobs2cmd(v, c)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
doatt(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register Char *cp = v[1];
|
||||
Char *cp = v[1];
|
||||
char ubuf[100];
|
||||
#ifdef BSDSIGS
|
||||
register sigmask_t omask = 0;
|
||||
sigmask_t omask = 0;
|
||||
#endif /* BSDSIGS */
|
||||
|
||||
if (cp == 0)
|
||||
@ -944,13 +944,13 @@ doatt(v, c)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
doucb(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register Char *cp = v[1];
|
||||
Char *cp = v[1];
|
||||
char ubuf[100];
|
||||
#ifdef BSDSIGS
|
||||
register sigmask_t omask = 0;
|
||||
sigmask_t omask = 0;
|
||||
#endif /* BSDSIGS */
|
||||
|
||||
if (cp == 0)
|
||||
@ -1020,7 +1020,7 @@ pr_stat_sub(p2, p1, pr)
|
||||
#endif /* _SEQUENT_ */
|
||||
|
||||
|
||||
#ifdef NEEDmemset
|
||||
#ifndef HAVE_MEMSET
|
||||
/* This is a replacement for a missing memset function */
|
||||
ptr_t xmemset(loc, value, len)
|
||||
ptr_t loc;
|
||||
@ -1033,10 +1033,10 @@ ptr_t xmemset(loc, value, len)
|
||||
*ptr++ = value;
|
||||
return loc;
|
||||
}
|
||||
#endif /* NEEDmemset */
|
||||
#endif /* !HAVE_MEMSET */
|
||||
|
||||
|
||||
#ifdef NEEDmemmove
|
||||
#ifndef HAVE_MEMMOVE
|
||||
/* memmove():
|
||||
* This is the ANSI form of bcopy() with the arguments backwards...
|
||||
* Unlike memcpy(), it handles overlaps between source and
|
||||
@ -1066,11 +1066,11 @@ xmemmove(vdst, vsrc, len)
|
||||
}
|
||||
return vdst;
|
||||
}
|
||||
#endif /* NEEDmemmove */
|
||||
#endif /* HAVE_MEMMOVE */
|
||||
|
||||
|
||||
#ifndef WINNT_NATIVE
|
||||
#ifdef tcgetpgrp
|
||||
#ifdef NEEDtcgetpgrp
|
||||
int
|
||||
xtcgetpgrp(fd)
|
||||
int fd;
|
||||
@ -1096,7 +1096,7 @@ xtcsetpgrp(fd, pgrp)
|
||||
return ioctl(fd, TIOCSPGRP, (ioctl_t) &pgrp);
|
||||
}
|
||||
|
||||
#endif /* tcgetpgrp */
|
||||
#endif /* NEEDtcgetpgrp */
|
||||
#endif /* WINNT_NATIVE */
|
||||
|
||||
|
||||
@ -1189,7 +1189,7 @@ osinit()
|
||||
#endif /* _SX */
|
||||
}
|
||||
|
||||
#ifdef strerror
|
||||
#ifndef HAVE_STRERROR
|
||||
char *
|
||||
xstrerror(i)
|
||||
int i;
|
||||
@ -1204,9 +1204,9 @@ xstrerror(i)
|
||||
return errbuf;
|
||||
}
|
||||
}
|
||||
#endif /* strerror */
|
||||
#endif /* !HAVE_STRERROR */
|
||||
|
||||
#ifdef gethostname
|
||||
#ifndef HAVE_GETHOSTNAME
|
||||
# if !defined(_MINIX) && !defined(__EMX__) && !defined(WINNT_NATIVE)
|
||||
# include <sys/utsname.h>
|
||||
# endif /* !_MINIX && !__EMX__ && !WINNT_NATIVE */
|
||||
@ -1245,9 +1245,9 @@ xgethostname(name, namlen)
|
||||
return(0);
|
||||
#endif /* _MINIX && !__EMX__ */
|
||||
} /* end xgethostname */
|
||||
#endif /* gethostname */
|
||||
#endif /* !HAVE_GETHOSTNAME */
|
||||
|
||||
#ifdef nice
|
||||
#ifndef HAVE_NICE
|
||||
# if defined(_MINIX) && defined(NICE)
|
||||
# undef _POSIX_SOURCE /* redefined in <lib.h> */
|
||||
# undef _MINIX /* redefined in <lib.h> */
|
||||
@ -1264,9 +1264,9 @@ xnice(incr)
|
||||
return /* incr ? 0 : */ 0;
|
||||
#endif /* _MINIX && NICE */
|
||||
} /* end xnice */
|
||||
#endif /* nice */
|
||||
#endif /* !HAVE_NICE */
|
||||
|
||||
#ifdef NEEDgetcwd
|
||||
#ifndef HAVE_GETCWD
|
||||
static char *strnrcpy __P((char *, char *, size_t));
|
||||
|
||||
/* xgetcwd():
|
||||
@ -1368,9 +1368,6 @@ xgetcwd(pathname, pathlen)
|
||||
|
||||
# else /* ! hp9000s500 */
|
||||
|
||||
# if (SYSVREL != 0 && !defined(d_fileno)) || defined(_VMS_POSIX) || defined(WINNT) || defined(_MINIX_VMD)
|
||||
# define d_fileno d_ino
|
||||
# endif
|
||||
|
||||
char *
|
||||
xgetcwd(pathname, pathlen)
|
||||
@ -1436,10 +1433,10 @@ xgetcwd(pathname, pathlen)
|
||||
/* Parent has same device. No need to stat every member */
|
||||
for (d = readdir(dp); d != NULL; d = readdir(dp)) {
|
||||
#ifdef __clipper__
|
||||
if (((unsigned long)d->d_fileno & 0xffff) == st_cur.st_ino)
|
||||
if (((unsigned long)d->d_ino & 0xffff) == st_cur.st_ino)
|
||||
break;
|
||||
#else
|
||||
if (d->d_fileno == st_cur.st_ino)
|
||||
if (d->d_ino == st_cur.st_ino)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
@ -1495,10 +1492,10 @@ xgetcwd(pathname, pathlen)
|
||||
*/
|
||||
static char *
|
||||
strnrcpy(ptr, str, siz)
|
||||
register char *ptr, *str;
|
||||
char *ptr, *str;
|
||||
size_t siz;
|
||||
{
|
||||
register int len = strlen(str);
|
||||
int len = strlen(str);
|
||||
if (siz == 0)
|
||||
return ptr;
|
||||
|
||||
@ -1507,7 +1504,7 @@ strnrcpy(ptr, str, siz)
|
||||
|
||||
return (ptr);
|
||||
} /* end strnrcpy */
|
||||
#endif /* getcwd */
|
||||
#endif /* !HAVE_GETCWD */
|
||||
|
||||
#ifdef apollo
|
||||
/***
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.os.h,v 3.90 2004/01/23 16:21:10 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.os.h,v 3.97 2005/03/03 22:32:01 kim Exp $ */
|
||||
/*
|
||||
* tc.os.h: Shell os dependent defines
|
||||
*/
|
||||
@ -33,13 +33,6 @@
|
||||
#ifndef _h_tc_os
|
||||
#define _h_tc_os
|
||||
|
||||
#ifndef __STDC__
|
||||
#ifndef WINNT_NATIVE
|
||||
#define NEEDstrerror /* Too hard to find which systems have it */
|
||||
#endif /* WINNT_NATIVE */
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef notdef
|
||||
/*
|
||||
* for SVR4 and linux we used to fork pipelines backwards.
|
||||
@ -52,7 +45,6 @@
|
||||
#ifdef __CYGWIN__
|
||||
# undef NOFILE
|
||||
# define NOFILE sysconf(_SC_OPEN_MAX)
|
||||
# undef NEEDstrerror
|
||||
#endif
|
||||
|
||||
#ifdef _VMS_POSIX
|
||||
@ -60,8 +52,6 @@
|
||||
# define NOFILE 64
|
||||
# endif /* NOFILE */
|
||||
# define nice(a) setprio((getpid()),a)
|
||||
# undef NEEDstrerror /* won't get sensible error messages otherwise */
|
||||
# define NEEDgethostname
|
||||
# include <sys/time.h> /* for time stuff in tc.prompt.c */
|
||||
# include <limits.h>
|
||||
#endif /* atp vmsposix */
|
||||
@ -86,17 +76,6 @@
|
||||
# define NOFILE 256
|
||||
#endif /* NOFILE */
|
||||
|
||||
#if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__) || SYSVREL >= 4 || defined(_MINIX_VMD)
|
||||
# undef NEEDstrerror
|
||||
#endif /* linux || __NetBSD__ || __FreeBSD__ || SYSVREL >= 4 || _MINIX_VMD */
|
||||
|
||||
#if !defined(pyr) && !defined(sinix)
|
||||
/* Pyramid's cpp complains about the next line */
|
||||
# if defined(BSD) && BSD >= 199306
|
||||
# undef NEEDstrerror
|
||||
# endif /* BSD && BSD >= 199306 */
|
||||
#endif /* pyr */
|
||||
|
||||
#ifdef OREO
|
||||
# include <sys/time.h>
|
||||
# ifdef notdef
|
||||
@ -161,12 +140,6 @@ struct ucred {
|
||||
# include <sys/bsdtty.h>
|
||||
# endif /* !hp9000s500 && !(SIGRTMAX || SIGRTMIN) */
|
||||
|
||||
# ifndef POSIX
|
||||
# ifdef BSDJOBS
|
||||
# define getpgrp(a) getpgrp2(a)
|
||||
# define setpgrp(a, b) setpgrp2(a, b)
|
||||
# endif /* BSDJOBS */
|
||||
# endif /* POSIX */
|
||||
# ifndef TIOCSTI
|
||||
# include <sys/strtio.h>
|
||||
# endif
|
||||
@ -197,10 +170,10 @@ struct ucred {
|
||||
* #if (SYSVREL > 0) && defined(TIOCGWINSZ)
|
||||
* If that breaks on your machine, let me know.
|
||||
*
|
||||
* It would break on linux, where all this is
|
||||
* It would break on glibc, where all this is
|
||||
* defined in <termios.h>. Wrapper added.
|
||||
*/
|
||||
#if !defined(linux) && !defined(_VMS_POSIX)
|
||||
#if !defined(linux) && !defined(__GNU__) && !defined(__GLIBC__) && !defined(_VMS_POSIX)
|
||||
# if defined(INTEL) || defined(u3b2) || defined (u3b5) || defined(ub15) || defined(u3b20d) || defined(ISC) || defined(SCO) || defined(tower32)
|
||||
# ifdef TIOCGWINSZ
|
||||
/*
|
||||
@ -209,26 +182,12 @@ struct ucred {
|
||||
# include <sys/stream.h>
|
||||
# include <sys/ptem.h>
|
||||
# endif /* TIOCGWINSZ */
|
||||
# ifndef ODT
|
||||
# define NEEDgethostname
|
||||
# endif /* ODT */
|
||||
# endif /* INTEL || u3b2 || u3b5 || ub15 || u3b20d || ISC || SCO || tower32 */
|
||||
#endif /* !linux && !_VMS_POSIX */
|
||||
|
||||
#if defined(UNIXPC) || defined(COHERENT)
|
||||
# define NEEDgethostname
|
||||
#endif /* UNIXPC || COHERENT */
|
||||
#endif /* !glibc && !_VMS_POSIX */
|
||||
|
||||
#ifdef IRIS4D
|
||||
# include <sys/time.h>
|
||||
# include <sys/resource.h>
|
||||
# ifndef POSIX
|
||||
/*
|
||||
* BSDsetpgrp() and BSDgetpgrp() are BSD versions of setpgrp, etc.
|
||||
*/
|
||||
# define setpgrp BSDsetpgrp
|
||||
# define getpgrp BSDgetpgrp
|
||||
# endif /* POSIX */
|
||||
#endif /* IRIS4D */
|
||||
|
||||
/*
|
||||
@ -242,7 +201,10 @@ struct ucred {
|
||||
*/
|
||||
#ifndef WINNT_NATIVE
|
||||
# ifdef F_SETFD
|
||||
# define close_on_exec(fd, v) fcntl((fd), F_SETFD, v)
|
||||
# ifndef FD_CLOEXEC
|
||||
# define FD_CLOEXEC 1
|
||||
# endif
|
||||
# define close_on_exec(fd, v) fcntl((fd), F_SETFD, ((v) ? FD_CLOEXEC : 0))
|
||||
# else /* !F_SETFD */
|
||||
# ifdef FIOCLEX
|
||||
# define close_on_exec(fd, v) ioctl((fd), ((v) ? FIOCLEX : FIONCLEX), NULL)
|
||||
@ -273,19 +235,7 @@ struct ucred {
|
||||
# endif /* S_IFMT */
|
||||
#endif /* ISC */
|
||||
|
||||
#if defined(uts) || defined(UTekV) || defined(sysV88)
|
||||
/*
|
||||
* The uts 2.1.2 macros (Amdahl) are busted!
|
||||
* You should fix <sys/stat.h>, cause other programs will break too!
|
||||
*
|
||||
* From: creiman@ncsa.uiuc.edu (Charlie Reiman)
|
||||
*/
|
||||
|
||||
/*
|
||||
* The same applies to Motorola MPC (System V/88 R32V2, UTekV 3.2e)
|
||||
* workstations, the stat macros are broken.
|
||||
* Kaveh Ghazi (ghazi@caip.rutgers.edu)
|
||||
*/
|
||||
#ifdef STAT_MACROS_BROKEN
|
||||
# undef S_ISDIR
|
||||
# undef S_ISCHR
|
||||
# undef S_ISBLK
|
||||
@ -294,7 +244,7 @@ struct ucred {
|
||||
# undef S_ISNAM
|
||||
# undef S_ISLNK
|
||||
# undef S_ISSOCK
|
||||
#endif /* uts || UTekV || sysV88 */
|
||||
#endif /* STAT_MACROS_BROKEN */
|
||||
|
||||
#ifdef S_IFMT
|
||||
# if !defined(S_ISDIR) && defined(S_IFDIR)
|
||||
@ -446,18 +396,11 @@ struct ucred {
|
||||
# endif /* SEEK_END */
|
||||
#endif /* L_XTND */
|
||||
|
||||
#ifdef _SEQUENT_
|
||||
# define NEEDgethostname
|
||||
#endif /* _SEQUENT_ */
|
||||
|
||||
#if defined(BSD) && defined(POSIXJOBS) && !defined(BSD4_4) && !defined(__hp_osf)
|
||||
#if !defined (HAVE_SETPGID) && !defined (SETPGRP_VOID)
|
||||
# define setpgid(pid, pgrp) setpgrp(pid, pgrp)
|
||||
#endif /* BSD && POSIXJOBS && && !BSD4_4 && !__hp_osf */
|
||||
#endif
|
||||
|
||||
#if defined(BSDJOBS) && !(defined(POSIX) && defined(POSIXJOBS))
|
||||
# if !defined(_AIX370) && !defined(_AIXPS2)
|
||||
# define setpgid(pid, pgrp) setpgrp(pid, pgrp)
|
||||
# endif /* !_AIX370 && !_AIXPS2 */
|
||||
# define NEEDtcgetpgrp
|
||||
#endif /* BSDJOBS && !(POSIX && POSIXJOBS) */
|
||||
|
||||
@ -468,11 +411,6 @@ struct ucred {
|
||||
# define NEEDtcgetpgrp
|
||||
#endif /* RENO */
|
||||
|
||||
#ifdef DGUX
|
||||
# define setpgrp(a, b) setpgrp2(a, b)
|
||||
# define getpgrp(a) getpgrp2(a)
|
||||
#endif /* DGUX */
|
||||
|
||||
#ifdef SXA
|
||||
# ifndef _BSDX_
|
||||
/*
|
||||
@ -484,8 +422,6 @@ struct ucred {
|
||||
#endif /* SXA */
|
||||
|
||||
#if defined(_MINIX) || defined(__EMX__)
|
||||
# define NEEDgethostname
|
||||
# define NEEDnice
|
||||
# define HAVENOLIMIT
|
||||
/*
|
||||
* Minix does not have these, so...
|
||||
@ -498,23 +434,6 @@ struct ucred {
|
||||
# define ttyname(fd) (isatty(fd) ? "/dev/tty" : NULL)
|
||||
#endif /* __EMX__ */
|
||||
|
||||
#ifndef POSIX
|
||||
# define mygetpgrp() getpgrp(0)
|
||||
#else /* POSIX */
|
||||
# if (defined(BSD) && !defined(BSD4_4)) || defined(SUNOS4) || defined(IRIS4D) || defined(DGUX) || defined(HPRT)
|
||||
# define mygetpgrp() getpgrp(0)
|
||||
# else /* !((BSD && !BSD4_4) || SUNOS4 || IRIS4D || DGUX || HPRT) */
|
||||
# define mygetpgrp() getpgrp()
|
||||
# endif /* (BSD && BSD4_4) || SUNOS4 || IRISD || DGUX || HPRT */
|
||||
#endif /* POSIX */
|
||||
|
||||
|
||||
#if !defined(SOLARIS2) && !defined(sinix) && !defined(BSD4_4) && !defined(WINNT_NATIVE)
|
||||
# if (SYSVREL > 0 && !defined(OREO) && !defined(sgi) && !defined(linux) && !defined(sinix) && !defined(_AIX) &&!defined(_UWIN)) || defined(NeXT)
|
||||
# define NEEDgetcwd
|
||||
# endif /* (SYSVREL > 0 && !OREO && !sgi && !linux && !sinix && !_AIX && !_UWIN) || NeXT */
|
||||
#endif
|
||||
|
||||
#ifndef S_IFLNK
|
||||
# define lstat stat
|
||||
#endif /* S_IFLNK */
|
||||
@ -534,12 +453,15 @@ typedef struct timeval timeval_t;
|
||||
# define free tcsh_free
|
||||
#endif /* NeXT */
|
||||
|
||||
#if !defined(BSD4_4) && !defined(__linux__) && !defined(__hpux) && \
|
||||
!defined(sgi) && !defined(_AIX) && !defined(__CYGWIN__)
|
||||
#ifndef NEEDgethostname
|
||||
#if defined(HAVE_GETHOSTNAME) && !HAVE_DECL_GETHOSTNAME
|
||||
extern int gethostname __P((char *, int));
|
||||
#endif /* NEEDgethostname */
|
||||
#endif /* !BDS4_4 && !__linux__ && !__hpux && !sgi */
|
||||
#endif
|
||||
|
||||
#ifndef GETPGRP_VOID
|
||||
# define mygetpgrp() getpgrp(0)
|
||||
#else
|
||||
# define mygetpgrp() getpgrp()
|
||||
#endif
|
||||
|
||||
#if !defined(POSIX) || defined(SUNOS4) || defined(UTekV) || defined(sysV88)
|
||||
extern time_t time();
|
||||
@ -549,6 +471,7 @@ extern int atoi();
|
||||
extern char *ttyname();
|
||||
# endif /* __EMX__ */
|
||||
|
||||
|
||||
# if defined(SUNOS4)
|
||||
# ifndef toupper
|
||||
extern int toupper __P((int));
|
||||
@ -557,19 +480,9 @@ extern int toupper __P((int));
|
||||
extern int tolower __P((int));
|
||||
# endif /* tolower */
|
||||
extern caddr_t sbrk __P((int));
|
||||
# if SYSVREL == 0 && !defined(__lucid)
|
||||
extern int qsort();
|
||||
# endif /* SYSVREL == 0 && !__lucid */
|
||||
# else /* !SUNOS4 */
|
||||
# ifndef WINNT_NATIVE
|
||||
# ifndef hpux
|
||||
# if __GNUC__ != 2
|
||||
extern int abort();
|
||||
# endif /* __GNUC__ != 2 */
|
||||
# ifndef fps500
|
||||
extern int qsort();
|
||||
# endif /* !fps500 */
|
||||
# else /* !hpux */
|
||||
# ifdef hpux
|
||||
extern void abort();
|
||||
extern void qsort();
|
||||
# endif /* hpux */
|
||||
@ -580,12 +493,9 @@ extern void perror();
|
||||
#endif
|
||||
|
||||
# ifdef BSDSIGS
|
||||
# if defined(_AIX370) || defined(MACH) || defined(NeXT) || defined(_AIXPS2) || defined(ardent) || defined(SUNOS4) || defined(HPBSD) || defined(__MACHTEN__)
|
||||
extern int sigvec();
|
||||
extern int sigpause();
|
||||
# else /* !(_AIX370 || MACH || NeXT || _AIXPS2 || ardent || SUNOS4 || HPBSD) */
|
||||
# if !defined(_AIX370) && !defined(MACH) && !defined(NeXT) && !defined(_AIXPS2) && !defined(ardent) && !defined(SUNOS4) && !defined(HPBSD) && !defined(__MACHTEN__)
|
||||
# if (!defined(apollo) || !defined(__STDC__)) && !defined(__DGUX__) && !defined(fps500)
|
||||
extern sigret_t sigvec();
|
||||
extern RETSIGTYPE sigvec();
|
||||
#ifndef _CX_UX
|
||||
extern void sigpause();
|
||||
#endif /* _CX_UX */
|
||||
@ -595,14 +505,6 @@ extern sigmask_t sigblock();
|
||||
extern sigmask_t sigsetmask();
|
||||
# endif /* BSDSIGS */
|
||||
|
||||
# ifndef killpg
|
||||
extern int killpg();
|
||||
# endif /* killpg */
|
||||
|
||||
# ifndef lstat
|
||||
extern int lstat();
|
||||
# endif /* lstat */
|
||||
|
||||
# ifdef BSD
|
||||
extern uid_t getuid(), geteuid();
|
||||
extern gid_t getgid(), getegid();
|
||||
@ -615,47 +517,14 @@ extern memalign_t calloc();
|
||||
extern void free();
|
||||
# endif /* SYSMALLOC */
|
||||
|
||||
# ifdef BSDTIMES
|
||||
extern int getrlimit();
|
||||
extern int setrlimit();
|
||||
extern int getrusage();
|
||||
extern int gettimeofday();
|
||||
# endif /* BSDTIMES */
|
||||
|
||||
# if defined(NLS) && !defined(NOSTRCOLL) && !defined(NeXT)
|
||||
extern int strcoll();
|
||||
# endif /* NLS && !NOSTRCOLL && !NeXT */
|
||||
|
||||
# ifdef BSDJOBS
|
||||
# ifdef BSDTIMES
|
||||
# ifdef __MACHTEN__
|
||||
extern pid_t wait3();
|
||||
# else
|
||||
# ifndef HPBSD
|
||||
extern int wait3();
|
||||
# endif /* HPBSD */
|
||||
# endif /* __MACHTEN__ */
|
||||
# else /* !BSDTIMES */
|
||||
# if !defined(POSIXJOBS) && !defined(_SEQUENT_)
|
||||
extern int wait3();
|
||||
# else /* POSIXJOBS || _SEQUENT_ */
|
||||
extern int waitpid();
|
||||
# endif /* POSIXJOBS || _SEQUENT_ */
|
||||
# endif /* BSDTIMES */
|
||||
# else /* !BSDJOBS */
|
||||
# if SYSVREL < 3
|
||||
extern int ourwait();
|
||||
# else /* SYSVREL >= 3 */
|
||||
extern int wait();
|
||||
# endif /* SYSVREL < 3 */
|
||||
# endif /* BSDJOBS */
|
||||
|
||||
# ifdef BSDNICE
|
||||
extern int setpriority();
|
||||
# else /* !BSDNICE */
|
||||
extern int nice();
|
||||
# endif /* BSDNICE */
|
||||
|
||||
# if (!defined(fps500) && !defined(apollo) && !defined(__lucid) && !defined(HPBSD) && !defined(DECOSF1))
|
||||
extern void setpwent();
|
||||
extern void endpwent();
|
||||
@ -663,12 +532,12 @@ extern void endpwent();
|
||||
|
||||
# ifndef __STDC__
|
||||
extern struct passwd *getpwuid(), *getpwnam(), *getpwent();
|
||||
# ifdef PW_SHADOW
|
||||
# ifdef HAVE_SHADOW_H
|
||||
extern struct spwd *getspnam(), *getspent();
|
||||
# endif /* PW_SHADOW */
|
||||
# ifdef PW_AUTH
|
||||
# endif /* HAVE_SHADOW_H */
|
||||
# ifdef HAVE_AUTH_H
|
||||
extern struct authorization *getauthuid();
|
||||
# endif /* PW_AUTH */
|
||||
# endif /* HAVE_AUTH_H */
|
||||
# endif /* __STDC__ */
|
||||
|
||||
# ifndef getcwd
|
||||
@ -714,17 +583,9 @@ extern void bcopy __P((const void *, void *, size_t));
|
||||
# endif /* __alpha && __osf__ && DECOSF1 < 200 */
|
||||
#endif /* (BSD && !BSD4_4) || SUNOS4 */
|
||||
|
||||
#if !defined(hpux) && !defined(COHERENT) && ((SYSVREL < 4) || defined(_SEQUENT_)) && !defined(BSD4_4) && !defined(memmove)
|
||||
# define NEEDmemmove
|
||||
#endif /* !hpux && !COHERENT && (SYSVREL < 4 || _SEQUENT_) && !BSD4_4 && !memmove */
|
||||
|
||||
#if defined(UTek) || defined(pyr)
|
||||
# define NEEDmemset
|
||||
#else /* !UTek && !pyr */
|
||||
# ifdef SUNOS4
|
||||
# include <memory.h> /* memset should be declared in <string.h> but isn't */
|
||||
# endif /* SUNOS4 */
|
||||
#endif /* UTek || pyr */
|
||||
#ifdef SUNOS4
|
||||
# include <memory.h> /* memset should be declared in <string.h> but isn't */
|
||||
#endif /* SUNOS4 */
|
||||
|
||||
#if SYSVREL == 4
|
||||
# ifdef REMOTEHOST
|
||||
@ -741,18 +602,13 @@ extern int getpeername __P((int, struct sockaddr *, int *));
|
||||
extern int getrlimit __P((int, struct rlimit *));
|
||||
extern int setrlimit __P((int, const struct rlimit *));
|
||||
# endif /* !BSDTIMES */
|
||||
# if !defined(IRIS4D) && !defined(SOLARIS2)
|
||||
extern int wait3(); /* I think some bizarre systems still need this */
|
||||
# endif /* !IRIS4D && !SOLARIS2 */
|
||||
# if defined(SOLARIS2)
|
||||
# undef NEEDstrerror
|
||||
extern char *strerror __P((int));
|
||||
# endif /* SOLARIS2 */
|
||||
#endif /* SYSVREL == 4 */
|
||||
|
||||
#if defined(__alpha) && defined(__osf__) && DECOSF1 < 200
|
||||
/* These are ok for 1.3, but conflict with the header files for 2.0 */
|
||||
extern int gethostname __P((char *, int));
|
||||
extern char *sbrk __P((ssize_t));
|
||||
extern int ioctl __P((int, unsigned long, char *));
|
||||
extern pid_t vfork __P((void));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.printf.c,v 3.24 2003/12/02 17:59:30 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.printf.c,v 3.27 2005/01/05 16:06:15 christos Exp $ */
|
||||
/*
|
||||
* tc.printf.c: A public-domain, minimal printf/sprintf routine that prints
|
||||
* through the putchar() routine. Feel free to use for
|
||||
@ -34,7 +34,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tc.printf.c,v 3.24 2003/12/02 17:59:30 christos Exp $")
|
||||
RCSID("$Id: tc.printf.c,v 3.27 2005/01/05 16:06:15 christos Exp $")
|
||||
|
||||
#ifdef lint
|
||||
#undef va_arg
|
||||
@ -44,6 +44,7 @@ RCSID("$Id: tc.printf.c,v 3.24 2003/12/02 17:59:30 christos Exp $")
|
||||
#define INF 32766 /* should be bigger than any field to print */
|
||||
|
||||
static char buf[128];
|
||||
static char snil[] = "(nil)";
|
||||
|
||||
static void xaddchar __P((int));
|
||||
static void doprnt __P((void (*) __P((int)), const char *, va_list));
|
||||
@ -59,7 +60,7 @@ doprnt(addchar, sfmt, ap)
|
||||
#ifdef SHORT_STRINGS
|
||||
Char *Bp;
|
||||
#endif /* SHORT_STRINGS */
|
||||
#ifdef HAVE_QUAD
|
||||
#ifdef HAVE_LONG_LONG
|
||||
long long l;
|
||||
unsigned long long u;
|
||||
#else
|
||||
@ -96,9 +97,9 @@ doprnt(addchar, sfmt, ap)
|
||||
f_width = va_arg(ap, int);
|
||||
f++;
|
||||
}
|
||||
else if (Isdigit((unsigned char) *f)) {
|
||||
else if (isdigit((unsigned char) *f)) {
|
||||
f_width = atoi(f);
|
||||
while (Isdigit((unsigned char) *f))
|
||||
while (isdigit((unsigned char) *f))
|
||||
f++; /* skip the digits */
|
||||
}
|
||||
|
||||
@ -108,9 +109,9 @@ doprnt(addchar, sfmt, ap)
|
||||
prec = va_arg(ap, int);
|
||||
f++;
|
||||
}
|
||||
else if (Isdigit((unsigned char) *f)) {
|
||||
prec = atoi((char *) f);
|
||||
while (Isdigit((unsigned char) *f))
|
||||
else if (isdigit((unsigned char) *f)) {
|
||||
prec = atoi(f);
|
||||
while (isdigit((unsigned char) *f))
|
||||
f++; /* skip the digits */
|
||||
}
|
||||
}
|
||||
@ -130,9 +131,9 @@ doprnt(addchar, sfmt, ap)
|
||||
}
|
||||
|
||||
fmt = (unsigned char) *f;
|
||||
if (fmt != 'S' && fmt != 'Q' && Isupper(fmt)) {
|
||||
if (fmt != 'S' && fmt != 'Q' && isupper(fmt)) {
|
||||
do_long = 1;
|
||||
fmt = Tolower(fmt);
|
||||
fmt = tolower(fmt);
|
||||
}
|
||||
bp = buf;
|
||||
switch (fmt) { /* do the format */
|
||||
@ -142,12 +143,12 @@ doprnt(addchar, sfmt, ap)
|
||||
l = (long) (va_arg(ap, int));
|
||||
break;
|
||||
case 1:
|
||||
#ifndef HAVE_QUAD
|
||||
#ifndef HAVE_LONG_LONG
|
||||
default:
|
||||
#endif
|
||||
l = va_arg(ap, long);
|
||||
break;
|
||||
#ifdef HAVE_QUAD
|
||||
#ifdef HAVE_LONG_LONG
|
||||
default:
|
||||
l = va_arg(ap, long long);
|
||||
break;
|
||||
@ -187,12 +188,12 @@ doprnt(addchar, sfmt, ap)
|
||||
u = (unsigned long) (va_arg(ap, unsigned int));
|
||||
break;
|
||||
case 1:
|
||||
#ifndef HAVE_QUAD
|
||||
#ifndef HAVE_LONG_LONG
|
||||
default:
|
||||
#endif
|
||||
u = va_arg(ap, unsigned long);
|
||||
break;
|
||||
#ifdef HAVE_QUAD
|
||||
#ifdef HAVE_LONG_LONG
|
||||
default:
|
||||
u = va_arg(ap, unsigned long long);
|
||||
break;
|
||||
@ -253,9 +254,15 @@ doprnt(addchar, sfmt, ap)
|
||||
while (f_width-- > 0)
|
||||
(*addchar) ((int) (pad | attributes));
|
||||
for (i = 0; *Bp && i < prec; i++) {
|
||||
char cbuf[MB_LEN_MAX];
|
||||
size_t pos, len;
|
||||
|
||||
if (fmt == 'Q' && *Bp & QUOTE)
|
||||
(*addchar) ((int) ('\\' | attributes));
|
||||
(*addchar) ((int) ((*Bp & TRIM) | attributes));
|
||||
len = one_wctomb(cbuf, *Bp & CHAR);
|
||||
for (pos = 0; pos < len; pos++)
|
||||
(*addchar) ((int) ((unsigned char)cbuf[pos]
|
||||
| attributes | (*Bp & ATTRIBUTES)));
|
||||
Bp++;
|
||||
}
|
||||
if (flush_left)
|
||||
@ -269,7 +276,7 @@ doprnt(addchar, sfmt, ap)
|
||||
bp = va_arg(ap, char *);
|
||||
lcase_s:
|
||||
if (!bp)
|
||||
bp = "(nil)";
|
||||
bp = snil;
|
||||
f_width = f_width - strlen((char *) bp);
|
||||
if (!flush_left)
|
||||
while (f_width-- > 0)
|
||||
@ -319,7 +326,7 @@ xaddchar(c)
|
||||
|
||||
pret_t
|
||||
/*VARARGS*/
|
||||
#ifdef FUNCPROTO
|
||||
#ifdef PROTOTYPES
|
||||
xsnprintf(char *str, size_t size, const char *fmt, ...)
|
||||
#else
|
||||
xsnprintf(va_alist)
|
||||
@ -327,7 +334,7 @@ xsnprintf(va_alist)
|
||||
#endif
|
||||
{
|
||||
va_list va;
|
||||
#ifdef FUNCPROTO
|
||||
#ifdef PROTOTYPES
|
||||
va_start(va, fmt);
|
||||
#else
|
||||
char *str, *fmt;
|
||||
@ -351,7 +358,7 @@ xsnprintf(va_alist)
|
||||
|
||||
pret_t
|
||||
/*VARARGS*/
|
||||
#ifdef FUNCPROTO
|
||||
#ifdef PROTOTYPES
|
||||
xprintf(const char *fmt, ...)
|
||||
#else
|
||||
xprintf(va_alist)
|
||||
@ -359,7 +366,7 @@ xprintf(va_alist)
|
||||
#endif
|
||||
{
|
||||
va_list va;
|
||||
#ifdef FUNCPROTO
|
||||
#ifdef PROTOTYPES
|
||||
va_start(va, fmt);
|
||||
#else
|
||||
char *fmt;
|
||||
@ -416,7 +423,7 @@ xvsnprintf(str, size, fmt, va)
|
||||
#define FILE int
|
||||
#endif
|
||||
int
|
||||
#ifdef FUNCPROTO
|
||||
#ifdef PROTOTYPES
|
||||
fprintf(FILE *fp, const char* fmt, ...)
|
||||
#else
|
||||
fprintf(va_alist)
|
||||
@ -424,7 +431,7 @@ fprintf(va_alist)
|
||||
#endif
|
||||
{
|
||||
va_list va;
|
||||
#ifdef FUNCPROTO
|
||||
#ifdef PROTOTYPES
|
||||
va_start(va, fmt);
|
||||
#else
|
||||
FILE *fp;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.prompt.c,v 3.47 2002/07/25 17:14:59 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.prompt.c,v 3.53 2005/01/05 18:06:43 christos Exp $ */
|
||||
/*
|
||||
* tc.prompt.c: Prompt printing stuff
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tc.prompt.c,v 3.47 2002/07/25 17:14:59 christos Exp $")
|
||||
RCSID("$Id: tc.prompt.c,v 3.53 2005/01/05 18:06:43 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
#include "tw.h"
|
||||
@ -48,8 +48,8 @@ RCSID("$Id: tc.prompt.c,v 3.47 2002/07/25 17:14:59 christos Exp $")
|
||||
* 29-Dec-96 added rprompt support
|
||||
*/
|
||||
|
||||
static char *month_list[12];
|
||||
static char *day_list[7];
|
||||
static const char *month_list[12];
|
||||
static const char *day_list[7];
|
||||
|
||||
void
|
||||
dateinit()
|
||||
@ -110,10 +110,10 @@ dateinit()
|
||||
void
|
||||
printprompt(promptno, str)
|
||||
int promptno;
|
||||
char *str;
|
||||
const char *str;
|
||||
{
|
||||
static Char *ocp = NULL;
|
||||
static char *ostr = NULL;
|
||||
static const char *ostr = NULL;
|
||||
time_t lclock = time(NULL);
|
||||
Char *cp;
|
||||
|
||||
@ -145,10 +145,9 @@ printprompt(promptno, str)
|
||||
|
||||
PromptBuf[0] = '\0';
|
||||
tprintf(FMT_PROMPT, PromptBuf, cp, 2 * INBUFSIZE - 2, str, lclock, NULL);
|
||||
|
||||
if (!editing) {
|
||||
for (cp = PromptBuf; *cp ; )
|
||||
(void) putraw(*cp++);
|
||||
(void) putwraw(*cp++);
|
||||
SetAttributes(0);
|
||||
flush();
|
||||
}
|
||||
@ -157,11 +156,10 @@ printprompt(promptno, str)
|
||||
if (promptno == 0) { /* determine rprompt if using main prompt */
|
||||
cp = varval(STRrprompt);
|
||||
tprintf(FMT_PROMPT, RPromptBuf, cp, INBUFSIZE - 2, NULL, lclock, NULL);
|
||||
|
||||
/* if not editing, put rprompt after prompt */
|
||||
if (!editing && RPromptBuf[0] != '\0') {
|
||||
for (cp = RPromptBuf; *cp ; )
|
||||
(void) putraw(*cp++);
|
||||
(void) putwraw(*cp++);
|
||||
SetAttributes(0);
|
||||
putraw(' ');
|
||||
flush();
|
||||
@ -175,7 +173,7 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
Char *buf;
|
||||
const Char *fmt;
|
||||
size_t siz;
|
||||
char *str;
|
||||
const char *str;
|
||||
time_t tim;
|
||||
ptr_t info;
|
||||
{
|
||||
@ -195,32 +193,34 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
|
||||
/* prompt stuff */
|
||||
static Char *olddir = NULL, *olduser = NULL;
|
||||
extern int tlength; /* cache cleared */
|
||||
int updirs;
|
||||
size_t pdirs, sz;
|
||||
int l;
|
||||
|
||||
for (; *cp; cp++) {
|
||||
if (p >= ep)
|
||||
break;
|
||||
#ifdef DSPMBYTE
|
||||
if (Ismbyte1(*cp) && ! (cp[1] == '\0'))
|
||||
{
|
||||
*p++ = attributes | *cp++; /* normal character */
|
||||
*p++ = attributes | *cp; /* normal character */
|
||||
l = NLSSize(cp, -1);
|
||||
if (l > 1) {
|
||||
while (l--)
|
||||
*p++ = attributes | *cp++;
|
||||
cp--;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
#endif /* DSPMBYTE */
|
||||
if ((*cp == '%') && ! (cp[1] == '\0')) {
|
||||
cp++;
|
||||
switch (*cp) {
|
||||
case 'R':
|
||||
if (what == FMT_HISTORY)
|
||||
fmthist('R', info, (char *) (cz = cbuff), sizeof(cbuff));
|
||||
else
|
||||
cz = (unsigned char *) str;
|
||||
if (what == FMT_HISTORY) {
|
||||
fmthist('R', info, (char *) cbuff, sizeof(cbuff));
|
||||
cz = cbuff;
|
||||
} else
|
||||
cz = (const unsigned char *) str;
|
||||
if (cz != NULL)
|
||||
for (; *cz; *p++ = attributes | *cz++)
|
||||
if (p >= ep) break;
|
||||
for (; *cz && p < ep; p++) {
|
||||
cz += one_mbtowc(p, (const char *)cz, MB_LEN_MAX);
|
||||
*p |= attributes;
|
||||
}
|
||||
break;
|
||||
case '#':
|
||||
*p++ = attributes | ((uid == 0) ? PRCHROOT : PRCH);
|
||||
@ -240,8 +240,10 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
eventno + 1);
|
||||
break;
|
||||
}
|
||||
for (cz = cbuff; *cz; *p++ = attributes | *cz++)
|
||||
if (p >= ep) break;
|
||||
for (cz = cbuff; *cz && p < ep; p++) {
|
||||
cz += one_mbtowc(p, (const char *)cz, MB_LEN_MAX);
|
||||
*p |= attributes;
|
||||
}
|
||||
break;
|
||||
case 'T': /* 24 hour format */
|
||||
case '@':
|
||||
@ -298,33 +300,37 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
case 'M':
|
||||
#ifndef HAVENOUTMP
|
||||
if (what == FMT_WHO)
|
||||
cz = (unsigned char *) who_info(info, 'M',
|
||||
cz = (const unsigned char *) who_info(info, 'M',
|
||||
(char *) cbuff, sizeof(cbuff));
|
||||
else
|
||||
#endif /* HAVENOUTMP */
|
||||
cz = (unsigned char *) getenv("HOST");
|
||||
cz = (const unsigned char *) getenv("HOST");
|
||||
/*
|
||||
* Bug pointed out by Laurent Dami <dami@cui.unige.ch>: don't
|
||||
* derefrence that NULL (if HOST is not set)...
|
||||
*/
|
||||
if (cz != NULL)
|
||||
for (; *cz ; *p++ = attributes | *cz++)
|
||||
if (p >= ep) break;
|
||||
for (; *cz && p < ep; p++) {
|
||||
cz += one_mbtowc(p, (const char *)cz, MB_LEN_MAX);
|
||||
*p |= attributes;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
#ifndef HAVENOUTMP
|
||||
if (what == FMT_WHO)
|
||||
cz = (unsigned char *) who_info(info, 'm', (char *) cbuff,
|
||||
sizeof(cbuff));
|
||||
cz = (const unsigned char *) who_info(info, 'm',
|
||||
(char *) cbuff, sizeof(cbuff));
|
||||
else
|
||||
#endif /* HAVENOUTMP */
|
||||
cz = (unsigned char *) getenv("HOST");
|
||||
cz = (const unsigned char *) getenv("HOST");
|
||||
|
||||
if (cz != NULL)
|
||||
for ( ; *cz && (what == FMT_WHO || *cz != '.')
|
||||
; *p++ = attributes | *cz++ )
|
||||
if (p >= ep) break;
|
||||
for (; *cz && (what == FMT_WHO || *cz != '.') && p < ep;
|
||||
p++) {
|
||||
cz += one_mbtowc(p, (const char *)cz, MB_LEN_MAX);
|
||||
*p |= attributes;
|
||||
}
|
||||
break;
|
||||
|
||||
/* lukem: new directory prompt code */
|
||||
@ -354,6 +360,7 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
if (Scp == '.' || Scp == 'C') {
|
||||
int skip;
|
||||
#ifdef WINNT_NATIVE
|
||||
Char *oldz = z;
|
||||
if (z[1] == ':') {
|
||||
*p++ = attributes | *z++;
|
||||
*p++ = attributes | *z++;
|
||||
@ -370,6 +377,18 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
while (*z) /* calc # of /'s */
|
||||
if (*z++ == '/')
|
||||
updirs++;
|
||||
|
||||
#ifdef WINNT_NATIVE
|
||||
/*
|
||||
* for format type c, prompt will be following...
|
||||
* c:/path => c:/path
|
||||
* c:/path/to => c:to
|
||||
* //machine/share => //machine/share
|
||||
* //machine/share/folder => //machine:folder
|
||||
*/
|
||||
if (oldz[0] == '/' && oldz[1] == '/' && updirs > 1)
|
||||
*p++ = attributes | ':';
|
||||
#endif /* WINNT_NATIVE */
|
||||
if ((Scp == 'C' && *q != '/'))
|
||||
updirs++;
|
||||
|
||||
@ -432,10 +451,12 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
case 'n':
|
||||
#ifndef HAVENOUTMP
|
||||
if (what == FMT_WHO) {
|
||||
cz = (unsigned char *) who_info(info, 'n',
|
||||
cz = (const unsigned char *) who_info(info, 'n',
|
||||
(char *) cbuff, sizeof(cbuff));
|
||||
for (; cz && *cz ; *p++ = attributes | *cz++)
|
||||
if (p >= ep) break;
|
||||
for (; *cz && p < ep; p++) {
|
||||
cz += one_mbtowc(p, (const char *)cz, MB_LEN_MAX);
|
||||
*p |= attributes;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* HAVENOUTMP */
|
||||
@ -448,10 +469,12 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
case 'l':
|
||||
#ifndef HAVENOUTMP
|
||||
if (what == FMT_WHO) {
|
||||
cz = (unsigned char *) who_info(info, 'l',
|
||||
cz = (const unsigned char *) who_info(info, 'l',
|
||||
(char *) cbuff, sizeof(cbuff));
|
||||
for (; cz && *cz ; *p++ = attributes | *cz++)
|
||||
if (p >= ep) break;
|
||||
for (; *cz && p < ep; p++) {
|
||||
cz += one_mbtowc(p, (const char *)cz, MB_LEN_MAX);
|
||||
*p |= attributes;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* HAVENOUTMP */
|
||||
@ -462,9 +485,11 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
for (cz = (unsigned char *) day_list[t->tm_wday]; *cz;
|
||||
*p++ = attributes | *cz++)
|
||||
if (p >= ep) break;
|
||||
for (cz = (const unsigned char *) day_list[t->tm_wday];
|
||||
*cz && p < ep; p++) {
|
||||
cz += one_mbtowc(p, (const char *)cz, MB_LEN_MAX);
|
||||
*p |= attributes;
|
||||
}
|
||||
break;
|
||||
case 'D':
|
||||
if (p >= ep - 3) break;
|
||||
@ -472,9 +497,11 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
break;
|
||||
case 'w':
|
||||
if (p >= ep - 5) break;
|
||||
for (cz = (unsigned char *) month_list[t->tm_mon]; *cz;
|
||||
*p++ = attributes | *cz++)
|
||||
if (p >= ep) break;
|
||||
for (cz = (const unsigned char *) month_list[t->tm_mon];
|
||||
*cz && p < ep; p++) {
|
||||
cz += one_mbtowc(p, (const char *)cz, MB_LEN_MAX);
|
||||
*p |= attributes;
|
||||
}
|
||||
break;
|
||||
case 'W':
|
||||
if (p >= ep - 3) break;
|
||||
@ -512,14 +539,14 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
|
||||
case 'j':
|
||||
{
|
||||
Char buf[128], *ebuf, *q;
|
||||
Char xbuf[128], *ebuf, *xq;
|
||||
int njobs = -1;
|
||||
struct process *pp;
|
||||
for (pp = proclist.p_next; pp; pp = pp->p_next)
|
||||
njobs++;
|
||||
/* make sure we have space */
|
||||
ebuf = Itoa(njobs, buf, 1, attributes);
|
||||
for (q = buf; q < ebuf; *p++ = *q++)
|
||||
for (xq = xbuf; xq < ebuf; *p++ = *xq++)
|
||||
if (p >= ep) break;
|
||||
break;
|
||||
}
|
||||
@ -554,10 +581,12 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
default:
|
||||
#ifndef HAVENOUTMP
|
||||
if (*cp == 'a' && what == FMT_WHO) {
|
||||
cz = (unsigned char *) who_info(info, 'a', (char *) cbuff,
|
||||
sizeof(cbuff));
|
||||
for (; cz && *cz; *p++ = attributes | *cz++)
|
||||
if (p >= ep) break;
|
||||
cz = (const unsigned char *) who_info(info, 'a',
|
||||
(char *) cbuff, sizeof(cbuff));
|
||||
for (; *cz && p < ep; p++) {
|
||||
cz += one_mbtowc(p, (const char *)cz, MB_LEN_MAX);
|
||||
*p |= attributes;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* HAVENOUTMP */
|
||||
@ -576,8 +605,10 @@ tprintf(what, buf, fmt, siz, str, tim, info)
|
||||
fmthist('h', info, (char *) cbuff, sizeof(cbuff));
|
||||
else
|
||||
(void) xsnprintf((char *) cbuff, sizeof(cbuff), "%d", eventno + 1);
|
||||
for (cz = cbuff; *cz; *p++ = attributes | *cz++)
|
||||
if (p >= ep) break;
|
||||
for (cz = cbuff; *cz && p < ep; p++) {
|
||||
cz += one_mbtowc(p, (const char *)cz, MB_LEN_MAX);
|
||||
*p |= attributes;
|
||||
}
|
||||
}
|
||||
else
|
||||
*p++ = attributes | *cp; /* normal character */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.sched.c,v 3.19 2002/03/08 17:36:47 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.sched.c,v 3.21 2004/11/23 02:10:50 christos Exp $ */
|
||||
/*
|
||||
* tc.sched.c: Scheduled command execution
|
||||
*
|
||||
@ -34,7 +34,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tc.sched.c,v 3.19 2002/03/08 17:36:47 christos Exp $")
|
||||
RCSID("$Id: tc.sched.c,v 3.21 2004/11/23 02:10:50 christos Exp $")
|
||||
|
||||
#include "ed.h"
|
||||
#include "tw.h"
|
||||
@ -61,14 +61,14 @@ sched_next()
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dosched(v, c)
|
||||
register Char **v;
|
||||
Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
register struct sched_event *tp, *tp1, *tp2;
|
||||
struct sched_event *tp, *tp1, *tp2;
|
||||
time_t cur_time;
|
||||
int count, hours, minutes, dif_hour, dif_min;
|
||||
Char *cp;
|
||||
bool relative; /* time specified as +hh:mm */
|
||||
int relative; /* time specified as +hh:mm */
|
||||
struct tm *ltp;
|
||||
|
||||
USE(c);
|
||||
@ -93,7 +93,7 @@ dosched(v, c)
|
||||
tprintf(FMT_SCHED, sbuf, fmt, sizeof(sbuf),
|
||||
short2str(buf), tp->t_when, (ptr_t) &count);
|
||||
for (cp = sbuf; *cp;)
|
||||
xputchar(*cp++);
|
||||
xputwchar(*cp++);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -200,11 +200,10 @@ sched_run(n)
|
||||
int n;
|
||||
{
|
||||
time_t cur_time;
|
||||
register struct sched_event *tp, *tp1;
|
||||
struct sched_event *tp, *tp1;
|
||||
struct wordent cmd, *nextword, *lastword;
|
||||
struct command *t;
|
||||
Char **v, *cp;
|
||||
extern Char GettingInput;
|
||||
#ifdef BSDSIGS
|
||||
sigmask_t omask;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.sig.c,v 3.26 2002/03/08 17:36:47 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.sig.c,v 3.29 2005/01/18 20:24:51 christos Exp $ */
|
||||
/*
|
||||
* tc.sig.c: Signal routine emulations
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tc.sig.c,v 3.26 2002/03/08 17:36:47 christos Exp $")
|
||||
RCSID("$Id: tc.sig.c,v 3.29 2005/01/18 20:24:51 christos Exp $")
|
||||
|
||||
#include "tc.wait.h"
|
||||
|
||||
@ -54,7 +54,7 @@ static int stk_ptr = -1;
|
||||
|
||||
/* queue child signals
|
||||
*/
|
||||
static sigret_t
|
||||
static RETSIGTYPE
|
||||
sig_ch_queue()
|
||||
{
|
||||
# ifdef JOBDEBUG
|
||||
@ -65,14 +65,11 @@ sig_ch_queue()
|
||||
stk[stk_ptr].s_pid = (pid_t) wait(&stk[stk_ptr].s_w);
|
||||
stk[stk_ptr].s_errno = errno;
|
||||
(void) signal(SIGCHLD, sig_ch_queue);
|
||||
# ifndef SIGVOID
|
||||
return(0);
|
||||
# endif /* SIGVOID */
|
||||
}
|
||||
|
||||
/* process all awaiting child signals
|
||||
*/
|
||||
static sigret_t
|
||||
static RETSIGTYPE
|
||||
sig_ch_rel()
|
||||
{
|
||||
while (stk_ptr > -1)
|
||||
@ -81,14 +78,11 @@ sig_ch_rel()
|
||||
xprintf("signal(SIGCHLD, pchild);\n");
|
||||
# endif /* JOBDEBUG */
|
||||
(void) signal(SIGCHLD, pchild);
|
||||
# ifndef SIGVOID
|
||||
return(0);
|
||||
# endif /* SIGVOID */
|
||||
}
|
||||
|
||||
|
||||
/* libc.a contains these functions in SYSVREL >= 3. */
|
||||
sigret_t
|
||||
RETSIGTYPE
|
||||
(*xsigset(a, b)) ()
|
||||
int a;
|
||||
signalfun_t b;
|
||||
@ -181,7 +175,7 @@ ourwait(w)
|
||||
|
||||
# ifdef COHERENT
|
||||
# undef signal
|
||||
sigret_t
|
||||
RETSIGTYPE
|
||||
(*xsignal(a, b)) ()
|
||||
int a;
|
||||
signalfun_t b;
|
||||
@ -221,7 +215,7 @@ sigpause(what)
|
||||
|
||||
#ifdef NEEDsignal
|
||||
/* turn into bsd signals */
|
||||
sigret_t
|
||||
RETSIGTYPE
|
||||
(*xsignal(s, a)) ()
|
||||
int s;
|
||||
signalfun_t a;
|
||||
@ -277,7 +271,7 @@ sigsetmask(mask)
|
||||
{
|
||||
sigset_t set, oset;
|
||||
int m;
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
(void) sigemptyset(&set);
|
||||
(void) sigemptyset(&oset);
|
||||
@ -293,7 +287,7 @@ sigsetmask(mask)
|
||||
|
||||
m = 0;
|
||||
for (i = 1; i <= MAXSIG; i++)
|
||||
if (sigismember(&oset, i))
|
||||
if (sigismember(&oset, i) == 1)
|
||||
SETBIT(m, i);
|
||||
|
||||
return (m);
|
||||
@ -313,7 +307,7 @@ sigblock(mask)
|
||||
{
|
||||
sigset_t set, oset;
|
||||
int m;
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
(void) sigemptyset(&set);
|
||||
(void) sigemptyset(&oset);
|
||||
@ -333,7 +327,7 @@ sigblock(mask)
|
||||
/* Return old mask to user. */
|
||||
m = 0;
|
||||
for (i = 1; i <= MAXSIG; i++)
|
||||
if (sigismember(&oset, i))
|
||||
if (sigismember(&oset, i) == 1)
|
||||
SETBIT(m, i);
|
||||
|
||||
return (m);
|
||||
@ -352,7 +346,7 @@ bsd_sigpause(mask)
|
||||
sigmask_t mask;
|
||||
{
|
||||
sigset_t set;
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
(void) sigemptyset(&set);
|
||||
|
||||
@ -367,7 +361,7 @@ bsd_sigpause(mask)
|
||||
*
|
||||
* Emulate bsd style signal()
|
||||
*/
|
||||
sigret_t (*bsd_signal(sig, func)) ()
|
||||
RETSIGTYPE (*bsd_signal(sig, func)) ()
|
||||
int sig;
|
||||
signalfun_t func;
|
||||
{
|
||||
@ -403,7 +397,7 @@ sigret_t (*bsd_signal(sig, func)) ()
|
||||
#ifdef SIGSYNCH
|
||||
static long Synch_Cnt = 0;
|
||||
|
||||
sigret_t
|
||||
RETSIGTYPE
|
||||
synch_handler(sno)
|
||||
int sno;
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.sig.h,v 3.26 2002/07/12 13:16:19 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.sig.h,v 3.28 2005/01/18 20:24:51 christos Exp $ */
|
||||
/*
|
||||
* tc.sig.h: Signal handling
|
||||
*
|
||||
@ -133,6 +133,9 @@ typedef struct sigvec sigvec_t;
|
||||
#if !defined(NSIG) && defined(_NSIG)
|
||||
# define NSIG _NSIG
|
||||
#endif /* !NSIG && _NSIG */
|
||||
#if !defined(NSIG)
|
||||
#define NSIG (sizeof(sigset_t) * 8)
|
||||
#endif /* !NSIG */
|
||||
#if !defined(MAXSIG) && defined(NSIG)
|
||||
# define MAXSIG NSIG
|
||||
#endif /* !MAXSIG && NSIG */
|
||||
@ -187,7 +190,7 @@ typedef struct sigvec sigvec_t;
|
||||
# else
|
||||
# define SYNCHMASK (sigmask(SIGCHLD))
|
||||
# endif
|
||||
extern sigret_t synch_handler();
|
||||
extern RETSIGTYPE synch_handler();
|
||||
#endif /* convex */
|
||||
|
||||
#ifdef SAVESIGVEC
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.str.c,v 3.13 2004/02/21 20:34:25 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.str.c,v 3.19 2005/01/06 16:56:26 christos Exp $ */
|
||||
/*
|
||||
* tc.str.c: Short string package
|
||||
* This has been a lesson of how to write buggy code!
|
||||
@ -33,17 +33,71 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tc.str.c,v 3.13 2004/02/21 20:34:25 christos Exp $")
|
||||
#include <limits.h>
|
||||
|
||||
RCSID("$Id: tc.str.c,v 3.19 2005/01/06 16:56:26 christos Exp $")
|
||||
|
||||
#define MALLOC_INCR 128
|
||||
#ifdef WIDE_STRINGS
|
||||
#define MALLOC_SURPLUS MB_LEN_MAX /* Space for one multibyte character */
|
||||
#else
|
||||
#define MALLOC_SURPLUS 0
|
||||
#endif
|
||||
|
||||
#ifdef WIDE_STRINGS
|
||||
size_t
|
||||
one_mbtowc(wchar_t *pwc, const char *s, size_t n)
|
||||
{
|
||||
int len;
|
||||
|
||||
len = rt_mbtowc(pwc, s, n);
|
||||
if (len == -1) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
*pwc = (unsigned char)*s | INVALID_BYTE;
|
||||
}
|
||||
if (len <= 0)
|
||||
len = 1;
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t
|
||||
one_wctomb(char *s, wchar_t wchar)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (wchar & INVALID_BYTE) {
|
||||
s[0] = wchar & 0xFF;
|
||||
len = 1;
|
||||
} else {
|
||||
len = wctomb(s, wchar);
|
||||
if (len == -1)
|
||||
s[0] = wchar;
|
||||
if (len <= 0)
|
||||
len = 1;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SHORT_STRINGS
|
||||
int
|
||||
rt_mbtowc(wchar_t *pwc, const char *s, size_t n)
|
||||
{
|
||||
int ret;
|
||||
char back[MB_LEN_MAX];
|
||||
|
||||
ret = mbtowc(pwc, s, n);
|
||||
if (ret > 0 && (wctomb(back, *pwc) != ret || memcmp(s, back, ret) != 0))
|
||||
ret = -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
Char **
|
||||
blk2short(src)
|
||||
register char **src;
|
||||
char **src;
|
||||
{
|
||||
size_t n;
|
||||
register Char **sdst, **dst;
|
||||
Char **sdst, **dst;
|
||||
|
||||
/*
|
||||
* Count
|
||||
@ -60,10 +114,10 @@ blk2short(src)
|
||||
|
||||
char **
|
||||
short2blk(src)
|
||||
register Char **src;
|
||||
Char **src;
|
||||
{
|
||||
size_t n;
|
||||
register char **sdst, **dst;
|
||||
char **sdst, **dst;
|
||||
|
||||
/*
|
||||
* Count
|
||||
@ -80,11 +134,11 @@ short2blk(src)
|
||||
|
||||
Char *
|
||||
str2short(src)
|
||||
register const char *src;
|
||||
const char *src;
|
||||
{
|
||||
static Char *sdst;
|
||||
static size_t dstsize = 0;
|
||||
register Char *dst, *edst;
|
||||
Char *dst, *edst;
|
||||
|
||||
if (src == NULL)
|
||||
return (NULL);
|
||||
@ -97,7 +151,8 @@ str2short(src)
|
||||
dst = sdst;
|
||||
edst = &dst[dstsize];
|
||||
while ((unsigned char) *src) {
|
||||
*dst++ = (Char) ((unsigned char) *src++);
|
||||
src += one_mbtowc(dst, src, MB_LEN_MAX);
|
||||
dst++;
|
||||
if (dst == edst) {
|
||||
dstsize += MALLOC_INCR;
|
||||
sdst = (Char *) xrealloc((ptr_t) sdst,
|
||||
@ -112,27 +167,30 @@ str2short(src)
|
||||
|
||||
char *
|
||||
short2str(src)
|
||||
register const Char *src;
|
||||
const Char *src;
|
||||
{
|
||||
static char *sdst = NULL;
|
||||
static size_t dstsize = 0;
|
||||
register char *dst, *edst;
|
||||
char *dst, *edst;
|
||||
|
||||
if (src == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (sdst == NULL) {
|
||||
dstsize = MALLOC_INCR;
|
||||
sdst = (char *) xmalloc((size_t) (dstsize * sizeof(char)));
|
||||
sdst = (char *) xmalloc((size_t) ((dstsize + MALLOC_SURPLUS)
|
||||
* sizeof(char)));
|
||||
}
|
||||
dst = sdst;
|
||||
edst = &dst[dstsize];
|
||||
while (*src) {
|
||||
*dst++ = (char) *src++;
|
||||
if (dst == edst) {
|
||||
dst += one_wctomb(dst, *src & CHAR);
|
||||
src++;
|
||||
if (dst >= edst) {
|
||||
dstsize += MALLOC_INCR;
|
||||
sdst = (char *) xrealloc((ptr_t) sdst,
|
||||
(size_t) (dstsize * sizeof(char)));
|
||||
(size_t) ((dstsize + MALLOC_SURPLUS)
|
||||
* sizeof(char)));
|
||||
edst = &sdst[dstsize];
|
||||
dst = &edst[-MALLOC_INCR];
|
||||
}
|
||||
@ -141,12 +199,13 @@ short2str(src)
|
||||
return (sdst);
|
||||
}
|
||||
|
||||
#ifndef WIDE_STRINGS
|
||||
Char *
|
||||
s_strcpy(dst, src)
|
||||
register Char *dst;
|
||||
register const Char *src;
|
||||
Char *dst;
|
||||
const Char *src;
|
||||
{
|
||||
register Char *sdst;
|
||||
Char *sdst;
|
||||
|
||||
sdst = dst;
|
||||
while ((*dst++ = *src++) != '\0')
|
||||
@ -156,11 +215,11 @@ s_strcpy(dst, src)
|
||||
|
||||
Char *
|
||||
s_strncpy(dst, src, n)
|
||||
register Char *dst;
|
||||
register const Char *src;
|
||||
register size_t n;
|
||||
Char *dst;
|
||||
const Char *src;
|
||||
size_t n;
|
||||
{
|
||||
register Char *sdst;
|
||||
Char *sdst;
|
||||
|
||||
if (n == 0)
|
||||
return(dst);
|
||||
@ -178,10 +237,10 @@ s_strncpy(dst, src, n)
|
||||
|
||||
Char *
|
||||
s_strcat(dst, src)
|
||||
register Char *dst;
|
||||
register const Char *src;
|
||||
Char *dst;
|
||||
const Char *src;
|
||||
{
|
||||
register short *sdst;
|
||||
Char *sdst;
|
||||
|
||||
sdst = dst;
|
||||
while (*dst++)
|
||||
@ -195,11 +254,11 @@ s_strcat(dst, src)
|
||||
#ifdef NOTUSED
|
||||
Char *
|
||||
s_strncat(dst, src, n)
|
||||
register Char *dst;
|
||||
register const Char *src;
|
||||
register size_t n;
|
||||
Char *dst;
|
||||
const Char *src;
|
||||
size_t n;
|
||||
{
|
||||
register Char *sdst;
|
||||
Char *sdst;
|
||||
|
||||
if (n == 0)
|
||||
return (dst);
|
||||
@ -224,36 +283,36 @@ s_strncat(dst, src, n)
|
||||
|
||||
Char *
|
||||
s_strchr(str, ch)
|
||||
register const Char *str;
|
||||
const Char *str;
|
||||
int ch;
|
||||
{
|
||||
do
|
||||
if (*str == ch)
|
||||
return ((Char *) str);
|
||||
return ((Char *)(intptr_t)str);
|
||||
while (*str++);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
Char *
|
||||
s_strrchr(str, ch)
|
||||
register const Char *str;
|
||||
const Char *str;
|
||||
int ch;
|
||||
{
|
||||
register const Char *rstr;
|
||||
const Char *rstr;
|
||||
|
||||
rstr = NULL;
|
||||
do
|
||||
if (*str == ch)
|
||||
rstr = str;
|
||||
while (*str++);
|
||||
return ((Char *) rstr);
|
||||
return ((Char *)(intptr_t)rstr);
|
||||
}
|
||||
|
||||
size_t
|
||||
s_strlen(str)
|
||||
register const Char *str;
|
||||
const Char *str;
|
||||
{
|
||||
register size_t n;
|
||||
size_t n;
|
||||
|
||||
for (n = 0; *str++; n++)
|
||||
continue;
|
||||
@ -262,7 +321,7 @@ s_strlen(str)
|
||||
|
||||
int
|
||||
s_strcmp(str1, str2)
|
||||
register const Char *str1, *str2;
|
||||
const Char *str1, *str2;
|
||||
{
|
||||
for (; *str1 && *str1 == *str2; str1++, str2++)
|
||||
continue;
|
||||
@ -283,8 +342,8 @@ s_strcmp(str1, str2)
|
||||
|
||||
int
|
||||
s_strncmp(str1, str2, n)
|
||||
register const Char *str1, *str2;
|
||||
register size_t n;
|
||||
const Char *str1, *str2;
|
||||
size_t n;
|
||||
{
|
||||
if (n == 0)
|
||||
return (0);
|
||||
@ -308,17 +367,26 @@ s_strncmp(str1, str2, n)
|
||||
} while (--n != 0);
|
||||
return(0);
|
||||
}
|
||||
#endif /* not WIDE_STRINGS */
|
||||
|
||||
int
|
||||
s_strcasecmp(str1, str2)
|
||||
register const Char *str1, *str2;
|
||||
const Char *str1, *str2;
|
||||
{
|
||||
#ifdef WIDE_STRINGS
|
||||
wchar_t l1 = 0, l2 = 0;
|
||||
for (; *str1 && ((*str1 == *str2 && (l1 = l2 = 0) == 0) ||
|
||||
(l1 = towlower(*str1)) == (l2 = towlower(*str2))); str1++, str2++)
|
||||
continue;
|
||||
|
||||
#else
|
||||
unsigned char c1, c2, l1 = 0, l2 = 0;
|
||||
for (; *str1 && ((*str1 == *str2 && (l1 = l2 = 0) == 0) ||
|
||||
((c1 = (unsigned char)*str1) == *str1 &&
|
||||
(c2 = (unsigned char)*str2) == *str2 &&
|
||||
(l1 = tolower(c1)) == (l2 = tolower(c2)))); str1++, str2++)
|
||||
continue;
|
||||
#endif
|
||||
/*
|
||||
* The following case analysis is necessary so that characters which look
|
||||
* negative collate low against normal characters but high against the
|
||||
@ -338,14 +406,14 @@ s_strcasecmp(str1, str2)
|
||||
|
||||
Char *
|
||||
s_strsave(s)
|
||||
register const Char *s;
|
||||
const Char *s;
|
||||
{
|
||||
Char *n;
|
||||
register Char *p;
|
||||
Char *p;
|
||||
|
||||
if (s == 0)
|
||||
s = STRNULL;
|
||||
for (p = (Char *) s; *p++;)
|
||||
for (p = (Char *)(intptr_t)s; *p++;)
|
||||
continue;
|
||||
n = p = (Char *) xmalloc((size_t)
|
||||
((((const Char *) p) - s) * sizeof(Char)));
|
||||
@ -359,48 +427,48 @@ s_strspl(cp, dp)
|
||||
const Char *cp, *dp;
|
||||
{
|
||||
Char *ep;
|
||||
register Char *p, *q;
|
||||
Char *p, *q;
|
||||
|
||||
if (!cp)
|
||||
cp = STRNULL;
|
||||
if (!dp)
|
||||
dp = STRNULL;
|
||||
for (p = (Char *) cp; *p++;)
|
||||
for (p = (Char *)(intptr_t) cp; *p++;)
|
||||
continue;
|
||||
for (q = (Char *) dp; *q++;)
|
||||
for (q = (Char *)(intptr_t) dp; *q++;)
|
||||
continue;
|
||||
ep = (Char *) xmalloc((size_t)
|
||||
(((((const Char *) p) - cp) +
|
||||
(((const Char *) q) - dp) - 1) * sizeof(Char)));
|
||||
for (p = ep, q = (Char*) cp; (*p++ = *q++) != '\0';)
|
||||
for (p = ep, q = (Char*)(intptr_t) cp; (*p++ = *q++) != '\0';)
|
||||
continue;
|
||||
for (p--, q = (Char *) dp; (*p++ = *q++) != '\0';)
|
||||
for (p--, q = (Char *)(intptr_t) dp; (*p++ = *q++) != '\0';)
|
||||
continue;
|
||||
return (ep);
|
||||
}
|
||||
|
||||
Char *
|
||||
s_strend(cp)
|
||||
register const Char *cp;
|
||||
const Char *cp;
|
||||
{
|
||||
if (!cp)
|
||||
return ((Char *) cp);
|
||||
return ((Char *)(intptr_t) cp);
|
||||
while (*cp)
|
||||
cp++;
|
||||
return ((Char *) cp);
|
||||
return ((Char *)(intptr_t) cp);
|
||||
}
|
||||
|
||||
Char *
|
||||
s_strstr(s, t)
|
||||
register const Char *s, *t;
|
||||
const Char *s, *t;
|
||||
{
|
||||
do {
|
||||
register const Char *ss = s;
|
||||
register const Char *tt = t;
|
||||
const Char *ss = s;
|
||||
const Char *tt = t;
|
||||
|
||||
do
|
||||
if (*tt == '\0')
|
||||
return ((Char *) s);
|
||||
return ((Char *)(intptr_t) s);
|
||||
while (*ss++ == *tt++);
|
||||
} while (*s++ != '\0');
|
||||
return (NULL);
|
||||
@ -410,18 +478,19 @@ s_strstr(s, t)
|
||||
|
||||
char *
|
||||
short2qstr(src)
|
||||
register const Char *src;
|
||||
const Char *src;
|
||||
{
|
||||
static char *sdst = NULL;
|
||||
static size_t dstsize = 0;
|
||||
register char *dst, *edst;
|
||||
char *dst, *edst;
|
||||
|
||||
if (src == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (sdst == NULL) {
|
||||
dstsize = MALLOC_INCR;
|
||||
sdst = (char *) xmalloc((size_t) (dstsize * sizeof(char)));
|
||||
sdst = (char *) xmalloc((size_t) ((dstsize + MALLOC_SURPLUS)
|
||||
* sizeof(char)));
|
||||
}
|
||||
dst = sdst;
|
||||
edst = &dst[dstsize];
|
||||
@ -431,16 +500,19 @@ short2qstr(src)
|
||||
if (dst == edst) {
|
||||
dstsize += MALLOC_INCR;
|
||||
sdst = (char *) xrealloc((ptr_t) sdst,
|
||||
(size_t) (dstsize * sizeof(char)));
|
||||
(size_t) ((dstsize + MALLOC_SURPLUS)
|
||||
* sizeof(char)));
|
||||
edst = &sdst[dstsize];
|
||||
dst = &edst[-MALLOC_INCR];
|
||||
}
|
||||
}
|
||||
*dst++ = (char) *src++;
|
||||
if (dst == edst) {
|
||||
dst += one_wctomb(dst, *src & CHAR);
|
||||
src++;
|
||||
if (dst >= edst) {
|
||||
dstsize += MALLOC_INCR;
|
||||
sdst = (char *) xrealloc((ptr_t) sdst,
|
||||
(size_t) (dstsize * sizeof(char)));
|
||||
(size_t) ((dstsize + MALLOC_SURPLUS)
|
||||
* sizeof(char)));
|
||||
edst = &sdst[dstsize];
|
||||
dst = &edst[-MALLOC_INCR];
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.vers.c,v 3.49 2002/05/16 13:51:26 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.vers.c,v 3.50 2004/08/04 17:12:31 christos Exp $ */
|
||||
/*
|
||||
* tc.vers.c: Version dependent stuff
|
||||
*/
|
||||
@ -33,7 +33,7 @@
|
||||
#include "sh.h"
|
||||
#include "tw.h"
|
||||
|
||||
RCSID("$Id: tc.vers.c,v 3.49 2002/05/16 13:51:26 christos Exp $")
|
||||
RCSID("$Id: tc.vers.c,v 3.50 2004/08/04 17:12:31 christos Exp $")
|
||||
|
||||
#include "patchlevel.h"
|
||||
|
||||
@ -45,7 +45,9 @@ RCSID("$Id: tc.vers.c,v 3.49 2002/05/16 13:51:26 christos Exp $")
|
||||
void
|
||||
fix_version()
|
||||
{
|
||||
#ifdef SHORT_STRINGS
|
||||
#ifdef WIDE_STRINGS
|
||||
# define SSSTR "wide"
|
||||
#elif defined (SHORT_STRINGS)
|
||||
# define SSSTR "8b"
|
||||
#else
|
||||
# define SSSTR "7b"
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.wait.h,v 3.13 2002/05/30 15:22:09 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.wait.h,v 3.14 2004/12/25 21:15:08 christos Exp $ */
|
||||
/*
|
||||
* tc.wait.h: <sys/wait.h> for machines that don't have it or have it and
|
||||
* is incorrect.
|
||||
@ -39,7 +39,7 @@
|
||||
* We try to use the system's wait.h when we can...
|
||||
*/
|
||||
|
||||
#if SYSVREL > 0 && !defined(linux)
|
||||
#if SYSVREL > 0 && !defined(linux) && !defined(__GNU__) && !defined(__GLIBC__)
|
||||
# ifdef hpux
|
||||
# ifndef __hpux
|
||||
# define NEEDwait
|
||||
@ -59,7 +59,7 @@
|
||||
# define NEEDwait
|
||||
# endif /* OREO || IRIS4D || POSIX */
|
||||
# endif /* hpux */
|
||||
#else /* SYSVREL == 0 || linux */
|
||||
#else /* SYSVREL == 0 || glibc */
|
||||
# ifdef _MINIX
|
||||
# undef NEEDwait
|
||||
# include "mi.wait.h"
|
||||
@ -68,7 +68,7 @@
|
||||
# include <sys/wait.h>
|
||||
# endif /* WINNT_NATIVE */
|
||||
# endif /* _MINIX */
|
||||
#endif /* SYSVREL == 0 || linux */
|
||||
#endif /* SYSVREL == 0 || glibc */
|
||||
|
||||
#ifdef NEEDwait
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tc.who.c,v 3.37 2002/11/21 20:02:01 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tc.who.c,v 3.44 2005/03/03 23:44:45 kim Exp $ */
|
||||
/*
|
||||
* tc.who.c: Watch logins and logouts...
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tc.who.c,v 3.37 2002/11/21 20:02:01 christos Exp $")
|
||||
RCSID("$Id: tc.who.c,v 3.44 2005/03/03 23:44:45 kim Exp $")
|
||||
|
||||
#include "tc.h"
|
||||
|
||||
@ -42,67 +42,80 @@ RCSID("$Id: tc.who.c,v 3.37 2002/11/21 20:02:01 christos Exp $")
|
||||
*/
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVEUTMPX
|
||||
#ifdef HAVE_UTMPX_H
|
||||
# include <utmpx.h>
|
||||
/* I just redefine a few words here. Changing every occurrence below
|
||||
* seems like too much of work. All UTMP functions have equivalent
|
||||
* UTMPX counterparts, so they can be added all here when needed.
|
||||
* Kimmo Suominen, Oct 14 1991
|
||||
*/
|
||||
# ifndef _PATH_UTMP
|
||||
# if defined(__UTMPX_FILE) && !defined(UTMPX_FILE)
|
||||
# define _PATH_UTMP __UTMPX_FILE
|
||||
# elif defined(_PATH_UTMPX)
|
||||
# define _PATH_UTMP _PATH_UTMPX
|
||||
# else
|
||||
# define _PATH_UTMP UTMPX_FILE
|
||||
# endif /* __UTMPX_FILE && !UTMPX_FILE */
|
||||
# endif /* _PATH_UTMP */
|
||||
# define utmp utmpx
|
||||
# ifdef __MVS__
|
||||
# define ut_time ut_tv.tv_sec
|
||||
# define ut_name ut_user
|
||||
# if defined(__UTMPX_FILE) && !defined(UTMPX_FILE)
|
||||
# define TCSH_PATH_UTMP __UTMPX_FILE
|
||||
# elif defined(_PATH_UTMPX)
|
||||
# define TCSH_PATH_UTMP _PATH_UTMPX
|
||||
# elif defined(UTMPX_FILE)
|
||||
# define TCSH_PATH_UTMP UTMPX_FILE
|
||||
# endif /* __UTMPX_FILE && !UTMPX_FILE */
|
||||
# ifdef TCSH_PATH_UTMP
|
||||
# define utmp utmpx
|
||||
# if defined(HAVE_STRUCT_UTMP_UT_TV)
|
||||
# define ut_time ut_tv.tv_sec
|
||||
# elif defined(HAVE_STRUCT_UTMP_UT_XTIME)
|
||||
# define ut_time ut_xtime
|
||||
# endif
|
||||
# ifdef HAVE_STRUCT_UTMP_UT_USER
|
||||
# define ut_name ut_user
|
||||
# endif
|
||||
# ifdef HAVE_GETUTENT
|
||||
# define getutent getutxent
|
||||
# define setutent setutxent
|
||||
# define endutent endutxent
|
||||
# endif /* HAVE_GETUTENT */
|
||||
# else
|
||||
# define ut_time ut_xtime
|
||||
# endif /* __MVS__ */
|
||||
#else /* !HAVEUTMPX */
|
||||
# ifndef WINNT_NATIVE
|
||||
# ifdef HAVE_UTMP_H
|
||||
# include <utmp.h>
|
||||
# endif /* WINNT_NATIVE */
|
||||
# endif /* TCSH_PATH_UTMP */
|
||||
#else /* !HAVE_UTMPX_H */
|
||||
# ifdef HAVE_UTMP_H
|
||||
# include <utmp.h>
|
||||
# endif /* WINNT_NATIVE */
|
||||
#endif /* HAVEUTMPX */
|
||||
#endif /* HAVE_UTMPX_H */
|
||||
|
||||
#ifndef BROKEN_CC
|
||||
# define UTNAMLEN sizeof(((struct utmp *) 0)->ut_name)
|
||||
# define UTLINLEN sizeof(((struct utmp *) 0)->ut_line)
|
||||
# ifdef UTHOST
|
||||
# ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
# ifdef _SEQUENT_
|
||||
# define UTHOSTLEN 100
|
||||
# else
|
||||
# define UTHOSTLEN sizeof(((struct utmp *) 0)->ut_host)
|
||||
# endif
|
||||
# endif /* UTHOST */
|
||||
# endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
||||
#else
|
||||
/* give poor cc a little help if it needs it */
|
||||
struct utmp __ut;
|
||||
|
||||
# define UTNAMLEN sizeof(__ut.ut_name)
|
||||
# define UTLINLEN sizeof(__ut.ut_line)
|
||||
# ifdef UTHOST
|
||||
# ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
# ifdef _SEQUENT_
|
||||
# define UTHOSTLEN 100
|
||||
# else
|
||||
# define UTHOSTLEN sizeof(__ut.ut_host)
|
||||
# endif
|
||||
# endif /* UTHOST */
|
||||
# endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
||||
#endif /* BROKEN_CC */
|
||||
|
||||
#ifndef _PATH_UTMP
|
||||
#ifndef TCSH_PATH_UTMP
|
||||
# ifdef UTMP_FILE
|
||||
# define _PATH_UTMP UTMP_FILE
|
||||
# define TCSH_PATH_UTMP UTMP_FILE
|
||||
# elif defined(_PATH_UTMP)
|
||||
# define TCSH_PATH_UTMP _PATH_UTMP
|
||||
# else
|
||||
# define _PATH_UTMP "/etc/utmp"
|
||||
# define TCSH_PATH_UTMP "/etc/utmp"
|
||||
# endif /* UTMP_FILE */
|
||||
#endif /* _PATH_UTMP */
|
||||
#endif /* TCSH_PATH_UTMP */
|
||||
|
||||
|
||||
struct who {
|
||||
@ -111,9 +124,9 @@ struct who {
|
||||
char who_name[UTNAMLEN + 1];
|
||||
char who_new[UTNAMLEN + 1];
|
||||
char who_tty[UTLINLEN + 1];
|
||||
#ifdef UTHOST
|
||||
#ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
char who_host[UTHOSTLEN + 1];
|
||||
#endif /* UTHOST */
|
||||
#endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
||||
time_t who_time;
|
||||
int who_status;
|
||||
};
|
||||
@ -165,8 +178,13 @@ void
|
||||
watch_login(force)
|
||||
int force;
|
||||
{
|
||||
int utmpfd, comp = -1, alldone;
|
||||
int comp = -1, alldone;
|
||||
int firsttime = stlast == 1;
|
||||
#ifdef HAVE_GETUTENT
|
||||
struct utmp *uptr;
|
||||
#else
|
||||
int utmpfd;
|
||||
#endif
|
||||
#ifdef BSDSIGS
|
||||
sigmask_t omask;
|
||||
#endif /* BSDSIGS */
|
||||
@ -176,7 +194,7 @@ watch_login(force)
|
||||
Char **vp = NULL;
|
||||
time_t t, interval = MAILINTVL;
|
||||
struct stat sta;
|
||||
#if defined(UTHOST) && defined(_SEQUENT_)
|
||||
#if defined(HAVE_STRUCT_UTMP_UT_HOST) && defined(_SEQUENT_)
|
||||
char *host, *ut_find_host();
|
||||
#endif
|
||||
#ifdef WINNT_NATIVE
|
||||
@ -242,11 +260,11 @@ watch_login(force)
|
||||
* From: Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de>
|
||||
* Don't open utmp all the time, stat it first...
|
||||
*/
|
||||
if (stat(_PATH_UTMP, &sta)) {
|
||||
if (stat(TCSH_PATH_UTMP, &sta)) {
|
||||
if (!force)
|
||||
xprintf(CGETS(26, 1,
|
||||
"cannot stat %s. Please \"unset watch\".\n"),
|
||||
_PATH_UTMP);
|
||||
TCSH_PATH_UTMP);
|
||||
# ifdef BSDSIGS
|
||||
(void) sigsetmask(omask);
|
||||
# else
|
||||
@ -263,11 +281,14 @@ watch_login(force)
|
||||
return;
|
||||
}
|
||||
stlast = sta.st_mtime;
|
||||
if ((utmpfd = open(_PATH_UTMP, O_RDONLY|O_LARGEFILE)) < 0) {
|
||||
#ifdef HAVE_GETUTENT
|
||||
setutent();
|
||||
#else
|
||||
if ((utmpfd = open(TCSH_PATH_UTMP, O_RDONLY|O_LARGEFILE)) < 0) {
|
||||
if (!force)
|
||||
xprintf(CGETS(26, 2,
|
||||
"%s cannot be opened. Please \"unset watch\".\n"),
|
||||
_PATH_UTMP);
|
||||
TCSH_PATH_UTMP);
|
||||
# ifdef BSDSIGS
|
||||
(void) sigsetmask(omask);
|
||||
# else
|
||||
@ -275,6 +296,7 @@ watch_login(force)
|
||||
# endif
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* xterm clears the entire utmp entry - mark everyone on the status list
|
||||
@ -289,7 +311,12 @@ watch_login(force)
|
||||
* Read in the utmp file, sort the entries, and update existing entries or
|
||||
* add new entries to the status list.
|
||||
*/
|
||||
#ifdef HAVE_GETUTENT
|
||||
while ((uptr = getutent()) != NULL) {
|
||||
memcpy(&utmp, uptr, sizeof (utmp));
|
||||
#else
|
||||
while (read(utmpfd, (char *) &utmp, sizeof utmp) == sizeof utmp) {
|
||||
#endif
|
||||
|
||||
# ifdef DEAD_PROCESS
|
||||
# ifndef IRIS4D
|
||||
@ -331,7 +358,7 @@ watch_login(force)
|
||||
}
|
||||
else {
|
||||
(void) strncpy(wp->who_new, utmp.ut_name, UTNAMLEN);
|
||||
# ifdef UTHOST
|
||||
# ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
# ifdef _SEQUENT_
|
||||
host = ut_find_host(wp->who_tty);
|
||||
if (host)
|
||||
@ -341,7 +368,7 @@ watch_login(force)
|
||||
# else
|
||||
(void) strncpy(wp->who_host, utmp.ut_host, UTHOSTLEN);
|
||||
# endif
|
||||
# endif /* UTHOST */
|
||||
# endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
||||
wp->who_time = utmp.ut_time;
|
||||
if (wp->who_name[0] == '\0')
|
||||
wp->who_status = ONLINE;
|
||||
@ -352,7 +379,7 @@ watch_login(force)
|
||||
else { /* new tty in utmp */
|
||||
wpnew = (struct who *) xcalloc(1, sizeof *wpnew);
|
||||
(void) strncpy(wpnew->who_tty, utmp.ut_line, UTLINLEN);
|
||||
# ifdef UTHOST
|
||||
# ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
# ifdef _SEQUENT_
|
||||
host = ut_find_host(wpnew->who_tty);
|
||||
if (host)
|
||||
@ -362,7 +389,7 @@ watch_login(force)
|
||||
# else
|
||||
(void) strncpy(wpnew->who_host, utmp.ut_host, UTHOSTLEN);
|
||||
# endif
|
||||
# endif /* UTHOST */
|
||||
# endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
||||
wpnew->who_time = utmp.ut_time;
|
||||
# ifdef DEAD_PROCESS
|
||||
if (utmp.ut_type == DEAD_PROCESS)
|
||||
@ -385,8 +412,12 @@ watch_login(force)
|
||||
wp->who_prev = wpnew; /* linked in now */
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_GETUTENT
|
||||
endutent();
|
||||
#else
|
||||
(void) close(utmpfd);
|
||||
# if defined(UTHOST) && defined(_SEQUENT_)
|
||||
#endif
|
||||
# if defined(HAVE_STRUCT_UTMP_UT_HOST) && defined(_SEQUENT_)
|
||||
endutent();
|
||||
# endif
|
||||
#endif /* !WINNT_NATIVE */
|
||||
@ -453,9 +484,9 @@ watch_login(force)
|
||||
#ifdef WHODEBUG
|
||||
static void
|
||||
debugwholist(new, wp)
|
||||
register struct who *new, *wp;
|
||||
struct who *new, *wp;
|
||||
{
|
||||
register struct who *a;
|
||||
struct who *a;
|
||||
|
||||
a = whohead.who_next;
|
||||
while (a->who_next != NULL) {
|
||||
@ -490,11 +521,11 @@ static void
|
||||
print_who(wp)
|
||||
struct who *wp;
|
||||
{
|
||||
#ifdef UTHOST
|
||||
#ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
Char *cp = str2short(CGETS(26, 7, "%n has %a %l from %m."));
|
||||
#else
|
||||
Char *cp = str2short(CGETS(26, 8, "%n has %a %l."));
|
||||
#endif /* UTHOST */
|
||||
#endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
||||
struct varent *vp = adrof(STRwho);
|
||||
Char buf[BUFSIZE];
|
||||
|
||||
@ -503,7 +534,7 @@ print_who(wp)
|
||||
|
||||
tprintf(FMT_WHO, buf, cp, BUFSIZE, NULL, wp->who_time, (ptr_t) wp);
|
||||
for (cp = buf; *cp;)
|
||||
xputchar(*cp++);
|
||||
xputwchar(*cp++);
|
||||
xputchar('\n');
|
||||
} /* end print_who */
|
||||
|
||||
@ -516,11 +547,11 @@ who_info(ptr, c, wbuf, wbufsiz)
|
||||
size_t wbufsiz;
|
||||
{
|
||||
struct who *wp = (struct who *) ptr;
|
||||
#ifdef UTHOST
|
||||
#ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
char *wb = wbuf;
|
||||
int flg;
|
||||
char *pb;
|
||||
#endif /* UTHOST */
|
||||
#endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
||||
|
||||
switch (c) {
|
||||
case 'n': /* user name */
|
||||
@ -550,19 +581,20 @@ who_info(ptr, c, wbuf, wbufsiz)
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef UTHOST
|
||||
#ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
case 'm':
|
||||
if (wp->who_host[0] == '\0')
|
||||
return CGETS(26, 12, "local");
|
||||
else {
|
||||
/* the ':' stuff is for <host>:<display>.<screen> */
|
||||
for (pb = wp->who_host, flg = Isdigit(*pb) ? '\0' : '.';
|
||||
*pb != '\0' &&
|
||||
(*pb != flg || ((pb = strchr(pb, ':')) != 0));
|
||||
for (pb = wp->who_host,
|
||||
flg = isdigit((unsigned char)*pb) ? '\0' : '.';
|
||||
*pb != '\0' && (*pb != flg || ((pb = strchr(pb, ':')) != 0));
|
||||
pb++) {
|
||||
if (*pb == ':')
|
||||
flg = '\0';
|
||||
*wb++ = Isupper(*pb) ? Tolower(*pb) : *pb;
|
||||
*wb++ = isupper((unsigned char)*pb) ?
|
||||
tolower((unsigned char)*pb) : *pb;
|
||||
}
|
||||
*wb = '\0';
|
||||
return wbuf;
|
||||
@ -573,11 +605,12 @@ who_info(ptr, c, wbuf, wbufsiz)
|
||||
return CGETS(26, 12, "local");
|
||||
else {
|
||||
for (pb = wp->who_host; *pb != '\0'; pb++)
|
||||
*wb++ = Isupper(*pb) ? Tolower(*pb) : *pb;
|
||||
*wb++ = isupper((unsigned char)*pb) ?
|
||||
tolower((unsigned char)*pb) : *pb;
|
||||
*wb = '\0';
|
||||
return wbuf;
|
||||
}
|
||||
#endif /* UTHOST */
|
||||
#endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
||||
|
||||
case 'l':
|
||||
return wp->who_tty;
|
||||
@ -613,7 +646,7 @@ struct command *c;
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef UTHOST
|
||||
# ifdef HAVE_STRUCT_UTMP_UT_HOST
|
||||
size_t
|
||||
utmphostsize()
|
||||
{
|
||||
@ -637,7 +670,7 @@ utmphost()
|
||||
resetwatch();
|
||||
return host;
|
||||
}
|
||||
# endif /* UTHOST */
|
||||
# endif /* HAVE_STRUCT_UTMP_UT_HOST */
|
||||
|
||||
#ifdef WINNT_NATIVE
|
||||
void add_to_who_list(name, mach_nm)
|
||||
|
@ -72,7 +72,7 @@
|
||||
.\" used here if you can. In particular, please don't use nroff commands
|
||||
.\" which aren't already used herein.
|
||||
.\"
|
||||
.TH TCSH 1 "19 May 2004" "Astron 6.13.00"
|
||||
.TH TCSH 1 "25 March 2005" "Astron 6.14.00"
|
||||
.SH NAME
|
||||
tcsh \- C shell with file name completion and command line editing
|
||||
.SH SYNOPSIS
|
||||
@ -175,6 +175,13 @@ Sets the \fBverbose\fR shell variable even before executing \fI~/.tcshrc\fR.
|
||||
.TP 4
|
||||
.B \-X
|
||||
Is to \fB\-x\fR as \fB\-V\fR is to \fB\-v\fR.
|
||||
.TP 4
|
||||
.B \-\-help
|
||||
Print a help message on the standard output and exit. (+)
|
||||
.TP 4
|
||||
.B \-\-version
|
||||
Print the version/platform/compilation options on the standard output and exit.
|
||||
This information is also contained in the \fBversion\fR shell variable. (+)
|
||||
.PP
|
||||
After processing of flag arguments, if arguments remain but none of the
|
||||
\fB\-c\fR, \fB\-i\fR, \fB\-s\fR, or \fB\-t\fR options were given, the first
|
||||
@ -1308,6 +1315,10 @@ quotes (`"') retain blanks and tabs; only newlines force new words. The single
|
||||
final newline does not force a new word in any case. It is thus possible for a
|
||||
command substitution to yield only part of a word, even if the command outputs
|
||||
a complete line.
|
||||
.PP
|
||||
By default, the shell since version 6.12 replaces all newline and carriage
|
||||
return characters in the command by spaces. If this is switched off by
|
||||
unsetting \fBcsubstnonl\fR, newlines separate commands as usual.
|
||||
.SS "Filename substitution"
|
||||
If a word contains any of the characters `*', `?', `[' or `{' or begins with
|
||||
the character `~' it is a candidate for filename substitution, also known as
|
||||
@ -1915,13 +1926,14 @@ The shell is eight bit clean
|
||||
and thus supports character sets needing this capability.
|
||||
NLS support differs depending on whether or not
|
||||
the shell was compiled to use the system's NLS (again, see \fBversion\fR).
|
||||
In either case, 7-bit ASCII is the default for character classification
|
||||
(e.g., which characters are printable) and sorting,
|
||||
In either case, 7-bit ASCII is the default character code
|
||||
(e.g., the classification of which characters are printable) and sorting,
|
||||
and changing the \fBLANG\fR or \fBLC_CTYPE\fR environment variables
|
||||
causes a check for possible changes in these respects.
|
||||
.PP
|
||||
When using the system's NLS, the \fIsetlocale\fR(3) function is called
|
||||
to determine appropriate character classification and sorting.
|
||||
to determine appropriate character code/classification and sorting
|
||||
(e.g., a 'en_CA.UTF-8' would yield "UTF-8" as a character code).
|
||||
This function typically examines the \fBLANG\fR and \fBLC_CTYPE\fR
|
||||
environment variables; refer to the system documentation for further details.
|
||||
When not using the system's NLS, the shell simulates it by assuming that the
|
||||
@ -2879,6 +2891,10 @@ the size of the largest core dump that will be created
|
||||
the maximum amount of physical memory a process
|
||||
may have allocated to it at a given time
|
||||
.TP
|
||||
\fIheapsize\fR
|
||||
the maximum amount of memory a process
|
||||
may allocate per \fIbrk()\fR system call
|
||||
.TP
|
||||
\fIdescriptors\fR or \fIopenfiles\fR
|
||||
the maximum number of open files for this process
|
||||
.TP
|
||||
@ -3299,6 +3315,12 @@ there is no default, execution continues after the \fIendsw\fR.
|
||||
.B telltc \fR(+)
|
||||
Lists the values of all terminal capabilities (see \fItermcap\fR(5)).
|
||||
.TP 8
|
||||
.B termname \fR[\fIterminal type\fR] \fR(+)
|
||||
Tests if \fIterminal type\fR (or the current value of \fBTERM\fR if no
|
||||
\fIterminal type\fR is given) has an entry in the hosts termcap(5) or
|
||||
terminfo(5) database. Prints the terminal type to stdout and returns 0
|
||||
if an entry is present otherwise returns 1.
|
||||
.TP 8
|
||||
.B time \fR[\fIcommand\fR]
|
||||
Executes \fIcommand\fR (which must be a simple command, not an alias,
|
||||
a pipeline, a command list or a parenthesized command list)
|
||||
@ -3338,6 +3360,8 @@ Removes the limitation on \fIresource\fR or, if no \fIresource\fR is
|
||||
specified, all \fIresource\fR limitations.
|
||||
With \fB\-h\fR, the corresponding hard limits are removed.
|
||||
Only the super-user may do this.
|
||||
Note that \fBunlimit\fR may not exit successful, since most systems
|
||||
do not allow \fIdescriptors\fR to be unlimited.
|
||||
.TP 8
|
||||
.B unset \fIpattern
|
||||
Removes all variables whose names match \fIpattern\fR, unless they are read-only.
|
||||
@ -3491,7 +3515,7 @@ desired interpreter (e.g., `/bin/csh' or `/usr/local/bin/tcsh').
|
||||
.SS "Special shell variables"
|
||||
The variables described in this section have special meaning to the shell.
|
||||
.PP
|
||||
The shell sets \fBaddsuffix\fR, \fBargv\fR, \fBautologout\fR, \fBcommand\fR, \fBecho_style\fR,
|
||||
The shell sets \fBaddsuffix\fR, \fBargv\fR, \fBautologout\fR, \fBcsubstnonl\fR, \fBcommand\fR, \fBecho_style\fR,
|
||||
\fBedit\fR, \fBgid\fR, \fBgroup\fR, \fBhome\fR, \fBloginsh\fR, \fBoid\fR, \fBpath\fR,
|
||||
\fBprompt\fR, \fBprompt2\fR, \fBprompt3\fR, \fBshell\fR, \fBshlvl\fR,
|
||||
\fBtcsh\fR, \fBterm\fR, \fBtty\fR, \fBuid\fR, \fBuser\fR and \fBversion\fR at
|
||||
@ -3601,6 +3625,10 @@ If set to `cmd', commands are automatically spelling-corrected.
|
||||
If set to `complete', commands are automatically completed.
|
||||
If set to `all', the entire command line is corrected.
|
||||
.TP 8
|
||||
.B csubstnonl \fR(+)
|
||||
If set, newlines and carriage returns in command substitution are
|
||||
replaced by spaces. Set by default.
|
||||
.TP 8
|
||||
.B cwd
|
||||
The full pathname of the current directory.
|
||||
See also the \fBdirstack\fR and \fBowd\fR shell variables.
|
||||
@ -3626,6 +3654,7 @@ but the first element (the current working directory) is always correct.
|
||||
See also the \fBcwd\fR and \fBowd\fR shell variables.
|
||||
.TP 8
|
||||
.B dspmbyte \fR(+)
|
||||
Has an affect iff 'dspm' is listed as part of the \fBversion\fR shell variable.
|
||||
If set to `euc', it enables display and editing EUC-kanji(Japanese) code.
|
||||
If set to `sjis', it enables display and editing Shift-JIS(Japanese) code.
|
||||
If set to `big5', it enables display and editing Big5(Chinese) code.
|
||||
@ -3662,7 +3691,7 @@ is set to number 0,1,2 and 3. Each number has the following meaning:
|
||||
.br
|
||||
If set to `001322', the first character (means 0x00 of the ASCII code) and
|
||||
second character (means 0x01 of ASCII code) are set to `0'. Then, it is not
|
||||
used for multi-byte characters. The 3rd character (0x02) is set to '2',
|
||||
used for multi-byte characters. The 3rd character (0x02) is set to '1',
|
||||
indicating that it is used for the first byte of a multi-byte character.
|
||||
The 4th character(0x03) is set '3'. It is used for both the first byte and
|
||||
the second byte of a multi-byte character. The 5th and 6th characters
|
||||
@ -4417,56 +4446,59 @@ Options which are set by default in the distribution are noted.
|
||||
.PP
|
||||
.RS +8
|
||||
.PD 0
|
||||
.TP 4
|
||||
.TP 6
|
||||
8b
|
||||
The shell is eight bit clean; default
|
||||
.TP 4
|
||||
.TP 6
|
||||
7b
|
||||
The shell is not eight bit clean
|
||||
.TP 4
|
||||
.TP 6
|
||||
wide
|
||||
The shell is multibyte encoding clean (like UTF-8)
|
||||
.TP 6
|
||||
nls
|
||||
The system's NLS is used; default for systems with NLS
|
||||
.TP 4
|
||||
.TP 6
|
||||
lf
|
||||
Login shells execute \fI/etc/csh.login\fR before instead of after
|
||||
\fI/etc/csh.cshrc\fR and \fI~/.login\fR before instead of after
|
||||
\fI~/.tcshrc\fR and \fI~/.history\fR.
|
||||
.TP 4
|
||||
.TP 6
|
||||
dl
|
||||
`.' is put last in \fBpath\fR for security; default
|
||||
.TP 4
|
||||
.TP 6
|
||||
nd
|
||||
`.' is omitted from \fBpath\fR for security
|
||||
.TP 4
|
||||
.TP 6
|
||||
vi
|
||||
\fIvi\fR-style editing is the default rather than \fIemacs\fR
|
||||
.TP 4
|
||||
.TP 6
|
||||
dtr
|
||||
Login shells drop DTR when exiting
|
||||
.TP 4
|
||||
.TP 6
|
||||
bye
|
||||
\fIbye\fR is a synonym for \fIlogout\fR and \fIlog\fR
|
||||
is an alternate name for \fIwatchlog\fR
|
||||
.TP 4
|
||||
.TP 6
|
||||
al
|
||||
\fBautologout\fR is enabled; default
|
||||
.TP 4
|
||||
.TP 6
|
||||
kan
|
||||
Kanji is used if appropriate according to locale settings,
|
||||
unless the \fBnokanji\fR shell variable is set
|
||||
.TP 4
|
||||
.TP 6
|
||||
sm
|
||||
The system's \fImalloc\fR(3) is used
|
||||
.TP 4
|
||||
.TP 6
|
||||
hb
|
||||
The `#!<program> <args>' convention is emulated when executing shell scripts
|
||||
.TP 4
|
||||
.TP 6
|
||||
ng
|
||||
The \fInewgrp\fR builtin is available
|
||||
.TP 4
|
||||
.TP 6
|
||||
rh
|
||||
The shell attempts to set the \fBREMOTEHOST\fR environment variable
|
||||
.TP 4
|
||||
.TP 6
|
||||
afs
|
||||
The shell verifies your password with the kerberos server if local
|
||||
authentication fails. The \fBafsuser\fR shell variable or the
|
||||
@ -4967,12 +4999,12 @@ the expression is false and the command is not executed.
|
||||
and does not handle control characters in filenames well. It cannot be
|
||||
interrupted.
|
||||
.PP
|
||||
Report bugs to tcsh-bugs@mx.gw.com, preferably with fixes. If you want to
|
||||
help maintain and test tcsh, send mail to listserv@mx.gw.com with the text
|
||||
`subscribe tcsh <your name>' on a line by itself in the body. You can
|
||||
also `subscribe tcsh-bugs <your name>' to get all bug reports, or
|
||||
`subscribe tcsh-diffs <your name>' to get the development list plus
|
||||
diffs for each patchlevel.
|
||||
Command substitution supports multiple commands and conditions, but not
|
||||
cycles or backward \fIgoto\fRs.
|
||||
.PP
|
||||
Report bugs at http://bugs.gw.com/, preferably with fixes. If you want to
|
||||
help maintain and test tcsh, send mail to tcsh-request@mx.gw.com with the
|
||||
text `subscribe tcsh' on a line by itself in the body.
|
||||
.SH THE T IN TCSH
|
||||
In 1964, DEC produced the PDP-6. The PDP-10 was a later re-implementation. It
|
||||
was re-christened the DECsystem-10 in 1970 or so when DEC brought out the
|
||||
@ -5019,7 +5051,7 @@ pipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2),
|
||||
malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7),
|
||||
termio(7), Introduction to the C Shell
|
||||
.SH VERSION
|
||||
This manual documents tcsh 6.13.00 (Astron) 2004-05-19.
|
||||
This manual documents tcsh 6.14.00 (Astron) 2005-03-25.
|
||||
.SH AUTHORS
|
||||
.PD 0
|
||||
.TP 2
|
||||
|
@ -1,5 +1,5 @@
|
||||
: # -*- perl -*-
|
||||
# $Id: tcsh.man2html,v 1.12 2001/04/28 05:20:42 kim Exp $
|
||||
# $Id: tcsh.man2html,v 1.13 2005/03/25 17:36:08 kim Exp $
|
||||
|
||||
# tcsh.man2html, Dave Schweisguth <dcs@proton.chem.yale.edu>
|
||||
#
|
||||
@ -800,22 +800,16 @@ There are three <I>tcsh</I> mailing lists:
|
||||
<DD>
|
||||
The <I>tcsh</I> maintainers and testers' mailing list.
|
||||
<DT>
|
||||
<I>tcsh-diffs@mx.gw.com</I>
|
||||
<DD>
|
||||
The same as <I>tcsh@mx.gw.com</I>, plus diffs for each new
|
||||
patchlevel of <I>tcsh</I>.
|
||||
<DT>
|
||||
<I>tcsh-bugs@mx.gw.com</I>
|
||||
<DD>
|
||||
Bug reports.
|
||||
Open bug and user comment discussion.
|
||||
</DL>
|
||||
You can subscribe to any of these lists by sending mail to
|
||||
<I><A HREF="mailto:listserv@mx.gw.com">listserv@mx.gw.com</A></I> with the
|
||||
text "subscribe <list name> <your name>" on a line by
|
||||
itself in the body. <list name> is the name of the mailing list,
|
||||
without "@mx.gw.com", and <your name> is your real name, not your
|
||||
email address. You can also ask the list server for help by sending
|
||||
only the word "help".
|
||||
You can subscribe to either of these lists by visiting
|
||||
<I><A HREF="http://mx.gw.com/">http://mx.gw.com/</A></I>
|
||||
<P>
|
||||
To file a bug report or a feature suggestion (preferably
|
||||
with code), please visit
|
||||
<I><A HREF="http://bugs.gw.com/">http://bugs.gw.com/</A></I>
|
||||
<P>
|
||||
<A HREF="TOPFILEHERE">Up</A>
|
||||
</BODY>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tw.color.c,v 1.12 2004/01/23 16:21:33 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tw.color.c,v 1.18 2005/03/03 16:40:53 kim Exp $ */
|
||||
/*
|
||||
* tw.color.c: builtin color ls-F
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tw.color.c,v 1.12 2004/01/23 16:21:33 christos Exp $")
|
||||
RCSID("$Id: tw.color.c,v 1.18 2005/03/03 16:40:53 kim Exp $")
|
||||
|
||||
#include "tw.h"
|
||||
#include "ed.h"
|
||||
@ -41,7 +41,7 @@ RCSID("$Id: tw.color.c,v 1.12 2004/01/23 16:21:33 christos Exp $")
|
||||
#ifdef COLOR_LS_F
|
||||
|
||||
typedef struct {
|
||||
char *s;
|
||||
const char *s;
|
||||
int len;
|
||||
} Str;
|
||||
|
||||
@ -95,15 +95,15 @@ typedef struct {
|
||||
} Extension;
|
||||
|
||||
static Extension *extensions = NULL;
|
||||
static int nextensions = 0;
|
||||
static size_t nextensions = 0;
|
||||
|
||||
static char *colors = NULL;
|
||||
bool color_context_ls = FALSE; /* do colored ls */
|
||||
static bool color_context_lsmF = FALSE; /* do colored ls-F */
|
||||
int color_context_ls = FALSE; /* do colored ls */
|
||||
static int color_context_lsmF = FALSE; /* do colored ls-F */
|
||||
|
||||
static bool getstring __P((char **, const Char **, Str *, int));
|
||||
static int getstring __P((char **, const Char **, Str *, int));
|
||||
static void put_color __P((Str *));
|
||||
static void print_color __P((Char *, size_t, int));
|
||||
static void print_color __P((Char *, size_t, Char));
|
||||
|
||||
/* set_color_context():
|
||||
*/
|
||||
@ -134,7 +134,7 @@ set_color_context()
|
||||
|
||||
/* getstring():
|
||||
*/
|
||||
static bool
|
||||
static int
|
||||
getstring(dp, sp, pd, f)
|
||||
char **dp; /* dest buffer */
|
||||
const Char **sp; /* source buffer */
|
||||
@ -143,24 +143,23 @@ getstring(dp, sp, pd, f)
|
||||
{
|
||||
const Char *s = *sp;
|
||||
char *d = *dp;
|
||||
int sc;
|
||||
eChar sc;
|
||||
|
||||
while (*s && (*s & CHAR) != f && (*s & CHAR) != ':') {
|
||||
while (*s && (*s & CHAR) != (Char)f && (*s & CHAR) != ':') {
|
||||
if ((*s & CHAR) == '\\' || (*s & CHAR) == '^') {
|
||||
if ((sc = parseescape(&s)) == -1)
|
||||
if ((sc = parseescape(&s)) == CHAR_ERR)
|
||||
return 0;
|
||||
else
|
||||
*d++ = (char) sc;
|
||||
}
|
||||
else
|
||||
*d++ = *s++ & CHAR;
|
||||
sc = *s++ & CHAR;
|
||||
d += one_wctomb(d, sc);
|
||||
}
|
||||
|
||||
pd->s = *dp;
|
||||
pd->len = (int) (d - *dp);
|
||||
*sp = s;
|
||||
*dp = d;
|
||||
return *s == f;
|
||||
return *s == (Char)f;
|
||||
}
|
||||
|
||||
|
||||
@ -171,11 +170,10 @@ void
|
||||
parseLS_COLORS(value)
|
||||
Char *value; /* LS_COLOR variable's value */
|
||||
{
|
||||
int i;
|
||||
size_t len;
|
||||
size_t i, len;
|
||||
const Char *v; /* pointer in value */
|
||||
char *c; /* pointer in colors */
|
||||
Extension *e; /* pointer in extensions */
|
||||
Extension *volatile e; /* pointer in extensions */
|
||||
jmp_buf_t osetexit;
|
||||
|
||||
(void) &e;
|
||||
@ -234,8 +232,8 @@ parseLS_COLORS(value)
|
||||
default: /* :vl=color: */
|
||||
if (v[0] && v[1] && (v[2] & CHAR) == '=') {
|
||||
for (i = 0; i < nvariables; i++)
|
||||
if (variables[i].variable[0] == (v[0] & CHAR) &&
|
||||
variables[i].variable[1] == (v[1] & CHAR))
|
||||
if ((Char)variables[i].variable[0] == (v[0] & CHAR) &&
|
||||
(Char)variables[i].variable[1] == (v[1] & CHAR))
|
||||
break;
|
||||
if (i < nvariables) {
|
||||
v += 3;
|
||||
@ -264,10 +262,9 @@ static void
|
||||
put_color(color)
|
||||
Str *color;
|
||||
{
|
||||
extern bool output_raw; /* PWP: in sh.print.c */
|
||||
size_t i;
|
||||
char *c = color->s;
|
||||
bool original_output_raw = output_raw;
|
||||
const char *c = color->s;
|
||||
int original_output_raw = output_raw;
|
||||
|
||||
output_raw = TRUE;
|
||||
for (i = color->len; 0 < i; i--)
|
||||
@ -282,9 +279,9 @@ static void
|
||||
print_color(fname, len, suffix)
|
||||
Char *fname;
|
||||
size_t len;
|
||||
int suffix;
|
||||
Char suffix;
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
char *filename = short2str(fname);
|
||||
char *last = filename + len;
|
||||
Str *color = &variables[VFile].color;
|
||||
@ -301,7 +298,7 @@ print_color(fname, len, suffix)
|
||||
default:
|
||||
for (i = 0; i < nvariables; i++)
|
||||
if (variables[i].suffix != NOS &&
|
||||
variables[i].suffix == suffix) {
|
||||
(Char)variables[i].suffix == suffix) {
|
||||
color = &variables[i].color;
|
||||
break;
|
||||
}
|
||||
@ -329,7 +326,7 @@ void
|
||||
print_with_color(filename, len, suffix)
|
||||
Char *filename;
|
||||
size_t len;
|
||||
int suffix;
|
||||
Char suffix;
|
||||
{
|
||||
if (color_context_lsmF &&
|
||||
(haderr ? (didfds ? is2atty : isdiagatty) :
|
||||
@ -343,10 +340,10 @@ print_with_color(filename, len, suffix)
|
||||
put_color(&variables[VNormal].color);
|
||||
put_color(&variables[VRight].color);
|
||||
}
|
||||
xputchar(suffix);
|
||||
}
|
||||
else
|
||||
xprintf("\045S%c", filename, suffix);
|
||||
xprintf("%S", filename);
|
||||
xputwchar(suffix);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tw.comp.c,v 1.34 2004/02/21 20:34:25 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tw.comp.c,v 1.37 2004/11/23 02:10:50 christos Exp $ */
|
||||
/*
|
||||
* tw.comp.c: File completion builtin
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tw.comp.c,v 1.34 2004/02/21 20:34:25 christos Exp $")
|
||||
RCSID("$Id: tw.comp.c,v 1.37 2004/11/23 02:10:50 christos Exp $")
|
||||
|
||||
#include "tw.h"
|
||||
#include "ed.h"
|
||||
@ -44,12 +44,12 @@ struct varent completions;
|
||||
static int tw_result __P((Char *, Char **));
|
||||
static Char **tw_find __P((Char *, struct varent *, int));
|
||||
static Char *tw_tok __P((Char *));
|
||||
static bool tw_pos __P((Char *, int));
|
||||
static int tw_pos __P((Char *, int));
|
||||
static void tw_pr __P((Char **));
|
||||
static int tw_match __P((Char *, Char *));
|
||||
static void tw_prlist __P((struct varent *));
|
||||
static Char *tw_dollar __P((Char *,Char **, int, Char *,
|
||||
int, const char *));
|
||||
Char, const char *));
|
||||
|
||||
/* docomplete():
|
||||
* Add or list completions in the completion list
|
||||
@ -60,8 +60,8 @@ docomplete(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
register struct varent *vp;
|
||||
register Char *p;
|
||||
struct varent *vp;
|
||||
Char *p;
|
||||
Char **pp;
|
||||
|
||||
USE(t);
|
||||
@ -109,7 +109,7 @@ static void
|
||||
tw_prlist(p)
|
||||
struct varent *p;
|
||||
{
|
||||
register struct varent *c;
|
||||
struct varent *c;
|
||||
|
||||
if (setintr)
|
||||
#ifdef BSDSIGS
|
||||
@ -149,7 +149,7 @@ static void
|
||||
tw_pr(cmp)
|
||||
Char **cmp;
|
||||
{
|
||||
bool sp, osp;
|
||||
int sp, osp;
|
||||
Char *ptr;
|
||||
|
||||
for (; *cmp; cmp++) {
|
||||
@ -158,7 +158,7 @@ tw_pr(cmp)
|
||||
sp = Isspace(*ptr);
|
||||
if (sp && osp)
|
||||
continue;
|
||||
xputchar(*ptr);
|
||||
xputwchar(*ptr);
|
||||
osp = sp;
|
||||
}
|
||||
xputchar('\'');
|
||||
@ -175,10 +175,10 @@ tw_pr(cmp)
|
||||
static Char **
|
||||
tw_find(nam, vp, cmd)
|
||||
Char *nam;
|
||||
register struct varent *vp;
|
||||
struct varent *vp;
|
||||
int cmd;
|
||||
{
|
||||
register Char **rv;
|
||||
Char **rv;
|
||||
|
||||
for (vp = vp->v_left; vp; vp = vp->v_right) {
|
||||
if (vp->v_left && (rv = tw_find(nam, vp, cmd)) != NULL)
|
||||
@ -200,7 +200,7 @@ tw_find(nam, vp, cmd)
|
||||
/* tw_pos():
|
||||
* Return true if the position is within the specified range
|
||||
*/
|
||||
static bool
|
||||
static int
|
||||
tw_pos(ran, wno)
|
||||
Char *ran;
|
||||
int wno;
|
||||
@ -245,7 +245,7 @@ tw_tok(str)
|
||||
continue;
|
||||
|
||||
for (str = bf; *bf && !Isspace(*bf); bf++) {
|
||||
if (ismeta(*bf))
|
||||
if (ismetahash(*bf))
|
||||
return INVPTR;
|
||||
*bf = *bf & ~QUOTE;
|
||||
}
|
||||
@ -422,7 +422,7 @@ tw_dollar(str, wl, nwl, buffer, sep, msg)
|
||||
Char *str, **wl;
|
||||
int nwl;
|
||||
Char *buffer;
|
||||
int sep;
|
||||
Char sep;
|
||||
const char *msg;
|
||||
{
|
||||
Char *sp, *bp = buffer, *ebp = &buffer[MAXPATHLEN];
|
||||
@ -454,7 +454,8 @@ tw_dollar(str, wl, nwl, buffer, sep, msg)
|
||||
if (*sp++ == sep)
|
||||
return sp;
|
||||
|
||||
stderror(ERR_COMPMIS, sep, msg, short2str(str));
|
||||
/* Truncates data if WIDE_STRINGS */
|
||||
stderror(ERR_COMPMIS, (int)sep, msg, short2str(str));
|
||||
return --sp;
|
||||
} /* end tw_dollar */
|
||||
|
||||
@ -530,7 +531,8 @@ tw_complete(line, word, pat, looking, suf)
|
||||
Char ran[MAXPATHLEN+1],/* The pattern or range X/<range>/XXXX/ */
|
||||
com[MAXPATHLEN+1],/* The completion X/XXXXX/<completion>/ */
|
||||
*pos = NULL; /* scratch pointer */
|
||||
int cmd, sep; /* the command and separator characters */
|
||||
int cmd;
|
||||
Char sep; /* the command and separator characters */
|
||||
|
||||
if (ptr[0] == '\0')
|
||||
continue;
|
||||
@ -559,7 +561,8 @@ tw_complete(line, word, pat, looking, suf)
|
||||
|
||||
sep = ptr[1];
|
||||
if (!Ispunct(sep)) {
|
||||
stderror(ERR_COMPINV, CGETS(27, 2, "separator"), sep);
|
||||
/* Truncates data if WIDE_STRINGS */
|
||||
stderror(ERR_COMPINV, CGETS(27, 2, "separator"), (int)sep);
|
||||
return TW_ZERO;
|
||||
}
|
||||
|
||||
@ -584,7 +587,7 @@ tw_complete(line, word, pat, looking, suf)
|
||||
*suf = '\0';
|
||||
|
||||
#ifdef TDEBUG
|
||||
xprintf("command: %c\nseparator: %c\n", cmd, sep);
|
||||
xprintf("command: %c\nseparator: %c\n", cmd, (int)sep);
|
||||
xprintf("pattern: %s\n", short2str(ran));
|
||||
xprintf("completion: %s\n", short2str(com));
|
||||
xprintf("suffix: ");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tw.decls.h,v 3.18 2002/03/08 17:36:47 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tw.decls.h,v 3.20 2004/08/08 06:42:29 christos Exp $ */
|
||||
/*
|
||||
* tw.decls.h: Tenex external declarations
|
||||
*/
|
||||
@ -50,11 +50,11 @@ extern int t_search __P((Char *, Char *, COMMAND,
|
||||
#endif
|
||||
extern int starting_a_command __P((Char *, Char *));
|
||||
extern void copyn __P((Char *, Char *, int));
|
||||
extern void catn __P((Char *, Char *, int));
|
||||
extern void catn __P((Char *, const Char *, int));
|
||||
extern int fcompare __P((Char **, Char **));
|
||||
extern void print_by_column __P((Char *, Char *[], int,
|
||||
int));
|
||||
extern int StrQcmp __P((Char *, Char *));
|
||||
extern int StrQcmp __P((const Char *, const Char *));
|
||||
extern Char *tgetenv __P((Char *));
|
||||
|
||||
/*
|
||||
@ -117,7 +117,7 @@ extern int tw_complete __P((Char *, Char **,
|
||||
* tw.color.c
|
||||
*/
|
||||
extern void set_color_context __P((void));
|
||||
extern void print_with_color __P((Char *, size_t, int));
|
||||
extern void print_with_color __P((Char *, size_t, Char));
|
||||
extern void parseLS_COLORS __P((Char *));
|
||||
#endif /* COLOR_LS_F */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tw.h,v 3.22 2002/03/08 17:36:47 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tw.h,v 3.24 2004/11/23 02:10:50 christos Exp $ */
|
||||
/*
|
||||
* tw.h: TwENEX functions headers
|
||||
*/
|
||||
@ -101,6 +101,12 @@ extern int non_unique_match;
|
||||
|
||||
extern int match_unique_match;
|
||||
|
||||
extern int InsideCompletion;
|
||||
|
||||
extern struct varent completions;
|
||||
|
||||
extern int color_context_ls;
|
||||
|
||||
#include "tw.decls.h"
|
||||
|
||||
#endif /* _h_tw */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tw.help.c,v 3.19 2002/11/21 20:02:01 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tw.help.c,v 3.21 2005/01/18 20:24:51 christos Exp $ */
|
||||
/* tw.help.c: actually look up and print documentation on a file.
|
||||
* Look down the path for an appropriate file, then print it.
|
||||
* Note that the printing is NOT PAGED. This is because the
|
||||
@ -35,18 +35,18 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tw.help.c,v 3.19 2002/11/21 20:02:01 christos Exp $")
|
||||
RCSID("$Id: tw.help.c,v 3.21 2005/01/18 20:24:51 christos Exp $")
|
||||
|
||||
#include "tw.h"
|
||||
#include "tc.h"
|
||||
|
||||
|
||||
static int f = -1;
|
||||
static sigret_t cleanf __P((int));
|
||||
static RETSIGTYPE cleanf __P((int));
|
||||
static Char *skipslist __P((Char *));
|
||||
static void nextslist __P((Char *, Char *));
|
||||
|
||||
static char *h_ext[] = {
|
||||
static const char *h_ext[] = {
|
||||
".help", ".1", ".8", ".6", "", NULL
|
||||
};
|
||||
|
||||
@ -56,11 +56,11 @@ do_help(command)
|
||||
{
|
||||
Char name[FILSIZ + 1];
|
||||
Char *cmd_p, *ep;
|
||||
char **sp;
|
||||
const char **sp;
|
||||
|
||||
signalfun_t orig_intr;
|
||||
Char curdir[MAXPATHLEN]; /* Current directory being looked at */
|
||||
register Char *hpath; /* The environment parameter */
|
||||
Char *hpath; /* The environment parameter */
|
||||
Char full[MAXPATHLEN];
|
||||
char buf[512]; /* full path name and buffer for read */
|
||||
int len; /* length of read buffer */
|
||||
@ -143,7 +143,7 @@ do_help(command)
|
||||
}
|
||||
}
|
||||
|
||||
static sigret_t
|
||||
static RETSIGTYPE
|
||||
/*ARGSUSED*/
|
||||
cleanf(snum)
|
||||
int snum;
|
||||
@ -156,9 +156,6 @@ int snum;
|
||||
if (f != -1)
|
||||
(void) close(f);
|
||||
f = -1;
|
||||
#ifndef SIGVOID
|
||||
return (snum);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* these next two are stolen from CMU's man(1) command for looking down
|
||||
@ -173,8 +170,8 @@ int snum;
|
||||
|
||||
static void
|
||||
nextslist(sl, np)
|
||||
register Char *sl;
|
||||
register Char *np;
|
||||
Char *sl;
|
||||
Char *np;
|
||||
{
|
||||
if (!*sl)
|
||||
*np = '\000';
|
||||
@ -195,7 +192,7 @@ nextslist(sl, np)
|
||||
|
||||
static Char *
|
||||
skipslist(sl)
|
||||
register Char *sl;
|
||||
Char *sl;
|
||||
{
|
||||
while (*sl && *sl++ != ':')
|
||||
continue;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tw.init.c,v 3.29 2002/06/25 19:02:12 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tw.init.c,v 3.34 2005/01/05 16:06:15 christos Exp $ */
|
||||
/*
|
||||
* tw.init.c: Handle lists of things to complete
|
||||
*/
|
||||
@ -32,20 +32,13 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tw.init.c,v 3.29 2002/06/25 19:02:12 christos Exp $")
|
||||
RCSID("$Id: tw.init.c,v 3.34 2005/01/05 16:06:15 christos Exp $")
|
||||
|
||||
#include "tw.h"
|
||||
#include "ed.h"
|
||||
#include "tc.h"
|
||||
#include "sh.proc.h"
|
||||
|
||||
#if !defined(NSIG) && defined(SIGMAX)
|
||||
# define NSIG (SIGMAX+1)
|
||||
#endif /* !NSIG && SIGMAX */
|
||||
#if !defined(NSIG) && defined(_NSIG)
|
||||
# define NSIG _NSIG
|
||||
#endif /* !NSIG && _NSIG */
|
||||
|
||||
#define TW_INCR 128
|
||||
|
||||
typedef struct {
|
||||
@ -111,7 +104,7 @@ static sigmask_t tw_omask;
|
||||
static Char *tw_str_add __P((stringlist_t *, int));
|
||||
static void tw_str_free __P((stringlist_t *));
|
||||
static Char *tw_dir_next __P((DIR *));
|
||||
static void tw_cmd_add __P((Char *name));
|
||||
static void tw_cmd_add __P((const Char *name));
|
||||
static void tw_cmd_cmd __P((void));
|
||||
static void tw_cmd_builtin __P((void));
|
||||
static void tw_cmd_alias __P((void));
|
||||
@ -150,7 +143,7 @@ tw_str_add(sl, len)
|
||||
(Char *) xmalloc((size_t) (sl->tbuff * sizeof(Char)));
|
||||
/* Re-thread the new pointer list, if changed */
|
||||
if (ptr != NULL && ptr != sl->buff) {
|
||||
int offs = (int) (sl->buff - ptr);
|
||||
intptr_t offs = sl->buff - ptr;
|
||||
for (i = 0; i < sl->nlist; i++)
|
||||
sl->list[i] += offs;
|
||||
}
|
||||
@ -188,7 +181,7 @@ static Char *
|
||||
tw_dir_next(dfd)
|
||||
DIR *dfd;
|
||||
{
|
||||
register struct dirent *dirp;
|
||||
struct dirent *dirp;
|
||||
|
||||
if (dfd == NULL)
|
||||
return NULL;
|
||||
@ -206,7 +199,7 @@ tw_dir_next(dfd)
|
||||
*/
|
||||
static void
|
||||
tw_cmd_add(name)
|
||||
Char *name;
|
||||
const Char *name;
|
||||
{
|
||||
int len;
|
||||
|
||||
@ -232,10 +225,10 @@ tw_cmd_free()
|
||||
static void
|
||||
tw_cmd_cmd()
|
||||
{
|
||||
register DIR *dirp;
|
||||
register struct dirent *dp;
|
||||
register Char *dir = NULL, *name;
|
||||
register Char **pv;
|
||||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
Char *dir = NULL, *name;
|
||||
Char **pv;
|
||||
struct varent *v = adrof(STRpath);
|
||||
struct varent *recexec = adrof(STRrecognize_only_executables);
|
||||
int len;
|
||||
@ -291,7 +284,7 @@ tw_cmd_cmd()
|
||||
static void
|
||||
tw_cmd_builtin()
|
||||
{
|
||||
register struct biltins *bptr;
|
||||
struct biltins *bptr;
|
||||
|
||||
for (bptr = bfunc; bptr < &bfunc[nbfunc]; bptr++)
|
||||
if (bptr->bname)
|
||||
@ -310,8 +303,8 @@ tw_cmd_builtin()
|
||||
static void
|
||||
tw_cmd_alias()
|
||||
{
|
||||
register struct varent *p;
|
||||
register struct varent *c;
|
||||
struct varent *p;
|
||||
struct varent *c;
|
||||
|
||||
p = &aliases;
|
||||
for (;;) {
|
||||
@ -501,9 +494,9 @@ tw_shvar_next(dir, flags)
|
||||
Char *dir;
|
||||
int *flags;
|
||||
{
|
||||
register struct varent *p;
|
||||
register struct varent *c;
|
||||
register Char *cp;
|
||||
struct varent *p;
|
||||
struct varent *c;
|
||||
Char *cp;
|
||||
|
||||
USE(flags);
|
||||
USE(dir);
|
||||
@ -602,8 +595,6 @@ tw_complete_start(dfd, pat)
|
||||
DIR *dfd;
|
||||
Char *pat;
|
||||
{
|
||||
extern struct varent completions;
|
||||
|
||||
USE(pat);
|
||||
SETDIR(dfd)
|
||||
tw_vptr_start(&completions);
|
||||
@ -640,9 +631,9 @@ tw_logname_start(dfd, pat)
|
||||
{
|
||||
USE(pat);
|
||||
SETDIR(dfd)
|
||||
#if !defined(_VMS_POSIX) && !defined(WINNT_NATIVE)
|
||||
#ifdef HAVE_GETPWENT
|
||||
(void) setpwent(); /* Open passwd file */
|
||||
#endif /* !_VMS_POSIX && !WINNT_NATIVE */
|
||||
#endif
|
||||
} /* end tw_logname_start */
|
||||
|
||||
|
||||
@ -666,12 +657,11 @@ tw_logname_next(dir, flags)
|
||||
USE(flags);
|
||||
USE(dir);
|
||||
TW_HOLD();
|
||||
#if !defined(_VMS_POSIX) && !defined(WINNT_NATIVE)
|
||||
/* ISC does not declare getpwent()? */
|
||||
pw = (struct passwd *) getpwent();
|
||||
#else /* _VMS_POSIX || WINNT_NATIVE */
|
||||
#ifdef HAVE_GETPWENT
|
||||
pw = getpwent();
|
||||
#else
|
||||
pw = NULL;
|
||||
#endif /* !_VMS_POSIX && !WINNT_NATIVE */
|
||||
#endif
|
||||
TW_RELS();
|
||||
|
||||
if (pw == NULL) {
|
||||
@ -694,9 +684,9 @@ tw_logname_end()
|
||||
#ifdef YPBUGS
|
||||
fix_yp_bugs();
|
||||
#endif
|
||||
#if !defined(_VMS_POSIX) && !defined(WINNT_NATIVE)
|
||||
#ifdef HAVE_GETPWENT
|
||||
(void) endpwent();
|
||||
#endif /* !_VMS_POSIX && !WINNT_NATIVE */
|
||||
#endif
|
||||
} /* end tw_logname_end */
|
||||
|
||||
|
||||
@ -953,7 +943,7 @@ tw_bind_next(dir, flags)
|
||||
Char *dir;
|
||||
int *flags;
|
||||
{
|
||||
char *ptr;
|
||||
const char *ptr;
|
||||
USE(flags);
|
||||
if (tw_bind && tw_bind->name) {
|
||||
for (ptr = tw_bind->name, dir = tw_retname;
|
||||
@ -993,7 +983,7 @@ tw_limit_next(dir, flags)
|
||||
int *flags;
|
||||
{
|
||||
#ifndef HAVENOLIMIT
|
||||
char *ptr;
|
||||
const char *ptr;
|
||||
if (tw_limit && tw_limit->limname) {
|
||||
for (ptr = tw_limit->limname, dir = tw_retname;
|
||||
(*dir++ = (Char) *ptr++) != '\0';)
|
||||
@ -1031,8 +1021,7 @@ tw_sig_next(dir, flags)
|
||||
Char *dir;
|
||||
int *flags;
|
||||
{
|
||||
char *ptr;
|
||||
extern int nsig;
|
||||
const char *ptr;
|
||||
USE(flags);
|
||||
for (;tw_index < nsig; tw_index++) {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tw.parse.c,v 3.96 2004/01/23 16:21:33 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tw.parse.c,v 3.105 2005/03/03 16:40:53 kim Exp $ */
|
||||
/*
|
||||
* tw.parse.c: Everyone has taken a shot in this futile effort to
|
||||
* lexically analyze a csh line... Well we cannot good
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tw.parse.c,v 3.96 2004/01/23 16:21:33 christos Exp $")
|
||||
RCSID("$Id: tw.parse.c,v 3.105 2005/03/03 16:40:53 kim Exp $")
|
||||
|
||||
#include "tw.h"
|
||||
#include "ed.h"
|
||||
@ -89,7 +89,7 @@ int curchoice = -1;
|
||||
|
||||
int match_unique_match = FALSE;
|
||||
int non_unique_match = FALSE;
|
||||
static bool SearchNoDirErr = 0; /* t_search returns -2 if dir is unreadable */
|
||||
static int SearchNoDirErr = 0; /* t_search returns -2 if dir is unreadable */
|
||||
|
||||
/* state so if a completion is interrupted, the input line doesn't get
|
||||
nuked */
|
||||
@ -97,18 +97,13 @@ int InsideCompletion = 0;
|
||||
|
||||
/* do the expand or list on the command line -- SHOULD BE REPLACED */
|
||||
|
||||
extern Char NeedsRedraw; /* from ed.h */
|
||||
extern int Tty_raw_mode;
|
||||
extern int TermH; /* from the editor routines */
|
||||
extern int lbuffed; /* from sh.print.c */
|
||||
|
||||
static void extract_dir_and_name __P((Char *, Char *, Char *));
|
||||
static int insert_meta __P((Char *, Char *, Char *, bool));
|
||||
static int insert_meta __P((Char *, Char *, Char *, int));
|
||||
static Char *tilde __P((Char *, Char *));
|
||||
#ifndef __MVS__
|
||||
static int expand_dir __P((Char *, Char *, DIR **, COMMAND));
|
||||
#endif
|
||||
static bool nostat __P((Char *));
|
||||
static int nostat __P((Char *));
|
||||
static Char filetype __P((Char *, Char *));
|
||||
static int t_glob __P((Char ***, int));
|
||||
static int c_glob __P((Char ***));
|
||||
@ -423,7 +418,7 @@ tenematch(inputline, num_read, command)
|
||||
*/
|
||||
static int
|
||||
t_glob(v, cmd)
|
||||
register Char ***v;
|
||||
Char ***v;
|
||||
int cmd;
|
||||
{
|
||||
jmp_buf_t osetexit;
|
||||
@ -477,7 +472,7 @@ t_glob(v, cmd)
|
||||
*/
|
||||
static int
|
||||
c_glob(v)
|
||||
register Char ***v;
|
||||
Char ***v;
|
||||
{
|
||||
Char *pat = **v, *cmd, **av;
|
||||
Char dir[MAXPATHLEN+1];
|
||||
@ -523,16 +518,14 @@ insert_meta(cp, cpend, word, closequotes)
|
||||
Char *cp;
|
||||
Char *cpend;
|
||||
Char *word;
|
||||
bool closequotes;
|
||||
int closequotes;
|
||||
{
|
||||
Char buffer[2 * FILSIZ + 1], *bptr, *wptr;
|
||||
int in_sync = (cp != NULL);
|
||||
int qu = 0;
|
||||
Char qu = 0;
|
||||
int ndel = (int) (cp ? cpend - cp : 0);
|
||||
Char w, wq;
|
||||
#ifdef DSPMBYTE
|
||||
int mbytepos = 1;
|
||||
#endif /* DSPMBYTE */
|
||||
int l;
|
||||
|
||||
for (bptr = buffer, wptr = word;;) {
|
||||
if (bptr > buffer + 2 * FILSIZ - 5)
|
||||
@ -540,9 +533,6 @@ insert_meta(cp, cpend, word, closequotes)
|
||||
|
||||
if (cp >= cpend)
|
||||
in_sync = 0;
|
||||
#ifdef DSPMBYTE
|
||||
if (mbytepos == 1)
|
||||
#endif /* DSPMBYTE */
|
||||
if (in_sync && !cmap(qu, _ESC) && cmap(*cp, _QF|_ESC))
|
||||
if (qu == 0 || qu == *cp) {
|
||||
qu ^= *cp;
|
||||
@ -556,10 +546,6 @@ insert_meta(cp, cpend, word, closequotes)
|
||||
wq = w & QUOTE;
|
||||
w &= ~QUOTE;
|
||||
|
||||
#ifdef DSPMBYTE
|
||||
if (mbytepos == 2)
|
||||
goto mbyteskip;
|
||||
#endif /* DSPMBYTE */
|
||||
if (cmap(w, _ESC | _QF))
|
||||
wq = QUOTE; /* quotes are always quoted */
|
||||
|
||||
@ -601,18 +587,17 @@ insert_meta(cp, cpend, word, closequotes)
|
||||
*bptr++ = '\\';
|
||||
*bptr++ = w;
|
||||
} else {
|
||||
#ifdef DSPMBYTE
|
||||
mbyteskip:
|
||||
#endif /* DSPMBYTE */
|
||||
if (in_sync && *cp++ != w)
|
||||
in_sync = 0;
|
||||
*bptr++ = w;
|
||||
#ifdef DSPMBYTE
|
||||
if (mbytepos == 1 && Ismbyte1(w))
|
||||
mbytepos = 2;
|
||||
else
|
||||
mbytepos = 1;
|
||||
#endif /* DSPMBYTE */
|
||||
l = NLSSize(wptr, -1);
|
||||
while (--l > 0) {
|
||||
wptr++;
|
||||
w = *wptr & ~QUOTE;
|
||||
if (in_sync && *cp++ != w)
|
||||
in_sync = 0;
|
||||
*bptr++ = w;
|
||||
}
|
||||
}
|
||||
wptr++;
|
||||
if (cmap(qu, _ESC))
|
||||
@ -635,7 +620,7 @@ insert_meta(cp, cpend, word, closequotes)
|
||||
*/
|
||||
static int
|
||||
is_prefix(check, template)
|
||||
register Char *check, *template;
|
||||
Char *check, *template;
|
||||
{
|
||||
for (; *check; check++, template++)
|
||||
if ((*check & TRIM) != (*template & TRIM))
|
||||
@ -695,9 +680,9 @@ is_prefixmatch(check, template, igncase)
|
||||
*/
|
||||
static int
|
||||
is_suffix(check, template)
|
||||
register Char *check, *template;
|
||||
Char *check, *template;
|
||||
{
|
||||
register Char *t, *c;
|
||||
Char *t, *c;
|
||||
|
||||
for (t = template; *t++;)
|
||||
continue;
|
||||
@ -717,10 +702,10 @@ is_suffix(check, template)
|
||||
*/
|
||||
static int
|
||||
ignored(item)
|
||||
register Char *item;
|
||||
Char *item;
|
||||
{
|
||||
struct varent *vp;
|
||||
register Char **cp;
|
||||
Char **cp;
|
||||
|
||||
if ((vp = adrof(STRfignore)) == NULL || (cp = vp->vec) == NULL)
|
||||
return (FALSE);
|
||||
@ -737,10 +722,10 @@ ignored(item)
|
||||
*/
|
||||
int
|
||||
starting_a_command(wordstart, inputline)
|
||||
register Char *wordstart, *inputline;
|
||||
Char *wordstart, *inputline;
|
||||
{
|
||||
register Char *ptr, *ncmdstart;
|
||||
int count;
|
||||
Char *ptr, *ncmdstart;
|
||||
int count, bsl;
|
||||
static Char
|
||||
cmdstart[] = {'`', ';', '&', '(', '|', '\0'},
|
||||
cmdalive[] = {' ', '\t', '\'', '"', '<', '>', '\0'};
|
||||
@ -770,8 +755,14 @@ starting_a_command(wordstart, inputline)
|
||||
for (count = 0; wordstart >= inputline; wordstart--) {
|
||||
if (*wordstart == '\0')
|
||||
continue;
|
||||
if (Strchr(ncmdstart, *wordstart))
|
||||
break;
|
||||
if (Strchr(ncmdstart, *wordstart)) {
|
||||
for (ptr = wordstart, bsl = 0; *(--ptr) == '\\'; bsl++);
|
||||
if (bsl & 1) {
|
||||
wordstart--;
|
||||
continue;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* found white space
|
||||
*/
|
||||
@ -819,8 +810,8 @@ recognize(exp_name, item, name_length, numitems, enhanced, igncase)
|
||||
int name_length, numitems, enhanced, igncase;
|
||||
{
|
||||
Char MCH1, MCH2;
|
||||
register Char *x, *ent;
|
||||
register int len = 0;
|
||||
Char *x, *ent;
|
||||
int len = 0;
|
||||
|
||||
if (numitems == 1) { /* 1st match */
|
||||
copyn(exp_name, item, MAXNAMLEN);
|
||||
@ -1367,7 +1358,7 @@ tw_list_items(looking, numitems, list_max)
|
||||
|
||||
|
||||
if (max_items || max_rows) {
|
||||
char tc;
|
||||
char tc, *sname;
|
||||
const char *name;
|
||||
int maxs;
|
||||
|
||||
@ -1380,8 +1371,10 @@ tw_list_items(looking, numitems, list_max)
|
||||
maxs = max_rows;
|
||||
}
|
||||
|
||||
sname = strsave(name);
|
||||
xprintf(CGETS(30, 7, "There are %d %s, list them anyway? [n/y] "),
|
||||
maxs, name);
|
||||
maxs, sname);
|
||||
xfree(sname);
|
||||
flush();
|
||||
/* We should be in Rawmode here, so no \n to catch */
|
||||
(void) read(SHIN, &tc, 1);
|
||||
@ -1733,7 +1726,7 @@ static void
|
||||
extract_dir_and_name(path, dir, name)
|
||||
Char *path, *dir, *name;
|
||||
{
|
||||
register Char *p;
|
||||
Char *p;
|
||||
|
||||
p = Strrchr(path, '/');
|
||||
#ifdef WINNT_NATIVE
|
||||
@ -1786,7 +1779,7 @@ static Char *
|
||||
tilde(new, old)
|
||||
Char *new, *old;
|
||||
{
|
||||
register Char *o, *p;
|
||||
Char *o, *p;
|
||||
|
||||
switch (old[0]) {
|
||||
case '~':
|
||||
@ -1891,12 +1884,12 @@ expand_dir(dir, edir, dfd, cmd)
|
||||
* This way, things won't grind to a halt when you complete in /afs
|
||||
* or very large directories.
|
||||
*/
|
||||
static bool
|
||||
static int
|
||||
nostat(dir)
|
||||
Char *dir;
|
||||
{
|
||||
struct varent *vp;
|
||||
register Char **cp;
|
||||
Char **cp;
|
||||
|
||||
if ((vp = adrof(STRnostat)) == NULL || (cp = vp->vec) == NULL)
|
||||
return FALSE;
|
||||
@ -2033,7 +2026,7 @@ find_rows(items, count, no_file_suffix)
|
||||
Char *items[];
|
||||
int count, no_file_suffix;
|
||||
{
|
||||
register int i, columns, rows;
|
||||
int i, columns, rows;
|
||||
unsigned int maxwidth = 0;
|
||||
|
||||
for (i = 0; i < count; i++) /* find widest string */
|
||||
@ -2056,13 +2049,13 @@ find_rows(items, count, no_file_suffix)
|
||||
*/
|
||||
void
|
||||
print_by_column(dir, items, count, no_file_suffix)
|
||||
register Char *dir, *items[];
|
||||
Char *dir, *items[];
|
||||
int count, no_file_suffix;
|
||||
{
|
||||
register int i, r, c, columns, rows;
|
||||
unsigned int w, maxwidth = 0;
|
||||
int i, r, c, columns, rows;
|
||||
unsigned int w, wx, maxwidth = 0;
|
||||
Char *val;
|
||||
bool across;
|
||||
int across;
|
||||
|
||||
lbuffed = 0; /* turn off line buffering */
|
||||
|
||||
@ -2070,8 +2063,9 @@ print_by_column(dir, items, count, no_file_suffix)
|
||||
across = ((val = varval(STRlistflags)) != STRNULL) &&
|
||||
(Strchr(val, 'x') != NULL);
|
||||
|
||||
for (i = 0; i < count; i++) /* find widest string */
|
||||
maxwidth = max(maxwidth, (unsigned int) Strlen(items[i]));
|
||||
for (i = 0; i < count; i++) { /* find widest string */
|
||||
maxwidth = max(maxwidth, (unsigned int) NLSStringWidth(items[i]));
|
||||
}
|
||||
|
||||
maxwidth += no_file_suffix ? 1 : 2; /* for the file tag and space */
|
||||
columns = TermH / maxwidth; /* PWP: terminal size change */
|
||||
@ -2085,6 +2079,7 @@ print_by_column(dir, items, count, no_file_suffix)
|
||||
i = across ? (i + 1) : (c * rows + r);
|
||||
|
||||
if (i < count) {
|
||||
wx = 0;
|
||||
w = (unsigned int) Strlen(items[i]);
|
||||
|
||||
#ifdef COLOR_LS_F
|
||||
@ -2097,7 +2092,7 @@ print_by_column(dir, items, count, no_file_suffix)
|
||||
else {
|
||||
/* Print filename followed by '/' or '*' or ' ' */
|
||||
print_with_color(items[i], w, filetype(dir, items[i]));
|
||||
w++;
|
||||
wx++;
|
||||
}
|
||||
#else /* ifndef COLOR_LS_F */
|
||||
if (no_file_suffix) {
|
||||
@ -2106,15 +2101,17 @@ print_by_column(dir, items, count, no_file_suffix)
|
||||
}
|
||||
else {
|
||||
/* Print filename followed by '/' or '*' or ' ' */
|
||||
xprintf("\045S%c", items[i],
|
||||
xprintf("%-S%c", items[i],
|
||||
filetype(dir, items[i]));
|
||||
w++;
|
||||
wx++;
|
||||
}
|
||||
#endif /* COLOR_LS_F */
|
||||
|
||||
if (c < (columns - 1)) /* Not last column? */
|
||||
if (c < (columns - 1)) { /* Not last column? */
|
||||
w = (unsigned int) NLSStringWidth(items[i]) + wx;
|
||||
for (; w < maxwidth; w++)
|
||||
xputchar(' ');
|
||||
}
|
||||
}
|
||||
else if (across)
|
||||
break;
|
||||
@ -2134,7 +2131,7 @@ print_by_column(dir, items, count, no_file_suffix)
|
||||
*/
|
||||
int
|
||||
StrQcmp(str1, str2)
|
||||
register Char *str1, *str2;
|
||||
const Char *str1, *str2;
|
||||
{
|
||||
for (; *str1 && samecase(*str1 & TRIM) == samecase(*str2 & TRIM);
|
||||
str1++, str2++)
|
||||
@ -2173,7 +2170,8 @@ fcompare(file1, file2)
|
||||
*/
|
||||
void
|
||||
catn(des, src, count)
|
||||
register Char *des, *src;
|
||||
Char *des;
|
||||
const Char *src;
|
||||
int count;
|
||||
{
|
||||
while (--count >= 0 && *des)
|
||||
@ -2191,7 +2189,7 @@ catn(des, src, count)
|
||||
*/
|
||||
void
|
||||
copyn(des, src, count)
|
||||
register Char *des, *src;
|
||||
Char *des, *src;
|
||||
int count;
|
||||
{
|
||||
while (--count >= 0)
|
||||
@ -2210,9 +2208,10 @@ tgetenv(str)
|
||||
Char *str;
|
||||
{
|
||||
Char **var;
|
||||
int len, res;
|
||||
size_t len;
|
||||
int res;
|
||||
|
||||
len = (int) Strlen(str);
|
||||
len = Strlen(str);
|
||||
/* Search the STR_environ for the entry matching str. */
|
||||
for (var = STR_environ; var != NULL && *var != NULL; var++)
|
||||
if (Strlen(*var) >= len && (*var)[len] == '=') {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/tw.spell.c,v 3.15 2002/03/08 17:36:47 christos Exp $ */
|
||||
/* $Header: /src/pub/tcsh/tw.spell.c,v 3.17 2004/11/23 02:10:50 christos Exp $ */
|
||||
/*
|
||||
* tw.spell.c: Spell check words
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
#include "sh.h"
|
||||
|
||||
RCSID("$Id: tw.spell.c,v 3.15 2002/03/08 17:36:47 christos Exp $")
|
||||
RCSID("$Id: tw.spell.c,v 3.17 2004/11/23 02:10:50 christos Exp $")
|
||||
|
||||
#include "tw.h"
|
||||
|
||||
@ -46,9 +46,9 @@ spell_me(oldname, oldsize, looking, pat, suf)
|
||||
{
|
||||
/* The +1 is to fool hp's optimizer */
|
||||
Char guess[FILSIZ + 1], newname[FILSIZ + 1];
|
||||
register Char *new = newname, *old = oldname;
|
||||
register Char *p, *cp, *ws;
|
||||
bool foundslash = 0;
|
||||
Char *new = newname, *old = oldname;
|
||||
Char *p, *cp, *ws;
|
||||
int foundslash = 0;
|
||||
int retval;
|
||||
|
||||
for (;;) {
|
||||
@ -111,7 +111,7 @@ spell_me(oldname, oldsize, looking, pat, suf)
|
||||
|
||||
int
|
||||
spdist(s, t)
|
||||
register Char *s, *t;
|
||||
Char *s, *t;
|
||||
{
|
||||
for (; (*s & TRIM) == (*t & TRIM); t++, s++)
|
||||
if (*t == '\0')
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /src/pub/tcsh/vms.termcap.c,v 1.6 2000/06/10 23:32:42 kim Exp $ */
|
||||
/* $Header: /src/pub/tcsh/vms.termcap.c,v 1.8 2005/03/03 16:49:16 kim Exp $ */
|
||||
/*
|
||||
* termcap.c 1.1 20/7/87 agc Joypace Ltd
|
||||
*
|
||||
@ -9,7 +9,7 @@
|
||||
* A public domain implementation of the termcap(3) routines.
|
||||
*/
|
||||
#include "sh.h"
|
||||
RCSID("$Id: vms.termcap.c,v 1.6 2000/06/10 23:32:42 kim Exp $")
|
||||
RCSID("$Id: vms.termcap.c,v 1.8 2005/03/03 16:49:16 kim Exp $")
|
||||
#if defined(_VMS_POSIX) || defined(_OSD_POSIX)
|
||||
/* efth 1988-Apr-29
|
||||
|
||||
@ -34,7 +34,9 @@ RCSID("$Id: vms.termcap.c,v 1.6 2000/06/10 23:32:42 kim Exp $")
|
||||
char *capab; /* the capability itself */
|
||||
|
||||
extern char *getenv(); /* new, improved getenv */
|
||||
#ifndef fopen
|
||||
extern FILE *fopen(); /* old fopen */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* tgetent - get the termcap entry for terminal name, and put it
|
||||
@ -271,7 +273,7 @@ char *cm;
|
||||
int destcol;
|
||||
int destline;
|
||||
{
|
||||
register char *rp;
|
||||
char *rp;
|
||||
static char ret[24];
|
||||
int incr = 0;
|
||||
int argno = 0, numval;
|
||||
@ -323,15 +325,22 @@ int destline;
|
||||
*/
|
||||
int
|
||||
tputs(cp, affcnt, outc)
|
||||
register char *cp;
|
||||
char *cp;
|
||||
int affcnt;
|
||||
int (*outc)();
|
||||
{
|
||||
unsigned long delay = 0;
|
||||
|
||||
if (cp == NULL)
|
||||
return(1);
|
||||
/* do any padding interpretation - left null for MINIX just now */
|
||||
for (delay = 0; *cp && ISDIGIT(*cp) ; cp++)
|
||||
delay = delay * 10 + *cp - '0';
|
||||
while (*cp)
|
||||
(*outc)(*cp++);
|
||||
#ifdef _OSD_POSIX
|
||||
usleep(delay*100); /* strictly spoken, it should be *1000 */
|
||||
#endif
|
||||
return(1);
|
||||
}
|
||||
#endif /* _VMS_POSIX || _OSD_POSIX */
|
||||
|
Loading…
Reference in New Issue
Block a user