mirror of https://github.com/tildeclub/ex-vi.git
* Ex does not exit on errors immediately anymore if standard input is not
a terminal but a pipe or regular file.
This commit is contained in:
parent
50bf5781f9
commit
aada6fd740
6
Changes
6
Changes
|
@ -17,8 +17,8 @@ Release ...
|
||||||
* The argument to the -w option is correctly recognized now.
|
* The argument to the -w option is correctly recognized now.
|
||||||
* If the SHELL environment variable is set to the empty string, it is now
|
* If the SHELL environment variable is set to the empty string, it is now
|
||||||
ignored.
|
ignored.
|
||||||
* A non-null exit status is now returned if a file could not be opened, or
|
* A non-null exit status is now returned if a file could not be opened, if
|
||||||
if an invalid address is given for a command.
|
an invalid address is given for a command, or if a tag is not found.
|
||||||
* If the match for a substitution is of length zero, a line overflow is
|
* If the match for a substitution is of length zero, a line overflow is
|
||||||
now avoided when compiled with the 'UNIX(R) Regular Expression Library'.
|
now avoided when compiled with the 'UNIX(R) Regular Expression Library'.
|
||||||
* When moving left while the cursor is positioned over a multicolumn
|
* When moving left while the cursor is positioned over a multicolumn
|
||||||
|
@ -37,6 +37,8 @@ Release ...
|
||||||
printed lines anymore.
|
printed lines anymore.
|
||||||
* The 'source' ex command now works if command input comes from a pipe or
|
* The 'source' ex command now works if command input comes from a pipe or
|
||||||
regular file.
|
regular file.
|
||||||
|
* Ex does not exit on errors immediately anymore if standard input is not
|
||||||
|
a terminal but a pipe or regular file.
|
||||||
|
|
||||||
Release 1/19/05
|
Release 1/19/05
|
||||||
* The last release erroneously made 'X' work like 'x' in visual mode. It now
|
* The last release erroneously made 'X' work like 'x' in visual mode. It now
|
||||||
|
|
3
ex.h
3
ex.h
|
@ -72,7 +72,7 @@
|
||||||
*
|
*
|
||||||
* from ex.h 7.7.1.1 (Berkeley) 8/12/86
|
* from ex.h 7.7.1.1 (Berkeley) 8/12/86
|
||||||
*
|
*
|
||||||
* @(#)ex.h 1.52 (gritter) 2/17/05
|
* @(#)ex.h 1.53 (gritter) 2/17/05
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -438,6 +438,7 @@ var JMP_BUF vreslab; /* For error throws to a visual catch */
|
||||||
var bool writing; /* 1 if in middle of a file write */
|
var bool writing; /* 1 if in middle of a file write */
|
||||||
var int xchng; /* Suppresses multiple "No writes" in !cmd */
|
var int xchng; /* Suppresses multiple "No writes" in !cmd */
|
||||||
var int failed; /* exit with a non-zero status */
|
var int failed; /* exit with a non-zero status */
|
||||||
|
var int exitoneof; /* exit command loop on EOF */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Macros
|
* Macros
|
||||||
|
|
10
ex_cmds.c
10
ex_cmds.c
|
@ -73,7 +73,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#ifdef DOSCCS
|
#ifdef DOSCCS
|
||||||
static char sccsid[] = "@(#)ex_cmds.c 1.18 (gritter) 1/2/05";
|
static char sccsid[] = "@(#)ex_cmds.c 1.20 (gritter) 2/17/05";
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ int poffset;
|
||||||
* processing and call command routines to do the real work.
|
* processing and call command routines to do the real work.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
commands(int noprompt, int exitoneof)
|
commands(int noprompt, int _exitoneof)
|
||||||
{
|
{
|
||||||
register line *addr;
|
register line *addr;
|
||||||
register int c;
|
register int c;
|
||||||
|
@ -110,6 +110,7 @@ commands(int noprompt, int exitoneof)
|
||||||
resetflav();
|
resetflav();
|
||||||
nochng();
|
nochng();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
exitoneof = _exitoneof;
|
||||||
/*
|
/*
|
||||||
* If dot at last command
|
* If dot at last command
|
||||||
* ended up at zero, advance to one if there is a such.
|
* ended up at zero, advance to one if there is a such.
|
||||||
|
@ -834,8 +835,11 @@ wq:
|
||||||
c = getchar();
|
c = getchar();
|
||||||
if (c=='\n' || c=='\r')
|
if (c=='\n' || c=='\r')
|
||||||
ungetchar(c);
|
ungetchar(c);
|
||||||
if (any(c, "@*\n\r"))
|
if (any(c, "@*\n\r")) {
|
||||||
c = lastmac;
|
c = lastmac;
|
||||||
|
if (c == 0)
|
||||||
|
failed = 1;
|
||||||
|
}
|
||||||
if (isupper(c))
|
if (isupper(c))
|
||||||
c = tolower(c);
|
c = tolower(c);
|
||||||
if (!islower(c))
|
if (!islower(c))
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#ifdef DOSCCS
|
#ifdef DOSCCS
|
||||||
static char sccsid[] = "@(#)ex_cmds2.c 1.17 (gritter) 12/1/04";
|
static char sccsid[] = "@(#)ex_cmds2.c 1.18 (gritter) 2/17/05";
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ error0(void)
|
||||||
dingdong();
|
dingdong();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (input) {
|
if (input && exitoneof) {
|
||||||
input = strend(input) - 1;
|
input = strend(input) - 1;
|
||||||
if (*input == '\n')
|
if (*input == '\n')
|
||||||
setlastchar('\n');
|
setlastchar('\n');
|
||||||
|
@ -218,7 +218,8 @@ error1(char *str)
|
||||||
putNFL();
|
putNFL();
|
||||||
if (die)
|
if (die)
|
||||||
exitex(1);
|
exitex(1);
|
||||||
lseek(0, (off_t)0, SEEK_END);
|
if (exitoneof)
|
||||||
|
lseek(0, (off_t)0, SEEK_END);
|
||||||
if (inglobal)
|
if (inglobal)
|
||||||
setlastchar('\n');
|
setlastchar('\n');
|
||||||
while (lastchar() != '\n' && lastchar() != EOF)
|
while (lastchar() != '\n' && lastchar() != EOF)
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
#ifdef DOSCCS
|
#ifdef DOSCCS
|
||||||
static char sccsid[] = "@(#)ex_cmdsub.c 1.27 (gritter) 2/17/05";
|
static char sccsid[] = "@(#)ex_cmdsub.c 1.28 (gritter) 2/17/05";
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -561,6 +561,7 @@ tagfind(bool quick)
|
||||||
char *fn, *fne;
|
char *fn, *fne;
|
||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
char *savefirstpat = NULL;
|
char *savefirstpat = NULL;
|
||||||
|
int ofailed;
|
||||||
#ifdef FASTTAG
|
#ifdef FASTTAG
|
||||||
int ft_iof;
|
int ft_iof;
|
||||||
char ft_iofbuf[MAXBSIZE];
|
char ft_iofbuf[MAXBSIZE];
|
||||||
|
@ -570,6 +571,8 @@ tagfind(bool quick)
|
||||||
|
|
||||||
omagic = value(MAGIC);
|
omagic = value(MAGIC);
|
||||||
owrapscan = value(WRAPSCAN);
|
owrapscan = value(WRAPSCAN);
|
||||||
|
ofailed = failed;
|
||||||
|
failed = 1;
|
||||||
if (!skipend()) {
|
if (!skipend()) {
|
||||||
register char *lp = lasttag;
|
register char *lp = lasttag;
|
||||||
|
|
||||||
|
@ -752,6 +755,7 @@ badtags:
|
||||||
if (tflag)
|
if (tflag)
|
||||||
value(WRAPSCAN) = 1;
|
value(WRAPSCAN) = 1;
|
||||||
commands(1, 1);
|
commands(1, 1);
|
||||||
|
failed = ofailed;
|
||||||
peekc = d;
|
peekc = d;
|
||||||
globp = oglobp;
|
globp = oglobp;
|
||||||
value(MAGIC) = omagic;
|
value(MAGIC) = omagic;
|
||||||
|
|
Loading…
Reference in New Issue