1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006
|
/*
* LEVEE, or Captain Video; A vi clone
*
* Copyright (c) 1982-1997 David L Parsons
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by David L Parsons (orc@pell.chi.il.us). My name may not be used
* to endorse or promote products derived from this software without
* specific prior written permission. THIS SOFTWARE IS PROVIDED
* AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
* FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "levee.h"
#include "extern.h"
/*
* do a newline and set flags.
*/
#define exprintln() (zotscreen=YES),println()
/* Pretty fancy, eh? */
void plural(int num, char *string)
{
printi(num);
prints(string);
if (num != 1)
printch('s');
} /* plural */
void clrmsg()
{
levee_mvcur(-1, 0);
strput(CE);
} /* clrmsg */
void errmsg(char *msg)
{
levee_mvcur(-1, 0);
prints(msg);
strput(CE);
} /* errmsg */
/* get a space-delimited token */
char *execstr; /* if someone calls getarg in the */
/* wrong place, death will come... */
char *getarg()
{
char *rv;
rv = execstr;
while (*execstr && !isspace(*execstr))
++execstr;
if (*execstr) {
*execstr++ = 0;
while (isspace(*execstr))
++execstr;
}
return (*rv) ? rv : NULL;
} /* getarg */
void version()
/* version: print which version of levee we are... */
{
errmsg("new-levee ");prints(ED_NOTICE);printch(ED_REVISION);
} /* version */
void args()
/* args: print the argument list */
{
int i;
levee_mvcur(-1,0);
for (i=0; i < argc; i++) {
if (curpos.x+strlen(argv[i]) >= COLS)
exprintln();
else if (i > 0)
printch(' ');
if (pc == i) { /* highlight the current filename.. */
printch('[');
prints(argv[i]);
printch(']');
}
else
prints(argv[i]);
}
} /* args */
void setcmd()
{
boolean no = YES, b;
char *arg, *num;
struct variable *vp;
if ((arg = getarg())) {
do {
if (*arg != 0) {
if ((num = strchr(arg, '='))) {
b = NO;
*num++ = 0;
}
else { /* set [no]opt */
b = YES;
if (arg[0]=='n' && arg[1]=='o') {
arg += 2;
no = NO;
} else {
no = YES;
}
}
for(vp=vars;vp->u && strcmp(arg,vp->v_name)
&& strcmp(arg,vp->v_abbr); vp++);
if (!vp->u || vp->v_flags & V_CONST) {
errmsg("can't set ");
prints(arg);
} else {
int j;
if (b)
if (vp->v_tipe == VBOOL)
vp->u->valu = no;
else
goto badsettype;
else if (vp->v_tipe == VSTR) {
if (vp->u->strp)
free(vp->u->strp);
vp->u->strp = (*num) ? strdup(num) : NULL;
}
else
if (*num && (j=atoi(num)) >= 0)
vp->u->valu = j;
else {
badsettype:
errmsg("bad set type");
continue;
}
diddled |= vp->v_flags & V_DISPLAY;
}
}
} while ((arg = getarg()));
}
else {
version(); exprintln();
for(vp=vars;vp->u;vp++) {
switch (vp->v_tipe) {
case VBOOL:
if (!vp->u->valu)
prints("no");
prints(vp->v_name);
break;
case VSTR:
if (!vp->u->strp)
prints("no ");
prints(vp->v_name);
if (vp->u->strp) {
levee_mvcur(-1,10);
prints("= ");
prints(vp->u->strp);
}
break;
default:
prints(vp->v_name);
levee_mvcur(-1,10);
prints("= ");
printi(vp->u->valu);
break;
}
exprintln();
}
}
} /* setcmd */
/* print a macro */
void printone(int i)
{
if (i >= 0) {
exprintln();
printch(mbuffer[i].token);
levee_mvcur(-1,3);
if (movemap[(int)mbuffer[i].token] == INSMACRO)
prints("!= ");
else
prints(" = ");
prints(mbuffer[i].m_text);
}
} /* printone */
/* print all the macros */
void printall()
{
int i;
for (i = 0; i < MAXMACROS; i++)
if (mbuffer[i].token != 0)
printone(i);
} /* printall */
/* :map ch text */
int map(boolean insert)
{
char *macro, c;
int i;
/* get the macro */
if ((macro=getarg()) == NULL) {
printall();
return 1;
}
if (strlen(macro) > 1) {
errmsg("macros must be one character");
return 0;
}
c = macro[0];
if (*execstr == 0)
printone(lookup(c));
else {
if ((i = lookup(0)) < 0)
errmsg("macro table full");
else if (c == ESC || c == ':') {
errmsg("can't map ");
printch(c);
}
else if (*execstr != 0) {
undefine(lookup(c));
mbuffer[i].token = c;
mbuffer[i].m_text = strdup(execstr);
mbuffer[i].oldmap = movemap[(int)c];
if (insert)
movemap[(int)c] = INSMACRO;
else
movemap[(int)c] = SOFTMACRO;
}
}
return 0; /* FIXME: not reached (?) */
} /* map */
void undefine(int i)
{
char *p;
if (i >= 0) {
movemap[(int)mbuffer[i].token] = mbuffer[i].oldmap;
mbuffer[i].token = 0;
p = mbuffer[i].m_text;
free(p);
mbuffer[i].m_text = 0;
}
} /* undefine */
boolean unmap()
{
int i;
char *arg;
if ((arg=getarg())) {
if (strlen(arg) == 1) {
undefine(lookup(*arg));
return YES;
}
if (strcmp(arg,"all") == 0) {
for (i = 0; i < MAXMACROS; i++)
if (mbuffer[i].token != 0)
undefine(i);
return YES;
}
}
return NO;
} /* unmap */
/* return argument # of a filename */
int findarg(char *name)
{
int j;
for (j = 0; j < argc; j++)
if (strcmp(argv[j],name) == 0)
return j;
return -1;
} /* findarg */
/* add a filename to the arglist */
int addarg(char *name)
{
int where;
if ((where = findarg(name)) < 0)
return doaddwork(name, &argc, &argv);
return where;
} /* addarg */
/* get a file name argument (substitute alt file for #) */
char *getname()
{
extern int wilderr;
char *name;
if ((name = getarg())) {
if (strcmp(name,"#") == 0) {
if (*altnm) {
name = altnm;
} else {
errmsg("no alt name");
wilderr++;
return NULL;
}
}
}
return name;
} /* getname */
/* CAUTION: these make exec not quite recursive */
int high, low; /* low && high end of command range */
boolean affirm; /* cmd! (use of ! to override */
/* s/[src]/dst[/options] */
/* s& */
void cutandpaste()
{
boolean askme = NO,
printme= NO,
glob = NO;
int newcurr = -1;
int oldcurr = curr;
int num;
char delim;
char *ip, *dp;
zerostack(&undo);
ip = execstr;
if (*ip != '&') {
delim = *ip;
ip = makepat(1+ip,delim); /* get search */
if (ip == NULL)
goto splat;
dp = dst;
while (*ip && *ip != delim) {
if (*ip == '\\' && ip[1] != 0)
*dp++ = *ip++;
*dp++ = *ip++;
}
*dp = 0;
if (*ip == delim) {
while (*++ip)
switch (*ip) {
case 'q':
case 'c': askme = YES; break;
case 'g': glob = YES; break;
case 'p': printme= YES; break;
}
}
}
if (*lastpatt == 0) {
splat: errmsg("bad substitute");
return;
}
fixupline(bseekeol(curr));
num = 0;
do {
low = chop(low, &high, NO, &askme);
if (low > -1) {
diddled = YES;
num++;
if (printme) {
exprintln();
writeline(-1,-1,bseekeol(low));
}
if (newcurr < 0)
newcurr = low;
if (!glob)
low = 1+fseekeol(low);
}
} while (low >= 0);
if (num > 0) {
exprintln();
plural(num," substitution");
}
fixupline((newcurr > -1) ? newcurr : oldcurr);
} /* cutandpaste */
void inputf(char *fname, boolean newbuf)
{
int onright = 0, /* text moved right for :read */
fsize; /* bytes read in */
FILE *f;
if (newbuf)
readonly = NO;
zerostack(&undo);
if (newbuf) {
modified = NO;
low = 0;
high = SIZE;
} else { /* append stuff to the buffer */
fixupline(bseekeol(curr));
onright = bufmax-low;
high = (SIZE-onright);
if (onright > 0)
moveright(&core[low], &core[high], onright);
}
printch('"');
prints(fname);
prints("\" ");
if ((f=fopen(fname, "r")) == NULL) {
prints("[no such file]");
fsize = 0;
if (newbuf)
newfile = YES;
} else {
if (addfile(f, low, high, &fsize))
plural(fsize," byte");
else if (fsize < 0) {
prints("[read error]");
fsize = 0;
} else {
prints("[overflow]");
readonly = YES;
}
fclose(f);
if (newbuf)
newfile = NO;
}
if (newbuf) {
fillchar(contexts, sizeof(contexts), -1);
bufmax = fsize;
} else {
insert_to_undo(&undo, low, fsize);
modified = YES;
if (onright > 0)
moveleft(&core[high], &core[low+fsize], onright);
}
if (*startcmd) {
count = 1;
if (findparse(startcmd, &curr, low)[0] || curr < 0)
curr = low;
*startcmd = 0;
} else {
curr = low;
}
diddled = YES;
} /* inputf */
/* Change a file's name (for autocopy). */
void backup(char *name)
{
char back[80];
strcpy(back, name);
strcat(back, "~");
unlink(back);
rename(name, back);
} /* backup */
boolean outputf(char *fname)
{
boolean whole;
FILE *f;
int status;
zerostack(&undo); /* undo doesn't survive past write */
if (high < 0)
high = (low < 0) ? bufmax : (1+fseekeol(low));
if (low < 0)
low = 0;
printch('"');
prints(fname);
prints("\" ");
whole = (low == 0 && high >= bufmax-1);
if (whole && autocopy)
backup(fname);
if ((f = fopen(fname, "w"))) {
status = putfile(f, low, high);
fclose(f);
if (status) {
plural(high-low," byte");
if (whole)
modified = NO;
return(YES);
}
else {
prints("[write error]");
unlink(fname);
}
}
else
prints(fisro);
return(NO);
} /* outputf */
/* check and see if it is ok to edit a new file */
boolean oktoedit(boolean writeold) /* automatically write out changes? */
{
if (modified && !affirm) {
if (readonly) {
errmsg(fisro);
return NO;
} else if (writeold && *filenm) {
if (!outputf(filenm))
return NO;
printch(',');
} else {
errmsg(fismod);
return NO;
}
}
return YES;
} /* oktoedit */
/* write out all || part of a file */
boolean writefile()
{
char *name;
if ((name=getname()) == NULL)
name = filenm;
if (*name) {
if (outputf(name)) {
addarg(name);
return YES;
}
else
strcpy(altnm, name);
}
else
errmsg("no file to write");
return NO;
}
void editfile()
{
char *name = NULL; /* file to edit */
char **myargv;
int myargc;
int i, newpc;
if ((name = getarg()) && *name == '+') {
strcpy(startcmd, (name[1])?(1+name):"$");
name = getarg();
}
myargc=0;
if (name)
do {
if (!expandargs(name, &myargc, &myargv))
return;
} while ((name = getarg()));
if (myargc == 0) {
if (*filenm)
name = filenm;
else
errmsg("no file to edit");
}
else if ((newpc = addarg(myargv[0])) >= 0) {
name = argv[pc = newpc];
for (i=1; i < myargc && doaddwork(myargv[i], &argc, &argv) >= 0; i++)
;
}
killargs(&myargc, &myargv);
if (name && oktoedit(NO))
doinput(name);
}
void doinput(char *name)
{
inputf(name, YES);
strcpy(altnm, filenm);
strcpy(filenm, name);
}
void toedit(int count)
{
if (count > 1) {
printi(count);
prints(" files to edit; ");
}
}
void readfile()
{
char *name;
if ((name = getarg()))
inputf(name,NO);
else
errmsg("no file to read");
}
void nextfile(boolean prev)
{
char *name = NULL;
int newpc = pc, myargc = 0;
char **myargv;
boolean newlist = NO;
if (prev == 0)
while ((name = getarg()))
if (!expandargs(name, &myargc, &myargv))
return;
if (oktoedit(autowrite)) {
if (prev || (myargc == 1 && strcmp(myargv[0],"-") == 0)) {
if (pc > 0) {
newpc = pc-1;
}
else {
prints("(no prev files)");
goto killem;
}
}
else if (myargc == 0) {
if (pc < argc-1) {
newpc = 1+pc;
}
else {
prints("(no more files)");
goto killem;
}
}
else if (myargc > 1 || (newpc = findarg(myargv[0])) < 0) {
toedit(myargc);
newpc = 0;
newlist++;
}
doinput(newlist ? myargv[0] : argv[newpc]);
pc = newpc;
if (newlist) {
killargs(&argc, &argv);
argc = myargc;
argv = myargv;
}
else
killem: if (!prev)
killargs(&myargc, &myargv);
}
}
/*
* set up low, high; set dot to low
*/
void fixupline(int dft)
{
if (low < 0)
low = dft;
if (high < 0)
high = fseekeol(low)+1;
else if (high < low) { /* flip high & low */
int tmp;
tmp = high;
high = low;
low = tmp;
}
if (low >= ptop && low < pend) {
setpos(skipws(low));
yp = setY(curr);
}
else {
curr = low;
diddled = YES;
}
}
void whatline()
{
printi(to_line((low < 0) ? (bufmax-1) : low));
if (high >= 0) {
printch(',');
printi(to_line(high));
}
}
void print()
{
do {
exprintln();
writeline(-1, 0, low);
low = fseekeol(low) + 1;
} while (low < high);
exprintln();
}
/* move to different line */
/* execute lines from a :sourced || .lvrc file */
boolean do_file(char *fname, exec_type *mode, boolean *noquit)
{
char line[120];
FILE *fp, *fopen();
if ((fp = fopen(fname,"r")) != NULL) {
indirect = YES;
while (fgets(line,120,fp) && indirect) {
strtok(line, "\n");
if (*line != 0)
exec(line,mode,noquit);
}
indirect = YES;
fclose(fp);
return YES;
}
return NO;
}
void doins(boolean flag)
{
int i;
curr = low;
exprintln();
low = insertion(1,setstep[flag],&i,&i,NO)-1;
if (low >= 0)
curr = low;
diddled = YES;
}
/* figure out a address range for a command */
char *findbounds(char *ip)
{
ip = findparse(ip, &low, curr); /* get the low address */
if (low >= 0) {
low = bseekeol(low); /* at start of line */
if (*ip == ',') { /* high address? */
ip++;
count = 0;
ip = findparse(ip, &high, curr);
if (high >= 0) {
high = fseekeol(high);
return(ip);
}
}
else
return(ip);
}
return(0);
}
/* parse the command line for lineranges && a command */
exec_mode_command parse(char *inp)
{
int j, k;
char cmd[80];
low = high = ERR;
affirm = 0;
if (*inp == '%') {
moveright(inp, 2+inp, 1+strlen(inp));
inp[0]='1';
inp[1]=',';
inp[2]='$';
}
while (isspace(*inp))
++inp;
if (strchr(".$-+0123456789?/`'", *inp))
if (!(inp=findbounds(inp))) {
errmsg("bad address");
return ERR;
}
while (isspace(*inp))
++inp;
j = 0;
while (isalpha(*inp))
cmd[j++] = *inp++;
if (*inp == '!') {
if (j == 0)
cmd[j++] = '!';
else
affirm++;
inp++;
}
else if (*inp == '=' && j == 0)
cmd[j++] = '=';
while (isspace(*inp))
++inp;
execstr = inp;
if (j==0)
return EX_CR;
for (k=0; excmds[k]; k++)
if (strncmp(cmd, excmds[k], j) == 0)
return k;
return ERR;
}
/* inner loop of execmode */
void exec(char *cmd, exec_type *mode, boolean *noquit)
{
exec_mode_command what;
boolean ok;
what = parse(cmd);
ok = YES;
if (diddled) {
lstart = bseekeol(curr);
lend = fseekeol(curr);
}
switch (what) {
case EX_QUIT: /* :quit */
if (affirm || !modified)
*noquit = NO;
else
errmsg(fismod);
break;
case EX_READ: /* :read */
clrmsg();
readfile();
break;
case EX_EDIT: /* :read, :edit */
clrmsg();
editfile();
break;
case EX_WRITE:
case EX_WQ : /* :write, :wq */
clrmsg();
if (readonly && !affirm)
prints(fisro);
else if (writefile() && what==EX_WQ)
*noquit = NO;
break;
case EX_PREV:
case EX_NEXT: /* :next */
clrmsg();
nextfile(what==EX_PREV);
break;
case EX_SUBS: /* :substitute */
cutandpaste();
break;
case EX_SOURCE: /* :source */
if ((cmd = getarg()) && !do_file(cmd, mode, noquit)) {
errmsg("cannot open ");
prints(cmd);
}
break;
case EX_XIT:
clrmsg();
if (modified) {
if (readonly) {
prints(fisro);
break;
} else if (!writefile()) {
break;
}
}
if (!affirm && (argc-pc > 1)) { /* any more files to edit? */
printch('(');
plural(argc-pc-1," more file");
prints(" to edit)");
}
else
*noquit = NO;
break;
case EX_MAP:
map(affirm);
break;
case EX_UNMAP:
ok = unmap();
break;
case EX_FILE: /* :file */
if ((cmd = getarg())) { /* :file name */
strcpy(altnm, filenm);
strcpy(filenm, cmd);
pc = addarg(filenm);
}
wr_stat();
break;
case EX_SET: /* :set */
setcmd();
break;
case EX_CR:
case EX_PR: /* :print */
fixupline(bseekeol(curr));
if (what == EX_PR)
print();
break;
case EX_LINE: /* := */
whatline();
break;
case EX_DELETE:
case EX_YANK: /* :delete, :yank */
yank.line = YES;
fixupline(lstart);
zerostack(&undo);
if (what == EX_DELETE)
ok = deletion(low,high);
else
ok = doyank(low,high);
diddled = YES;
break;
case EX_PUT: /* :put */
fixupline(lstart);
zerostack(&undo);
ok = putback(low, &high);
diddled = YES;
break;
case EX_VI: /* :visual */
*mode = E_VISUAL;
if (*execstr) {
clrmsg();
nextfile(NO);
}
break;
case EX_EX:
*mode = E_EDIT; /* :execmode */
break;
case EX_INSERT:
case EX_OPEN: /* :insert, :open */
if (indirect)
ok = NO; /* kludge, kludge, kludge!!!!!!!!!! */
else {
zerostack(&undo);
fixupline(lstart);
doins(what == EX_OPEN);
}
break;
case EX_CHANGE: /* :change */
if (indirect)
ok = NO; /* kludge, kludge, kludge!!!!!!!!!! */
else {
zerostack(&undo);
yank.line = YES;
fixupline(lstart);
if (deletion(low,high))
doins(YES);
else
ok = NO;
}
break;
case EX_UNDO: /* :undo */
low = fixcore(&high);
if (low >= 0) {
diddled = YES;
curr = low;
}
else ok = NO;
break;
case EX_ARGS: /* :args */
args();
break;
case EX_VERSION: /* version */
version();
break;
case EX_ESCAPE: /* shell escape hack */
zotscreen = YES;
exprintln();
if (*execstr) {
#if ZTERM
zclose();
#endif
fixcon();
system(execstr);
initcon();
}
else
prints("incomplete shell escape.");
break;
case EX_REWIND:
clrmsg();
if (argc > 0 && oktoedit(autowrite)) {
pc = 0;
doinput(argv[0]);
}
break;
default:
prints(":not an editor command.");
break;
}
if (!ok) {
errmsg(excmds[what]);
prints(" error");
}
}
|