1 /* #includes */ /*{{{C}}}*//*{{{*/
18 const char cmd[]="cpmrm";
20 int main(int argc, char *argv[]) /*{{{*/
22 /* variables */ /*{{{*/
26 const char *devopts=NULL;
27 int c,i,usage=0,exitcode=0;
28 struct cpmSuperBlock drive;
34 /* parse options */ /*{{{*/
35 if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
36 while ((c=getopt(argc,argv,"T:f:h?"))!=EOF) switch(c)
38 case 'T': devopts=optarg; break;
39 case 'f': format=optarg; break;
41 case '?': usage=1; break;
44 if (optind>=(argc-1)) usage=1;
45 else image=argv[optind++];
49 fprintf(stderr,"Usage: %s [-f format] [-T dsktype] image pattern ...\n",cmd);
53 /* open image */ /*{{{*/
54 if ((err=Device_open(&drive.dev, image, O_RDWR, devopts)))
56 fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err);
59 if (cpmReadSuper(&drive,&root,format)==-1)
61 fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo);
65 cpmglob(optind,argc,argv,&root,&gargc,&gargv);
66 for (i=0; i<gargc; ++i)
68 if (cpmUnlink(&root,gargv[i])==-1)
70 fprintf(stderr,"%s: can not erase %s: %s\n",cmd,gargv[i],boo);