[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.100 and 1.101

version 1.100, 2016/01/02 10:39:19 version 1.101, 2019/06/22 10:21:57
Line 668 
Line 668 
 int  int
 writeout(FILE ** ffp, struct buffer *bp, char *fn)  writeout(FILE ** ffp, struct buffer *bp, char *fn)
 {  {
         struct stat     statbuf;          struct stat      statbuf;
         int      s;          struct line     *lpend;
         char     dp[NFILEN];          int              s, eobnl;
           char             dp[NFILEN];
   
         if (stat(fn, &statbuf) == -1 && errno == ENOENT) {          if (stat(fn, &statbuf) == -1 && errno == ENOENT) {
                 errno = 0;                  errno = 0;
Line 686 
Line 687 
                         return (FIOERR);                          return (FIOERR);
                 }                  }
         }          }
           lpend = bp->b_headp;
           eobnl = 0;
           if (llength(lback(lpend)) != 0) {
                   if (eyorn("No newline at end of file, add one") == TRUE)
                           eobnl = 1;
           }
         /* open writes message */          /* open writes message */
         if ((s = ffwopen(ffp, fn, bp)) != FIOSUC)          if ((s = ffwopen(ffp, fn, bp)) != FIOSUC)
                 return (FALSE);                  return (FALSE);
         s = ffputbuf(*ffp, bp);          s = ffputbuf(*ffp, bp, eobnl);
         if (s == FIOSUC) {          if (s == FIOSUC) {
                 /* no write error */                  /* no write error */
                 s = ffclose(*ffp, bp);                  s = ffclose(*ffp, bp);

Legend:
Removed from v.1.100  
changed lines
  Added in v.1.101