char *argp1
, *argp2
, *argp3
, *argp4
;
write(1,"Usage: mv name1 name2\n",22);
if(stat(argp
[1], stbuf
) < 0){
write(1,"Source file non-existent\n",25);
check whether file or directory
if((stbuf
[0].imode
& 060000) == 040000){
The source is a directory, so
we do lots of checking and
messing around so as not to get
into trouble. This patch of
code contains administrative
policies rather than system
if(stat(argp
[2], stbuf
) >= 0){
write(1,"Directory target exists.\n",25);
while(*argp1
)if(*argp1
++ == '/'){
write(1,"Directory rename only\n",22);
while(*argp2
)if(*argp2
++ == '/'){
write(1,"Directory rename only\n",22);
write(1,"values of \ eB\ f will give rise to dom!\n",37);
if(stat(argp4
, &stbuf
[2]) >= 0){
if((stbuf
[2].imode
& 060000) == 040000){
while(*argp2
++ = *argp4
++);
while(*argp2
++ = *argp1
++);
if(stat(argp4
, &stbuf
[2]) >= 0){
if((stbuf
[0]==stbuf
[2]) && (stbuf
[1]==stbuf
[3])){
write(1,"Files are identical.\n",21);
if((getuid()&0377) == stbuf
[2].uid
)
if((getgid()&0377) == stbuf
[2].gid
)
if((stbuf
[2].imode
& b
) == 0) {
printf("%s: %o mode ", argp4
,
while(b
!= '\n' && b
!= '\0')
write(1,"Cannot remove target file.\n",27);
if(link(argp3
, argp4
) < 0){
write(1,"Try again.\n",11);
while(wait(&status
) != i
);
execl("/bin/cp","cp", p1
, p2
, 0);
if((status
& 0377) != 0){
write(1,"Cannot unlink source file.\n",27);
if(read(0, &c
, 1) != 1) return(0);