[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.92 and 1.93

version 1.92, 2013/12/23 14:58:16 version 1.93, 2014/03/20 07:47:29
Line 372 
Line 372 
         int              i, ret = FALSE;          int              i, ret = FALSE;
   
         if (curwp->w_dotp->l_text[listbuf_ncol/2 - 1] == '$') {          if (curwp->w_dotp->l_text[listbuf_ncol/2 - 1] == '$') {
                   dobeep();
                 ewprintf("buffer name truncated");                  ewprintf("buffer name truncated");
                 return (FALSE);                  return (FALSE);
         }          }
Line 462 
Line 463 
                         ret = snprintf(pbuf, sizeof(pbuf), "Save file %s",                          ret = snprintf(pbuf, sizeof(pbuf), "Save file %s",
                             bp->b_fname);                              bp->b_fname);
                         if (ret < 0 || ret >= sizeof(pbuf)) {                          if (ret < 0 || ret >= sizeof(pbuf)) {
                                   dobeep();
                                 ewprintf("Error: filename too long!");                                  ewprintf("Error: filename too long!");
                                 return (UERROR);                                  return (UERROR);
                         }                          }
Line 523 
Line 525 
   
         bp = calloc(1, sizeof(struct buffer));          bp = calloc(1, sizeof(struct buffer));
         if (bp == NULL) {          if (bp == NULL) {
                   dobeep();
                 ewprintf("Can't get %d bytes", sizeof(struct buffer));                  ewprintf("Can't get %d bytes", sizeof(struct buffer));
                 return (NULL);                  return (NULL);
         }          }
Line 561 
Line 564 
         bp->b_dotline = bp->b_markline = 1;          bp->b_dotline = bp->b_markline = 1;
         bp->b_lines = 1;          bp->b_lines = 1;
         if ((bp->b_bname = strdup(bname)) == NULL) {          if ((bp->b_bname = strdup(bname)) == NULL) {
                   dobeep();
                 ewprintf("Can't get %d bytes", strlen(bname) + 1);                  ewprintf("Can't get %d bytes", strlen(bname) + 1);
                 return (NULL);                  return (NULL);
         }          }
Line 745 
Line 749 
                 return (FALSE);                  return (FALSE);
   
         if (bp == curbp) {          if (bp == curbp) {
                   dobeep();
                 ewprintf("Cannot insert buffer into self");                  ewprintf("Cannot insert buffer into self");
                 return (FALSE);                  return (FALSE);
         }          }
Line 886 
Line 891 
         char fbuf[NFILEN + 32];          char fbuf[NFILEN + 32];
   
         if (curbp->b_fname[0] == 0) {          if (curbp->b_fname[0] == 0) {
                   dobeep();
                 ewprintf("Cannot revert buffer not associated with any files.");                  ewprintf("Cannot revert buffer not associated with any files.");
                 return (FALSE);                  return (FALSE);
         }          }
Line 906 
Line 912 
         struct undo_rec *rec;          struct undo_rec *rec;
   
         if (access(curbp->b_fname, F_OK|R_OK) != 0) {          if (access(curbp->b_fname, F_OK|R_OK) != 0) {
                   dobeep();
                 if (errno == ENOENT)                  if (errno == ENOENT)
                         ewprintf("File %s no longer exists!",                          ewprintf("File %s no longer exists!",
                             curbp->b_fname);                              curbp->b_fname);
Line 954 
Line 961 
                 return (ABORT);                  return (ABORT);
   
         if (access(DIFFTOOL, X_OK) != 0) {          if (access(DIFFTOOL, X_OK) != 0) {
                   dobeep();
                 ewprintf("%s not found or not executable.", DIFFTOOL);                  ewprintf("%s not found or not executable.", DIFFTOOL);
                 return (FALSE);                  return (FALSE);
         }          }
   
         if (curbp->b_fname[0] == 0) {          if (curbp->b_fname[0] == 0) {
                   dobeep();
                 ewprintf("Cannot diff buffer not associated with any files.");                  ewprintf("Cannot diff buffer not associated with any files.");
                 return (FALSE);                  return (FALSE);
         }          }
Line 970 
Line 979 
                         len++;                          len++;
         }          }
         if ((text = calloc(len + 1, sizeof(char))) == NULL) {          if ((text = calloc(len + 1, sizeof(char))) == NULL) {
                   dobeep();
                 ewprintf("Cannot allocate memory.");                  ewprintf("Cannot allocate memory.");
                 return (FALSE);                  return (FALSE);
         }          }
Line 1014 
Line 1024 
         char            bname[NBUFN], fname[NBUFN];          char            bname[NBUFN], fname[NBUFN];
   
         if (strlcpy(fname, fn, sizeof(fname)) >= sizeof(fname)) {          if (strlcpy(fname, fn, sizeof(fname)) >= sizeof(fname)) {
                   dobeep();
                 ewprintf("filename too long");                  ewprintf("filename too long");
                 return (NULL);                  return (NULL);
         }          }

Legend:
Removed from v.1.92  
changed lines
  Added in v.1.93