1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-08 06:25:17 +00:00

fix for previous change: the last vlir chains could be blank, do not pad the last real file

git-svn-id: svn://svn.cc65.org/cc65/trunk@2154 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
izydorst
2003-05-09 19:52:23 +00:00
parent 0a1266e59b
commit 24ed6e5e3d

View File

@@ -38,7 +38,7 @@ FILE *outCVT, *input;
unsigned char buffer[BLOODY_BIG_BUFFER]; unsigned char buffer[BLOODY_BIG_BUFFER];
unsigned char vlirtabt[127]; unsigned char vlirtabt[127];
unsigned char vlirtabs[127]; unsigned char vlirtabs[127];
int i,j; int i,j,lastarg;
int bytes; int bytes;
int blocks,rest; int blocks,rest;
@@ -77,6 +77,15 @@ int blocks,rest;
vlirtabs[j]=0; vlirtabs[j]=0;
} }
/* scan arguments for the last one that is not blank or nonexistant */
j=argc;
lastarg=argc-1;
while (j!=3) {
--j;
if ((strcmp(argv[j],"blank")==0)||(strcmp(argv[j],"noexist")==0))
--lastarg;
}
/* now read all VLIR chains, align to 254 bytes */ /* now read all VLIR chains, align to 254 bytes */
++i; ++i;
@@ -106,7 +115,7 @@ int blocks,rest;
vlirtabt[j]=blocks+1; vlirtabs[j]=rest; vlirtabt[j]=blocks+1; vlirtabs[j]=rest;
/* do not pad the last chain - it doesn't change or break anything /* do not pad the last chain - it doesn't change or break anything
but filesize in bytes of .cvt will be identical to native cvt */ but filesize in bytes of .cvt will be identical to native cvt */
if (i==(argc-1)) if (i==lastarg)
fwrite(buffer,1,bytes,outCVT); fwrite(buffer,1,bytes,outCVT);
else else
fwrite(buffer,1,(blocks+1)*254,outCVT); fwrite(buffer,1,(blocks+1)*254,outCVT);