/ { return(1) ; } execommand() { extern struct textline inline ; extern int cmdlun,dovtedit,kblun,indlun,iniecho,sts_one,stvtedit ; register int status ; dovtedit = stvtedit ; while ( ( sts_one & ed_quit ) == 0 ) { status = 0 ; if ( dovtedit && ( cmdlun == kblun ) ) then { inline.c[0] = 'V' ; inline.len = 1 ; dovtedit = 0 ; } else { while ( status != sys_normal ) { resumeoutput() ; if ( cmdlun == kblun ) then xprintf("EDIT> ") ; status = getline(cmdlun,inline.c,&inline.len) ; if ( status == er_eof && cmdlun != kblun ) then { closef( cmdlun ) ; cmdlun = kblun ; if ( dovtedit ) then { inline.len = 0 ; status = sys_normal ; } } } } if ( iniecho && inline.len && (cmdlun == indlun) ) then { putbin("EDIT> ",0) ; putbin(inline.c,inline.len) ; } if ( (inline.len = cvtstring(inline.c,inline.len,04)) != 0 ) then { inline.c[inline.len] = 0 ; if ( inline.c[0] == '@' ) then { if (inline.c[1] == 0) then tederror("Need a filename to open") ; else if (openfi(&inline.c[1],indlun)==sys_normal) then cmdlun = indlun ; else tederror("Can't open command file") ; } else if (inline.c[0]=='/' && toupper(inline.c[1])=='L') then lastline() ; else teddocommand(inline.c) ; } } } teddocommand(s) char *s ; { struct cmd *findcommand() ; register struct cmd *cmdp ; register int status ; extern int argstat,filopen,kblun,cmdlun,sts_one ; if ( (cmdp = findcommand(s,&cmdlist)) == &nullcmd ) then { if ( cmdlun != kblun ) then tederror(s) ; tederror("Unknown TED command"); } else { if ( (status = getarg(s,cmdp->flags)) == 0 ) then tederror("Invalid command format") ; else if ( checkarg() == 0 ) then tederror("Illegal command line arguments") ; else if ( (argstat & comp(cmdp->flags)) != 0 ) then tederror("Extra arguments for command"); else if ((sts_one & _vtedit) && (cmdp->flags & NO_VT)) then tederror("Command not accessable from VTEDIT"); else if ( setfile(cmdp->flags) == 0 ) then file_error("Can't access that file"); else { status = dispatch(cmdp->idx) ; clrfile() ; } } return(status) ; } static clrfile() { extern int filopen,cmdlun,kblun ; if ( filopen != kblun && filopen != cmdlun ) then closef(filopen) ; filopen = kblun ; } static setfile(flag) int flag ; { register int lun,status ; extern int argstat,filopen ; extern char argfile[] ; extern int cmdlun,inlun,outlun,kblun ; filopen = cmdlun ; if ( (argstat & ARG_FI) == 0 ) then return(sys_normal) ; if ( (flag & DIR_WR) != 0 ) then { if ( flookup(argfile) ) then { if ( getyesno("Supercede file ? ","YES") ) then { status = openfi(argfile,outlun) ; lun = outlun ; } else status = 0 ; } else { status = openfi(argfile,outlun) ; lun = outlun ; } } else { if ( (flag & DIR_RD) != 0 ) then { status = openfi(argfile,inlun) ; lun = inlun ; } else { status = sys_normal ; lun = cmdlun ; } } if ( status != sys_normal ) then status = 0 ; if ( status == sys_normal ) then filopen = lun ; else filopen = cmdlun ; return(status) ; } static dispatch(idx) int idx ; { extern int filopen,iniecho,lowlim,highlim,*maxline,sts_one,target ; extern char argfile[] ; switch(idx) { case CMVTEDIT: ldvtedit() ; if ( (sts_one & ed_end) != 0 ) then cend() ; return(1) ; break ; case CMLEN: clength() ; break ; case CMINSERT: cinsert(filopen) ; break ; case CMLIST: clist(filopen) ; break ; case CMDELETE: cdelete(filopen) ; break ; case CMDUMP: dumpindex() ; break ; case CMSTAT: dumpstats() ; break ; case CMMOVE: cmove() ; EDCMD C [.050036]EDCMD .C [.050036]    X14|H [4;Ik(&'( k ߫H&P` \RrPP2PPzPP{PPPPP2P~\$\\TD 0D \~ hi) +\ ^( n ^( np\^txY\^ˀ\!kVk<\F˰<˴ˬ\VVkˤ1`@lP ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789<@<SЬTЬ UQS>?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~@ggh<i|o<m<4p<p<k|Zn<l fr rwx<x<x<x޺<w@]@@fjnr]Ze@@|> | |v<H|  |  |xz|  |zt f r   < &^ @&@'*/V,"?Lh:hmBmz|z{x`y~|fN|@@|@͂|@ ݃ƃ<ns<|Ŏ |️|ep|u|-@率|<ᄇ2ֻr||ZRM | ntB|xyvZw|J=|R>|J? nnaa|bddf-1 ,-1 ,-1 ,74 ,-1 ,3 , 4 ,-1 ,57 ,5 ,-1 ,-1 ,0 ,4 ,-1 ,4 , 36 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,86 ,-1 ,5 , 6 ,-1 ,57 ,-1 ,-1 ,-1 ,0 ,6 ,-1 ,6 , 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,7 , -1 ,3 ,57 ,5 ,-1 ,-1 ,0 ,8 ,-1 ,8 } ; static getarg(s,flags) register char *s ; int flags ; { extern int argstat,lowlim,highlim,*maxline,target,trimarg ; extern char argfile[] ; int i ; register int state,action ; lowlim = 1 ; highlim = *maxline - 1 ; trimarg = 0 ; target = 0 ; argfile[0] = 0 ; argstat = 0 ; if ( ( flags & NOPARSE ) != 0 ) then { while ( isletter(*s) || *s == '$' ) s++ ; while ( *s == SPACE || *s == TAB ) s++ ; if ( *s == '/' ) then s++ ; for (i=0; i < 63 && (argfile[i] = *s++) != 0; i++); argstat = ARG_FI ; return( 1 ) ; } state = 1 ; while ( state > 0 ) { state = state_table[ mapch(*s) + N_MAPS*(state-1) ] ; if ( state > 0 ) then { action = state/10 ; state = state % 10 ; switch( action ) { case 1: lowlim = val(s) ; highlim = lowlim ; argstat |= ARG_LO ; break ; case 2: highlim = val(s) ; argstat |= ARG_HI ; break ; case 3: target = val(s) ; trimarg = target ; argstat |= ARG_TA ; break ; case 4: break ; case 5: strcpy(argfile,++s) ; argstat |= ARG_FI ; break ; case 6: lowlim = *maxline - 1 ; highlim = lowlim ; argstat |= ARG_LO ; break ; case 7: highlim = *maxline - 1 ; argstat |= ARG_HI ; break ; case 8: target = *maxline - 1 ; argstat |= ARG_TA ; break ; default: break ; } /* end case */ s++ ; } /* end then */ } /* end while */ return( ( state==0 ) ? 1:0 ) ; } /* end getarg*/ checkarg() { extern int highlim,lowlim,*maxline,target ; if ( target >= *maxline ) then target = 0 ; return ( !( highlim >= *maxline || lowlim > highlim || lowlim <= 0 || target < 0 || target >= *maxline ) ) ; } static val(s) register char *s ; { register int i ; i = 0 ; while ( isdigit(*s) ) i = i*10 + (*s++ - '0') ; return(i) ; } static mapch(ch) register char ch ; { register int map ; if ( isletter(ch) ) then return(M_LET) ; if ( isdigit(ch) ) then return(M_DIG) ; switch( ch ) { case SPACE: case TAB: map = M_SPA ; break ; case ',': map = M_COM ; break ; case '/': map = M_QUO ; break ; case '\'': map = M_QUO ; break ; case '\0': map = M_NUL ; break ; case ':': map = M_COL ; break ; case '*': map = M_STA ; break ; case '%': map = M_PER ; break ; default: map = M_OTH ; break ; } return(map) ; } static lastline() { extern int *maxline ; xprintf("Last line is %d\n",*maxline-1); } static cruler() { int i ; xprintf(" ") ; for (i=1;i<72;i++) xprintf("%d",i%10) ; xprintf("\n") ; } static ctime() { char s[30] ; gettim(s) ; xprintf("%s\n",s) ; } static creticent() { extern int verbose ; verbose = 0 ; } static cchatty() { extern int verbose ; verbose = 1 ; } static cfile() { extern char *infile[] ; xprintf("%s\n",infile[0]) ; } static comp(i) int i ; { return(~i) ; } #if VAXVMS static testcommand() { extern int lowlim,highlim ; register int i,junk ; extern struct textline *textpointer() ; register struct textline *tp ; for (i=lowlim;i<=highlim;i++) tp = textpointer(i) ; } static test1command() { extern int lowlim,highlim ; register int i,junk ; extern struct textline *w_l_address[] ; register struct textline *tp ; for (i=lowlim;i<=highlim;i++) tp = w_l_address[findline(i)]; } #else testcommand() { extern int mapcnt ; xprintf("mapcnt %d\n",mapcnt) ; } test1command() {} ; #endif static file_error(e) char *e ; { char s[80] ; geterror(s) ; xprintf("%s\n %s\n",e,s) ; } EDCMD C [.050036]EDCMD .C [.050036]   X14|H [4;Ik(&'( k ߫H&P` \RrPP2PPzPP{PPPPP2P~\$\\TD 0D \~ hi) +\ ^( n ^( np\^txY\^ˀ\!kVk<\F˰<˴ˬ\VVkˤ1`@lP ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789<@<SЬTЬ UQS>?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~@ggh<i|o<m<4p<p<k|Zn<l fr rwx<x<x<x޺<w@]@@fjnr]Ze@@|> | |v<H|  |  |xz|  |zt f r   < &^ @&@'*/V,"?Lh:hmBmz|z{x`y~|fN|@@|@͂|@ ݃ƃ<ns<|Ŏ |️|ep|u|-@率|<ᄇ2ֻr||ZRM | ntB|xyvZw|J=|R>|J? nnaa|bddf