[BACK]Return to buffer.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/buffer.c between version 1.84 and 1.85

version 1.84, 2012/10/22 08:31:42 version 1.85, 2012/10/23 20:51:17
Line 880 
Line 880 
 int  int
 revertbuffer(int f, int n)  revertbuffer(int f, int n)
 {  {
         struct buffer *bp = wheadp->w_bufp;  
         char fbuf[NFILEN + 32];          char fbuf[NFILEN + 32];
   
         if (bp->b_fname[0] == 0) {          if (curbp->b_fname[0] == 0) {
                 ewprintf("Cannot revert buffer not associated with any files.");                  ewprintf("Cannot revert buffer not associated with any files.");
                 return (FALSE);                  return (FALSE);
         }          }
   
         snprintf(fbuf, sizeof(fbuf), "Revert buffer from file %s", bp->b_fname);          snprintf(fbuf, sizeof(fbuf), "Revert buffer from file %s",
               curbp->b_fname);
   
         if (eyorn(fbuf))          if (eyorn(fbuf) == TRUE)
                 return dorevert();                  return dorevert();
   
         return (FALSE);          return (FALSE);
Line 899 
Line 899 
 int  int
 dorevert()  dorevert()
 {  {
         struct mgwin *wp = wheadp;  
         struct buffer *bp = wp->w_bufp;  
         int lineno;          int lineno;
   
         if (access(bp->b_fname, F_OK|R_OK) != 0) {          if (access(curbp->b_fname, F_OK|R_OK) != 0) {
                 if (errno == ENOENT)                  if (errno == ENOENT)
                         ewprintf("File %s no longer exists!",                          ewprintf("File %s no longer exists!",
                             bp->b_fname);                              curbp->b_fname);
                 else                  else
                         ewprintf("File %s is no longer readable!",                          ewprintf("File %s is no longer readable!",
                             bp->b_fname);                              curbp->b_fname);
                 return (FALSE);                  return (FALSE);
         }          }
   
         /* Save our current line, so we can go back after reloading. */          /* Save our current line, so we can go back after reloading. */
         lineno = wp->w_dotline;          lineno = curwp->w_dotline;
   
         /* Prevent readin from asking if we want to kill the buffer. */          /* Prevent readin from asking if we want to kill the buffer. */
         curbp->b_flag &= ~BFCHG;          curbp->b_flag &= ~BFCHG;
   
         if (readin(bp->b_fname))          if (readin(curbp->b_fname))
                 return(setlineno(lineno));                  return(setlineno(lineno));
         return (FALSE);          return (FALSE);
 }  }

Legend:
Removed from v.1.84  
changed lines
  Added in v.1.85