diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-12-30 14:30:02 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-12-30 14:30:02 +0000 |
commit | 4d70086c95dd7d504d588db11daab964a36e98ee (patch) | |
tree | 4d09b8c85958a8036cc9baf9c850fb6d5beb56ac /ext/Errno | |
parent | b5d36cd27f1794bce694f7e2254cd37d81da0e73 (diff) | |
download | perl-4d70086c95dd7d504d588db11daab964a36e98ee.tar.gz |
Win32 hides some errno-oid constants in <winsock.h> under assumed names.
This gets them into Errno.pm - yet to prove they end up in $!.
p4raw-id: //depot/perlio@13950
Diffstat (limited to 'ext/Errno')
-rw-r--r-- | ext/Errno/Errno_pm.PL | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL index d429146c20..eafbd67ec8 100644 --- a/ext/Errno/Errno_pm.PL +++ b/ext/Errno/Errno_pm.PL @@ -5,6 +5,7 @@ use strict; our $VERSION = "1.09_00"; my %err = (); +my %wsa = (); unlink "Errno.pm" if -f "Errno.pm"; open OUT, ">Errno.pm" or die "Cannot open Errno.pm: $!"; @@ -12,6 +13,10 @@ select OUT; my $file; foreach $file (get_files()) { process_file($file); + if ($^O eq 'MSWin32') { + $file =~ s/errno/winsock/; + process_file($file); + } } write_errno_pm(); unlink "errno.c" if -f "errno.c"; @@ -20,6 +25,7 @@ sub process_file { my($file) = @_; return unless defined $file and -f $file; +# warn "Processing $file\n"; local *FH; if (($^O eq 'VMS') && ($Config{vms_cc_type} ne 'gnuc')) { @@ -55,6 +61,10 @@ sub process_file { while(<FH>) { $err{$1} = 1 if /^\s*#\s*define\s+(E\w+)\s+/; + if ($^O eq 'MSWin32') { + $wsa{$1} = 1 + if /^\s*#\s*define\s+WSA(E\w+)\s+/; + } } } close(FH); @@ -172,11 +182,21 @@ sub write_errno_pm { die "Cannot open errno.c"; if ($^O eq 'NetWare') { - print CPPI "#include <nwerrno.h>\n"; - } else { - print CPPI "#include <errno.h>\n"; + print CPPI "#include <nwerrno.h>\n"; + } + else { + print CPPI "#include <errno.h>\n"; + } + if ($^O eq 'MSWin32') { + print CPPI "#include <winsock.h>\n"; + foreach $err (keys %wsa) { + print CPPI "#ifndef $err\n"; + print CPPI "#define $err WSA$err\n"; + print CPPI "#endif\n"; + $err{$err} = 1; } - + } + foreach $err (keys %err) { print CPPI '"',$err,'" [[',$err,']]',"\n"; } |