version 1.92, 2013/12/23 14:58:16 |
version 1.93, 2014/03/20 07:47:29 |
|
|
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); |
} |
} |
|
|
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); |
} |
} |
|
|
|
|
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); |
} |
} |
|
|
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); |
} |
} |
|
|
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); |
} |
} |
|
|
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); |
} |
} |
|
|
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); |
|
|
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); |
} |
} |
|
|
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); |
} |
} |
|
|
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); |
} |
} |