NAME
movefile - change name of a file

SYNOPSIS
int movefile (from,to);
char *from,*to;

DESCRIPTION
Movefile attempts to change the name of the file from to to.
Movefile uses link(2) and unlink(2) if possible, since this is the
fastest way to change the name of a file. Under certain
circumstances (i.e. if from and to specify different mounted
devices), this may fail; in such a case, movefile will creat(2) the
result file and use filecopy(3) to copy the data.

If movefile is successful, then from will be deleted and movefile
will return a 0. If unsuccessful, to will be deleted (if any file
already has this name), and -1 will be returned.

SEE ALSO
mv(1), link(2), unlink(2), creat(2), filecopy(3)

DIAGNOSTICS
Returns 0 normally; -1 on error. If an error occurs, from still
exists.