Imported Upstream version 2.17
[debian/cpmtools] / cpmrm.c
diff --git a/cpmrm.c b/cpmrm.c
index 0749235263731cb2b1db2ca8c7aaf9ea7ffd745a..fb4bcffcac3a06d8af1254840c7f86e7e2e1426b 100644 (file)
--- a/cpmrm.c
+++ b/cpmrm.c
@@ -22,7 +22,7 @@ int main(int argc, char *argv[]) /*{{{*/
   /* variables */ /*{{{*/
   const char *err;
   const char *image;
-  const char *format=FORMAT;
+  const char *format;
   const char *devopts=NULL;
   int c,i,usage=0,exitcode=0;
   struct cpmSuperBlock drive;
@@ -32,6 +32,7 @@ int main(int argc, char *argv[]) /*{{{*/
   /*}}}*/
 
   /* parse options */ /*{{{*/
+  if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
   while ((c=getopt(argc,argv,"T:f:h?"))!=EOF) switch(c)
   {
     case 'T': devopts=optarg; break;
@@ -66,6 +67,7 @@ int main(int argc, char *argv[]) /*{{{*/
       exitcode=1;
     }
   }
+  cpmUmount(&drive);
   exit(exitcode);
 }
 /*}}}*/