ååã¯BSD Unixã®ã«ãŒãã§ãã2BSDãåãããŠã¿ãŸãããã ä»åã¯åŒãç¶ã2BSDäžã§ex/viã³ãã³ãããã«ãããå©çšããŠã¿ãŸãã termcapã®ç»å Žãã·ã§ã«ã¹ã¯ãªããã®è§£éãªã©èå³æ·±ã話é¡ããããŸããã ãªãªãžãã«ã®viã³ãã³ããå©çšããŠã¿ããšãæå€ãªäºå®ã«æ°ãä»ããŸãã
ãã®é£èŒãä»åã§ïŒïŒåç®ãè¿ããŸãããããïŒå¹Žç®ã«çªå ¥ããŸããã 颚å€ãããªã«ã«ããã¿æºèŒã®ãã®é£èŒãïŒå¹Žãç¶ããã®ã«ã¯ã ãŸãã¯èªè ã®çããã®åŸ¡ç解ãããã«æ¯æææ«ã«ãªããšå¿ ãçºçãã åä»ããšã«ä»ãåã£ãŠãããç·šééšããã®ä»ã®è«žæ°ã®ååã®è³ã§ãã ãã®å ŽãåããŠæè¬ããããšæããŸããã§ããã®é£èŒãæ¢ã«ïŒïŒåã éããã®ã«å 容çã«ã¯åœåäºå®ã®åã°ãããããŸã ãŠããŠãããŠãŸãã ãããé£èŒã¯ãŸã ç¶ããŸãã
ããããç¶æ ã«ãªã£ãŠããŸã£ããã€ãŸã埡玹ä»ãããå 容ãåœåã®èŠç©ãããã å€ããªã£ãŠããŸã£ã倧ããªçç±ã®ïŒã€ã¯ãAncient Unix ãå©çšããå®ç¿ç解説ã è©Šã¿ãŠããããã§ãããã確ãã«ããã®ãããªå€æãã Unix ãåãã è©Šã¿ã«ã©ã®ãããªäŸ¡å€ããããã¯è°è«ã®åããããšããã§ãã ãããé£èŒã§äœæ ãå®ç¿ç解説ãè¡ãã®ãïŒããšå°ãããããšãããã ç§ã®å人çãªæ£çŽãªåçã¯ãããã«ãœãŒã¹ãããããã ïŒãã§ãã ç§ã®æ¬é³ã¯ãšããããšããŠãããå°ãäžè¬ã«é æ ®ããçãè¿°ã¹ããšããã°ã ãã¯ããæè²ç䟡å€ãèŠåºãããšãã§ããããšããçç±ã«å°œãããšæããŸãã
ä»æ¥ãã³ã³ãã¥ãŒã¿ã«é¢ããæè¡ã¯äžå®ã®ã¬ãã«ã§ã®æçãè¿ããŠãã ããã«æããŸããæ ã«ä»æ¥ã§ã¯ãæ°ããæè¡ãéçºãããããšãããã ãæ¢åã®æè¡ãã©ã®ããã«æŽ»çšããŠãããããšã«éç¹ã眮ããã ããã«ãªã£ãŠããŸãããããã ãæ¢åã®æè¡èç©ãèšå€§ãªãã®ã«ãªã£ããš èšããã§ãããããã®ç¶æ³ã¯ããããã³ã³ãã¥ãŒã¿ãå§ããããšããŠãã è¥ãæ¹ã ã«ãšã£ãŠãéåžžã«è² æ ã®å€§ããªç¶æ³ãªã®ã§ã¯ãªãããšç§ã¯æããŸãã ãªããªãããæ¢åã®æè¡ããæã£åãæ©ãç解ããããšãæ±ããããããã§ãã å¿ ç¶çã«ãæ¢åã®æè¡ãããã©ãã¯ããã¯ã¹ãšããŠåãæ±ãããåŸãªããªããŸãã å®éãç¡æ°ã®ãã©ãã¯ããã¯ã¹ãç©ã¿äžããããŠãããããçµã¿åãã㊠äœã圹ã«ç«ã€ãã®ãæ±ãããããšããã®ã¯ããã®ããã®ç¹å¥ãªæèœã æã¡åãããŠããæ¹ãé€ãã°ã倧å€èŸãä»äºãªã®ã§ã¯ãªãã§ããããïŒ
ããšãã£ãŠãæ¢åã®æè¡ãã®äžèº«ãç解ãããšããã®ãä»æ¥ã§ã¯å€§å€ãªä»äºã§ãã äŸãã°ãLinux ã«ãŒãã«ãšããã®ã¯å€ãã®æè¡è ã«ãšã£ãŠ é¢å¿ã®é«ããæ¢åã®æè¡ãã§ããããã®äžèº«ãå šãŠç解ãããšããã®ã¯ã ããããéæ¹ããªãè©Šã¿ã®ãããªæ°ãããŸããäœæ ãªãæ¢ã« Linux ã«ãŒãã«ã¯ ããèªäœãéåžžã«å€§ããªãœãããŠã§ã¢ã«ãªã£ãŠããŸããã æŽã«ä»ãã£ãŠã³ãŒãã¯èšåŒµãç¶ããŠããããã§ãã ãããã£ãã·ã¹ãã ã察象ã«ãäžèº«ãå šãŠç解ãããããšèªäœã çµãã®ãªãäœæ¥ã«ãªããããªãã
ããã§ãå®éã«äœ¿ãããŠããæè¡ãšç䟡ã ãããã£ãšã·ã³ãã«ã§ã ããæ¹å€ãããããšã®ãªããã®ããšããååšãšã㊠Ancient Unix 㯠䟡å€ãããã®ã§ã¯ãªãããšç§ã¯èããŠããŸããäŸãã°ãã€ããç解ããã®ã« å¿ ã Linux ã«ãŒãã«ãèªãŸãªããã°ãªããªãå¿ èŠã¯ãªãã¯ãã§ãã ãã£ãšããªãœãŒã¹ã®å°ããããŒããŠã§ã¢ã§åããŠãã Ancient Unix ã® ãã€ãã®å®è£ ã®æ¹ããã£ãšã·ã³ãã«ã§å°ãã (æ ã«ç解ãæã) ãã®ã ãš æããŸããç§ã䞻匵ãã Ancient Unix ã®ãæè²ç䟡å€ããšã¯ ãããã£ããã®ãªã®ã§ãããã
ããããæå³ã®å ã«ãç§ã¯ Ancient Unix ãå®éã«äœ¿ãããã®æ¹æ³ã ããªãã¡å®ç¿ç解説ãè©Šã¿ãŠããããã§ããããšã¯ããçŸå®ã« Ancient Unixã äŸãã° Version 7 Unix ã§ããã°ã©ã ãæžãã®ã¯éªšãæããŸãããïŒ ãã®ãã£ãšã倧ããªåå ã®ã䜿ãæ £ãããšãã£ã¿ãåããªããã£ãŠããš ãããªãã§ããããïŒ ç¢ºãã« ed ã³ãã³ãã§ãœãŒã¹ãä¿®æ£ããã®ã¯ ç§ã§ãç²ããŸããæ¬åœã«ãããã§ä»å㯠Version 7 Unix ã« 2BSD ã® ex/vi ã ã€ã³ã¹ããŒã«ããæ¹æ³ã埡玹ä»ããããšã«ããŸããvi ã¯çŸåšã§ãäž»èŠãªãšãã£ã¿ã® ïŒã€ã§ãã®ã§ããã㧠Version 7 Unix (2BSD) ã®äžã§ã®äœæ¥ãå¹çã æ Œæ®µã«æ¹åãããæ¹ãå€ãã§ãããã
ãemacs ã¯ã©ããªãã§ããïŒããšä»°ãæ¹ãããã§ããããããããã°ãã ãåŸ ã¡ãã ãããé£èŒã¯ç¶ããŸãã
ex ãšãã£ã¿ãšãã® visual mode (ããªãã¡ vi) ã®èµ·æºã«ã€ããŠã¯ã æ¢ã«ç¬¬ïŒïŒåã® 1BSD ã®åŸ¡çŽ¹ä»ã®éã«èª¬æããŸããã®ã§ã ããã§ç¹°ãè¿ãå¿ èŠã¯ãªãã§ãããã
1BSD ã§ã¯ Version 1.1 ã§ãã£ã ex ãã2BSD ã§ã¯ Version 2.0 ã« ã¡ãžã£ãŒã¢ããããŒããããŠããŸãããã®ïŒã€ã®ãã£ã¹ããªãã¥ãŒã·ã§ã³ã¯ ä»å±ããããã¥ã¡ã³ãã«ææãæ確ã«æžãããŠããªãããããã€é é åžããã ããã«ãªã£ããæ£ç¢ºãªææãããããŸããããããããå幎ããïŒå¹ŽåŒ±ã® æéãã空ããŠããªãã£ããšæšæž¬ãããŸãããã®æéå ã§ã¡ãžã£ãŒã¢ããããŒãã ããããšããããšã¯ãex/vi ã¯æ£ãããã®ææã«éçºäžã®ãœãããŠã§ã¢ã ã£ããš ããããšã§ãããã
第ïŒïŒåã§ã¯ ex/vi 㯠Ken Thompson ã® ed ã George Coulouris ã® em (Editor for Mortals) ããæ¡åŒµããããœãããŠã§ã¢ãšãã£ããã¥ãŒã¢ã³ã¹ã§ 説æããããšæããŸãããå®éã«ã¯ ed ã em ããŠãŒãã£ãªãã£ã¯ã©ã¹ã® æ¯èŒçã³ã³ãã¯ããªããã°ã©ã ã§ãã£ãã®ã«å¯Ÿããex/vi ã¯ãµãã·ã¹ãã ã¯ã©ã¹ã® (åœæãšããŠã¯) 巚倧ãªãœãããŠã§ã¢ã§ããããã®ãã¥ãŒãã³ ã€ã³ã¿ãŒãã§ãŒã¹ãéèŠãããã®ããã«å€ããäœã蟌ã姿å¢ã¯ãåãææã« XEROX ã® Palo Alto ç 究æã§èªçãã1980 幎代以ééçã極ããŠãã ãŠã£ã³ãã·ã¹ãã ã®äºäŸãªã©ããããããããã«ã1970 幎代åŸæã® ãã¬ã³ãã ã£ããšèšããã§ããããæ ã« ex/vi ã®ã³ã³ãã€ã«ã§ã¯ ãã®ãã«ããåé¡ã«ãªãããšãå€ãã£ãããã§ããä»å玹ä»ããæé ã§ã ãã®ãã«ãããããŸèŠããšããããããŸãã®ã§æ³šæããŠãã ããã
ããã§ã¯ ex/vi ã®ãã«ããå§ããŸãããã ä»åãä»å±ã® CD-ROM ã«åé²ãããœãŒã¹ã³ãŒãã¯ã ååãšå šãåæ§ã®ãã®ã§ãããã以éã§çŽ¹ä»ããæé 㯠åå埡玹ä»ããäœæ¥ãå šãŠçµããŠãããšä»®å®ããŠèª¬æããŠãããŸãã ãã®è©³çŽ°ã«ã€ããŠã¯ååã®èšäºã確èªããŠãã ããã
ex ãã³ã³ãã€ã«ããåã«ããŸããååã€ã³ã¹ããŒã«ãã 2BSD ã³ãã³ãã«æçŽããå¿ èŠãªãšãããïŒç®æãããŸãã
ãã®ïŒã€ã¯ã·ã§ã«ã¹ã¯ãªããã®é¢ããä¿®æ£ã§ããå®è¡äŸïŒã埡芧ãã ããã
å®è¡äŸïŒ /usr/ucb ã«ã€ã³ã¹ããŒã«ãããã·ã§ã«ã¹ã¯ãªããã®ä¿®æ£
$ pdp11
PDP-11 simulator V3.0-2
sim> set cpu URH70
sim> set cpu 2M
Disabling XQ
sim> set rp0 RP06
sim> att rp0 rp0.dsk
sim> set rp1 RP06
sim> att rp1 rp1.dsk
sim> boot rp0
boot
Boot
: hp(0,0)unix
mem = 2020544
# DATE 200403101722
WED MAR 10 17:22:00 JST 2004 â æ¥ä»ã®èšå®ãå¿ããªãããã«
# RESTRICTED RIGHTS: USE, DUPLICATION, OR DISCLOSURE
IS SUBJECT TO RESTRICTIONS STATED IN YOUR CONTRACT WITH
WESTERN ELECTRIC COMPANY, INC.
WED MAR 10 17:22:02 JST 2004
login: root
Password:
You have mail.
# /etc/mount /dev/rp7 /mnt â 2BSD ã®ãœãŒã¹ããããã¡ã€ã«ã·ã¹ãã ã
# cd /mnt/src ããŠã³ããã
# ls *.sh
astags.sh
ctags.sh
cxref.sh
makewhatis.sh
print.sh
w.sh
#
# cp astags.sh astags.sh.orig
# ed astags.sh
....
# diff -e astags.sh.orig astags.sh
1,2d
#
# cp ctags.sh ctags.sh.orig
# ed ctags.sh
....
# diff -e ctags.sh.orig ctags.sh
1,2d
#
# cp cxref.sh cxref.sh.orig
# ed cxref.sh
....
# diff -e cxref.sh.orig cxref.sh
1,2d
#
# cp makewhatis.sh makewhatis.sh.orig
# ed makewa#hatis.sh
....
# diff -e makewhatis.sh.orig makewhatis.sh
1,2d
#
# cp print.sh print.sh.orig
# ed print.sh
....
# diff -e print.sh.orig print.sh
1,2d
#
# cp w.sh w.sh.orig
# ed w.sh
....
# diff -e w.sh.orig w.sh
1,2d
#
# cp astags.sh /usr/ucb/astags
# cp ctags.sh /usr/ucb/ctags
# cp cxref.sh /usr/ucb/cxref
# cp makewhatis.sh /usr/ucb/makewhatis
# cp print.sh /usr/ucb/print
# cp w.sh /usr/ucb/w
#
2BSD 㧠/usr/ucb ã«ã€ã³ã¹ããŒã«ãããã³ãã³ãã«ã¯ïŒã€ã®ã·ã§ã« ã¹ã¯ãªãããå«ãŸããŸãããååã®ç¶æ ã§ã¯ãšã©ãŒãçºçããŠå®è¡ã§ããŸããã ãã®çç±ã¯ããããã®ã·ã§ã«ã¹ã¯ãªããã¯ããããã³ã¡ã³ãè¡ããå§ãŸãã®ã§ããã Version 7 ã® /bin/sh ã¯ãã®å é ã®ã³ã¡ã³ãè¡ãèªèããã ãšã©ãŒã«ãªã£ãŠããŸããŸãã(â ã³ã©ã ïŒåç §) ãã®ãã ex ãã³ã³ãã€ã«ããéã« /usr/ucb/ctags ã䜿çšããŠãã ãšãã㧠make ãç°åžžçµäºããŸãã æ¬æ¥ãBourne Shell ãæçŽãããã¹ããªã®ã§ããããã ããã¯æã£åãæ©ãã·ã§ã«ã¹ã¯ãªããã®å é ã®ã³ã¡ã³ãè¡ ïŒè¡ãåé€ããããšã§å¯ŸåŠããŸããã
ããïŒã€ã®æçŽããã¹ããšãã㯠C Shell ã«ã€ããŠã§ãã ååã®æé ã§ã¯ C Shell ã Version 6 Unix ã«åãããŠã³ã³ãã€ã«ããŸãããã ãã®ã³ã³ãã£ã°ã¬ãŒã·ã§ã³ã ãš setenv ã³ãã³ãã䜿ããŸããã ä»åãex ãåäœãããããã«ç°å¢å€æ° TERM ã®èšå®ãããå¿ èŠãããã®ã§ããã Bourne Shell ã®ç°å¢å€æ°ã®èšå®ã¯ç ©ãããã®ã§(â ã³ã©ã ïŒåç §)ã C Shell ã® setenv ã³ãã³ãã䜿ããããšããã§ãã ãã㧠setenv ã³ãã³ãã䜿ããããã« C Shell ãåã³ã³ãã€ã«ããŸãã å®è¡äŸïŒã埡芧ãã ããã
å®è¡äŸïŒ C Shell 㧠setenv ã³ãã³ãã䜿ããããã«ãã
# cd /mnt/src/csh
# make clean
rm -f a.out strings x.c xs.c
rm -f *.o
# cp sh.init.c sh.init.c.orig
# ed sh.init.c
....
# diff -e sh.init.c.orig sh.init.c
86d
84d
# cp sh.func.c sh.func.c.orig
# ed sh.func.c
....
# diff -e sh.func.c.orig sh.func.c
766d
711d
#
# make install
....
cc -n sh.o sh.dol.o sh.err.o sh.exec.o sh.exp.o sh.func.o sh.glob.o sh.hist.o sh.lex.o sh.misc.o sh.parse.o sh.print.o sh.sem.o sh.set.o sh.wait.o alloc.o sh.init.o 11printf.o getpwent.o getpwnam.o getpwuid.o errlst.o strings.o
cp a.out x
strip x
rm -f /bin/csh
mv x /bin/csh
rm -f /bin/makesh
ln /bin/csh /bin/makesh
#
# /bin/csh
# set path=($path /usr/ucb)
# set
argv ()
home /
path (/etc /bin /usr/bin /usr/ucb)
prompt #
shell /bin/csh
status 0
# printenv
HOME=/
PATH=:/bin:/usr/bin
# setenv TERM vt100
# printenv
HOME=/
PATH=:/bin:/usr/bin
TERM=vt100
# exit
# #
ãªãªãžãã«ã®ãœãŒã¹ã§ã¯ setenv ã³ãã³ãã« é¢é£ããæ©èœã¯ sh.init.c ããã³ sh.func.c ã«å®è£ ãããŠããã ãã¯ã V6 ãå®çŸ©ãããŠãªãæã ãã³ã³ãã€ã«ãããããã«ãªã£ãŠããŸãã ããã§é¢é£ãã #ifndef ãš #endif ãåé€ããŠããŸãã
å¿ èŠãªä¿®æ£ã csh ãã³ã³ãã€ã«ïŒã€ã³ã¹ããŒã«ããŠãã ããã ã€ã³ã¹ããŒã«åŸã¯ setenv ã³ãã³ãã䜿ããããšã確èªããŠãããŸãããã ãã®äŸã§ã¯ç°å¢å€æ° TERM ã«ç«¯æ«å vt100 ãèšå®ããŠããŸãã
ã¡ãªã¿ã«ããã®ä¿®æ£ã¯å¿ é ã§ã¯ãããŸãããC Shell ã®ãœãŒã¹ã³ãŒãã æ±ããããªãæ¹ã¯ãC Shell ã§ã¯ãªã Bourne Shell ã§ç°å¢å€æ°ã® èšå®ãããŠããã£ãŠãæ§ããŸãããäœè«ã§ãã Version 7 Unix ã§ã¯ ã©ã€ãã©ãªé¢æ° setenv() ã¯ååšããŸããã詳现ãâ ã³ã©ã ïŒã§ 説æããŠãŸãã®ã§ãæ°ã«ãªãæ¹ã¯åèã«ããŠãã ããã
ããã§ã¯ ex ã®ã³ã³ãã€ã«ïŒã€ã³ã¹ããŒã«ã«ããããŸãã /mnt/src/ex/READ_ME ãèŠããšãåé ã«æ¬¡ã®ãããªïŒè¡ããããŸãã
There are 2 skeletal makefiles: makefile.v6 which I made from
the local makefile.CORY, and makefile.v7 which I made from makefile.VAX.
ãããèŠããšãmakefile.v7 㯠VAX çšãªã®ã§ã makefile.v6 ã䜿ã£ãæ¹ãè¯ãã®ããªïŒããšãã æ°æã¡ã«ãªã£ã¡ããã®ã§ããããã«ããããç§ãè©Šã¿ããšããã§ã¯ csh ã®æãšã¯éã£ãŠãex ã®å Žå㯠makefile.v7 ãä¿®æ£ããŠäœ¿ãã®ã æ£è§£ã®ããã§ãã
ex ãã³ã³ãã€ã«ããäžã§ã®åé¡ç¹ãšããŠã¯ïŒã€ãããŸãã ïŒã€ã¯ C Shell ãšå ±éã®åé¡ã§ printf ã®å éšäžäœé¢æ° _strout() ã® åŒæ°ã®äžŠã³ã Version 7 Unix ãš UNIX/32V ã§ç°ãªãããšãã€ãŸãã C Shell ãšåæ§ã« ex ã§ãèªåã® printf ã䜿ã£ãŠããã£ãŠããšã§ããã ããã®å¯ŸåŠæ³ãåã㧠printf.c ã®ä»£ããã« 11printf.c ã䜿ããŸãã ããïŒã€ã®åé¡ã¯ ex_io.c ã§ãããã® C ãœãŒã¹ã¯å€§ãéããããã ã³ã³ãã€ã«æã«ãšã©ãŒ "Symbol table overflow" ãçºçããŸãã ãã®ãšã©ãŒã¯ã³ã³ãã€ã©ã®åé¡ãªã®ã§ãæ¬æ¥ã¯ã³ã³ãã€ã©ã®æ¹ã æçŽãããã¹ããªã®ã§ãã(â ã³ã©ã ïŒãâ ã³ã©ã ïŒåç §) ã ã³ã³ãã€ã©ãä¿®æ£ããã®ã¯å€§å€å±éºãªã®ã§ãex_io.c ãååã«ã¶ã£ãåãã ãšããèæã§ä¹ãåãããšã«ããŸãããå®è¡äŸïŒã埡芧ãã ããã
å®è¡äŸïŒ ex ã®ã³ã³ãã€ã«ïŒã€ã³ã¹ããŒã«
# cd /mnt/src/ex
# cp makefile makefile.v7
# diff -e makefile.v7 makefile
58,61c
${CC} -c xs.c
mv xs.o strings.o
.
43c
11printf.o strings.o
.
40c
ex_io0.o ex_io1.o ex_put.o ex_re.o ex_set.o ex_subr.o ex_temp.o ex_tty.o \
.
# cp ex_io.c ex_io0.c
# ed ex_io0.c
....
# diff -e ex_io.c ex_io0.c
501,1000d
20,24d
# cp ex_io.c ex_io1.c
# ed ex_io1.c
....
# diff -e ex_io.c ex_io1.c
24,501d
16,19d
#
# make
/usr/ucb/mkstr - ex2.0strings x ex.c
cc -E -O -DTABS=8 -DLISP -DCHDIR -DUCVISUAL xex.c | /usr/ucb/xstr -c -
rm -f xex.c
cc -O -DTABS=8 -DLISP -DCHDIR -DUCVISUAL -c x.c
mv x.o ex.o
....
# make install
/usr/ucb/ctags ex.c ex_*.c
cc -i ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_data.o ex_get.o ex_io0.o ex_io1.o ex_put.o ex_re.o ex_set.o ex_subr.o ex_temp.o ex_tty.o ex_v.o ex_vadj.o ex_vget.o ex_vmain.o ex_voperate.o ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o 11printf.o strings.o -ltermlib
chmod 711 /usr/ucb/ex
/usr/ucb/ex </dev/null
rm /usr/ucb/ex /usr/ucb/e /usr/bin/ex /usr/ucb/edit /usr/ucb/vi
rm: /usr/bin/ex nonexistent
rm: /usr/ucb/vi nonexistent
*** Error code 2 (ignored)
cp a.out /usr/ucb/ex
cp ex2.0strings /usr/lib/ex2.0strings
cp ex2.0strings /lib/ex2.0strings
ln /usr/ucb/ex /usr/ucb/edit
ln /usr/ucb/ex /usr/ucb/e
ln /usr/ucb/ex /usr/bin/ex
ln /usr/ucb/ex /usr/ucb/vi
chmod 1711 /usr/ucb/ex
#
ãŸããããã©ã«ãã® makefile 㯠Version 7 Unix (UNIX/32V) çšãªã®ã§ã makefile.v7 ã«ã³ããŒãæ®ã㊠makefile ã®æ¹ãä¿®æ£ããŸãã ä¿®æ£ç¹ã¯ïŒç®æãåè¿°ã®åé¡ã«å¯Ÿå¿ããïŒç®æãš strings.o ãäœæãã ãšãã㧠VAX çšã®ä¿®æ£ãå ¥ã£ãŠããããããããåé€ããŸããã ç¶ã㊠ex_io.c ãã¶ã£ãåã£ãŠ ex_io0.c ãš ex_io1.c ãäœæããŸãã 奜éœåãªããšã«åçŽãªè¡åé€ã ãã§ãå¥éºã«ïŒã€ã«åããããšãã§ããŸããã
ãã㊠make ãš make install ãè¡ããŸãã泚æããŠæ¬²ããã®ã¯ make install ãå®è¡ããåã«ãã£ã¬ã¯ã㪠/usr/bin ãäœæããããšã§ãã makefile 㯠/usr/ucb ã« ex ãã€ã³ã¹ããŒã«ãããšåæã« /usr/bin ã«ã ex ã®ãªã³ã¯ã匵ããŸãããã£ã¬ã¯ã㪠/usr/bin ããªããš make install 㯠éäžã§ç°åžžçµäºããŸãã®ã§ãäºããã£ã¬ã¯ããªãäœã£ãŠãããŠãã ããã
以äžã§ ex/vi ã®ã³ã³ãã€ã«ïŒã€ã³ã¹ããŒã«ã¯çµãã§ãã
ex 2.0 ã®ç¹åŸŽãšããã°ã端æ«ããŒã¿ããŒã¹ãšã㊠termcap ã åããŠäœ¿ãããããã«ãªã£ãããšãäžããããŸããä»æ¥ã termcap ãšèšãã°ããŠã£ã³ããŠã·ã¹ãã ã®ã¿ãŒããã« ãšãã¥ã¬ãŒã¿ã䜿ãæããããããäžè©±ã«ãªããŸããã®ã§ã è¥ãçããã«ã¯ããŸã銎æã¿ããªãããç¥ããŸããããã ç§ã®ãããªãªãŒã«ããŠãŒã¶ãŒã«ãšã£ãŠãtermcap ãšããã° Unix ã® æªå€¢ã®ïŒã€ã«äžããããã»ã©ãåä»ããšã®å°è±¡ã匷ãã§ãããã æã¯åŠãªã¿ãŒããã«ãå€ãã£ãã§ãããããã
ex ã®ååºã¯ 1BSD ã§ãããããã®æã«ã¯ termcap ã®å身ã§ãã ttycap ã䜿ãããŠããŸããããªã¹ãïŒãèŠãŠããããšãããããã« ãªãã ããã¹ã¯ãŒããã¡ã€ã« (/etc/passwd) ã¿ãããªå°è±¡ã§ããã ãã® ttycap ãæŽã«æ¹è¯ããã®ãçãããè¯ããåç¥ã® termcap ã§ã ãµããŒããããã®ã¯ 2BSD ããã§ãã
ãªã¹ãïŒ ttycap
l1|11/10:0:0:?
ca|adm3a|3a:0177440:0000332:li#24:co#80:cl=^z:ho=\036:nd=^l:up=^k:am:bs:ca
cl|adm3:0177440:0000332:li#24:co#80:cl=^z:am:bs
td|decwriter|dw2:0177444:0000332:co#132:bs:os:am
pd|dtc300s|diablo|dtc:0137446:0000330:if=/usr/lib/tset.dtc_tabs:co#132:\
hu=\EH:hd=\Eh:up=^z:bs:it:os:pt:pl du|dialup:0:0:
pg|gsi:0137446:0000330:is#1:co#132:hu=\EH:hd=\Eh:up=^z:bs:it:os:pt:pl
g0|gt40:0177444:0000332:li#30:co#72:bs:os
g2|gt42:0177444:0000332:li#40:co#72:bs:os
ch|hazeltine2000:0177440:0000332:bs:ca
lh|hp21mx:0:0:?
cH|hp2645|2645:0177440:0000332:li#24:co#80:cl=\E&a00c00Y\EJ:ho?:nd=\EC:up=\EA:\
am:bs:ca:it:ce=\Ek\ pt:al=\EL:dl=\EM:ce=\EK:cd=\EJ
gk|tek4014:0177444:0040332:co#120:li#56:bs:os:cl=\E^l:is=\E\:
ct|teleray:0177440:0000332:co#80:li#24:cl=^l:bs
ti|ti700|ti|ti733:0151440:0020332:co#80:bs:os
t3|teletype|tty|33|35:0157440:0020336:co#72
t7|tty37|37:0:0:bs:os:hu?:hd?:up?
un|unknown|u:0:0:
2BSD ã«åé²ãããŠãã termcap ã®ãµã³ãã«ã«ç»é²ãããŠãã ãšã³ããªæ° (ãµããŒãããŠãã端æ«æ°) ã¯ãã£ã 48 çš®é¡ã§ãã ãªãŒã«ããŠãŒã¶ãŒã®ç§ããã®äžã«æžãããŠããåã ã®ç«¯æ«åãèŠãŠã ãå šãç¥ããªãããããã¯ãååã¯èããããšãããããã®ã°ããã§ãã å¿ ç¶çã«ç§ãã¡ã®ç°å¢ã«åãããŠæ°ãããšã³ããªãèšè¿°ããå¿ èŠããããŸãã
èªè ã®å€ãã®æ¹ã 㯠X Window System ãåäœãã Unix ç°å¢ã ã䜿ãã§ããããããä»å㯠xterm ã kterm ããã㯠ãã¹ã¯ãããç°å¢ã®æšæºã¿ãŒããã«ãšãã¥ã¬ãŒã¿ãæ³å®ããŠè§£èª¬ããŸãã
2BSD ã® termcap ã¯çŸåšã®ãã®ãšåºæ¬çã«å€ãããŸããã ãããâ è¡šïŒãèŠãŠããããšãããããã«ã å®çŸ©ãããŠãã capabilities ã®æ°ã¯ïŒïŒåãš çŸåšã®ãã®ãšã¯æ¯ã¹ãã®ã«ãªããªãã»ã©å°ãªããã®ã§ããã (ã¡ãªã¿ã«ãçŸåšã® termcap ã® man page 㧠capability ã®æ°ãæ°ããŠã¿ããšãã 274 ããããŸããã 2BSD ã® termcap ã¯æåéã ex/vi ããµããŒãããã ãã®ããã® æ©èœãããªãã£ãããã§ã)
è¡šïŒ 2BSD termcap ã® capabilities (man page ããæç²)
Name | Type | Pad? | Description |
---|---|---|---|
al | str | (P*) | Add new blank line |
am | bool | Terminal has automatic margins | |
bc | str | Back cursor if not `^H' | |
bs | bool | Terminal can backspace with `^H' | |
cd | str | (P*) | Clear to end of display |
ce | str | (P) | Clear to end of line |
cl | str | (P*) | Clear screen |
cm | str | (P) | Cursor motion |
co | num | Number of columns in a line | |
da | bool | Display may be retained above | |
db | bool | Display may be retained below | |
dc | str | (P*) | Delete character |
dl | str | (P*) | Delete line |
dm | str | Delete mode (enter) | |
ed | str | End delete mode | |
ei | str | End insert mode; give ``:ei=:'' if `ic' | |
eo | str | Can erase overstrikes with a blank | |
ho | str | Home cursor (if no `cm') | |
hz | str | Hazeltine; can't print ~'s | |
ic | str | (P) | Insert character |
if | - | Name of file containing `is' | |
im | bool | Insert mode (enter); give ``:im=:'' if `ic' | |
in | bool | Insert mode distinguishes nulls on display | |
ip | str | (P*) | Insert pad after character inserted |
is | str | Terminal initialization string | |
li | num | Number of lines on CRT screen | |
ll | str | Last line, first column (if no `cm') | |
ma | str | Control character map for arrow keys | |
mi | bool | Safe to move while in insert mode | |
nc | bool | No correctly working carriage return (DM2500) | |
nd | str | Non-destructive space (cursor right) | |
os | bool | Terminal overstrikes | |
pc | str | Pad character (rather than null) | |
se | str | End stand out mode | |
sf | str | (P) | Scroll forwards |
so | str | Begin stand out mode | |
sr | str | (P) | Scroll reverse (backwards) |
ta | str | (P) | Tab (other than `^I' or with padding) |
ul | bool | Terminal underlines even though it doesn't overstrike | |
up | str | Upline (cursor up) | |
vb | str | Visible bell (may not move cursor) | |
ve | str | Sequence to end open/visual mode | |
vs | str | Sequence to start open/visual mode | |
xn | str | A newline is ignored after a wrap (Concept) |
termcap ã® capabilities ã¯ååãšããŠäžäœäºæã«ãªã£ãŠããŸãã®ã§ã çŸåšäžè¬ã«äœ¿ãããŠãã termcap ã®åŠ¥åœãªãšã³ããªãã 2BSD termcap ã® capabilities ã ããæŸãéãããšå¿ èŠãªãšã³ããªã®æ å ±ãäœæã§ããŸãã ä»äœ¿ã£ãŠãã£ããã Unix ã® /etc/termcap ãã xterm ããã㯠kterm ã® ãšã³ããªãèŠã€ããã°ããã®ã§ãããããã¡ã€ã«ãåœãŠã«ãªããªãã ãããã¯ãWindows ã§äœæ¥ããŠãããã®ã§ããã°ã Termcap/Terminfo Resources Page ãã termcap ãã¡ã€ã«ãåã£ãŠãããšè¯ãã§ãããã 念ã®ãããç§ã®äœæãã termcap ãžã®è¿œå ãšã³ããªã ãªã¹ãïŒã«æ²èŒããŠãããŸãã
ãªã¹ãïŒ termcap ã®è¿œå ãšã³ããª
x0|xterm|:\
:co#80:li#24:am:bs:mi:xn:\
:al=\E[L:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:\
:dc=\E[P:dl=\E[M:ei=\E[4l:ho=\E[H:im=\E[4h:\
:is=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>:\
:nd=\E[C:se=\E[m:sf=^J:so=\E[7m:sr=\EM:ta=^I:up=\E[A:
å®éã®ãšã³ããªã®è¿œå äœæ¥ã¯ ed ã䜿ã£ãŠ /etc/termcap ãçŽæ¥ä¿®æ£ããŸãã (å®è¡äŸïŒ)ããã㧠ed ã䜿ãã®ãæåŸããšæãã°å€å°é·ãè¡å ¥åã èŠã«ãªããªãã§ããã :-p
å®è¡äŸïŒ termcap ãžã®ãšã³ããªã®è¿œå
# cd /etc
# cp termcap termcap.orig
# ed termcap
....
# diff -e termcap.orig termcap
0a
x0|xterm|:\
:co#80:li#24:am:bs:mi:xn:\
:al=\E[L:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:\
:dc=\E[P:dl=\E[M:ei=\E[4l:ho=\E[H:im=\E[4h:\
:is=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>:\
:nd=\E[C:se=\E[m:sf=^J:so=\E[7m:sr=\EM:ta=^I:up=\E[A:
.
#
ã¡ãªã¿ã« xterm ã¯ããã³ã³ã®ã¿ãŒããã«ã®ä»£åè©ã§ãã£ã VT100 (å³å¯ã«ã¯ VT102) ããšãã¥ã¬ãŒãããã¿ãŒããã«ãšãã¥ã¬ãŒã¿ã§ãã â ã³ã©ã ïŒã§ VT100 ã«ã€ããŠçŽ¹ä»ããŠãããŸããã®ã§ãåèã«ããŠãã ããã
ããŠãããã§æºåã¯å šãŠæŽããŸãããè©Šãã« ex/vi ãèµ·åããŠã¿ãŸãããã Unix ãš SIMH ãäžæŠæ¢ããŠãxterm (kterm ããã®ä»ã®äºæã¿ãŒããã« ãšãã¥ã¬ãŒã¿ã§ãæ§ããŸããã) ããåèµ·åããŸããããã§æ³šæã㊠欲ããã®ã¯ãèµ·åããã¿ãŒããã«ãšãã¥ã¬ãŒã¿ã®ãŠã£ã³ããŠãµã€ãºã 80 æåà 24 æåã«ãããšããããšã§ãã
ãšããã®ãããã®åœæã® ex/vi ã¯è¡šç€ºå¯Ÿè±¡ãšããŠã¿ãŒããã«ãã æ³å®ããŠããŸãããå ã«çŽ¹ä»ãã termcap ã®ãšã³ããªäŸã§ã¯è¡šç€ºç»é¢ã 80 æåà 24 æå ã§ããããšãä»®å®ããŠããŸãããå®è¡äžã«ãã®å€§ããã å€ãã£ãŠãããããèªèããŠè¡šç€ºã®å€§ããã調æŽãããããªããšã¯ã§ããŸããã xterm ã¯ç¹å¥ã®èšå®ãããŠããªããã°ãããã©ã«ãã§è¡šç€ºç»é¢ã 80 æåà 24 æå ã«èšå®ããŠèµ·åããŸãã以éã®æäœã§ã ãŠã£ã³ããŠãµã€ãºãå€ããªãããã«æ³šæããŠãã ããã
xterm ã®ãŠã£ã³ããŠãéããããSIMH ãç«ã¡äžã Unix ãåèµ·åããŸãã (å®è¡äŸïŒ)
å®è¡äŸïŒ ex/vi ãèµ·åããŠã¿ã
$ pdp11
PDP-11 simulator V3.0-2
sim> set cpu URH70
sim> set cpu 2M
Disabling XQ
sim> set rp0 RP06
sim> att rp0 rp0.dsk
sim> set rp1 RP06
sim> att rp1 rp1.dsk
sim> boot rp0
boot
Boot
: hp(0,0)unix
mem = 2020544
# DATE 200403141245
SUN MAR 14 12:45:00 JST 2004
# <CNTL-D>
RESTRICTED RIGHTS: USE, DUPLICATION, OR DISCLOSURE
IS SUBJECT TO RESTRICTIONS STATED IN YOUR CONTRACT WITH
WESTERN ELECTRIC COMPANY, INC.
SUN MAR 14 12:45:16 JST 2004
login: root
Password:
You have mail.
#
# TERM=xterm
# export TERM
# PATH=$PATH:/usr/ucb
# export PATH
# printenv
HOME=/
PATH=:/bin:/usr/bin:/usr/ucb
TERM=xterm
#
# stty 9600
# tset
Erase set to control-H
#
# /etc/mount /dev/rp7 /mnt
# cd /mnt
#
# vi READ_ME
....
#
ã·ã¹ãã ãèµ·åãããåãæ¢ãã root ã§ãã°ã€ã³ãããŠãã ããã ex/vi ãèµ·åããããã«ã¯å°ãèšå®ãå¿ èŠã§ãããŸãç°å¢å€æ° TERM ã« termcap ã®ãšã³ããªå xterm ãèšå®ããŸããã€ãã§ã«ç°å¢å€æ° PATH ã« /usr/ucb ãè¿œå ã㊠BSD ã³ãã³ãã䜿ããããã«ããŠãããŸãããã ç°å¢å€æ°ã®èšå®ãçµã£ãã printenv ã§èšå®å 容ã®ç¢ºèªãããŸãã 次ã«ç«¯æ«ã®èšå®ãè¡ããŸãããŸãåç·é床ã®èšå®ã§ããä»å㯠SIMH ã®äžã§ åãããŠããŸãã®ã§ããã®èšå®ã¯æ¬è³ªçã«æå³ããªããšæãããã§ããããã å®ã¯ ex/vi ã¯åç·é床ããã§ãã¯ããŠã1200 baud 以äžã®å Žåã«ã¯ ç»é¢ã®ããååãã䜿ããªãããã«ãªããŸããããã§ãããã§ã¯ 1200 ãã 倧ããªå€ãèšå®ããŠãããŸãããã次㫠tset ã³ãã³ããå®è¡ããŸãã ãã® BSD ã³ãã³ã㯠termcap ã®ãšã³ããªãåç §ããŠã ãã®ä»ã®å¿ èŠãªåç·èšå®ãããŠãããŸãã"Erase set to control-H" 㚠衚瀺ãããŠããŸããããã以éïŒæååé€ã¯ # ããŒã§ã¯ãªã CNTL-H ã« ãªããŸãããªãããã®ç°å¢å€æ°ãšåç·ã«å¯Ÿããèšå®ã¯ãåœæã¯ãã°ã€ã³æã® èšå®ãšã㊠csh ã® .login ã sh ã® .profile ãªã©ã«èšè¿°ãããããšã äžè¬çã§ããã
ããã§ã¯ãŸã vi ããèµ·åããŠã¿ãŸãããããäœãé©åœãªãã¡ã€ã«ã éããŠã¿ãŠãã ãããçãããããåç¥ã® vi ã§ãããããã®æäœæ¹æ³ã ããã§æ¹ããŠèª¬æãããŸã§ããªãã§ãããããããªãã ãã¡ãã£ãšããããïŒ ã¯ããå®ã¯ 2BSD ã® ex/vi ã¯ã«ãŒãœã«ã移åããã³ãã³ãã®ããŒãã€ã³ãã£ã³ã°ã çŸåšçãããè¯ããåç¥ãªãã®ãšéããŸãã2BSD ã«ä»å±ãã "Vi Quick Reference" ãèŠãŠããã ããšãããã®ã§ãããã«ãŒãœã«ã®è¡ç§»åã®å Žå㯠CNTL-N ãš CNTL-P (ãã㯠emacs ã®ããŒãã€ã³ãã£ã³ã°ãšåãã§ãã)ã ããã㯠+ ãš - ã«ãã€ã³ããããŠããŸãããããŠã«ãŒãœã«ãïŒæåå³ã« 移åããã«ã¯ space ã䜿ããŸããçãããè¯ããåç¥ã® j, k, l ããŒã«ã¯ æ©èœããã€ã³ããããŠããªãã®ã§ããããã®ããŒãæŒããš beep ããªãã¯ãã§ãã ããã¯ã¡ãã£ãšé©ãã§ããã
ããã§ã¯äœ¿ãã¥ããã®ã§ j, k, l ããŒã䜿ããããã«æçŽããããŸãããã ãã®ããã«ã¯ ex/vi ã®ãœãŒã¹ãä¿®æ£ããå¿ èŠããããŸããå®è¡äŸïŒã埡芧ãã ããã
å®è¡äŸïŒ j, k, l ã³ãã³ããè¿œå ããã
# cd /mnt/src/ex
# cp ex_voperate.c ex_voperate.c.orig
# ex ex_voperate.c
"ex_voperate.c" 834 lines, 14402 characters
:set number
:528
case CTRL(n):
:a
529 case 'j':
530 .
:480
480 */
:a
481 case 'k':
482 .
:397
397 */
:a
398 case 'l':
399 .
:w
"ex_voperate.c" 837 lines, 14435 characters
:q
# diff -e ex_voperate.c.orig ex_voperate.c
528a
case 'j':
.
480a
case 'k':
.
397a
case 'l':
.
# make clean
....
# make install
....
#
ãã£ããã§ãããä»åã®ä¿®æ£ã«ã¯ ex ã䜿ã£ãŠã¿ãŸããããex 㯠ed ã® äžäœäºæã§ãã®ã§ãå šãåãã³ãã³ããåãä»ããŠãããŸããed ã§ã¯ãªã æ¢ã㊠ex ã䜿ãçç±ããããšããã°ãããã¯äŸãã° set number ã³ãã³ãã äžããããã§ããããset number ã³ãã³ããå®è¡ãããšè¡è¡šç€ºã®éã è¡çªå·ã衚瀺ããŠãããããã«ãªããŸããdiff -e ã®åºåãªã© è¡æåã®ãã¡ã€ã«ç·šéãå¿ èŠãªå Žåããã®æ©èœã¯äŸ¿å©ã§ãã
ex_voperate.c ã®ä¿®æ£ãçµã£ããã å®è¡äŸïŒãšåãããã«ex/vi ãã€ã³ã¹ããŒã«ãããŠã vi ã®åäœã確ãããŠã¿ãŸããããã»ã j, k, l ããŒã䜿ããããã« ãªããŸãããã
èŠåŽã®ãããã£ãŠããããããªãªãžãã« ex/vi ãåºæ¥äžãããŸããã ããèªè ã®çããã®äžã«ã¯ãããã£ãŠã©ããªããããå³ãããã®ïŒããšæããŠãã æ¹ãããã£ãããã§ãããã確ãã«ä»æ¥ã§ã¯ããŸããŸãª vi ã¯ããŒã³ãååšããŠããã ã©ããéåžžã«ããåºæ¥ãŠããã®ã§ããæ¬ç©ã®vi ã䜿ããããšããããšã ãã§ã¯ ä»äžã€é åãèãããç¥ããŸããã ã§ãããã®ãªãªãžãã« ex/viãã¡ãŸãã®å€ãã® vi ã¯ããŒã³ã§ã¯ ãµããŒããããŠããªããªãŒãã³ã¢ãŒãã䜿ããŸãã第ïŒïŒåã§åŸ¡çŽ¹ä»ãã George Coulouris ã® em (Editor for Mortals) ãããã®ãã®ãªãŒãã³ã¢ãŒãã§ãã ããã°ããã¯ããªãªãžãã«ã ããã®æ©èœã§ãã :-p (ãvi ãåããªã å¿ èŠãªããžã£ã³ãã£ãŠæèŠãããã§ãããã)
ãªãŒãã³ã¢ãŒãã䜿ãããã«ã¯ããŸã ex ãèµ·åããŸãã ã³ãã³ãããã³ããã® ":" ãè¿ã£ãŠãããã å°æåã® "o" ãšæã£ãŠãã ãããããã§ãªãŒãã³ã¢ãŒãã«ãªããŸãã ãªãŒãã³ã¢ãŒãã§ã®çŸåšè¡ã®ç·šéæäœã¯ vi ãšåãã§ãããŸã vi ãš åãèŠé ã§è¡ç§»åãã§ããŸãããã«ãŒãœã«ãäžäžã«åãããšã¯ãããŸããã åžžã«ã³ãã³ãè¡ã®ïŒè¡äžã«çŸåšè¡ã衚瀺ãããŸãããªãŒãã³ã¢ãŒãã æããããã«ã¯ãå°æåã® "q" ãæã£ãŠãã ãããããšã® ex ã«æ»ããŸãã
ex ã®ãªãŒãã³ã¢ãŒãã®ç¹åŸŽã¯ã¿ãŒããã«ã®èšå®ãå¿ èŠãšããªãããšã§ãã äŸãã°ç°å¢å€æ° TERM ãèšå®ãããŠããªãç¶æ 㧠vi ãèµ·åããå Žåã "[Using open mode]" ãšè¡šç€ºãããŠãèªåçã«ãªãŒãã³ã¢ãŒã㧠ç«ã¡äžãããŸããã«ãŒãœã«ãç»é¢ãäžäžã«åããªãããšãé€ãã°ã åºæ¬çãªæäœã¯ vi ãšå€ãããªãã®ã§æ¡å€éå®ããŸãããè©Šãããã
â»
以äžãä»å㯠2BSD ã«åé²ãããŠãã ex/vi ããã«ãããŠã¿ãŸããã ãããã ã£ãã§ããããïŒ å®ã¯ããã®æäœæ¹æ³ã®ãããã Version 7 Unix ã«ã¯ç§ã倧å€ã¬ãããªå°è±¡ãæã£ãŠããã®ã§ããã äžæè°ãªãã®ã§ vi ãåãå§ããé端ãã°ããšã¢ãã³ãªå°è±¡ã«å€ãããŸããã ãããªãããã°ã©ã ãæžãæ°ã«ããªã£ãŠãããšãããã®ã§ãããšããããã§ã 次å㯠2BSD ã䜿ã£ãå®ç¿ã®æåŸãšããŠã1BSD/2BSD æ倧ã®ç®çã§ãã Berkeley Pascal System ã«ææŠããŠã¿ãããšæããŸãã»ã»ã»ãã§ã emacs ã¯ã©ããªããã§ããïŒããšä»°ã£ãŠããããªããé£èŒã¯ãŸã ç¶ããŸãïŒïŒ
ãããïŒãªã㧠/bin/sh ã®åé¡ãªã®ïŒã«ãŒãã«ã®åé¡ãããªãã®ïŒããš æã£ãæ¹ããããšæããŸãããããä»æ¥ã®ã¢ãã³ãª Unix ã§ã¯ å®è¡ããŒãã·ã§ã³ãèšå®ãããŠãã (å®è¡å¯èœãª) ã¹ã¯ãªãã㯠ã«ãŒãã«ã® exec ã·ã¹ãã ã³ãŒã«ã«å¯Ÿå¿ããã«ãŒãã³ã®ãªã㧠å é ã®ïŒè¡ã解éããŠããã®ã¹ã¯ãªãããåãä»ããããã°ã©ã ã 決å®ããå®è£ ãäžè¬çã§ããå®éããã®æ©èœãããã®ã§ãã¢ãã³ãª Unix ã§ã¯ perl ãªã©ã®ããŸããŸãªã€ã³ã¿ãŒããªã¿ã®ã¹ã¯ãªãããã³ãã³ãã®ããã« åãæ±ãããšãã§ããã®ã§ãããVersion 7 Unix ã§ã¯ãã®æ©èœã¯ å®è£ ãããŠããŸããããããã£ãŠãå®è¡å¯èœãªã·ã§ã«ã¹ã¯ãªããã æå®ã㊠exec ã·ã¹ãã ã³ãŒã«ãåŒã³åºããå Žåããšã©ãŒãçºçã ãšã©ãŒã³ãŒã ENOEXEC (Exec format error) ãè¿ã£ãŠããŸãã
ãããã誰ãã¹ã¯ãªãããå®è¡ããŠããã®ïŒããšããããšã«ãªããŸããã çã㯠/bin/sh èªèº«ã§ãã/bin/sh 㯠execve ã·ã¹ãã ã³ãŒã«ã åŒã³åºã㊠ENOEXEC ãè¿ã£ãŠããå Žåãå®è¡å¯Ÿè±¡ãšãªããã¡ã€ã«ã ã·ã§ã«ã¹ã¯ãªãããšä»®å®ããŠããã®ãã¡ã€ã«ãå ¥åãšããŠå®è¡ããããšã è©Šã¿ãŸãã(ãœãŒã¹ã³ãŒã /usr/src/cmd/sh/service.c ã® 140 è¡ç®ãããã 埡芧ãã ãã) æ¬æã§ææããŠããã³ã¡ã³ãã®åé¡ã¯ãã®åŸã® subshell ã« longjump ããåŸã§çºçããŠããããã§ããããã®ããã« Version 7 Unix ã® ã·ã§ã«ã¹ã¯ãªããæ©èœã¯ãéåžžã« /bin/sh ã«äŸåãã圢ã§å®è£ ãããŠããŸããã ä»æ¥ã®ã¢ãã³ãª Unix ã§äžè¬åãããŠããåè¿°ã®å®è£ æ¹æ³ã¯ãåŸã« BSD Unix 㧠æ¡çšãããã¢ãããŒãã§ãã
/bin/sh ãå®éã«ã¯ bash ã§ããããšãå€ãä»æ¥ã ç°å¢å€æ°ã®èšå®ãç ©ããããšèãã人ã¯ããŸãããªãã§ãããã å®é
$ export TERM=vt100
$
ã®ïŒè¡ã§èšå®ãã§ããããã§ãã ã§ããã®æ©èœãå®ã¯ bash ã®ç¬èªæ©èœãªãã§ããã ãªãŒã«ããŠãŒã¶ãŒã®æ¹ã¯è¯ããåç¥ã ãšæããŸããã ãªãªãžãã«ã® Bourne Shell ã§ã¯ãç°å¢å€æ°ãèšå®ããéã ãŸãã·ã§ã«å€æ°ãèšå®ããŠããã®å 容ãç°å¢å€æ°ã« export ãããšãã ïŒæ®µéã®æé ãå¿ èŠãšããŸãããäŸãã°ãããªæãã
$ TERM=vt100
$ export TERM
$
Bourne Shell ã® export ã³ãã³ãã§ã¯å€æ°ã®å€ãèšå®ããããšã¯ã§ããŸããã ããããã·ã§ã«å€æ°ã®å 容ãšç°å¢å€æ°ãåžžæäžèŽãããããšãçã£ãŠ ããããä»æ§ã«ããŠããã®ã ãšæšæž¬ãããŸããããã®çç±ã¯å®ãã§ã¯ãããŸããã ãšã¯ãããã®æé ãé »ç¹ã«ãã©ãã«ã®åå ã«ãªããŸããã ç°å¢å€æ°ãèšå®ããã€ãããã·ã§ã«å€æ°ããèšå®ããŠãªãã£ããšãããã C Shell ã®ããã«ã·ã§ã«å€æ°ãšç°å¢å€æ°ãç¬ç«ããŠèšå®ã§ããä»æ§ã®æ¹ã åççã ãšç§ã¯æãã®ã§ããã©ãã
ä»æ¥ setenv() 㯠libc ã®ã©ã€ãã©ãªé¢æ°ã«ãªã£ãŠããŸãã ããVersion 7 Unix ã® libc ã§ã¯ getenv() ã¯ååšããŸããã setenv() ã¯ååšããŸããããããããç°å¢å€æ°ã¯ã©ããã£ãŠ èšå®ããã®ïŒããšããçåã¯åœç¶ã§ãããããªãªãžãã«ã® Version 7 Unix ã§ã¯ç°å¢å€æ°ãèšå®ããŠããã®ã¯ /bin/login ãš /bin/sh ã®ïŒã€ã®ããã°ã©ã ã ãã§ãåã èªåã§ç°å¢å€æ°ã®é å environ ãçŽæ¥åç §ããŠå€ãèšå®ããŠããŸãããã€ãŸããã®åœæã äžè¬ç㪠Unix ããã°ã©ã ã¯ç°å¢å€æ°ãåç §ããã ãã ã£ããšããããã§ãã
ä»æ¥ãç§ãã¡ãç¥ãã©ã€ãã©ãªé¢æ° setenv() ã®ä»æ§ã¯ C Shell ã® ååã®å éšé¢æ°ãããŒã¹ã«ãªã£ãããã§ããäžèº«ã¯ãããC Shell ã® ãœãŒã¹ãèŠãŠãã ããããsh.func.c ã®æåŸã®æ¹ã§ãã
å®ã¯ ex ã®ã³ã³ãã€ã«æ¹æ³ãæ¢ãéçšã§ makefile.v6 ãè©ŠããŠã¿ãŸããã ãããã¡ãã§ã "Symbol table overflow" ãçºçããŸããã ã§ã2BSD ã®ãã£ã¹ããªãã¥ãŒã·ã§ã³ã®äžã«ãã®åé¡ãžã®å¯ŸåŠæ¹æ³ã èšè¿°ãããã®ããªãããšæ¢ãããšãã /mnt/upgrade/c ã« overflow 㫠察åŠããããããååšããŸããããã®ãã£ã¬ã¯ããªã«ãã c0.h ããã³ c11.c ã¯ã¯ /usr/src/cmd/c ã®äžã«ãã Ritchie C Compiler ãžã® ãããã®ããã§ããã
ã§ãããããåœãŠãããšãè©Šã¿ãã®ã§ãããããããŸããããŸããã ã©ãããå ã®ãœãŒã¹ãéãããã§ããã€ãŸã UCB ã§äœ¿ãããŠãã Ritchie C Compiler 㯠Version 7 Unix ã«åé²ãããŠãããã®ãšã¯ ç°ãªãããã§ãããŸãããšã¯æã£ãã®ã§ããã念ã®ãã Version 6 Unix ã« åé²ãããŠãã Ritchie C Compiler ãžã®ããããè©Šã¿ãŸãããããããããã¡ã ã§ããäžäœãUCB ã§äœ¿ãããŠãã Ritchie C Compiler ã£ãŠ ã©ã®ããŒãžã§ã³ïŒããšãŸãããé ãæ±ããããšã«ãªããŸããã
æ°æ¥ãžã¿ãã¿ããçµæãèŠã€ããçãã¯ããããã®ãããããªããš Programmers Work Bench (æ£ç¢ºã«ã¯ãããã PWB-2.0 â ã³ã©ã ïŒåç §) ã« åé²ãããŠãã Ritchie C Compiler ã«å¯Ÿãããããã ã£ãããã§ãã å šã Reject ãããããšãªããããã¯ããã¿ãªåœãããŸããã ããã§ãã®ããããåœãŠãåŸã®ãœãŒã¹ã Version 7 Unix ãæã£ãŠãã£ãŠ ã³ã³ãã€ã«ããããšããã®ã§ãããããå šãã³ã³ãã€ã«ã§ããŸããã Version 7 Unix ã«åé²ãããŠãã Ritchie C Compiler ãš diff ã åã£ãŠã¿ããšãããPWB 㯠Version 6 Unix ä»æ§ã®ã·ã¹ãã ãªã®ã§ ãã®äžã§åã Ritchie C Compiler ã Version 6 Unix ä»æ§ãªãã§ããã ã§ãVersion 7 Unix ãšã¯ (ã·ã¹ãã ã³ãŒã«ãªã©) ã·ã¹ãã ä»æ§ã倧ãã ç°ãªãããã³ã³ãã€ã«ã§ããªãã£ããšããããã§ãããããã« Version 7 Unix ã®ä»æ§ã«åãããããæ¹é ããã ãã®æéãåŽåããªãã£ãã®ã§ã ããã§ã³ã³ãã€ã©ãæçŽããããšããæ¹çã¯æ念ãããããªããªããŸããã
ååãMashey Shell ã®çŽ¹ä»ã®ãšããã§è§Šãã Programmer's Workbench (PWB) ã§ããã äºæ³ã«åããŠéèŠãªåœ¹å²ãæããããªãªãŒã¹ã§ãã£ãããšãããã£ãŠããŸããã ããã§ãããå°ã詳ãã觊ããŠãããŸãããã
ååã§ã埡玹ä»ããããã«ãPWB ã¯å€§èŠæš¡ãœãããŠã§ã¢éçºã®ããã® ã·ã¹ãã ãšããŠéçºãããžã§ã¯ããå§ãŸã£ããšèª¬æããŸãããã å®éã«ã¯ AT&T ã® Business Information Systems (BIS) ãããžã§ã¯ãã æ±ããåé¡ã解決ããããšãç®çã ã£ãããã§ãããã®åé¡ãšã¯ã åœæã®å€§åã³ã³ãã¥ãŒã¿ãæ±ããŠããéäºææ§ã®åé¡ã§ããã åœæ BIS 㯠IBMãUNIVAC(çŸUNISYS)ãXEROX ãªã©ç°ãªãã¡ãŒã«ãŒãæäŸããã çžäºã«äºææ§ã®ãªãïŒçš®é¡ä»¥äžã®ã¢ãŒããã¯ãã¥ã¢ã®äžã§åããœãããŠã§ã¢ã éçºããå¿ èŠããããŸããã第ïŒåã§åŸ¡çŽ¹ä»ããããã«ãåœæã®ãã®æ㮠倧åã³ã³ãã¥ãŒã¿ã¯äœ¿çšãã CPU æéã«ãã£ãŒãžãããä»çµã¿ã§ã å®æ©ã§ã®éçºã¯å€§å€ãéãããããŸãããæŽã«ããŸãã«ãã¢ãŒããã¯ãã¥ã¢ã ç°ãªãããã(ãœãŒã¹ã³ãŒããªã©)éçºããææãçµ±äžçã«ç®¡çããæ段ã ãããŸããã§ãããã§ããã®åé¡ã解決ããããã« Unix ã掻çšããããšããã®ã PWB ãããžã§ã¯ãã®ç®è«èŠã ã£ãããã§ãã
ãã® PWB ãããžã§ã¯ãã®äžå¿äººç©ã¯ååã埡玹ä»ãã Rudd Canaday ã§ãã ãã®äººã¯ç¬¬ïŒåã第ïŒåã§åŸ¡çŽ¹ä»ãã Ken Thompson ã®ãã§ãŒã¯ãã¡ã€ã« ã·ã¹ãã ã®éçºãæäŒã£ã Unix éçºã®ãªãªãžãã«ã¡ã³ããŒã®äžäººã§ãã 1973 幎 Version 3 Unix (ããã³ Version 4 Unix) ãçºè¡šãããé ã«ã Unix ã·ã¹ãã ãã®ãã®ã®éçºããé¢ããŠããã® PWB ãããžã§ã¯ããå§ãã ãšã®ããšã§ãã
ãã®ãããžã§ã¯ãã®æ倧ã®ç¹åŸŽã¯ãã®éçºæ¹éã«ãããŸããããããããã¡ãªã ç·è«çèŠå°ã«ç«ã£ãŠçµ±åçãªã·ã¹ãã ãšããŠã¯ãŒã¯ãã³ããèšèšããã¢ãããŒãã ããªãã¡ãããããŠã³åã®ã¢ãããŒãã¯æåããé€å€ãããBIS ã®éçºèŠå¡ã® æ±ããŠããå ·äœçãªåé¡ã解決ããããŒã«ã Unix ã®äžã«ïŒã€ãã€å®è£ ã㊠ãããšãããããããããã ã¢ããåã®ã¢ãããŒããæ¡çšããŠããŸããã æ ã« PWB/UNIX ã¯ã·ã¹ãã ãšããŠã¯ Unix ãã®ãã®ã§ãããååã埡玹ä»ãã RJE ã SCCS ãšãã£ãèå㪠PWB ãããžã§ã¯ãã®ææã¯ãåŸã« Unix äžã® ãŠããŒã¯ãªãœãããŠã§ã¢éçºããŒã«ãšããŠçãæ®ã£ãŠããããšã«ãªããŸããã
Version 4 Unix ãããŒã¹ã«ãããªãªãžãã«ã® PWB/UNIX ãšåŒã°ããã·ã¹ãã 㯠1974 幎ã«ãªãªãŒã¹ãããŠããŸããããã®åŸã¯ Version 6 Unix ãããŒã¹ã«ãã PWB 1.0 ã 1977 幎ã«ãPWB 2.0 ã 1978 幎ã«ãªãªãŒã¹ãããŠããŸããUnix ã® æŽå²ãšãã芳ç¹ã§ããããã®ãªãªãŒã¹ã¯éèŠã§ãäŸãã°â ã³ã©ã ïŒã§è¿°ã¹ã Ritchie C Compiler ã®ã¢ããããŒãçãªã©ãéæåé²ãããŠããŸããã1977 幎ã 1978 幎ãšããã°ç¬¬ïŒåã§åŸ¡çŽ¹ä»ããããã« Unix èªäœã¯ Version 7 ã®éçºææã« åœãããããŒã¿ããªãã£ãéæããããã®éçºäœæ¥ã«éäžããŠããææã§ãã å®éãVersion 6 ããªãªãŒã¹ãããŠãã Version 7 ããªãªãŒã¹ããããŸã§ã¯ ïŒå¹ŽåããïŒå¹Žãšããé·ãæéããããŸãããPWB ã¯çµæçã«ãã®é·ããªãªãŒã¹ ã®ç©ºçœæéãåãã圹å²ãæãããããšã«ãªããŸãããã㯠Version 7 㧠åé²ããã Unix ã®ä»£è¡šãããã㪠make ã lex ãšããããŒã«ãã å®ã¯ååºã¯ PWB ã ã£ããšããäºå®ããã確èªã§ããŸãã
PWB 㯠2.0 ãæåŸã«ãã®åŸ PWB ãªãªãŒã¹ã¯äœãããŠããªãããã§ãã ãããã AT&T ã Unix ããžãã¹ãéå§ããããšã«ãªãããã®ææã Unix ã®äžéšãšããŠåã蟌ãŸããããã ãšæãããŸãã
çŸåšãPWB 㯠Ancient Unix ã®äžéšãšããŠç¡æã§ãœãŒã¹ã³ãŒãã å ¥æããããšãã§ããŸããäŸã«ãã£ãŠ The Unix Heritage Society ã® Unix Archive ããå ¥æããã®ãäžçªãæ軜ã§ããããã¡ãªã¿ã«ã Unix Archive ãžã® PWB ã®ãœãŒã¹ã®æäŸè ã®ïŒäººã§ãã Keith Bostic 㯠UCB CSRG ã®æåŸã®ïŒäººã®ã¡ã³ããŒã®ãã¡ã®äžäººã§ãããšããããšã¯ã UCB 㯠PWB ã®ã³ãŒããå ¥æããŠãããšããããšã«ãªããŸããã ããããäœæ 2BSD ã« PWB 2.0 ã® Ritchie C Compiler ã«å¯Ÿãã ããããåé²ãããŠããã®ãïŒãã®çã§ãããã
è¿œèš: åè¡æ¬ã§ã¯ç¬¬ïŒç« 㧠PWB ã玹ä»ããŠããŸãã
ç§ã®äžä»£ã§ã¯ãã³ã³ãã¥ãŒã¿ã®ã¿ãŒããã«ããšãããšã ãŸã DEC ã® VT100 ãæãåºããŸãããŠã£ã³ããŠã·ã¹ãã å šçã®æšä»ã ãã¿ãŒããã«ããšããçšèªèªäœãæ»èªã®ããã«ãªã£ãŠããŸããã ããã§ã VT100 ã®åœ±é¿ããã¯å ããŸãããxterm ã kterm ãªã© X Window System ã®äžã§åäœããã¿ãŒããã«ãšãã¥ã¬ãŒã¿ã¯æ°ã ååšããŸããããããã®ããã°ã©ã ããšãã¥ã¬ãŒãããŠãã ã¿ãŒããã«ãšããã®ã¯ãå®ã¯ VT100 (æ£ç¢ºã« VT102) ã§ãã ç§ãã¡ã¯ç¥ããç¥ããã®ãã¡ã« VT100 ã®ãäžè©±ã«ãªã£ãŠãããã§ããã
DEC ã® VT100 㯠1978 幎ã«çºè¡šãããŸããã以éãASCII CODE ããŒã¹ã® ã¿ãŒããã«ã®ããã¡ã¯ãã¹ã¿ã³ããŒããšããŠåºãèªç¥ããç¶ããŠããŸãã 1980 幎代ã«è£œååãããå€ãã®ã¿ãŒããã«è£œå㯠VT100 äºæã å±ã£ãŠããŸããããããœã³ã³äžã§åäœããã¿ãŒããã«ãšãã¥ã¬ãŒã¿ã§ã VT100 ã® ãšã¹ã±ãŒãã·ãŒã±ã³ã¹ããµããŒãããã®ã¯åºæ¬ãšç解ãããŠããŸããã VT100 ããã®ãããªå€§ããªåœ±é¿åãæã£ãã®ã«ã¯ããã¡ããåœæã® ããã³ã³æ¥çã®èŠè ã§ãã£ã DEC ã®è£œåã§ãã£ããšããããšãäžããããŸããã ãã£ãšãéèŠãªçç±ã¯ä»ã«ãããŸããVT100 㯠ANSI äºæã®ã¿ãŒããã«ã® æåã®è£œåã ã£ãã®ã§ãã
DEC ã VT100 ãçºè¡šããç¿å¹Žã® 1979 幎ãã¢ã¡ãªã«ã®æšæºåå£äœã§ãã ANSI 㯠X3.64 "Additional Controls for Use with American National Standard Code for Information Interchange" ãæšæºåããŸãããDEC 㯠ãã®æšæºåäœæ¥ã暪ç®ã§èŠãªããã䞊è¡ããŠè£œåéçºãè¡ããŸãããã ãã®è£œåã VT100 ãšãªããŸãããä»æ¥ã§ãæšæºåäœæ¥ãšäžŠè¡ã㊠補åéçºãè¡ãããããšã¯ãããŸãããåœæã¯ãã£ãšæ¥µç«¯ãªç¶æ³ã§ ç¹å®ã®ã¡ãŒã«ãŒãéçºãã補åããæåããæšæºã«é©åããŠãã ãšãããããªããšãçµæ§ãããŸããã ãããåœæ圱é¿åãæã£ãŠãã DEC ãšããã©ããèªç€Ÿè£œåããããŸã§ 圱é¿åã®ããããã¡ã¯ãã¹ã¿ã³ããŒãã«æŒãäžããåã¯ãªãã£ãã§ãããã çŸåšã® VT100 ã®å°äœãäœã£ãã®ã¯ ANSI X3.64 ã®ãããã§ãã
ãã®æšæºä»æ§ã¯äž»ã«ãšã©ãŒãçºçããåŸã®åŸ©æ§ãªã©ã«ã€ããŠã ä»æ§äžã®æªå®çŸ©ãªã©ããããŸãããããæ ANSI X3.64 ã®ä»æ§ã« åºã¥ããŠã¿ãŒããã«ãéçºããŠãã補åãšããŠåé¡ãæ®ã£ãŠããŸãã®ã§ãã DEC 㯠ANSI X3.64 ãéµå®ãã€ã€ããåé¡ã®éšåã«ã€ããŠã¯ç¬èªã®æ¹æ³ã§ åé¿ããããã«ã㊠VT100 ãéçºããŸãããã®ã¡ã«ãåŸçºã® ANSI äºæ ã¿ãŒããã«ãéçºããŠããã¡ãŒã«ãŒãåæ§ã®åé¡ã«ã¶ã€ããã®ã§ããã çµå±æ¢ã«è£œååãããŠãã VT100 ãåèã«ããŠåé¡ãåé¿ããã®ã§ããã ãããã£ãäºæ ãã VT100 㯠ANSI X3.64 ã®ãªãã¡ã¬ã³ã¹ã®åœ¹å²ã æãããã ãã§ã¯ãªããç¬èªã®åé¡åé¿æ¹æ³ãæ瀺ããæ Œå¥œã«ãªãã ããããå«ãã VT100 äºæã®ã¿ãŒããã«ãæ¥çã«å®çããããã§ãã
ããã§ãåŸçºã¡ãŒã«ãŒã VT100 äºæã®ã¿ãŒããã«ãäœã£ãŠå売ã«ãªã£ãã®ïŒã ãšçåãæãããæ¹ãããã£ãããã§ããããå®ã¯ååã«å売ã«ãªã£ããã§ããã äŸãã°ããã€ãŠç§ã VAX ã®ã·ã¹ãã 管çè ãããŠããé ãéçºçšã«ã¯ïŒïŒå°ã® ã¿ãŒããã«ãæ¥ç¶ãããŠããŸãããããã®ãã¡çŽæ£ã® VT100 ã¯ïŒå°ã ã㧠æ®ãïŒïŒå°ã¯å šéš VT100 äºæã®ä»ç€Ÿè£œåãæ¥ç¶ãããŠããŸããã ããããã VT100 ã¯å€æ®µã®é«ãã¿ãŒããã«ã ã£ããã§ããã
åŸã« DEC ã VT100 ã®å»äŸ¡çã補ååããŸããVT100 ã§ã¯ãªãã·ã§ã³æ±ãã« ãªã£ãŠããããªã³ã¿ãŒããŒã(ç»é¢ã®ããŒãã³ããŒãåãããã«äœ¿ããŸã)ã æšæºè£ åã«ããŠå°ãå€æ®µãäžãã VT102 ãšããããã®ãªãã·ã§ã³ã å šéšåã£ãŠã°ããšå€æ®µãäžãã VT101 ã®ïŒçš®é¡ã補ååãããŸããã xterm ãªã©ã¯ãã® VT102 ã§è¿œå ãããäžéšã®ãšã¹ã±ãŒãã·ãŒã±ã³ã¹ã ãµããŒãããŠãããããVT102 äºæã®ã¿ãŒããã«ãšãã¥ã¬ãŒã¿ããš åŒã°ããŠããŸãã
ãªã VT100 ã«é¢ããæè¡æ å ±ã調ã¹ãããã«ã¯ VT100.net ãšããããŒã ããŒãžã䟿å©ã§ããDEC ãçºè¡ãã æè¡è³æããããã«æŽåãããŠæ²èŒãããŠããŸãã®ã§ã äžåºŠåŸ¡èŠ§ã«ãªã£ãŠã¯ãããã§ããããã