ProTERM can prepend a 128-byte Binary ][ header before transmitting a file.

When it does so it does not pad the file's length out to a multiple of
128 bytes, which confused the file extraction code.
This commit is contained in:
Andy McFadden 2009-01-13 20:16:23 +00:00
parent c3a9598bb8
commit aa61e5ae48
3 changed files with 6 additions and 4 deletions

View File

@ -440,7 +440,8 @@ BNYNormalizePath(BNYArchive* pBny, BNYEntry* pEntry)
/*
* Copy all data from the Binary II file to "outfp", reading in 128-byte
* blocks.
* blocks. Some programs (like ProTERM) apply a 128-byte header without
* padding out the file length, so we do need to handle that here.
*
* Uses pEntry->blockBuf, which already has the first 128 bytes in it.
*/
@ -471,7 +472,8 @@ BNYCopyBlocks(BNYArchive* pBny, BNYEntry* pEntry, FILE* outfp)
bytesLeft -= toWrite;
if (bytesLeft) {
err = BNYRead(pBny, pEntry->blockBuf, kBNYBlockSize);
err = BNYRead(pBny, pEntry->blockBuf,
bytesLeft < kBNYBlockSize ? bytesLeft : kBNYBlockSize);
if (err != kNuErrNone) {
ReportError(err, "BNY read failed");
goto bail;

View File

@ -149,7 +149,7 @@ Usage(const NulibState* pState)
printf("\nNulib2 v%s, linked with NufxLib v%ld.%ld.%ld [%s]\n",
NState_GetProgramVersion(pState),
majorVersion, minorVersion, bugVersion, nufxLibFlags);
printf("Copyright (C) 2000-2007, Andy McFadden. All Rights Reserved.\n");
printf("Copyright (C) 2000-2009, Andy McFadden. All Rights Reserved.\n");
printf("This software is distributed under terms of the BSD License.\n");
printf("Visit http://www.nulib.com/ for source code and documentation.\n\n");
printf("Usage: %s -command[modifiers] archive [filename-list]\n\n",

View File

@ -9,7 +9,7 @@
#include "Nulib2.h"
static const char* gProgramVersion = "2.2.0";
static const char* gProgramVersion = "2.2.1";
/*