Mail Archives: cygwin/1997/05/24/09:15:28
------ =_NextPart_000_01BC67A6.01B89F80
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
The following program does not generate the correct output file. I ran =
the program on a file with just "11" in the contents. The chksum is =
valid in the calc_chksum function. But when I view the output file, it =
is not the same. I'm using cygwin32 b18.
--jc
------ =_NextPart_000_01BC67A6.01B89F80
Content-Type: application/octet-stream; name="INTSTK.C"
Content-Transfer-Encoding: base64
LyoNCiAqIGludHN0ay5jDQogKg0KICogVGhpcyBwcm9ncmFtIHN0YWNrcyBleGVjdXRhYmxlIGNv
ZGUgaW50byBhIGZpbGUuICBUaGUgZmlsZSBmb3JtYXQgaXMgYXMNCiAqIGZvbGxvd3M6DQogKg0K
ICogMDAwMCAtIDAwNDAJCUhlYWRlcg0KICogMDA0MCAtIHh4eHgJCUludGVyZmFjZSAxDQogKiB4
eHh4IC0geXl5eQkJSW50ZXJmYWNlIDINCiAqIHl5eXkgLSB6enp6CQlJbnRlcmZhY2UgMw0KICog
IC4uLg0KICoNCiAqIFdlIGFzc3VtZSB0aGUgZmlsZSBpcyBhdCBtb3N0IFNFR19NQVggYnl0ZXMg
bG9uZy4gIEFueSBieXRlcyBiZXlvbmQgdGhpcw0KICogbGltaXQgaXMgaWdub3JlZC4NCiAqDQog
KiBTeW50YXg6ICBpbnRzdGsgWy1hXSAtbyBvdXRmaWxlIGludGZjMSBbLi4uXQ0KICoNCiAqIC1h
IEFwcGVuZCB0byBvdXRwdXQgZmlsZS4NCiAqIC1vIEZpbGVuYW1lIG9mIG91dHB1dCBmaWxlLg0K
ICovDQoNCiNpbmNsdWRlIDxzdGRpby5oPg0KI2luY2x1ZGUgPHN0cmluZy5oPg0KI2luY2x1ZGUg
PHN0ZGxpYi5oPg0KI2luY2x1ZGUgPGVycm5vLmg+DQoNCiNkZWZpbmUgSERSX01BR0lDCTB4NWQ1
ZQ0KI2RlZmluZSBIRFJfTUFYCQkzMQ0KI2RlZmluZSBTRUdfTU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KGZ3cml0ZSgmaGRyLCBzaXplb2YoaGRyKSwgMSwgb3V0X2ZpbGUpICE9IDEp
DQoJCXsNCgkJZnByaW50ZihzdGRlcnIsICJFcnJvciB3cml0aW5nIHRvIGZpbGUgJyVzJy5cbiIs
IG91dF9maWxlbmFtZSk7DQoJCWdvdG8gZXJyb3JfaGFuZGxlcjsNCgkJfQ0KCWZjbG9zZShvdXRf
ZmlsZSk7DQoNCgljYWxjX2Noa3N1bShvdXRfZmlsZW5hbWUpOw0KCXJldHVybiAwOw0KDQplcnJv
cl9oYW5kbGVyOg0KCWZjbG9zZShvdXRfZmlsZSk7DQoJcmVtb3ZlKG91dF9maWxlbmFtZSk7DQoJ
cmV0dXJuIDE7DQoJfQ0KDQo=
------ =_NextPart_000_01BC67A6.01B89F80--
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -