amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator) (03/04/91)
Submitted-by: <umueller@iiic.ethz.ch> Posting-number: Volume 91, Issue 027 Archive-name: shells/cshell-5.00/part01 [ file `shell.doc' was split to facilitate posting ...tad ] Announcing: C-Shell 5.00 C-Shell 5.00 is a legitimate follow of the Matt Dillon shell. Main features include: - Kickstart 2.0 compatible, some kick 2.0 specific features - 20 new built in commands - 70 functions like: echo @strleft( "hello world" 7 ) - Many new system variables - Residentable (finally!) - Tab file name completion - Freely programmable editing keys - Object oriented features (file classes, actions on classes) - Jump scrolling for some internal commands - Automatic cd (type a directory name to 'cd' to it) - Quick cd ('cd' to any directory without typing a path) - Intuition Menus in the console window - VT terminal compatibility, command line editing on a VT - Foreign character sets supported - Automatic RX-ing (type a .rexx file name to 'rx' it) - Unlimited number of args & commands per line Restrictions: - Due to the dramatic changes, certainly not 100% bug free. Everyday use should not be affected. The first update fill follow soon; I count on your bug reports - Executable size 85K #!/bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 1 (of 6)." # Contents: README class.sh globals.c lmakefile main.c makefile # menu.sh proto.h run.c sample.sh set.c shell.doc.ac shell.h # technotes.doc # Wrapped by tadguy@ab20 on Sun Mar 3 16:55:55 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README'\" else echo shar: Extracting \"'README'\" \(1300 characters\) sed "s/^X//" >'README' <<'END_OF_FILE' XAnnouncing: C-Shell 5.00 X XC-Shell 5.00 is a legitimate follow of the Matt Dillon shell. X XMain features include: X- Kickstart 2.0 compatible, some kick 2.0 specific features X- 20 new built in commands X- 70 functions like: echo @strleft( "hello world" 7 ) X- Many new system variables X- Residentable (finally!) X- Tab file name completion X- Freely programmable editing keys X- Object oriented features (file classes, actions on classes) X- Jump scrolling for some internal commands X- Automatic cd (type a directory name to 'cd' to it) X- Quick cd ('cd' to any directory without typing a path) X- Intuition Menus in the console window X- VT terminal compatibility, command line editing on a VT X- Foreign character sets supported X- Automatic RX-ing (type a .rexx file name to 'rx' it) X- Unlimited number of args & commands per line X XRestrictions: X- Due to the dramatic changes, certainly not 100% bug free. Everyday X use should not be affected. The first update fill follow soon; I X count on your bug reports X- Executable size 85K X X | Urban Mueller | / / | Urban Mueller | X | USENET: umueller@iiic.ethz.ch | __ / / | Schulhausstr. 83 | X | FIDONET: 2:302/906 (AUGL) | \ \/ / | CH-6312 Steinhausen | X | "Don't tell my employer" | \__/ | SWITZERLAND | X END_OF_FILE if test 1300 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi # end of 'README' fi if test -f 'class.sh' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'class.sh'\" else echo shar: Extracting \"'class.sh'\" \(1717 characters\) sed "s/^X//" >'class.sh' <<'END_OF_FILE' Xclass -n Xclass dms offs=0,444D5321 Xclass warp offs=0,57617270 Xclass zoom offs=0,5A4F4F4D Xclass lharc offs=2,2D6C68..2D Xclass zoo offs=0,5A4F4F20 Xclass arc offs=0,1a08 Xclass compr offs=0,1f9d Xclass anim offs=0,464f524d........414e494d Xclass icon offs=0,e3100001 offs=0,f34c0012 Xclass gif offs=0,474946 Xclass zip offs=0,504b0304 Xclass ppacked offs=0,50503230 X Xclass dms suff=.dms act exec="Dms write" extr="Dms write" view="Dms view" Xclass warp suff=.wrp act exec="Warp write 0 79" extr="Warp write 0 79" Xclass zoom suff=.zom act exec="Zoom" extr="Zoom" Xclass lharc suff=.lzh act exec="lharc e" extr="lharc e" view="lharc v" add="lharc a" edit=lharca Xclass zoo suff=.zoo act exec="zoo e" extr="zoo e//" view="zoo v" add="zoo a" Xclass arc suff=.arc act exec="arc e" extr="arc e" view="arc -v" Xclass zip suff=.zip act exec="unzip" extr="unzip" view="unzip l" Xclass ppacked suff=.pp act exec="ppmore" view=ppmore Xclass lhwarp suff=.lhw act exec="lhwarp write 0" Xclass anim suff=.anim act exec=showanim view=showanim Xclass gif suff=.gif act exec=virtgif view=virtgif extr="shamsharp" Xclass ilbm offs=0,464F524D........494C424D act exec=M view=M edit=dpaint Xclass text offs=0,464F524D........46545854 act edit=excellence Xclass prog offs=0,000003f300000000 act view=htype edit=newzap Xclass object suff=.o Xclass include suff=.h Xclass c_source suff=.c Xclass script suff=.sh Xclass ascii suff=.doc suff=.txt name=readme chars act view=more exec=more edit=ced Xclass "" default act view=htype edit=ced X Xalias v "%n action -a view $n;more $n" Xalias ed "%n action -a edit $n;ced $n" Xalias xt "action extr" END_OF_FILE if test 1717 -ne `wc -c <'class.sh'`; then echo shar: \"'class.sh'\" unpacked with wrong size! fi # end of 'class.sh' fi if test -f 'globals.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'globals.c'\" else echo shar: Extracting \"'globals.c'\" \(4589 characters\) sed "s/^X//" >'globals.c' <<'END_OF_FILE' X X/* X * GLOBALS.C X * X * (c)1986 Matthew Dillon 9 October 1986 X * X * Most global variables. X * X * Version 2.07M by Steve Drew 10-Sep-87 X * Version 4.01A by Carlo Borreo & Cesare Dieni 17-Feb-90 X * Version 5.00L by Urban Mueller 17-Feb-91 X * X */ X X#include "shell.h" X Xchar v_titlebar []="_titlebar"; /* Window title */ Xchar v_prompt []="_prompt"; /* your prompt (ascii command) */ Xchar v_hist []="_history"; /* set history depth (value) */ Xchar v_histnum []="_histnum"; /* set history numbering var */ Xchar v_debug []="_debug"; /* set debug mode */ Xchar v_verbose []="_verbose"; /* set verbose for source files */ Xchar v_stat []="_maxerr"; /* worst return value to date */ Xchar v_lasterr []="_lasterr"; /* return value from last comm. */ Xchar v_cwd []="_cwd"; /* current directory */ Xchar v_except []="_except"; /* "nnn;command" */ Xchar v_every []="_every"; /* executed before prompt */ Xchar v_passed []="_passed"; /* passed arguments to source file */ Xchar v_path []="_path"; /* search path for external commands*/ Xchar v_gotofwd []="_gtf"; /* set name for fwd goto name */ Xchar v_linenum []="_linenum"; /* name for forline line # */ Xchar v_lcd []="_lcd"; /* last current directory */ Xchar v_rxpath []="_rxpath"; /* path for .rexx commands */ Xchar v_hilite []="_hilite"; /* hilighting escape sequence */ Xchar v_scroll []="_scroll"; /* scroll jump in fast mode */ Xchar v_minrows []="_minrows"; /* minimum # of rows for fast scroll*/ Xchar v_result []="_result"; /* result from rxsend */ Xchar v_qcd []="_qcd"; /* file name for csh-qcd */ Xchar v_noreq []="_noreq"; /* turn off system requesters */ Xchar v_value []="_value"; /* return value of a function */ Xchar v_nobreak []="_nobreak"; /* disabling of ^C */ Xchar v_bground []="_bground"; /* started in background */ X Xstruct HIST *H_head, *H_tail; /* HISTORY lists */ X Xstruct PERROR Perror[]= { /* error code->string */ X 103, "Insufficient free storage", X 105, "Task table full", X 120, "Argument line invalid or too long", X 121, "File is not an object module", X 122, "Invalid resident library during load", X 201, "No default directory", X 202, "Object in use", X 203, "Object already exists", X 204, "Directory not found", X 205, "Object not found", X 206, "Bad stream name", X 207, "Object too large", X 209, "Action not known", X 210, "Invalid stream component name", X 211, "Invalid object lock", X 212, "Object not of required type", X 213, "Disk not validated", X 214, "Disk write protected", X 215, "Rename across devices", X 216, "Directory not empty", X 217, "Too many levels", X 218, "Device not mounted", X 219, "Seek error", X 220, "Comment too long", X 221, "Disk full", X 222, "File delete protected", X 223, "File write protected", X 224, "File read protected", X 225, "Not a DOS disk", X 226, "No disk in drive", X X /* custom error messages */ X X 500, "Bad arguments", X 501, "Label not found", X 502, "Must be within source file", X 503, "Syntax Error", X 504, "Redirection error", X 505, "Pipe error", X 506, "Too many arguments", X 507, "Destination not a directory", X 508, "Cannot mv a filesystem", X 509, "Error in command name", X 510, "Bad drive name", X 511, "Illegal number", X 512, "Out of memory", X 0, NULL X}; X Xchar **av; /* Internal argument list */ XFILE *Src_base[MAXSRC]; /* file pointers for source files */ Xlong Src_pos[MAXSRC]; /* seek position storage for same */ Xint Src_if[MAXSRC]; /* the if level at batch file start */ Xchar If_base[MAXIF]; /* If/Else stack for conditionals */ Xint H_len, H_tail_base; /* History associated stuff */ Xint H_stack; /* AddHistory disable stack */ Xint E_stack; /* Exception disable stack */ Xint Src_stack, If_stack; /* Stack Indexes */ Xint forward_goto; /* Flag for searching for foward lables */ Xint ac; /* Internal argc */ Xint max_ac=256; /* Maximum # of args (increasable) */ Xint debug; /* Debug mode */ Xint disable; /* Disable com. execution (conditionals)*/ Xint Verbose; /* Verbose mode for source files */ Xint Lastresult; /* Last return code */ Xint Exec_abortline; /* flag to abort rest of line */ Xint Quit; /* Quit flag */ Xlong Cout, Cin; /* Current input and output file handles*/ Xlong Cout_append; /* append flag for Cout */ Xchar *Cin_name, *Cout_name; /* redirection input/output name or NULL*/ Xchar *Pipe1, *Pipe2; /* the two pipe temp. files */ Xstruct Process *Myprocess; Xstruct CommandLineInterface *Mycli; Xint S_histlen = 20; /* Max # history entries */ X Xunsigned int options; Xchar Buf[280], confirmed; XCLASS *CRoot, *LastCRoot; END_OF_FILE if test 4589 -ne `wc -c <'globals.c'`; then echo shar: \"'globals.c'\" unpacked with wrong size! fi # end of 'globals.c' fi if test -f 'lmakefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'lmakefile'\" else echo shar: Extracting \"'lmakefile'\" \(1339 characters\) sed "s/^X//" >'lmakefile' <<'END_OF_FILE' X###################################################################### X# X# Makefile to build Shell 5.00A under Lattice C 5.10 X# NOTE: Our char's are UNSIGNED by default! X# X###################################################################### X XFLAGS = -ms -v -d3 -cu -cs -O XPRECOM = X#PRECOM = -HShell.syms X X# -ms = short code X# -v = no stack overflow check X# -d0 = no debug info X# -cu = unsigned chars X# -cs = no copies of string X# -m3 = code for 68030 X# -H = read precompiled header file X X X XOBJS = run.o main.o comm1.o comm2.o comm3.o execom.o set.o sub.o \ X globals.o rawcon.o X XINCL = shell.h X Xcsh : makefile $(OBJS) X BLINK lib:cres.o $(OBJS) LIB lib:lc.lib lib:amiga.lib TO csh NOICONS ND X X#shell.syms: Shell.h Proto.h X# lc -cu -ph -oShell.Syms Syms.c X Xrawcon.o : rawcon.c $(INCL) X lc $(FLAGS) $(PRECOM) rawcon.c X Xrun.o : run.c $(INCL) X lc $(FLAGS) $(PRECOM) run.c X Xmain.o : main.c $(INCL) X lc $(FLAGS) $(PRECOM) main.c X Xcomm1.o : comm1.c $(INCL) X lc $(FLAGS) $(PRECOM) comm1.c X Xcomm2.o : comm2.c $(INCL) X lc $(FLAGS) $(PRECOM) comm2.c X Xcomm3.o : comm3.c $(INCL) X lc $(FLAGS) $(PRECOM) comm3.c X Xset.o : set.c $(INCL) X lc $(FLAGS) $(PRECOM) set.c X Xsub.o : sub.c $(INCL) X lc $(FLAGS) $(PRECOM) sub.c X Xglobals.o : globals.c $(INCL) X lc $(FLAGS) $(PRECOM) globals.c X Xexecom.o : execom.c $(INCL) X lc $(FLAGS) $(PRECOM) execom.c END_OF_FILE if test 1339 -ne `wc -c <'lmakefile'`; then echo shar: \"'lmakefile'\" unpacked with wrong size! fi # end of 'lmakefile' fi if test -f 'main.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'main.c'\" else echo shar: Extracting \"'main.c'\" \(8799 characters\) sed "s/^X//" >'main.c' <<'END_OF_FILE' X/* X * MAIN.C X * X * Matthew Dillon, 24 Feb 1986 X * (c)1986 Matthew Dillon 9 October 1986 X * X * Version 2.07M by Steve Drew 10-Sep-87 X * Version 4.01A by Carlo Borreo & Cesare Dieni 17-Feb-90 X * Version 5.00L by Urban Mueller 17-Feb-91 X * X */ X X#include "shell.h" X Xvoid breakreset(void); Xstruct Window *getwindow (void); X Xchar shellname[] ="CShell V5.00L"; Xchar shellversion[]="500"; Xchar shellvers[] ="5.00"; Xchar shellctr [] ="CshCounter"; Xchar shellres [] ="CshResident"; Xchar shellv [] ="\0$VER: csh 5.00"; X Xstatic void add_residents(void); X Xchar *oldtitle; Xchar trueprompt[100]; Xchar Inline[260]; Xstruct IntuitionBase *IntuitionBase; Xstruct Window *Win; Xstruct ArpBase *ArpBase; Xint oldtaskpri=-999; X Xstatic char *defset[]={ X v_histnum, "0", X v_titlebar, shellname, X v_hist, "50", X v_lasterr, "0", X v_stat, "0", X v_path, "RAM:,RAM:c,df0:c,df1:c,sys:system", X v_rxpath, "REXX:", X v_scroll, "3", X v_minrows, "34", X v_hilite, "c7", X v_lcd, "", X v_qcd, "s:csh-qcd", X "_terminal","", X "_man", "shell.doc", X "_insert", "1", X "_version", shellversion, X "f1", "cdir df0:\15", X "F1", "cdir df1:\15", X "f3", "cdir RAM:\15", X "F3", "cdir vd0:\15", X "f4", "cd df0:\15", X "F4", "cd df1:\15", X "f5", "cls; ls\15", X "F5", "cdir ", X "f6", "ls -s\15", X "f7", "info\15", X "F7", "assign \15", X "f8", "window -lf\15", X "F8", "window -sb\15", X "f10", "cls\15", X "F10", "exit\15", X NULL, NULL X}; X Xstatic char *defalias[]={ X "cdir", "%q cd $q; cls; dir", X "cls", "echo -n ^l", X "diffdir","dir -u", X "dswap","cd $_lcd", X "exit", "endcli;quit", X "fg", "pri 0 1", X "kr", "rm -r RAM:* >NIL:", X "nice", "pri 0 -1", X "lp", "cat >PRT:", X "q", "quit", X "manlist", "sea -qwnl $_man \" *\"", X NULL, NULL X}; X X#ifndef AZTEC_C Xchkabort() X{ X return 0; X} X#endif X Xextern struct Library *DosBase; X Xmain(argc, argv) Xchar *argv[]; X{ X int i; X char buf[10]; X static char pipe1[32], pipe2[32]; X struct Window *getwindow(); X char nologin=0 , *mymem=malloc(4); X#ifdef AZTEC_C X extern int Enable_Abort; X Enable_Abort = 0; X#endif X X if( argc==0 ) /* Prevent starting from workbench */ X exit(0); X X if( !(av=malloc( max_ac*sizeof(char *)))) exit( 0 ); X X initmap(); X X if(!(ArpBase=(struct ArpBase *)OpenLibrary("arp.library",34L))) X { printf("No arp library\n"); exit(0); } X X IntuitionBase=(struct IntuitionBase *)ArpBase->IntuiBase; X X if( ArpBase->DosBase->lib_Version >= 36 ) X o_kick20=1; X set_var( LEVEL_SET, "_kick2x", (o_kick20) ? "1" : "0" ); X X if( !IsInteractive(Input())) X o_bground=1; X set_var( LEVEL_SET, v_bground, (o_bground) ? "1" : "0" ); X X X Forbid(); X i=0; X if (Getenv(shellctr,buf,10L)) i=atoi(buf); X if (Getenv(shellres,buf,10L)) o_resident=1; X sprintf(buf, "%d", i+1); X Setenv(shellctr, buf); X Permit(); X X#ifdef isalphanum X for( i='a'; i<='z'; i++ ) X isalph[i]=1; X for( i='A'; i<='Z'; i++ ) X isalph[i]=1; X for( i='0'; i<='9'; i++ ) X isalph[i]=1; X isalph['_']=1; X#endif X X#ifdef AZTEC_C X stdin->_flags |= _IONBF; /* make sure we're set as an unbuffered tty */ X stdout->_flags |= _IONBF; /* in case of redirection in .login */ X Close(_devtab[2].fd); X _devtab[2].mode |= O_STDIO; X _devtab[2].fd = _devtab[1].fd; /* set stderr to Output() otherwise */ X /* don't work with aux driver */ X#else X /* if( setvbuf( stdout,NULL,_IOLBF,BUFSIZ )) exit(20); */ X /* setnbf( stdout ); */ X /* Close( _ufbs[2] ); */ X /*_ufbs[2]=_ufbs[1]; */ X /* setnbf( stderr ); */ X#endif X X Myprocess = (struct Process *)FindTask(0L); X Mycli=(struct CommandLineInterface *)((long)Myprocess->pr_CLI << 2); X X if( !o_nowindow && (Win=getwindow()) && IsInteractive(Input())) { X oldtitle=(char *)(Win->Title); X set_menu(); X } X X Pipe1 = pipe1; X Pipe2 = pipe2; X sprintf(pipe1, "t:pipe1_%ld", mymem); X sprintf(pipe2, "t:pipe2_%ld", mymem); X X sprintf(buf,"%ld",Myprocess->pr_TaskNum); X set_var(LEVEL_SET, "_clinumber", buf); X X seterr(); X if (Myprocess->pr_CurrentDir == NULL) X do_cd("x :"); X else do_pwd(NULL); X X o_nowindow= 1; X X set_var(LEVEL_SET,v_prompt, (IsInteractive(Input())) ? "%c%p> ":""); X for( i=0; defset[i]; i+=2 ) X set_var( LEVEL_SET, defset[i], defset[i+1] ); X for( i=0; defalias[i]; i+=2 ) X set_var( LEVEL_ALIAS, defalias[i], defalias[i+1] ); X X o_nowindow= 0; X X for (i = 1; i < argc; ++i) { X if (*argv[i]=='-') { X char *str=argv[1]; X X if( index(str,'k') ) set_var(LEVEL_SET,v_nobreak,"1"); X if( index(str,'i') ) o_internal=1; X if( index(str,'r') ) add_residents(); X if( index(str,'v') ) Verbose=1, set_var(LEVEL_SET,v_verbose,"1"); X if( index(str,'n') ) nologin=TRUE; X if( index(str,'b') ) { X oldtaskpri=Myprocess->pr_Task.tc_Node.ln_Pri; X SetTaskPri( &Myprocess->pr_Task, -1 ); X } X if( index(str,'f') ) { X oldtaskpri=Myprocess->pr_Task.tc_Node.ln_Pri; X SetTaskPri( &Myprocess->pr_Task, 1 ); X } X if( index(str,'c') ) { X Inline[0] = ' '; X Inline[1] = '\0'; X while (++i < argc) X { strcat(Inline,argv[i]); strcat(Inline," "); } X exec_command(Inline); X main_exit(Lastresult); X } X if( index(str,'a')) { X o_nowindow= o_noraw= 1; X set_var( LEVEL_SET, v_hilite, "" ); X } X if( index(str,'t')) { X o_nowindow= o_vt100= o_nofastscr= 1; X /* clr */ X set_var( LEVEL_SET, v_hilite, "r" ); X set_var( LEVEL_SET, v_noreq, "1" ); X set_var( LEVEL_SET, "_terminal", "1" ); X set_var( LEVEL_ALIAS, "cls", "e -n ^[[0\\;0H^[[J" ); X } X } else { X sprintf (Inline, "source %s",argv[i]); X av[1] = argv[i]; X do_source (Inline); X } X } X X if (!nologin && exists(av[1] = "S:.login")) do_source("x S:.login"); X X for (;;) { X if (breakcheck()) X#ifdef AZTEC_C X while (WaitForChar(Input(), 100L) || stdin->_bp < stdin->_bend) X#else X while (WaitForChar(Input(), 100L) || stdin->_rcnt != stdin->_wcnt ) X#endif X gets(Inline); X clearerr(stdin); /* prevent acidental quit */ X exec_every(); X update_sys_var(v_titlebar); X update_sys_var(v_prompt); X breakreset(); X#if RAW_CONSOLE X if (Quit || !rawgets(Inline, disable ? "_ " : trueprompt)) main_exit(0); X#else X printf("%s", disable ? "_ " : trueprompt); X fflush(stdout); X if (Quit || !gets(Inline)) main_exit(0); X#endif X breakreset(); X if (*Inline) exec_command(Inline); X } X} X Xvoid Xmain_exit(n) X{ X int i; X char buf[10]; X X Getenv(shellctr,buf,10L); X i=atoi(buf); X sprintf(buf,"%d",i-1); X Setenv(shellctr,buf); X if( oldtitle ) X SetWindowTitles(Win,oldtitle,(char *)-1); X if( oldtaskpri != -999 ) X SetTaskPri(&Myprocess->pr_Task,oldtaskpri); X for (i=1; i<MAXMYFILES; i++) myclose(i); X remove_menu(); X CloseLibrary((struct Library *)ArpBase); X exit(0); X} X Xint Xbreakcheck() X{ X return !o_nobreak && SetSignal(0L,0L) & SIGBREAKF_CTRL_C; X} X Xvoid Xbreakreset() X{ X SetSignal(0L, SIGBREAKF_CTRL_C|SIGBREAKF_CTRL_D); X} X Xdobreak() X{ X if (breakcheck()) { printf("^C\n"); return(1); } X return(0); X} X X/* this routine causes manx to use this Chk_Abort() rather than it's own */ X/* otherwise it resets our ^C when doing any I/O (even when Enable_Abort */ X/* is zero). Since we want to check for our own ^C's */ X Xlong XChk_Abort() X{ X return(0); X} X Xvoid X_wb_parse() X{ X} X Xdo_howmany() X{ X char buf[10]; X X Getenv(shellctr, buf, 10L); X printf("Shell(s) running: %s\n",buf); X return 0; X} X Xstatic struct Window * Xgetwindow() X{ X struct InfoData *infodata; X struct Window *win; X long args[8]; X X if( o_nowindow ) X return NULL; X infodata=(void *)AllocMem((long)sizeof(struct InfoData),MEMF_CLEAR|MEMF_PUBLIC); X args[0]=(long)infodata >> 2; X Write(Output(),"",1); /* make window appear */ X SendPacket(ACTION_DISK_INFO,args,(void *)Myprocess->pr_ConsoleTask); X win=(struct Window *)infodata->id_VolumeNode; X FreeMem(infodata,(long)sizeof(struct InfoData)); X if( win==NULL ) X o_nowindow=1; X newwidth(); X return win; X} X X#ifndef AZTEC_C X Xchar * Xrindex( char *str , char c ) X{ X char *ret=NULL; X X for( ; *str; str++ ) X if( *str==c ) X ret=str; X return ret; X} X X#endif X Xextern struct DosLibrary *DOSBase; X Xstruct ResidentList { X BPTR rl_Next; X LONG rl_UseCount; X BPTR rl_SegList; X char rl_SegName[1]; X}; X X Xstatic void Xadd_residents() X{ X char buf[80], *g, *p, c; X struct RootNode *Node; X struct DosInfo *Info; X struct ResidentList *res; X struct ResidentProgramNode *rpn; X X if( ArpBase->ResidentPrgList ) X return; X X Forbid(); X Node=(struct RootNode *)DOSBase->dl_Root; X Info=(struct DosInfo *)(Node->rn_Info*4); X res=(struct ResidentList *)((long)Info->di_NetHand*4); X X for( ; res; res=(struct ResidentList *)((long)res->rl_Next*4) ) { X g=res->rl_SegName, p=buf; X for( c=*g++; c>0; --c ) *p++=*g++; X *p=0; X if( res->rl_UseCount>=0 ) X res->rl_UseCount++; X else X continue; X AddResidentPrg( res->rl_SegList, buf); X for(rpn=ArpBase->ResidentPrgList; rpn; rpn=rpn->rpn_Next) X if( rpn->rpn_Segment==res->rl_SegList ) X rpn->rpn_Usage++; X } X Permit(); X} END_OF_FILE if test 8799 -ne `wc -c <'main.c'`; then echo shar: \"'main.c'\" unpacked with wrong size! fi # end of 'main.c' fi if test -f 'makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'makefile'\" else echo shar: Extracting \"'makefile'\" \(1302 characters\) sed "s/^X//" >'makefile' <<'END_OF_FILE' X###################################################################### X# X# Makefile to build Shell 5.00 under Aztec C 5.0d X# make sure you use 5.0d or above, as setenv() has changed X# NOTE: Our chars are UNSIGNED by default! X# X###################################################################### X XOBJS = run.o main.o comm1.o comm2.o comm3.o execom.o set.o sub.o \ X globals.o rawcon.o X XINCL = shell.syms X XERRFILE = XFLAGS = -pp -wurp -ssr $(ERRFILE) XDEBUG = -bs XPRECOM = -hiShell.syms X Xcsh: makefile shell.syms $(OBJS) X ln +q -m -g -o csh $(OBJS) -larpl -lc X Xshell.syms : shell.h proto.h X cc -pp -hoShell.syms shell.h -DAZTEC_C X Xrawcon.o : rawcon.c $(INCL) X cc $(DEBUG) $(FLAGS) $(PRECOM) rawcon.c X Xrun.o : run.c $(INCL) X cc $(DEBUG) $(FLAGS) $(PRECOM) run.c X Xmain.o : main.c $(INCL) X cc $(DEBUG) $(FLAGS) $(PRECOM) main.c X Xcomm1.o : comm1.c $(INCL) X cc $(DEBUG) $(FLAGS) $(PRECOM) comm1.c X Xcomm2.o : comm2.c $(INCL) X cc $(DEBUG) $(FLAGS) $(PRECOM) comm2.c X Xcomm3.o : comm3.c $(INCL) X cc $(DEBUG) $(FLAGS) $(PRECOM) comm3.c X Xset.o : set.c $(INCL) X cc $(DEBUG) $(FLAGS) $(PRECOM) set.c X Xsub.o : sub.c $(INCL) X cc $(DEBUG) $(FLAGS) $(PRECOM) sub.c X Xglobals.o : globals.c $(INCL) X cc $(DEBUG) $(FLAGS) $(PRECOM) globals.c X Xexecom.o : execom.c $(INCL) X cc $(DEBUG) $(FLAGS) $(PRECOM) execom.c END_OF_FILE if test 1302 -ne `wc -c <'makefile'`; then echo shar: \"'makefile'\" unpacked with wrong size! fi # end of 'makefile' fi if test -f 'menu.sh' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'menu.sh'\" else echo shar: Extracting \"'menu.sh'\" \(982 characters\) sed "s/^X//" >'menu.sh' <<'END_OF_FILE' X# This installs an intuition menu with all editing keys X Xmenu -n Move \ X "Left CursL",\ X "Right CursR",\ X "WordLeft S-CursL",\ X "WordRight S-CursR",\ X "BegOfLine ^A",^a\ X "EndOfLine ^E",^e X Xmenu Delete \ X "Left BkSpc",^h\ X "Right Del",\177\ X "WordLeft ^W",^[^h\ X "WordRight ESC-Del",^[\177\ X "To BOL ^B",^[x^h\ X "To EOL ^K",^[x\177\ X "Line ^X",^[d X Xmenu History \ X "Back CursU",\ X "Forward CursD",\ X "Start S-CursU",\ X "End S-CursD",\ X "Complete ESC-!",^[!\ X "Get tail ^T",^T X Xmenu Complete \ X "One TAB",^I\ X "Partial S-TAB",\ X "All ESC-TAB",^[^I\ X "QuickCD ESC-c",^[c\ X "LastCD ESC-~",^[~ X Xmenu Execute \ X "Now RETURN",^M\ X "+Hist ESC-RETURN",^[^M\ X "Not ^N",^N\ X "Exit ^\", X Xmenu Misc \ X "Undo ^U",^U\ X "Repeat ^R",^R\ X "Retype ^L",^L\ X "Ins/Ovr ESC-i",^[i X END_OF_FILE if test 982 -ne `wc -c <'menu.sh'`; then echo shar: \"'menu.sh'\" unpacked with wrong size! fi # end of 'menu.sh' fi if test -f 'proto.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'proto.h'\" else echo shar: Extracting \"'proto.h'\" \(5157 characters\) sed "s/^X//" >'proto.h' <<'END_OF_FILE' X/* main.c */ Xint main(int argc, char **argv); Xvoid main_exit(int n); Xint breakcheck(void); Xint dobreak(void); Xlong Chk_Abort(void); Xvoid _wb_parse(void); Xint do_howmany(void); Xvoid breakreset(void); X X/* comm1.c */ Xint do_sleep(void); Xint do_protect(void); Xint do_filenote(void); Xint do_cat(void); Xvoid get_drives(char *buf); Xchar *drive_name(char *name); Xchar *oneinfo( char *name, int function ); Xint do_info(void); Xint do_dir(void); Xchar *formatfile(struct file_info *info); Xint do_quit(void); Xint do_echo(void); Xint do_source(char *str ); Xint do_pwd(char *str ); Xint do_cd(char *str ); Xchar *quick_cd( char *buf, char *name, int repeat ); Xint do_mkdir(void); Xint do_mv(void); Xint all_args(int (*action)(char *str), int dirsflag); Xint do_search(void); Xint do_rm(void); Xint do_history(void); Xint do_mem(void); Xint do_forline(void); Xint do_fornum(void); Xint do_foreach(void); Xint do_forever(char *str); Xint do_window(void); Xchar *dates(struct DateStamp *dss); Xint do_date(void); X X/* comm2.c */ Xint do_abortline(void); Xint do_return(void); Xint do_strhead(void); Xint do_strtail(void); Xint do_if(char *garbage, int com); Xint do_label(void); Xint do_goto(void); Xint do_inc(char *garbage, int com); Xint do_input(void); Xint do_ver(void); Xint do_ps(void); Xint do_copy(void); Xint do_touch(void); Xint do_addbuffers(void); Xint do_relabel(void); Xint do_diskchange(void); Xint dofunc(int id, char **av, int ac); X X/* comm3.c */ Xint do_tee(void); Xint do_head(char *garbage, int com); Xvoid man(struct __stdio *f, char *s); Xint do_man(void); Xint do_assign(void); Xint do_join(void); Xint do_strings(void); Xint do_open(void); Xint do_close(void); Xvoid myclose(int n); Xint do_fileslist(void); Xlong extOpen(char *name, long mode); Xvoid extClose(long fh); Xint do_basename(void); Xint do_tackon(void); Xint do_resident(void); Xint loadres(char *s); Xint do_truerun(char *avline, int backflag); Xint exists(char *name); Xint do_aset(void); Xint do_htype(void); Xint do_stack(void); Xint do_fault(void); Xint eval_rpn(char **av, int ac, int flag); Xint do_rpn(char *garbage, int ifflag); Xint do_path(void); Xint do_pri(void); Xint do_strleft(void); Xint do_strright(void); Xint do_strmid(void); Xint do_strlen(void); Xint myatoi(char *s, int min, int max); Xint unlatoi(char *s); Xint posatoi(char *s); Xint do_fltlower(void); Xint do_fltupper(void); Xint do_linecnt(void); Xint do_uniq(void); Xint do_rxsend(char *avline); Xint do_rxrec(void); Xint do_rxreturn(void); Xint do_waitport(void); Xint do_ascii(void); Xvoid appendslash(char *path); Xint do_whereis(void); Xint do_usage(void); Xint do_menu(void); Xvoid remove_menu(void); Xvoid set_menu(void); Xint do_getenv(void); Xint do_setenv(void); Xchar **read_file(struct __stdio *file, int *ac); Xvoid free_file(char **ptr); Xint do_qsort(void); Xint do_truncate(void); Xint do_split(void); X X/* execom.c */ Xvoid *mymalloc(int len); Xint exec_command(char *base); X#ifndef isalphanum Xint isalphanum(char c); X#endif Xchar *exec_function(char *str, char **fav, int fac); Xint do_help(void); Xvoid exec_every(void); Xvoid show_usage(char *str); Xint do_exec(char *str); Xint interactive(void); Xchar *a0tospace(char *str); Xint execute( char *str ); Xchar *find_internal(char *str); X X/* sub.c */ Xchar *getclass(char *file); Xvoid seterr(void); Xchar *next_word(char *str); Xchar *compile_av(char **av, int start, int end, char delim, int quote); Xvoid Free(void *ptr); Xvoid add_history(char *str); Xchar *get_history(char *ptr, int echo); Xvoid replace_head(char *str); Xvoid pError(char *str); Xint ierror(char *str, int err); Xstruct DPTR *dopen(char *name, int *stat); Xint dclose(struct DPTR *dp); Xint isdir(char *file); Xvoid free_expand(char **av); Xchar **expand(char *base, int *pac); Xchar *strupr(char *s); Xchar *strlwr(char *s); Xint compare_ok(char *wild, char *name, int casedep); Xvoid expand_all(char *name, struct __stdio *file); Xint cmp(char *s1, char *s2); Xint sizecmp(char *s1, char *s2); Xint datecmp(char *s1, char *s2); Xint classcmp(char *s1, char *s2); Xvoid QuickSort(char **av, int n); Xvoid DirQuickSort(char **av, int n, int (*func)(char *,char *), int rev); Xint filesize(char *name); Xchar **and(char **av1, int ac1, char **av2, int ac2, int *ac, int base); Xchar **without(char **av1, int ac1, char **av2, int ac2, int *ac, int base); Xchar **or(char **av1, int ac1, char **av2, int ac2, int *ac, int base); Xvoid clear_archive_bit(char *name); Xchar *itoa( int i ); Xchar *itok( int i ); Xchar *getaction( char *class, char *action ); Xint doaction( char *file, char *action, char *args ); X X/* set.c */ Xvoid set_var(int level, char *name, char *str); Xvoid update_sys_var( char *name ); Xvoid set_var_n(int level, char *name, char *str, int n); Xchar *get_var(int level, char *name); Xvoid unset_level(int level); Xvoid unset_var(int level, char *name); Xint do_unset_var(char *str, int level); Xint do_set_var(char *command, int level); X X/* rawconsole.c */ Xint newwidth(void); Xvoid initmap(void); Xchar *rawgets(char line[], char prompt[]); Xvoid prepscroll(int fromtee); Xvoid quickscroll(void); Xvoid setrawcon( long flag, int ievent ); X X/* run.c */ Xint do_run(char *str); Xchar *dofind(char *cmd, char *ext, char *buf, char *path); X#ifndef AZTEC_C Xchar *rindex( char *str , char c ); X#endif END_OF_FILE if test 5157 -ne `wc -c <'proto.h'`; then echo shar: \"'proto.h'\" unpacked with wrong size! fi # end of 'proto.h' fi if test -f 'run.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'run.c'\" else echo shar: Extracting \"'run.c'\" \(4716 characters\) sed "s/^X//" >'run.c' <<'END_OF_FILE' X X/* X * RUN.C X * X * (c)1986 Matthew Dillon 9 October 1986 X * X * RUN handles running of external commands. X * X * Version 2.07M by Steve Drew 10-Sep-87 X * Version 4.01A by Carlo Borreo & Cesare Dieni 17-Feb-90 X * Version 5.00L by Urban Mueller 17-Feb-91 X * X */ X X#include "shell.h" X Xchar *rindex(); Xint MySyncRun( char *com, char *args, BPTR in, BPTR out ); Xint echofunc(void); Xlong IoError; X Xint Xdo_run( char *str ) X{ X int retcode; X char buf[200]; /* enough space for 100 char cmd name + path stuff */ X char *path, *argline, *trueargline, *copy, *ext, *dst, *end; X X if( !*av[0] ) X return 0; X X if( (retcode=echofunc())>=0 ) X return retcode; X X a0tospace( av[0] ); /* allow "com mand" */ X X IoError=0; X if( ac==1 && (isdir(av[0]) || !strcmp( av[0],"..") || !strcmp(av[0],"~"))) { X if( !strcmp(av[0],"~") && (dst=get_var(LEVEL_SET,v_lcd)) ) X sprintf(buf,"cd %s",dst); X else X sprintf(buf,"cd %s",av[0]); X execute( buf ); X return 0; X } X X if( (IoError==218 || IoError==225 || IoError==226) && index(av[0],':')) { X ierror( av[0], IoError ); X return 20; X } X X argline=compile_av(av, 1, ac, ' ', 1); X trueargline= (*argline ? argline : "\n"); X X if (strlen(av[0]) > 100) { ierror(NULL,509); return -1; } X X sprintf(buf,"res_%s",BaseName(av[0])); /* delayed residents */ X if (o_resident && Getenv(buf, buf+100, 90L) && loadres(av[0])) X Setenv(buf,NULL); X X if( (retcode=MySyncRun(av[0],trueargline,0L,0L))>=0 ) /* AmigaDOS path */ X goto done2; X X strcpy(buf,"source "); X if (path = dofind(av[0],"",buf+7,v_path)) { /* shell path */ X if((retcode = MySyncRun(path,trueargline,0L,0L))>=0) X goto done2; X else { X struct DPTR *dp; X int stat; X if(dp=dopen(path,&stat)) { X stat=dp->fib->fib_Protection & FIBF_SCRIPT; X dclose(dp); X if( stat ) { X execute(buf); X return 0; X } X } X } X } X X if(!(end=rindex(av[0],'.'))) end=""; /* automatic sourcing */ X ext=strcmp(end,".sh") ? ".sh" : ""; X if (path = dofind(av[0],ext,buf,v_path)) { X av[1] = buf; X copy = malloc(strlen(str)+3); X sprintf(copy,"x %s",str); X retcode = do_source(copy); X goto done; X } X X copy=malloc(strlen(av[0])+strlen(argline)+5); X sprintf(copy,"%s %s",av[0],trueargline); X X ext=strcmp(end,".rexx") ? ".rexx" : ""; /* automatic rx-ing */ X if( path = dofind(av[0], ext, buf, v_rxpath )) { X if( (retcode=MySyncRun("rx",copy,0L,0L)) >=0 ) goto done; X if (path = dofind("rx","",buf,v_path)) { X retcode = MySyncRun(path,copy,0L,0L); X goto done; X } X } X X if( !doaction(av[0],"exec",argline)) { X retcode=0; X goto done; X } X X retcode=-1; X fprintf(stderr,"Command Not Found %s\n",av[0]); X Xdone: X free( copy ); Xdone2: X free( argline ); X return retcode; X} X Xstruct Segment { X BPTR NextEntry; X LONG UseCount; X BPTR SegPtr; X BSTR SegName; X}; X Xint XMySyncRun( char *com, char *args, BPTR in, BPTR out ) X{ X struct Segment *seg; X int ret; X char buf2[84], *buf=buf2; X long oldname; X X#ifdef KICK20 X if( o_kick20 ) { X oldname = (long)Mycli->cli_CommandName; X X while( (long)buf & 3 ) buf++; X buf[0] = strlen( com ); X strncpy(buf+1,com,80); X X Forbid(); X seg=FindSegment( com, NULL, 0 ); X Permit(); X if( seg ) { X Mycli->cli_CommandName = (long)buf/4; X seg->UseCount++; X X ret=RunCommand(seg->SegPtr, Mycli->cli_DefaultStack, X args, strlen(args)); X seg->UseCount--; X Mycli->cli_CommandName = (long)oldname; X return ret; X } X X if( o_internal ) { X Forbid(); X seg=FindSegment( com, NULL, 1 ); X Permit(); X if( seg ) { X Mycli->cli_CommandName = (long)buf/4; X X ret=RunCommand(seg->SegPtr, Mycli->cli_DefaultStack, X args, strlen(args)); X Mycli->cli_CommandName = (long)oldname; X return ret; X } X } X X } X#endif X if( (ret= SyncRun( com, args, in, out ))>=0 ) X return ret; X X return ret; X} X Xint Xdo_which( char *str ) X{ X char *got, *com=av[1]; X X if( get_var(LEVEL_ALIAS,com) ) { X printf("Shell Alias '%s'\n",com); X return 0; X } X X if( *(got=find_internal( com ))>1 ) { X printf("Shell Internal '%s'\n",got); X return 0; X } X X X X printf( "Not found\n" ); X return 20; X} X X Xchar * Xdofind( char *cmd, char *ext, char *buf, char *path) X{ X char *ptr, *s=path; X X Myprocess->pr_WindowPtr = (APTR)(-1); X sprintf(buf,"%s%s",cmd,ext); X if (exists(buf)) return buf; X if (BaseName(buf)==buf) { X if( *path=='_' ) X s = get_var(LEVEL_SET, path); X while (*s) { X for (ptr=buf; *s && *s!=','; ) *ptr++ = *s++; X if( ptr[-1]!=':' && ptr[-1]!='/') X *ptr++='/'; X sprintf(ptr, "%s%s", cmd, ext); X if (exists(buf)) { X Myprocess->pr_WindowPtr = (APTR)o_noreq; X return buf; X } X if (*s) s++; X } X } X Myprocess->pr_WindowPtr = (APTR)o_noreq; X return NULL; X} END_OF_FILE if test 4716 -ne `wc -c <'run.c'`; then echo shar: \"'run.c'\" unpacked with wrong size! fi # end of 'run.c' fi if test -f 'sample.sh' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'sample.sh'\" else echo shar: Extracting \"'sample.sh'\" \(926 characters\) sed "s/^X//" >'sample.sh' <<'END_OF_FILE' X# first a few useful aliases X Xal d "dir -hq" # hides .info and block lengths Xal lst "ls -t" # sorts by access time Xal lsl "ls -l" # sorts by length X X# sc searches *.c, even 'sc -c main()' works X Xal sc "%a search @pickopts( $a ) *.c @pickargs( $a ) X X# edf edits a function in Cygnus Ed if the name starts in the first column: X Xal edf "%func set b \"\";search -afl *.c $func | inp b;\ X if $b;split b file line;ed $file;waitforport rexx_ced;\ X inc line 1;rxs rexx_ced \"jump to file \"$file \"jumpto \"$line\" 0\";\ X else;\ X echo Not found;\ X endif X X# this aliases suppress wild card expansion for certain commands X Xal zoo "*a Zoo $a Xal lharc "*a Lharc $a Xal lz "*a Lz $a Xal newlist "*a Newlist $a X X# pushd pushes the current directory on a stack X# popd retrieves it from there X Xset stk "" Xal pushd "set stk $_cwd @subwords( $stk 1 10 );" Xal popd "\\cd @first( $stk );set stk @subwords( $stk 2 10 );" END_OF_FILE if test 926 -ne `wc -c <'sample.sh'`; then echo shar: \"'sample.sh'\" unpacked with wrong size! fi # end of 'sample.sh' fi if test -f 'set.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'set.c'\" else echo shar: Extracting \"'set.c'\" \(6486 characters\) sed "s/^X//" >'set.c' <<'END_OF_FILE' X X/* X * SET.C X * X * (c)1986 Matthew Dillon 9 October 1986 X * X * Version 2.07M by Steve Drew 10-Sep-87 X * Version 4.01A by Carlo Borreo & Cesare Dieni 17-Feb-90 X * Version 5.00L by Urban Mueller 17-Feb-91 X * X */ X X#include "shell.h" X Xstatic char *sys_expand( char *str, char *t ); Xstatic void set_sys_var( char *name ); X X#define MAXLEVELS (3+MAXSRC) X#define HASH 32 X Xtypedef struct VNode { X struct VNode *next; X char *text; X char name[1]; X} NODE; X Xtypedef struct VRoot { X NODE *first[HASH]; X} ROOT; X XROOT Mbase[ MAXLEVELS ]; X Xvoid Xset_var( int level, char *name, char *str ) X{ X NODE **first=&Mbase[level].first[*name & HASH-1], *node; X char *t, c; X X if( !str ) str=""; X X for( t=name; isalphanum(*t); t++ ) ; X c=*t; *t=0; X X for( node=*first; node; node=node->next ) X if( !strcmp( node->name, name) ) { X free( node->text ); X goto copy; X } X X node=malloc(sizeof(NODE) + strlen(name)); X node->next=*first; X *first=node; X strcpy( node->name, name ); X Xcopy: X node->text=strcpy( malloc(strlen(str)+1), str ); X *t=c; X if( *name=='_' ) X set_sys_var( name ); X} X X Xchar * Xget_var( int level, char *name ) X{ X NODE *node=Mbase[level].first[*name & HASH-1]; X char *t, c; X X for ( t= name; *(signed char *)t > 0; t++ ) ; /* *t!=0 && *t<0x80 */ X c=*t; *t=0; X X for( ; node; node=node->next ) X if( !strcmp(node->name,name) ) X { *t=c; return node->text; } X *t=c; X return NULL; X} X Xvoid Xunset_level( int level ) X{ X NODE *node; X int i; X X for( i=0; i<HASH; i++ ) { X for( node=Mbase[level].first[i]; node; node=node->next ) { X Free ( node->text ); X Free ( node ); X } X Mbase[level].first[i] = NULL; X } X} X Xvoid Xunset_var( int level, char *name ) X{ X NODE **first=&Mbase[level].first[*name & HASH-1], *node, *prev; X char *t, c; X X for( t=name; isalphanum(*t); t++ ) ; X c=*t; *t=0; X X for( node=*first, prev=NULL; node; prev=node, node=node->next ) X if( !strcmp( node->name, name) ) { X if( prev ) prev->next=node->next; else *first=node->next; X Free( node->text ); X Free( node ); X if( *name=='_' ) X set_sys_var( name ); X break; X } X *t=c; X} X X Xvoid Xset_var_n( int level, char *name, char *str, int n ) X{ X char c, len=strlen(str); X X if( n>len ) X n=len; X X if( n>=0 ) { X c=str[n]; str[n]=0; X set_var( level, name, str ); X str[n]=c; X } else X set_var( level, name, "" ); X} X Xint Xdo_unset_var( char *str, int level ) X{ X int i; X X for (i = 1; i < ac; ++i) X unset_var (level, av[i]); X return 0; X} X Xint Xdo_set_var( char *command, int level ) X{ X ROOT *root = &Mbase[level]; X NODE *node; X int i; X char *str; X X switch (ac) { X case 1: X for( i=0; i<HASH && !breakcheck(); i++ ) X for( node=root->first[i]; node && !dobreak(); node=node->next ) X printf ("%s%-10s %s\n", o_lolite, node->name, node->text); X break; X case 2: X if (str=get_var(level,av[1])) printf ("%-10s %s\n", av[1], str); X break; X default: X set_var (level, av[1], next_word (next_word (command))); X break; X } X return 0; X} X X Xextern char shellvers[]; X Xstatic char * Xsys_expand( char *str, char *t ) X{ X struct DateStamp dss; X DateStamp(&dss); X X if( !str ) { X *t=0; X return t; X } X X while (*str) X if (*str=='%') { X str+=2; X switch( str[-1] ) { X case 'p': t+=sprintf(t,"%s", get_var(LEVEL_SET, "_cwd")); break; X case 'm': t+=sprintf(t,"%d", AvailMem( 0 )/1024); break; X case 't': t+=sprintf(t,"%s", next_word(dates(&dss))); break; X case 'd': sprintf(t,"%s", dates(&dss)); t=index(t,' ');break; X case 'c': t+=sprintf(t,"%s", o_hilite); break; X case 'v': t+=sprintf(t,"%s", shellvers ); break; X case 'n': t+=sprintf(t,"%s", get_var(LEVEL_SET,"_clinumber"));break; X case 'h': t+=sprintf(t,"%s", get_var(LEVEL_SET, v_histnum)); break; X case 'f': t+=sprintf(t,"%s", oneinfo(get_var(LEVEL_SET,v_cwd),4));break; X case 'r': t+=sprintf(t,"%d", (SBYTE)Myprocess->pr_Task.tc_Node.ln_Pri);break; X default : *t++=str[-1]; X } X } X else *t++=*str++; X *t=0; X return t; X} X Xchar truetitle[200]; X Xchar o_hilite[24], o_lolite[8], *o_csh_qcd, o_kick20, o_nobreak; Xchar o_minrows, o_scroll, o_nowindow, o_noraw, o_vt100, o_nofastscr; Xchar o_nobreak, o_bground, o_resident, o_internal; Xlong o_noreq; X Xextern char trueprompt[100]; X Xstatic void Xset_sys_var( char *name ) X{ X char *get, *str, c=name[1], col; X X if( c==v_debug [1] ) debug = get_var(LEVEL_SET,v_debug )!=NULL; X if( c==v_verbose[1] ) Verbose= get_var(LEVEL_SET,v_verbose)!=NULL; X if( c==v_nobreak[1] ) o_nobreak=get_var(LEVEL_SET,v_nobreak)!=NULL; X if( c==v_hilite [1] && !strcmp( name, v_hilite)) { X o_hilite[0]=o_lolite[0]=0; X get= get_var(LEVEL_SET,v_hilite); X str= o_hilite; X while( get && *get ) { X switch( *get++ ) { X case 'b': str+=sprintf( str, "\033[1m" ); break; X case 'i': str+=sprintf( str, "\033[3m" ); break; X case 'u': str+=sprintf( str, "\033[4m" ); break; X case 'r': str+=sprintf( str, "\033[7m" ); break; X case 'c': str+=strlen(str); X if( *get>='0' && *get<='9' ) { X col=*get++; X if( *get==',' && get[1]>='0' && get[1]<='9' ) { X str+=sprintf( str,"\033[3%cm\033[4%cm",col,get[1]); X get+=2; X } else X str+=sprintf( str,"\033[3%cm",col ); X } X break; X } X } X *str=0; X if( *o_hilite ) X strcpy(o_lolite,"\033[m"); X strcpy(sys_expand(str,trueprompt),o_lolite); X } X if( c==v_scroll[1] ) { X o_scroll=0; X if( (str= get_var(LEVEL_SET,v_scroll))) { X o_scroll=atoi( str ); X if( o_scroll<2 ) o_scroll=0; X if( o_scroll>8 ) o_scroll=8; X } X } X if( c==v_minrows[1] ) { X o_minrows=34; X if( (str= get_var(LEVEL_SET,v_minrows))) { X o_minrows=atoi( str ); X if( o_minrows<8 ) o_minrows=8; X if( o_minrows>100 ) o_minrows=100, o_scroll=0; X } X } X if( c==v_qcd[1] ) { X o_csh_qcd="s:csh-qcd"; X if( str=get_var(LEVEL_SET,v_qcd) ) X o_csh_qcd=str; X } X if( c==v_noreq[1] ) { X o_noreq= get_var(LEVEL_SET,v_noreq ) ? -1 : 0; X Myprocess->pr_WindowPtr = (APTR)o_noreq; X } X if( c==v_hist[1] ) X S_histlen=(str= get_var(LEVEL_SET, v_hist)) ? atoi(str) : 0; X if( c==v_titlebar[1] ) X update_sys_var( v_titlebar ); X} X Xvoid Xupdate_sys_var( char *name ) X{ X char c=name[1], *str, buf[250]; X X if( c==v_prompt[1] ) { X if( (str=get_var(LEVEL_SET,v_prompt) ) ==NULL) str="$ "; X strcpy(sys_expand(str,trueprompt),o_lolite); X } X if( c==v_titlebar[1] && !o_nowindow && Win ) { X sys_expand( get_var(LEVEL_SET, v_titlebar), buf); X if (strcmp(Win->Title, buf)) { X strcpy(truetitle,buf); X SetWindowTitles(Win, truetitle, (char *)-1); X } X } X} END_OF_FILE if test 6486 -ne `wc -c <'set.c'`; then echo shar: \"'set.c'\" unpacked with wrong size! fi # end of 'set.c' fi if test -f 'shell.doc.ac' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'shell.doc.ac'\" else echo shar: Extracting \"'shell.doc.ac'\" \(10945 characters\) sed "s/^X//" >'shell.doc.ac' <<'END_OF_FILE' X in the next chapter which aliases all those cases. X - because the 'if' command works differently now, variables with X embedded stand-alone '<' or '<=' type operators will cause problems X if they are on the left side in an 'if' statement: X set a b "<" c;if $a > x;echo b > x;end --> b > x X - A question mark '?' as the only argument to a command now shows the X usage of that command and does NOT pattern match. X XXII. EXAMPLE SOURCE FILES X------------------------- X XIf from a CLI or the startup-script you say 'SHELL filename', that file is Xsourced first. X X### compat.sh ### X X# this makes sure that your old abbreviations don't call new commands X Xalias as aset Xalias cl close Xalias g goto Xalias h help Xalias he help Xalias m md Xalias q quit Xalias re rename Xalias w window X Xalias kr "rm -r ram:* >NIL: X X### End of compat.sh ### X X XMoreover, if you have a file called S:.login, it will be sourced for every XShell you run. This is useful for aliases and setting that you want in ALL XShells. X X X### Example S:.login ### X XHere is an example .login file: X Xset F5 "cdir WORK:"^M Xset f9 "ed s:login.sh"^M Xset F9 "ed df0:s/startup-sequence"^M X Xalias toram "%q foreach i ( $q ) \"cp -r $i: ram:$i >NIL:;assign $i: ram:$i Xalias ramop "md RAM:op; assign OP: ram:op Xalias noop "assign OP: ; rm -r ram:op Xalias newop "rm -r OP:* Xalias dc "dfc df0: to df1: Xalias go "%q assign WORK: Boot:$q; cd WORK:; source startme.sh Xalias get "%q cp $q RAM: >NIL: Xalias filter "%a%b%c exec $b \\<$a \\>$c X # reads $a, filters it with $b and writes result to $c X Xalias rm "%q \\rm @confirm( Remove $q ) X X#alias rm "%a set f @pickargs( $a );set opts @pickargs( $a );\ X# e -n OK to delete @words( @files( $f ) ) file(s) and @words( @dirs( $f ) )\ X# directories\"? \";input b;if $b = y;\\rm $opts $f;endif X# # for the anxious among us: confirmed rm X Xset _prompt "%c%p> " X # this puts the path highlighted in the prompt X X# this one puts cli number, free mem, date and time in title bar Xset _titlebar "Shell %n Mem %m Date %d Time %t X X# This file will be sourced for every Shell you start X X### End of example .login ### X X**************************************************************************** X XIf you are a CLI user, your startup-sequence may be as simple as: X X C:csh S:startup.sh X XHere is, my startup code: X X### Example S:startup.sh ### X Xwind -l # if you are on a PAL machine, or use overscan X # note that commands may be abbreviated (wind=window) X Xassign LC: Stuff:c INCLUDE: Stuff:include LIB: Boot:lib QUAD: RAM: X Xrback C:FaccII; sleep 1 X # after spawning a process, it is always better to allow it X # to load the command, to avoid excessive drive head movement X Xresident -d blink lc1 lc2 >NIL: #defer loading X XC:PopCli 300 C:Newcli #using full pathname loads faster XC:FF -1 Siesta.font >NIL: XC:Patch_1 >NIL: Xstack 8000 # lc1 and lc2 need this X Xsource S:setdate.sh # this is listed next X X### End of example startup.sh ### X X**************************************************************************** X XThe following is an example source file to set date and time; it may be Xused at startup if you don't have an internal clock. X X### setdate.sh ### X Xopen CON:200/100/440/80/SetDate write 1 Xecho >.1 -n "Current date is " Xdate >.1 Xecho >.1 -n "Please enter date: " Xinput <.1 d Xclose 1 Xstrlen len $d Xif $len > 1 ; date $d ; endif Xecho -n "New date: " ; date X X### End of setdate.sh ### X X*************************************************************************** X XNext comes a makefile that needs no Make program: may be executed from XShell directely!!! X X### make.sh ### X Xif -t Shell.syms Shell.h; cc +HShell.syms Shell.h; rm shell.o; endif Xif -t RAM:Shell.syms Shell.syms; cp -d Shell.syms RAM:; endif X Xforeach i ( main comm1 comm2 comm3 execom globals rawconsole run set \ X sub ) "if -t $i.o $i.c; echo Compile $i...;cc +IRAM:shell.syms $i.c; endif" X X# we used line continuation for better visibility. this is not necessary, X# you can type it all in one line. note the limit of 256 bytes per line X Xif -t Shell run.o main.o comm1.o comm2.o comm3.o execom.o \ Xset.o sub.o globals.o rawconsole.o X ln +q -m -o Shell run.o main.o comm1.o comm2.o comm3.o\ X execom.o set.o sub.o globals.o rawconsole.o -la -lc Xendif X X### End of make.sh ### X X XXIII. Default Values X-------------------- X XTo make things easier, some aliases are predefined whenever you start a Xnew Shell. These are: X X CLS X Simply clear the screen. X X CDIR X Use "cdir directory" to clear the screen, set CD to directory, X and list it. X X EXIT X Leave Shell and exit CLI. X X FG X Runs current shell in foreground, this means priority 1. X X KR X Used to delete everything on RAM:. This one is gone, if you still X want it, you'll have to put it in your s:.login X X LP X List to printer one or more files. X X MANLIST X Display a list of possible arguments to man. You can pipe this to X qsort to get a sorted output. X X NICE X Sets this shell to priority -1. X XMoreover, many variables have default values, and many function keys are Xpredefined. You can use set command to determine all of these. X XXIV. Object oriented features X------------------------------ X X CLASSES OF FILES X X You can define a class of files using several 'class' commands. X Here a simple example: X X class picture suff=.pic suff=.iff suff=.ilbm X class anim suff=.anim X X From now on, everything with the suffix .pic, .iff or .ilbm will X be identified as a picture. Please note that there may be no blanks X between the names and the '=', and that blanks inside the names X must be put in quotes. So these are the ways to identify a file: X X suff=.doc True if the suffix of the file is .doc X name=readme True if the file is "readme" X offs=14,DC..C4FD True if the bytes starting at $14 are $DC, X anything, $C4, $FD (all numbers hexadecimal!). X Each pair of dots means one byte ignored. X chars True if 90% of the bytes in the file are 32..127 X or 9..13 X default Always true, used to define the default type X X Note that only the first character is examined, so 's' = 'suff'. X One class can be identified by more than one 'class' statement. X They are looked at in the same sequence they were entered. So to X make sure that an zoo archive misnamed as .lzh is identified X correctly, use the following 'class' statements: X X class zoo offs=14,DCA7C4FD X class lzh offs=2,2D6C68..2D X class zoo suff=.zoo X class lzh suff=.lzh X X Moreover, there is a builtin class 'dir', which means directory. X Now we know many file types. But what to do with them? This is X where we define 'actions'. X X ACTIONS ON CLASSES X X There may be one or more 'class' command that define what actions X need to be taken in various cases for that specific class: X X class zoo actions view="zoo -list" extr="zoo -extract" X class lzh actions view="lz l" extr="lz e" X X Whenever somebody tries to 'view' a test.zoo, the command X 'zoo -list test.zoo' will be issued, but if he tries to X view test.lzh, then 'lz l test.lzh' will be executed. Note X that any command supplied here goes through the normal csh X parser, so AmigaDOS and csh paths will be searched. Aliases X with arguments are allowed here, too, so whatever the user X typed will be stored in the variable after the '%'. X X How do I tell a file that I want to 'view' it? There comes the X second command used for object oriented features: X X action view test.zoo X X will first identify the type of that file and then apply, if X possible, the 'view' action to it. Of course, this works best X inside an alias: alias v "action view" will define a v-command X that views all types of files known to cshell. Similarly, you X can define alias xtr "action extr" and use this command to X extract files from any type of archive. X There is one action that will be sent to every file that you X try to start but is not executable. This action is 'exec'. X Assume you have defined the class 'picture', then after X X class picture actions view=Mostra exec=Mostra X X you can display a picture using Mostra by just typing its name. X More builtin actions like 'rm' and 'dir' may be implemented, X so don't use command names for action names. X X The batch file class.sh defines a few useful classes. X X X XXV. Keymaps X--------------- X X You define a keymap as a collection of key/function pairs. Both X are given as numbers. There can be several keymaps which activate X each other, but at first we only edit keymap 0, which is active X at the beginning. All keys you define will eventually overwrite X the old definitions in an existing keymap. Everithing marked with X a (*) is not yet implemented. X X KEYCODES X X 1..255 The corresponding ASCII character X 256 Up Arrow X 257 Down Arrow X 258 Right Arrow X 259 Left Arrow X 260 Help X 261..270 F1..F10 (unshifted) X X X Modifiers (add them to the key code) X X 512 SHIFT (only necessary for arrows and fkeys) X 1024 ESC (was pressed & released before this key) X X EDITFUNCTIONS X X - Movement Move cursor... X 0 CursLeft 1 left X 1 CursRight 1 right X 2 WordLeft 1 word left X 3 WordRight 1 word right X 4 BegOfLine to beginning of line X 5 EndOfLine to end of line X X - Deleting Delete... X 10 Backspace char left from cursor X 11 Delete char right from cursor X 12 BkspcWord word left from cursor X 13 DelWord word right from cursor X 14 DeleteToSOL to start of line X 15 DeleteToEOL to end of line X 16 DeleteLine whole line X X - History X 20 Back Move one line back in history X 21 Forward Move one line forward in history X 22 Beg Move to first line in history X 23 End Move to last line in history X 24 Complete History retrieve like '!' X 25 Exec Execute history line & bring up next X 26 Tail Insert previous line except first word X X - Completion X 30 Normal Insert first matching file (or cycle) X 31 Partial Insert substring of all matching files X 32 All Insert all matching files X 33 Directory Find dir in quick cd list X 34 LastCD Insert last current directory X X - Special X 40 Insert Toggle Insert/Overwrite X 41 Quit Silently perform 'quit' X 42 Help Silently perform 'help' X 43 Refresh Redraw current line X 44 Execute Execute current line X 45 Leave Edit new line, store this in hist X 46 EOF Terminate shell X 47 NOP Do nothing X 48 Echo^O Echoes a ^O X 49 Beep Echoes a ^G X X - Other X 50 Fkey Execute command associated to last fkey X 51 Menu Execute command associated to last menu X 52 Undo Undoes last edit X 53 Repeat Repeats last function X X X Command types X X 0 +x Editing function x, see above descriptions X 512 +x Setmap x, x=0..7 X 1024+x Insert key x, x=1..255 X 1536+x Macro x x=1..15 (*) X 2048+x String x x=1..15 (*) END_OF_FILE if test 10945 -ne `wc -c <'shell.doc.ac'`; then echo shar: \"'shell.doc.ac'\" unpacked with wrong size! fi # end of 'shell.doc.ac' fi if test -f 'shell.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'shell.h'\" else echo shar: Extracting \"'shell.h'\" \(5730 characters\) sed "s/^X//" >'shell.h' <<'END_OF_FILE' X X/* X * SHELL.H X * X * (c)1986 Matthew Dillon 9 October 1986 X * X * X * SHELL include file.. contains shell parameters and extern's X * X * Version 2.07M by Steve Drew 10-Sep-87 X * X * Version 4.01A by Carlo Borreo & Cesare Dieni 17-Feb-90 X * X */ X X#define RAW_CONSOLE 1 /* Set to 0 to compile out Cmd Line Editing */ X#define KICK20 X X#define strlen strlen X X#include <exec/types.h> X#include <exec/exec.h> X#include <libraries/arpbase.h> X#include <intuition/intuitionbase.h> X#include <libraries/dosextens.h> X#include <time.h> X#include <ctype.h> X#include <fcntl.h> X#include <stdio.h> X#include <stdlib.h> X#include <string.h> X#include "proto.h" X XLONG AssignLock( UBYTE *name, BPTR lock ); XBOOL AssignLate( UBYTE *name, UBYTE *path ); XBOOL AssignPath( UBYTE *name, UBYTE *path ); XBOOL AssignAdd( UBYTE *name, BPTR lock ); X Xtypedef struct FileInfoBlock FIB; X#ifdef AZTEC_C X X# include <functions.h> X# define DEVTAB(x) _devtab[x->_unit].fd X# define CHARSWAIT(x) (x->_bp < x->_bend) X# define COMPILER "Aztec C 5.0d" X# pragma amicall(DOSBase, 0x264, AssignLock(d1,d2)) X# pragma amicall(DOSBase, 0x26a, AssignLate(d1,d2)) X# pragma amicall(DOSBase, 0x270, AssignPath(d1,d2)) X# pragma amicall(DOSBase, 0x276, AssignAdd(d1,d2)) X X#else X X# include <proto/all.h> X# include <ios1.h> X# define DEVTAB(x) _ufbs[(x)->_file].ufbfh X# define CHARSWAIT(x) (x->_rcnt != x->_wcnt) X X extern struct UFB _ufbs[]; X# define COMPILER "Lattice C 5.10" X# define index strchr X# define memmove(t,f,l) movmem((f),(t),(l)) X# define swapmem(x,y,z) swmem(x,y,z) X# pragma libcall DOSBase AssignLock 264 2102 X# pragma libcall DOSBase AssignLate 26a 2102 X# pragma libcall DOSBase AssignPath 270 2102 X# pragma libcall DOSBase AssignAdd 276 2102 X X#endif X X#ifndef MAX X#define MAX(x,y) ((x)>(y) ? (x) : (y)) X#endif X X#ifdef KICK20 Xtypedef ULONG Tag; Xstruct TagItem { X Tag ti_Tag; X ULONG ti_Data; X}; X#define TAG_DONE (0L) /* terminates array of TagItems. ti_Data unused */ X#define TAG_END TAG_DONE X#define TAG_IGNORE (1L) /* ignore this item, not end of array */ X#define TAG_MORE (2L) /* ti_Data is pointer to another array of TagItems X * note that this tag terminates the current array */ X#define TAG_SKIP (3L) /* skip this and the next ti_Data items */ X#define TAG_USER (1L<<31) /* differentiates user tags from system tags*/ X X/* definitions for the System() call */ X Xenum { SYS_Dummy = TAG_USER + 32, X SYS_Input, /* specifies the input filehandle */ X SYS_Output, /* specifies the output filehandle */ X SYS_Asynch, /* run asynch, close input/output on exit(!) */ X SYS_UserShell, /* send to user shell instead of boot shell */ X SYS_CustomShell, /* send to a specific shell (data is name) */ X}; X#endif X X#define MAXAV 256 /* Max. # of arguments */ X#define MAXSRC 5 /* Max. # of source file levels */ X#define MAXIF 10 /* Max. # of if levels */ X#define MAXALIAS 20 /* Max. # of alias levels */ X#define MAXMYFILES 9 /* Max. # of internal files */ X X#define LEVEL_SET 0 /* which variable list to use */ X#define LEVEL_ALIAS 1 X#define LEVEL_LABEL 2 X#define LEVEL_SOURCE 2 X X#define SBYTE signed char X#define MAXITEMS 16 X#define MAXMENUS 6 X X#ifndef NULL X#define NULL 0L X#endif X X#define CHECKBREAK() dobreak() X X#ifndef AZTEC_C Xstruct _dev { X long fd; X short mode; X }; X#endif X Xstruct HIST { X struct HIST *next, *prev; /* doubly linked list */ X char *line; /* line in history */ X}; X Xstruct PERROR { X int errnum; /* Format of global error lookup */ X char *errstr; X}; X Xstruct DPTR { /* Format of directory fetch pointer */ X BPTR lock; /* lock on directory */ X FIB *fib; /* mod'd fib for entry */ X }; X Xextern struct HIST *H_head, *H_tail; Xextern struct PERROR Perror[]; Xextern struct DPTR *dopen(); Xextern char **av; Xextern char *Current; Xextern int H_len, H_tail_base, H_stack; Xextern int E_stack; Xextern int Src_stack, If_stack, forward_goto; Xextern int ac; Xextern int max_ac; Xextern int debug, Rval, Verbose, disable, Quit; Xextern int Lastresult, atoierr; Xextern int Exec_abortline; Xextern int S_histlen; Xextern unsigned int options; Xextern long Cin, Cout, Cout_append; Xextern char *Cin_name, *Cout_name; Xextern char Cin_type, Cout_type; /* these variables are in transition */ Xextern char *Pipe1, *Pipe2; X Xextern FILE *Src_base[MAXSRC]; Xextern long Src_pos[MAXSRC]; Xextern int Src_if[MAXSRC]; Xextern char If_base[MAXIF]; Xextern struct Process *Myprocess; Xextern struct CommandLineInterface *Mycli; X Xextern struct ArpBase *ArpBase; X Xextern long atol(), Atol(), myatol(); X Xextern char v_titlebar[], v_prompt[], v_hist[], v_histnum[], v_debug[], X v_verbose[], v_stat[], v_lasterr[], v_cwd[], v_except[], v_passed[], X v_path[], v_gotofwd[], v_linenum[], v_every[], v_lcd[], v_rxpath[], X v_hilite[], v_scroll[], v_minrows[], v_result[], v_qcd[], v_noreq[], X v_value[], v_nobreak[], v_bground[]; X Xextern char o_hilite[], o_lolite[], *o_csh_qcd, o_internal; Xextern char o_aux, o_minrows, o_scroll, o_nowindow, o_noraw, o_vt100; Xextern char o_nofastscr, o_kick20, o_nobreak, o_bground, o_resident; Xextern long o_noreq; Xextern char Buf[], isalph[], confirmed, *classfile; X X/* #define isalphanum(x) isalph[x] */ X Xtypedef struct file_info { X LONG flags; X LONG size; X LONG blocks; X char class[12]; X struct DateStamp date; X} FILEINFO; X Xtypedef struct Class { X struct Class *next; X char name[1]; X} CLASS; X Xextern CLASS *CRoot, *LastCRoot; Xextern struct Window *Win; X X#if 1 XLONG RunCommand( BPTR seg, long stack, UBYTE *paramptr, long paramlen ); Xstruct Segment *FindSegment( UBYTE *name, struct Segment *seg, long system ); XLONG System( UBYTE *command, struct TagItem *tags ); X X# pragma libcall DOSBase RunCommand 1f8 432104 X# pragma libcall DOSBase FindSegment 30c 32103 X# pragma libcall DOSBase System 25e 2102 X#endif END_OF_FILE if test 5730 -ne `wc -c <'shell.h'`; then echo shar: \"'shell.h'\" unpacked with wrong size! fi # end of 'shell.h' fi if test -f 'technotes.doc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'technotes.doc'\" else echo shar: Extracting \"'technotes.doc'\" \(2908 characters\) sed "s/^X//" >'technotes.doc' <<'END_OF_FILE' X TECHINCAL NOTES FOR SHELL VERSION: 5.00 17-Feb-91 X ================================================= X XSTRUCTURE X--------- X XThe heart of CShell is still the old parser of Matt Dillon, which went Xthrough its first major change in this version (Matt abused bit 7 of the Xcharacters, so international characters would not work). Everything else Xwere just minor enhancements, which are very useful, though. It's quite Xhard to read, and it's huge (took me DAYS to understand it), but maybe all Xinterpreters look like this... X XThe other side of the shell are the built in commands. They look much like XCLI commands in C, but they have helluva lot of support functions for their Xneeds. X XTo write a builtin command for CShell, you use the global variables av and Xac instead of argv and argc, and use printf() for output. That's it. Any Xother changes, if necessary, will be done by me. X XEvery builtin command has its equivalent as a C function with the prefix Xdo_ (example: do_addbuffers). The are no hard coded jumps to any of those Xfunctions, instead there is a table with the descriptions of all functions X(like name, usage, minimum arguments and, last but not least, a pointer to Xthat function). X XI'll probably create a .doc that descibes the insides of the thell more Xprecisely, and distribute it along with the source if I find the time to do Xit (not everybody is a 24 hour programmer like Matt :-) X XWHY BUILT IN COMMANDS? X---------------------- X XThe reasons why does C-Shell still relies heavily on internal Xcommands: X- They can take advantage from each other (e.g. class recognition in the X 'dir' command, use of 'search' command in quick cd) X- They have a fast calling sequence X- They need no hard disk seeks, so the startup can be accelerated X significantly X- They are shorter than external commands X- And finally, if you don't like them, don't use them. The wasted resources X become more and more negligible nowadays. X XSOURCE X------ X XThe source for CShell is available, if you don't have it, request it from Xme. It consists of 10 modules, together 190K. It is compilable under SAS X(Lattice) & Manx C, although the executables produced by Manx are not Xresidentable. If you want to modify it, ask me for an up-to-date version Xfirst. You may not release modified versions (imagine the chaos if Xeverbody releases his private csh), but if you send them to me, you have a Xvery good chance that I'll build it in. You'll be, of course, be mentioned Xin the docs. X XEven if you don't intend to modify it, I still encourage you to get the Xsource, because there are so many things you can look up there once you Xneed it (did *you* know how to set the system date?). I apologize for my Xpoor to nonexistent comments, I'll go through again when I've got the time. XAh, yes, that famous Dillon-formatting is gone, now it's traditionally Xformatted. END_OF_FILE if test 2908 -ne `wc -c <'technotes.doc'`; then echo shar: \"'technotes.doc'\" unpacked with wrong size! fi # end of 'technotes.doc' fi echo shar: End of archive 1 \(of 6\). cp /dev/null ark1isdone MISSING="" for I in 1 2 3 4 5 6 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 6 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Mail submissions (sources or binaries) to <amiga@uunet.uu.net>. Mail comments to the moderator at <amiga-request@uunet.uu.net>. Post requests for sources, and general discussion to comp.sys.amiga.misc.