mirror of https://github.com/tildeclub/ex-vi.git
* The 'source' ex command now works if command input comes from a pipe or
regular file.
This commit is contained in:
parent
124bd15ee6
commit
50bf5781f9
2
Changes
2
Changes
|
@ -35,6 +35,8 @@ Release ...
|
|||
the command now succeeds and prints a "[New file]" message.
|
||||
* If standard output is not a terminal, no '\r' is written at the end of
|
||||
printed lines anymore.
|
||||
* The 'source' ex command now works if command input comes from a pipe or
|
||||
regular file.
|
||||
|
||||
Release 1/19/05
|
||||
* The last release erroneously made 'X' work like 'x' in visual mode. It now
|
||||
|
|
6
ex.h
6
ex.h
|
@ -72,7 +72,7 @@
|
|||
*
|
||||
* from ex.h 7.7.1.1 (Berkeley) 8/12/86
|
||||
*
|
||||
* @(#)ex.h 1.51 (gritter) 2/15/05
|
||||
* @(#)ex.h 1.52 (gritter) 2/17/05
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -398,7 +398,7 @@ var bool inopen; /* Inside open or visual */
|
|||
var char *input; /* Current position in cmd line input buffer */
|
||||
var bool intty; /* Input is a tty */
|
||||
var short io; /* General i/o unit (auto-closed on error!) */
|
||||
extern short lastc; /* Last character ret'd from cmd input */
|
||||
extern int lastc; /* Last character ret'd from cmd input */
|
||||
var bool laste; /* Last command was an "e" (or "rec") */
|
||||
var char lastmac; /* Last macro called for ** */
|
||||
var char lasttag[TAGSIZE]; /* Last argument to a tag command */
|
||||
|
@ -417,7 +417,7 @@ var shand oldxfsz; /* Previous SIGXFSZ handler */
|
|||
var short oprompt; /* Saved during source */
|
||||
extern unsigned short ospeed; /* Output speed (from gtty) */
|
||||
var int otchng; /* Backup tchng to find changes in macros */
|
||||
var short peekc; /* Peek ahead character (cmd mode input) */
|
||||
var int peekc; /* Peek ahead character (cmd mode input) */
|
||||
var char *pkill[2]; /* Trim for put with ragged (LISP) delete */
|
||||
var bool pfast; /* Have stty -nl'ed to go faster */
|
||||
var pid_t pid; /* Process id of child */
|
||||
|
|
4
ex_get.c
4
ex_get.c
|
@ -73,7 +73,7 @@
|
|||
|
||||
#ifndef lint
|
||||
#ifdef DOSCCS
|
||||
static char sccsid[] = "@(#)ex_get.c 1.16 (gritter) 11/24/04";
|
||||
static char sccsid[] = "@(#)ex_get.c 1.17 (gritter) 2/17/05";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -88,7 +88,7 @@ static char sccsid[] = "@(#)ex_get.c 1.16 (gritter) 11/24/04";
|
|||
* we have different flavors of routines which do/don't return such.
|
||||
*/
|
||||
static bool junkbs;
|
||||
short lastc = '\n';
|
||||
int lastc = '\n';
|
||||
|
||||
void
|
||||
ignchar(void)
|
||||
|
|
25
ex_io.c
25
ex_io.c
|
@ -73,7 +73,7 @@
|
|||
|
||||
#ifndef lint
|
||||
#ifdef DOSCCS
|
||||
static char sccsid[] = "@(#)ex_io.c 1.39 (gritter) 2/17/05";
|
||||
static char sccsid[] = "@(#)ex_io.c 1.40 (gritter) 2/17/05";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -964,14 +964,19 @@ source(char *fil, bool okfail)
|
|||
{
|
||||
JMP_BUF osetexit;
|
||||
register int saveinp, ointty, oerrno;
|
||||
char *saveglobp;
|
||||
short savepeekc;
|
||||
char *saveglobp, *saveinput;
|
||||
char saveinline[BUFSIZ];
|
||||
int savepeekc, savelastc;
|
||||
|
||||
signal(SIGINT, SIG_IGN);
|
||||
saveinp = dup(0);
|
||||
savepeekc = peekc;
|
||||
savelastc = lastc;
|
||||
saveglobp = globp;
|
||||
peekc = 0; globp = 0;
|
||||
saveinput = input;
|
||||
if (input)
|
||||
strcpy(saveinline, input);
|
||||
peekc = 0; lastc = 0; globp = 0; input = 0;
|
||||
if (saveinp < 0)
|
||||
error(catgets(catd, 1, 119, "Too many nested sources"));
|
||||
if (slevel <= 0)
|
||||
|
@ -982,6 +987,10 @@ source(char *fil, bool okfail)
|
|||
setrupt();
|
||||
dup(saveinp);
|
||||
close(saveinp);
|
||||
input = saveinput;
|
||||
if (input)
|
||||
strcpy(input, saveinline);
|
||||
lastc = savelastc;
|
||||
errno = oerrno;
|
||||
if (!okfail)
|
||||
filioerr(fil);
|
||||
|
@ -1000,6 +1009,10 @@ source(char *fil, bool okfail)
|
|||
close(0);
|
||||
dup(saveinp);
|
||||
close(saveinp);
|
||||
input = saveinput;
|
||||
if (input)
|
||||
strcpy(input, saveinline);
|
||||
lastc = savelastc;
|
||||
slevel--;
|
||||
resexit(osetexit);
|
||||
reset();
|
||||
|
@ -1010,7 +1023,11 @@ source(char *fil, bool okfail)
|
|||
dup(saveinp);
|
||||
close(saveinp);
|
||||
globp = saveglobp;
|
||||
input = saveinput;
|
||||
if (input)
|
||||
strcpy(input, saveinline);
|
||||
peekc = savepeekc;
|
||||
lastc = savelastc;
|
||||
slevel--;
|
||||
resexit(osetexit);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue