#include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc,char **argv) { int i = 0x0, z = 0x0; char *buffer = (char *)malloc(4096); FILE *in = 0x0; FILE *out = 0x0; if(argc != 3) { printf("usage: mv <file1> <file2>\n"); return 0; } in = fopen(argv[1],"rb"); out = fopen(argv[2],"wb"); if(in == NULL || out == NULL) { printf("unable to open file(s) for i/o\n"); return 1; } while (!feof(in)) { i = fread(buffer,4096,1,in); z = fwrite(buffer,4096,1,out); } fclose(in); fclose(out); if(i != z) printf("mv: failed: out of disk space or kernel error\n"); else unlink(argv[1]); return(0x0); } /*** $Log$ Revision 1.4 2005/08/05 09:43:57 fsdfs code clean up, performance tuning Revision 1.3 2004/05/24 13:40:35 reddawg Clean Up END ***/