1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-15 17:16:48 -05:00

Compare commits

..

3 Commits

Author SHA1 Message Date
0c584e5490 Revise window flagging on line change.
Evaluation of Value of kill buffer and current line.
2021-09-15 13:15:31 +08:00
b244adf23a Revise fence handling in CMODE. 2021-09-15 11:55:23 +08:00
860bace701 Revise pipe-command. 2021-09-15 11:51:12 +08:00
5 changed files with 284 additions and 313 deletions

32
eval.c
View File

@ -259,7 +259,7 @@ typedef struct {
static void findvar( char *var, variable_description *vd, int size) ;
static int svar( variable_description *var, char *value) ;
static char *i_to_a( int i) ;
static const char *i_to_a( int i) ;
/*
* putctext:
@ -616,11 +616,37 @@ static char *gtusr( char *vname) {
}
/* getctext: grab and return a string with the text of the current line */
static const char *getctext( void) {
static int rsize = 0 ;
static char *rline = NULL ; /* line to return */
/* find the contents of the current line and its length */
line_p lp = curwp->w_dotp ; /* line to copy */
int size = lp->l_used ; /* length of line to return */
if( size >= rsize) {
/* extend storage */
int newsize = size + 1 ;
char *newstr = realloc( rline, newsize) ;
if( newstr == NULL)
return "" ;
rline = newstr ;
rsize = newsize ;
}
/* copy it across */
memcpy( rline, lp->l_text, size) ;
rline[ size] = 0 ;
return rline ;
}
/* gtenv()
*
* char *vname; name of environment variable to retrieve
*/
static char *gtenv( char *vname) {
static const char *gtenv( char *vname) {
unsigned vnum ; /* ordinal number of var referenced */
/* scan the list, looking for the referenced name */
@ -1085,7 +1111,7 @@ static int svar( variable_description *var, char *value)
*
* int i; integer to translate to a string
*/
static char *i_to_a( int i) {
static const char *i_to_a( int i) {
unsigned u ;
int sign ; /* sign of resulting number */
/* returns result string: sign digits null */

View File

@ -55,10 +55,7 @@ static int inspound( int n) {
static int insbrace( int n, int c) {
int ch ; /* last character before input */
int oc ; /* caractere oppose a c */
int i, count ;
int target ; /* column brace should go after */
struct line *oldlp ;
int oldoff ;
/* if not called with {, acts as insertion */
if( c == '}')
@ -67,16 +64,17 @@ static int insbrace( int n, int c) {
return linsert( n, c) ;
/* scan to see if all preceding spaces are white spaces, if not, insert */
for( i = curwp->w_doto - 1 ; i >= 0 ; --i) {
for( int i = curwp->w_doto - 1 ; i >= 0 ; --i) {
ch = lgetc( curwp->w_dotp, i) ;
if( ch != ' ' && ch != '\t')
return linsert( n, c) ;
}
oldlp = curwp->w_dotp ;
oldoff = curwp->w_doto ;
/* save the original cursor position */
line_p oldlp = curwp->w_dotp ;
int oldoff = curwp->w_doto ;
count = 1 ;
int count = 1 ;
do {
if( boundary( curwp->w_dotp, curwp->w_doto, REVERSE)) {
/* at beginning of buffer, no match to be found */
@ -132,10 +130,6 @@ static int insbrace( int n, int c) {
* char ch; fence type to match against
*/
static void fmatch( int ch) {
struct line *oldlp ; /* original line pointer */
int oldoff ; /* and offset */
struct line *toplp ; /* top line in current window */
int count ; /* current fence level count */
int opench ; /* open fence */
/* $tpause <= 0 disable fmatch */
@ -146,8 +140,8 @@ static void fmatch( int ch) {
update( FALSE) ;
/* save the original cursor position */
oldlp = curwp->w_dotp ;
oldoff = curwp->w_doto ;
line_p oldlp = curwp->w_dotp ;
int oldoff = curwp->w_doto ;
/* setup proper open fence for passed close fence */
if( ch == ')')
@ -158,11 +152,11 @@ static void fmatch( int ch) {
opench = '[' ;
/* find the top line and set up for scan */
toplp = curwp->w_linep->l_bp ;
line_p toplp = curwp->w_linep->l_bp ;
backchar( FALSE, 1) ; /* . was after the }, move back */
/* scan back until we find it, or reach past the top of the window */
count = 1 ;
int count = 1 ; /* current fence level count */
do {
/* At beginning of window or buffer, no match to be found */
if( curwp->w_dotp == toplp
@ -209,17 +203,14 @@ static void fmatch( int ch) {
* int f, n; not used
*/
BINDABLE( getfence) {
struct line *oldlp; /* original line pointer */
int oldoff; /* and offset */
int sdir; /* direction of search (1/-1) */
int count; /* current fence level count */
char ch; /* fence type to match against */
char ofence; /* open fence */
char c; /* current character in scan */
/* save the original cursor position */
oldlp = curwp->w_dotp;
oldoff = curwp->w_doto;
line_p oldlp = curwp->w_dotp ;
int oldoff = curwp->w_doto ;
/* get the current character */
if (oldoff == llength(oldlp))
@ -259,7 +250,7 @@ BINDABLE( getfence) {
}
/* scan until we find a match, or reach the end of file */
count = 1 ;
int count = 1 ; /* current fence level count */
do {
if( boundary( curwp->w_dotp, curwp->w_doto, sdir)) {
/* at buffer limit, no match to be found */

435
line.c
View File

@ -54,35 +54,23 @@ static char *value = NULL ; /* temp buffer for value */
/*
* return some of the contents of the kill buffer
*/
char *getkill( void) {
kill_p kp ;
char *cp ;
if (kbufh == NULL)
/* no kill buffer....just a null string */
const char *getkill( void) {
/* no kill buffer or no memory .... just return a null string */
if( kbufh == NULL
|| (value = realloc( value, klen + 1)) == NULL)
return "" ;
if( value != NULL)
free( value) ;
value = (char *) malloc( klen + 1) ;
cp = value ;
for( kp = kbufh ; kp != NULL ; kp = kp->d_next) {
int size ;
if( kp->d_next != NULL)
size = KBLOCK ;
else
size = kused ;
char *cp = value ;
for( kill_p kp = kbufh ; kp != NULL ; kp = kp->d_next) {
int size = (kp->d_next != NULL) ? KBLOCK : kused ;
memcpy( cp, kp->d_chunk, size) ;
cp += size ;
}
*cp = 0 ;
/* and return the constructed value */
return value;
/* and return the constructed value */
return value ;
}
@ -240,29 +228,25 @@ void lfree( line_p lp) {
free( lp) ;
}
/*
* This routine gets called when a character is changed in place in the current
/* This routine gets called when a character is changed in place in the current
* buffer. It updates all of the required flags in the buffer and window
* system. The flag used is passed as an argument; if the buffer is being
* displayed in more than 1 window we change EDIT t HARD. Set MODE if the
* displayed in more than 1 window we change EDIT to HARD. Set MODE if the
* mode line needs to be updated (the "*" has to be set).
*/
void lchange(int flag)
{
struct window *wp;
void lchange( int flag) {
if( curbp->b_nwnd != 1) /* Ensure hard. */
flag = WFHARD ;
if (curbp->b_nwnd != 1) /* Ensure hard. */
flag = WFHARD;
if ((curbp->b_flag & BFCHG) == 0) { /* First change, so */
flag |= WFMODE; /* update mode lines. */
curbp->b_flag |= BFCHG;
}
wp = wheadp;
while (wp != NULL) {
if (wp->w_bufp == curbp)
wp->w_flag |= flag;
wp = wp->w_wndp;
if( (curbp->b_flag & BFCHG) == 0) { /* First change, so */
flag |= WFMODE ; /* update mode lines. */
curbp->b_flag |= BFCHG ;
}
for( window_p wp = wheadp ; wp != NULL ; wp = wp->w_wndp)
if( wp->w_bufp == curbp)
wp->w_flag |= flag ;
}
@ -309,81 +293,85 @@ boolean linstr( char *instr) {
boolean linsert_byte( int n, int c) {
char *cp1;
char *cp2;
line_p lp1, lp2, lp3 ;
int doto;
int i;
struct window *wp;
line_p lp2, lp3 ;
int i ;
assert( (curbp->b_mode & MDVIEW) == 0) ;
lchange(WFEDIT);
lp1 = curwp->w_dotp; /* Current line */
if (lp1 == curbp->b_linep) { /* At the end: special */
if (curwp->w_doto != 0) {
mloutstr( "bug: linsert") ;
return FALSE;
}
lchange( WFEDIT) ;
line_p lp1 = curwp->w_dotp ; /* Current line */
if( lp1 == curbp->b_linep) { /* At the end: special */
if( curwp->w_doto != 0)
return mloutfail( "bug: linsert") ;
lp2 = lalloc( n) ; /* Allocate new line */
if( lp2 == NULL)
return FALSE ;
lp3 = lp1->l_bp; /* Previous line */
lp3->l_fp = lp2; /* Link in */
lp2->l_fp = lp1;
lp1->l_bp = lp2;
lp2->l_bp = lp3;
for (i = 0; i < n; ++i)
lp2->l_text[i] = c;
curwp->w_dotp = lp2;
curwp->w_doto = n;
return TRUE;
lp3 = lp1->l_bp ; /* Previous line */
lp3->l_fp = lp2 ; /* Link in */
lp2->l_fp = lp1 ;
lp1->l_bp = lp2 ;
lp2->l_bp = lp3 ;
for( i = 0 ; i < n ; ++i)
lp2->l_text[ i] = c ;
curwp->w_dotp = lp2 ;
curwp->w_doto = n ;
return TRUE ;
}
doto = curwp->w_doto; /* Save for later. */
if (lp1->l_used + n > lp1->l_size) { /* Hard: reallocate */
int doto = curwp->w_doto ; /* Save for later. */
if( lp1->l_used + n > lp1->l_size) { /* Hard: reallocate */
lp2 = lalloc( lp1->l_used + n) ;
if( lp2 == NULL)
return FALSE ;
cp1 = &lp1->l_text[0];
cp2 = &lp2->l_text[0];
while (cp1 != &lp1->l_text[doto])
*cp2++ = *cp1++;
cp2 += n;
while (cp1 != &lp1->l_text[lp1->l_used])
*cp2++ = *cp1++;
lp1->l_bp->l_fp = lp2;
lp2->l_fp = lp1->l_fp;
lp1->l_fp->l_bp = lp2;
lp2->l_bp = lp1->l_bp;
free((char *) lp1);
cp1 = &lp1->l_text[ 0] ;
cp2 = &lp2->l_text[ 0] ;
while( cp1 != &lp1->l_text[ doto])
*cp2++ = *cp1++ ;
cp2 += n ;
while( cp1 != &lp1->l_text[ lp1->l_used])
*cp2++ = *cp1++ ;
lp1->l_bp->l_fp = lp2 ;
lp2->l_fp = lp1->l_fp ;
lp1->l_fp->l_bp = lp2 ;
lp2->l_bp = lp1->l_bp ;
free( lp1) ;
} else { /* Easy: in place */
lp2 = lp1; /* Pretend new line */
lp2->l_used += n;
cp2 = &lp1->l_text[lp1->l_used];
cp1 = cp2 - n;
while (cp1 != &lp1->l_text[doto])
*--cp2 = *--cp1;
lp2 = lp1 ; /* Pretend new line */
lp2->l_used += n ;
cp2 = &lp1->l_text[ lp1->l_used] ;
cp1 = cp2 - n ;
while( cp1 != &lp1->l_text[ doto])
*--cp2 = *--cp1 ;
}
for (i = 0; i < n; ++i) /* Add the characters */
lp2->l_text[doto + i] = c;
wp = wheadp; /* Update windows */
while (wp != NULL) {
if (wp->w_linep == lp1)
wp->w_linep = lp2;
if (wp->w_dotp == lp1) {
wp->w_dotp = lp2;
if (wp == curwp || wp->w_doto > doto)
wp->w_doto += n;
for( i = 0 ; i < n ; ++i) /* Add the characters */
lp2->l_text[ doto + i] = c ;
/* Update windows */
for( window_p wp = wheadp ; wp != NULL ; wp = wp->w_wndp) {
if( wp->w_linep == lp1)
wp->w_linep = lp2 ;
if( wp->w_dotp == lp1) {
wp->w_dotp = lp2 ;
if( wp == curwp || wp->w_doto > doto)
wp->w_doto += n ;
}
if (wp->w_markp == lp1) {
wp->w_markp = lp2;
if (wp->w_marko > doto)
wp->w_marko += n;
if( wp->w_markp == lp1) {
wp->w_markp = lp2 ;
if( wp->w_marko > doto)
wp->w_marko += n ;
}
wp = wp->w_wndp;
}
return TRUE;
return TRUE ;
}
boolean linsert( int n, unicode_t c) {
@ -565,101 +553,72 @@ boolean ldelchar( long n, boolean kill_f) {
* int kflag; put killed text in kill buffer flag
*/
boolean ldelete( long n, boolean kflag) {
char *cp1;
char *cp2;
line_p dotp;
int doto;
int chunk;
struct window *wp;
assert( !(curbp->b_mode & MDVIEW)) ;
while( n > 0) {
dotp = curwp->w_dotp;
doto = curwp->w_doto;
if (dotp == curbp->b_linep) /* Hit end of buffer. */
return FALSE;
chunk = dotp->l_used - doto; /* Size of chunk. */
if (chunk > n)
chunk = n;
if (chunk == 0) { /* End of line, merge. */
line_p dotp = curwp->w_dotp ;
if( dotp == curbp->b_linep) /* Hit end of buffer. */
return FALSE ;
int doto = curwp->w_doto ;
int chunk = dotp->l_used - doto ; /* Size of chunk. */
if( chunk == 0) { /* End of line, merge. */
#if SCROLLCODE
lchange(WFHARD | WFKILLS);
lchange( WFHARD | WFKILLS) ;
#else
lchange(WFHARD);
lchange( WFHARD) ;
#endif
if (ldelnewline() == FALSE
|| (kflag != FALSE && kinsert('\n') == FALSE))
return FALSE;
--n;
continue;
}
lchange(WFEDIT);
cp1 = &dotp->l_text[doto]; /* Scrunch text. */
cp2 = cp1 + chunk;
if (kflag != FALSE) { /* Kill? */
while (cp1 != cp2) {
if (kinsert(*cp1) == FALSE)
return FALSE;
++cp1;
}
cp1 = &dotp->l_text[doto];
}
while (cp2 != &dotp->l_text[dotp->l_used])
*cp1++ = *cp2++;
dotp->l_used -= chunk;
wp = wheadp; /* Fix windows */
while (wp != NULL) {
if (wp->w_dotp == dotp && wp->w_doto >= doto) {
wp->w_doto -= chunk;
if (wp->w_doto < doto)
wp->w_doto = doto;
}
if (wp->w_markp == dotp && wp->w_marko >= doto) {
wp->w_marko -= chunk;
if (wp->w_marko < doto)
wp->w_marko = doto;
}
wp = wp->w_wndp;
}
n -= chunk;
}
return TRUE;
}
if( ldelnewline() == FALSE
|| (kflag != FALSE && kinsert( '\n') == FALSE))
return FALSE ;
/*
* getctext: grab and return a string with the text of
* the current line
*/
char *getctext( void) {
line_p lp ; /* line to copy */
int size; /* length of line to return */
static int rsize = 0 ;
static char *rline ; /* line to return */
--n ;
continue ;
} else if( chunk > n)
chunk = n ;
/* find the contents of the current line and its length */
lp = curwp->w_dotp;
size = lp->l_used;
if( size >= rsize) {
if( rsize)
free( rline) ;
lchange( WFEDIT) ;
char *cp1 = &dotp->l_text[ doto] ; /* Scrunch text. */
char *cp2 = cp1 + chunk ;
if( kflag != FALSE) { /* Kill? */
while( cp1 != cp2) {
if( kinsert( *cp1) == FALSE)
return FALSE ;
++cp1 ;
}
rsize = size + 1 ;
rline = malloc( rsize) ;
if( rline == NULL) {
rsize = 0 ;
return "" ;
cp1 = &dotp->l_text[ doto] ;
}
while( cp2 != &dotp->l_text[ dotp->l_used])
*cp1++ = *cp2++ ;
dotp->l_used -= chunk ;
/* Fix windows */
for( window_p wp = wheadp ; wp != NULL ; wp = wp->w_wndp) {
if( wp->w_dotp == dotp && wp->w_doto >= doto) {
wp->w_doto -= chunk ;
if( wp->w_doto < doto)
wp->w_doto = doto ;
}
if( wp->w_markp == dotp && wp->w_marko >= doto) {
wp->w_marko -= chunk ;
if( wp->w_marko < doto)
wp->w_marko = doto ;
}
}
n -= chunk ;
}
/* copy it across */
memcpy( rline, lp->l_text, size) ;
rline[ size] = 0 ;
return rline ;
return TRUE ;
}
/*
* Delete a newline. Join the current line with the next line. If the next line
/* Delete a newline. Join the current line with the next line. If the next line
* is the magic header line always return TRUE; merging the last line with the
* header line can be thought of as always being a successful operation, even
* if nothing is done, and this makes the kill buffer work "right". Easy cases
@ -670,80 +629,86 @@ char *getctext( void) {
static int ldelnewline( void) {
char *cp1;
char *cp2;
line_p lp1, lp2, lp3 ;
struct window *wp;
window_p wp ;
assert( (curbp->b_mode & MDVIEW) == 0) ;
lp1 = curwp->w_dotp;
lp2 = lp1->l_fp;
if (lp2 == curbp->b_linep) { /* At the buffer end. */
if (lp1->l_used == 0) /* Blank line. */
lfree(lp1);
return TRUE;
line_p lp1 = curwp->w_dotp ;
line_p lp2 = lp1->l_fp ;
if( lp2 == curbp->b_linep) { /* At the buffer end. */
if( lp1->l_used == 0) /* Blank line. */
lfree( lp1) ;
return TRUE ;
}
if (lp2->l_used <= lp1->l_size - lp1->l_used) {
cp1 = &lp1->l_text[lp1->l_used];
cp2 = &lp2->l_text[0];
while (cp2 != &lp2->l_text[lp2->l_used])
*cp1++ = *cp2++;
wp = wheadp;
while (wp != NULL) {
if (wp->w_linep == lp2)
wp->w_linep = lp1;
if (wp->w_dotp == lp2) {
wp->w_dotp = lp1;
wp->w_doto += lp1->l_used;
if( lp2->l_used <= lp1->l_size - lp1->l_used) {
cp1 = &lp1->l_text[ lp1->l_used] ;
cp2 = lp2->l_text ;
while( cp2 != &lp2->l_text[ lp2->l_used])
*cp1++ = *cp2++ ;
for( wp = wheadp ; wp != NULL ; wp = wp->w_wndp) {
if( wp->w_linep == lp2)
wp->w_linep = lp1 ;
if( wp->w_dotp == lp2) {
wp->w_dotp = lp1 ;
wp->w_doto += lp1->l_used ;
}
if (wp->w_markp == lp2) {
wp->w_markp = lp1;
wp->w_marko += lp1->l_used;
if( wp->w_markp == lp2) {
wp->w_markp = lp1 ;
wp->w_marko += lp1->l_used ;
}
wp = wp->w_wndp;
}
lp1->l_used += lp2->l_used;
lp1->l_fp = lp2->l_fp;
lp2->l_fp->l_bp = lp1;
free((char *) lp2);
return TRUE;
lp1->l_used += lp2->l_used ;
lp1->l_fp = lp2->l_fp ;
lp2->l_fp->l_bp = lp1 ;
free( lp2) ;
return TRUE ;
}
lp3 = lalloc( lp1->l_used + lp2->l_used) ;
line_p lp3 = lalloc( lp1->l_used + lp2->l_used) ;
if( lp3 == NULL)
return FALSE ;
cp1 = &lp1->l_text[0];
cp2 = &lp3->l_text[0];
while (cp1 != &lp1->l_text[lp1->l_used])
*cp2++ = *cp1++;
cp1 = &lp2->l_text[0];
while (cp1 != &lp2->l_text[lp2->l_used])
*cp2++ = *cp1++;
lp1->l_bp->l_fp = lp3;
lp3->l_fp = lp2->l_fp;
lp2->l_fp->l_bp = lp3;
lp3->l_bp = lp1->l_bp;
wp = wheadp;
while (wp != NULL) {
if (wp->w_linep == lp1 || wp->w_linep == lp2)
wp->w_linep = lp3;
if (wp->w_dotp == lp1)
wp->w_dotp = lp3;
else if (wp->w_dotp == lp2) {
wp->w_dotp = lp3;
wp->w_doto += lp1->l_used;
cp1 = lp1->l_text ;
cp2 = lp3->l_text ;
while( cp1 != &lp1->l_text[ lp1->l_used])
*cp2++ = *cp1++ ;
cp1 = lp2->l_text ;
while( cp1 != &lp2->l_text[ lp2->l_used])
*cp2++ = *cp1++ ;
lp1->l_bp->l_fp = lp3 ;
lp3->l_fp = lp2->l_fp ;
lp2->l_fp->l_bp = lp3 ;
lp3->l_bp = lp1->l_bp ;
for( wp = wheadp ; wp != NULL ; wp = wp->w_wndp) {
if( wp->w_linep == lp1 || wp->w_linep == lp2)
wp->w_linep = lp3 ;
if( wp->w_dotp == lp1)
wp->w_dotp = lp3 ;
else if( wp->w_dotp == lp2) {
wp->w_dotp = lp3 ;
wp->w_doto += lp1->l_used ;
}
if (wp->w_markp == lp1)
wp->w_markp = lp3;
else if (wp->w_markp == lp2) {
wp->w_markp = lp3;
wp->w_marko += lp1->l_used;
if( wp->w_markp == lp1)
wp->w_markp = lp3 ;
else if( wp->w_markp == lp2) {
wp->w_markp = lp3 ;
wp->w_marko += lp1->l_used ;
}
wp = wp->w_wndp;
}
free((char *) lp1);
free((char *) lp2);
return TRUE;
free( lp1) ;
free( lp2) ;
return TRUE ;
}

8
line.h
View File

@ -29,15 +29,12 @@ typedef struct line {
extern int tabwidth ; /* Map to $tab, default to 8, can be set to [1, .. */
char *getkill( void) ;
/* Bindable functions */
BBINDABLE( backchar) ;
BBINDABLE( forwchar) ;
BINDABLE( insspace) ;
BINDABLE( yank) ;
void lfree( line_p lp) ;
void lchange( int flag) ;
boolean linstr( char *instr) ;
boolean linsert( int n, unicode_t c) ;
@ -47,10 +44,11 @@ boolean lnewline( void) ;
boolean ldelete( long n, boolean kflag) ;
boolean ldelchar( long n, boolean kflag) ;
int lgetchar( unicode_t *cref) ;
char *getctext( void) ;
void kdelete( void) ;
int kinsert( int c) ;
line_p lalloc( int minsize) ; /* Allocate a line of at least minsize chars. */
line_p lalloc( int minsize) ; /* Allocate a line of at least minsize chars. */
void lfree( line_p lp) ; /* free a line, updating buffers and windows */
const char *getkill( void) ; /* get value of $kill */
boolean rdonly( void) ; /* Read Only error message */

89
spawn.c
View File

@ -169,97 +169,88 @@ BINDABLE( execprg) {
/* Pipe a one line command into a window
* Bound to ^X @
* Bound to pipe-command ^X @
*/
BINDABLE( pipecmd) {
int s ; /* return status from CLI */
struct window *wp ; /* pointer to new window */
buffer_p bp ; /* pointer to buffer to zot */
window_p wp ; /* pointer to new window */
char *mlarg ;
char *line ; /* command line send to shell */
static char bname[] = "command" ;
static char filnam[ NSTRING] = "command" ;
const char filnam[] = "command" ;
/* don't allow this command if restricted */
/* don't allow this command if restricted */
if( restflag)
return resterr() ;
/* get the command to pipe in */
s = newmlarg( &mlarg, "@", 0) ;
/* get the command to pipe in */
int s = newmlarg( &mlarg, "pipe-command: ", 0) ;
if( s != TRUE)
return s ;
line = malloc( strlen( mlarg) + strlen( filnam) + 2) ;
if( line == NULL) {
char *cmdline = malloc( strlen( mlarg) + strlen( filnam) + 4) ;
if( cmdline == NULL) {
free( mlarg) ;
return FALSE ;
}
strcpy( line, mlarg) ;
strcpy( cmdline, mlarg) ;
free( mlarg) ;
strcat( cmdline, " > ") ;
strcat( cmdline, filnam) ;
/* get rid of the command output buffer if it exists */
if ((bp = bfind(bname, FALSE, 0)) != FALSE) {
/* try to make sure we are off screen */
wp = wheadp;
while (wp != NULL) {
if (wp->w_bufp == bp) {
/* get rid of the command output buffer if it exists */
buffer_p bp = bfind( filnam, FALSE, 0) ;
if( bp != NULL) {
/* try to make sure we are off screen */
for( wp = wheadp ; wp != NULL ; wp = wp->w_wndp) {
if( wp->w_bufp == bp) {
#if PKCODE
if (wp == curwp)
delwind(FALSE, 1);
if( wp == curwp)
delwind( FALSE, 1) ;
else
onlywind(FALSE, 1);
break;
onlywind( FALSE, 1) ;
break ;
#else
onlywind(FALSE, 1);
break;
onlywind( FALSE, 1) ;
break ;
#endif
}
wp = wp->w_wndp;
}
if( zotbuf( bp) != TRUE) {
free( line) ;
free( cmdline) ;
return FALSE ;
}
}
#if USG | BSD
TTflush();
TTclose(); /* stty to old modes */
TTkclose();
strcat( line, ">") ;
strcat( line, filnam) ;
ue_system( line) ;
free( line) ;
ue_system( cmdline) ;
free( cmdline) ;
TTopen();
TTkopen();
TTflush();
sgarbf = TRUE;
s = TRUE;
#else
if (s != TRUE)
if( s != TRUE)
return s;
#endif
/* split the current window to make room for the command output */
if (splitwind(FALSE, 1) == FALSE)
return FALSE;
/* split the current window to make room for the command output
** and read the stuff in */
if( splitwind( FALSE, 1) == FALSE
|| getfile( filnam, FALSE) == FALSE)
return FALSE ;
/* and read the stuff in */
if (getfile(filnam, FALSE) == FALSE)
return FALSE;
/* make this window in VIEW mode, update all mode lines */
curwp->w_bufp->b_mode |= MDVIEW ;
for( wp = wheadp ; wp != NULL ; wp = wp->w_wndp)
wp->w_flag |= WFMODE ;
/* make this window in VIEW mode, update all mode lines */
curwp->w_bufp->b_mode |= MDVIEW;
wp = wheadp;
while (wp != NULL) {
wp->w_flag |= WFMODE;
wp = wp->w_wndp;
}
/* and get rid of the temporary file */
unlink(filnam);
return TRUE;
/* and get rid of the temporary file */
unlink( filnam) ;
return TRUE ;
}