#include #include #define MAXM 10 #define DEFZ (6*1024 - 8) void copy(char *from, char *to, int todir); void copy1(int fdf, int fdt, char *from, char *to); long zsize; void main(int argc, char *argv[]) { Dir dirb; int todir, i; char *s; zsize = 0; ARGBEGIN{ case 'z': zsize = DEFZ; if(s = ARGF()){ if(*s >= '0' && *s <= '9') zsize = atol(s); } break; }ARGEND if(argc<2){ fprint(2, "usage:\tcp [-z[#]] fromfile tofile\n"); fprint(2, "\tcp [-z[#]] fromfile ... todir\n"); exits("usage"); } todir=0; if(dirstat(argv[argc-1], &dirb)==0 && (dirb.mode&0x80000000L)) todir=1; if(argc>2 && !todir){ fprint(2, "cp: %s not a directory\n", argv[argc-1]); exits("bad usage"); } for(i=0; i