version 1.2, 2000/02/26 22:53:16 |
version 1.3, 2000/04/13 06:12:14 |
|
|
*/ |
*/ |
#include "def.h" |
#include "def.h" |
|
|
BUFFER *findbuffer(); |
static char *itos __P((char *, unsigned int)); |
VOID makename(); |
|
VOID upmodes(); |
|
static char *itos(); |
|
|
|
/* |
/* |
* insert a file into the current buffer. Real easy - just call the |
* insert a file into the current buffer. Real easy - just call the |
* insertfile routine with the file name. |
* insertfile routine with the file name. |
*/ |
*/ |
/*ARGSUSED*/ |
/* ARGSUSED */ |
|
int |
fileinsert(f, n) |
fileinsert(f, n) |
|
int f, n; |
{ |
{ |
register int s; |
int s; |
char fname[NFILEN]; |
char fname[NFILEN]; |
|
|
if ((s=eread("Insert file: ", fname, NFILEN, EFNEW|EFCR|EFFILE)) != TRUE) |
s = eread("Insert file: ", fname, NFILEN, EFNEW | EFCR | EFFILE); |
|
if (s != TRUE) |
return (s); |
return (s); |
return insertfile(adjustname(fname), (char *) NULL, FALSE); |
return insertfile(adjustname(fname), (char *) NULL, FALSE); |
/* don't set buffer name */ |
/* don't set buffer name */ |
} |
} |
|
|
/* |
/* |
|
|
* the file, create a new buffer, read in the |
* the file, create a new buffer, read in the |
* text, and switch to the new buffer. |
* text, and switch to the new buffer. |
*/ |
*/ |
/*ARGSUSED*/ |
/* ARGSUSED */ |
|
int |
filevisit(f, n) |
filevisit(f, n) |
|
int f, n; |
{ |
{ |
register BUFFER *bp; |
BUFFER *bp; |
int s; |
int s; |
char fname[NFILEN]; |
char fname[NFILEN]; |
char *adjf; |
char *adjf; |
|
|
if ((s=eread("Find file: ", fname, NFILEN, EFNEW|EFCR|EFFILE)) != TRUE) |
s = eread("Find file: ", fname, NFILEN, EFNEW | EFCR | EFFILE); |
|
if (s != TRUE) |
return s; |
return s; |
adjf = adjustname(fname); |
adjf = adjustname(fname); |
if ((bp = findbuffer(adjf)) == NULL) return FALSE; |
if ((bp = findbuffer(adjf)) == NULL) |
|
return FALSE; |
curbp = bp; |
curbp = bp; |
if (showbuffer(bp, curwp, WFHARD) != TRUE) return FALSE; |
if (showbuffer(bp, curwp, WFHARD) != TRUE) |
|
return FALSE; |
if (bp->b_fname[0] == 0) |
if (bp->b_fname[0] == 0) |
return readin(adjf); /* Read it in. */ |
return readin(adjf); /* Read it in. */ |
return TRUE; |
return TRUE; |
} |
} |
|
|
|
|
* Pop to a file in the other window. Same as last function, just |
* Pop to a file in the other window. Same as last function, just |
* popbuf instead of showbuffer. |
* popbuf instead of showbuffer. |
*/ |
*/ |
/*ARGSUSED*/ |
/* ARGSUSED */ |
|
int |
poptofile(f, n) |
poptofile(f, n) |
|
int f, n; |
{ |
{ |
register BUFFER *bp; |
BUFFER *bp; |
register MGWIN *wp; |
MGWIN *wp; |
int s; |
int s; |
char fname[NFILEN]; |
char fname[NFILEN]; |
char *adjf; |
char *adjf; |
|
|
if ((s=eread("Find file in other window: ", fname, NFILEN, |
if ((s = eread("Find file in other window: ", fname, NFILEN, |
EFNEW|EFCR|EFFILE)) != TRUE) |
EFNEW | EFCR | EFFILE)) != TRUE) |
return s; |
return s; |
adjf = adjustname(fname); |
adjf = adjustname(fname); |
if ((bp = findbuffer(adjf)) == NULL) return FALSE; |
if ((bp = findbuffer(adjf)) == NULL) |
if ((wp = popbuf(bp)) == NULL) return FALSE; |
return FALSE; |
|
if ((wp = popbuf(bp)) == NULL) |
|
return FALSE; |
curbp = bp; |
curbp = bp; |
curwp = wp; |
curwp = wp; |
if (bp->b_fname[0] == 0) |
if (bp->b_fname[0] == 0) |
return readin(adjf); /* Read it in. */ |
return readin(adjf); /* Read it in. */ |
return TRUE; |
return TRUE; |
} |
} |
|
|
|
|
*/ |
*/ |
BUFFER * |
BUFFER * |
findbuffer(fname) |
findbuffer(fname) |
char *fname; |
char *fname; |
{ |
{ |
register BUFFER *bp; |
BUFFER *bp; |
char bname[NBUFN], *cp; |
char bname[NBUFN], *cp; |
unsigned count = 1; |
unsigned int count = 1; |
|
|
for (bp=bheadp; bp!=NULL; bp=bp->b_bufp) { |
for (bp = bheadp; bp != NULL; bp = bp->b_bufp) { |
if (fncmp(bp->b_fname, fname) == 0) |
if (fncmp(bp->b_fname, fname) == 0) |
return bp; |
return bp; |
} |
} |
makename(bname, fname); /* New buffer name. */ |
makename(bname, fname); /* New buffer name. */ |
cp = bname + strlen(bname); |
cp = bname + strlen(bname); |
while(bfind(bname, FALSE) != NULL) { |
while (bfind(bname, FALSE) != NULL) { |
*cp = '<'; /* add "<count>" to then name */ |
*cp = '<'; /* add "<count>" to then name */ |
(VOID) strcpy(itos(cp, ++count)+1, ">"); |
(VOID) strcpy(itos(cp, ++count) + 1, ">"); |
} |
} |
return bfind(bname, TRUE); |
return bfind(bname, TRUE); |
} |
} |
|
|
* Put the decimal representation of num into a buffer. Hacked to be |
* Put the decimal representation of num into a buffer. Hacked to be |
* faster, smaller, and less general. |
* faster, smaller, and less general. |
*/ |
*/ |
static char *itos(bufp, num) |
static char * |
char *bufp; |
itos(bufp, num) |
unsigned num; |
char *bufp; |
|
unsigned int num; |
{ |
{ |
|
|
if (num >= 10) { |
if (num >= 10) { |
bufp = itos(bufp, num/10); |
bufp = itos(bufp, num / 10); |
num %= 10; |
num %= 10; |
} |
} |
*++bufp = '0' + num; |
*++bufp = '0' + num; |
|
|
* for unsaved changes. This is called by the "read" command, the |
* for unsaved changes. This is called by the "read" command, the |
* "visit" command, and the mainline (for "uemacs file"). |
* "visit" command, and the mainline (for "uemacs file"). |
*/ |
*/ |
readin(fname) char *fname; { |
int |
register int status; |
readin(fname) |
register MGWIN *wp; |
char *fname; |
|
{ |
|
int status; |
|
MGWIN *wp; |
|
|
if (bclear(curbp) != TRUE) /* Might be old. */ |
if (bclear(curbp) != TRUE) /* Might be old. */ |
return TRUE; |
return TRUE; |
status = insertfile(fname, fname, TRUE) ; |
status = insertfile(fname, fname, TRUE); |
curbp->b_flag &= ~BFCHG; /* No change. */ |
curbp->b_flag &= ~BFCHG;/* No change. */ |
for (wp=wheadp; wp!=NULL; wp=wp->w_wndp) { |
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { |
if (wp->w_bufp == curbp) { |
if (wp->w_bufp == curbp) { |
wp->w_dotp = wp->w_linep = lforw(curbp->b_linep); |
wp->w_dotp = wp->w_linep = lforw(curbp->b_linep); |
wp->w_doto = 0; |
wp->w_doto = 0; |
wp->w_markp = NULL; |
wp->w_markp = NULL; |
wp->w_marko = 0; |
wp->w_marko = 0; |
} |
} |
|
|
* read in, but not on a new file (you don't need to make a backup |
* read in, but not on a new file (you don't need to make a backup |
* copy of nothing). |
* copy of nothing). |
*/ |
*/ |
static char *line = NULL; |
static char *line = NULL; |
static int linesize = 0; |
static int linesize = 0; |
|
|
insertfile(fname, newname, needinfo) char fname[], newname[]; { |
int |
register LINE *lp1; |
insertfile(fname, newname, needinfo) |
register LINE *lp2; |
char *fname, *newname; |
register MGWIN *wp; |
int needinfo; |
int nbytes; |
{ |
LINE *olp; /* Line we started at */ |
LINE *lp1; |
int opos; /* and offset into it */ |
LINE *lp2; |
int s, nline; |
MGWIN *wp; |
BUFFER *bp; |
int nbytes; |
|
LINE *olp; /* Line we started at */ |
|
int opos; /* and offset into it */ |
|
int s, nline; |
|
BUFFER *bp; |
|
|
if (line == NULL) { |
if (line == NULL) { |
line = malloc(NLINE); |
line = malloc(NLINE); |
linesize = NLINE; |
linesize = NLINE; |
} |
} |
bp = curbp; /* Cheap. */ |
bp = curbp; /* Cheap. */ |
if (newname != (char *) NULL) |
if (newname != (char *) NULL) |
(VOID) strcpy(bp->b_fname, newname); |
(VOID) strcpy(bp->b_fname, newname); |
/* Hard file open. */ |
/* Hard file open. */ |
if ((s=ffropen(fname, needinfo ? bp : (BUFFER *) NULL)) == FIOERR) |
if ((s = ffropen(fname, needinfo ? bp : (BUFFER *) NULL)) == FIOERR) |
goto out; |
goto out; |
if (s == FIOFNF) { /* File not found. */ |
if (s == FIOFNF) { /* File not found. */ |
if (newname != NULL) |
if (newname != NULL) |
ewprintf("(New file)"); |
ewprintf("(New file)"); |
else ewprintf("(File not found)"); |
else |
|
ewprintf("(File not found)"); |
goto out; |
goto out; |
} |
} |
opos = curwp->w_doto; |
opos = curwp->w_doto; |
/* Open a new line, at point, and start inserting after it */ |
/* Open a new line, at point, and start inserting after it */ |
(VOID) lnewline(); |
(VOID) lnewline(); |
olp = lback(curwp->w_dotp); |
olp = lback(curwp->w_dotp); |
if(olp == curbp->b_linep) { |
if (olp == curbp->b_linep) { |
/* if at end of buffer, create a line to insert before */ |
/* if at end of buffer, create a line to insert before */ |
(VOID) lnewline(); |
(VOID) lnewline(); |
curwp->w_dotp = lback(curwp->w_dotp); |
curwp->w_dotp = lback(curwp->w_dotp); |
} |
} |
nline = 0; /* Don't count fake line at end */ |
nline = 0; /* Don't count fake line at end */ |
while ((s=ffgetline(line, linesize, &nbytes)) != FIOERR) { |
while ((s = ffgetline(line, linesize, &nbytes)) != FIOERR) { |
doneread: |
doneread: |
switch(s) { |
switch (s) { |
case FIOSUC: |
case FIOSUC: |
++nline; |
++nline; |
/* and continue */ |
/* and continue */ |
case FIOEOF: /* the last line of the file */ |
case FIOEOF: /* the last line of the file */ |
if ((lp1=lalloc(nbytes)) == NULL) { |
if ((lp1 = lalloc(nbytes)) == NULL) { |
s = FIOERR; /* Keep message on the */ |
s = FIOERR; /* Keep message on the */ |
goto endoffile; /* display. */ |
goto endoffile; /* display. */ |
} |
} |
bcopy(line, <ext(lp1)[0], nbytes); |
bcopy(line, <ext(lp1)[0], nbytes); |
lp2 = lback(curwp->w_dotp); |
lp2 = lback(curwp->w_dotp); |
lp2->l_fp = lp1; |
lp2->l_fp = lp1; |
lp1->l_fp = curwp->w_dotp; |
lp1->l_fp = curwp->w_dotp; |
lp1->l_bp = lp2; |
lp1->l_bp = lp2; |
curwp->w_dotp->l_bp = lp1; |
curwp->w_dotp->l_bp = lp1; |
if(s==FIOEOF) goto endoffile; |
if (s == FIOEOF) |
break; |
goto endoffile; |
case FIOLONG: { /* a line to long to fit in our buffer */ |
break; |
char *cp; |
case FIOLONG:{ /* a line too long to fit in our buffer */ |
int newsize; |
char *cp; |
|
int newsize; |
|
|
newsize = linesize * 2; |
newsize = linesize * 2; |
if(newsize < 0 || |
if (newsize < 0 || |
(cp = malloc((unsigned)newsize)) == NULL) { |
(cp = malloc((unsigned) newsize)) == NULL) { |
ewprintf("Could not allocate %d bytes", |
ewprintf("Could not allocate %d bytes", |
newsize); |
newsize); |
s = FIOERR; |
s = FIOERR; |
goto endoffile; |
goto endoffile; |
} |
} |
bcopy(line, cp, linesize); |
bcopy(line, cp, linesize); |
free(line); |
free(line); |
line = cp; |
line = cp; |
s=ffgetline(line+linesize, linesize, &nbytes); |
s = ffgetline(line + linesize, linesize, &nbytes); |
nbytes += linesize; |
nbytes += linesize; |
linesize = newsize; |
linesize = newsize; |
if (s == FIOERR) |
if (s == FIOERR) |
goto endoffile; |
goto endoffile; |
goto doneread; |
goto doneread; |
|
} |
|
default: |
|
ewprintf("Unknown code %d reading file", s); |
|
s = FIOERR; |
|
break; |
} |
} |
default: |
|
ewprintf("Unknown code %d reading file", s); |
|
s = FIOERR; |
|
break; |
|
} |
|
} |
} |
endoffile: |
endoffile: |
(VOID) ffclose((BUFFER *) NULL); /* Ignore errors. */ |
(VOID) ffclose((BUFFER *) NULL); /* Ignore errors. */ |
if (s==FIOEOF) { /* Don't zap an error. */ |
if (s == FIOEOF) { /* Don't zap an error. */ |
if (nline == 1) ewprintf("(Read 1 line)"); |
if (nline == 1) |
else ewprintf("(Read %d lines)", nline); |
ewprintf("(Read 1 line)"); |
|
else |
|
ewprintf("(Read %d lines)", nline); |
} |
} |
/* Set mark at the end of the text */ |
/* Set mark at the end of the text */ |
curwp->w_dotp = curwp->w_markp = lback(curwp->w_dotp); |
curwp->w_dotp = curwp->w_markp = lback(curwp->w_dotp); |
|
|
(VOID) ldelnewline(); |
(VOID) ldelnewline(); |
curwp->w_dotp = olp; |
curwp->w_dotp = olp; |
curwp->w_doto = opos; |
curwp->w_doto = opos; |
if(olp == curbp->b_linep) curwp->w_dotp = lforw(olp); |
if (olp == curbp->b_linep) |
|
curwp->w_dotp = lforw(olp); |
#ifndef NO_BACKUP |
#ifndef NO_BACKUP |
if (newname != NULL) |
if (newname != NULL) |
bp->b_flag |= BFCHG | BFBAK; /* Need a backup. */ |
bp->b_flag |= BFCHG | BFBAK; /* Need a backup. */ |
else bp->b_flag |= BFCHG; |
else |
|
bp->b_flag |= BFCHG; |
#else |
#else |
bp->b_flag |= BFCHG; |
bp->b_flag |= BFCHG; |
#endif |
#endif |
/* if the insert was at the end of buffer, set lp1 to the end of |
/* |
* buffer line, and lp2 to the beginning of the newly inserted |
* if the insert was at the end of buffer, set lp1 to the end of |
* text. (Otherwise lp2 is set to NULL.) This is |
* buffer line, and lp2 to the beginning of the newly inserted text. |
* used below to set pointers in other windows correctly if they |
* (Otherwise lp2 is set to NULL.) This is used below to set |
* are also at the end of buffer. |
* pointers in other windows correctly if they are also at the end of |
|
* buffer. |
*/ |
*/ |
lp1 = bp->b_linep; |
lp1 = bp->b_linep; |
if (curwp->w_markp == lp1) { |
if (curwp->w_markp == lp1) { |
lp2 = curwp->w_dotp; |
lp2 = curwp->w_dotp; |
} else { |
} else { |
(VOID) ldelnewline(); /* delete extranious newline */ |
(VOID) ldelnewline(); /* delete extranious newline */ |
out: lp2 = NULL; |
out: lp2 = NULL; |
} |
} |
for (wp=wheadp; wp!=NULL; wp=wp->w_wndp) { |
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { |
if (wp->w_bufp == curbp) { |
if (wp->w_bufp == curbp) { |
wp->w_flag |= WFMODE|WFEDIT; |
wp->w_flag |= WFMODE | WFEDIT; |
if (wp != curwp && lp2 != NULL) { |
if (wp != curwp && lp2 != NULL) { |
if (wp->w_dotp == lp1) wp->w_dotp = lp2; |
if (wp->w_dotp == lp1) |
if (wp->w_markp == lp1) wp->w_markp = lp2; |
wp->w_dotp = lp2; |
if (wp->w_linep == lp1) wp->w_linep = lp2; |
if (wp->w_markp == lp1) |
|
wp->w_markp = lp2; |
|
if (wp->w_linep == lp1) |
|
wp->w_linep = lp2; |
} |
} |
} |
} |
} |
} |
return s != FIOERR; /* False if error. */ |
return s != FIOERR; /* False if error. */ |
} |
} |
|
|
/* |
/* |
|
|
* BDC3 optional right scan delimiter. |
* BDC3 optional right scan delimiter. |
*/ |
*/ |
VOID |
VOID |
makename(bname, fname) char bname[]; char fname[]; { |
makename(bname, fname) |
register char *cp1; |
char *bname; |
register char *cp2; |
char *fname; |
|
{ |
|
char *cp1; |
|
char *cp2; |
|
|
cp1 = &fname[0]; |
cp1 = &fname[0]; |
while (*cp1 != 0) |
while (*cp1 != 0) |
++cp1; |
++cp1; |
--cp1; /* insure at least 1 character ! */ |
--cp1; /* insure at least 1 character ! */ |
#ifdef BDC2 |
#ifdef BDC2 |
while (cp1!=&fname[0] && cp1[-1]!=BDC1 && cp1[-1]!=BDC2) |
while (cp1 != &fname[0] && cp1[-1] != BDC1 && cp1[-1] != BDC2) |
--cp1; |
--cp1; |
#else |
#else |
while (cp1!=&fname[0] && cp1[-1]!=BDC1) |
while (cp1 != &fname[0] && cp1[-1] != BDC1) |
--cp1; |
--cp1; |
#endif |
#endif |
cp2 = &bname[0]; |
cp2 = &bname[0]; |
#ifdef BDC3 |
#ifdef BDC3 |
while (cp2!=&bname[NBUFN-1] && *cp1!=0 && *cp1!=BDC3) |
while (cp2 != &bname[NBUFN - 1] && *cp1 != 0 && *cp1 != BDC3) |
*cp2++ = *cp1++; |
*cp2++ = *cp1++; |
#else |
#else |
while (cp2!=&bname[NBUFN-1] && *cp1!=0) |
while (cp2 != &bname[NBUFN - 1] && *cp1 != 0) |
*cp2++ = *cp1++; |
*cp2++ = *cp1++; |
#endif |
#endif |
*cp2 = 0; |
*cp2 = 0; |
|
|
* is more compatable with Gosling EMACS than |
* is more compatable with Gosling EMACS than |
* with ITS EMACS. |
* with ITS EMACS. |
*/ |
*/ |
/*ARGSUSED*/ |
/* ARGSUSED */ |
|
int |
filewrite(f, n) |
filewrite(f, n) |
|
int f, n; |
{ |
{ |
register int s; |
int s; |
char fname[NFILEN]; |
char fname[NFILEN]; |
char *adjfname; |
char *adjfname; |
|
|
if ((s=eread("Write file: ", fname, NFILEN, |
if ((s = eread("Write file: ", fname, NFILEN, |
EFNEW|EFCR|EFFILE)) != TRUE) |
EFNEW | EFCR | EFFILE)) != TRUE) |
return (s); |
return (s); |
adjfname = adjustname(fname); |
adjfname = adjustname(fname); |
/* old attributes are no longer current */ |
/* old attributes are no longer current */ |
bzero(&curbp->b_fi, sizeof(curbp->b_fi)); |
bzero(&curbp->b_fi, sizeof(curbp->b_fi)); |
if ((s=writeout(curbp, adjfname)) == TRUE) { |
if ((s = writeout(curbp, adjfname)) == TRUE) { |
(VOID) strcpy(curbp->b_fname, adjfname); |
(VOID) strcpy(curbp->b_fname, adjfname); |
#ifndef NO_BACKUP |
#ifndef NO_BACKUP |
curbp->b_flag &= ~(BFBAK | BFCHG); |
curbp->b_flag &= ~(BFBAK | BFCHG); |
|
|
#ifndef MAKEBACKUP |
#ifndef MAKEBACKUP |
#define MAKEBACKUP TRUE |
#define MAKEBACKUP TRUE |
#endif |
#endif |
static int makebackup = MAKEBACKUP; |
static int makebackup = MAKEBACKUP; |
#endif |
#endif |
|
|
/*ARGSUSED*/ |
/* ARGSUSED */ |
|
int |
filesave(f, n) |
filesave(f, n) |
{ |
{ |
return buffsave(curbp); |
return buffsave(curbp); |
|
|
* Allow user to select whether or not to make backup files |
* Allow user to select whether or not to make backup files |
* by looking at the value of makebackup. |
* by looking at the value of makebackup. |
*/ |
*/ |
buffsave(bp) BUFFER *bp; { |
int |
register int s; |
buffsave(bp) |
|
BUFFER *bp; |
|
{ |
|
int s; |
|
|
if ((bp->b_flag&BFCHG) == 0) { /* Return, no changes. */ |
if ((bp->b_flag & BFCHG) == 0) { /* Return, no changes. */ |
ewprintf("(No changes need to be saved)"); |
ewprintf("(No changes need to be saved)"); |
return TRUE; |
return TRUE; |
} |
} |
if (bp->b_fname[0] == '\0') { /* Must have a name. */ |
if (bp->b_fname[0] == '\0') { /* Must have a name. */ |
ewprintf("No file name"); |
ewprintf("No file name"); |
return (FALSE); |
return (FALSE); |
} |
} |
#ifndef NO_BACKUP |
#ifndef NO_BACKUP |
if (makebackup && (bp->b_flag&BFBAK)) { |
if (makebackup && (bp->b_flag & BFBAK)) { |
s = fbackupfile(bp->b_fname); |
s = fbackupfile(bp->b_fname); |
if (s == ABORT) /* Hard error. */ |
if (s == ABORT) /* Hard error. */ |
return FALSE; |
return FALSE; |
if (s == FALSE /* Softer error. */ |
if (s == FALSE /* Softer error. */ |
&& (s=eyesno("Backup error, save anyway")) != TRUE) |
&& (s = eyesno("Backup error, save anyway")) != TRUE) |
return s; |
return s; |
} |
} |
#endif |
#endif |
if ((s=writeout(bp, bp->b_fname)) == TRUE) { |
if ((s = writeout(bp, bp->b_fname)) == TRUE) { |
#ifndef NO_BACKUP |
#ifndef NO_BACKUP |
bp->b_flag &= ~(BFCHG | BFBAK); |
bp->b_flag &= ~(BFCHG | BFBAK); |
#else |
#else |
|
|
} |
} |
|
|
#ifndef NO_BACKUP |
#ifndef NO_BACKUP |
/* Since we don't have variables (we probably should) |
/* |
* this is a command processor for changing the value of |
* Since we don't have variables (we probably should) this is a command |
* the make backup flag. If no argument is given, |
* processor for changing the value of the make backup flag. If no argument |
* sets makebackup to true, so backups are made. If |
* is given, sets makebackup to true, so backups are made. If an argument is |
* an argument is given, no backup files are made when |
* given, no backup files are made when saving a new version of a file. Only |
* saving a new version of a file. Only used when BACKUP |
* used when BACKUP is #defined. |
* is #defined. |
|
*/ |
*/ |
/*ARGSUSED*/ |
/* ARGSUSED */ |
|
int |
makebkfile(f, n) |
makebkfile(f, n) |
{ |
{ |
if(f & FFARG) makebackup = n > 0; |
|
else makebackup = !makebackup; |
if (f & FFARG) |
|
makebackup = n > 0; |
|
else |
|
makebackup = !makebackup; |
ewprintf("Backup files %sabled", makebackup ? "en" : "dis"); |
ewprintf("Backup files %sabled", makebackup ? "en" : "dis"); |
return TRUE; |
return TRUE; |
} |
} |
|
|
* in the "fileio.c" package. Most of the grief |
* in the "fileio.c" package. Most of the grief |
* is checking of some sort. |
* is checking of some sort. |
*/ |
*/ |
writeout(bp, fn) register BUFFER *bp; char *fn; { |
int |
register int s; |
writeout(bp, fn) |
|
BUFFER *bp; |
|
char *fn; |
|
{ |
|
int s; |
|
|
if ((s=ffwopen(fn,bp)) != FIOSUC) /* Open writes message. */ |
if ((s = ffwopen(fn, bp)) != FIOSUC) /* Open writes message. */ |
return (FALSE); |
return (FALSE); |
s = ffputbuf(bp); |
s = ffputbuf(bp); |
if (s == FIOSUC) { /* No write error. */ |
if (s == FIOSUC) { /* No write error. */ |
s = ffclose(bp); |
s = ffclose(bp); |
if (s==FIOSUC) |
if (s == FIOSUC) |
ewprintf("Wrote %s", fn); |
ewprintf("Wrote %s", fn); |
} else /* Ignore close error */ |
} else /* Ignore close error */ |
(VOID) ffclose(bp); /* if a write error. */ |
(VOID) ffclose(bp); /* if a write error. */ |
return s == FIOSUC; |
return s == FIOSUC; |
} |
} |
|
|
|
|
* mode line updated. |
* mode line updated. |
*/ |
*/ |
VOID |
VOID |
upmodes(bp) register BUFFER *bp; { |
upmodes(bp) |
register MGWIN *wp; |
BUFFER *bp; |
|
{ |
|
MGWIN *wp; |
|
|
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) |
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) |
if (bp == NULL || curwp->w_bufp == bp) wp->w_flag |= WFMODE; |
if (bp == NULL || curwp->w_bufp == bp) |
|
wp->w_flag |= WFMODE; |
} |
} |