static char sccsid
[] = "@(#)cpmv.c 5.2 (Berkeley) %G%";
* xcp(f1, f2) copy f1 to f2
* return - 0 ok | FAIL failed
register FILE *fp1
, *fp2
;
if ((fp1
= fopen(subfile(f1
), "r")) == NULL
)
if (stat(subfile(f2
), &s
) == 0) {
/* check for directory */
if ((s
.st_mode
& S_IFMT
) == S_IFDIR
) {
strcat(full
, lastpart(f1
));
DEBUG(4, "full %s\n", full
);
if ((fp2
= fopen(subfile(full
), "w")) == NULL
) {
while((len
= fread(buf
, sizeof (char), BUFSIZ
, fp1
)) > 0)
fwrite(buf
, sizeof (char), len
, fp2
);
* xmv(f1, f2) move f1 to f2
* return 0 ok | FAIL failed
if (link(subfile(f1
), subfile(f2
)) < 0) {