mirror of
https://github.com/gryf/gryf-overlay.git
synced 2026-01-04 12:54:14 +01:00
138 lines
4.7 KiB
Diff
138 lines
4.7 KiB
Diff
--- adflib-0.7.12_a/examples/unadf.c 2021-07-09 17:38:47.980770205 +0200
|
|
+++ adflib-0.7.12_b/examples/unadf.c 2021-07-09 17:54:32.548793259 +0200
|
|
@@ -65,6 +65,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');
|
|
@@ -72,7 +73,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)
|
|
@@ -81,12 +83,12 @@
|
|
if (entry->type==ST_DIR)
|
|
printf(" ");
|
|
else
|
|
- printf("%7ld ",entry->size);
|
|
+ printf("%7d ",entry->size);
|
|
|
|
printf("%4d/%02d/%02d %2d:%02d:%02d ",entry->year, entry->month, entry->days,
|
|
entry->hour, entry->mins, entry->secs);
|
|
if (sect)
|
|
- printf(" %06ld ",entry->sector);
|
|
+ printf(" %06d ",entry->sector);
|
|
|
|
if (strlen(path)>0)
|
|
printf(" %s/",path);
|
|
@@ -96,7 +98,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');
|
|
|
|
@@ -203,13 +205,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) {
|
|
@@ -219,11 +222,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;
|
|
}
|
|
@@ -247,7 +250,7 @@
|
|
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);
|
|
}
|
|
@@ -277,7 +280,7 @@
|
|
if (vol->volName!=NULL)
|
|
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");
|
|
if (isINTL(vol->dosType))
|
|
@@ -373,7 +376,7 @@
|
|
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];
|
|
@@ -392,7 +395,7 @@
|
|
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;
|
|
dirname = NULL;
|
|
@@ -433,6 +436,9 @@
|
|
case 's':
|
|
sflag = TRUE;
|
|
break;
|
|
+ case 'm':
|
|
+ mflag = TRUE;
|
|
+ break;
|
|
case 'c':
|
|
cflag = TRUE;
|
|
break;
|
|
@@ -526,13 +532,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) {
|