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

Diff for /src/usr.bin/mg/file.c between version 1.58 and 1.59

version 1.58, 2006/06/01 05:34:52 version 1.59, 2006/06/01 09:00:50
Line 282 
Line 282 
         struct line     *lp1, *lp2;          struct line     *lp1, *lp2;
         struct line     *olp;                   /* line we started at */          struct line     *olp;                   /* line we started at */
         struct mgwin    *wp;          struct mgwin    *wp;
         int      nbytes, s, nline, siz, x = -1, x2;          int      nbytes, s, nline = 0, siz, x = -1, x2;
         int      opos;                  /* offset we started at */          int      opos;                  /* offset we started at */
           int      oline;                 /* original line number */
   
         if (replacebuf == TRUE)          if (replacebuf == TRUE)
                 x = undo_enable(FALSE);                  x = undo_enable(FALSE);
Line 334 
Line 335 
         }          }
         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. */
         x2 = undo_enable(FALSE);          x2 = undo_enable(FALSE);
           oline = curwp->w_dotline;
         (void)lnewline();          (void)lnewline();
         olp = lback(curwp->w_dotp);          olp = lback(curwp->w_dotp);
         if (olp == curbp->b_linep) {          if (olp == curbp->b_linep) {
Line 353 
Line 355 
                 siz += nbytes + 1;                  siz += nbytes + 1;
                 switch (s) {                  switch (s) {
                 case FIOSUC:                  case FIOSUC:
                         ++nline;  
                         /* FALLTHRU */                          /* FALLTHRU */
                 case FIOEOF:                  case FIOEOF:
                         /* the last line of the file */                          /* the last line of the file */
                           ++nline;
                         if ((lp1 = lalloc(nbytes)) == NULL) {                          if ((lp1 = lalloc(nbytes)) == NULL) {
                                 /* keep message on the display */                                  /* keep message on the display */
                                 s = FIOERR;                                  s = FIOERR;
Line 402 
Line 404 
                 }                  }
         }          }
 endoffile:  endoffile:
         undo_add_insert(olp, opos, siz-1);          undo_add_insert(olp, opos, siz - 1);
   
         /* ignore errors */          /* ignore errors */
         ffclose(NULL);          ffclose(NULL);
Line 419 
Line 421 
         (void)ldelnewline();          (void)ldelnewline();
         curwp->w_dotp = olp;          curwp->w_dotp = olp;
         curwp->w_doto = opos;          curwp->w_doto = opos;
           curwp->w_dotline = oline;
         if (olp == curbp->b_linep)          if (olp == curbp->b_linep)
                 curwp->w_dotp = lforw(olp);                  curwp->w_dotp = lforw(olp);
         if (newname != NULL)          if (newname != NULL)
Line 453 
Line 456 
                         }                          }
                 }                  }
         }          }
           bp->b_lines += nline;
 cleanup:  cleanup:
         undo_enable(x);          undo_enable(x);
   
Line 564 
Line 568 
  * Since we don't have variables (we probably should) this is a command   * Since we don't have variables (we probably should) this is a command
  * processor for changing the value of the make backup flag.  If no argument   * processor for changing the value of the make backup flag.  If no argument
  * is given, sets makebackup to true, so backups are made.  If an argument is   * is given, sets makebackup to true, so backups are made.  If an argument is
  * given, no backup files are made when saving a new version of a file. Only   * given, no backup files are made when saving a new version of a file.
  * used when BACKUP is #defined.  
  */   */
 /* ARGSUSED */  /* ARGSUSED */
 int  int

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.59