Notes on patching Borland (binary) executables so they'll understand Unix- style, LF-delimited ASCII files (from Onno van der Linden, c/o Frank van der Linden, vdlinden@fwi.uva.nl). 1. The CPP used by TC 2.0 can't handle unix-style (LF-terminated) lines. The CPP used by BC++ 2.0 can. The CPP used by BC++ 3.0 can't handle #if statements with unix-style lines. Fixes for both these problems below (GRR: offset, new byte, old byte). Comparing files \TC\CPP.EXE and \TC\CPP.OLD 00004F25: 0D 0A 00005E3D: 0D 0A 00007916: 0D 0A 000079D6: 0D 0A 00007AC1: 0A 0D 0000D8EE: EC F7 0000D8F1: F7 EC 0000D9EE: EC F7 0000D9F1: F7 EC 0000DC80: 0A 0D 0000DC90: 0A 0D Comparing files \BORLANDC\BIN\CPP.EXE and \BORLANDC\BIN\CPP.OLD 0001D150: 89 75 0001D151: 36 08 0001D152: 30 89 0001D153: 23 36 0001D154: 75 30 0001D155: 04 23 0001D288: 9A 89 0001D289: FF 36 0001D28A: FF 30 0001D28B: 00 23 0001D28C: 00 9A 0001D28E: 0E FF 0001D28F: 30 00 0001D290: 23 00 0001E5A7: 89 8D 2. The compilers (tcc 2.0 and bcc 3.0) are both one-pass compilers; i.e., cpp.exe isn't used when compiling with tcc or bcc. The earlier statements about both cpp's are the same for the builtin preprocesser in the compilers. To fix the unix-style line stuff for the compilers, apply the fixes below. I do have something called bpatch.c which reads in the output of fc /b and changes the executable. If anyone is too lazy to write it himself, just send out a mail. Comparing files TCC.EXE and TCC.OLD 00005E06: BF 88 00005E07: 02 01 00005E0C: 88 BF 00005E0D: 01 02 00006E7C: 0A 0D 00011FF9: 0A 0D 00012059: 0A 0D 00017E6C: 0A 0D 00018181: 0A 0D 000181F6: 0A 0D 00018AC1: 0A 0D 00018B27: 0D 0A 00018BBE: 0A 0D 00018C12: 0A 0D 00018C6A: 0A 0D 0001948A: 0A 0D 000194B7: 0D 0A 00019507: 0A 0D 0001C093: 0A 0D 0001C495: 3C 89 0001C496: 0D 46 0001C497: 74 FC 0001C498: DF 3D 0001C499: FF 0D 0001C49A: 0E 00 0001C49B: 34 75 0001C49C: 50 03 0001C49D: 3C E9 0001C49E: 0A F6 0001C49F: 75 FB 0001C4A0: 03 FF 0001C4A1: E9 0E 0001C4A2: F2 34 0001C4A3: FB 50 0001C4D0: 0A 0D 0001CFA7: 0A 0D 0001CFBA: 0D 0A 0001D007: 0A 0D 0002A13C: 0A 0D 0002A14C: 0A 0D 0002A2B6: EC F7 0002A2B9: F7 EC 0002A3B6: EC F7 0002A3B9: F7 EC 0002A4B6: EC F7 0002A4B9: F7 EC 0002BDC3: 20 21 0002BDC6: 21 20 Comparing files BCC.EXE and BCC.OLD 0002B877: 89 75 0002B878: 36 08 0002B879: 5C 89 0002B87A: 5F 36 0002B87B: 75 5C 0002B87C: 04 5F 0002B9AF: 0E 89 0002B9B0: E8 36 0002B9B1: 56 5C 0002B9B2: DC 5F 0002B9B3: FF 90 0002B9B5: 5C E8 0002B9B6: 5F 51 0002B9B7: 90 DC Just an addition: the first one was for the cpp.exe's, the recent one is for the compilers (bcc.exe, tcc.exe). The first one is a bit redundant because cpp.exe is hardly ever used. See it as an attempt to make things complete. 3. For those of you who are using NDMAKE45 under MSDOS: version 4.5 predefines the macro's MAKE and MFLAGS as readonly's. So there was no way you could use $(MAKE) with ndmake45. Here are the fc /b's that make things work: Comparing files MAKE45.EXE and MAKE45.OLD 000019C0: 00 03 # MFLAG 000019DC: 00 03 # MAKE 00007BEA: 0A 7E # output of make -p 00007BEB: 00 0A # Comparing files MAKE45L.EXE and MAKE45L.OLD 0000277E: 00 03 # MFLAG 0000279D: 00 03 # MAKE 0000A6A8: 0A 7E # output of make -p 0000A6A9: 00 0A