Commit | Line | Data |
---|---|---|
8736538c AS |
1 | This is an addendum to Steven Morlock's original post. The patch, perl5.005_02.patch, contains the USEMYBINMODE correction described below. |
2 | ||
3 | ***************************** | |
4 | Subject: Re: HOWTO: Builiding Perl under Win95/98 using Cygwin32 | |
5 | Author: Steven Morlock <newspost@morlock.net> | |
6 | Date: 1998/12/22 | |
7 | Forum: comp.lang.perl.misc | |
8 | ||
9 | I realized that in my original post I left out a couple important | |
10 | details. I'd like to correct that here. | |
11 | ||
12 | There is a need to address the issue of end of lines being CR/NL or | |
13 | NL on the Windows platform. Cygwin32 by default converts NL to CR/NL | |
14 | during file I/O by non Cygwin32-savvy applications. This means that | |
15 | Perl, since it does not support 'binmode' for the Cygwin32 platform, will | |
16 | not be able to read & write untranslated/binary files. There are two | |
17 | methods of over coming this. The first is to mount the Cygwin32 | |
18 | partitions in binary mode. The second is to enable binmode support | |
19 | in Perl. In the original post I had mounted the partition as binary | |
20 | and neglected to include that fact in the post. | |
21 | ||
22 | * Using a binary partition: | |
23 | ||
24 | Mount the Perl source & installation destination partitions in binary | |
25 | mode. Refer to the Cygnus documentation on 'mount' for details: | |
26 | ||
27 | http://sourceware.cygnus.com/cygwin/cygwin-ug-net/mount.html | |
28 | ||
29 | On my system since everything was in the root partition I issued the | |
30 | following commands from the bash shell: | |
31 | ||
32 | umount / | |
33 | mount -b c:\\ / | |
34 | ||
35 | You must also get and install the gzip'd version of the Perl source code | |
36 | archive. The zip'd version of the archive has all NL converted to CR/NL | |
37 | pairs in all text files. So you should be downloading the files ending in | |
38 | '.gz', not '.zip'. | |
39 | ||
40 | * Patching Perl to add Cygwin32 binmode support: | |
41 | ||
42 | For this method you can use either the gzip'd or zip'd version of the | |
43 | Perl source archive. | |
44 | ||
45 | Apply the following patch to <PERL>/perl.h: | |
46 | ||
47 | *** perl.h.ORIG Tue Dec 22 09:22:42 1998 | |
48 | --- perl.h Tue Dec 22 09:43:10 1998 | |
49 | *************** | |
50 | *** 1480,1483 **** | |
51 | --- 1480,1495 ---- | |
52 | #endif | |
53 | ||
54 | + #if defined(__CYGWIN32__) | |
55 | + /* USEMYBINMODE | |
56 | + * This symbol, if defined, indicates that the program should | |
57 | + * use the routine my_binmode(FILE *fp, char iotype) to insure | |
58 | + * that a file is in "binary" mode -- that is, that no translation | |
59 | + * of bytes occurs on read or write operations. | |
60 | + */ | |
61 | + #define USEMYBINMODE / **/ | |
62 | + #define my_binmode(fp, iotype) \ | |
63 | + (PerlLIO_setmode(PerlIO_fileno(fp), O_BINARY) != -1 ? TRUE : NULL) | |
64 | + #endif | |
65 | + | |
66 | #include "regexp.h" | |
67 | #include "sv.h" | |
68 | ||
69 | Regards, | |
70 | Steve | |
71 | ||
72 | -- | |
73 | Steven Morlock | |
74 | Foliage Software Systems | |
75 | aka The Nerd Farm | |
76 | http://www.foliage.com |