[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.18 and 1.19

version 1.18, 2002/05/29 12:41:42 version 1.19, 2002/06/19 22:02:08
Line 121 
Line 121 
  * Read the file "fname" into the current buffer.  Make all of the text   * Read the file "fname" into the current buffer.  Make all of the text
  * in the buffer go away, after checking for unsaved changes.  This is   * in the buffer go away, after checking for unsaved changes.  This is
  * called by the "read" command, the "visit" command, and the mainline   * called by the "read" command, the "visit" command, and the mainline
  * (for "uemacs file").   * (for "mg file").
  */   */
 int  int
 readin(fname)  readin(char *fname)
         char *fname;  
 {  {
         MGWIN   *wp;          MGWIN   *wp;
         int      status, i;          int      status, i;
Line 162 
Line 161 
         else          else
                 curbp->b_flag &=~ BFREADONLY;                  curbp->b_flag &=~ BFREADONLY;
   
   
         return status;          return status;
 }  }
   
Line 194 
Line 192 
         LINE    *lp1, *lp2;          LINE    *lp1, *lp2;
         LINE    *olp;                   /* line we started at */          LINE    *olp;                   /* line we started at */
         MGWIN   *wp;          MGWIN   *wp;
         int      nbytes, s, nline;          int      nbytes, s, nline, siz;
         int      opos;                  /* and offset into it */          int      opos;                  /* offset we started at */
   
         lp1 = NULL;          lp1 = NULL;
   
         if (line == NULL) {          if (line == NULL) {
                 line = malloc(NLINE);                  line = malloc(NLINE);
                 linesize = NLINE;                  linesize = NLINE;
Line 223 
Line 220 
         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();          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 */
Line 233 
Line 230 
   
         /* don't count fake lines at the end */          /* don't count fake lines at the end */
         nline = 0;          nline = 0;
           siz = 0;
         while ((s = ffgetline(line, linesize, &nbytes)) != FIOERR) {          while ((s = ffgetline(line, linesize, &nbytes)) != FIOERR) {
 doneread:  doneread:
                   siz += nbytes + 1;
                 switch (s) {                  switch (s) {
                 case FIOSUC:                  case FIOSUC:
                         ++nline;                          ++nline;
Line 255 
Line 254 
                         if (s == FIOEOF)                          if (s == FIOEOF)
                                 goto endoffile;                                  goto endoffile;
                         break;                          break;
                 case FIOLONG:{                  case FIOLONG: {
                                 /* a line too long to fit in our buffer */                                  /* a line too long to fit in our buffer */
                                 char    *cp;                                  char    *cp;
                                 int     newsize;                                  int     newsize;
Line 286 
Line 285 
                 }                  }
         }          }
 endoffile:  endoffile:
           undo_add_insert(olp, opos, siz);
   
         /* ignore errors */          /* ignore errors */
         ffclose(NULL);          ffclose(NULL);
         /* don't zap an error */          /* don't zap an error */

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19