/* #includes */ /*{{{C}}}*//*{{{*/
+#include "config.h"
+
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include <errno.h>
-#include "config.h"
-
-extern char *optarg;
-extern int optind,opterr,optopt;
-int getopt(int argc, char * const *argv, const char *optstring);
+#include "getopt_.h"
#include "cpmdir.h"
#include "cpmfs.h"
+
+#ifdef USE_DMALLOC
+#include <dmalloc.h>
+#endif
/*}}}*/
/* #defines */ /*{{{*/
/* your favourite password *:-) */
{
const char *err;
const char *image;
- const char *format=FORMAT;
+ const char *format;
const char *devopts=NULL;
int c,usage=0;
struct cpmSuperBlock sb;
struct cpmInode root;
enum Result ret;
+ if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
while ((c=getopt(argc,argv,"T:f:nh?"))!=EOF) switch(c)
{
case 'f': format=optarg; break;
}
if (optind!=(argc-1)) usage=1;
- else image=argv[optind];
+ else image=argv[optind++];
if (usage)
{