[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.9 and 1.10

version 1.9, 2001/05/24 03:05:22 version 1.10, 2002/02/13 03:03:49
Line 95 
Line 95 
         char *fname;          char *fname;
 {  {
         BUFFER          *bp;          BUFFER          *bp;
         char             bname[NBUFN], *cp;          char             bname[NBUFN];
         unsigned int     count = 1;          unsigned int     count = 1;
   
         for (bp = bheadp; bp != NULL; bp = bp->b_bufp) {          for (bp = bheadp; bp != NULL; bp = bp->b_bufp) {
Line 103 
Line 103 
                         return bp;                          return bp;
         }          }
         /* new buffer name */          /* new buffer name */
         strcpy(bname, basename(fname));  
         cp = bname + strlen(bname);  
         for (count = 1; bfind(bname, FALSE) != NULL; count++)          for (count = 1; bfind(bname, FALSE) != NULL; count++)
                 sprintf(cp, "<%d>", count);                  ;
           snprintf(bname, sizeof bname, "%s<%d>", basename(fname), count);
   
         return bfind(bname, TRUE);          return bfind(bname, TRUE);
 }  }
   
Line 182 
Line 182 
         /* cheap */          /* cheap */
         bp = curbp;          bp = curbp;
         if (newname != NULL)          if (newname != NULL)
                 (void)strcpy(bp->b_fname, newname);                  (void)strlcpy(bp->b_fname, newname, sizeof bp->b_fname);
   
         /* hard file open */          /* hard file open */
         if ((s = ffropen(fname, needinfo ? bp : NULL)) == FIOERR)          if ((s = ffropen(fname, needinfo ? bp : NULL)) == FIOERR)
Line 340 
Line 340 
         /* 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)strlcpy(curbp->b_fname, adjfname, sizeof curbp->b_fname);
 #ifndef NO_BACKUP  #ifndef NO_BACKUP
                 curbp->b_flag &= ~(BFBAK | BFCHG);                  curbp->b_flag &= ~(BFBAK | BFCHG);
 #else /* !NO_BACKUP */  #else /* !NO_BACKUP */

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10