-/* Copyright (c) 1979 Regents of the University of California */
+/* Copyright (c) 1980 Regents of the University of California */
+static char *sccsid = "@(#)ex_cmds2.c 6.1 10/18/80";
#include "ex.h"
#include "ex_argv.h"
#include "ex_temp.h"
return (1);
case '|':
+ case '"':
endline = 0;
return (1);
}
error0();
merror(str, i);
+ if (writing) {
+ serror(" [Warning - %s is incomplete]", file);
+ writing = 0;
+ }
error1(str);
}
error0()
{
+ if (laste) {
+#ifdef VMUNIX
+ tlaste();
+#endif
+ laste = 0;
+ sync();
+ }
if (vcatch) {
if (splitw == 0)
fixech();
setoutt();
flush();
resetflav();
- if (laste) {
- laste = 0;
- sync();
- }
if (!SO || !SE)
dingdong();
if (inopen) {
COLUMNS = OCOLUMNS;
undvis();
ostop(normf);
+ /* ostop should be doing this
putpad(VE);
putpad(KE);
+ */
putnl();
}
inopen = 0;
io = -1;
}
die = (getpid() != ppid); /* Only children die */
+ inappend = inglobal = 0;
+ globp = vglobp = vmacp = 0;
if (vcatch && !die) {
- inglobal = 0;
- vglobp = vmacp = 0;
inopen = 1;
vcatch = 0;
+ if (str)
+ noonl();
fixol();
longjmp(vreslab,1);
}
lseek(0, 0L, 2);
if (inglobal)
setlastchar('\n');
- inglobal = 0;
- globp = 0;
while (lastchar() != '\n' && lastchar() != EOF)
ignchar();
ungetchar(0);
*/
next()
{
+ extern short isalt; /* defined in ex_io.c */
if (argc == 0)
error("No more files@to edit");
morargc = argc;
+ isalt = (strcmp(altfile, args)==0) + 1;
if (savedfile[0])
CP(altfile, savedfile);
CP(savedfile, args);
case '\t':
continue;
+ case '"':
+ comment();
+ setflav();
+ return;
+
default:
if (!endcmd(c))
serror("Extra chars|Extra characters at end of \"%s\" command", Command);
{
pastwh();
- return (endcmd(peekchar()));
+ return (endcmd(peekchar()) && peekchar() != '"');
}
/*
}
/*
- * Continue after a shell escape from open/visual.
+ * Continue after a : command from open/visual.
*/
vcontin(ask)
bool ask;
vcnt = -vcnt;
if (inopen) {
if (state != VISUAL) {
-/*
- vtube[WECHO][0] = '*';
- vnfl();
-*/
+ /*
+ * We don't know what a shell command may have left on
+ * the screen, so we move the cursor to the right place
+ * and then put out a newline. But this makes an extra
+ * blank line most of the time so we only do it for :sh
+ * since the prompt gets left on the screen.
+ *
+ * BUG: :!echo longer than current line \\c
+ * will screw it up, but be reasonable!
+ */
+ if (state == CRTOPEN) {
+ termreset();
+ vgoto(WECHO, 0);
+ }
+ if (!ask) {
+ putch('\r');
+ putch('\n');
+ }
return;
}
if (ask) {
vraw();
#endif
if (ask) {
+#ifdef EATQS
/*
* Gobble ^Q/^S since the tty driver should be eating
* them (as far as the user can see)
*/
while (peekkey() == CTRL(Q) || peekkey() == CTRL(S))
ignore(getkey());
- if(getkey() == ':')
+#endif
+ if(getkey() == ':') {
+ /* Ugh. Extra newlines, but no other way */
+ putch('\n');
+ outline = WECHO;
ungetkey(':');
+ }
+ }
+ vclrech(1);
+ if (Peekkey != ':') {
+ putpad(TI);
+ tostart();
+ /* replaced by ostart.
+ putpad(VS);
+ putpad(KS);
+ */
}
- putpad(VS);
- putpad(KS);
}
}
vmoveitup(1, 0);
vgoto(WECHO, 0);
vclrbyte(vtube[WECHO], WCOLS);
+ tostop();
+ /* replaced by the ostop above
putpad(VE);
putpad(KE);
+ */
}
flush();
}