#include #include #define DEFB (8*1024) int xflag; void copy(char *from, char *to, int todir); void copy1(int fdf, int fdt, char *from, char *to); void main(int argc, char *argv[]) { Dir dirb; int todir, i; ARGBEGIN { case 'x': xflag++; break; default: goto usage; } ARGEND todir=0; if(argc < 2) goto usage; if(dirstat(argv[argc-1], &dirb)==0 && (dirb.mode&CHDIR)) todir=1; if(argc>2 && !todir){ fprint(2, "cp: %s not a directory\n", argv[argc-1]); exits("bad usage"); } for(i=0; i