projects
/
debian
/
cpmtools
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update debhelper build-dep to reflect new compat level 10
[debian/cpmtools]
/
cpmchattr.c
diff --git
a/cpmchattr.c
b/cpmchattr.c
index cb9e53d4358493bf73b49d17fa802b8a5e4e5406..be39130b86b056d0c993b22b1072b0fe9afef0cb 100644
(file)
--- a/
cpmchattr.c
+++ b/
cpmchattr.c
@@
-6,7
+6,7
@@
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
-#include "getopt.h"
+#include "getopt
_
.h"
#include "cpmfs.h"
#ifdef USE_DMALLOC
#include "cpmfs.h"
#ifdef USE_DMALLOC
@@
-21,7
+21,7
@@
int main(int argc, char *argv[]) /*{{{*/
/* variables */ /*{{{*/
const char *err;
const char *image;
/* 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;
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 */ /*{{{*/
/*}}}*/
/* parse options */ /*{{{*/
+ if (!(format=getenv("CPMTOOLSFMT"))) format=FORMAT;
while ((c=getopt(argc,argv,"T:f:h?"))!=EOF) switch(c)
{
case 'T': devopts=optarg; break;
while ((c=getopt(argc,argv,"T:f:h?"))!=EOF) switch(c)
{
case 'T': devopts=optarg; break;
@@
-43,8
+44,8
@@
int main(int argc, char *argv[]) /*{{{*/
if (optind>=(argc-2)) usage=1;
else
{
if (optind>=(argc-2)) usage=1;
else
{
- image=argv[optind];
- attrs = argv[optind+
1
];
+ image=argv[optind
++
];
+ attrs = argv[optind+
+
];
}
if (usage)
}
if (usage)
@@
-56,10
+57,14
@@
int main(int argc, char *argv[]) /*{{{*/
/* open image */ /*{{{*/
if ((err=Device_open(&drive.dev, image, O_RDWR, devopts)))
{
/* open image */ /*{{{*/
if ((err=Device_open(&drive.dev, image, O_RDWR, devopts)))
{
- fprintf(stderr,"%s: can not open %s (%s)\n",cmd,image,err);
+ fprintf(stderr,"%s: cannot open %s (%s)\n",cmd,image,err);
+ exit(1);
+ }
+ if (cpmReadSuper(&drive,&root,format)==-1)
+ {
+ fprintf(stderr,"%s: cannot read superblock (%s)\n",cmd,boo);
exit(1);
}
exit(1);
}
- cpmReadSuper(&drive,&root,format);
/*}}}*/
cpmglob(optind,argc,argv,&root,&gargc,&gargv);
for (i=0; i<gargc; ++i)
/*}}}*/
cpmglob(optind,argc,argv,&root,&gargc,&gargv);
for (i=0; i<gargc; ++i)
@@
-72,7
+77,9
@@
int main(int argc, char *argv[]) /*{{{*/
if (!rc) rc = cpmAttrGet(&ino, &attrib);
if (!rc)
{
if (!rc) rc = cpmAttrGet(&ino, &attrib);
if (!rc)
{
- int n, m;
+ unsigned int n;
+ int m;
+
m = 0;
for (n = 0; n < strlen(attrs); n++)
{
m = 0;
for (n = 0; n < strlen(attrs); n++)
{
@@
-106,6
+113,7
@@
int main(int argc, char *argv[]) /*{{{*/
exitcode=1;
}
}
exitcode=1;
}
}
+ cpmUmount(&drive);
exit(exitcode);
}
/*}}}*/
exit(exitcode);
}
/*}}}*/