Vendor import of tcsh 6.15.00
authorMatthias Schmidt <matthias@dragonflybsd.org>
Tue, 15 Jan 2008 13:41:47 +0000 (13:41 +0000)
committerMatthias Schmidt <matthias@dragonflybsd.org>
Tue, 15 Jan 2008 13:41:47 +0000 (13:41 +0000)
367 files changed:
contrib/tcsh-6/Copyright [new file with mode: 0644]
contrib/tcsh-6/README [new file with mode: 0644]
contrib/tcsh-6/complete.tcsh [new file with mode: 0644]
contrib/tcsh-6/config/bsd4.4 [new file with mode: 0644]
contrib/tcsh-6/config_f.h [new file with mode: 0644]
contrib/tcsh-6/ed.chared.c [new file with mode: 0644]
contrib/tcsh-6/ed.decls.h [new file with mode: 0644]
contrib/tcsh-6/ed.defns.c [new file with mode: 0644]
contrib/tcsh-6/ed.h [new file with mode: 0644]
contrib/tcsh-6/ed.init.c [new file with mode: 0644]
contrib/tcsh-6/ed.inputl.c [new file with mode: 0644]
contrib/tcsh-6/ed.refresh.c [new file with mode: 0644]
contrib/tcsh-6/ed.screen.c [new file with mode: 0644]
contrib/tcsh-6/ed.term.c [new file with mode: 0644]
contrib/tcsh-6/ed.term.h [new file with mode: 0644]
contrib/tcsh-6/ed.xmap.c [new file with mode: 0644]
contrib/tcsh-6/gethost.c [new file with mode: 0644]
contrib/tcsh-6/glob.c [new file with mode: 0644]
contrib/tcsh-6/glob.h [new file with mode: 0644]
contrib/tcsh-6/mi.termios.c [new file with mode: 0644]
contrib/tcsh-6/nls/et/set1 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set10 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set11 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set12 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set13 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set14 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set15 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set16 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set17 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set18 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set19 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set2 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set20 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set21 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set22 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set23 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set24 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set25 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set26 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set27 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set29 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set3 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set30 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set31 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set4 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set5 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set6 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set7 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set8 [new file with mode: 0644]
contrib/tcsh-6/nls/et/set9 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set1 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set10 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set11 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set12 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set13 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set14 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set15 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set16 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set17 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set18 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set19 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set2 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set20 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set21 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set22 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set23 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set24 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set25 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set26 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set27 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set29 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set3 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set30 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set31 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set4 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set5 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set6 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set7 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set8 [new file with mode: 0644]
contrib/tcsh-6/nls/finnish/set9 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set1 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set10 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set11 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set12 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set13 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set14 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set15 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set16 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set17 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set18 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set19 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set2 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set20 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set21 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set22 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set23 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set24 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set25 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set26 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set27 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set29 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set3 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set30 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set31 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set4 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set5 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set6 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set7 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set8 [new file with mode: 0644]
contrib/tcsh-6/nls/french/set9 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set1 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set10 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set11 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set12 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set13 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set14 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set15 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set16 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set17 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set18 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set19 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set2 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set20 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set21 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set22 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set23 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set24 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set25 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set26 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set27 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set29 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set3 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set30 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set31 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set4 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set5 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set6 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set7 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set8 [new file with mode: 0644]
contrib/tcsh-6/nls/german/set9 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set1 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set10 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set11 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set12 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set13 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set14 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set15 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set16 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set17 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set18 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set19 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set2 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set20 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set21 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set22 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set23 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set24 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set25 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set26 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set27 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set29 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set3 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set30 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set31 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set4 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set5 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set6 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set7 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set8 [new file with mode: 0644]
contrib/tcsh-6/nls/greek/set9 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set1 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set10 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set11 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set12 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set13 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set14 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set15 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set16 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set17 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set18 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set19 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set2 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set20 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set21 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set22 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set23 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set24 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set25 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set26 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set27 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set29 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set3 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set30 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set31 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set4 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set5 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set6 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set7 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set8 [new file with mode: 0644]
contrib/tcsh-6/nls/italian/set9 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set1 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set10 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set11 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set12 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set13 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set15 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set16 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set17 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set18 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set2 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set21 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set24 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set29 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set3 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set30 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set4 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set5 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set6 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set7 [new file with mode: 0644]
contrib/tcsh-6/nls/ja/set8 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set1 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set10 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set11 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set12 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set13 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set14 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set15 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set16 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set17 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set18 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set19 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set2 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set20 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set21 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set22 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set23 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set24 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set25 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set26 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set27 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set29 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set3 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set30 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set31 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set4 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set5 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set6 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set7 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set8 [new file with mode: 0644]
contrib/tcsh-6/nls/russian/set9 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set1 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set10 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set11 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set12 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set13 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set14 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set15 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set16 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set17 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set18 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set19 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set2 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set20 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set21 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set22 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set23 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set24 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set25 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set26 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set27 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set29 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set3 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set30 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set31 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set4 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set5 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set6 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set7 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set8 [new file with mode: 0644]
contrib/tcsh-6/nls/spanish/set9 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set1 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set10 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set11 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set12 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set13 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set14 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set15 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set16 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set17 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set18 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set19 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set2 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set20 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set21 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set22 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set23 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set24 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set25 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set26 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set27 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set29 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set3 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set30 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set31 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set4 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set5 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set6 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set7 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set8 [new file with mode: 0644]
contrib/tcsh-6/nls/ukrainian/set9 [new file with mode: 0644]
contrib/tcsh-6/patchlevel.h [new file with mode: 0644]
contrib/tcsh-6/pathnames.h [new file with mode: 0644]
contrib/tcsh-6/sh.c [new file with mode: 0644]
contrib/tcsh-6/sh.char.c [new file with mode: 0644]
contrib/tcsh-6/sh.char.h [new file with mode: 0644]
contrib/tcsh-6/sh.decls.h [new file with mode: 0644]
contrib/tcsh-6/sh.dir.c [new file with mode: 0644]
contrib/tcsh-6/sh.dir.h [new file with mode: 0644]
contrib/tcsh-6/sh.dol.c [new file with mode: 0644]
contrib/tcsh-6/sh.err.c [new file with mode: 0644]
contrib/tcsh-6/sh.exec.c [new file with mode: 0644]
contrib/tcsh-6/sh.exp.c [new file with mode: 0644]
contrib/tcsh-6/sh.file.c [new file with mode: 0644]
contrib/tcsh-6/sh.func.c [new file with mode: 0644]
contrib/tcsh-6/sh.glob.c [new file with mode: 0644]
contrib/tcsh-6/sh.h [new file with mode: 0644]
contrib/tcsh-6/sh.hist.c [new file with mode: 0644]
contrib/tcsh-6/sh.init.c [new file with mode: 0644]
contrib/tcsh-6/sh.lex.c [new file with mode: 0644]
contrib/tcsh-6/sh.misc.c [new file with mode: 0644]
contrib/tcsh-6/sh.parse.c [new file with mode: 0644]
contrib/tcsh-6/sh.print.c [new file with mode: 0644]
contrib/tcsh-6/sh.proc.c [new file with mode: 0644]
contrib/tcsh-6/sh.proc.h [new file with mode: 0644]
contrib/tcsh-6/sh.sem.c [new file with mode: 0644]
contrib/tcsh-6/sh.set.c [new file with mode: 0644]
contrib/tcsh-6/sh.time.c [new file with mode: 0644]
contrib/tcsh-6/sh.types.h [new file with mode: 0644]
contrib/tcsh-6/tc.alloc.c [new file with mode: 0644]
contrib/tcsh-6/tc.bind.c [new file with mode: 0644]
contrib/tcsh-6/tc.const.c [new file with mode: 0644]
contrib/tcsh-6/tc.decls.h [new file with mode: 0644]
contrib/tcsh-6/tc.disc.c [new file with mode: 0644]
contrib/tcsh-6/tc.func.c [new file with mode: 0644]
contrib/tcsh-6/tc.h [new file with mode: 0644]
contrib/tcsh-6/tc.nls.c [new file with mode: 0644]
contrib/tcsh-6/tc.nls.h [new file with mode: 0644]
contrib/tcsh-6/tc.os.c [new file with mode: 0644]
contrib/tcsh-6/tc.os.h [new file with mode: 0644]
contrib/tcsh-6/tc.printf.c [new file with mode: 0644]
contrib/tcsh-6/tc.prompt.c [new file with mode: 0644]
contrib/tcsh-6/tc.sched.c [new file with mode: 0644]
contrib/tcsh-6/tc.sig.c [new file with mode: 0644]
contrib/tcsh-6/tc.sig.h [new file with mode: 0644]
contrib/tcsh-6/tc.str.c [new file with mode: 0644]
contrib/tcsh-6/tc.vers.c [new file with mode: 0644]
contrib/tcsh-6/tc.wait.h [new file with mode: 0644]
contrib/tcsh-6/tc.who.c [new file with mode: 0644]
contrib/tcsh-6/tcsh.man [new file with mode: 0644]
contrib/tcsh-6/tw.color.c [new file with mode: 0644]
contrib/tcsh-6/tw.comp.c [new file with mode: 0644]
contrib/tcsh-6/tw.decls.h [new file with mode: 0644]
contrib/tcsh-6/tw.h [new file with mode: 0644]
contrib/tcsh-6/tw.help.c [new file with mode: 0644]
contrib/tcsh-6/tw.init.c [new file with mode: 0644]
contrib/tcsh-6/tw.parse.c [new file with mode: 0644]
contrib/tcsh-6/tw.spell.c [new file with mode: 0644]

diff --git a/contrib/tcsh-6/Copyright b/contrib/tcsh-6/Copyright
new file mode 100644 (file)
index 0000000..6ba10c4
--- /dev/null
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 1980, 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
diff --git a/contrib/tcsh-6/README b/contrib/tcsh-6/README
new file mode 100644 (file)
index 0000000..9648c27
--- /dev/null
@@ -0,0 +1,207 @@
+This is tcsh version 6.15.  Tcsh is a version of the Berkeley
+C-Shell, with the addition of: a command line editor, command and file
+name completion, listing, etc. and a bunch of small additions to the
+shell itself.
+
+Tcsh has been ported to most unix variants, and can be tinkered to work
+in unix systems that it has not ported yet. See the Ported file for
+a more complete list of ported systems and in the config directory for
+a configuration file that matches your system.
+Tcsh also runs under VMS/POSIX and OS/2+emx; the OS/2 port is not
+complete yet.
+
+Feel free to use it.  These changes to csh may only be included in a
+commercial product if the inclusion or exclusion does not change the
+purchase price, level of support, etc.  Please respect the individual
+authors by giving credit where credit is due (in other words, don't
+claim that you wrote portions that you haven't, and don't delete the
+names of the authors from the source code or documentation).  
+
+To install tcsh:
+
+0)  Try running "./configure".  If that doesn't work, goto step 1.
+    Run "./configure --help" to see possible options.  After running
+    configure, goto step 3.
+
+1)  Otherwise copy Makefile.std to Makefile. Look at the Makefile and
+    make sure that you are using the right compilation flags.
+
+2)  Copy the appropriate for your machine and OS config file from the
+    config subdirectory into config.h.  Consult the file "Ported" for
+    settings known to work on various machines.  If you are trying to
+    compile tcsh on a machine for which there is no config file yet,
+    you will need to create a config file using as a template one of
+    the supplied ones.  If you get tcsh working on a new machine, I'd
+    appreciate a copy of the config file plus additional information
+    about the architecture/OS.  If you are creating a new config file,
+    look very hard at BSDJOBS and BSDTIMES if you are running
+    a non-BSD machine.  For vanila SysV, these would all be #undef-ed,
+    but others may vary (such as A/UX or HPUX).  On a pyramid, compile
+    in the UCB universe even if you are running under the ATT universe
+    usually; it will work anyway, and you get job control for free.
+
+3)  Look at config_f.h, and enable or disable any features you want.
+    It is configured the way I like it, but you may disagree.
+
+4)  Look at host.defs to make sure that you have the right defines to set
+    the environment variables "HOSTTYPE", "MACHTYPE", "OSTYPE" and 
+    "VENDOR" correctly.  If you need to make changes, PLEASE SEND THEM 
+    BACK TO ME.
+
+5)  You may want to adjust the DESTBIN and DESTMAN entries in
+    the Makefile.  These are the directories that tcsh, and the tcsh.1
+    man entry will be placed in when you do a "make install" and "make
+    install.man" respectively.  If you decide to install tcsh somewhere
+    other than in /usr/local/bin/tcsh, you should #define _PATH_TCSHELL
+    "/your/installation/directory/tcsh" in pathnames.h.
+
+6)  make
+
+7)  Read the documentation while you are waiting.  The file tcsh.man
+    is in standard [nt]roff -man format. If you like, you can run the
+    tcsh.man2html script (requires Perl) to generate an HTML version of
+    the manpage which you can read with Mosaic, lynx or other HTML browser.
+
+8)  Test tcsh by typing ./tcsh to see that it has compiled correctly.
+    The history command should give a time stamp on every entry.
+    Typing normal characters should echo each exactly once.  Control-A
+    should put the cursor at the beginning of the input line, but after
+    the prompt.  Typing characters after that should insert them into
+    the line.  If you have job control make sure that stopping and
+    restarting jobs works. Make sure you can ^C in the middle of the
+    input line.  Also make sure that pipelines work correctly and there
+    are no races. Try 'echo | cat | cat | cat | cat | more' a couple of
+    times. If you have job control, try this command in the background
+    and bring it in the foreground when it stops for tty output.  Also
+    make sure that the ioctl() modes are preserved.  Get into vi, enter
+    and exit input mode and suspend it, background it and foreground it
+    again. After all that, lastly make sure that the tty process group
+    manipulation is happening correctly. Try ftp to some host. If your
+    passwd appears on the screen, you have lost /dev/tty. Otherwise
+    everything is fine.
+
+9)  Once satisfied that tcsh is working correctly, complete the installation
+    by typing "make install" to install the binary, and "make install.man" to
+    install the documentation. Don't forget to look at complete.tcsh for
+    useful completions...
+
+10) Enjoy.
+
+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
+
+Various:
+
+***************************************************************************
+
+On sysv versions < 3.0 (not hpux) Doug Gwyn's public domain directory 
+manipulation library has to be installed. This library is available
+for anonymous ftp from prep.ai.mit.edu:/pub/gnu/dirent.tar.Z
+If the network is not installed, then there is a gethostname()
+routine is tc.os.c
+
+***************************************************************************
+
+On BSDreno, in ttyname() closedir() is called twice and so the same
+pointer gets free'd twice. tcsh's malloc is picky and it prints an
+error message to that effect. If you don't like the message:
+
+1. Apply the following patch:
+
+*** /usr/src/lib/libc/gen/ttyname.c.orig       Fri Jun  1 17:17:15 1990
+--- /usr/src/lib/libc/gen/ttyname.c    Tue Oct 29 16:33:12 1991
+***************
+*** 51,57 ****
+               if (stat(buf, &sb2) < 0 || sb1.st_dev != sb2.st_dev ||
+                   sb1.st_ino != sb2.st_ino)
+                       continue;
+-              closedir(dp);
+               rval = buf;
+               break;
+       }
+--- 51,56 ----
+
+Or: Comment the error printing out in tc.alloc.c
+Or: Compile -DSYSMALLOC
+
+
+***************************************************************************
+
+From: Scott Krotz <krotz@honey.rtsg.mot.com>
+
+Tcsh has been ported to minix by  Scott Krotz (krotz@honey.rtsg.mot.com).
+Unfortunately the minix sed is broken, so you'll have to find a way to
+make tc.const.h, sh.err.h, ed.defns.h which are automatically generated.
+The easiest way to create them is to make a copy from unix, copying 
+minix to config.h, and then 'make sh.err.h tc.const.h ed.defns.h'
+
+The OS/dependent files are in mi.termios.h, mi.wait.h, mi.varargs.h
+
+You will get some warnings, but dont worry about them, just ignore
+them.  After tcsh has compiled and the gcc binary is converted to a
+minix binary, remember to chmem it to give it more memory - it will
+need it!  How much you need depends on how many aliases you have, etc..
+Add at least 50000 to it.
+
+One last thing.  You might have to make some links for include files so
+that they are in the directories that tcsh is expecting while compiling.
+I forget if I had to do this or not, but it should be fairly easy to sort
+out.  If it cant find any include files this is probably the reason.
+
+If you have any problems, please tell me.  I can be contacted through
+e-mail at:
+
+krotz@honey.rtsg.mot.com
+
+I also read comp.os.minix on a regular basis, so a note there will get
+my attention also.
+
+Have fun!
+
+ps.  The termios functions are provided by Magnus Doell and Bruce Evans.
+     Thanks, guys!
+
+
+From: Bob Byrnes <byrnes@ee.cornell.edu>
+
+This is for minix 1.5 (straight out of the box from P-H) plus the i386
+patches from Bruce Evans.
+
+I cross-compiled on a Sun using gcc 2.1 with a target of i386-bsd
+(using the minix include files instead of the bsd versions), and then
+linked the resulting object files with similarly compiled crtso.o and
+libc.a on vax (little endian) using a hacked version of ld which I put
+together to generate minix executables instead of bsd a.out format.
+What a kludge ...
+
+I compiled with -O2 -Wall ...  So far I haven't noticed any problems
+with the optimizer.
+
+In case anyone is contemplating compiling tcsh with bcc (Bruce Evan's
+i386 compiler that comes with the minix386 upgrade package), don't bother.
+It is some serious bugs that kill tcsh when compiled for 16-bit characters.
+I can provide more details of bugs that I noticed for brave souls who want
+to try, but it would be hard (and why bother if you can get gcc?).
+
+I can make the binary available to anyone who wants it (for example people
+who can't get access to a cross-compiling environment, and who don't yet
+have gcc running under minix).
+
+
+***************************************************************************
+
+If your compiler cannot handle long symbol names, add 
+
+#include "snames.h" 
+
+to your config.h file
+
+            -- Christos Zoulas
+               christos@zoulas.com
+
diff --git a/contrib/tcsh-6/complete.tcsh b/contrib/tcsh-6/complete.tcsh
new file mode 100644 (file)
index 0000000..42edcbd
--- /dev/null
@@ -0,0 +1,1196 @@
+#
+# $tcsh: complete.tcsh,v 1.47 2006/03/02 18:46:44 christos 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 ~/.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.
+#
+# Added two Debian-specific completions: dpkg and dpkg-deb (who
+# wrote them?). Changed completions of several commands. The ones
+# are evaluated if the `traditional_complete' shell variable is
+# defined.
+#
+# Debian enhancements by Vadim Vygonets <vadik@cs.huji.ac.il>.
+# Bugfixes and apt completions by Miklos Quartus <miklos.quartus@nokia.com>.
+# Cleanup by Martin A. Godisch <martin@godisch.de>.
+
+onintr -
+if (! $?prompt) goto end
+
+if ($?tcsh) then
+    if ($tcsh != 1) then
+       set rev=$tcsh:r
+       set rel=$rev:e
+       set pat=$tcsh:e
+       set rev=$rev:r
+    endif
+    if ($rev > 5 && $rel > 1) then
+       set _complete=1
+    endif
+    unset rev rel pat
+endif
+
+if ($?_complete) then
+    set noglob
+    if ( ! $?hosts ) set hosts
+    foreach f ($HOME/.hosts /usr/local/etc/csh.hosts $HOME/.rhosts /etc/hosts.equiv)
+        if ( -r $f ) then
+           set hosts = ($hosts `grep -v "+" $f | grep -E -v "^#" | tr -s " " " " | cut -f 1`)
+       endif
+    end
+    if ( -r $HOME/.netrc ) then
+       set f=`awk '/machine/ { print $2 }' < $HOME/.netrc` >& /dev/null
+       set hosts=($hosts $f)
+    endif
+    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
+    if ( ! $?hosts ) then
+       set hosts=(hyperion.ee.cornell.edu phaeton.ee.cornell.edu \
+                  guillemin.ee.cornell.edu vangogh.cs.berkeley.edu \
+                  ftp.uu.net prep.ai.mit.edu export.lcs.mit.edu \
+                  labrea.stanford.edu sumex-aim.stanford.edu \
+                  tut.cis.ohio-state.edu)
+    endif
+
+    complete ywho      n/*/\$hosts/    # argument from list in $hosts
+    complete rsh       p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
+    complete ssh       p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
+    complete xrsh      p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
+    complete rlogin    p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/
+    complete telnet    p/1/\$hosts/ p/2/x:'<port>'/ n/*/n/
+
+    complete cd        p/1/d/          # Directories only
+    complete chdir     p/1/d/
+    complete pushd     p/1/d/
+    complete popd      p/1/d/
+    complete pu        p/1/d/
+    complete po        p/1/d/
+    complete complete  p/1/X/          # Completions only
+    complete uncomplete        n/*/X/
+    complete exec      p/1/c/          # Commands only
+    complete trace     p/1/c/
+    complete strace    p/1/c/
+    complete which     n/*/c/
+    complete where     n/*/c/
+    complete skill     p/1/c/
+    complete dde       p/1/c/ 
+    complete adb       c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
+    complete sdb       p/1/c/
+    complete dbx       c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
+    complete xdb       p/1/c/
+    complete gdb       n/-d/d/ n/*/c/
+    complete ups       p/1/c/
+    complete set       'c/*=/f/' 'p/1/s/=' 'n/=/f/'
+    complete unset     n/*/s/
+    complete alias     p/1/a/          # only aliases are valid
+    complete unalias   n/*/a/
+    complete xdvi      n/*/f:*.dvi/    # Only files that match *.dvi
+    complete dvips     n/*/f:*.dvi/
+    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 -)"/ \
+                       n/{-c,--command}/c/ \
+                       n@{-s,--shell}@'`cat /etc/shells`'@ n/*/u/
+    complete cc        c/-[IL]/d/ \
+              c@-l@'`\ls -1 /usr/lib/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
+                       c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
+    complete acc       c/-[IL]/d/ \
+       c@-l@'`\ls -1 /usr/lang/SC1.0/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
+                       c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
+    complete gcc       c/-[IL]/d/ \
+                       c/-f/"(caller-saves cse-follow-jumps delayed-branch \
+                              elide-constructors expensive-optimizations \
+                              float-store force-addr force-mem inline \
+                              inline-functions keep-inline-functions \
+                              memoize-lookups no-default-inline \
+                              no-defer-pop no-function-cse omit-frame-pointer \
+                              rerun-cse-after-loop schedule-insns \
+                              schedule-insns2 strength-reduce \
+                              thread-jumps unroll-all-loops \
+                              unroll-loops syntax-only all-virtual \
+                              cond-mismatch dollars-in-identifiers \
+                              enum-int-equiv no-asm no-builtin \
+                              no-strict-prototype signed-bitfields \
+                              signed-char this-is-variable unsigned-bitfields \
+                              unsigned-char writable-strings call-saved-reg \
+                              call-used-reg fixed-reg no-common \
+                              no-gnu-binutils nonnull-objects \
+                              pcc-struct-return pic PIC shared-data \
+                              short-enums short-double volatile)"/ \
+                       c/-W/"(all aggregate-return cast-align cast-qual \
+                              comment conversion enum-clash error format \
+                              id-clash-len implicit missing-prototypes \
+                              no-parentheses pointer-arith return-type shadow \
+                              strict-prototypes switch uninitialized unused \
+                              write-strings)"/ \
+                       c/-m/"(68000 68020 68881 bitfield fpa nobitfield rtd \
+                              short c68000 c68020 soft-float g gnu unix fpu \
+                              no-epilogue)"/ \
+                       c/-d/"(D M N)"/ \
+                       c/-/"(f W vspec v vpath ansi traditional \
+                             traditional-cpp trigraphs pedantic x o l c g L \
+                             I D U O O2 C E H B b V M MD MM i dynamic \
+                             nodtdlib static nostdinc undef)"/ \
+                       c/-l/f:*.a/ \
+                       n/*/f:*.{c,C,cc,o,a,s,i}/
+    complete g++       n/*/f:*.{C,cc,o,s,i}/
+    complete CC        n/*/f:*.{C,cc,cpp,o,s,i}/
+    complete rm        c/--/"(directory force interactive verbose \
+                       recursive help version)"/ c/-/"(d f i v r R -)"/ \
+                       n/*/f:^*.{c,cc,C,h,in}/ # Protect precious files
+    complete vi        n/*/f:^*.[oa]/
+    complete bindkey    N/-a/b/ N/-c/c/ n/-[ascr]/'x:<key-sequence>'/ \
+                       n/-[svedlr]/n/ c/-[vedl]/n/ c/-/"(a s k c v e d l r)"/\
+                       n/-k/"(left right up down)"/ p/2-/b/ \
+                       p/1/'x:<key-sequence or option>'/
+
+    complete find      n/-fstype/"(nfs 4.2)"/ n/-name/f/ \
+                       n/-type/"(c b d f p l s)"/ n/-user/u/ n/-group/g/ \
+                       n/-exec/c/ n/-ok/c/ n/-cpio/f/ n/-ncpio/f/ n/-newer/f/ \
+                       c/-/"(fstype name perm prune type user nouser \
+                            group nogroup size inum atime mtime ctime exec \
+                            ok print ls cpio ncpio newer xdev depth \
+                            daystart follow maxdepth mindepth noleaf version \
+                            anewer cnewer amin cmin mmin true false uid gid \
+                            ilname iname ipath iregex links lname empty path \
+                            regex used xtype fprint fprint0 fprintf \
+                            print0 printf not a and o or)"/ \
+                            n/*/d/
+
+    complete -%*       c/%/j/                  # fill in the jobs builtin
+    complete {fg,bg,stop}      c/%/j/ p/1/"(%)"//
+
+    complete limit     c/-/"(h)"/ n/*/l/
+    complete unlimit   c/-/"(h)"/ n/*/l/
+
+    complete -co*      p/0/"(compress)"/       # make compress completion
+                                               # not ambiguous
+    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
+
+    complete finger    c/*@/\$hosts/ n/*/u/@ 
+    complete ping      p/1/\$hosts/
+    complete traceroute        p/1/\$hosts/
+
+    complete {talk,ntalk,phone}        p/1/'`users | tr " " "\012" | uniq`'/ \
+               n/*/\`who\ \|\ grep\ \$:1\ \|\ awk\ \'\{\ print\ \$2\ \}\'\`/
+
+    complete ftp       c/-/"(d i g n v)"/ n/-/\$hosts/ p/1/\$hosts/ n/*/n/
+
+    # this one is simple...
+    #complete rcp c/*:/f/ C@[./\$~]*@f@ n/*/\$hosts/:
+    # From Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de> 
+    # This one will rsh to the file to fetch the list of files!
+    complete rcp 'c%*@*:%`set q=$:-0;set q="$q:s/@/ /";set q="$q:s/:/ /";set q=($q " ");rsh $q[2] -l $q[1] ls -dp $q[3]\*`%' 'c%*:%`set q=$:-0;set q="$q:s/:/ /";set q=($q " ");rsh $q[1] ls -dp $q[2]\*`%' 'c%*@%$hosts%:' 'C@[./$~]*@f@'  'n/*/$hosts/:'
+
+    complete dd c/--/"(help version)"/ c/[io]f=/f/ \
+               c/conv=*,/"(ascii ebcdic ibm block unblock \
+                           lcase notrunc ucase swab noerror sync)"/,\
+               c/conv=/"(ascii ebcdic ibm block unblock \
+                         lcase notrunc ucase swab noerror sync)"/,\
+               c/*=/x:'<number>'/ \
+               n/*/"(if of conv ibs obs bs cbs files skip file seek count)"/=
+
+    complete nslookup   p/1/x:'<host>'/ p/2/\$hosts/
+
+    complete ar c/[dmpqrtx]/"(c l o u v a b i)"/ p/1/"(d m p q r t x)"// \
+               p/2/f:*.a/ p/*/f:*.o/
+
+    # these should be merged with the MH completion hacks below - jgotts
+    complete {refile,sprev,snext,scan,pick,rmm,inc,folder,show} \
+               c@+@F:$HOME/Mail/@
+
+    # these and interrupt handling from Jaap Vermeulen <jaap@sequent.com>
+    complete {rexec,rxexec,rxterm,rmterm} \
+                       'p/1/$hosts/' 'c/-/(l L E)/' 'n/-l/u/' 'n/-L/f/' \
+                       'n/-E/e/' 'n/*/c/'
+    complete kill      'c/-/S/' 'c/%/j/' \
+                       'n/*/`ps -u $LOGNAME | awk '"'"'{print $1}'"'"'`/'
+
+    # these from Marc Horowitz <marc@cam.ov.com>
+    complete attach 'n/-mountpoint/d/' 'n/-m/d/' 'n/-type/(afs nfs rvd ufs)/' \
+                   'n/-t/(afs nfs rvd ufs)/' 'n/-user/u/' 'n/-U/u/' \
+                   'c/-/(verbose quiet force printpath lookup debug map \
+                         nomap remap zephyr nozephyr readonly write \
+                         mountpoint noexplicit explicit type mountoptions \
+                         nosetuid setuid override skipfsck lock user host)/' \
+                   'n/-e/f/' 'n/*/()/'
+    complete hesinfo   'p/1/u/' \
+                       'p/2/(passwd group uid grplist pcap pobox cluster \
+                             filsys sloc service)/'
+
+    # these from E. Jay Berkenbilt <ejb@ERA.COM>
+    # = isn't always followed by a filename or a path anymore - jgotts
+    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,\
+                               mandir,srcdir}/(=)//' \
+                        'c/--/(cache-file verbose prefix exec-prefix bindir \
+                               sbindir libexecdir datadir sysconfdir \
+                               sharedstatedir localstatedir libdir \
+                               includedir oldincludedir infodir mandir \
+                               srcdir)//'
+    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>/' \
+                       'c/--{enable,disable,with}-*/x:<feature>//' \
+                       'c/--*=/x:<directory>//' \
+                       'c/--/(prefix= exec-prefix= bindir= \
+                       sbindir= libexecdir= datadir= sysconfdir= \
+                       sharedstatedir= localstatedir= infodir= \
+                       mandir= srcdir= x-includes= x-libraries= cachefile= \
+                       enable- disable- with- \
+                       help no-create quiet silent version verbose )//'
+    endif
+    complete gs 'c/-sDEVICE=/(x11 cdjmono cdj550 epson eps9high epsonc \
+                             dfaxhigh dfaxlow laserjet ljet4 sparc pbm \
+                             pbmraw pgm pgmraw ppm ppmraw bit)/' \
+               'c/-sOutputFile=/f/' 'c/-s/(DEVICE OutputFile)/=' \
+               'c/-d/(NODISPLAY NOPLATFONTS NOPAUSE)/' 'n/*/f/'
+    complete perl      'n/-S/c/'
+    complete printenv  'n/*/e/'
+    complete sccs      p/1/"(admin cdc check clean comb deledit delget \
+                       delta diffs edit enter fix get help info \
+                       print prs prt rmdel sccsdiff tell unedit \
+                       unget val what)"/
+    complete setenv    'p/1/e/' 'c/*:/f/'
+
+    # these and method of setting hosts from Kimmo Suominen <kim@tac.nyc.ny.us>
+    if ( -f $HOME/.mh_profile && -x "`which folders`" ) then 
+
+    if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`"
+    if ( ! $?MHA )     setenv MHA     "`ali | sed -e '/^ /d' -e 's/:.*//'`"
+
+    set folders = ( $FOLDERS )
+    set mha = ( $MHA )
+
+    complete ali \
+        'c/-/(alias nolist list nonormalize normalize nouser user help)/' \
+        'n,-alias,f,'
+
+    complete anno \
+        'c/-/(component noinplace inplace nodate date text help)/' \
+        'c,+,$folders,'  \
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete burst \
+        'c/-/(noinplace inplace noquiet quiet noverbose verbose help)/' \
+        'c,+,$folders,'  \
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete comp \
+        'c/-/(draftfolder draftmessage nodraftfolder editor noedit file form nouse use whatnowproc nowhatnowproc help)/' \
+        'c,+,$folders,'  \
+        'n,-whatnowproc,c,'  \
+        'n,-file,f,'\
+        'n,-form,f,'\
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete dist \
+        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit form noinplace inplace whatnowproc nowhatnowproc help)/' \
+        'c,+,$folders,'  \
+        'n,-whatnowproc,c,'  \
+        'n,-form,f,'\
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete folder \
+        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
+        'c,+,$folders,'  \
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete folders \
+        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
+        'c,+,$folders,'  \
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete forw \
+        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit filter form noformat format noinplace inplace digest issue volume whatnowproc nowhatnowproc help)/' \
+        'c,+,$folders,'  \
+        'n,-whatnowproc,c,'  \
+        'n,-filter,f,'\
+        'n,-form,f,'\
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete inc \
+        'c/-/(audit file noaudit nochangecur changecur file form format nosilent silent notruncate truncate width help)/' \
+        'c,+,$folders,'  \
+        'n,-audit,f,'\
+        'n,-form,f,'
+
+    complete mark \
+        'c/-/(add delete list sequence nopublic public nozero zero help)/' \
+        'c,+,$folders,'  \
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete mhmail \
+        'c/-/(body cc from subject help)/' \
+        'n,-cc,$mha,'  \
+        'n,-from,$mha,'  \
+        'n/*/$mha/'
+
+    complete mhpath \
+        'c/-/(help)/' \
+        'c,+,$folders,'  \
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete msgchk \
+        'c/-/(nodate date nonotify notify help)/' 
+
+    complete msh \
+        'c/-/(prompt noscan scan notopcur topcur help)/' 
+
+    complete next \
+        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
+        'c,+,$folders,'  \
+        'n,-moreproc,c,'  \
+        'n,-showproc,c,'  \
+        'n,-form,f,'
+
+    complete packf \
+        'c/-/(file help)/' \
+        'c,+,$folders,'  \
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete pick \
+        'c/-/(and or not lbrace rbrace cc date from search subject to othercomponent after before datefield sequence nopublic public nozero zero nolist list help)/' \
+        'c,+,$folders,'  \
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete prev \
+        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
+        'c,+,$folders,'  \
+        'n,-moreproc,c,'  \
+        'n,-showproc,c,'  \
+        'n,-form,f,'
+
+    complete prompter \
+        'c/-/(erase kill noprepend prepend norapid rapid nodoteof doteof help)/' 
+
+    complete refile \
+        'c/-/(draft nolink link nopreserve preserve src file help)/' \
+        'c,+,$folders,'  \
+        'n,-file,f,'\
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete rmf \
+        'c/-/(nointeractive interactive help)/' \
+        'c,+,$folders,'  
+
+    complete rmm \
+        'c/-/(help)/' \
+        'c,+,$folders,'  \
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete scan \
+        'c/-/(noclear clear form format noheader header width noreverse reverse file help)/' \
+        'c,+,$folders,'  \
+        'n,-form,f,'\
+        'n,-file,f,'\
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete send \
+        'c/-/(alias draft draftfolder draftmessage nodraftfolder filter nofilter noformat format noforward forward nomsgid msgid nopush push noverbose verbose nowatch watch width help)/' \
+        'n,-alias,f,'\
+        'n,-filter,f,'
+
+    complete show \
+        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
+        'c,+,$folders,'  \
+        'n,-moreproc,c,'  \
+        'n,-showproc,c,'  \
+        'n,-form,f,'\
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete sortm \
+        'c/-/(datefield textfield notextfield limit nolimit noverbose verbose help)/' \
+        'c,+,$folders,'  \
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete vmh \
+        'c/-/(prompt vmhproc novmhproc help)/' \
+        'n,-vmhproc,c,'  
+
+    complete whatnow \
+        'c/-/(draftfolder draftmessage nodraftfolder editor noedit prompt help)/' 
+
+    complete whom \
+        'c/-/(alias nocheck check draft draftfolder draftmessage nodraftfolder help)/' \
+        'n,-alias,f,'
+
+    complete plum \
+        'c/-/()/' \
+        'c,+,$folders,'  \
+        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+
+    complete mail \
+        'c/-/()/' \
+        'n/*/$mha/'
+
+    endif
+
+    #from Dan Nicolaescu <dann@ics.uci.edu>
+    if ( $?MODULESHOME ) then
+       alias Compl_module 'find ${MODULEPATH:as/:/ /} -name .version -o -name .modulea\* -prune -o -print  | sed `echo "-e s@${MODULEPATH:as%:%/\*@@g -e s@%}/\*@@g"`'
+       complete module 'p%1%(add load unload switch display avail use unuse update purge list clear help initadd initrm initswitch initlist initclear)%' \
+       'n%{unl*,sw*,inits*}%`echo "$LOADEDMODULES:as/:/ /"`%' \
+       'n%{lo*,di*,he*,inita*,initr*}%`eval Compl_module`%' \
+       'N%{sw*,initsw*}%`eval Compl_module`%' 'C%-%(-append)%' 'n%{use,unu*,av*}%d%' 'n%-append%d%' \
+       'C%[^-]*%`eval Compl_module`%'
+    endif
+
+    # from George Cox
+    complete acroread  'p/*/f:*.{pdf,PDF}/'
+    complete apachectl  'c/*/(start stop restart fullstatus status graceful \
+                       configtest help)/'
+    complete appletviewer      'p/*/f:*.class/'
+    complete bison     'c/--/(debug defines file-prefix= fixed-output-files \
+                       help name-prefix= no-lines no-parser output= \
+                       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 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/'
+    complete camcontrol        'p/1/(cmd debug defects devlist eject inquiry \
+                       modepage negotiate periphlist rescan reset start \
+                       stop tags tur)/'
+    complete ctlinnd   'p/1/(addhist allow begin cancel changegroup \
+                       checkfile drop feedinfo flush flushlogs go hangup \
+                       logmode mode name newgroup param pause readers refile \
+                       reject reload renumber reserve rmgroup send shutdown \
+                       kill throttle trace xabort xexec)/'
+    complete cvs       'c/--/(help help-commands help-synonyms)/' \
+                       'p/1/(add admin annotate checkout commit diff \
+                       edit editors export history import init log login \
+                       logout rdiff release remove rtag status tag unedit \
+                       update watch watchers)/' 'n/-a/(edit unedit commit \
+                       all none)/' 'n/watch/(on off add remove)/'
+    complete cxx       'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
+    complete detex     'p/*/f:*.tex/'
+    complete edquota    'n/*/u/'
+    complete exec      'p/1/c/'
+    complete ghostview 'p/*/f:*.ps/'
+    complete gv                'p/*/f:*.ps/'
+    complete ifconfig  'p@1@`ifconfig -l`@' 'n/*/(range phase link netmask \
+                       mtu vlandev vlan metric mediaopt down delete \
+                       broadcast arp debug)/'
+    complete imake     'c/-I/d/'
+    complete ipfw      'p/1/(flush add delete list show zero)/' \
+                       'n/add/(allow permit accept pass deny drop reject \
+                       reset count skipto num divert port tee port)/'
+    complete javac     'p/*/f:*.java/'
+    complete ldif2ldbm 'n/-i/f:*.ldif/'
+    complete libtool   'c/--mode=/(compile execute finish install link \
+                       uninstall)/' 'c/--/(config debug dry-run features \
+                       finish help quiet silent version mode=)/'
+    complete libtoolize        'c/--/(automake copy debug dry-run force help ltdl \
+                       ltdl-tar version)/'
+    complete links     'c/-/(assume-codepage async-dns download-dir \
+                       format-cache-size ftp-proxy help http-proxy \
+                       max-connections max-connections-to-host \
+                       memory-cache-size receive-timeout retries \
+                       unrestartable-receive-timeout version)/'
+    complete natd      c/-/'(alias_address config deny_incoming dynamic \
+                       inport interface log log_denied log_facility \
+                       outport outport port pptpalias proxy_only \
+                       proxy_rule redirect_address redirect_port \
+                       reverse same_ports unregistered_only use_sockets \
+                       verbose)'/ 'n@-interface@`ifconfig -l`@'
+    complete netstat   'n@-I@`ifconfig -l`@'
+    complete objdump   'c/--/(adjust-vma= all-headers architecture= \
+                       archive-headers debugging demangle disassemble \
+                       disassemble-all disassemble-zeroes dynamic-reloc \
+                       dynamic-syms endian= file-headers full-contents \
+                       headers help info line-numbers no-show-raw-insn \
+                       prefix-addresses private-headers reloc section-headers \
+                       section=source stabs start-address= stop-address= \
+                       syms target= version wide)/' \
+                       'c/-/(a h i f C d D p r R t T x s S l w)/'
+    complete xmodmap   'c/-/(display help grammar verbose quiet n e pm pk \
+                       pke pp)/'
+    complete lynx      'c/-/(accept_all_cookies anonymous assume_charset= \
+                       assume_local_charset= assume_unrec_charset= auth= base \
+                       book buried_news cache= case cfg= child cookie_file= \
+                       cookies core crawl debug_partial display= dump editor= \
+                       emacskeys enable_scrollback error_file= force_html \
+                       force_secure forms_options from ftp get_data head help \
+                       hiddenlinks= historical homepage= image_links index= \
+                       ismap link= localhost mime_header minimal \
+                       newschunksize= newsmaxchunk= nobrowse nocc nocolor \
+                       nofilereferer nolist nolog nopause noprint noredir \
+                       noreferer nostatus number_links partial partial_thres \
+                       pauth= popup post_data preparsed print pseudo_inlines \
+                       raw realm reload restrictions= resubmit_posts rlogin \
+                       selective show_cursor soft_dquotes source stack_dump \
+                       startfile_ok tagsoup telnet term= tlog trace traversal \
+                       underscore useragent= validate verbose version vikeys \
+                       width=)/' 'c/(http|ftp)/$URLS/'
+    complete gmake     'c/{--directory=,--include-dir=}/d/' \
+                       'c/{--assume-new,--assume-old,--makefile,--new-file,--what-if,--file}/f/' \
+                       'c/--/(assume-new= assume-old= debug directory= \
+                       dry-run environment-overrides file= help \
+                       ignore-errors include-dir= jobs[=N] just-print \
+                       keep-going load-average[=N] makefile= max-load[=N] \
+                       new-file= no-builtin-rules no-keep-going \
+                       no-print-directory old-file= print-data-base \
+                       print-directory question quiet recon silent stop \
+                       touch version warn-undefined-variables what-if=)/' \
+                       'n@*@`cat -s GNUMakefile Makefile makefile |& sed -n -e "/No such file/d" -e "s/^\([A-Za-z0-9-]*\):.*/\1/p"`@' \
+                       'n/=/f/' 'n/-f/f/'
+    complete mixer     p/1/'(vol bass treble synth pcm speaker mic cd mix \
+                       pcm2 rec igain ogain line1 line2 line3)'/ \
+                       p@2@'`mixer $:-1 | awk \{\ print\ \$7\ \}`'@
+
+    complete mpg123    'c/--/(2to1 4to1 8bit aggressive au audiodevice \
+                       auth buffer cdr check doublespeed equalizer frames \
+                       gain halfspeed headphones left lineout list mix mono \
+                       proxy quiet random rate reopen resync right scale \
+                       shuffle single0 single1 skip speaker stdout stereo \
+                       test verbose wav)/'
+    complete mysqladmin        'n/*/(create drop extended-status flush-hosts \
+                       flush-logs flush-status flush-tables flush-privileges \
+                       kill password ping processlist reload refresh \
+                       shutdown status variables version)/'
+    complete mutt      c@-f=@F:${HOME}/Mail/@ \
+                       n/-a/f/ \
+                       n/-F/f/ n/-H/f/ \
+                       n/-s/x:'<subject line>'/ \
+                       n/-e/x:'<command>'/ \
+                       n@-b@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
+                       n@-c@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
+                       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 \
+                       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>/' \
+               'c/--target=/x:<bfdname>/' \
+               'c/--format=/(bsd sysv posix)/n/' \
+               'c/--/(debugsyms extern-only demangle dynamic print-armap \
+                       print-file-name numeric-sort no-sort reverse-sort \
+                       size-sort undefined-only portability target= radix= \
+                       format= defined-only\ line-numbers no-demangle version \
+                       help)//' \
+               'n/*/f:^*.{h,c,cc,s,S}/'
+    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)/'
+    complete postmap   'n/1/(hash: regexp:)' 'c/hash:/f/' 'c/regexp:/f/'
+    complete rcsdiff   'p@1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
+    complete X         'c/-/(I a ac allowMouseOpenFail allowNonLocalModInDev \
+                       allowNonLocalXvidtune ar1 ar2 audit auth bestRefresh \
+                       bgamma bpp broadcast bs c cc class co core deferglyphs \
+                       disableModInDev disableVidMode displayID dpi dpms f fc \
+                       flipPixels fn fp gamma ggamma help indirect kb keeptty \
+                       ld lf logo ls nolisten string noloadxkb nolock nopn \
+                       once p pn port probeonly query quiet r rgamma s \
+                       showconfig sp su t terminate to tst v verbose version \
+                       weight wm x xkbdb xkbmap)/'
+    complete users      'c/--/(help version)/' 'p/1/x:"<accounting_file>"/'
+    complete vidcontrol        'p/1/(132x25 132x30 132x43 132x50 132x60 40x25 80x25 \
+                       80x30 80x43 80x50 80x60 EGA_80x25 EGA_80x43 \
+                       VESA_132x25 VESA_132x30 VESA_132x43 VESA_132x50 \
+                       VESA_132x60 VESA_800x600 VGA_320x200 VGA_40x25 \
+                       VGA_80x25 VGA_80x30 VGA_80x50 VGA_80x60)/'
+    complete vim       'n/*/f:^*.[oa]/'
+    complete where     'n/*/c/'
+    complete which     'n/*/c/'
+    complete wmsetbg   'c/-/(display D S a b c d e m p s t u w)/' \
+                       'c/--/(back-color center colors dither help match \
+                       maxscale parse scale smooth tile update-domain \
+                       update-wmaker version workspace)/'
+    complete xdb       'p/1/c/'
+    complete xdvi      'c/-/(allowshell debug display expert gamma hushchars \
+                       hushchecksums hushspecials install interpreter keep \
+                       margins nogrey noinstall nomakepk noscan paper safer \
+                       shrinkbuttonn thorough topmargin underlink version)/' \
+                       'n/-paper/(a4 a4r a5 a5r)/' 'p/*/f:*.dvi/'
+    complete xlock     'c/-/(allowaccess allowroot debug description \
+                       echokeys enablesaver grabmouse grabserver hide inroot \
+                       install inwindow mono mousemotion nolock remote \
+                       resetsaver sound timeelapsed use3d usefirst verbose \
+                       wireframe background batchcount bg bitmap both3d \
+                       count cycles delay delta3d display dpmsoff \
+                       dpmsstandby dpmssuspend endCmd erasedelay erasemode \
+                       erasetime fg font foreground geometry help \
+                       icongeometry info invalid left3d lockdelay logoutCmd \
+                       mailCmd mailIcon message messagefile messagefont \
+                       messagesfile mode name ncolors nice nomailIcon none3d \
+                       parent password planfont program resources right3d \
+                       saturation size startCmd timeout username validate \
+                       version visual)/' 'n/-mode/(ant atlantis ball bat \
+                       blot bouboule bounce braid bubble bubble3d bug cage \
+                       cartoon clock coral crystal daisy dclock decay deco \
+                       demon dilemma discrete drift eyes fadeplot flag flame \
+                       flow forest galaxy gears goop grav helix hop hyper \
+                       ico ifs image invert julia kaleid kumppa lament laser \
+                       life life1d life3d lightning lisa lissie loop lyapunov \
+                       mandelbrot marquee matrix maze moebius morph3d \
+                       mountain munch nose pacman penrose petal pipes puzzle \
+                       pyro qix roll rotor rubik shape sierpinski slip sphere \
+                       spiral spline sproingies stairs star starfish strange \
+                       superquadrics swarm swirl tetris thornbird triangle \
+                       tube turtle vines voters wator wire world worm xjack \
+                       blank bomb random)/' 
+    complete xfig      'c/-/(display)/' 'p/*/f:*.fig/'
+    complete wget      c/--/"(accept= append-output= background cache= \
+                       continue convert-links cut-dirs= debug \
+                       delete-after directory-prefix= domains= \
+                       dont-remove-listing dot-style= exclude-directories= \
+                       exclude-domains= execute= follow-ftp \
+                       force-directories force-html glob= header= help \
+                       http-passwd= http-user= ignore-length \
+                       include-directories= input-file= level= mirror \
+                       no-clobber no-directories no-host-directories \
+                       no-host-lookup no-parent non-verbose \
+                       output-document= output-file= passive-ftp \
+                       proxy-passwd= proxy-user= proxy= quiet quota= \
+                       recursive reject= relative retr-symlinks save-headers \
+                       server-response span-hosts spider timeout= \
+                       timestamping tries= user-agent= verbose version wait=)"/
+
+    # these from Tom Warzeka <tom@waz.cc>
+
+    # this one works but is slow and doesn't descend into subdirectories
+    # complete cd      C@[./\$~]*@d@ \
+    #                  p@1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@
+
+    if ( -r /etc/shells ) then
+        complete setenv        p@1@e@ n@DISPLAY@\$hosts@: n@SHELL@'`cat /etc/shells`'@
+    else
+       complete setenv p@1@e@ n@DISPLAY@\$hosts@:
+    endif
+    complete unsetenv  n/*/e/
+
+    set _maildir = /var/mail
+    if (-r $HOME/.mailrc) then
+        complete mail  c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
+                       c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
+                       n@-u@T:$_maildir@ n/-f/f/ \
+                       n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " "     " | cut -f 2`'@
+    else
+        complete mail  c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
+                       c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
+                       n@-u@T:$_maildir@ n/-f/f/ n/*/u/
+    endif
+    unset _maildir
+
+    if (! $?MANPATH) then
+       if (-r /usr/share/man) then
+           setenv MANPATH /usr/share/man:
+       else
+           setenv MANPATH /usr/man:
+       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 \
+           '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.\*\$%%`@'\
+           'n@4@`set q = "$MANPATH:as%:%/man4 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.4.\*\$%%`@'\
+           'n@5@`set q = "$MANPATH:as%:%/man5 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.5.\*\$%%`@'\
+           'n@6@`set q = "$MANPATH:as%:%/man6 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.6.\*\$%%`@'\
+           'n@7@`set q = "$MANPATH:as%:%/man7 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.7.\*\$%%`@'\
+           'n@8@`set q = "$MANPATH:as%:%/man8 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.8.\*\$%%`@'\
+           'n@9@`set q = "$MANPATH:as%:%/man9 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.9.\*\$%%`@'\
+           'n@0@`set q = "$MANPATH:as%:%/man0 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.0.\*\$%%`@'\
+           'n@n@`set q = "$MANPATH:as%:%/mann %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.n.\*\$%%`@'\
+           'n@o@`set q = "$MANPATH:as%:%/mano %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.o.\*\$%%`@'\
+           'n@l@`set q = "$MANPATH:as%:%/manl %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.l.\*\$%%`@'\
+           'n@p@`set q = "$MANPATH:as%:%/manp %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.p.\*\$%%`@'\
+           c@-@"(- f k M P s S t)"@ n@-f@c@ n@-k@x:'<keyword>'@ n@-[MP]@d@   \
+           'N@-[MP]@`\ls -1 $:-1/man? |& sed -n s%\\..\\+\$%%p`@'            \
+           '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.\*\$%%`'@ \
+                           n@2@'`\ls -1 /usr/man/man2 | sed s%\\.2.\*\$%%`'@ \
+                           n@3@'`\ls -1 /usr/man/man3 | sed s%\\.3.\*\$%%`'@ \
+                           n@4@'`\ls -1 /usr/man/man4 | sed s%\\.4.\*\$%%`'@ \
+                           n@5@'`\ls -1 /usr/man/man5 | sed s%\\.5.\*\$%%`'@ \
+                           n@6@'`\ls -1 /usr/man/man6 | sed s%\\.6.\*\$%%`'@ \
+                           n@7@'`\ls -1 /usr/man/man7 | sed s%\\.7.\*\$%%`'@ \
+                           n@8@'`\ls -1 /usr/man/man8 | sed s%\\.8.\*\$%%`'@ \
+    n@9@'`[ -r /usr/man/man9 ] && \ls -1 /usr/man/man9 | sed s%\\.9.\*\$%%`'@ \
+    n@0@'`[ -r /usr/man/man0 ] && \ls -1 /usr/man/man0 | sed s%\\.0.\*\$%%`'@ \
+  n@new@'`[ -r /usr/man/mann ] && \ls -1 /usr/man/mann | sed s%\\.n.\*\$%%`'@ \
+  n@old@'`[ -r /usr/man/mano ] && \ls -1 /usr/man/mano | sed s%\\.o.\*\$%%`'@ \
+n@local@'`[ -r /usr/man/manl ] && \ls -1 /usr/man/manl | sed s%\\.l.\*\$%%`'@ \
+n@public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \
+               c/-/"(- f k P s t)"/ n/-f/c/ n/-k/x:'<keyword>'/ n/-P/d/ \
+               N@-P@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n/*/c/
+    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>'/
+    complete compress  c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/
+    complete uncompress        c/-/"(c f v)"/                        n/*/f:*.Z/
+
+    complete uuencode  p/1/f/ p/2/x:'<decode_pathname>'/ n/*/n/
+    complete uudecode  c/-/"(f)"/ n/-f/f:*.{uu,UU}/ p/1/f:*.{uu,UU}/ n/*/n/
+
+    complete xhost     c/[+-]/\$hosts/ n/*/\$hosts/
+    complete xpdf      c/-/"(z g remote raise quit cmap rgb papercolor       \
+                             eucjp t1lib freetype ps paperw paperh level1    \
+                             upw fullscreen cmd q v h help)"/                \
+                       n/-z/x:'<zoom (-5 .. +5) or "page" or "width">'/      \
+                       n/-g/x:'<geometry>'/ n/-remote/x:'<name>'/            \
+                       n/-rgb/x:'<number>'/ n/-papercolor/x:'<color>'/       \
+                       n/-{t1lib,freetype}/x:'<font_type>'/                  \
+                       n/-ps/x:'<PS_file>'/ n/-paperw/x:'<width>'/           \
+                       n/-paperh/x:'<height>'/ n/-upw/x:'<password>'/        \
+                       n/-/f:*.{pdf,PDF}/                                    \
+                       N/-{z,g,remote,rgb,papercolor,t1lib,freetype,ps,paperw,paperh,upw}/f:*.{pdf,PDF}/ \
+                       N/-/x:'<page>'/ p/1/f:*.{pdf,PDF}/ p/2/x:'<page>'/
+
+    complete tcsh      c/-D*=/'x:<value>'/ c/-D/'x:<name>'/ \
+                       c/-/"(b c d D e f F i l m n q s t v V x X -version)"/ \
+                       n/-c/c/ n/{-l,--version}/n/ n/*/'f:*.{,t}csh'/
+
+    complete rpm       c/--/"(query verify nodeps nofiles nomd5 noscripts    \
+                       nogpg nopgp install upgrade freshen erase allmatches  \
+                       notriggers repackage test rebuild recompile initdb    \
+                       rebuilddb addsign resign querytags showrc setperms    \
+                       setugids all file group package querybynumber qf      \
+                       triggeredby whatprovides whatrequires changelog       \
+                       configfiles docfiles dump filesbypkg info last list   \
+                       provides queryformat requires scripts state triggers  \
+                       triggerscripts allfiles badreloc excludepath checksig \
+                       excludedocs force hash ignoresize ignorearch ignoreos \
+                       includedocs justdb noorder oldpackage percent prefix  \
+                       relocate replace-files replacepkgs buildroot clean    \
+                       nobuild rmsource rmspec short-circuit sign target     \
+                       help version quiet rcfile pipe dbpath root specfile)"/\
+                       c/-/"(q V K i U F e ba bb bp bc bi bl bs ta tb tp tc  \
+                       ti tl ts a f g p c d l R s h ? v vv -)"/              \
+               n/{-f,--file}/f/ n/{-g,--group}/g/ n/--pipe/c/ n/--dbpath/d/  \
+               n/--querybynumber/x:'<number>'/ n/--triggeredby/x:'<package>'/\
+               n/--what{provides,requires}/x:'<capability>'/ n/--root/d/     \
+               n/--{qf,queryformat}/x:'<format>'/ n/--buildroot/d/           \
+               n/--excludepath/x:'<oldpath>'/  n/--prefix/x:'<newpath>'/     \
+               n/--relocate/x:'<oldpath=newpath>'/ n/--target/x:'<platform>'/\
+               n/--rcfile/x:'<filelist>'/ n/--specfile/x:'<specfile>'/       \
+               n/{-[iUFep],--{install,upgrade,freshen,erase,package}}/f:*.rpm/
+
+    # these conform to the latest GNU versions available at press time ...
+    # updates by John Gotts <jgotts@engin.umich.edu>
+    if (-X emacs) then
+      # TW note:  if your version of GNU Emacs supports the "--version" option,
+      #           uncomment this line and comment the next to automatically
+      #           detect the version, else set "_emacs_ver" to your version.
+      #set _emacs_ver=`emacs --version | sed -e 's%GNU Emacs %%' -e q | cut -d . -f1-2`
+      set _emacs_ver=21.3
+      set _emacs_dir=`which emacs | sed s%/bin/emacs%%` 
+      complete emacs   c/--/"(batch terminal display no-windows no-init-file \
+                               user debug-init unibyte multibyte version help \
+                               no-site-file funcall load eval insert kill)"/ \
+                        c/-/"(t d nw q u f l -)"/ c/+/x:'<line_number>'/ \
+                       n/{-t,--terminal}/x:'<terminal>'/ n/{-d,--display}/x:'<display>'/ \
+                       n/{-u,--user}/u/ n/{-f,--funcall}/x:'<lisp_function>'/ \
+                       n@{-l,--load}@F:$_emacs_dir/share/emacs/$_emacs_ver/lisp@ \
+                       n/--eval/x:'<expression>'/ n/--insert/f/ n/*/f:^*[\#~]/
+      unset _emacs_ver _emacs_dir
+    endif
+
+    complete gzcat     c/--/"(force help license quiet version)"/ \
+                       c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
+    complete gzip      c/--/"(stdout to-stdout decompress uncompress \
+                       force help list license no-name quiet recurse \
+                       suffix test verbose version fast best)"/ \
+                       c/-/"(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)"/\
+                       n/{-S,--suffix}/x:'<file_name_suffix>'/ \
+                       n/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
+                       N/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
+                       n/*/f:^*.{gz,Z,z,zip,taz,tgz}/
+    complete {gunzip,ungzip} c/--/"(stdout to-stdout force help list license \
+                       no-name quiet recurse suffix test verbose version)"/ \
+                       c/-/"(c f h l L n q r S t v V -)"/ \
+                       n/{-S,--suffix}/x:'<file_name_suffix>'/ \
+                       n/*/f:*.{gz,Z,z,zip,taz,tgz}/
+    complete zgrep     c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
+                       c/-/"(A b B c C e f h i l n s v V w x)"/ \
+                       p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
+                       n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
+    complete zegrep    c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
+                       c/-/"(A b B c C e f h i l n s v V w x)"/ \
+                       p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
+                       n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
+    complete zfgrep    c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
+                       c/-/"(A b B c C e f h i l n s v V w x)"/ \
+                       p/1/x:'<fixed_string>'/ N/-*e/f/ \
+                       n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
+    complete znew      c/-/"(f t v 9 P K)"/ n/*/f:*.Z/
+    complete zmore     n/*/f:*.{gz,Z,z,zip}/
+    complete zfile     n/*/f:*.{gz,Z,z,zip,taz,tgz}/
+    complete ztouch    n/*/f:*.{gz,Z,z,zip,taz,tgz}/
+    complete zforce    n/*/f:^*.{gz,tgz}/
+
+    complete dcop 'p/1/`$:0`/ /' \
+       'p/2/`$:0 $:1 | awk \{print\ \$1\}`/ /' \
+       'p/3/`$:0 $:1 $:2 | sed "s%.* \(.*\)(.*%\1%"`/ /'
+
+
+    complete grep      c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
+                       c/--/"(extended-regexp fixed-regexp basic-regexp \
+                       regexp file ignore-case word-regexp line-regexp \
+                       no-messages revert-match version help byte-offset \
+                       line-number with-filename no-filename quiet silent \
+                       text directories recursive files-without-match \
+                       files-with-matches count before-context after-context \
+                       context binary unix-byte-offsets)"/ \
+                       c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
+                               v w x)"/ \
+                       p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
+                       n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
+    complete egrep     c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
+                       c/--/"(extended-regexp fixed-regexp basic-regexp \
+                       regexp file ignore-case word-regexp line-regexp \
+                       no-messages revert-match version help byte-offset \
+                       line-number with-filename no-filename quiet silent \
+                       text directories recursive files-without-match \
+                       files-with-matches count before-context after-context \
+                       context binary unix-byte-offsets)"/ \
+                       c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
+                               v w x)"/ \
+                       p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
+                       n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
+    complete fgrep     c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
+                       c/--/"(extended-regexp fixed-regexp basic-regexp \
+                       regexp file ignore-case word-regexp line-regexp \
+                       no-messages revert-match version help byte-offset \
+                       line-number with-filename no-filename quiet silent \
+                       text directories recursive files-without-match \
+                       files-with-matches count before-context after-context \
+                       context binary unix-byte-offsets)"/ \
+                       c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
+                               v w x)"/ \
+                       p/1/x:'<fixed_string>'/ N/-*e/f/ \
+                       n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
+
+    complete sed       c/--/"(quiet silent version help expression file)"/   \
+                       c/-/"(n V e f -)"/ n/{-e,--expression}/x:'<script>'/  \
+                       n/{-f,--file}/f:*.sed/ N/-{e,f,-{file,expression}}/f/ \
+                       n/-/x:'<script>'/ N/-/f/ p/1/x:'<script>'/ p/2/f/
+
+    complete users     c/--/"(help version)"/ p/1/x:'<accounting_file>'/
+    complete who       c/--/"(heading idle count mesg message writable help \
+                       version)"/ c/-/"(H i m q s T w u -)"/ \
+                       p/1/x:'<accounting_file>'/ n/am/"(i)"/ n/are/"(you)"/
+
+    complete chown     c/--/"(changes dereference no-dereference silent \
+                       quiet reference recursive verbose help version)"/ \
+                       c/-/"(c f h R v -)"/ C@[./\$~]@f@ c/*[.:]/g/ \
+                       n/-/u/: p/1/u/: n/*/f/
+    complete chgrp     c/--/"(changes no-dereference silent quiet reference \
+                       recursive verbose help version)"/ \
+                       c/-/"(c f h R v -)"/ n/-/g/ p/1/g/ n/*/f/
+    complete chmod     c/--/"(changes silent quiet verbose reference \
+                       recursive help version)"/ c/-/"(c f R v)"/
+    complete df                c/--/"(all block-size human-readable si inodes \
+                       kilobytes local megabytes no-sync portability sync \
+                       type print-type exclude-type help version)"/ \
+                       c/-/"(a H h i k l m P T t v x)"/
+    complete du                c/--/"(all block-size bytes total dereference-args \
+                       human-readable si kilobytes count-links dereference \
+                       megabytes separate-dirs summarize one-file-system \
+                       exclude-from exclude max-depth help version"/ \
+                       c/-/"(a b c D H h k L l m S s X x)"/
+
+    complete cat       c/--/"(number-nonblank number squeeze-blank show-all \
+                       show-nonprinting show-ends show-tabs help version)"/ \
+                       c/-/"(A b E e n s T t u v -)"/ n/*/f/
+    complete mv                c/--/"(backup force interactive update verbose suffix \
+                       version-control help version)"/ \
+                       c/-/"(b f i S u V v -)"/ \
+                       n/{-S,--suffix}/x:'<suffix>'/ \
+                       n/{-V,--version-control}/"(t numbered nil existing \
+                       never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
+    complete cp                c/--/"(archive backup no-dereference force \
+                       interactive link preserve parents sparse recursive \
+                       symbolic-link suffix update verbose version-control \
+                       one-file-system help version)"/ \
+                       c/-/"(a b d f i l P p R r S s u V v x -)"/ \
+                       n/-*r/d/ n/{-S,--suffix}/x:'<suffix>'/ \
+                       n/{-V,--version-control}/"(t numbered nil existing \
+                       never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
+    complete ln                c/--/"(backup directory force no-dereference \
+                       interactive symbolic suffix verbose version-control \
+                       help version)"/ \
+                       c/-/"(b d F f i n S s V v -)"/ \
+                       n/{-S,--suffix}/x:'<suffix>'/ \
+                       n/{-V,--version-control}/"(t numbered nil existing \
+                       never simple)"/ n/-/f/ N/-/x:'<link_name>'/ \
+                       p/1/f/ p/2/x:'<link_name>'/
+    complete touch     c/--/"(date reference time help version)"/ \
+                       c/-/"(a c d f m r t -)"/ \
+                       n/{-d,--date}/x:'<date_string>'/ \
+                       c/--time/"(access atime mtime modify use)"/ \
+                       n/{-r,--file}/f/ n/-t/x:'<time_stamp>'/ n/*/f/
+    complete mkdir     c/--/"(mode parents verbose help version)"/ \
+                       c/-/"(p m -)"/ \
+                       n/{-m,--mode}/x:'<mode>'/ n/*/d/
+    complete rmdir     c/--/"(ignore-fail-on-non-empty parents verbose help \
+                       version)"/ c/-/"(p -)"/ n/*/d/
+    complete env       'c/*=/f/' 'p/1/e/=/' 'p/2/c/'
+
+    complete tar       c/-[Acru]*/"(b B C f F g G h i l L M N o P \
+                       R S T v V w W X z Z)"/ \
+                       c/-[dtx]*/"( B C f F g G i k K m M O p P \
+                       R s S T v w x X z Z)"/ \
+                       p/1/"(A c d r t u x -A -c -d -r -t -u -x \
+                       --catenate --concatenate --create --diff --compare \
+                       --delete --append --list --update --extract --get \
+                       --help --version)"/ \
+                       c/--/"(catenate concatenate create diff compare \
+                       delete append list update extract get atime-preserve \
+                       block-size read-full-blocks directory checkpoint file \
+                       force-local info-script new-volume-script incremental \
+                       listed-incremental dereference ignore-zeros \
+                       ignore-failed-read keep-old-files starting-file \
+                       one-file-system tape-length modification-time \
+                       multi-volume after-date newer old-archive portability \
+                       to-stdout same-permissions preserve-permissions \
+                       absolute-paths preserve record-number remove-files \
+                       same-order preserve-order same-owner sparse \
+                       files-from null totals verbose label version \
+                       interactive confirmation verify exclude exclude-from \
+                       compress uncompress gzip ungzip use-compress-program \
+                       block-compress help version)"/ \
+                       c/-/"(b B C f F g G h i k K l L m M N o O p P R s S \
+                       T v V w W X z Z 0 1 2 3 4 5 6 7 -)"/ \
+                       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`'/ \
+                       n/--use-compress-program/c/ \
+                       n/{-b,--block-size}/x:'<block_size>'/ \
+                       n/{-V,--label}/x:'<volume_label>'/ \
+                       n/{-N,--{after-date,newer}}/x:'<date>'/ \
+                       n/{-L,--tape-length}/x:'<tape_length_in_kB>'/ \
+                       n/{-C,--directory}/d/ \
+                       N/{-C,--directory}/'`\ls $:-1`'/ \
+                       n/-[0-7]/"(l m h)"/
+
+    # 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
+      set _domain = "`domainname`"
+      set _ypdir  = /var/yp    # directory where NIS (YP) maps are kept
+      if ("$_domain" != "" && "$_domain" != "noname") then
+        complete domainname p@1@D:$_ypdir@" " n@*@n@
+        complete ypcat     c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
+                           N@-d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
+                           n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
+        complete ypmatch    c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
+                           N@-d@x:'<key ...>'@ n@-@x:'<key ...>'@ p@1@x:'<key ...>'@ \
+                           n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
+        complete ypwhich    c@-@"(d m t x V1 V2)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
+                           n@-m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
+                           N@-m@n@ n@*@\$hosts@
+      endif
+      unset _domain _ypdir
+    endif
+
+    complete make \
+       'n/-f/f/' \
+       'c/*=/f/' \
+       'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^     #].*:/s/:.*//p"`@'
+
+    if ( -f /etc/printcap ) then
+       set printers=(`sed -n -e "/^[^     #].*:/s/:.*//p" /etc/printcap`)
+
+       complete lpr    'c/-P/$printers/'
+       complete lpq    'c/-P/$printers/'
+       complete lprm   'c/-P/$printers/'
+       complete lpquota        'p/1/(-Qprlogger)/' 'c/-P/$printers/'
+       complete dvips  'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/'
+       complete dvilj  'p/*/f:*.dvi/'
+    endif
+
+    # From Alphonse Bendt
+    complete ant \
+        'n/-f/f:*.xml/' \
+             'n@*@`cat build.xml | sed -n -e "s/[ \t]*<target[\t\n]*name=.\([a-zA-Z0-9_:]*\).*/\1/p"`@'
+
+    if ($?P4CLIENT && -X perl) then
+       # This is from Greg Allen.
+       set p4cmds=(add branch branches commands change changes client clients \
+           counter counters delete depot depots describe diff diff2 \
+           edit filelog files fix fixes fstat group groups have help \
+           info integrate integrated job jobs jobspec label labels \
+           labelsync lock obliterate opened passwd print protect rename \
+           reopen resolve resolved revert review reviews set submit \
+           sync triggers unlock user users verify where)
+       complete p4 'p/1/$p4cmds/' 'n/help/$p4cmds/' \
+           'n%{-l,label}%`p4 labels | sed "s/Label \([^ ]*\) .*/\1/"`%' \
+           'n%-t%`p4 $:1s | sed "s/[^ ]* \([^ ]*\) .*/\1/"`%' \
+           'c%*@%`p4 labels | sed "s/Label \([^ ]*\) .*/\1/"`%' \
+           'c@//*/*@`p4 files $:-0... |& perl -nle "m%\Q$:-0\E([^#][^/# ] \
+           *)%;print "\$"1 if \\\!/no such/&&\!"\$"h{"\$"1}++"`@@' \
+           'c@//@`p4 depots | sed "s/Depot \([^ ]*\) .*/\1/"`@/@'
+    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
+       uncomplete gv
+       uncomplete ghostview
+        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 \
+                       highlight-bars indent= filter= borders page-prefeed \
+                       no-page-prefeed lineprinter lines-per-page= mail \
+                       media= copies= newline= output= missing-characters \
+                       printer= quiet silent landscape portrait \
+                       baselineskip= statusdict= title= tabsize= underlay= \
+                       verbose version encoding pass-through download-font= \
+                       filter-stdin= help highlight-bar-gray= list-media \
+                       list-options non-printable-format= page-label-format= \
+                       printer-options= ul-angle= ul-font= ul-gray= \
+                       ul-position= ul-style= \
+                    )/'
+    endif
+
+    complete dpkg \
+               'c/--{admindir,instdir,root}=/d/' \
+               'c/--debug=/n/' \
+               'c/--{admindir,debug,instdir,root}/(=)//' \
+               'c/--/(admindir= debug= instdir= root= \
+                       assert-support-predepends assert-working-epoch \
+                       audit auto-deconfigure clear-avail \
+                       compare-versions configure contents control \
+                       extract force-bad-path field \
+                       force-configure-any force-conflicts \
+                       force-depends force-depends-version force-help \
+                       force-hold force-non-root \
+                       force-overwrite-diverted \
+                       force-remove-essential force-remove-reinstreq \
+                       forget-old-unavail fsys-tarfile get-selections \
+                       help ignore-depends info install largemem \
+                       license list listfiles merge-avail no-act \
+                       pending predep-package print-architecture \
+                       print-gnu-build-architecture \
+                       print-installation-architecture print-avail \
+                       purge record-avail recursive refuse-downgrade \
+                       remove search set-selections selected-only \
+                       skip-same-version smallmem status unpack \
+                       update-avail version vextract \
+                     )//' \
+               'n/{-l}/`dpkg -l|awk \{print\ \$2\}`/' \
+               'n/*/f:*.deb'/
+    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 \
+                  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 )/' \
+               'c/-/(b c= d f h m o= q qq s t x y )/' \
+               'n/{source,build-dep}/x:<pkgname>/' \
+               'n/{remove}/`dpkg -l|grep ^ii|awk \{print\ \$2\}`/' \
+               'n/{install}/`apt-cache pkgnames | sort`/' \
+               'C/*/(update upgrade dselect-upgrade source \
+                  build-dep check clean autoclean install remove)/'
+    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)/' \
+               'n/{search}/x:<regex>/' \
+               'n/{pkgnames,policy,show,showpkg,depends,dotty}/`apt-cache pkgnames | sort`/' \
+               'C/*/(add gencaches showpkg stats dump dumpavail unmet show \
+               search depends pkgnames dotty policy )/'
+
+    unset noglob
+    unset _complete
+    unset traditional_complete
+endif
+
+end:
+       onintr
diff --git a/contrib/tcsh-6/config/bsd4.4 b/contrib/tcsh-6/config/bsd4.4
new file mode 100644 (file)
index 0000000..6be4ebb
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * config.h -- configure various defines for tcsh
+ *
+ * All source files should #include this FIRST.
+ *
+ * Edit this to match your system type.
+ */
+
+#ifndef _h_config
+#define _h_config
+/****************** System dependant compilation flags ****************/
+/*
+ * POSIX       This system supports IEEE Std 1003.1-1988 (POSIX).
+ */
+#define POSIX
+
+/*
+ * POSIXJOBS   This system supports the optional IEEE Std 1003.1-1988 (POSIX)
+ *             job control facilities.
+ */
+#define POSIXJOBS
+
+/*
+ * VFORK       This machine has a vfork().  
+ *             It used to be that for job control to work, this define
+ *             was mandatory. This is not the case any more.
+ *             If you think you still need it, but you don't have vfork, 
+ *             define this anyway and then do #define vfork fork.  
+ *             I do this anyway on a Sun because of yellow pages brain damage,
+ *             [should not be needed under 4.1]
+ *             and on the iris4d cause SGI's fork is sufficiently "virtual" 
+ *             that vfork isn't necessary.  (Besides, SGI's vfork is weird).
+ *             Note that some machines eg. rs6000 have a vfork, but not
+ *             with the berkeley semantics, so we cannot use it there either.
+ */
+#define VFORK
+
+/*
+ * BSDJOBS     You have BSD-style job control (both process groups and
+ *             a tty that deals correctly
+ */
+#define BSDJOBS
+
+/*
+ * BSDTIMES    You have BSD-style process time stuff (like rusage)
+ *             This may or may not be true.  For example, Apple Unix
+ *             (OREO) has BSDJOBS but not BSDTIMES.
+ */
+#define BSDTIMES
+
+/*
+ * BSDLIMIT    You have BSD-style resource limit stuff (getrlimit/setrlimit)
+ */
+#define BSDLIMIT
+
+/*
+ * TERMIO      You have struct termio instead of struct sgttyb.
+ *             This is usually the case for SYSV systems, where
+ *             BSD uses sgttyb. POSIX systems should define this
+ *             anyway, even though they use struct termios.
+ */
+#define TERMIO
+
+/*
+ * SYSVREL     Your machine is SYSV based (HPUX, A/UX)
+ *             NOTE: don't do this if you are on a Pyramid -- tcsh is
+ *             built in a BSD universe.
+ *             Set SYSVREL to 1, 2, 3, or 4, depending the version of System V
+ *             you are running. Or set it to 0 if you are not SYSV based
+ */
+#define SYSVREL        0
+
+/*
+ * YPBUGS      Work around Sun YP bugs that cause expansion of ~username
+ *             to send command output to /dev/null
+ */
+#undef YPBUGS
+
+/****************** local defines *********************/
+
+#if defined(__FreeBSD__)
+#define NLS_BUGS
+#define BSD_STYLE_COLORLS
+#endif
+
+#if defined(__bsdi__)
+/*
+ * _PATH_TCSHELL      if you've change the installation location (vix)
+ */
+#include <sys/param.h>
+# ifdef _BSDI_VERSION >= 199701
+#  define _PATH_TCSHELL "/bin/tcsh"
+#  undef SYSMALLOC
+#  define SYSMALLOC
+# else
+#  define _PATH_TCSHELL "/usr/contrib/bin/tcsh"
+# endif
+
+# undef NLS_CATALOGS
+
+#elif defined(__APPLE__)
+# define SYSMALLOC
+
+#else
+# define NLS_CATALOGS
+#endif
+
+#endif /* _h_config */
diff --git a/contrib/tcsh-6/config_f.h b/contrib/tcsh-6/config_f.h
new file mode 100644 (file)
index 0000000..aee7363
--- /dev/null
@@ -0,0 +1,225 @@
+/* $Header: /p/tcsh/cvsroot/tcsh/config_f.h,v 3.40 2006/08/28 14:53:04 mitr Exp $ */
+/*
+ * config_f.h -- configure various defines for tcsh
+ *
+ * This is included by config.h.
+ *
+ * Edit this to match your particular feelings; this is set up to the
+ * way I like it.
+ */
+/*-
+ * Copyright (c) 1980, 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _h_config_f
+#define _h_config_f
+
+/*
+ * SHORT_STRINGS Use 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) && defined (NLS) && SIZEOF_WCHAR_T >= 4 && defined (HAVE_MBRTOWC) && !defined (WINNT_NATIVE) && !defined(_OSD_POSIX)
+# define WIDE_STRINGS
+#endif
+
+/*
+ * NLS_CATALOGS:Use Native Language System catalogs for
+ *             international messages.
+ *             Routines like catopen() are needed
+ *             if you don't have <nl_types.h>, you don't want
+ *             to define this.
+ */
+#if defined (NLS) && defined (HAVE_CATGETS)
+# define NLS_CATALOGS
+#endif
+
+/*
+ * LOGINFIRST   Source ~/.login before ~/.cshrc
+ */
+#undef LOGINFIRST
+
+/*
+ * VIDEFAULT    Make the VI mode editor the default
+ */
+#undef VIDEFAULT
+
+/*
+ * KAI          use "bye" command and rename "log" to "watchlog"
+ */
+#undef KAI
+
+/*
+ * TESLA       drops DTR on logout. Historical note:
+ *             tesla.ee.cornell.edu was a vax11/780 with a develcon
+ *             switch that sometimes would not hang up.
+ */
+#undef TESLA
+
+/*
+ * DOTLAST      put "." last in the default path, for security reasons
+ */
+#define DOTLAST
+
+/*
+ * NODOT       Don't put "." in the default path, for security reasons
+ */
+#undef NODOT
+
+/*
+ * AUTOLOGOUT  tries to determine if it should set autologout depending
+ *             on the name of the tty, and environment.
+ *             Does not make sense in the modern window systems!
+ */
+#define AUTOLOGOUT
+
+/*
+ * SUSPENDED   Newer shells say 'Suspended' instead of 'Stopped'.
+ *             Define to get the same type of messages.
+ */
+#define SUSPENDED
+
+/*
+ * KANJI       Ignore meta-next, and the ISO character set. Should
+ *             be used with SHORT_STRINGS (or WIDE_STRINGS)
+ *
+ */
+#define KANJI
+
+/*
+ * DSPMBYTE    add variable "dspmbyte" and display multi-byte string at
+ *             only output, when "dspmbyte" is set. Should be used with
+ *             KANJI
+ */
+#if defined (SHORT_STRINGS) && !defined (WIDE_STRINGS)
+# define DSPMBYTE
+#endif
+
+/*
+ * MBYTEDEBUG  when "dspmbyte" is changed, set multi-byte checktable to
+ *             variable "mbytemap".
+ *             (use for multi-byte table check)
+ */
+#undef MBYTEDEBUG
+
+/*
+ * NEWGRP      Provide a newgrp builtin.
+ */
+#undef NEWGRP
+
+/*
+ * SYSMALLOC   Use the system provided version of malloc and friends.
+ *             This can be much slower and no memory statistics will be
+ *             provided.
+ */
+#if defined(__MACHTEN__) || defined(PURIFY) || defined(MALLOC_TRACE) || defined(_OSD_POSIX) || defined(__MVS__) || defined (__linux__)
+# define SYSMALLOC
+#else
+# undef SYSMALLOC
+#endif
+
+/*
+ * USE_ACCESS  Use access(2) rather than stat(2) when POSIX is defined.
+ *             POSIX says to use stat, but stat(2) is less accurate
+ *             than access(2) for determining file access.
+ */
+#undef USE_ACCESS
+
+/*
+ * REMOTEHOST  Try to determine the remote host that we logged in from
+ *             using first getpeername, and then the utmp file. If
+ *             successful, set $REMOTEHOST to the name or address of the
+ *             host
+ */
+#define REMOTEHOST
+
+/*
+ * COLOR_LS_F Do you want to use builtin color ls-F ?
+ *
+ */
+#define COLOR_LS_F
+
+/*
+ * COLORCAT Do you want to colorful message ?
+ *
+ */
+#undef COLORCAT
+
+/*
+ * FILEC    support for old style file completion
+ */
+#define FILEC
+
+/*
+ * RCSID       This defines if we want rcs strings in the binary or not
+ *
+ */
+#if !defined(lint) && !defined(SABER) && !defined(__CLCC__)
+# ifndef __GNUC__
+#  define RCSID(id) static char *rcsid = (id);
+# else
+#  define RCSID(id) static char *rcsid(const char *a) { return rcsid(a = id); }
+# endif /* !__GNUC__ */
+#else
+# define RCSID(id)     /* Nothing */
+#endif /* !lint && !SABER */
+
+/* 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 */
diff --git a/contrib/tcsh-6/ed.chared.c b/contrib/tcsh-6/ed.chared.c
new file mode 100644 (file)
index 0000000..9f09c68
--- /dev/null
@@ -0,0 +1,3870 @@
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.chared.c,v 3.93 2006/08/23 15:03:13 christos Exp $ */
+/*
+ * ed.chared.c: Character editing functions.
+ */
+/*-
+ * 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.
+ */
+/*
+  Bjorn Knutsson @ Thu Jun 24 19:02:17 1999
+
+  e_dabbrev_expand() did not do proper completion if quoted spaces were present
+  in the string being completed. Exemple:
+
+  # echo hello\ world
+  hello world
+  # echo h<press key bound to dabbrev-expande>
+  # echo hello\<cursor>
+
+  Correct behavior is:
+  # echo h<press key bound to dabbrev-expande>
+  # echo hello\ world<cursor>
+
+  The same problem occured if spaces were present in a string withing quotation
+  marks. Example:
+
+  # echo "hello world"
+  hello world
+  # echo "h<press key bound to dabbrev-expande>
+  # echo "hello<cursor>
+  
+  The former problem could be solved with minor modifications of c_preword()
+  and c_endword(). The latter, however, required a significant rewrite of
+  c_preword(), since quoted strings must be parsed from start to end to
+  determine if a given character is inside or outside the quotation marks.
+
+  Compare the following two strings:
+
+  # echo \"" 'foo \' bar\"
+  " 'foo \' bar\
+  # echo '\"" 'foo \' bar\"
+  \"" foo ' bar"
+
+  The only difference between the two echo lines is in the first character
+  after the echo command. The result is either one or three arguments.
+
+ */
+
+#include "sh.h"
+
+RCSID("$tcsh: ed.chared.c,v 3.93 2006/08/23 15:03:13 christos Exp $")
+
+#include "ed.h"
+#include "tw.h"
+#include "ed.defns.h"
+
+/* #define SDEBUG */
+
+#define TCSHOP_NOP       0x00
+#define TCSHOP_DELETE    0x01
+#define TCSHOP_INSERT    0x02
+#define TCSHOP_CHANGE    0x04
+
+#define CHAR_FWD       0
+#define CHAR_BACK      1
+
+/*
+ * vi word treatment
+ * from: Gert-Jan Vons <vons@cesar.crbca1.sinet.slb.com>
+ */
+#define C_CLASS_WHITE  1
+#define C_CLASS_ALNUM  2
+#define C_CLASS_OTHER  3
+
+static Char *InsertPos = InputBuf; /* Where insertion starts */
+static Char *ActionPos = 0;       /* Where action begins  */
+static int  ActionFlag = TCSHOP_NOP;      /* What delayed action to take */
+/*
+ * Word search state
+ */
+static int  searchdir = F_UP_SEARCH_HIST;      /* Direction of last search */
+static struct Strbuf patbuf; /* = Strbuf_INIT; Search target */
+/*
+ * Char search state
+ */
+static int  srch_dir = CHAR_FWD;               /* Direction of last search */
+static Char srch_char = 0;                     /* Search target */
+
+/* all routines that start with c_ are private to this set of routines */
+static void     c_alternativ_key_map   (int);
+void    c_insert               (int);
+void    c_delafter             (int);
+void    c_delbefore            (int);
+static         int      c_to_class             (Char);
+static Char    *c_prev_word            (Char *, Char *, int);
+static Char    *c_next_word            (Char *, Char *, int);
+static Char    *c_number               (Char *, int *, int);
+static Char    *c_expand               (Char *);
+static void     c_excl                 (Char *);
+static void     c_substitute           (void);
+static void     c_delfini              (void);
+static int      c_hmatch               (Char *);
+static void     c_hsetpat              (void);
+#ifdef COMMENT
+static void     c_get_word             (Char **, Char **);
+#endif
+static Char    *c_preword              (Char *, Char *, int, Char *);
+static Char    *c_nexword              (Char *, Char *, int);
+static Char    *c_endword              (Char *, Char *, int, Char *);
+static Char    *c_eword                (Char *, Char *, int);
+static void     c_push_kill            (Char *, Char *);
+static void     c_save_inputbuf        (void);
+static  CCRETVAL c_search_line         (Char *, int);
+static  CCRETVAL v_repeat_srch         (int);
+static CCRETVAL e_inc_search           (int);
+#ifdef notyet
+static  CCRETVAL e_insert_str          (Char *);
+#endif
+static CCRETVAL v_search               (int);
+static CCRETVAL v_csearch_fwd          (Char, int, int);
+static CCRETVAL v_action               (int);
+static CCRETVAL v_csearch_back         (Char, int, int);
+
+static void
+c_alternativ_key_map(int state)
+{
+    switch (state) {
+    case 0:
+       CurrentKeyMap = CcKeyMap;
+       break;
+    case 1:
+       CurrentKeyMap = CcAltMap;
+       break;
+    default:
+       return;
+    }
+
+    AltKeyMap = (Char) state;
+}
+
+void
+c_insert(int num)
+{
+    Char *cp;
+
+    if (LastChar + num >= InputLim)
+       return;                 /* can't go past end of buffer */
+
+    if (Cursor < LastChar) {   /* if I must move chars */
+       for (cp = LastChar; cp >= Cursor; cp--)
+           cp[num] = *cp;
+       if (Mark && Mark > Cursor)
+               Mark += num;
+    }
+    LastChar += num;
+}
+
+void
+c_delafter(int num)
+{
+    Char *cp, *kp = NULL;
+
+    if (num > LastChar - Cursor)
+       num = (int) (LastChar - Cursor);        /* bounds check */
+
+    if (num > 0) {                     /* if I can delete anything */
+       if (VImode) {
+           kp = UndoBuf;               /* Set Up for VI undo command */
+           UndoAction = TCSHOP_INSERT;
+           UndoSize = num;
+           UndoPtr  = Cursor;
+           for (cp = Cursor; cp <= LastChar; cp++) {
+               *kp++ = *cp;    /* Save deleted chars into undobuf */
+               *cp = cp[num];
+           }
+       }
+       else
+           for (cp = Cursor; cp + num <= LastChar; cp++)
+               *cp = cp[num];
+       LastChar -= num;
+       /* Mark was within the range of the deleted word? */
+       if (Mark && Mark > Cursor && Mark <= Cursor+num)
+               Mark = Cursor;
+       /* Mark after the deleted word? */
+       else if (Mark && Mark > Cursor)
+               Mark -= num;
+    }
+#ifdef notdef
+    else {
+       /* 
+        * XXX: We don't want to do that. In emacs mode overwrite should be
+        * sticky. I am not sure how that affects vi mode 
+        */
+       inputmode = MODE_INSERT;
+    }
+#endif /* notdef */
+}
+
+void
+c_delbefore(int num)           /* delete before dot, with bounds checking */
+{
+    Char *cp, *kp = NULL;
+
+    if (num > Cursor - InputBuf)
+       num = (int) (Cursor - InputBuf);        /* bounds check */
+
+    if (num > 0) {                     /* if I can delete anything */
+       if (VImode) {
+           kp = UndoBuf;               /* Set Up for VI undo command */
+           UndoAction = TCSHOP_INSERT;
+           UndoSize = num;
+           UndoPtr  = Cursor - num;
+           for (cp = Cursor - num; cp <= LastChar; cp++) {
+               *kp++ = *cp;
+               *cp = cp[num];
+           }
+       }
+       else
+           for (cp = Cursor - num; cp + num <= LastChar; cp++)
+               *cp = cp[num];
+       LastChar -= num;
+       Cursor -= num;
+       /* Mark was within the range of the deleted word? */
+       if (Mark && Mark > Cursor && Mark <= Cursor+num)
+               Mark = Cursor;
+       /* Mark after the deleted word? */
+       else if (Mark && Mark > Cursor)
+               Mark -= num;
+    }
+}
+
+static Char *
+c_preword(Char *p, Char *low, int n, Char *delim)
+{
+  while (n--) {
+    Char *prev = low;
+    Char *new;
+
+    while (prev < p) {         /* Skip initial non-word chars */
+      if (!Strchr(delim, *prev) || *(prev-1) == (Char)'\\')
+       break;
+      prev++;
+    }
+
+    new = prev;
+
+    while (new < p) {
+      prev = new;
+      new = c_endword(prev-1, p, 1, delim); /* Skip to next non-word char */
+      new++;                   /* Step away from end of word */
+      while (new <= p) {       /* Skip trailing non-word chars */
+       if (!Strchr(delim, *new) || *(new-1) == (Char)'\\')
+         break;
+       new++;
+      }
+    }
+
+    p = prev;                  /* Set to previous word start */
+
+  }
+  if (p < low)
+    p = low;
+  return (p);
+}
+
+/*
+ * c_to_class() returns the class of the given character.
+ *
+ * This is used to make the c_prev_word() and c_next_word() functions
+ * work like vi's, which classify characters. A word is a sequence of
+ * characters belonging to the same class, classes being defined as
+ * follows:
+ *
+ *     1/ whitespace
+ *     2/ alphanumeric chars, + underscore
+ *     3/ others
+ */
+static int
+c_to_class(Char ch)
+{
+    if (Isspace(ch))
+        return C_CLASS_WHITE;
+
+    if (Isdigit(ch) || Isalpha(ch) || ch == '_')
+        return C_CLASS_ALNUM;
+
+    return C_CLASS_OTHER;
+}
+
+static Char *
+c_prev_word(Char *p, Char *low, int n)
+{
+    p--;
+
+    if (!VImode) {
+       while (n--) {
+           while ((p >= low) && !isword(*p)) 
+               p--;
+           while ((p >= low) && isword(*p)) 
+               p--;
+       }
+      
+       /* cp now points to one character before the word */
+       p++;
+       if (p < low)
+           p = low;
+       /* cp now points where we want it */
+       return(p);
+    }
+  
+    while (n--) {
+        int  c_class;
+
+        if (p < low)
+            break;
+
+        /* scan until beginning of current word (may be all whitespace!) */
+        c_class = c_to_class(*p);
+        while ((p >= low) && c_class == c_to_class(*p))
+            p--;
+
+        /* if this was a non_whitespace word, we're ready */
+        if (c_class != C_CLASS_WHITE)
+            continue;
+
+        /* otherwise, move back to beginning of the word just found */
+        c_class = c_to_class(*p);
+        while ((p >= low) && c_class == c_to_class(*p))
+            p--;
+    }
+
+    p++;                        /* correct overshoot */
+
+    return (p);
+}
+
+static Char *
+c_next_word(Char *p, Char *high, int n)
+{
+    if (!VImode) {
+       while (n--) {
+           while ((p < high) && !isword(*p)) 
+               p++;
+           while ((p < high) && isword(*p)) 
+               p++;
+       }
+       if (p > high)
+           p = high;
+       /* p now points where we want it */
+       return(p);
+    }
+
+    while (n--) {
+        int  c_class;
+
+        if (p >= high)
+            break;
+
+        /* scan until end of current word (may be all whitespace!) */
+        c_class = c_to_class(*p);
+        while ((p < high) && c_class == c_to_class(*p))
+            p++;
+
+        /* if this was all whitespace, we're ready */
+        if (c_class == C_CLASS_WHITE)
+            continue;
+
+       /* if we've found white-space at the end of the word, skip it */
+        while ((p < high) && c_to_class(*p) == C_CLASS_WHITE)
+            p++;
+    }
+
+    p--;                        /* correct overshoot */
+
+    return (p);
+}
+
+static Char *
+c_nexword(Char *p, Char *high, int n)
+{
+    while (n--) {
+       while ((p < high) && !Isspace(*p)) 
+           p++;
+       while ((p < high) && Isspace(*p)) 
+           p++;
+    }
+
+    if (p > high)
+       p = high;
+    /* p now points where we want it */
+    return(p);
+}
+
+/*
+ * Expand-History (originally "Magic-Space") code added by
+ * Ray Moody <ray@gibbs.physics.purdue.edu>
+ * this is a neat, but odd, addition.
+ */
+
+/*
+ * c_number: Ignore character p points to, return number appearing after that.
+ * A '$' by itself means a big number; "$-" is for negative; '^' means 1.
+ * Return p pointing to last char used.
+ */
+
+/*
+ * dval is the number to subtract from for things like $-3
+ */
+
+static Char *
+c_number(Char *p, int *num, int dval)
+{
+    int i;
+    int sign = 1;
+
+    if (*++p == '^') {
+       *num = 1;
+       return(p);
+    }
+    if (*p == '$') {
+       if (*++p != '-') {
+           *num = INT_MAX;     /* Handle $ */
+           return(--p);
+       }
+       sign = -1;              /* Handle $- */
+       ++p;
+    }
+    for (i = 0; *p >= '0' && *p <= '9'; i = 10 * i + *p++ - '0')
+       continue;
+    *num = (sign < 0 ? dval - i : i);
+    return(--p);
+}
+
+/*
+ * excl_expand: There is an excl to be expanded to p -- do the right thing
+ * with it and return a version of p advanced over the expanded stuff.  Also,
+ * update tsh_cur and related things as appropriate...
+ */
+
+static Char *
+c_expand(Char *p)
+{
+    Char *q;
+    struct Hist *h = Histlist.Hnext;
+    struct wordent *l;
+    int     i, from, to, dval;
+    int    all_dig;
+    int    been_once = 0;
+    Char   *op = p;
+    Char   *buf;
+    size_t buf_len;
+    Char   *modbuf;
+
+    buf = NULL;
+    if (!h)
+       goto excl_err;
+excl_sw:
+    switch (*(q = p + 1)) {
+
+    case '^':
+       buf = expand_lex(&h->Hlex, 1, 1);
+       break;
+
+    case '$':
+       if ((l = (h->Hlex).prev) != 0)
+           buf = expand_lex(l->prev->prev, 0, 0);
+       break;
+
+    case '*':
+       buf = expand_lex(&h->Hlex, 1, INT_MAX);
+       break;
+
+    default:
+       if (been_once) {        /* unknown argument */
+           /* assume it's a modifier, e.g. !foo:h, and get whole cmd */
+           buf = expand_lex(&h->Hlex, 0, INT_MAX);
+           q -= 2;
+           break;
+       }
+       been_once = 1;
+
+       if (*q == ':')          /* short form: !:arg */
+           --q;
+
+       if (*q != HIST) {
+           /*
+            * Search for a space, tab, or colon.  See if we have a number (as
+            * in !1234:xyz).  Remember the number.
+            */
+           for (i = 0, all_dig = 1; 
+                *q != ' ' && *q != '\t' && *q != ':' && q < Cursor; q++) {
+               /*
+                * PWP: !-4 is a valid history argument too, therefore the test
+                * is if not a digit, or not a - as the first character.
+                */
+               if ((*q < '0' || *q > '9') && (*q != '-' || q != p + 1))
+                   all_dig = 0;
+               else if (*q == '-')
+                   all_dig = 2;/* we are sneeky about this */
+               else
+                   i = 10 * i + *q - '0';
+           }
+           --q;
+
+           /*
+            * If we have a number, search for event i.  Otherwise, search for
+            * a named event (as in !foo).  (In this case, I is the length of
+            * the named event).
+            */
+           if (all_dig) {
+               if (all_dig == 2)
+                   i = -i;     /* make it negitive */
+               if (i < 0)      /* if !-4 (for example) */
+                   i = eventno + 1 + i;        /* remember: i is < 0 */
+               for (; h; h = h->Hnext) {
+                   if (h->Hnum == i)
+                       break;
+               }
+           }
+           else {
+               for (i = (int) (q - p); h; h = h->Hnext) {
+                   if ((l = &h->Hlex) != 0) {
+                       if (!Strncmp(p + 1, l->next->word, (size_t) i))
+                           break;
+                   }
+               }
+           }
+       }
+       if (!h)
+           goto excl_err;
+       if (q[1] == ':' || q[1] == '-' || q[1] == '*' ||
+           q[1] == '$' || q[1] == '^') {       /* get some args */
+           p = q[1] == ':' ? ++q : q;
+           /*
+            * Go handle !foo:*
+            */
+           if ((q[1] < '0' || q[1] > '9') &&
+               q[1] != '-' && q[1] != '$' && q[1] != '^')
+               goto excl_sw;
+           /*
+            * Go handle !foo:$
+            */
+           if (q[1] == '$' && (q[2] != '-' || q[3] < '0' || q[3] > '9'))
+               goto excl_sw;
+           /*
+            * Count up the number of words in this event.  Store it in dval.
+            * Dval will be fed to number.
+            */
+           dval = 0;
+           if ((l = h->Hlex.prev) != 0) {
+               for (l = l->prev; l != h->Hlex.next; l = l->prev, dval++)
+                   continue;
+           }
+           if (!dval)
+               goto excl_err;
+           if (q[1] == '-')
+               from = 0;
+           else
+               q = c_number(q, &from, dval);
+           if (q[1] == '-') {
+               ++q;
+               if ((q[1] < '0' || q[1] > '9') && q[1] != '$')
+                   to = dval - 1;
+               else
+                   q = c_number(q, &to, dval);
+           }
+           else if (q[1] == '*') {
+               ++q;
+               to = INT_MAX;
+           }
+           else {
+               to = from;
+           }
+           if (from < 0 || to < from)
+               goto excl_err;
+           buf = expand_lex(&h->Hlex, from, to);
+       }
+       else                    /* get whole cmd */
+           buf = expand_lex(&h->Hlex, 0, INT_MAX);
+       break;
+    }
+    if (buf == NULL)
+       buf = SAVE("");
+
+    /*
+     * Apply modifiers, if any.
+     */
+    if (q[1] == ':') {
+       modbuf = buf;
+       while (q[1] == ':' && modbuf != NULL) {
+           switch (q[2]) {
+           case 'r':
+           case 'e':
+           case 'h':
+           case 't':
+           case 'q':
+           case 'x':
+           case 'u':
+           case 'l':
+               if ((modbuf = domod(buf, (int) q[2])) != NULL) {
+                   xfree(buf);
+                   buf = modbuf;
+               }
+               ++q;
+               break;
+
+           case 'a':
+           case 'g':
+               /* Not implemented; this needs to be done before expanding
+                * lex. We don't have the words available to us anymore.
+                */
+               ++q;
+               break;
+
+           case 'p':
+               /* Ok */
+               ++q;
+               break;
+
+           case '\0':
+               break;
+
+           default:
+               ++q;
+               break;
+           }
+           if (q[1])
+               ++q;
+       }
+    }
+
+    buf_len = Strlen(buf);
+    /*
+     * Now replace the text from op to q inclusive with the text from buf.
+     */
+    q++;
+
+    /*
+     * Now replace text non-inclusively like a real CS major!
+     */
+    if (LastChar + buf_len - (q - op) >= InputLim)
+       goto excl_err;
+    (void) memmove(op + buf_len, q, (LastChar - q) * sizeof(Char));
+    LastChar += buf_len - (q - op);
+    Cursor += buf_len - (q - op);
+    (void) memcpy(op, buf, buf_len * sizeof(Char));
+    *LastChar = '\0';
+    xfree(buf);
+    return op + buf_len;
+excl_err:
+    xfree(buf);
+    SoundBeep();
+    return(op + 1);
+}
+
+/*
+ * c_excl: An excl has been found at point p -- back up and find some white
+ * space (or the beginning of the buffer) and properly expand all the excl's
+ * from there up to the current cursor position. We also avoid (trying to)
+ * expanding '>!'
+ */
+
+static void
+c_excl(Char *p)
+{
+    int i;
+    Char *q;
+
+    /*
+     * if />[SPC TAB]*![SPC TAB]/, back up p to just after the >. otherwise,
+     * back p up to just before the current word.
+     */
+    if ((p[1] == ' ' || p[1] == '\t') &&
+       (p[-1] == ' ' || p[-1] == '\t' || p[-1] == '>')) {
+       for (q = p - 1; q > InputBuf && (*q == ' ' || *q == '\t'); --q)
+           continue;
+       if (*q == '>')
+           ++p;
+    }
+    else {
+       while (*p != ' ' && *p != '\t' && p > InputBuf)
+           --p;
+    }
+
+    /*
+     * Forever: Look for history char.  (Stop looking when we find the cursor.)
+     * Count backslashes.  Of odd, skip history char. Return if all done.
+     * Expand if even number of backslashes.
+     */
+    for (;;) {
+       while (*p != HIST && p < Cursor)
+           ++p;
+       for (i = 1; (p - i) >= InputBuf && p[-i] == '\\'; i++)
+           continue;
+       if (i % 2 == 0)
+           ++p;
+       if (p >= Cursor)
+           return;
+       if (i % 2 == 1)
+           p = c_expand(p);
+    }
+}
+
+
+static void
+c_substitute(void)
+{
+    Char *p;
+
+    /*
+     * Start p out one character before the cursor.  Move it backwards looking
+     * for white space, the beginning of the line, or a history character.
+     */
+    for (p = Cursor - 1; 
+        p > InputBuf && *p != ' ' && *p != '\t' && *p != HIST; --p)
+       continue;
+
+    /*
+     * If we found a history character, go expand it.
+     */
+    if (*p == HIST)
+       c_excl(p);
+    Refresh();
+}
+
+static void
+c_delfini(void)                /* Finish up delete action */
+{
+    int Size;
+
+    if (ActionFlag & TCSHOP_INSERT)
+       c_alternativ_key_map(0);
+
+    ActionFlag = TCSHOP_NOP;
+
+    if (ActionPos == 0) 
+       return;
+
+    UndoAction = TCSHOP_INSERT;
+
+    if (Cursor > ActionPos) {
+       Size = (int) (Cursor-ActionPos);
+       c_delbefore(Size); 
+       RefCursor();
+    }
+    else if (Cursor < ActionPos) {
+       Size = (int)(ActionPos-Cursor);
+       c_delafter(Size);
+    }
+    else  {
+       Size = 1;
+       c_delafter(Size);
+    }
+    UndoPtr = Cursor;
+    UndoSize = Size;
+}
+
+static Char *
+c_endword(Char *p, Char *high, int n, Char *delim)
+{
+    Char inquote = 0;
+    p++;
+
+    while (n--) {
+        while (p < high) {     /* Skip non-word chars */
+         if (!Strchr(delim, *p) || *(p-1) == (Char)'\\')
+           break;
+         p++;
+        }
+       while (p < high) {      /* Skip string */
+         if ((*p == (Char)'\'' || *p == (Char)'"')) { /* Quotation marks? */
+           if (inquote || *(p-1) != (Char)'\\') { /* Should it be honored? */
+             if (inquote == 0) inquote = *p;
+             else if (inquote == *p) inquote = 0;
+           }
+         }
+         /* Break if unquoted non-word char */
+         if (!inquote && Strchr(delim, *p) && *(p-1) != (Char)'\\')
+           break;
+         p++;
+       }
+    }
+
+    p--;
+    return(p);
+}
+
+
+static Char *
+c_eword(Char *p, Char *high, int n)
+{
+    p++;
+
+    while (n--) {
+       while ((p < high) && Isspace(*p)) 
+           p++;
+
+       if (Isalnum(*p))
+           while ((p < high) && Isalnum(*p)) 
+               p++;
+       else
+           while ((p < high) && !(Isspace(*p) || Isalnum(*p)))
+               p++;
+    }
+
+    p--;
+    return(p);
+}
+
+/* Set the max length of the kill ring */
+void
+SetKillRing(int max)
+{
+    CStr *new;
+    int count, i, j;
+
+    if (max < 1)
+       max = 1;                /* no ring, but always one buffer */
+    if (max == KillRingMax)
+       return;
+    new = xcalloc(max, sizeof(CStr));
+    if (KillRing != NULL) {
+       if (KillRingLen != 0) {
+           if (max >= KillRingLen) {
+               count = KillRingLen;
+               j = KillPos;
+           } else {
+               count = max;
+               j = (KillPos - count + KillRingLen) % KillRingLen;
+           }
+           for (i = 0; i < KillRingLen; i++) {
+               if (i < count)  /* copy latest */
+                   new[i] = KillRing[j];
+               else            /* free the others */
+                   xfree(KillRing[j].buf);
+               j = (j + 1) % KillRingLen;
+           }
+           KillRingLen = count;
+           KillPos = count % max;
+           YankPos = count - 1;
+       }
+       xfree(KillRing);
+    }
+    KillRing = new;
+    KillRingMax = max;
+}
+
+/* Push string from start upto (but not including) end onto kill ring */
+static void
+c_push_kill(Char *start, Char *end)
+{
+    CStr save, *pos;
+    Char *dp, *cp, *kp;
+    int len = end - start, i, j, k;
+
+    /* Check for duplicates? */
+    if (KillRingLen > 0 && (dp = varval(STRkilldup)) != STRNULL) {
+       YankPos = (KillPos - 1 + KillRingLen) % KillRingLen;
+       if (eq(dp, STRerase)) { /* erase earlier one (actually move up) */
+           j = YankPos;
+           for (i = 0; i < KillRingLen; i++) {
+               if (Strncmp(KillRing[j].buf, start, (size_t) len) == 0 &&
+                   KillRing[j].buf[len] == '\0') {
+                   save = KillRing[j];
+                   for ( ; i > 0; i--) {
+                       k = j;
+                       j = (j + 1) % KillRingLen;
+                       KillRing[k] = KillRing[j];
+                   }
+                   KillRing[j] = save;
+                   return;
+               }
+               j = (j - 1 + KillRingLen) % KillRingLen;
+           }
+       } else if (eq(dp, STRall)) { /* skip if any earlier */
+           for (i = 0; i < KillRingLen; i++)
+               if (Strncmp(KillRing[i].buf, start, (size_t) len) == 0 &&
+                   KillRing[i].buf[len] == '\0')
+                   return;
+       } else if (eq(dp, STRprev)) { /* skip if immediately previous */
+           j = YankPos;
+           if (Strncmp(KillRing[j].buf, start, (size_t) len) == 0 &&
+               KillRing[j].buf[len] == '\0')
+               return;
+       }
+    }
+
+    /* No duplicate, go ahead and push */
+    len++;                     /* need space for '\0' */
+    YankPos = KillPos;
+    if (KillRingLen < KillRingMax)
+       KillRingLen++;
+    pos = &KillRing[KillPos];
+    KillPos = (KillPos + 1) % KillRingMax;
+    if (pos->len < len) {
+       pos->buf = xrealloc(pos->buf, len * sizeof(Char));
+       pos->len = len;
+    }
+    cp = start;
+    kp = pos->buf;
+    while (cp < end)
+       *kp++ = *cp++;
+    *kp = '\0';
+}
+
+/* Save InputBuf etc in SavedBuf etc for restore after cmd exec */
+static void
+c_save_inputbuf()
+{
+    SavedBuf.len = 0;
+    Strbuf_append(&SavedBuf, InputBuf);
+    Strbuf_terminate(&SavedBuf);
+    LastSaved = LastChar - InputBuf;
+    CursSaved = Cursor - InputBuf;
+    HistSaved = Hist_num;
+    RestoreSaved = 1;
+}
+
+CCRETVAL
+GetHistLine()
+{
+    struct Hist *hp;
+    int     h;
+
+    if (Hist_num == 0) {       /* if really the current line */
+       if (HistBuf.s != NULL)
+           copyn(InputBuf, HistBuf.s, INBUFSIZE);/*FIXBUF*/
+       else
+           *InputBuf = '\0';
+       LastChar = InputBuf + HistBuf.len;
+
+#ifdef KSHVI
+    if (VImode)
+       Cursor = InputBuf;
+    else
+#endif /* KSHVI */
+       Cursor = LastChar;
+
+       return(CC_REFRESH);
+    }
+
+    hp = Histlist.Hnext;
+    if (hp == NULL)
+       return(CC_ERROR);
+
+    for (h = 1; h < Hist_num; h++) {
+       if ((hp->Hnext) == NULL) {
+           Hist_num = h;
+           return(CC_ERROR);
+       }
+       hp = hp->Hnext;
+    }
+
+    if (HistLit && hp->histline) {
+       copyn(InputBuf, hp->histline, INBUFSIZE);/*FIXBUF*/
+       CurrentHistLit = 1;
+    }
+    else {
+       Char *p;
+
+       p = sprlex(&hp->Hlex);
+       copyn(InputBuf, p, sizeof(InputBuf) / sizeof(Char));/*FIXBUF*/
+       xfree(p);
+       CurrentHistLit = 0;
+    }
+    LastChar = Strend(InputBuf);
+
+    if (LastChar > InputBuf) {
+       if (LastChar[-1] == '\n')
+           LastChar--;
+#if 0
+       if (LastChar[-1] == ' ')
+           LastChar--;
+#endif
+       if (LastChar < InputBuf)
+           LastChar = InputBuf;
+    }
+  
+#ifdef KSHVI
+    if (VImode)
+       Cursor = InputBuf;
+    else
+#endif /* KSHVI */
+       Cursor = LastChar;
+
+    return(CC_REFRESH);
+}
+
+static CCRETVAL
+c_search_line(Char *pattern, int dir)
+{
+    Char *cp;
+    size_t len;
+
+    len = Strlen(pattern);
+
+    if (dir == F_UP_SEARCH_HIST) {
+       for (cp = Cursor; cp >= InputBuf; cp--)
+           if (Strncmp(cp, pattern, len) == 0 ||
+               Gmatch(cp, pattern)) {
+               Cursor = cp;
+               return(CC_NORM);
+           }
+       return(CC_ERROR);
+    } else {
+       for (cp = Cursor; *cp != '\0' && cp < InputLim; cp++)
+           if (Strncmp(cp, pattern, len) == 0 ||
+               Gmatch(cp, pattern)) {
+               Cursor = cp;
+               return(CC_NORM);
+           }
+       return(CC_ERROR);
+    }
+}
+
+static CCRETVAL
+e_inc_search(int dir)
+{
+    static const Char STRfwd[] = { 'f', 'w', 'd', '\0' },
+                     STRbck[] = { 'b', 'c', 'k', '\0' };
+    static Char pchar = ':';   /* ':' = normal, '?' = failed */
+    static Char endcmd[2];
+    const Char *cp;
+    Char ch,
+       *oldCursor = Cursor,
+       oldpchar = pchar;
+    CCRETVAL ret = CC_NORM;
+    int oldHist_num = Hist_num,
+       oldpatlen = patbuf.len,
+       newdir = dir,
+        done, redo;
+
+    if (LastChar + sizeof(STRfwd)/sizeof(Char) + 2 + patbuf.len >= InputLim)
+       return(CC_ERROR);
+
+    for (;;) {
+
+       if (patbuf.len == 0) {  /* first round */
+           pchar = ':';
+           Strbuf_append1(&patbuf, '*');
+       }
+       done = redo = 0;
+       *LastChar++ = '\n';
+       for (cp = newdir == F_UP_SEARCH_HIST ? STRbck : STRfwd; 
+            *cp; *LastChar++ = *cp++)
+           continue;
+       *LastChar++ = pchar;
+       for (cp = &patbuf.s[1]; cp < &patbuf.s[patbuf.len];
+            *LastChar++ = *cp++)
+           continue;
+       *LastChar = '\0';
+       if (adrof(STRhighlight) && pchar == ':') {
+           /* if the no-glob-search patch is applied, remove the - 1 below */
+           IncMatchLen = patbuf.len - 1;
+           ClearLines();
+           ClearDisp();
+       }
+       Refresh();
+
+       if (GetNextChar(&ch) != 1)
+           return(e_send_eof(0));
+
+       switch (ch > NT_NUM_KEYS
+               ? F_INSERT : CurrentKeyMap[(unsigned char) ch]) {
+       case F_INSERT:
+       case F_DIGIT:
+       case F_MAGIC_SPACE:
+           if (LastChar + 1 >= InputLim) /*FIXBUF*/
+               SoundBeep();
+           else {
+               Strbuf_append1(&patbuf, ch);
+               *LastChar++ = ch;
+               *LastChar = '\0';
+               Refresh();
+           }
+           break;
+
+       case F_INC_FWD:
+           newdir = F_DOWN_SEARCH_HIST;
+           redo++;
+           break;
+
+       case F_INC_BACK:
+           newdir = F_UP_SEARCH_HIST;
+           redo++;
+           break;
+
+       case F_DELPREV:
+           if (patbuf.len > 1)
+               done++;
+           else 
+               SoundBeep();
+           break;
+
+       default:
+           switch (ASC(ch)) {
+           case 0007:          /* ^G: Abort */
+               ret = CC_ERROR;
+               done++;
+               break;
+
+           case 0027:          /* ^W: Append word */
+               /* No can do if globbing characters in pattern */
+               for (cp = &patbuf.s[1]; ; cp++)
+                   if (cp >= &patbuf.s[patbuf.len]) {
+                       Cursor += patbuf.len - 1;
+                       cp = c_next_word(Cursor, LastChar, 1);
+                       while (Cursor < cp && *Cursor != '\n') {
+                           if (LastChar + 1 >= InputLim) {/*FIXBUF*/
+                               SoundBeep();
+                               break;
+                           }
+                           Strbuf_append1(&patbuf, *Cursor);
+                           *LastChar++ = *Cursor++;
+                       }
+                       Cursor = oldCursor;
+                       *LastChar = '\0';
+                       Refresh();
+                       break;
+                   } else if (isglob(*cp)) {
+                       SoundBeep();
+                       break;
+                   }
+               break;
+           
+           default:            /* Terminate and execute cmd */
+               endcmd[0] = ch;
+               PushMacro(endcmd);
+               /*FALLTHROUGH*/
+
+           case 0033:          /* ESC: Terminate */
+               ret = CC_REFRESH;
+               done++;
+               break;
+           }
+           break;
+       }
+
+       while (LastChar > InputBuf && *LastChar != '\n')
+           *LastChar-- = '\0';
+       *LastChar = '\0';
+
+       if (!done) {
+
+           /* Can't search if unmatched '[' */
+           for (cp = &patbuf.s[patbuf.len - 1], ch = ']'; cp > patbuf.s; cp--)
+               if (*cp == '[' || *cp == ']') {
+                   ch = *cp;
+                   break;
+               }
+
+           if (patbuf.len > 1 && ch != '[') {
+               if (redo && newdir == dir) {
+                   if (pchar == '?') { /* wrap around */
+                       Hist_num = newdir == F_UP_SEARCH_HIST ? 0 : INT_MAX;
+                       if (GetHistLine() == CC_ERROR)
+                           /* Hist_num was fixed by first call */
+                           (void) GetHistLine();
+                       Cursor = newdir == F_UP_SEARCH_HIST ?
+                           LastChar : InputBuf;
+                   } else
+                       Cursor += newdir == F_UP_SEARCH_HIST ? -1 : 1;
+               }
+               Strbuf_append1(&patbuf, '*');
+               Strbuf_terminate(&patbuf);
+               if (Cursor < InputBuf || Cursor > LastChar ||
+                   (ret = c_search_line(&patbuf.s[1], newdir)) == CC_ERROR) {
+                   LastCmd = (KEYCMD) newdir; /* avoid c_hsetpat */
+                   ret = newdir == F_UP_SEARCH_HIST ?
+                       e_up_search_hist(0) : e_down_search_hist(0);
+                   if (ret != CC_ERROR) {
+                       Cursor = newdir == F_UP_SEARCH_HIST ?
+                           LastChar : InputBuf;
+                       (void) c_search_line(&patbuf.s[1], newdir);
+                   }
+               }
+               patbuf.s[--patbuf.len] = '\0';
+               if (ret == CC_ERROR) {
+                   SoundBeep();
+                   if (Hist_num != oldHist_num) {
+                       Hist_num = oldHist_num;
+                       if (GetHistLine() == CC_ERROR)
+                           return(CC_ERROR);
+                   }
+                   Cursor = oldCursor;
+                   pchar = '?';
+               } else {
+                   pchar = ':';
+               }
+           }
+
+           ret = e_inc_search(newdir);
+
+           if (ret == CC_ERROR && pchar == '?' && oldpchar == ':') {
+               /* break abort of failed search at last non-failed */
+               ret = CC_NORM;
+           }
+
+       }
+
+       if (ret == CC_NORM || (ret == CC_ERROR && oldpatlen == 0)) {
+           /* restore on normal return or error exit */
+           pchar = oldpchar;
+           patbuf.len = oldpatlen;
+           if (Hist_num != oldHist_num) {
+               Hist_num = oldHist_num;
+               if (GetHistLine() == CC_ERROR)
+                   return(CC_ERROR);
+           }
+           Cursor = oldCursor;
+           if (ret == CC_ERROR)
+               Refresh();
+       }
+       if (done || ret != CC_NORM)
+           return(ret);
+           
+    }
+
+}
+
+static CCRETVAL
+v_search(int dir)
+{
+    struct Strbuf tmpbuf = Strbuf_INIT;
+    Char ch;
+    Char *oldbuf;
+    Char *oldlc, *oldc;
+
+    cleanup_push(&tmpbuf, Strbuf_cleanup);
+    oldbuf = Strsave(InputBuf);
+    cleanup_push(oldbuf, xfree);
+    oldlc = LastChar;
+    oldc = Cursor;
+    Strbuf_append1(&tmpbuf, '*');
+
+    InputBuf[0] = '\0';
+    LastChar = InputBuf;
+    Cursor = InputBuf;
+    searchdir = dir;
+
+    c_insert(2);       /* prompt + '\n' */
+    *Cursor++ = '\n';
+    *Cursor++ = dir == F_UP_SEARCH_HIST ? '?' : '/';
+    Refresh();
+    for (ch = 0;ch == 0;) {
+       if (GetNextChar(&ch) != 1) {
+           cleanup_until(&tmpbuf);
+           return(e_send_eof(0));
+       }
+       switch (ASC(ch)) {
+       case 0010:      /* Delete and backspace */
+       case 0177:
+           if (tmpbuf.len > 1) {
+               *Cursor-- = '\0';
+               LastChar = Cursor;
+               tmpbuf.len--;
+           }
+           else {
+               copyn(InputBuf, oldbuf, INBUFSIZE);/*FIXBUF*/
+               LastChar = oldlc;
+               Cursor = oldc;
+               cleanup_until(&tmpbuf);
+               return(CC_REFRESH);
+           }
+           Refresh();
+           ch = 0;
+           break;
+
+       case 0033:      /* ESC */
+#ifdef IS_ASCII
+       case '\r':      /* Newline */
+       case '\n':
+#else
+       case '\012':    /* ASCII Line feed */
+       case '\015':    /* ASCII (or EBCDIC) Return */
+#endif
+           break;
+
+       default:
+           Strbuf_append1(&tmpbuf, ch);
+           *Cursor++ = ch;
+           LastChar = Cursor;
+           Refresh();
+           ch = 0;
+           break;
+       }
+    }
+    cleanup_until(oldbuf);
+
+    if (tmpbuf.len == 1) {
+       /*
+        * Use the old pattern, but wild-card it.
+        */
+       if (patbuf.len == 0) {
+           InputBuf[0] = '\0';
+           LastChar = InputBuf;
+           Cursor = InputBuf;
+           Refresh();
+           cleanup_until(&tmpbuf);
+           return(CC_ERROR);
+       }
+       if (patbuf.s[0] != '*') {
+           oldbuf = Strsave(patbuf.s);
+           patbuf.len = 0;
+           Strbuf_append1(&patbuf, '*');
+           Strbuf_append(&patbuf, oldbuf);
+           xfree(oldbuf);
+           Strbuf_append1(&patbuf, '*');
+           Strbuf_terminate(&patbuf);
+       }
+    }
+    else {
+       Strbuf_append1(&tmpbuf, '*');
+       Strbuf_terminate(&tmpbuf);
+       patbuf.len = 0;
+       Strbuf_append(&patbuf, tmpbuf.s);
+       Strbuf_terminate(&patbuf);
+    }
+    cleanup_until(&tmpbuf);
+    LastCmd = (KEYCMD) dir; /* avoid c_hsetpat */
+    Cursor = LastChar = InputBuf;
+    if ((dir == F_UP_SEARCH_HIST ? e_up_search_hist(0) : 
+                                  e_down_search_hist(0)) == CC_ERROR) {
+       Refresh();
+       return(CC_ERROR);
+    }
+    else {
+       if (ASC(ch) == 0033) {
+           Refresh();
+           *LastChar++ = '\n';
+           *LastChar = '\0';
+           PastBottom();
+           return(CC_NEWLINE);
+       }
+       else
+           return(CC_REFRESH);
+    }
+}
+
+/*
+ * semi-PUBLIC routines.  Any routine that is of type CCRETVAL is an
+ * entry point, called from the CcKeyMap indirected into the
+ * CcFuncTbl array.
+ */
+
+/*ARGSUSED*/
+CCRETVAL
+v_cmd_mode(Char c)
+{
+    USE(c);
+    InsertPos = 0;
+    ActionFlag = TCSHOP_NOP;   /* [Esc] cancels pending action */
+    ActionPos = 0;
+    DoingArg = 0;
+    if (UndoPtr > Cursor)
+       UndoSize = (int)(UndoPtr - Cursor);
+    else
+       UndoSize = (int)(Cursor - UndoPtr);
+
+    inputmode = MODE_INSERT;
+    c_alternativ_key_map(1);
+#ifdef notdef
+    /*
+     * We don't want to move the cursor, because all the editing
+     * commands don't include the character under the cursor.
+     */
+    if (Cursor > InputBuf)
+       Cursor--;
+#endif
+    RefCursor();
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_unassigned(Char c)
+{                              /* bound to keys that arn't really assigned */
+    USE(c);
+    SoundBeep();
+    flush();
+    return(CC_NORM);
+}
+
+#ifdef notyet
+static CCRETVAL
+e_insert_str(Char *c)
+{
+    int i, n;
+
+    n = Strlen(c);
+    if (LastChar + Argument * n >= InputLim)
+       return(CC_ERROR);       /* end of buffer space */
+    if (inputmode != MODE_INSERT) {
+       c_delafter(Argument * Strlen(c));
+    }
+    c_insert(Argument * n);
+    while (Argument--) {
+       for (i = 0; i < n; i++)
+           *Cursor++ = c[i];
+    }
+    Refresh();
+    return(CC_NORM);
+}
+#endif
+
+CCRETVAL
+e_insert(Char c)
+{
+#ifndef SHORT_STRINGS
+    c &= ASCII;                        /* no meta chars ever */
+#endif
+
+    if (!c)
+       return(CC_ERROR);       /* no NULs in the input ever!! */
+
+    if (LastChar + Argument >= InputLim)
+       return(CC_ERROR);       /* end of buffer space */
+
+    if (Argument == 1) {       /* How was this optimized ???? */
+
+       if (inputmode != MODE_INSERT) {
+           UndoBuf[UndoSize++] = *Cursor;
+           UndoBuf[UndoSize] = '\0';
+           c_delafter(1);   /* Do NOT use the saving ONE */
+       }
+
+        c_insert(1);
+       *Cursor++ = (Char) c;
+       DoingArg = 0;           /* just in case */
+       RefPlusOne(1);          /* fast refresh for one char. */
+    }
+    else {
+       if (inputmode != MODE_INSERT) {
+           int i;
+           for(i = 0; i < Argument; i++) 
+               UndoBuf[UndoSize++] = *(Cursor + i);
+
+           UndoBuf[UndoSize] = '\0';
+           c_delafter(Argument);   /* Do NOT use the saving ONE */
+       }
+
+        c_insert(Argument);
+
+       while (Argument--)
+           *Cursor++ = (Char) c;
+       Refresh();
+    }
+
+    if (inputmode == MODE_REPLACE_1)
+       (void) v_cmd_mode(0);
+
+    return(CC_NORM);
+}
+
+int
+InsertStr(Char *s)             /* insert ASCIZ s at cursor (for complete) */
+{
+    int len;
+
+    if ((len = (int) Strlen(s)) <= 0)
+       return -1;
+    if (LastChar + len >= InputLim)
+       return -1;              /* end of buffer space */
+
+    c_insert(len);
+    while (len--)
+       *Cursor++ = *s++;
+    return 0;
+}
+
+void
+DeleteBack(int n)              /* delete the n characters before . */
+{
+    if (n <= 0)
+       return;
+    if (Cursor >= &InputBuf[n]) {
+       c_delbefore(n);         /* delete before dot */
+    }
+}
+
+CCRETVAL
+e_digit(Char c)                        /* gray magic here */
+{
+    if (!Isdigit(c))
+       return(CC_ERROR);       /* no NULs in the input ever!! */
+
+    if (DoingArg) {            /* if doing an arg, add this in... */
+       if (LastCmd == F_ARGFOUR)       /* if last command was ^U */
+           Argument = c - '0';
+       else {
+           if (Argument > 1000000)
+               return CC_ERROR;
+           Argument = (Argument * 10) + (c - '0');
+       }
+       return(CC_ARGHACK);
+    }
+    else {
+       if (LastChar + 1 >= InputLim)
+           return CC_ERROR;    /* end of buffer space */
+
+       if (inputmode != MODE_INSERT) {
+           UndoBuf[UndoSize++] = *Cursor;
+           UndoBuf[UndoSize] = '\0';
+           c_delafter(1);   /* Do NOT use the saving ONE */
+       }
+       c_insert(1);
+       *Cursor++ = (Char) c;
+       DoingArg = 0;           /* just in case */
+       RefPlusOne(1);          /* fast refresh for one char. */
+    }
+    return(CC_NORM);
+}
+
+CCRETVAL
+e_argdigit(Char c)             /* for ESC-n */
+{
+#ifdef IS_ASCII
+    c &= ASCII;
+#else
+    c = CTL_ESC(ASC(c) & ASCII); /* stripping for EBCDIC done the ASCII way */
+#endif
+
+    if (!Isdigit(c))
+       return(CC_ERROR);       /* no NULs in the input ever!! */
+
+    if (DoingArg) {            /* if doing an arg, add this in... */
+       if (Argument > 1000000)
+           return CC_ERROR;
+       Argument = (Argument * 10) + (c - '0');
+    }
+    else {                     /* else starting an argument */
+       Argument = c - '0';
+       DoingArg = 1;
+    }
+    return(CC_ARGHACK);
+}
+
+CCRETVAL
+v_zero(Char c)                 /* command mode 0 for vi */
+{
+    if (DoingArg) {            /* if doing an arg, add this in... */
+       if (Argument > 1000000)
+           return CC_ERROR;
+       Argument = (Argument * 10) + (c - '0');
+       return(CC_ARGHACK);
+    }
+    else {                     /* else starting an argument */
+       Cursor = InputBuf;
+       if (ActionFlag & TCSHOP_DELETE) {
+          c_delfini();
+          return(CC_REFRESH);
+        }
+       RefCursor();            /* move the cursor */
+       return(CC_NORM);
+    }
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_newline(Char c)
+{                              /* always ignore argument */
+    USE(c);
+    if (adrof(STRhighlight) && MarkIsSet) {
+       MarkIsSet = 0;
+       ClearLines();
+       ClearDisp();
+       Refresh();
+    }
+    MarkIsSet = 0;
+
+  /*  PastBottom();  NOW done in ed.inputl.c */
+    *LastChar++ = '\n';                /* for the benefit of CSH */
+    *LastChar = '\0';          /* just in case */
+    if (VImode)
+       InsertPos = InputBuf;   /* Reset editing position */
+    return(CC_NEWLINE);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_newline_hold(Char c)
+{
+    USE(c);
+    c_save_inputbuf();
+    HistSaved = 0;
+    *LastChar++ = '\n';                /* for the benefit of CSH */
+    *LastChar = '\0';          /* just in case */
+    return(CC_NEWLINE);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_newline_down_hist(Char c)
+{
+    USE(c);
+    if (Hist_num > 1) {
+       HistSaved = Hist_num;
+    }
+    *LastChar++ = '\n';                /* for the benefit of CSH */
+    *LastChar = '\0';          /* just in case */
+    return(CC_NEWLINE);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_send_eof(Char c)
+{                              /* for when ^D is ONLY send-eof */
+    USE(c);
+    PastBottom();
+    *LastChar = '\0';          /* just in case */
+    return(CC_EOF);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_complete(Char c)
+{
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+    return(CC_COMPLETE);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_complete_back(Char c)
+{
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+    return(CC_COMPLETE_BACK);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_complete_fwd(Char c)
+{
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+    return(CC_COMPLETE_FWD);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_complete_all(Char c)
+{
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+    return(CC_COMPLETE_ALL);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_cm_complete(Char c)
+{
+    USE(c);
+    if (Cursor < LastChar)
+       Cursor++;
+    *LastChar = '\0';          /* just in case */
+    return(CC_COMPLETE);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_toggle_hist(Char c)
+{
+    struct Hist *hp;
+    int     h;
+
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+
+    if (Hist_num <= 0) {
+       return CC_ERROR;
+    }
+
+    hp = Histlist.Hnext;
+    if (hp == NULL) {  /* this is only if no history */
+       return(CC_ERROR);
+    }
+
+    for (h = 1; h < Hist_num; h++)
+       hp = hp->Hnext;
+
+    if (!CurrentHistLit) {
+       if (hp->histline) {
+           copyn(InputBuf, hp->histline, INBUFSIZE);/*FIXBUF*/
+           CurrentHistLit = 1;
+       }
+       else {
+           return CC_ERROR;
+       }
+    }
+    else {
+       Char *p;
+
+       p = sprlex(&hp->Hlex);
+       copyn(InputBuf, p, sizeof(InputBuf) / sizeof(Char));/*FIXBUF*/
+       xfree(p);
+       CurrentHistLit = 0;
+    }
+
+    LastChar = Strend(InputBuf);
+    if (LastChar > InputBuf) {
+       if (LastChar[-1] == '\n')
+           LastChar--;
+       if (LastChar[-1] == ' ')
+           LastChar--;
+       if (LastChar < InputBuf)
+           LastChar = InputBuf;
+    }
+
+#ifdef KSHVI
+    if (VImode)
+       Cursor = InputBuf;
+    else
+#endif /* KSHVI */
+       Cursor = LastChar;
+
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_up_hist(Char c)
+{
+    Char    beep = 0;
+
+    USE(c);
+    UndoAction = TCSHOP_NOP;
+    *LastChar = '\0';          /* just in case */
+
+    if (Hist_num == 0) {       /* save the current buffer away */
+       HistBuf.len = 0;
+       Strbuf_append(&HistBuf, InputBuf);
+       Strbuf_terminate(&HistBuf);
+    }
+
+    Hist_num += Argument;
+
+    if (GetHistLine() == CC_ERROR) {
+       beep = 1;
+       (void) GetHistLine(); /* Hist_num was fixed by first call */
+    }
+
+    Refresh();
+    if (beep)
+       return(CC_ERROR);
+    else
+       return(CC_NORM);        /* was CC_UP_HIST */
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_down_hist(Char c)
+{
+    USE(c);
+    UndoAction = TCSHOP_NOP;
+    *LastChar = '\0';          /* just in case */
+
+    Hist_num -= Argument;
+
+    if (Hist_num < 0) {
+       Hist_num = 0;
+       return(CC_ERROR);       /* make it beep */
+    }
+
+    return(GetHistLine());
+}
+
+
+
+/*
+ * c_hmatch() return True if the pattern matches the prefix
+ */
+static int
+c_hmatch(Char *str)
+{
+    if (Strncmp(patbuf.s, str, patbuf.len) == 0)
+       return 1;
+    return Gmatch(str, patbuf.s);
+}
+
+/*
+ * c_hsetpat(): Set the history seatch pattern
+ */
+static void
+c_hsetpat(void)
+{
+    if (LastCmd != F_UP_SEARCH_HIST && LastCmd != F_DOWN_SEARCH_HIST) {
+       patbuf.len = 0;
+       Strbuf_appendn(&patbuf, InputBuf, Cursor - InputBuf);
+       Strbuf_terminate(&patbuf);
+    }
+#ifdef SDEBUG
+    xprintf("\nHist_num = %d\n", Hist_num);
+    xprintf("patlen = %d\n", (int)patbuf.len);
+    xprintf("patbuf = \"%S\"\n", patbuf.s);
+    xprintf("Cursor %d LastChar %d\n", Cursor - InputBuf, LastChar - InputBuf);
+#endif
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_up_search_hist(Char c)
+{
+    struct Hist *hp;
+    int h;
+    int    found = 0;
+
+    USE(c);
+    ActionFlag = TCSHOP_NOP;
+    UndoAction = TCSHOP_NOP;
+    *LastChar = '\0';          /* just in case */
+    if (Hist_num < 0) {
+#ifdef DEBUG_EDIT
+       xprintf("%s: e_up_search_hist(): Hist_num < 0; resetting.\n", progname);
+#endif
+       Hist_num = 0;
+       return(CC_ERROR);
+    }
+
+    if (Hist_num == 0) {
+       HistBuf.len = 0;
+       Strbuf_append(&HistBuf, InputBuf);
+       Strbuf_terminate(&HistBuf);
+    }
+
+
+    hp = Histlist.Hnext;
+    if (hp == NULL)
+       return(CC_ERROR);
+
+    c_hsetpat();               /* Set search pattern !! */
+
+    for (h = 1; h <= Hist_num; h++)
+       hp = hp->Hnext;
+
+    while (hp != NULL) {
+       Char *hl;
+       int matched;
+
+       if (hp->histline == NULL)
+           hp->histline = sprlex(&hp->Hlex);
+       if (HistLit)
+           hl = hp->histline;
+       else {
+           hl = sprlex(&hp->Hlex);
+           cleanup_push(hl, xfree);
+       }
+#ifdef SDEBUG
+       xprintf("Comparing with \"%S\"\n", hl);
+#endif
+       matched = (Strncmp(hl, InputBuf, (size_t) (LastChar - InputBuf)) ||
+                  hl[LastChar-InputBuf]) && c_hmatch(hl);
+       if (!HistLit)
+           cleanup_until(hl);
+       if (matched) {
+           found++;
+           break;
+       }
+       h++;
+       hp = hp->Hnext;
+    }
+
+    if (!found) {
+#ifdef SDEBUG
+       xprintf("not found\n");
+#endif
+       return(CC_ERROR);
+    }
+
+    Hist_num = h;
+
+    return(GetHistLine());
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_down_search_hist(Char c)
+{
+    struct Hist *hp;
+    int h;
+    int    found = 0;
+
+    USE(c);
+    ActionFlag = TCSHOP_NOP;
+    UndoAction = TCSHOP_NOP;
+    *LastChar = '\0';          /* just in case */
+
+    if (Hist_num == 0)
+       return(CC_ERROR);
+
+    hp = Histlist.Hnext;
+    if (hp == 0)
+       return(CC_ERROR);
+
+    c_hsetpat();               /* Set search pattern !! */
+
+    for (h = 1; h < Hist_num && hp; h++) {
+       Char *hl;
+       if (hp->histline == NULL)
+           hp->histline = sprlex(&hp->Hlex);
+       if (HistLit)
+           hl = hp->histline;
+       else {
+           hl = sprlex(&hp->Hlex);
+           cleanup_push(hl, xfree);
+       }
+#ifdef SDEBUG
+       xprintf("Comparing with \"%S\"\n", hl);
+#endif
+       if ((Strncmp(hl, InputBuf, (size_t) (LastChar - InputBuf)) || 
+            hl[LastChar-InputBuf]) && c_hmatch(hl))
+           found = h;
+       if (!HistLit)
+           cleanup_until(hl);
+       hp = hp->Hnext;
+    }
+
+    if (!found) {              /* is it the current history number? */
+       if (!c_hmatch(HistBuf.s)) {
+#ifdef SDEBUG
+           xprintf("not found\n");
+#endif
+           return(CC_ERROR);
+       }
+    }
+
+    Hist_num = found;
+
+    return(GetHistLine());
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_helpme(Char c)
+{
+    USE(c);
+    PastBottom();
+    *LastChar = '\0';          /* just in case */
+    return(CC_HELPME);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_correct(Char c)
+{
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+    return(CC_CORRECT);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_correctl(Char c)
+{
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+    return(CC_CORRECT_L);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_run_fg_editor(Char c)
+{
+    struct process *pp;
+
+    USE(c);
+    if ((pp = find_stop_ed()) != NULL) {
+       /* save our editor state so we can restore it */
+       c_save_inputbuf();
+       Hist_num = 0;           /* for the history commands */
+
+       /* put the tty in a sane mode */
+       PastBottom();
+       (void) Cookedmode();    /* make sure the tty is set up correctly */
+
+       /* do it! */
+       fg_proc_entry(pp);
+
+       (void) Rawmode();       /* go on */
+       Refresh();
+       RestoreSaved = 0;
+       HistSaved = 0;
+    }
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_list_choices(Char c)
+{
+    USE(c);
+    PastBottom();
+    *LastChar = '\0';          /* just in case */
+    return(CC_LIST_CHOICES);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_list_all(Char c)
+{
+    USE(c);
+    PastBottom();
+    *LastChar = '\0';          /* just in case */
+    return(CC_LIST_ALL);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_list_glob(Char c)
+{
+    USE(c);
+    PastBottom();
+    *LastChar = '\0';          /* just in case */
+    return(CC_LIST_GLOB);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_expand_glob(Char c)
+{
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+    return(CC_EXPAND_GLOB);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_normalize_path(Char c)
+{
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+    return(CC_NORMALIZE_PATH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_normalize_command(Char c)
+{
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+    return(CC_NORMALIZE_COMMAND);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_expand_vars(Char c)
+{
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+    return(CC_EXPAND_VARS);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_which(Char c)
+{                              /* do a fast command line which(1) */
+    USE(c);
+    c_save_inputbuf();
+    Hist_num = 0;              /* for the history commands */
+    PastBottom();
+    *LastChar = '\0';          /* just in case */
+    return(CC_WHICH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_last_item(Char c)
+{                              /* insert the last element of the prev. cmd */
+    struct Hist *hp;
+    struct wordent *wp, *firstp;
+    int i;
+    Char *expanded;
+
+    USE(c);
+    if (Argument <= 0)
+       return(CC_ERROR);
+
+    hp = Histlist.Hnext;
+    if (hp == NULL) {  /* this is only if no history */
+       return(CC_ERROR);
+    }
+
+    wp = (hp->Hlex).prev;
+
+    if (wp->prev == (struct wordent *) NULL)
+       return(CC_ERROR);       /* an empty history entry */
+
+    firstp = (hp->Hlex).next;
+
+    /* back up arg words in lex */
+    for (i = 0; i < Argument && wp != firstp; i++) {
+       wp = wp->prev;
+    }
+
+    expanded = expand_lex(wp->prev, 0, i - 1);
+    if (InsertStr(expanded)) {
+       xfree(expanded);
+       return(CC_ERROR);
+    }
+
+    xfree(expanded);
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_dabbrev_expand(Char c)
+{                              /* expand to preceding word matching prefix */
+    Char *cp, *ncp, *bp;
+    struct Hist *hp;
+    int arg = 0, i;
+    size_t len = 0;
+    int found = 0;
+    Char *hbuf;
+    static int oldevent, hist, word;
+    static Char *start, *oldcursor;
+
+    USE(c);
+    if (Argument <= 0)
+       return(CC_ERROR);
+
+    cp = c_preword(Cursor, InputBuf, 1, STRshwordsep);
+    if (cp == Cursor || Isspace(*cp))
+       return(CC_ERROR);
+
+    hbuf = NULL;
+    hp = Histlist.Hnext;
+    bp = InputBuf;
+    if (Argument == 1 && eventno == oldevent && cp == start &&
+       Cursor == oldcursor && patbuf.len > 0
+       && Strncmp(patbuf.s, cp, patbuf.len) == 0){
+       /* continue previous search - go to last match (hist/word) */
+       if (hist != 0) {                /* need to move up history */
+           for (i = 1; i < hist && hp != NULL; i++)
+               hp = hp->Hnext;
+           if (hp == NULL)     /* "can't happen" */
+               goto err_hbuf;
+           hbuf = expand_lex(&hp->Hlex, 0, INT_MAX);
+           cp = Strend(hbuf);
+           bp = hbuf;
+           hp = hp->Hnext;
+       }
+       cp = c_preword(cp, bp, word, STRshwordsep);
+    } else {                   /* starting new search */
+       oldevent = eventno;
+       start = cp;
+       patbuf.len = 0;
+       Strbuf_appendn(&patbuf, cp, Cursor - cp);
+       hist = 0;
+       word = 0;
+    }
+
+    while (!found) {
+       ncp = c_preword(cp, bp, 1, STRshwordsep);
+       if (ncp == cp || Isspace(*ncp)) { /* beginning of line */
+           hist++;
+           word = 0;
+           if (hp == NULL)
+               goto err_hbuf;
+           hbuf = expand_lex(&hp->Hlex, 0, INT_MAX);
+           cp = Strend(hbuf);
+           bp = hbuf;
+           hp = hp->Hnext;
+           continue;
+       } else {
+           word++;
+           len = c_endword(ncp-1, cp, 1, STRshwordsep) - ncp + 1;
+           cp = ncp;
+       }
+       if (len > patbuf.len && Strncmp(cp, patbuf.s, patbuf.len) == 0) {
+           /* We don't fully check distinct matches as Gnuemacs does: */
+           if (Argument > 1) { /* just count matches */
+               if (++arg >= Argument)
+                   found++;
+           } else {            /* match if distinct from previous */
+               if (len != (size_t)(Cursor - start)
+                   || Strncmp(cp, start, len) != 0)
+                   found++;
+           }
+       }
+    }
+
+    if (LastChar + len - (Cursor - start) >= InputLim)
+       goto err_hbuf;  /* no room */
+    DeleteBack(Cursor - start);
+    c_insert(len);
+    while (len--)
+       *Cursor++ = *cp++;
+    oldcursor = Cursor;
+    xfree(hbuf);
+    return(CC_REFRESH);
+
+ err_hbuf:
+    xfree(hbuf);
+    return CC_ERROR;
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_yank_kill(Char c)
+{                              /* almost like GnuEmacs */
+    int len;
+    Char *kp, *cp;
+
+    USE(c);
+    if (KillRingLen == 0)      /* nothing killed */
+       return(CC_ERROR);
+    len = Strlen(KillRing[YankPos].buf);
+    if (LastChar + len >= InputLim)
+       return(CC_ERROR);       /* end of buffer space */
+
+    /* else */
+    cp = Cursor;               /* for speed */
+
+    c_insert(len);             /* open the space, */
+    for (kp = KillRing[YankPos].buf; *kp; kp++)        /* copy the chars */
+       *cp++ = *kp;
+
+    if (Argument == 1) {       /* if no arg */
+       Mark = Cursor;          /* mark at beginning, cursor at end */
+       Cursor = cp;
+    } else {
+       Mark = cp;              /* else cursor at beginning, mark at end */
+    }
+
+    if (adrof(STRhighlight) && MarkIsSet) {
+       ClearLines();
+       ClearDisp();
+    }
+    MarkIsSet = 0;
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_yank_pop(Char c)
+{                              /* almost like GnuEmacs */
+    int m_bef_c, del_len, ins_len;
+    Char *kp, *cp;
+
+    USE(c);
+
+#if 0
+    /* XXX This "should" be here, but doesn't work, since LastCmd
+       gets set on CC_ERROR and CC_ARGHACK, which it shouldn't(?).
+       (But what about F_ARGFOUR?) I.e. if you hit M-y twice the
+       second one will "succeed" even if the first one wasn't preceded
+       by a yank, and giving an argument is impossible. Now we "succeed"
+       regardless of previous command, which is wrong too of course. */
+    if (LastCmd != F_YANK_KILL && LastCmd != F_YANK_POP)
+       return(CC_ERROR);
+#endif
+
+    if (KillRingLen == 0)      /* nothing killed */
+       return(CC_ERROR);
+    YankPos -= Argument;
+    while (YankPos < 0)
+       YankPos += KillRingLen;
+    YankPos %= KillRingLen;
+
+    if (Cursor > Mark) {
+       del_len = Cursor - Mark;
+       m_bef_c = 1;
+    } else {
+       del_len = Mark - Cursor;
+       m_bef_c = 0;
+    }
+    ins_len = Strlen(KillRing[YankPos].buf);
+    if (LastChar + ins_len - del_len >= InputLim)
+       return(CC_ERROR);       /* end of buffer space */
+
+    if (m_bef_c) {
+       c_delbefore(del_len);
+    } else {
+       c_delafter(del_len);
+    }
+    cp = Cursor;               /* for speed */
+
+    c_insert(ins_len);         /* open the space, */
+    for (kp = KillRing[YankPos].buf; *kp; kp++)        /* copy the chars */
+       *cp++ = *kp;
+
+    if (m_bef_c) {
+       Mark = Cursor;          /* mark at beginning, cursor at end */
+       Cursor = cp;
+    } else {
+       Mark = cp;              /* else cursor at beginning, mark at end */
+    }
+
+    if (adrof(STRhighlight) && MarkIsSet) {
+       ClearLines();
+       ClearDisp();
+    }
+    MarkIsSet = 0;
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_delprev(Char c)              /* Backspace key in insert mode */
+{
+    int rc;
+
+    USE(c);
+    rc = CC_ERROR;
+
+    if (InsertPos != 0) {
+       if (Argument <= Cursor - InsertPos) {
+           c_delbefore(Argument);      /* delete before */
+           rc = CC_REFRESH;
+       }
+    }
+    return(rc);
+}   /* v_delprev  */
+
+/*ARGSUSED*/
+CCRETVAL
+e_delprev(Char c)
+{
+    USE(c);
+    if (Cursor > InputBuf) {
+       c_delbefore(Argument);  /* delete before dot */
+       return(CC_REFRESH);
+    }
+    else {
+       return(CC_ERROR);
+    }
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_delwordprev(Char c)
+{
+    Char *cp;
+
+    USE(c);
+    if (Cursor == InputBuf)
+       return(CC_ERROR);
+    /* else */
+
+    cp = c_prev_word(Cursor, InputBuf, Argument);
+
+    c_push_kill(cp, Cursor);   /* save the text */
+
+    c_delbefore((int)(Cursor - cp));   /* delete before dot */
+    return(CC_REFRESH);
+}
+
+/* DCS <dcs@neutron.chem.yale.edu>, 9 Oct 93
+ *
+ * Changed the names of some of the ^D family of editor functions to
+ * correspond to what they actually do and created new e_delnext_list
+ * for completeness.
+ *   
+ *   Old names:                        New names:
+ *   
+ *   delete-char               delete-char-or-eof
+ *     F_DELNEXT                 F_DELNEXT_EOF
+ *     e_delnext                 e_delnext_eof
+ *     edelnxt                   edelnxteof
+ *   delete-char-or-eof                delete-char                     
+ *     F_DELNEXT_EOF             F_DELNEXT
+ *     e_delnext_eof             e_delnext
+ *     edelnxteof                edelnxt
+ *   delete-char-or-list       delete-char-or-list-or-eof
+ *     F_LIST_DELNEXT            F_DELNEXT_LIST_EOF
+ *     e_list_delnext            e_delnext_list_eof
+ *                               edellsteof
+ *   (no old equivalent)       delete-char-or-list
+ *                               F_DELNEXT_LIST
+ *                               e_delnext_list
+ *                               e_delnxtlst
+ */
+
+/* added by mtk@ari.ncl.omron.co.jp (920818) */
+/* rename e_delnext() -> e_delnext_eof() */
+/*ARGSUSED*/
+CCRETVAL
+e_delnext(Char c)
+{
+    USE(c);
+    if (Cursor == LastChar) {/* if I'm at the end */
+       if (!VImode) {
+               return(CC_ERROR);
+       }
+       else {
+           if (Cursor != InputBuf)
+               Cursor--;
+           else
+               return(CC_ERROR);
+       }
+    }
+    c_delafter(Argument);      /* delete after dot */
+    if (Cursor > LastChar)
+       Cursor = LastChar;      /* bounds check */
+    return(CC_REFRESH);
+}
+
+
+/*ARGSUSED*/
+CCRETVAL
+e_delnext_eof(Char c)
+{
+    USE(c);
+    if (Cursor == LastChar) {/* if I'm at the end */
+       if (!VImode) {
+           if (Cursor == InputBuf) {   
+               /* if I'm also at the beginning */
+               so_write(STReof, 4);/* then do a EOF */
+               flush();
+               return(CC_EOF);
+           }
+           else 
+               return(CC_ERROR);
+       }
+       else {
+           if (Cursor != InputBuf)
+               Cursor--;
+           else
+               return(CC_ERROR);
+       }
+    }
+    c_delafter(Argument);      /* delete after dot */
+    if (Cursor > LastChar)
+       Cursor = LastChar;      /* bounds check */
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_delnext_list(Char c)
+{
+    USE(c);
+    if (Cursor == LastChar) {  /* if I'm at the end */
+       PastBottom();
+       *LastChar = '\0';       /* just in case */
+       return(CC_LIST_CHOICES);
+    }
+    else {
+       c_delafter(Argument);   /* delete after dot */
+       if (Cursor > LastChar)
+           Cursor = LastChar;  /* bounds check */
+       return(CC_REFRESH);
+    }
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_delnext_list_eof(Char c)
+{
+    USE(c);
+    if (Cursor == LastChar) {  /* if I'm at the end */
+       if (Cursor == InputBuf) {       /* if I'm also at the beginning */
+           so_write(STReof, 4);/* then do a EOF */
+           flush();
+           return(CC_EOF);
+       }
+       else {
+           PastBottom();
+           *LastChar = '\0';   /* just in case */
+           return(CC_LIST_CHOICES);
+       }
+    }
+    else {
+       c_delafter(Argument);   /* delete after dot */
+       if (Cursor > LastChar)
+           Cursor = LastChar;  /* bounds check */
+       return(CC_REFRESH);
+    }
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_list_eof(Char c)
+{
+    CCRETVAL rv;
+
+    USE(c);
+    if (Cursor == LastChar && Cursor == InputBuf) {
+       so_write(STReof, 4);    /* then do a EOF */
+       flush();
+       rv = CC_EOF;
+    }
+    else {
+       PastBottom();
+       *LastChar = '\0';       /* just in case */
+       rv = CC_LIST_CHOICES;
+    }
+    return rv;
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_delwordnext(Char c)
+{
+    Char *cp;
+
+    USE(c);
+    if (Cursor == LastChar)
+       return(CC_ERROR);
+    /* else */
+
+    cp = c_next_word(Cursor, LastChar, Argument);
+
+    c_push_kill(Cursor, cp);   /* save the text */
+
+    c_delafter((int)(cp - Cursor));    /* delete after dot */
+    if (Cursor > LastChar)
+       Cursor = LastChar;      /* bounds check */
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_toend(Char c)
+{
+    USE(c);
+    Cursor = LastChar;
+    if (VImode)
+       if (ActionFlag & TCSHOP_DELETE) {
+           c_delfini();
+           return(CC_REFRESH);
+       }
+    RefCursor();               /* move the cursor */
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_tobeg(Char c)
+{
+    USE(c);
+    Cursor = InputBuf;
+
+    if (VImode) {
+       while (Isspace(*Cursor)) /* We want FIRST non space character */
+       Cursor++;
+       if (ActionFlag & TCSHOP_DELETE) {
+           c_delfini();
+           return(CC_REFRESH);
+       }
+    }
+
+    RefCursor();               /* move the cursor */
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_killend(Char c)
+{
+    USE(c);
+    c_push_kill(Cursor, LastChar); /* copy it */
+    LastChar = Cursor;         /* zap! -- delete to end */
+    if (Mark > Cursor)
+        Mark = Cursor;
+    MarkIsSet = 0;
+    return(CC_REFRESH);
+}
+
+
+/*ARGSUSED*/
+CCRETVAL
+e_killbeg(Char c)
+{
+    USE(c);
+    c_push_kill(InputBuf, Cursor); /* copy it */
+    c_delbefore((int)(Cursor - InputBuf));
+    if (Mark && Mark > Cursor)
+        Mark -= Cursor-InputBuf;
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_killall(Char c)
+{
+    USE(c);
+    c_push_kill(InputBuf, LastChar); /* copy it */
+    Cursor = Mark = LastChar = InputBuf;       /* zap! -- delete all of it */
+    MarkIsSet = 0;
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_killregion(Char c)
+{
+    USE(c);
+    if (!Mark)
+       return(CC_ERROR);
+
+    if (Mark > Cursor) {
+       c_push_kill(Cursor, Mark); /* copy it */
+       c_delafter((int)(Mark - Cursor)); /* delete it - UNUSED BY VI mode */
+       Mark = Cursor;
+    }
+    else {                     /* mark is before cursor */
+       c_push_kill(Mark, Cursor); /* copy it */
+       c_delbefore((int)(Cursor - Mark));
+    }
+    if (adrof(STRhighlight) && MarkIsSet) {
+       ClearLines();
+       ClearDisp();
+    }
+    MarkIsSet = 0;
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_copyregion(Char c)
+{
+    USE(c);
+    if (!Mark)
+       return(CC_ERROR);
+
+    if (Mark > Cursor) {
+       c_push_kill(Cursor, Mark); /* copy it */
+    }
+    else {                     /* mark is before cursor */
+       c_push_kill(Mark, Cursor); /* copy it */
+    }
+    return(CC_NORM);           /* don't even need to Refresh() */
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_charswitch(Char cc)
+{
+    Char c;
+
+    USE(cc);
+
+    /* do nothing if we are at beginning of line or have only one char */
+    if (Cursor == &InputBuf[0] || LastChar == &InputBuf[1]) {
+       return(CC_ERROR);
+    }
+
+    if (Cursor < LastChar) {
+       Cursor++;
+    }
+    c = Cursor[-2];
+    Cursor[-2] = Cursor[-1];
+    Cursor[-1] = c;
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_gcharswitch(Char cc)
+{                              /* gosmacs style ^T */
+    Char c;
+
+    USE(cc);
+    if (Cursor > &InputBuf[1]) {/* must have at least two chars entered */
+       c = Cursor[-2];
+       Cursor[-2] = Cursor[-1];
+       Cursor[-1] = c;
+       return(CC_REFRESH);
+    }
+    else {
+       return(CC_ERROR);
+    }
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_charback(Char c)
+{
+    USE(c);
+    if (Cursor > InputBuf) {
+       if (Argument > Cursor - InputBuf)
+           Cursor = InputBuf;
+       else
+           Cursor -= Argument;
+
+       if (VImode)
+           if (ActionFlag & TCSHOP_DELETE) {
+               c_delfini();
+               return(CC_REFRESH);
+           }
+
+       RefCursor();
+       return(CC_NORM);
+    }
+    else {
+       return(CC_ERROR);
+    }
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_wordback(Char c)
+{
+    USE(c);
+    if (Cursor == InputBuf)
+       return(CC_ERROR);
+    /* else */
+
+    Cursor = c_preword(Cursor, InputBuf, Argument, STRshwspace); /* bounds check */
+
+    if (ActionFlag & TCSHOP_DELETE) {
+       c_delfini();
+       return(CC_REFRESH);
+    }
+
+    RefCursor();
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_wordback(Char c)
+{
+    USE(c);
+    if (Cursor == InputBuf)
+       return(CC_ERROR);
+    /* else */
+
+    Cursor = c_prev_word(Cursor, InputBuf, Argument); /* bounds check */
+
+    if (VImode) 
+       if (ActionFlag & TCSHOP_DELETE) {
+           c_delfini();
+           return(CC_REFRESH);
+       }
+
+    RefCursor();
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_charfwd(Char c)
+{
+    USE(c);
+    if (Cursor < LastChar) {
+       Cursor += Argument;
+       if (Cursor > LastChar)
+           Cursor = LastChar;
+
+       if (VImode)
+           if (ActionFlag & TCSHOP_DELETE) {
+               c_delfini();
+               return(CC_REFRESH);
+           }
+
+       RefCursor();
+       return(CC_NORM);
+    }
+    else {
+       return(CC_ERROR);
+    }
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_wordfwd(Char c)
+{
+    USE(c);
+    if (Cursor == LastChar)
+       return(CC_ERROR);
+    /* else */
+
+    Cursor = c_next_word(Cursor, LastChar, Argument);
+
+    if (VImode)
+       if (ActionFlag & TCSHOP_DELETE) {
+           c_delfini();
+           return(CC_REFRESH);
+       }
+
+    RefCursor();
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_wordfwd(Char c)
+{
+    USE(c);
+    if (Cursor == LastChar)
+       return(CC_ERROR);
+    /* else */
+
+    Cursor = c_nexword(Cursor, LastChar, Argument);
+
+    if (VImode)
+       if (ActionFlag & TCSHOP_DELETE) {
+           c_delfini();
+           return(CC_REFRESH);
+       }
+
+    RefCursor();
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_wordbegnext(Char c)
+{
+    USE(c);
+    if (Cursor == LastChar)
+       return(CC_ERROR);
+    /* else */
+
+    Cursor = c_next_word(Cursor, LastChar, Argument);
+    if (Cursor < LastChar)
+       Cursor++;
+
+    if (VImode)
+       if (ActionFlag & TCSHOP_DELETE) {
+           c_delfini();
+           return(CC_REFRESH);
+       }
+
+    RefCursor();
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+static CCRETVAL
+v_repeat_srch(int c)
+{
+    CCRETVAL rv = CC_ERROR;
+#ifdef SDEBUG
+    xprintf("dir %d patlen %d patbuf %S\n",
+           c, (int)patbuf.len, patbuf.s);
+#endif
+
+    LastCmd = (KEYCMD) c;  /* Hack to stop c_hsetpat */
+    LastChar = InputBuf;
+    switch (c) {
+    case F_DOWN_SEARCH_HIST:
+       rv = e_down_search_hist(0);
+       break;
+    case F_UP_SEARCH_HIST:
+       rv = e_up_search_hist(0);
+       break;
+    default:
+       break;
+    }
+    return rv;
+}
+
+static CCRETVAL
+v_csearch_back(Char ch, int count, int tflag)
+{
+    Char *cp;
+
+    cp = Cursor;
+    while (count--) {
+       if (*cp == ch) 
+           cp--;
+       while (cp > InputBuf && *cp != ch) 
+           cp--;
+    }
+
+    if (cp < InputBuf || (cp == InputBuf && *cp != ch))
+       return(CC_ERROR);
+
+    if (*cp == ch && tflag)
+       cp++;
+
+    Cursor = cp;
+
+    if (ActionFlag & TCSHOP_DELETE) {
+       Cursor++;
+       c_delfini();
+       return(CC_REFRESH);
+    }
+
+    RefCursor();
+    return(CC_NORM);
+}
+
+static CCRETVAL
+v_csearch_fwd(Char ch, int count, int tflag)
+{
+    Char *cp;
+
+    cp = Cursor;
+    while (count--) {
+       if(*cp == ch) 
+           cp++;
+       while (cp < LastChar && *cp != ch) 
+           cp++;
+    }
+
+    if (cp >= LastChar)
+       return(CC_ERROR);
+
+    if (*cp == ch && tflag)
+       cp--;
+
+    Cursor = cp;
+
+    if (ActionFlag & TCSHOP_DELETE) {
+       Cursor++;
+       c_delfini();
+       return(CC_REFRESH);
+    }
+    RefCursor();
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+static CCRETVAL
+v_action(int c)
+{
+    Char *cp, *kp;
+
+    if (ActionFlag == TCSHOP_DELETE) {
+       ActionFlag = TCSHOP_NOP;
+       ActionPos = 0;
+       
+       UndoSize = 0;
+       kp = UndoBuf;
+       for (cp = InputBuf; cp < LastChar; cp++) {
+           *kp++ = *cp;
+           UndoSize++;
+       }
+               
+       UndoAction = TCSHOP_INSERT;
+       UndoPtr  = InputBuf;
+       LastChar = InputBuf;
+       Cursor   = InputBuf;
+       if (c & TCSHOP_INSERT)
+           c_alternativ_key_map(0);
+           
+       return(CC_REFRESH);
+    }
+#ifdef notdef
+    else if (ActionFlag == TCSHOP_NOP) {
+#endif
+       ActionPos = Cursor;
+       ActionFlag = c;
+       return(CC_ARGHACK);  /* Do NOT clear out argument */
+#ifdef notdef
+    }
+    else {
+       ActionFlag = 0;
+       ActionPos = 0;
+       return(CC_ERROR);
+    }
+#endif
+}
+
+#ifdef COMMENT
+/* by: Brian Allison <uiucdcs!convex!allison@RUTGERS.EDU> */
+static void
+c_get_word(Char **begin, Char **end)
+{
+    Char   *cp;
+
+    cp = &Cursor[0];
+    while (Argument--) {
+       while ((cp <= LastChar) && (isword(*cp)))
+           cp++;
+       *end = --cp;
+       while ((cp >= InputBuf) && (isword(*cp)))
+           cp--;
+       *begin = ++cp;
+    }
+}
+#endif /* COMMENT */
+
+/*ARGSUSED*/
+CCRETVAL
+e_uppercase(Char c)
+{
+    Char   *cp, *end;
+
+    USE(c);
+    end = c_next_word(Cursor, LastChar, Argument);
+
+    for (cp = Cursor; cp < end; cp++)  /* PWP: was cp=begin */
+       if (Islower(*cp))
+           *cp = Toupper(*cp);
+
+    Cursor = end;
+    if (Cursor > LastChar)
+       Cursor = LastChar;
+    return(CC_REFRESH);
+}
+
+
+/*ARGSUSED*/
+CCRETVAL
+e_capitolcase(Char c)
+{
+    Char   *cp, *end;
+
+    USE(c);
+    end = c_next_word(Cursor, LastChar, Argument);
+
+    cp = Cursor;
+    for (; cp < end; cp++) {
+       if (Isalpha(*cp)) {
+           if (Islower(*cp))
+               *cp = Toupper(*cp);
+           cp++;
+           break;
+       }
+    }
+    for (; cp < end; cp++)
+       if (Isupper(*cp))
+           *cp = Tolower(*cp);
+
+    Cursor = end;
+    if (Cursor > LastChar)
+       Cursor = LastChar;
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_lowercase(Char c)
+{
+    Char   *cp, *end;
+
+    USE(c);
+    end = c_next_word(Cursor, LastChar, Argument);
+
+    for (cp = Cursor; cp < end; cp++)
+       if (Isupper(*cp))
+           *cp = Tolower(*cp);
+
+    Cursor = end;
+    if (Cursor > LastChar)
+       Cursor = LastChar;
+    return(CC_REFRESH);
+}
+
+
+/*ARGSUSED*/
+CCRETVAL
+e_set_mark(Char c)
+{
+    USE(c);
+    if (adrof(STRhighlight) && MarkIsSet && Mark != Cursor) {
+       ClearLines();
+       ClearDisp();
+       Refresh();
+    }
+    Mark = Cursor;
+    MarkIsSet = 1;
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_exchange_mark(Char c)
+{
+    Char *cp;
+
+    USE(c);
+    cp = Cursor;
+    Cursor = Mark;
+    Mark = cp;
+    RefCursor();
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_argfour(Char c)
+{                              /* multiply current argument by 4 */
+    USE(c);
+    if (Argument > 1000000)
+       return CC_ERROR;
+    DoingArg = 1;
+    Argument *= 4;
+    return(CC_ARGHACK);
+}
+
+static void
+quote_mode_cleanup(void *unused)
+{
+    USE(unused);
+    QuoteModeOff();
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_quote(Char c)
+{
+    Char    ch;
+    int     num;
+
+    USE(c);
+    QuoteModeOn();
+    cleanup_push(&c, quote_mode_cleanup); /* Using &c just as a mark */
+    num = GetNextChar(&ch);
+    cleanup_until(&c);
+    if (num == 1)
+       return e_insert(ch);
+    else
+       return e_send_eof(0);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_metanext(Char c)
+{
+    USE(c);
+    MetaNext = 1;
+    return(CC_ARGHACK);        /* preserve argument */
+}
+
+#ifdef notdef
+/*ARGSUSED*/
+CCRETVAL
+e_extendnext(Char c)
+{
+    CurrentKeyMap = CcAltMap;
+    return(CC_ARGHACK);        /* preserve argument */
+}
+
+#endif
+
+/*ARGSUSED*/
+CCRETVAL
+v_insbeg(Char c)
+{                              /* move to beginning of line and start vi
+                                * insert mode */
+    USE(c);
+    Cursor = InputBuf;
+    InsertPos = Cursor;
+
+    UndoPtr  = Cursor;
+    UndoAction = TCSHOP_DELETE;
+
+    RefCursor();               /* move the cursor */
+    c_alternativ_key_map(0);
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_replone(Char c)
+{                              /* vi mode overwrite one character */
+    USE(c);
+    c_alternativ_key_map(0);
+    inputmode = MODE_REPLACE_1;
+    UndoAction = TCSHOP_CHANGE;        /* Set Up for VI undo command */
+    UndoPtr = Cursor;
+    UndoSize = 0;
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_replmode(Char c)
+{                              /* vi mode start overwriting */
+    USE(c);
+    c_alternativ_key_map(0);
+    inputmode = MODE_REPLACE;
+    UndoAction = TCSHOP_CHANGE;        /* Set Up for VI undo command */
+    UndoPtr = Cursor;
+    UndoSize = 0;
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_substchar(Char c)
+{                              /* vi mode substitute for one char */
+    USE(c);
+    c_delafter(Argument);
+    c_alternativ_key_map(0);
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_substline(Char c)
+{                              /* vi mode replace whole line */
+    USE(c);
+    (void) e_killall(0);
+    c_alternativ_key_map(0);
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_chgtoend(Char c)
+{                              /* vi mode change to end of line */
+    USE(c);
+    (void) e_killend(0);
+    c_alternativ_key_map(0);
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_insert(Char c)
+{                              /* vi mode start inserting */
+    USE(c);
+    c_alternativ_key_map(0);
+
+    InsertPos = Cursor;
+    UndoPtr = Cursor;
+    UndoAction = TCSHOP_DELETE;
+
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_add(Char c)
+{                              /* vi mode start adding */
+    USE(c);
+    c_alternativ_key_map(0);
+    if (Cursor < LastChar)
+    {
+       Cursor++;
+       if (Cursor > LastChar)
+           Cursor = LastChar;
+       RefCursor();
+    }
+
+    InsertPos = Cursor;
+    UndoPtr = Cursor;
+    UndoAction = TCSHOP_DELETE;
+
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_addend(Char c)
+{                              /* vi mode to add at end of line */
+    USE(c);
+    c_alternativ_key_map(0);
+    Cursor = LastChar;
+
+    InsertPos = LastChar;      /* Mark where insertion begins */
+    UndoPtr = LastChar;
+    UndoAction = TCSHOP_DELETE;
+
+    RefCursor();
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_change_case(Char cc)
+{
+    Char    c;
+
+    USE(cc);
+    if (Cursor < LastChar) {
+#ifndef WINNT_NATIVE
+       c = *Cursor;
+#else
+       c = CHAR & *Cursor;
+#endif /* WINNT_NATIVE */
+       if (Isupper(c))
+           *Cursor++ = Tolower(c);
+       else if (Islower(c))
+           *Cursor++ = Toupper(c);
+       else
+           Cursor++;
+       RefPlusOne(1);          /* fast refresh for one char */
+       return(CC_NORM);
+    }
+    return(CC_ERROR);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_expand(Char c)
+{
+    Char *p;
+
+    USE(c);
+    for (p = InputBuf; Isspace(*p); p++)
+       continue;
+    if (p == LastChar)
+       return(CC_ERROR);
+
+    justpr++;
+    Expand++;
+    return(e_newline(0));
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_startover(Char c)
+{                              /* erase all of current line, start again */
+    USE(c);
+    ResetInLine(0);            /* reset the input pointers */
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_redisp(Char c)
+{
+    USE(c);
+    ClearLines();
+    ClearDisp();
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_cleardisp(Char c)
+{
+    USE(c);
+    ClearScreen();             /* clear the whole real screen */
+    ClearDisp();               /* reset everything */
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_tty_int(Char c)
+{                      
+    USE(c);
+#if defined(_MINIX) || defined(WINNT_NATIVE)
+    /* SAK PATCH: erase all of current line, start again */
+    ResetInLine(0);            /* reset the input pointers */
+    xputchar('\n');
+    ClearDisp();
+    return (CC_REFRESH);
+#else /* !_MINIX && !WINNT_NATIVE */
+    /* do no editing */
+    return (CC_NORM);
+#endif /* _MINIX || WINNT_NATIVE */
+}
+
+/*
+ * From: ghazi@cesl.rutgers.edu (Kaveh R. Ghazi)
+ * Function to send a character back to the input stream in cooked
+ * mode. Only works if we have TIOCSTI
+ */
+/*ARGSUSED*/
+CCRETVAL
+e_stuff_char(Char c)
+{
+#ifdef TIOCSTI
+     int was_raw = Tty_raw_mode;
+     char buf[MB_LEN_MAX];
+     size_t i, len;
+
+     if (was_raw)
+         (void) Cookedmode();
+
+     (void) xwrite(SHIN, "\n", 1);
+     len = one_wctomb(buf, c & CHAR);
+     for (i = 0; i < len; i++)
+        (void) ioctl(SHIN, TIOCSTI, (ioctl_t) &buf[i]);
+
+     if (was_raw)
+        (void) Rawmode();
+     return(e_redisp(c));
+#else /* !TIOCSTI */  
+     return(CC_ERROR);
+#endif /* !TIOCSTI */  
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_insovr(Char c)
+{
+    USE(c);
+    inputmode = (inputmode == MODE_INSERT ? MODE_REPLACE : MODE_INSERT);
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_tty_dsusp(Char c)
+{
+    USE(c);
+    /* do no editing */
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_tty_flusho(Char c)
+{
+    USE(c);
+    /* do no editing */
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_tty_quit(Char c)
+{
+    USE(c);
+    /* do no editing */
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_tty_tsusp(Char c)
+{
+    USE(c);
+    /* do no editing */
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_tty_stopo(Char c)
+{
+    USE(c);
+    /* do no editing */
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_expand_history(Char c)
+{
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+    c_substitute();
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_magic_space(Char c)
+{
+    USE(c);
+    *LastChar = '\0';          /* just in case */
+    c_substitute();
+    return(e_insert(' '));
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_inc_fwd(Char c)
+{
+    CCRETVAL ret;
+
+    USE(c);
+    patbuf.len = 0;
+    MarkIsSet = 0;
+    ret = e_inc_search(F_DOWN_SEARCH_HIST);
+    if (adrof(STRhighlight) && IncMatchLen) {
+       IncMatchLen = 0;
+       ClearLines();
+       ClearDisp();
+       Refresh();
+    }
+    IncMatchLen = 0;
+    return ret;
+}
+
+
+/*ARGSUSED*/
+CCRETVAL
+e_inc_back(Char c)
+{
+    CCRETVAL ret;
+
+    USE(c);
+    patbuf.len = 0;
+    MarkIsSet = 0;
+    ret = e_inc_search(F_UP_SEARCH_HIST);
+    if (adrof(STRhighlight) && IncMatchLen) {
+       IncMatchLen = 0;
+       ClearLines();
+       ClearDisp();
+       Refresh();
+    }
+    IncMatchLen = 0;
+    return ret;
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_copyprev(Char c)
+{
+    Char *cp, *oldc, *dp;
+
+    USE(c);
+    if (Cursor == InputBuf)
+       return(CC_ERROR);
+    /* else */
+
+    oldc = Cursor;
+    /* does a bounds check */
+    cp = c_prev_word(Cursor, InputBuf, Argument);      
+
+    c_insert((int)(oldc - cp));
+    for (dp = oldc; cp < oldc && dp < LastChar; cp++)
+       *dp++ = *cp;
+
+    Cursor = dp;               /* put cursor at end */
+
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_tty_starto(Char c)
+{
+    USE(c);
+    /* do no editing */
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+e_load_average(Char c)
+{
+    USE(c);
+    PastBottom();
+#ifdef TIOCSTAT
+    /*
+     * Here we pass &c to the ioctl because some os's (NetBSD) expect it
+     * there even if they don't use it. (lukem@netbsd.org)
+     */
+    if (ioctl(SHIN, TIOCSTAT, (ioctl_t) &c) < 0) 
+#endif
+       xprintf(CGETS(5, 1, "Load average unavailable\n"));
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_chgmeta(Char c)
+{
+    USE(c);
+    /*
+     * Delete with insert == change: first we delete and then we leave in
+     * insert mode.
+     */
+    return(v_action(TCSHOP_DELETE|TCSHOP_INSERT));
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_delmeta(Char c)
+{
+    USE(c);
+    return(v_action(TCSHOP_DELETE));
+}
+
+
+/*ARGSUSED*/
+CCRETVAL
+v_endword(Char c)
+{
+    USE(c);
+    if (Cursor == LastChar)
+       return(CC_ERROR);
+    /* else */
+
+    Cursor = c_endword(Cursor, LastChar, Argument, STRshwspace);
+
+    if (ActionFlag & TCSHOP_DELETE)
+    {
+       Cursor++;
+       c_delfini();
+       return(CC_REFRESH);
+    }
+
+    RefCursor();
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_eword(Char c)
+{
+    USE(c);
+    if (Cursor == LastChar)
+       return(CC_ERROR);
+    /* else */
+
+    Cursor = c_eword(Cursor, LastChar, Argument);
+
+    if (ActionFlag & TCSHOP_DELETE) {
+       Cursor++;
+       c_delfini();
+       return(CC_REFRESH);
+    }
+
+    RefCursor();
+    return(CC_NORM);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_char_fwd(Char c)
+{
+    Char ch;
+
+    USE(c);
+    if (GetNextChar(&ch) != 1)
+       return e_send_eof(0);
+
+    srch_dir = CHAR_FWD;
+    srch_char = ch;
+
+    return v_csearch_fwd(ch, Argument, 0);
+
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_char_back(Char c)
+{
+    Char ch;
+
+    USE(c);
+    if (GetNextChar(&ch) != 1)
+       return e_send_eof(0);
+
+    srch_dir = CHAR_BACK;
+    srch_char = ch;
+
+    return v_csearch_back(ch, Argument, 0);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_charto_fwd(Char c)
+{
+    Char ch;
+
+    USE(c);
+    if (GetNextChar(&ch) != 1)
+       return e_send_eof(0);
+
+    return v_csearch_fwd(ch, Argument, 1);
+
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_charto_back(Char c)
+{
+    Char ch;
+
+    USE(c);
+    if (GetNextChar(&ch) != 1)
+       return e_send_eof(0);
+
+    return v_csearch_back(ch, Argument, 1);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_rchar_fwd(Char c)
+{
+    USE(c);
+    if (srch_char == 0)
+       return CC_ERROR;
+
+    return srch_dir == CHAR_FWD ? v_csearch_fwd(srch_char, Argument, 0) : 
+                                 v_csearch_back(srch_char, Argument, 0);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_rchar_back(Char c)
+{
+    USE(c);
+    if (srch_char == 0)
+       return CC_ERROR;
+
+    return srch_dir == CHAR_BACK ? v_csearch_fwd(srch_char, Argument, 0) : 
+                                  v_csearch_back(srch_char, Argument, 0);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_undo(Char c)
+{
+    int  loop;
+    Char *kp, *cp;
+    Char temp;
+    int         size;
+
+    USE(c);
+    switch (UndoAction) {
+    case TCSHOP_DELETE|TCSHOP_INSERT:
+    case TCSHOP_DELETE:
+       if (UndoSize == 0) return(CC_NORM);
+       cp = UndoPtr;
+       kp = UndoBuf;
+       for (loop=0; loop < UndoSize; loop++)   /* copy the chars */
+           *kp++ = *cp++;                      /* into UndoBuf   */
+
+       for (cp = UndoPtr; cp <= LastChar; cp++)
+           *cp = cp[UndoSize];
+
+       LastChar -= UndoSize;
+       Cursor   =  UndoPtr;
+       
+       UndoAction = TCSHOP_INSERT;
+       break;
+
+    case TCSHOP_INSERT:
+       if (UndoSize == 0) return(CC_NORM);
+       cp = UndoPtr;
+       Cursor = UndoPtr;
+       kp = UndoBuf;
+       c_insert(UndoSize);             /* open the space, */
+       for (loop = 0; loop < UndoSize; loop++) /* copy the chars */
+           *cp++ = *kp++;
+
+       UndoAction = TCSHOP_DELETE;
+       break;
+
+    case TCSHOP_CHANGE:
+       if (UndoSize == 0) return(CC_NORM);
+       cp = UndoPtr;
+       Cursor = UndoPtr;
+       kp = UndoBuf;
+       size = (int)(Cursor-LastChar); /*  NOT NSL independant */
+       if (size < UndoSize)
+           size = UndoSize;
+       for(loop = 0; loop < size; loop++) {
+           temp = *kp;
+           *kp++ = *cp;
+           *cp++ = temp;
+       }
+       break;
+
+    default:
+       return(CC_ERROR);
+    }
+
+    return(CC_REFRESH);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_ush_meta(Char c)
+{
+    USE(c);
+    return v_search(F_UP_SEARCH_HIST);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_dsh_meta(Char c)
+{
+    USE(c);
+    return v_search(F_DOWN_SEARCH_HIST);
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_rsrch_fwd(Char c)
+{
+    USE(c);
+    if (patbuf.len == 0) return(CC_ERROR);
+    return(v_repeat_srch(searchdir));
+}
+
+/*ARGSUSED*/
+CCRETVAL
+v_rsrch_back(Char c)
+{
+    USE(c);
+    if (patbuf.len == 0) return(CC_ERROR);
+    return(v_repeat_srch(searchdir == F_UP_SEARCH_HIST ? 
+                        F_DOWN_SEARCH_HIST : F_UP_SEARCH_HIST));
+}
+
+#ifndef WINNT_NATIVE
+/* Since ed.defns.h  is generated from ed.defns.c, these empty 
+   functions will keep the F_NUM_FNS consistent
+ */
+CCRETVAL
+e_copy_to_clipboard(Char c)
+{
+    USE(c);
+    return CC_ERROR;
+}
+
+CCRETVAL
+e_paste_from_clipboard(Char c)
+{
+    USE(c);
+    return (CC_ERROR);
+}
+
+CCRETVAL
+e_dosify_next(Char c)
+{
+    USE(c);
+    return (CC_ERROR);
+}
+CCRETVAL
+e_dosify_prev(Char c)
+{
+    USE(c);
+    return (CC_ERROR);
+}
+CCRETVAL
+e_page_up(Char c)
+{
+    USE(c);
+    return (CC_ERROR);
+}
+CCRETVAL
+e_page_down(Char c)
+{
+    USE(c);
+    return (CC_ERROR);
+}
+#endif /* !WINNT_NATIVE */
+
+#ifdef notdef
+void
+MoveCursor(int n)              /* move cursor + right - left char */
+{
+    Cursor = Cursor + n;
+    if (Cursor < InputBuf)
+       Cursor = InputBuf;
+    if (Cursor > LastChar)
+       Cursor = LastChar;
+    return;
+}
+
+Char *
+GetCursor(void)
+{
+    return(Cursor);
+}
+
+int
+PutCursor(Char *p)
+{
+    if (p < InputBuf || p > LastChar)
+       return 1;               /* Error */
+    Cursor = p;
+    return 0;
+}
+#endif
diff --git a/contrib/tcsh-6/ed.decls.h b/contrib/tcsh-6/ed.decls.h
new file mode 100644 (file)
index 0000000..a9628ce
--- /dev/null
@@ -0,0 +1,280 @@
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.decls.h,v 3.44 2006/08/23 15:03:13 christos Exp $ */
+/*
+ * ed.decls.h: Editor external definitions
+ */
+/*-
+ * Copyright (c) 1980, 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _h_ed_decls
+#define _h_ed_decls
+
+/*
+ * ed.chared.c
+ */
+extern int     InsertStr               (Char *);
+extern void    DeleteBack              (int);
+extern void    SetKillRing             (int);
+extern CCRETVAL GetHistLine            (void);
+
+/*
+ * ed.init.c
+ */
+#ifdef SIG_WINDOW
+extern void    check_window_size       (int);
+extern void    window_change           (int);
+#endif /* SIG_WINDOW */
+extern int     ed_Setup                (int);
+extern void    ed_Init                 (void);
+extern int     Cookedmode              (void);
+extern int     Rawmode                 (void);
+extern void    ed_set_tty_eight_bit    (void);
+
+extern void    QuoteModeOn             (void);
+extern void    QuoteModeOff            (void);
+extern void    ResetInLine             (int);
+extern int     Load_input_line         (void);
+
+/*
+ * ed.term.c:
+ */
+extern void    dosetty                 (Char **, struct command *);
+extern int     tty_getty               (int, ttydata_t *);
+extern int     tty_setty               (int, ttydata_t *);
+extern void    tty_getchar             (ttydata_t *, unsigned char *);
+extern void    tty_setchar             (ttydata_t *, unsigned char *);
+extern speed_t tty_getspeed            (ttydata_t *);
+extern int     tty_gettabs             (ttydata_t *);
+extern int     tty_geteightbit         (ttydata_t *);
+extern int     tty_cooked_mode         (ttydata_t *);
+#ifdef _IBMR2
+extern void    tty_setdisc             (int, int);
+#endif /* _IBMR2 */
+
+/*
+ * ed.screen.c
+ */
+extern void    terminit                (void);
+extern void    SetAttributes           (Char);
+extern void    so_write                (Char *, int);
+extern void    ClearScreen             (void);
+extern void    MoveToLine              (int);
+extern void    MoveToChar              (int);
+extern void    ClearEOL                (int);
+extern void    Insert_write            (Char *, int);
+extern void    DeleteChars             (int);
+extern void    TellTC                  (void);
+extern void    SetTC                   (char *, char *);
+extern void    EchoTC                  (Char **);
+extern int     SetArrowKeys            (const CStr *, XmapVal *, int);
+extern int     IsArrowKey              (Char *);
+extern void    ResetArrowKeys          (void);
+extern void    DefaultArrowKeys        (void);
+extern int     ClearArrowKeys          (const CStr *);
+extern void    PrintArrowKeys          (const CStr *);
+extern void    BindArrowKeys           (void);
+extern void    SoundBeep               (void);
+extern int     CanWeTab                (void);
+extern void    ChangeSize              (int, int);
+#ifdef SIG_WINDOW
+extern int     GetSize                 (int *, int *);
+#endif /* SIG_WINDOW */
+extern void    ClearToBottom           (void);
+extern void    GetTermCaps             (void);
+extern void    StartHighlight          (void);
+extern void    StopHighlight           (void);
+
+/*
+ * ed.defns.c
+ */
+extern void    editinit                (void);
+extern void    ed_InitNLSMaps          (void);
+#ifdef DEBUG_EDIT
+extern void    CheckMaps               (void);
+#endif
+extern void    ed_InitMaps             (void);
+extern void    ed_InitEmacsMaps        (void);
+extern void    ed_InitVIMaps           (void);
+
+extern  CCRETVAL       e_unassigned            (Char);
+extern CCRETVAL        e_insert                (Char);
+extern CCRETVAL        e_newline               (Char);
+extern CCRETVAL        e_delprev               (Char);
+extern CCRETVAL        e_delnext               (Char);
+/* added by mtk@ari.ncl.omron.co.jp (920818) */
+extern CCRETVAL        e_delnext_eof           (Char);
+extern CCRETVAL        e_delnext_list          (Char);
+extern CCRETVAL        e_delnext_list_eof      (Char); /* for ^D */
+extern CCRETVAL        e_toend                 (Char);
+extern CCRETVAL        e_tobeg                 (Char);
+extern CCRETVAL        e_charback              (Char);
+extern CCRETVAL        e_charfwd               (Char);
+extern CCRETVAL        e_quote                 (Char);
+extern CCRETVAL        e_startover             (Char);
+extern CCRETVAL        e_redisp                (Char);
+extern CCRETVAL        e_wordback              (Char);
+extern CCRETVAL        e_wordfwd               (Char);
+extern CCRETVAL        v_wordbegnext           (Char);
+extern CCRETVAL        e_uppercase             (Char);
+extern CCRETVAL        e_lowercase             (Char);
+extern CCRETVAL        e_capitolcase           (Char);
+extern CCRETVAL        e_cleardisp             (Char);
+extern CCRETVAL        e_complete              (Char);
+extern CCRETVAL        e_correct               (Char);
+extern CCRETVAL        e_correctl              (Char);
+extern CCRETVAL        e_up_hist               (Char);
+extern CCRETVAL        e_down_hist             (Char);
+extern CCRETVAL        e_up_search_hist        (Char);
+extern CCRETVAL        e_down_search_hist      (Char);
+extern CCRETVAL        e_helpme                (Char);
+extern CCRETVAL        e_list_choices          (Char);
+extern CCRETVAL        e_delwordprev           (Char);
+extern CCRETVAL        e_delwordnext           (Char);
+extern CCRETVAL        e_digit                 (Char);
+extern CCRETVAL        e_argdigit              (Char);
+extern CCRETVAL        v_zero                  (Char);
+extern CCRETVAL        e_killend               (Char);
+extern CCRETVAL        e_killbeg               (Char);
+extern CCRETVAL        e_metanext              (Char);
+#ifdef notdef
+extern CCRETVAL        e_extendnext            (Char);
+#endif
+extern CCRETVAL        e_send_eof              (Char);
+extern CCRETVAL        e_charswitch            (Char);
+extern CCRETVAL        e_gcharswitch           (Char);
+extern CCRETVAL        e_which                 (Char);
+extern CCRETVAL        e_yank_kill             (Char);
+extern CCRETVAL        e_tty_dsusp             (Char);
+extern CCRETVAL        e_tty_flusho            (Char);
+extern CCRETVAL        e_tty_quit              (Char);
+extern CCRETVAL        e_tty_tsusp             (Char);
+extern CCRETVAL        e_tty_stopo             (Char);
+extern CCRETVAL        e_tty_starto            (Char);
+extern CCRETVAL        e_argfour               (Char);
+extern CCRETVAL        e_set_mark              (Char);
+extern CCRETVAL        e_exchange_mark         (Char);
+extern CCRETVAL        e_last_item             (Char);
+extern CCRETVAL        v_cmd_mode              (Char);
+extern CCRETVAL        v_insert                (Char);
+extern CCRETVAL        v_replmode              (Char);
+extern CCRETVAL        v_replone               (Char);
+extern CCRETVAL        v_substline             (Char);
+extern CCRETVAL        v_substchar             (Char);
+extern CCRETVAL        v_add                   (Char);
+extern CCRETVAL        v_addend                (Char);
+extern CCRETVAL        v_insbeg                (Char);
+extern CCRETVAL        v_chgtoend              (Char);
+extern CCRETVAL        e_killregion            (Char);
+extern CCRETVAL        e_killall               (Char);
+extern CCRETVAL        e_copyregion            (Char);
+extern CCRETVAL        e_tty_int               (Char);
+extern CCRETVAL        e_run_fg_editor         (Char);
+extern CCRETVAL        e_list_eof              (Char);
+extern CCRETVAL        e_expand_history        (Char);
+extern CCRETVAL        e_magic_space           (Char);
+extern CCRETVAL        e_list_glob             (Char);
+extern CCRETVAL        e_expand_glob           (Char);
+extern CCRETVAL        e_insovr                (Char);
+extern CCRETVAL        v_cm_complete           (Char);
+extern CCRETVAL        e_copyprev              (Char);
+extern CCRETVAL        v_change_case           (Char);
+extern CCRETVAL        e_expand                (Char);
+extern CCRETVAL        e_expand_vars           (Char);
+extern CCRETVAL        e_toggle_hist           (Char);
+extern  CCRETVAL        e_load_average         (Char);
+extern  CCRETVAL        v_delprev              (Char);
+extern  CCRETVAL        v_delmeta              (Char);
+extern  CCRETVAL        v_wordfwd              (Char);
+extern  CCRETVAL        v_wordback             (Char);
+extern  CCRETVAL        v_endword              (Char);
+extern  CCRETVAL        v_eword                        (Char);
+extern  CCRETVAL        v_undo                 (Char);
+extern  CCRETVAL        v_ush_meta             (Char);
+extern  CCRETVAL        v_dsh_meta             (Char);
+extern  CCRETVAL        v_rsrch_fwd            (Char);
+extern  CCRETVAL        v_rsrch_back           (Char);
+extern  CCRETVAL        v_char_fwd             (Char);
+extern  CCRETVAL        v_char_back            (Char);
+extern  CCRETVAL        v_chgmeta              (Char);
+extern CCRETVAL        e_inc_fwd               (Char);
+extern CCRETVAL        e_inc_back              (Char);
+extern CCRETVAL        v_rchar_fwd             (Char);
+extern CCRETVAL        v_rchar_back            (Char);
+extern  CCRETVAL        v_charto_fwd           (Char);
+extern  CCRETVAL        v_charto_back          (Char);
+extern  CCRETVAL        e_normalize_path       (Char);
+extern  CCRETVAL        e_normalize_command    (Char);
+extern  CCRETVAL        e_stuff_char           (Char);
+extern  CCRETVAL        e_list_all             (Char);
+extern  CCRETVAL        e_complete_all         (Char);
+extern  CCRETVAL        e_complete_fwd         (Char);
+extern  CCRETVAL        e_complete_back                (Char);
+extern  CCRETVAL        e_dabbrev_expand       (Char);
+extern  CCRETVAL       e_copy_to_clipboard     (Char);
+extern  CCRETVAL       e_paste_from_clipboard  (Char);
+extern  CCRETVAL       e_dosify_next           (Char);
+extern  CCRETVAL       e_dosify_prev           (Char);
+extern  CCRETVAL       e_page_up               (Char);
+extern  CCRETVAL       e_page_down             (Char);
+extern  CCRETVAL       e_yank_pop              (Char);
+extern  CCRETVAL       e_newline_hold          (Char);
+extern  CCRETVAL       e_newline_down_hist     (Char);
+
+/*
+ * ed.inputl.c
+ */
+extern int     Inputl                  (void);
+extern int     GetNextChar             (Char *);
+extern void    UngetNextChar           (Char);
+extern void    PushMacro               (Char *);
+
+/*
+ * ed.refresh.c
+ */
+extern void    ClearLines              (void);
+extern void    ClearDisp               (void);
+extern void    Refresh                 (void);
+extern void    RefCursor               (void);
+extern void    RefPlusOne              (int);
+extern void    PastBottom              (void);
+
+/*
+ * ed.xmap.c
+ */
+extern  XmapVal *XmapStr               (CStr *);
+extern  XmapVal *XmapCmd               (int);
+extern void     AddXkey                (const CStr *, XmapVal *, int);
+extern void     ClearXkey              (KEYCMD *, const CStr *);
+extern int      GetXkey                (CStr *, XmapVal *);
+extern void     ResetXmap              (void);
+extern int      DeleteXkey             (const CStr *);
+extern void     PrintXkey              (const CStr *);
+extern void     printOne               (const Char *, const XmapVal *, int);
+extern eChar             parseescape   (const Char **);
+extern unsigned char    *unparsestring (const CStr *, const Char *);
+
+#endif /* _h_ed_decls */
diff --git a/contrib/tcsh-6/ed.defns.c b/contrib/tcsh-6/ed.defns.c
new file mode 100644 (file)
index 0000000..5124bde
--- /dev/null
@@ -0,0 +1,1984 @@
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.defns.c,v 3.46 2006/03/02 18:46:44 christos Exp $ */
+/*
+ * ed.defns.c: Editor function definitions and initialization
+ */
+/*-
+ * 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("$tcsh: ed.defns.c,v 3.46 2006/03/02 18:46:44 christos Exp $")
+
+#include "ed.h"
+
+static void            ed_InitMetaBindings     (void);
+
+PFCmd   CcFuncTbl[] = {                /* table of available commands */
+    e_unassigned,
+/* no #define here -- this is a dummy to detect initing of the key map */
+    e_unassigned,
+#define                F_UNASSIGNED    1
+    e_insert,
+#define                F_INSERT        2
+    e_newline,
+#define                F_NEWLINE       3
+    e_delprev,
+#define                F_DELPREV       4
+    e_delnext,
+#define                F_DELNEXT       5
+    e_toend,
+#define                F_TOEND         6
+    e_tobeg,
+#define                F_TOBEG         7
+    e_charback,
+#define                F_CHARBACK      8
+    e_charfwd,
+#define                F_CHARFWD       9
+    e_quote,
+#define                F_QUOTE         10
+    e_startover,
+#define                F_STARTOVER     11
+    e_redisp,
+#define                F_REDISP        12
+    e_tty_int,
+#define                F_TTY_INT       13
+    e_wordback,
+#define                F_WORDBACK      14
+    e_wordfwd,
+#define                F_WORDFWD       15
+    e_cleardisp,
+#define                F_CLEARDISP     16
+    e_complete,
+#define                F_COMPLETE      17
+    e_correct,
+#define                F_CORRECT       18
+    e_up_hist,
+#define                F_UP_HIST       19
+    e_down_hist,
+#define                F_DOWN_HIST     20
+    e_up_search_hist,
+#define                F_UP_SEARCH_HIST        21
+    e_down_search_hist,
+#define                F_DOWN_SEARCH_HIST      22
+    e_helpme,
+#define                F_HELPME        23
+    e_list_choices,
+#define                F_LIST_CHOICES  24
+    e_delwordprev,
+#define                F_DELWORDPREV   25
+    e_delwordnext,
+#define                F_DELWORDNEXT   26
+    e_digit,
+#define                F_DIGIT         27
+    e_killend,
+#define                F_KILLEND       28
+    e_killbeg,
+#define                F_KILLBEG       29
+    e_metanext,
+#define                F_METANEXT      30
+    e_send_eof,
+#define                F_SEND_EOF      31
+    e_charswitch,
+#define                F_CHARSWITCH    32
+    e_which,
+#define                F_WHICH         33
+    e_yank_kill,
+#define                F_YANK_KILL     34
+    e_tty_dsusp,
+#define                F_TTY_DSUSP     35
+    e_tty_flusho,
+#define                F_TTY_FLUSHO    36
+    e_tty_quit,
+#define                F_TTY_QUIT      37
+    e_tty_tsusp,
+#define                F_TTY_TSUSP     38
+    e_tty_stopo,
+#define                F_TTY_STOPO     39
+    e_tty_starto,
+#define                F_TTY_STARTO    40
+    e_argfour,
+#define                F_ARGFOUR       41
+    e_set_mark,
+#define                F_SET_MARK      42
+    e_exchange_mark,
+#define                F_EXCHANGE_MARK 43
+    e_last_item,
+#define                F_LAST_ITEM     44
+    e_delnext_list_eof,
+#define                F_DELNEXT_LIST_EOF      45
+    v_cmd_mode,
+#define                V_CMD_MODE      46
+    v_insert,
+#define                V_INSERT        47
+    e_argdigit,
+#define                F_ARGDIGIT      48
+    e_killregion,
+#define                F_KILLREGION    49
+    e_copyregion,
+#define                F_COPYREGION    50
+    e_gcharswitch,
+#define                F_GCHARSWITCH   51
+    e_run_fg_editor,
+#define                F_RUN_FG_EDITOR 52
+    e_unassigned,      /* place holder for sequence lead in character */
+#define                F_XKEY          53
+    e_uppercase,
+#define         F_CASEUPPER     54
+    e_lowercase,
+#define         F_CASELOWER     55
+    e_capitolcase,
+#define         F_CASECAPITAL   56
+    v_zero,
+#define                V_ZERO          57
+    v_add,
+#define                V_ADD           58
+    v_addend,
+#define                V_ADDEND        59
+    v_wordbegnext,
+#define                V_WORDBEGNEXT   60
+    e_killall,
+#define                F_KILLALL       61
+    e_unassigned,
+/* F_EXTENDNEXT removed */
+    v_insbeg,
+#define                V_INSBEG        63
+    v_replmode,
+#define                V_REPLMODE      64
+    v_replone,
+#define                V_REPLONE       65
+    v_substline,
+#define                V_SUBSTLINE     66
+    v_substchar,
+#define                V_SUBSTCHAR     67
+    v_chgtoend,
+#define                V_CHGTOEND      68
+    e_list_eof,
+#define                F_LIST_EOF      69
+    e_list_glob,
+#define                F_LIST_GLOB     70
+    e_expand_history,
+#define                F_EXPAND_HISTORY        71
+    e_magic_space,
+#define                F_MAGIC_SPACE   72
+    e_insovr,
+#define                F_INSOVR        73
+    v_cm_complete,
+#define                V_CM_COMPLETE   74
+    e_copyprev,
+#define                F_COPYPREV      75
+    e_correctl,
+#define                F_CORRECT_L     76
+    e_expand_glob,
+#define                F_EXPAND_GLOB   77
+    e_expand_vars,
+#define                F_EXPAND_VARS   78
+    e_toggle_hist,
+#define                F_TOGGLE_HIST   79
+    v_change_case,
+#define                V_CHGCASE       80
+    e_expand,
+#define                F_EXPAND        81
+    e_load_average,
+#define                F_LOAD_AVERAGE  82
+    v_delprev,
+#define                V_DELPREV       83
+    v_delmeta,
+#define                V_DELMETA       84
+    v_wordfwd,
+#define                V_WORDFWD       85
+    v_wordback,
+#define                V_WORDBACK      86
+    v_endword,
+#define                V_ENDWORD       87
+    v_eword,
+#define                V_EWORD         88
+    v_undo,
+#define                V_UNDO          89
+    v_ush_meta,
+#define                V_USH_META      90
+    v_dsh_meta,
+#define                V_DSH_META      91
+    v_rsrch_fwd,
+#define                V_RSRCH_FWD     92
+    v_rsrch_back,
+#define                V_RSRCH_BACK    93
+    v_char_fwd,
+#define                V_CHAR_FWD      94
+    v_char_back,
+#define                V_CHAR_BACK     95
+    v_chgmeta,
+#define                V_CHGMETA       96
+    e_inc_fwd,
+#define                F_INC_FWD       97
+    e_inc_back,
+#define                F_INC_BACK      98
+    v_rchar_fwd,
+#define                V_RCHAR_FWD     99
+    v_rchar_back,
+#define                V_RCHAR_BACK    100
+    v_charto_fwd,
+#define                V_CHARTO_FWD    101
+    v_charto_back,
+#define                V_CHARTO_BACK   102
+    e_normalize_path,
+#define                F_PATH_NORM     103
+    e_delnext_eof,             /* added by mtk@ari.ncl.omron.co.jp (920818) */
+#define                F_DELNEXT_EOF   104
+    e_stuff_char,              
+#define                F_STUFF_CHAR    105
+    e_complete_all,
+#define                F_COMPLETE_ALL  106
+    e_list_all,
+#define                F_LIST_ALL      107
+    e_complete_fwd,
+#define                F_COMPLETE_FWD  108
+    e_complete_back,
+#define                F_COMPLETE_BACK 109
+    e_delnext_list,
+#define                F_DELNEXT_LIST  110
+    e_normalize_command,
+#define                F_COMMAND_NORM  111
+    e_dabbrev_expand,
+#define                F_DABBREV_EXPAND        112
+    e_copy_to_clipboard,
+#define                F_COPY_CLIP     113
+    e_paste_from_clipboard,
+#define                F_PASTE_CLIP    114
+    e_dosify_next,
+#define                F_DOSIFY_NEXT   115
+    e_dosify_prev,
+#define                F_DOSIFY_PREV   116
+    e_page_up,
+#define                F_PAGE_UP       117
+    e_page_down,
+#define                F_PAGE_DOWN     118
+    e_yank_pop,
+#define                F_YANK_POP      119
+    e_newline_hold,
+#define                F_NEWLINE_HOLD  120
+    e_newline_down_hist,
+#define                F_NEWLINE_DOWN_HIST     121
+    0                          /* DUMMY VALUE */
+#define                F_NUM_FNS       122
+
+};
+
+KEYCMD  NumFuns = F_NUM_FNS;
+
+KEYCMD  CcKeyMap[NT_NUM_KEYS];         /* the real key map */
+KEYCMD  CcAltMap[NT_NUM_KEYS];         /* the alternative key map */
+#define        F_NUM_FUNCNAMES (F_NUM_FNS + 2)
+struct KeyFuncs FuncNames[F_NUM_FUNCNAMES];
+
+#ifdef WINNT_NATIVE
+extern KEYCMD CcEmacsMap[];
+extern KEYCMD CcViMap[];
+extern KEYCMD  CcViCmdMap[];
+#else /* !WINNT_NATIVE*/
+KEYCMD  CcEmacsMap[] = {
+/* keymap table, each index into above tbl; should be 256*sizeof(KEYCMD)
+   bytes long */
+
+    F_SET_MARK,                        /* ^@ */
+    F_TOBEG,                   /* ^A */
+    F_CHARBACK,                        /* ^B */
+    F_TTY_INT,                 /* ^C */
+    F_DELNEXT_LIST_EOF,                /* ^D */
+    F_TOEND,                   /* ^E */
+    F_CHARFWD,                 /* ^F */
+    F_UNASSIGNED,              /* ^G */
+    F_DELPREV,                 /* ^H */
+    F_COMPLETE,                        /* ^I */
+    F_NEWLINE,                 /* ^J */
+    F_KILLEND,                 /* ^K */
+    F_CLEARDISP,               /* ^L */
+    F_NEWLINE,                 /* ^M */
+    F_DOWN_HIST,               /* ^N */
+    F_TTY_FLUSHO,              /* ^O */
+    F_UP_HIST,                 /* ^P */
+    F_TTY_STARTO,              /* ^Q */
+    F_REDISP,                  /* ^R */
+    F_TTY_STOPO,               /* ^S */
+    F_CHARSWITCH,              /* ^T */
+    F_KILLALL,                 /* ^U */
+    F_QUOTE,                   /* ^V */
+    F_KILLREGION,              /* ^W */
+    F_XKEY,                    /* ^X */
+    F_YANK_KILL,               /* ^Y */
+    F_TTY_TSUSP,               /* ^Z */
+    F_METANEXT,                        /* ^[ */
+    F_TTY_QUIT,                        /* ^\ */
+    F_TTY_DSUSP,               /* ^] */
+    F_UNASSIGNED,              /* ^^ */
+    F_UNASSIGNED,              /* ^_ */
+    F_INSERT,                  /* SPACE */
+    F_INSERT,                  /* ! */
+    F_INSERT,                  /* " */
+    F_INSERT,                  /* # */
+    F_INSERT,                  /* $ */
+    F_INSERT,                  /* % */
+    F_INSERT,                  /* & */
+    F_INSERT,                  /* ' */
+    F_INSERT,                  /* ( */
+    F_INSERT,                  /* ) */
+    F_INSERT,                  /* * */
+    F_INSERT,                  /* + */
+    F_INSERT,                  /* , */
+    F_INSERT,                  /* - */
+    F_INSERT,                  /* . */
+    F_INSERT,                  /* / */
+    F_DIGIT,                   /* 0 */
+    F_DIGIT,                   /* 1 */
+    F_DIGIT,                   /* 2 */
+    F_DIGIT,                   /* 3 */
+    F_DIGIT,                   /* 4 */
+    F_DIGIT,                   /* 5 */
+    F_DIGIT,                   /* 6 */
+    F_DIGIT,                   /* 7 */
+    F_DIGIT,                   /* 8 */
+    F_DIGIT,                   /* 9 */
+    F_INSERT,                  /* : */
+    F_INSERT,                  /* ; */
+    F_INSERT,                  /* < */
+    F_INSERT,                  /* = */
+    F_INSERT,                  /* > */
+    F_INSERT,                  /* ? */
+    F_INSERT,                  /* @ */
+    F_INSERT,                  /* A */
+    F_INSERT,                  /* B */
+    F_INSERT,                  /* C */
+    F_INSERT,                  /* D */
+    F_INSERT,                  /* E */
+    F_INSERT,                  /* F */
+    F_INSERT,                  /* G */
+    F_INSERT,                  /* H */
+    F_INSERT,                  /* I */
+    F_INSERT,                  /* J */
+    F_INSERT,                  /* K */
+    F_INSERT,                  /* L */
+    F_INSERT,                  /* M */
+    F_INSERT,                  /* N */
+    F_INSERT,                  /* O */
+    F_INSERT,                  /* P */
+    F_INSERT,                  /* Q */
+    F_INSERT,                  /* R */
+    F_INSERT,                  /* S */
+    F_INSERT,                  /* T */
+    F_INSERT,                  /* U */
+    F_INSERT,                  /* V */
+    F_INSERT,                  /* W */
+    F_INSERT,                  /* X */
+    F_INSERT,                  /* Y */
+    F_INSERT,                  /* Z */
+    F_INSERT,                  /* [ */
+    F_INSERT,                  /* \ */
+    F_INSERT,                  /* ] */
+    F_INSERT,                  /* ^ */
+    F_INSERT,                  /* _ */
+    F_INSERT,                  /* ` */
+    F_INSERT,                  /* a */
+    F_INSERT,                  /* b */
+    F_INSERT,                  /* c */
+    F_INSERT,                  /* d */
+    F_INSERT,                  /* e */
+    F_INSERT,                  /* f */
+    F_INSERT,                  /* g */
+    F_INSERT,                  /* h */
+    F_INSERT,                  /* i */
+    F_INSERT,                  /* j */
+    F_INSERT,                  /* k */
+    F_INSERT,                  /* l */
+    F_INSERT,                  /* m */
+    F_INSERT,                  /* n */
+    F_INSERT,                  /* o */
+    F_INSERT,                  /* p */
+    F_INSERT,                  /* q */
+    F_INSERT,                  /* r */
+    F_INSERT,                  /* s */
+    F_INSERT,                  /* t */
+    F_INSERT,                  /* u */
+    F_INSERT,                  /* v */
+    F_INSERT,                  /* w */
+    F_INSERT,                  /* x */
+    F_INSERT,                  /* y */
+    F_INSERT,                  /* z */
+    F_INSERT,                  /* { */
+    F_INSERT,                  /* | */
+    F_INSERT,                  /* } */
+    F_INSERT,                  /* ~ */
+    F_DELPREV,                 /* ^? */
+    F_UNASSIGNED,              /* M-^@ */
+    F_UNASSIGNED,              /* M-^A */
+    F_UNASSIGNED,              /* M-^B */
+    F_UNASSIGNED,              /* M-^C */
+    F_LIST_CHOICES,            /* M-^D */
+    F_UNASSIGNED,              /* M-^E */
+    F_UNASSIGNED,              /* M-^F */
+    F_UNASSIGNED,              /* M-^G */
+    F_DELWORDPREV,             /* M-^H */
+    F_COMPLETE,                        /* M-^I */
+    F_UNASSIGNED,              /* M-^J */
+    F_UNASSIGNED,              /* M-^K */
+    F_CLEARDISP,               /* M-^L */
+    F_UNASSIGNED,              /* M-^M */
+    F_UNASSIGNED,              /* M-^N */
+    F_UNASSIGNED,              /* M-^O */
+    F_UNASSIGNED,              /* M-^P */
+    F_UNASSIGNED,              /* M-^Q */
+    F_UNASSIGNED,              /* M-^R */
+    F_UNASSIGNED,              /* M-^S */
+    F_UNASSIGNED,              /* M-^T */
+    F_UNASSIGNED,              /* M-^U */
+    F_UNASSIGNED,              /* M-^V */
+    F_UNASSIGNED,              /* M-^W */
+    F_UNASSIGNED,              /* M-^X */
+    F_UNASSIGNED,              /* M-^Y */
+    F_RUN_FG_EDITOR,           /* M-^Z */
+    F_COMPLETE,                        /* M-^[ */
+    F_UNASSIGNED,              /* M-^\ */
+    F_UNASSIGNED,              /* M-^] */
+    F_UNASSIGNED,              /* M-^^ */
+    F_COPYPREV,                        /* M-^_ */
+    F_EXPAND_HISTORY,          /* M-SPACE */
+    F_EXPAND_HISTORY,          /* M-! */
+    F_UNASSIGNED,              /* M-" */
+    F_UNASSIGNED,              /* M-# */
+    F_CORRECT_L,               /* M-$ */
+    F_UNASSIGNED,              /* M-% */
+    F_UNASSIGNED,              /* M-& */
+    F_UNASSIGNED,              /* M-' */
+    F_UNASSIGNED,              /* M-( */
+    F_UNASSIGNED,              /* M-) */
+    F_UNASSIGNED,              /* M-* */
+    F_UNASSIGNED,              /* M-+ */
+    F_UNASSIGNED,              /* M-, */
+    F_UNASSIGNED,              /* M-- */
+    F_UNASSIGNED,              /* M-. */
+    F_DABBREV_EXPAND,          /* M-/ */
+    F_ARGDIGIT,                        /* M-0 */
+    F_ARGDIGIT,                        /* M-1 */
+    F_ARGDIGIT,                        /* M-2 */
+    F_ARGDIGIT,                        /* M-3 */
+    F_ARGDIGIT,                        /* M-4 */
+    F_ARGDIGIT,                        /* M-5 */
+    F_ARGDIGIT,                        /* M-6 */
+    F_ARGDIGIT,                        /* M-7 */
+    F_ARGDIGIT,                        /* M-8 */
+    F_ARGDIGIT,                        /* M-9 */
+    F_UNASSIGNED,              /* M-: */
+    F_UNASSIGNED,              /* M-; */
+    F_UNASSIGNED,              /* M-< */
+    F_UNASSIGNED,              /* M-= */
+    F_UNASSIGNED,              /* M-> */
+    F_WHICH,                   /* M-? */
+    F_UNASSIGNED,              /* M-@ */
+    F_NEWLINE_HOLD,            /* M-A */
+    F_WORDBACK,                        /* M-B */
+    F_CASECAPITAL,             /* M-C */
+    F_DELWORDNEXT,             /* M-D */
+    F_UNASSIGNED,              /* M-E */
+    F_WORDFWD,                 /* M-F */
+    F_UNASSIGNED,              /* M-G */
+    F_HELPME,                  /* M-H */
+    F_UNASSIGNED,              /* M-I */
+    F_UNASSIGNED,              /* M-J */
+    F_UNASSIGNED,              /* M-K */
+    F_CASELOWER,               /* M-L */
+    F_UNASSIGNED,              /* M-M */
+    F_DOWN_SEARCH_HIST,                /* M-N */
+    F_XKEY,                    /* M-O *//* extended key esc PWP Mar 88 */
+    F_UP_SEARCH_HIST,          /* M-P */
+    F_UNASSIGNED,              /* M-Q */
+    F_TOGGLE_HIST,             /* M-R */
+    F_CORRECT,                 /* M-S */
+    F_UNASSIGNED,              /* M-T */
+    F_CASEUPPER,               /* M-U */
+    F_UNASSIGNED,              /* M-V */
+    F_COPYREGION,              /* M-W */
+    F_UNASSIGNED,              /* M-X */
+    F_YANK_POP,                        /* M-Y */
+    F_UNASSIGNED,              /* M-Z */
+    F_XKEY,                    /* M-[ *//* extended key esc -mf Oct 87 */
+    F_UNASSIGNED,              /* M-\ */
+    F_UNASSIGNED,              /* M-] */
+    F_UNASSIGNED,              /* M-^ */
+    F_LAST_ITEM,               /* M-_ */
+    F_UNASSIGNED,              /* M-` */
+    F_NEWLINE_HOLD,            /* M-a */
+    F_WORDBACK,                        /* M-b */
+    F_CASECAPITAL,             /* M-c */
+    F_DELWORDNEXT,             /* M-d */
+    F_UNASSIGNED,              /* M-e */
+    F_WORDFWD,                 /* M-f */
+    F_UNASSIGNED,              /* M-g */
+    F_HELPME,                  /* M-h */
+    F_UNASSIGNED,              /* M-i */
+    F_UNASSIGNED,              /* M-j */
+    F_UNASSIGNED,              /* M-k */
+    F_CASELOWER,               /* M-l */
+    F_UNASSIGNED,              /* M-m */
+    F_DOWN_SEARCH_HIST,                /* M-n */
+    F_UNASSIGNED,              /* M-o */
+    F_UP_SEARCH_HIST,          /* M-p */
+    F_UNASSIGNED,              /* M-q */
+    F_TOGGLE_HIST,             /* M-r */
+    F_CORRECT,                 /* M-s */
+    F_UNASSIGNED,              /* M-t */
+    F_CASEUPPER,               /* M-u */
+    F_UNASSIGNED,              /* M-v */
+    F_COPYREGION,              /* M-w */
+    F_UNASSIGNED,              /* M-x */
+    F_YANK_POP,                        /* M-y */
+    F_UNASSIGNED,              /* M-z */
+    F_UNASSIGNED,              /* M-{ */
+    F_UNASSIGNED,              /* M-| */
+    F_UNASSIGNED,              /* M-} */
+    F_UNASSIGNED,              /* M-~ */
+    F_DELWORDPREV              /* M-^? */
+};
+
+/*
+ * keymap table for vi.  Each index into above tbl; should be
+ * 256 entries long.  Vi mode uses a sticky-extend to do command mode:
+ * insert mode characters are in the normal keymap, and command mode
+ * in the extended keymap.
+ */
+static KEYCMD  CcViMap[] = {
+#ifdef KSHVI
+    F_UNASSIGNED,              /* ^@ */
+    F_INSERT,                  /* ^A */
+    F_INSERT,                  /* ^B */
+    F_INSERT,                  /* ^C */
+    F_INSERT,                  /* ^D */
+    F_INSERT,                  /* ^E */
+    F_INSERT,                  /* ^F */
+    F_INSERT,                  /* ^G */
+    V_DELPREV,                 /* ^H */   /* BackSpace key */
+    F_COMPLETE,                        /* ^I */   /* Tab Key  */
+    F_NEWLINE,                 /* ^J */
+    F_INSERT,                  /* ^K */
+    F_INSERT,                  /* ^L */
+    F_NEWLINE,                 /* ^M */
+    F_INSERT,                  /* ^N */
+    F_INSERT,                  /* ^O */
+    F_INSERT,                  /* ^P */
+    F_TTY_STARTO,              /* ^Q */
+    F_INSERT,                  /* ^R */
+    F_INSERT,                  /* ^S */
+    F_INSERT,                  /* ^T */
+    F_INSERT,                  /* ^U */
+    F_QUOTE,                   /* ^V */
+    F_DELWORDPREV,             /* ^W */  /* Only until start edit pos */
+    F_INSERT,                  /* ^X */
+    F_INSERT,                  /* ^Y */
+    F_INSERT,                  /* ^Z */
+    V_CMD_MODE,                        /* ^[ */  /* [ Esc ] key */
+    F_TTY_QUIT,                        /* ^\ */
+    F_INSERT,                  /* ^] */
+    F_INSERT,                  /* ^^ */
+    F_INSERT,                  /* ^_ */
+#else /* !KSHVI */
+    F_UNASSIGNED,              /* ^@ */   /* NOTE: These mapping do NOT */
+    F_TOBEG,                   /* ^A */   /* Correspond well to the KSH */
+    F_CHARBACK,                        /* ^B */   /* VI editting assignments    */
+    F_TTY_INT,                 /* ^C */   /* On the other hand they are */
+    F_LIST_EOF,                        /* ^D */   /* convenient any many people */
+    F_TOEND,                   /* ^E */   /* have gotten used to them   */
+    F_CHARFWD,                 /* ^F */
+    F_LIST_GLOB,               /* ^G */
+    F_DELPREV,                 /* ^H */   /* BackSpace key */
+    F_COMPLETE,                        /* ^I */   /* Tab Key */
+    F_NEWLINE,                 /* ^J */
+    F_KILLEND,                 /* ^K */
+    F_CLEARDISP,               /* ^L */
+    F_NEWLINE,                 /* ^M */
+    F_DOWN_HIST,               /* ^N */
+    F_TTY_FLUSHO,              /* ^O */
+    F_UP_HIST,                 /* ^P */
+    F_TTY_STARTO,              /* ^Q */
+    F_REDISP,                  /* ^R */
+    F_TTY_STOPO,               /* ^S */
+    F_CHARSWITCH,              /* ^T */
+    F_KILLBEG,                 /* ^U */
+    F_QUOTE,                   /* ^V */
+    F_DELWORDPREV,             /* ^W */
+    F_EXPAND,                  /* ^X */
+    F_TTY_DSUSP,               /* ^Y */
+    F_TTY_TSUSP,               /* ^Z */
+    V_CMD_MODE,                        /* ^[ */
+    F_TTY_QUIT,                        /* ^\ */
+    F_UNASSIGNED,              /* ^] */
+    F_UNASSIGNED,              /* ^^ */
+    F_UNASSIGNED,              /* ^_ */
+#endif  /* KSHVI */
+    F_INSERT,                  /* SPACE */
+    F_INSERT,                  /* ! */
+    F_INSERT,                  /* " */
+    F_INSERT,                  /* # */
+    F_INSERT,                  /* $ */
+    F_INSERT,                  /* % */
+    F_INSERT,                  /* & */
+    F_INSERT,                  /* ' */
+    F_INSERT,                  /* ( */
+    F_INSERT,                  /* ) */
+    F_INSERT,                  /* * */
+    F_INSERT,                  /* + */
+    F_INSERT,                  /* , */
+    F_INSERT,                  /* - */
+    F_INSERT,                  /* . */
+    F_INSERT,                  /* / */
+    F_INSERT,                  /* 0 */
+    F_INSERT,                  /* 1 */
+    F_INSERT,                  /* 2 */
+    F_INSERT,                  /* 3 */
+    F_INSERT,                  /* 4 */
+    F_INSERT,                  /* 5 */
+    F_INSERT,                  /* 6 */
+    F_INSERT,                  /* 7 */
+    F_INSERT,                  /* 8 */
+    F_INSERT,                  /* 9 */
+    F_INSERT,                  /* : */
+    F_INSERT,                  /* ; */
+    F_INSERT,                  /* < */
+    F_INSERT,                  /* = */
+    F_INSERT,                  /* > */
+    F_INSERT,                  /* ? */
+    F_INSERT,                  /* @ */
+    F_INSERT,                  /* A */
+    F_INSERT,                  /* B */
+    F_INSERT,                  /* C */
+    F_INSERT,                  /* D */
+    F_INSERT,                  /* E */
+    F_INSERT,                  /* F */
+    F_INSERT,                  /* G */
+    F_INSERT,                  /* H */
+    F_INSERT,                  /* I */
+    F_INSERT,                  /* J */
+    F_INSERT,                  /* K */
+    F_INSERT,                  /* L */
+    F_INSERT,                  /* M */
+    F_INSERT,                  /* N */
+    F_INSERT,                  /* O */
+    F_INSERT,                  /* P */
+    F_INSERT,                  /* Q */
+    F_INSERT,                  /* R */
+    F_INSERT,                  /* S */
+    F_INSERT,                  /* T */
+    F_INSERT,                  /* U */
+    F_INSERT,                  /* V */
+    F_INSERT,                  /* W */
+    F_INSERT,                  /* X */
+    F_INSERT,                  /* Y */
+    F_INSERT,                  /* Z */
+    F_INSERT,                  /* [ */
+    F_INSERT,                  /* \ */
+    F_INSERT,                  /* ] */
+    F_INSERT,                  /* ^ */
+    F_INSERT,                  /* _ */
+    F_INSERT,                  /* ` */
+    F_INSERT,                  /* a */
+    F_INSERT,                  /* b */
+    F_INSERT,                  /* c */
+    F_INSERT,                  /* d */
+    F_INSERT,                  /* e */
+    F_INSERT,                  /* f */
+    F_INSERT,                  /* g */
+    F_INSERT,                  /* h */
+    F_INSERT,                  /* i */
+    F_INSERT,                  /* j */
+    F_INSERT,                  /* k */
+    F_INSERT,                  /* l */
+    F_INSERT,                  /* m */
+    F_INSERT,                  /* n */
+    F_INSERT,                  /* o */
+    F_INSERT,                  /* p */
+    F_INSERT,                  /* q */
+    F_INSERT,                  /* r */
+    F_INSERT,                  /* s */
+    F_INSERT,                  /* t */
+    F_INSERT,                  /* u */
+    F_INSERT,                  /* v */
+    F_INSERT,                  /* w */
+    F_INSERT,                  /* x */
+    F_INSERT,                  /* y */
+    F_INSERT,                  /* z */
+    F_INSERT,                  /* { */
+    F_INSERT,                  /* | */
+    F_INSERT,                  /* } */
+    F_INSERT,                  /* ~ */
+    F_DELPREV,                 /* ^? */
+    F_UNASSIGNED,              /* M-^@ */
+    F_UNASSIGNED,              /* M-^A */
+    F_UNASSIGNED,              /* M-^B */
+    F_UNASSIGNED,              /* M-^C */
+    F_UNASSIGNED,              /* M-^D */
+    F_UNASSIGNED,              /* M-^E */
+    F_UNASSIGNED,              /* M-^F */
+    F_UNASSIGNED,              /* M-^G */
+    F_UNASSIGNED,              /* M-^H */
+    F_UNASSIGNED,              /* M-^I */
+    F_UNASSIGNED,              /* M-^J */
+    F_UNASSIGNED,              /* M-^K */
+    F_UNASSIGNED,              /* M-^L */
+    F_UNASSIGNED,              /* M-^M */
+    F_UNASSIGNED,              /* M-^N */
+    F_UNASSIGNED,              /* M-^O */
+    F_UNASSIGNED,              /* M-^P */
+    F_UNASSIGNED,              /* M-^Q */
+    F_UNASSIGNED,              /* M-^R */
+    F_UNASSIGNED,              /* M-^S */
+    F_UNASSIGNED,              /* M-^T */
+    F_UNASSIGNED,              /* M-^U */
+    F_UNASSIGNED,              /* M-^V */
+    F_UNASSIGNED,              /* M-^W */
+    F_UNASSIGNED,              /* M-^X */
+    F_UNASSIGNED,              /* M-^Y */
+    F_UNASSIGNED,              /* M-^Z */
+    F_UNASSIGNED,              /* M-^[ */
+    F_UNASSIGNED,              /* M-^\ */
+    F_UNASSIGNED,              /* M-^] */
+    F_UNASSIGNED,              /* M-^^ */
+    F_UNASSIGNED,              /* M-^_ */
+    F_UNASSIGNED,              /* M-SPACE */
+    F_UNASSIGNED,              /* M-! */
+    F_UNASSIGNED,              /* M-" */
+    F_UNASSIGNED,              /* M-# */
+    F_UNASSIGNED,              /* M-$ */
+    F_UNASSIGNED,              /* M-% */
+    F_UNASSIGNED,              /* M-& */
+    F_UNASSIGNED,              /* M-' */
+    F_UNASSIGNED,              /* M-( */
+    F_UNASSIGNED,              /* M-) */
+    F_UNASSIGNED,              /* M-* */
+    F_UNASSIGNED,              /* M-+ */
+    F_UNASSIGNED,              /* M-, */
+    F_UNASSIGNED,              /* M-- */
+    F_UNASSIGNED,              /* M-. */
+    F_UNASSIGNED,              /* M-/ */
+    F_UNASSIGNED,              /* M-0 */
+    F_UNASSIGNED,              /* M-1 */
+    F_UNASSIGNED,              /* M-2 */
+    F_UNASSIGNED,              /* M-3 */
+    F_UNASSIGNED,              /* M-4 */
+    F_UNASSIGNED,              /* M-5 */
+    F_UNASSIGNED,              /* M-6 */
+    F_UNASSIGNED,              /* M-7 */
+    F_UNASSIGNED,              /* M-8 */
+    F_UNASSIGNED,              /* M-9 */
+    F_UNASSIGNED,              /* M-: */
+    F_UNASSIGNED,              /* M-; */
+    F_UNASSIGNED,              /* M-< */
+    F_UNASSIGNED,              /* M-= */
+    F_UNASSIGNED,              /* M-> */
+    F_UNASSIGNED,              /* M-? */
+    F_UNASSIGNED,              /* M-@ */
+    F_UNASSIGNED,              /* M-A */
+    F_UNASSIGNED,              /* M-B */
+    F_UNASSIGNED,              /* M-C */
+    F_UNASSIGNED,              /* M-D */
+    F_UNASSIGNED,              /* M-E */
+    F_UNASSIGNED,              /* M-F */
+    F_UNASSIGNED,              /* M-G */
+    F_UNASSIGNED,              /* M-H */
+    F_UNASSIGNED,              /* M-I */
+    F_UNASSIGNED,              /* M-J */
+    F_UNASSIGNED,              /* M-K */
+    F_UNASSIGNED,              /* M-L */
+    F_UNASSIGNED,              /* M-M */
+    F_UNASSIGNED,              /* M-N */
+    F_UNASSIGNED,              /* M-O */
+    F_UNASSIGNED,              /* M-P */
+    F_UNASSIGNED,              /* M-Q */
+    F_UNASSIGNED,              /* M-R */
+    F_UNASSIGNED,              /* M-S */
+    F_UNASSIGNED,              /* M-T */
+    F_UNASSIGNED,              /* M-U */
+    F_UNASSIGNED,              /* M-V */
+    F_UNASSIGNED,              /* M-W */
+    F_UNASSIGNED,              /* M-X */
+    F_UNASSIGNED,              /* M-Y */
+    F_UNASSIGNED,              /* M-Z */
+    F_UNASSIGNED,              /* M-[ */
+    F_UNASSIGNED,              /* M-\ */
+    F_UNASSIGNED,              /* M-] */
+    F_UNASSIGNED,              /* M-^ */
+    F_UNASSIGNED,              /* M-_ */
+    F_UNASSIGNED,              /* M-` */
+    F_UNASSIGNED,              /* M-a */
+    F_UNASSIGNED,              /* M-b */
+    F_UNASSIGNED,              /* M-c */
+    F_UNASSIGNED,              /* M-d */
+    F_UNASSIGNED,              /* M-e */
+    F_UNASSIGNED,              /* M-f */
+    F_UNASSIGNED,              /* M-g */
+    F_UNASSIGNED,              /* M-h */
+    F_UNASSIGNED,              /* M-i */
+    F_UNASSIGNED,              /* M-j */
+    F_UNASSIGNED,              /* M-k */
+    F_UNASSIGNED,              /* M-l */
+    F_UNASSIGNED,              /* M-m */
+    F_UNASSIGNED,              /* M-n */
+    F_UNASSIGNED,              /* M-o */
+    F_UNASSIGNED,              /* M-p */
+    F_UNASSIGNED,              /* M-q */
+    F_UNASSIGNED,              /* M-r */
+    F_UNASSIGNED,              /* M-s */
+    F_UNASSIGNED,              /* M-t */
+    F_UNASSIGNED,              /* M-u */
+    F_UNASSIGNED,              /* M-v */
+    F_UNASSIGNED,              /* M-w */
+    F_UNASSIGNED,              /* M-x */
+    F_UNASSIGNED,              /* M-y */
+    F_UNASSIGNED,              /* M-z */
+    F_UNASSIGNED,              /* M-{ */
+    F_UNASSIGNED,              /* M-| */
+    F_UNASSIGNED,              /* M-} */
+    F_UNASSIGNED,              /* M-~ */
+    F_UNASSIGNED               /* M-^? */
+};
+
+KEYCMD  CcViCmdMap[] = {
+    F_UNASSIGNED,              /* ^@ */
+    F_TOBEG,                   /* ^A */
+    F_UNASSIGNED,              /* ^B */
+    F_TTY_INT,                 /* ^C */
+    F_LIST_CHOICES,            /* ^D */
+    F_TOEND,                   /* ^E */
+    F_UNASSIGNED,              /* ^F */
+    F_LIST_GLOB,               /* ^G */
+    F_CHARBACK,                        /* ^H */
+    V_CM_COMPLETE,             /* ^I */
+    F_NEWLINE,                 /* ^J */
+    F_KILLEND,                 /* ^K */
+    F_CLEARDISP,               /* ^L */
+    F_NEWLINE,                 /* ^M */
+    F_DOWN_HIST,               /* ^N */
+    F_TTY_FLUSHO,              /* ^O */
+    F_UP_HIST,                 /* ^P */
+    F_TTY_STARTO,              /* ^Q */
+    F_REDISP,                  /* ^R */
+    F_TTY_STOPO,               /* ^S */
+    F_UNASSIGNED,              /* ^T */
+    F_KILLBEG,                 /* ^U */
+    F_UNASSIGNED,              /* ^V */
+    F_DELWORDPREV,             /* ^W */
+    F_EXPAND,                  /* ^X */
+    F_UNASSIGNED,              /* ^Y */
+    F_UNASSIGNED,              /* ^Z */
+    F_METANEXT,                        /* ^[ */
+    F_TTY_QUIT,                        /* ^\ */
+    F_UNASSIGNED,              /* ^] */
+    F_UNASSIGNED,              /* ^^ */
+    F_UNASSIGNED,              /* ^_ */
+    F_CHARFWD,                 /* SPACE */
+    F_EXPAND_HISTORY,          /* ! */
+    F_UNASSIGNED,              /* " */
+    F_UNASSIGNED,              /* # */
+    F_TOEND,                   /* $ */
+    F_UNASSIGNED,              /* % */
+    F_UNASSIGNED,              /* & */
+    F_UNASSIGNED,              /* ' */
+    F_UNASSIGNED,              /* ( */
+    F_UNASSIGNED,              /* ) */
+    F_EXPAND_GLOB,             /* * */
+    F_DOWN_HIST,               /* + */
+    V_RCHAR_BACK,              /* , */ 
+    F_UP_HIST,                 /* - */ 
+    F_UNASSIGNED,              /* . */
+    V_DSH_META,                        /* / */
+    V_ZERO,                    /* 0 */
+    F_ARGDIGIT,                        /* 1 */
+    F_ARGDIGIT,                        /* 2 */
+    F_ARGDIGIT,                        /* 3 */
+    F_ARGDIGIT,                        /* 4 */
+    F_ARGDIGIT,                        /* 5 */
+    F_ARGDIGIT,                        /* 6 */
+    F_ARGDIGIT,                        /* 7 */
+    F_ARGDIGIT,                        /* 8 */
+    F_ARGDIGIT,                        /* 9 */
+    F_UNASSIGNED,              /* : */
+    V_RCHAR_FWD,               /* ; */
+    F_UNASSIGNED,              /* < */
+    F_UNASSIGNED,              /* = */
+    F_UNASSIGNED,              /* > */
+    V_USH_META,                        /* ? */
+    F_UNASSIGNED,              /* @ */
+    V_ADDEND,                  /* A */
+    V_WORDBACK,                        /* B */
+    V_CHGTOEND,                        /* C */
+    F_KILLEND,                 /* D */
+    V_ENDWORD,                 /* E */
+    V_CHAR_BACK,               /* F */
+    F_UNASSIGNED,              /* G */
+    F_UNASSIGNED,              /* H */
+    V_INSBEG,                  /* I */
+    F_DOWN_SEARCH_HIST,                /* J */
+    F_UP_SEARCH_HIST,          /* K */
+    F_UNASSIGNED,              /* L */
+    F_UNASSIGNED,              /* M */
+    V_RSRCH_BACK,              /* N */
+    F_XKEY,                    /* O */
+    F_UNASSIGNED,              /* P */
+    F_UNASSIGNED,              /* Q */
+    V_REPLMODE,                        /* R */
+    V_SUBSTLINE,               /* S */
+    V_CHARTO_BACK,             /* T */
+    F_UNASSIGNED,              /* U */
+    F_EXPAND_VARS,             /* V */
+    V_WORDFWD,                 /* W */
+    F_DELPREV,                 /* X */
+    F_UNASSIGNED,              /* Y */
+    F_UNASSIGNED,              /* Z */
+    F_XKEY,                    /* [ */
+    F_UNASSIGNED,              /* \ */
+    F_UNASSIGNED,              /* ] */
+    F_TOBEG,                   /* ^ */
+    F_UNASSIGNED,              /* _ */
+    F_UNASSIGNED,              /* ` */
+    V_ADD,                     /* a */
+    F_WORDBACK,                        /* b */
+    V_CHGMETA,                 /* c */
+    V_DELMETA,                 /* d */
+    V_EWORD,                   /* e */
+    V_CHAR_FWD,                        /* f */
+    F_UNASSIGNED,              /* g */
+    F_CHARBACK,                        /* h */
+    V_INSERT,                  /* i */
+    F_DOWN_HIST,               /* j */
+    F_UP_HIST,                 /* k */
+    F_CHARFWD,                 /* l */
+    F_UNASSIGNED,              /* m */
+    V_RSRCH_FWD,               /* n */
+    F_UNASSIGNED,              /* o */
+    F_UNASSIGNED,              /* p */
+    F_UNASSIGNED,              /* q */
+    V_REPLONE,                 /* r */
+    V_SUBSTCHAR,               /* s */
+    V_CHARTO_FWD,              /* t */
+    V_UNDO,                    /* u */
+    F_EXPAND_VARS,             /* v */
+    V_WORDBEGNEXT,             /* w */
+    F_DELNEXT_EOF,             /* x */
+    F_UNASSIGNED,              /* y */
+    F_UNASSIGNED,              /* z */
+    F_UNASSIGNED,              /* { */
+    F_UNASSIGNED,              /* | */
+    F_UNASSIGNED,              /* } */
+    V_CHGCASE,                 /* ~ */
+    F_DELPREV,                 /* ^? */
+    F_UNASSIGNED,              /* M-^@ */
+    F_UNASSIGNED,              /* M-^A */
+    F_UNASSIGNED,              /* M-^B */
+    F_UNASSIGNED,              /* M-^C */
+    F_UNASSIGNED,              /* M-^D */
+    F_UNASSIGNED,              /* M-^E */
+    F_UNASSIGNED,              /* M-^F */
+    F_UNASSIGNED,              /* M-^G */
+    F_UNASSIGNED,              /* M-^H */
+    F_UNASSIGNED,              /* M-^I */
+    F_UNASSIGNED,              /* M-^J */
+    F_UNASSIGNED,              /* M-^K */
+    F_UNASSIGNED,              /* M-^L */
+    F_UNASSIGNED,              /* M-^M */
+    F_UNASSIGNED,              /* M-^N */
+    F_UNASSIGNED,              /* M-^O */
+    F_UNASSIGNED,              /* M-^P */
+    F_UNASSIGNED,              /* M-^Q */
+    F_UNASSIGNED,              /* M-^R */
+    F_UNASSIGNED,              /* M-^S */
+    F_UNASSIGNED,              /* M-^T */
+    F_UNASSIGNED,              /* M-^U */
+    F_UNASSIGNED,              /* M-^V */
+    F_UNASSIGNED,              /* M-^W */
+    F_UNASSIGNED,              /* M-^X */
+    F_UNASSIGNED,              /* M-^Y */
+    F_UNASSIGNED,              /* M-^Z */
+    F_UNASSIGNED,              /* M-^[ */
+    F_UNASSIGNED,              /* M-^\ */
+    F_UNASSIGNED,              /* M-^] */
+    F_UNASSIGNED,              /* M-^^ */
+    F_UNASSIGNED,              /* M-^_ */
+    F_UNASSIGNED,              /* M-SPACE */
+    F_UNASSIGNED,              /* M-! */
+    F_UNASSIGNED,              /* M-" */
+    F_UNASSIGNED,              /* M-# */
+    F_UNASSIGNED,              /* M-$ */
+    F_UNASSIGNED,              /* M-% */
+    F_UNASSIGNED,              /* M-& */
+    F_UNASSIGNED,              /* M-' */
+    F_UNASSIGNED,              /* M-( */
+    F_UNASSIGNED,              /* M-) */
+    F_UNASSIGNED,              /* M-* */
+    F_UNASSIGNED,              /* M-+ */
+    F_UNASSIGNED,              /* M-, */
+    F_UNASSIGNED,              /* M-- */
+    F_UNASSIGNED,              /* M-. */
+    F_UNASSIGNED,              /* M-/ */
+    F_UNASSIGNED,              /* M-0 */
+    F_UNASSIGNED,              /* M-1 */
+    F_UNASSIGNED,              /* M-2 */
+    F_UNASSIGNED,              /* M-3 */
+    F_UNASSIGNED,              /* M-4 */
+    F_UNASSIGNED,              /* M-5 */
+    F_UNASSIGNED,              /* M-6 */
+    F_UNASSIGNED,              /* M-7 */
+    F_UNASSIGNED,              /* M-8 */
+    F_UNASSIGNED,              /* M-9 */
+    F_UNASSIGNED,              /* M-: */
+    F_UNASSIGNED,              /* M-; */
+    F_UNASSIGNED,              /* M-< */
+    F_UNASSIGNED,              /* M-= */
+    F_UNASSIGNED,              /* M-> */
+    F_HELPME,                  /* M-? */
+    F_UNASSIGNED,              /* M-@ */
+    F_UNASSIGNED,              /* M-A */
+    F_UNASSIGNED,              /* M-B */
+    F_UNASSIGNED,              /* M-C */
+    F_UNASSIGNED,              /* M-D */
+    F_UNASSIGNED,              /* M-E */
+    F_UNASSIGNED,              /* M-F */
+    F_UNASSIGNED,              /* M-G */
+    F_UNASSIGNED,              /* M-H */
+    F_UNASSIGNED,              /* M-I */
+    F_UNASSIGNED,              /* M-J */
+    F_UNASSIGNED,              /* M-K */
+    F_UNASSIGNED,              /* M-L */
+    F_UNASSIGNED,              /* M-M */
+    F_UNASSIGNED,              /* M-N */
+    F_XKEY,                    /* M-O *//* extended key esc PWP Mar 88 */
+    F_UNASSIGNED,              /* M-P */
+    F_UNASSIGNED,              /* M-Q */
+    F_UNASSIGNED,              /* M-R */
+    F_UNASSIGNED,              /* M-S */
+    F_UNASSIGNED,              /* M-T */
+    F_UNASSIGNED,              /* M-U */
+    F_UNASSIGNED,              /* M-V */
+    F_UNASSIGNED,              /* M-W */
+    F_UNASSIGNED,              /* M-X */
+    F_UNASSIGNED,              /* M-Y */
+    F_UNASSIGNED,              /* M-Z */
+    F_XKEY,                    /* M-[ *//* extended key esc -mf Oct 87 */
+    F_UNASSIGNED,              /* M-\ */
+    F_UNASSIGNED,              /* M-] */
+    F_UNASSIGNED,              /* M-^ */
+    F_UNASSIGNED,              /* M-_ */
+    F_UNASSIGNED,              /* M-` */
+    F_UNASSIGNED,              /* M-a */
+    F_UNASSIGNED,              /* M-b */
+    F_UNASSIGNED,              /* M-c */
+    F_UNASSIGNED,              /* M-d */
+    F_UNASSIGNED,              /* M-e */
+    F_UNASSIGNED,              /* M-f */
+    F_UNASSIGNED,              /* M-g */
+    F_UNASSIGNED,              /* M-h */
+    F_UNASSIGNED,              /* M-i */
+    F_UNASSIGNED,              /* M-j */
+    F_UNASSIGNED,              /* M-k */
+    F_UNASSIGNED,              /* M-l */
+    F_UNASSIGNED,              /* M-m */
+    F_UNASSIGNED,              /* M-n */
+    F_UNASSIGNED,              /* M-o */
+    F_UNASSIGNED,              /* M-p */
+    F_UNASSIGNED,              /* M-q */
+    F_UNASSIGNED,              /* M-r */
+    F_UNASSIGNED,              /* M-s */
+    F_UNASSIGNED,              /* M-t */
+    F_UNASSIGNED,              /* M-u */
+    F_UNASSIGNED,              /* M-v */
+    F_UNASSIGNED,              /* M-w */
+    F_UNASSIGNED,              /* M-x */
+    F_UNASSIGNED,              /* M-y */
+    F_UNASSIGNED,              /* M-z */
+    F_UNASSIGNED,              /* M-{ */
+    F_UNASSIGNED,              /* M-| */
+    F_UNASSIGNED,              /* M-} */
+    F_UNASSIGNED,              /* M-~ */
+    F_UNASSIGNED               /* M-^? */
+};
+#endif /* WINNT_NATIVE */
+
+
+void
+editinit(void)
+{
+    struct KeyFuncs *f;
+
+#if defined(NLS_CATALOGS) || defined(WINNT_NATIVE)
+    int i;
+
+    for (i = 0; i < F_NUM_FUNCNAMES; i++)
+       xfree((ptr_t)(intptr_t)FuncNames[i].desc);
+#endif
+
+    f = FuncNames;
+    f->name = "backward-char";
+    f->func = F_CHARBACK;
+    f->desc = CSAVS(3, 1, "Move back a character");
+
+    f++;
+    f->name = "backward-delete-char";
+    f->func = F_DELPREV;
+    f->desc = CSAVS(3, 2, "Delete the character behind cursor");
+
+    f++;
+    f->name = "backward-delete-word";
+    f->func = F_DELWORDPREV;
+    f->desc = CSAVS(3, 3,
+       "Cut from beginning of current word to cursor - saved in cut buffer");
+
+    f++;
+    f->name = "backward-kill-line";
+    f->func = F_KILLBEG;
+    f->desc = CSAVS(3, 4,
+       "Cut from beginning of line to cursor - save in cut buffer");
+
+    f++;
+    f->name = "backward-word";
+    f->func = F_WORDBACK;
+    f->desc = CSAVS(3, 5, "Move to beginning of current word");
+
+    f++;
+    f->name = "beginning-of-line";
+    f->func = F_TOBEG;
+    f->desc = CSAVS(3, 6, "Move to beginning of line");
+
+    f++;
+    f->name = "capitalize-word";
+    f->func = F_CASECAPITAL;
+    f->desc = CSAVS(3, 7,
+       "Capitalize the characters from cursor to end of current word");
+
+    f++;
+    f->name = "change-case";
+    f->func = V_CHGCASE;
+    f->desc = CSAVS(3, 8,
+       "Vi change case of character under cursor and advance one character");
+
+    f++;
+    f->name = "change-till-end-of-line";
+    f->func = V_CHGTOEND;      /* backward compat. */
+    f->desc = CSAVS(3, 9, "Vi change to end of line");
+
+    f++;
+    f->name = "clear-screen";
+    f->func = F_CLEARDISP;
+    f->desc = CSAVS(3, 10, "Clear screen leaving current line on top");
+
+    f++;
+    f->name = "complete-word";
+    f->func = F_COMPLETE;
+    f->desc = CSAVS(3, 11, "Complete current word");
+
+    f++;
+    f->name = "complete-wor