mirror of
https://github.com/gryf/ADFlib.git
synced 2026-02-09 09:45:46 +01:00
Added switch for displaying comments next to filename
This commit is contained in:
1
README
1
README
@@ -29,6 +29,7 @@ unadf [-lrcsp -v n] dumpname.adf [files-with-path] [-d extractdir]
|
|||||||
-r : lists directory tree contents
|
-r : lists directory tree contents
|
||||||
-c : use dircache data (must be used with -l)
|
-c : use dircache data (must be used with -l)
|
||||||
-s : display entries logical block pointer (must be used with -l)
|
-s : display entries logical block pointer (must be used with -l)
|
||||||
|
-m : display file comments, if exists (must be used with -l)
|
||||||
|
|
||||||
-v n : mount volume #n instead of default #0 volume
|
-v n : mount volume #n instead of default #0 volume
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ void help()
|
|||||||
puts(" -r : lists directory tree contents");
|
puts(" -r : lists directory tree contents");
|
||||||
puts(" -c : use dircache data (must be used with -l)");
|
puts(" -c : use dircache data (must be used with -l)");
|
||||||
puts(" -s : display entries logical block pointer (must be used with -l)");
|
puts(" -s : display entries logical block pointer (must be used with -l)");
|
||||||
|
puts(" -m : display file comments, if exists (must be used with -l)");
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
puts(" -v n : mount volume #n instead of default #0 volume");
|
puts(" -v n : mount volume #n instead of default #0 volume");
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
@@ -65,7 +66,8 @@ void help()
|
|||||||
puts(" -d dir : extract to 'dir' directory");
|
puts(" -d dir : extract to 'dir' directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
void printEnt(struct Volume *vol, struct Entry* entry, char *path, BOOL sect)
|
void printEnt(struct Volume *vol, struct Entry* entry, char *path, BOOL sect,
|
||||||
|
BOOL comment)
|
||||||
{
|
{
|
||||||
/* do not print the links entries, ADFlib do not support them yet properly */
|
/* do not print the links entries, ADFlib do not support them yet properly */
|
||||||
if (entry->type==ST_LFILE || entry->type==ST_LDIR || entry->type==ST_LSOFT)
|
if (entry->type==ST_LFILE || entry->type==ST_LDIR || entry->type==ST_LSOFT)
|
||||||
@@ -74,12 +76,12 @@ void printEnt(struct Volume *vol, struct Entry* entry, char *path, BOOL sect)
|
|||||||
if (entry->type==ST_DIR)
|
if (entry->type==ST_DIR)
|
||||||
printf(" ");
|
printf(" ");
|
||||||
else
|
else
|
||||||
printf("%7ld ",entry->size);
|
printf("%7d ",entry->size);
|
||||||
|
|
||||||
printf("%4d/%02d/%02d %2d:%02d:%02d ",entry->year, entry->month, entry->days,
|
printf("%4d/%02d/%02d %2d:%02d:%02d ",entry->year, entry->month, entry->days,
|
||||||
entry->hour, entry->mins, entry->secs);
|
entry->hour, entry->mins, entry->secs);
|
||||||
if (sect)
|
if (sect)
|
||||||
printf(" %06ld ",entry->sector);
|
printf(" %06d ",entry->sector);
|
||||||
|
|
||||||
if (strlen(path)>0)
|
if (strlen(path)>0)
|
||||||
printf(" %s/",path);
|
printf(" %s/",path);
|
||||||
@@ -89,7 +91,7 @@ void printEnt(struct Volume *vol, struct Entry* entry, char *path, BOOL sect)
|
|||||||
printf("%s/",entry->name);
|
printf("%s/",entry->name);
|
||||||
else
|
else
|
||||||
printf("%s",entry->name);
|
printf("%s",entry->name);
|
||||||
if (entry->comment!=NULL && strlen(entry->comment)>0)
|
if (comment && entry->comment!=NULL && strlen(entry->comment)>0)
|
||||||
printf(", %s",entry->comment);
|
printf(", %s",entry->comment);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
|
||||||
@@ -199,13 +201,14 @@ void extractTree(struct Volume *vol, struct List* tree, char *path, unsigned cha
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void printTree(struct Volume *vol, struct List* tree, char* path, BOOL sect)
|
void printTree(struct Volume *vol, struct List* tree, char* path, BOOL sect,
|
||||||
|
BOOL comment)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
struct Entry* entry;
|
struct Entry* entry;
|
||||||
|
|
||||||
while(tree) {
|
while(tree) {
|
||||||
printEnt(vol, tree->content, path, sect);
|
printEnt(vol, tree->content, path, sect, comment);
|
||||||
if (tree->subdir!=NULL) {
|
if (tree->subdir!=NULL) {
|
||||||
entry = (struct Entry*)tree->content;
|
entry = (struct Entry*)tree->content;
|
||||||
if (strlen(path)>0) {
|
if (strlen(path)>0) {
|
||||||
@@ -215,11 +218,11 @@ void printTree(struct Volume *vol, struct List* tree, char* path, BOOL sect)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf(buf,"%s/%s", path, entry->name);
|
sprintf(buf,"%s/%s", path, entry->name);
|
||||||
printTree(vol, tree->subdir, buf, sect);
|
printTree(vol, tree->subdir, buf, sect, comment);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printTree(vol, tree->subdir, entry->name, sect);
|
printTree(vol, tree->subdir, entry->name, sect, comment);
|
||||||
}
|
}
|
||||||
tree = tree->next;
|
tree = tree->next;
|
||||||
}
|
}
|
||||||
@@ -243,7 +246,7 @@ void printDev(struct Device* dev)
|
|||||||
printf("???"); break;
|
printf("???"); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(". Cylinders = %ld, Heads = %ld, Sectors = %ld",dev->cylinders,dev->heads,dev->sectors);
|
printf(". Cylinders = %d, Heads = %d, Sectors = %d",dev->cylinders,dev->heads,dev->sectors);
|
||||||
|
|
||||||
printf(". Volumes = %d\n",dev->nVol);
|
printf(". Volumes = %d\n",dev->nVol);
|
||||||
}
|
}
|
||||||
@@ -273,7 +276,7 @@ void printVol(struct Volume* vol, int volNum)
|
|||||||
if (vol->volName!=NULL)
|
if (vol->volName!=NULL)
|
||||||
printf(" \"%s\"", vol->volName);
|
printf(" \"%s\"", vol->volName);
|
||||||
|
|
||||||
printf(" between sectors [%ld-%ld].",vol->firstBlock, vol->lastBlock);
|
printf(" between sectors [%d-%d].",vol->firstBlock, vol->lastBlock);
|
||||||
|
|
||||||
printf(" %s ",isFFS(vol->dosType) ? "FFS" : "OFS");
|
printf(" %s ",isFFS(vol->dosType) ? "FFS" : "OFS");
|
||||||
if (isINTL(vol->dosType))
|
if (isINTL(vol->dosType))
|
||||||
@@ -370,12 +373,10 @@ void processFile(struct Volume *vol, char* name, char* path, unsigned char *extb
|
|||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
BOOL rflag, lflag, xflag, cflag, vflag, sflag, dflag, pflag, qflag;
|
BOOL rflag, lflag, xflag, cflag, vflag, sflag, dflag, pflag, qflag, mflag;
|
||||||
struct List* files, *rtfiles;
|
struct List* files, *rtfiles;
|
||||||
char *devname, *dirname;
|
char *devname, *dirname;
|
||||||
char strbuf[80];
|
|
||||||
unsigned char *extbuf;
|
unsigned char *extbuf;
|
||||||
int vInd, dInd, fInd, aInd;
|
|
||||||
BOOL nextArg;
|
BOOL nextArg;
|
||||||
|
|
||||||
struct Device *dev;
|
struct Device *dev;
|
||||||
@@ -389,8 +390,7 @@ int main(int argc, char* argv[])
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
rflag = lflag = cflag = vflag = sflag = dflag = pflag = qflag = FALSE;
|
rflag = lflag = cflag = vflag = sflag = dflag = pflag = qflag = mflag = FALSE;
|
||||||
vInd = dInd = fInd = aInd = -1;
|
|
||||||
xflag = TRUE;
|
xflag = TRUE;
|
||||||
dirname = NULL;
|
dirname = NULL;
|
||||||
devname = NULL;
|
devname = NULL;
|
||||||
@@ -430,6 +430,9 @@ int main(int argc, char* argv[])
|
|||||||
case 's':
|
case 's':
|
||||||
sflag = TRUE;
|
sflag = TRUE;
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
mflag = TRUE;
|
||||||
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
cflag = TRUE;
|
cflag = TRUE;
|
||||||
break;
|
break;
|
||||||
@@ -489,8 +492,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
dev = adfMountDev( devname,TRUE );
|
dev = adfMountDev( devname,TRUE );
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
sprintf(strbuf,"Can't mount the dump device '%s'.\n", devname);
|
fprintf(stderr,"Can't mount the dump device '%s'.\n", devname);
|
||||||
fprintf(stderr, strbuf);
|
|
||||||
adfEnvCleanUp(); exit(1);
|
adfEnvCleanUp(); exit(1);
|
||||||
}
|
}
|
||||||
if (!qflag)
|
if (!qflag)
|
||||||
@@ -523,13 +525,13 @@ int main(int argc, char* argv[])
|
|||||||
if (!rflag) {
|
if (!rflag) {
|
||||||
cell = list = adfGetDirEnt(vol,vol->curDirPtr);
|
cell = list = adfGetDirEnt(vol,vol->curDirPtr);
|
||||||
while(cell) {
|
while(cell) {
|
||||||
printEnt(vol,cell->content,"", sflag);
|
printEnt(vol,cell->content,"", sflag, mflag);
|
||||||
cell = cell->next;
|
cell = cell->next;
|
||||||
}
|
}
|
||||||
adfFreeDirList(list);
|
adfFreeDirList(list);
|
||||||
} else {
|
} else {
|
||||||
cell = list = adfGetRDirEnt(vol,vol->curDirPtr,TRUE);
|
cell = list = adfGetRDirEnt(vol,vol->curDirPtr,TRUE);
|
||||||
printTree(vol,cell,"", sflag);
|
printTree(vol,cell,"", sflag, mflag);
|
||||||
adfFreeDirList(list);
|
adfFreeDirList(list);
|
||||||
}
|
}
|
||||||
}else if (xflag) {
|
}else if (xflag) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ unadf [-lrcsp -v n] dumpname.adf [files-with-path] [-d extractdir]
|
|||||||
-r : lists directory tree contents
|
-r : lists directory tree contents
|
||||||
-c : use dircache data (must be used with -l)
|
-c : use dircache data (must be used with -l)
|
||||||
-s : display entries logical block pointer (must be used with -l)
|
-s : display entries logical block pointer (must be used with -l)
|
||||||
|
-m : display file comments, if exists (must be used with -l)
|
||||||
|
|
||||||
-v n : mount volume #n instead of default #0 volume
|
-v n : mount volume #n instead of default #0 volume
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user