version 1.47, 2011/01/18 17:35:42 |
version 1.48, 2011/01/23 00:45:03 |
|
|
d_expunge(int f, int n) |
d_expunge(int f, int n) |
{ |
{ |
struct line *lp, *nlp; |
struct line *lp, *nlp; |
char fname[NFILEN]; |
char fname[NFILEN], sname[NFILEN]; |
|
|
for (lp = bfirstlp(curbp); lp != curbp->b_headp; lp = nlp) { |
for (lp = bfirstlp(curbp); lp != curbp->b_headp; lp = nlp) { |
nlp = lforw(lp); |
nlp = lforw(lp); |
|
|
return (FALSE); |
return (FALSE); |
case FALSE: |
case FALSE: |
if (unlink(fname) < 0) { |
if (unlink(fname) < 0) { |
ewprintf("Could not delete '%s'", |
(void)xbasename(sname, fname, NFILEN); |
basename(fname)); |
ewprintf("Could not delete '%s'", sname); |
return (FALSE); |
return (FALSE); |
} |
} |
break; |
break; |
case TRUE: |
case TRUE: |
if (rmdir(fname) < 0) { |
if (rmdir(fname) < 0) { |
ewprintf("Could not delete directory '%s'", |
(void)xbasename(sname, fname, NFILEN); |
basename(fname)); |
ewprintf("Could not delete directory " |
|
"'%s'", sname); |
return (FALSE); |
return (FALSE); |
} |
} |
break; |
break; |
|
|
int |
int |
d_copy(int f, int n) |
d_copy(int f, int n) |
{ |
{ |
char frname[NFILEN], toname[NFILEN], *bufp; |
char frname[NFILEN], toname[NFILEN], sname[NFILEN], *bufp; |
int ret; |
int ret; |
size_t off; |
size_t off; |
struct buffer *bp; |
struct buffer *bp; |
|
|
ewprintf("Directory name too long"); |
ewprintf("Directory name too long"); |
return (FALSE); |
return (FALSE); |
} |
} |
if ((bufp = eread("Copy %s to: ", toname, sizeof(toname), |
(void)xbasename(sname, frname, NFILEN); |
EFDEF | EFNEW | EFCR, basename(frname))) == NULL) |
bufp = eread("Copy %s to: ", toname, sizeof(toname), |
|
EFDEF | EFNEW | EFCR, sname); |
|
if (bufp == NULL) |
return (ABORT); |
return (ABORT); |
else if (bufp[0] == '\0') |
else if (bufp[0] == '\0') |
return (FALSE); |
return (FALSE); |
|
|
int ret; |
int ret; |
size_t off; |
size_t off; |
struct buffer *bp; |
struct buffer *bp; |
|
char sname[NFILEN]; |
|
|
if (d_makename(curwp->w_dotp, frname, sizeof(frname)) != FALSE) { |
if (d_makename(curwp->w_dotp, frname, sizeof(frname)) != FALSE) { |
ewprintf("Not a file"); |
ewprintf("Not a file"); |
|
|
ewprintf("Directory name too long"); |
ewprintf("Directory name too long"); |
return (FALSE); |
return (FALSE); |
} |
} |
if ((bufp = eread("Rename %s to: ", toname, |
(void)xbasename(sname, frname, NFILEN); |
sizeof(toname), EFDEF | EFNEW | EFCR, basename(frname))) == NULL) |
bufp = eread("Rename %s to: ", toname, |
|
sizeof(toname), EFDEF | EFNEW | EFCR, sname); |
|
if (bufp == NULL) |
return (ABORT); |
return (ABORT); |
else if (bufp[0] == '\0') |
else if (bufp[0] == '\0') |
return (FALSE); |
return (FALSE); |
|
|
struct buffer *bp; |
struct buffer *bp; |
struct mgwin *wp; |
struct mgwin *wp; |
FILE *fin; |
FILE *fin; |
|
char sname[NFILEN]; |
|
|
bp = bfind("*Shell Command Output*", TRUE); |
bp = bfind("*Shell Command Output*", TRUE); |
if (bclear(bp) != TRUE) |
if (bclear(bp) != TRUE) |
|
|
} |
} |
|
|
command[0] = '\0'; |
command[0] = '\0'; |
if ((bufp = eread("! on %s: ", command, sizeof(command), EFNEW, |
(void)xbasename(sname, fname, NFILEN); |
basename(fname))) == NULL) |
bufp = eread("! on %s: ", command, sizeof(command), EFNEW, sname); |
|
if (bufp == NULL) |
return (ABORT); |
return (ABORT); |
infd = open(fname, O_RDONLY); |
infd = open(fname, O_RDONLY); |
if (infd == -1) { |
if (infd == -1) { |