diff --git a/nufxlib-0/Archive.c b/nufxlib-0/Archive.c index b2c9104..c287e31 100644 --- a/nufxlib-0/Archive.c +++ b/nufxlib-0/Archive.c @@ -308,6 +308,8 @@ Nu_UpdateWrapper(NuArchive* pArchive, FILE* fp) BailError(err); Nu_WriteFour(pArchive, fp, archiveLen512); + /* probably ought to update "modified when" date/time field */ + /* seek just past end of BNY wrapper */ err = Nu_FSeek(fp, kNuBinary2BlockSize - (kNuBNYDiskSpace+4), SEEK_CUR); BailError(err); @@ -459,6 +461,10 @@ bail: * That way, if the application is trying a series of libraries to find * one that will accept the file, we don't generate spurious complaints. * + * Since there's a fair possibility that whoever is opening this file is + * also interested in related formats, we try to return a meaningful error + * code for stuff we recognize (especially Binary II). + * * On exit, the stream will be positioned just past the master header. */ static NuError @@ -491,7 +497,7 @@ Nu_ReadMasterHeader(NuArchive* pArchive) err = kNuErrNotNuFX; /* probably too short to be BNY, so go ahead and whine */ Nu_ReportError(NU_BLOB, kNuErrNone, - "Might be Binary II, but it's not NuFX"); + "Looks like a truncated Binary II archive?"); goto bail; } @@ -502,7 +508,7 @@ Nu_ReadMasterHeader(NuArchive* pArchive) */ count = Nu_ReadOne(pArchive, fp); if (count != 0) { - err = kNuErrNotNuFX; + err = kNuErrIsBinary2; /*Nu_ReportError(NU_BLOB, kNuErrNone, "This is a Binary II archive with %d files in it", count+1);*/ DBUG(("This is a Binary II archive with %d files in it\n",count+1)); @@ -537,6 +543,7 @@ Nu_ReadMasterHeader(NuArchive* pArchive) err = kNuErrNotNuFX; if (isBinary2) { + err = kNuErrIsBinary2; /*Nu_ReportError(NU_BLOB, kNuErrNone, "Looks like Binary II, not NuFX");*/ DBUG(("Looks like Binary II, not NuFX\n")); diff --git a/nufxlib-0/MiscUtils.c b/nufxlib-0/MiscUtils.c index f2ffbda..9af5aad 100644 --- a/nufxlib-0/MiscUtils.c +++ b/nufxlib-0/MiscUtils.c @@ -174,6 +174,9 @@ Nu_StrError(NuError err) case kNuErrDamaged: return "Original archive may have been damaged"; + case kNuErrIsBinary2: + return "This is a Binary II archive"; + default: sprintf(defaultMsg, "(error=%d)", err); return defaultMsg; diff --git a/nufxlib-0/NufxLib.h b/nufxlib-0/NufxLib.h index 5d3f4c2..e4b19dd 100644 --- a/nufxlib-0/NufxLib.h +++ b/nufxlib-0/NufxLib.h @@ -101,7 +101,9 @@ typedef enum NuError { kNuErrLeadingFssep = -80, /* names in archives must not start w/sep */ kNuErrNotNewer = -81, /* item same age or older than existing */ kNuErrDuplicateNotFound = -82, /* "must overwrite" was set, but item DNE */ - kNuErrDamaged = -83 /* original archive may have been damaged */ + kNuErrDamaged = -83, /* original archive may have been damaged */ + + kNuErrIsBinary2 = -90, /* this looks like a Binary II archive */ } NuError; /* @@ -333,14 +335,14 @@ typedef union NuDataSink NuDataSink; /* dummy def for internal struct */ * NuFX Date/Time structure; same as TimeRec from IIgs "misctool.h". */ typedef struct NuDateTime { - unsigned char second; - unsigned char minute; - unsigned char hour; - unsigned char year; - unsigned char day; - unsigned char month; - unsigned char extra; - unsigned char weekDay; + unsigned char second; /* 0-59 */ + unsigned char minute; /* 0-59 */ + unsigned char hour; /* 0-23 */ + unsigned char year; /* year - 1900 */ + unsigned char day; /* 0-30 */ + unsigned char month; /* 0-11 */ + unsigned char extra; /* (must be zero) */ + unsigned char weekDay; /* 1-7 (1=sunday) */ } NuDateTime; /* @@ -499,7 +501,7 @@ typedef struct NuSelectionProposal { } NuSelectionProposal; /* - * Passed into the OuputPathnameFilter callback. + * Passed into the OutputPathnameFilter callback. */ typedef struct NuPathnameProposal { const char* pathname;