diff -ur unadf-0.7.11a.orig/Demo/unadf.c unadf-0.7.11a/Demo/unadf.c --- unadf-0.7.11a.orig/Demo/unadf.c 2013-05-12 17:59:51.214905177 +0200 +++ unadf-0.7.11a/Demo/unadf.c 2013-05-12 17:50:06.843420519 +0200 @@ -58,6 +58,7 @@ puts(" -r : lists directory tree contents"); puts(" -c : use dircache data (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'); puts(" -v n : mount volume #n instead of default #0 volume"); putchar('\n'); @@ -65,7 +66,8 @@ 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 */ if (entry->type==ST_LFILE || entry->type==ST_LDIR || entry->type==ST_LSOFT) @@ -89,7 +91,7 @@ printf("%s/",entry->name); else 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); putchar('\n'); @@ -199,13 +201,14 @@ } -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; struct Entry* entry; while(tree) { - printEnt(vol, tree->content, path, sect); + printEnt(vol, tree->content, path, sect, comment); if (tree->subdir!=NULL) { entry = (struct Entry*)tree->content; if (strlen(path)>0) { @@ -215,11 +218,11 @@ return; } sprintf(buf,"%s/%s", path, entry->name); - printTree(vol, tree->subdir, buf, sect); + printTree(vol, tree->subdir, buf, sect, comment); free(buf); } else - printTree(vol, tree->subdir, entry->name, sect); + printTree(vol, tree->subdir, entry->name, sect, comment); } tree = tree->next; } @@ -370,12 +373,10 @@ int main(int argc, char* argv[]) { 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; char *devname, *dirname; - char strbuf[80]; unsigned char *extbuf; - int vInd, dInd, fInd, aInd; BOOL nextArg; struct Device *dev; @@ -389,8 +390,7 @@ exit(0); } - rflag = lflag = cflag = vflag = sflag = dflag = pflag = qflag = FALSE; - vInd = dInd = fInd = aInd = -1; + rflag = lflag = cflag = vflag = sflag = dflag = pflag = qflag = mflag = FALSE; xflag = TRUE; dirname = NULL; devname = NULL; @@ -430,6 +430,9 @@ case 's': sflag = TRUE; break; + case 'm': + mflag = TRUE; + break; case 'c': cflag = TRUE; break; @@ -522,13 +525,13 @@ if (!rflag) { cell = list = adfGetDirEnt(vol,vol->curDirPtr); while(cell) { - printEnt(vol,cell->content,"", sflag); + printEnt(vol,cell->content,"", sflag, mflag); cell = cell->next; } adfFreeDirList(list); } else { cell = list = adfGetRDirEnt(vol,vol->curDirPtr,TRUE); - printTree(vol,cell,"", sflag); + printTree(vol,cell,"", sflag, mflag); adfFreeDirList(list); } }else if (xflag) { diff -ur unadf-0.7.11a.orig/Demo/unadf.usage unadf-0.7.11a/Demo/unadf.usage --- unadf-0.7.11a.orig/Demo/unadf.usage 2006-12-03 15:27:00.000000000 +0100 +++ unadf-0.7.11a/Demo/unadf.usage 2013-05-12 17:40:23.116966854 +0200 @@ -3,6 +3,7 @@ -r : lists directory tree contents -c : use dircache data (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