mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-24 11:22:09 +00:00
git-subtree-dir: crossassemblers/macro11 git-subtree-mainline: fc2c8875ca614c989a594d4cf266a9d4e1c98d1e git-subtree-split: 2a14ffe2519589011ffc4050d5d4fd6591fb4c3c command was: git subtree add --prefix=crossassemblers/macro11 git://github.com/Rhialto/macro11.git master
35 lines
602 B
C
35 lines
602 B
C
/*
|
|
* A little tool to convert files with variable records to byte streams.
|
|
*
|
|
* Each record consist of 2 bytes of length (little endian) followed by
|
|
* that number of data bytes.
|
|
*
|
|
* If the length is odd, there is a padding byte. This byte does not have
|
|
* to be 0.
|
|
*/
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
while (!feof(stdin)) {
|
|
int count, savecount;
|
|
unsigned char ch;
|
|
|
|
ch = getchar();
|
|
count = ch;
|
|
ch = getchar();
|
|
count += ch << 8;
|
|
|
|
savecount = count;
|
|
|
|
while (count-- > 0) {
|
|
ch = getchar();
|
|
putchar(ch);
|
|
}
|
|
|
|
if (savecount & 1) {
|
|
getchar();
|
|
}
|
|
}
|
|
}
|