diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-09-24 10:16:04 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-09-24 10:16:04 +0100 |
commit | e14adb6005c86f724c57fce18f4514abf3c57041 (patch) | |
tree | 21620146a1f8109531423679858f5375884a1cb6 /cpan/Sys-Syslog | |
parent | 9271a704fa108e9f1352cdcdd0dd7ed1a71d1db9 (diff) | |
download | perl-e14adb6005c86f724c57fce18f4514abf3c57041.tar.gz |
Move Sys-Syslog from ext/ to cpan/
(Something had to be first, and it had to be XS, and skipped on Win32 and VMS)
Diffstat (limited to 'cpan/Sys-Syslog')
-rw-r--r-- | cpan/Sys-Syslog/.gitignore | 2 | ||||
-rw-r--r-- | cpan/Sys-Syslog/Changes | 177 | ||||
-rw-r--r-- | cpan/Sys-Syslog/Makefile.PL | 196 | ||||
-rw-r--r-- | cpan/Sys-Syslog/README | 69 | ||||
-rw-r--r-- | cpan/Sys-Syslog/README.win32 | 30 | ||||
-rw-r--r-- | cpan/Sys-Syslog/Syslog.pm | 1600 | ||||
-rw-r--r-- | cpan/Sys-Syslog/Syslog.xs | 171 | ||||
-rw-r--r-- | cpan/Sys-Syslog/fallback/const-c.inc | 689 | ||||
-rw-r--r-- | cpan/Sys-Syslog/fallback/const-xs.inc | 87 | ||||
-rw-r--r-- | cpan/Sys-Syslog/fallback/syslog.h | 111 | ||||
-rw-r--r-- | cpan/Sys-Syslog/t/00-load.t | 8 | ||||
-rw-r--r-- | cpan/Sys-Syslog/t/constants.t | 42 | ||||
-rw-r--r-- | cpan/Sys-Syslog/t/syslog.t | 266 | ||||
-rw-r--r-- | cpan/Sys-Syslog/win32/PerlLog.mc | 602 | ||||
-rw-r--r-- | cpan/Sys-Syslog/win32/PerlLog_RES.uu | 130 | ||||
-rw-r--r-- | cpan/Sys-Syslog/win32/PerlLog_dll.uu | 171 | ||||
-rw-r--r-- | cpan/Sys-Syslog/win32/Win32.pm | 283 | ||||
-rw-r--r-- | cpan/Sys-Syslog/win32/compile.pl | 277 |
18 files changed, 4911 insertions, 0 deletions
diff --git a/cpan/Sys-Syslog/.gitignore b/cpan/Sys-Syslog/.gitignore new file mode 100644 index 0000000000..2f2399bced --- /dev/null +++ b/cpan/Sys-Syslog/.gitignore @@ -0,0 +1,2 @@ +*.inc +macros.all diff --git a/cpan/Sys-Syslog/Changes b/cpan/Sys-Syslog/Changes new file mode 100644 index 0000000000..2f6653baa8 --- /dev/null +++ b/cpan/Sys-Syslog/Changes @@ -0,0 +1,177 @@ +Revision history for Sys-Syslog + +0.27 -- 2008.09.21 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] Fixed compilation on Win32, thanks to Serguei Trouchelle. + Also added stubs so calling the XS functions will never fail. + [TESTS] t/pod.t now also uses Pod::Checker. + +0.26 -- 2008.06.16 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] Make Sys::Syslog works with Perl 5.10.0 (because of + ExtUtils::Constant::ProxySubs). + [CODE] setlogsock() is now a little more strict about its arguments. + +0.25 -- 2008.05.17 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] CPAN-RT#34691: Fixed an incorrect call to sysopen() which + prevented Sys::Syslog from working on some Solaris systems. + Thanks to Paul Townsend. + [BUGFIX] CPAN-RT#34753: Fixed a slowness introduced in v0.19 (which + was to work around OSX syslog own slowness). Thanks to Alex Efros. + [BUGFIX] CPAN-RT#35952: Fixed a bug with the "nofatal" option. + [BUGFIX] CPAN-RT#35189: Fixed a bug in xlate(). + [BUGFIX] Fixed build on Win32, thanks to Adam Kennedy. + [FEATURE] setlogsock() now interprets the second argument as the + hostname for network mechanisms. + [DIST] Add AUTHOR to WriteMakefile() in order to fix the META.yml + generated by ExtUtils::MakeMaker. + [TESTS] Improved t/pod.t with Pod::Checker. + +0.24 -- 2007.12.31 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] CPANT-RT#32001: Skip the setlogsock('stream') tests when + /dev/log is unavailable (Brendan O'Dea). + +0.23 -- 2007.11.12 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] Fixed a too liberal test in the "pipe" mechanism, thanks + to Jan Dubois. + [DIST] fallback/syslog.h was missing from MANIFEST (thanks to CPAN + Tester Matthew Musgrove). + [TESTS] Better handling of Perl 5.005, thanks to CPAN Tester Slaven Rezic. + +0.22 -- 2007.11.08 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] CPAN-RT#29875: Added workaround SpamAssassin overzealous + logging features. + [FEATURE] Added support for PERROR option. + [FEATURE] Support for SYSLOG on z/OS, thanks to Chun Bing Ge. + [CODE] Prevent $@ from being visible outside the module, in trying + to address the problem reported in CPAN-RT#29875. + [DOC] CPAN-RT#29451: Add Copyright notice. Thanks to Allison Randal + for her advice. + [DOC] New speaking about Win32 API instead of Win32 operating system. + +0.21 -- 2007.09.14 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] setlogsock(eventlog) returned true even when it shouldn't have. + [BUGFIX] CPAN-RT#24431: Added workaround for Mac OS X syslogd. + [FEATURE] Added "pipe" mechanism in order to support HP-UX named pipe. + Thanks to H.Merijn Brand and PROCURA. + [CODE] Sys::Syslog works again on Perl 5.005, thanks to Nicholas Clark. + +0.20 -- 2007.09.05 -- Sebastien Aperghis-Tramoni (SAPER) + [DOC] Added README.win32 which was missing in MANIFEST. + +0.19 -- 2007.09.05 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] CPAN-RT#20635: Fix tests to avoid problems related to the + "stream" mechanism which occured on Debian and Cygwin. + [BUGFIX] CPAN-RT#20780: Facility could not be temporarily changed. + Also fixes the syslog() before openlog() bug. + [BUGFIX] CPAN-RT#21333: Makefile.PL now creates a typemap for Perl 5.6.1 + [BUGFIX] CPAN-RT#21516: disconnect_log() now correctly calls closelog_xs(). + [BUGFIX] CPAN-RT#21866: Silence warnings in openlog(). + [BUGFIX] CPAN-RT#25488: Silence warnings in disconnect_log(). + via syslog(). + [BUGFIX] Rewrote the constants generation code in order to provide + fallback value for non-standard macros. + [BUGFIX] Mark Blackman and Edmund von der Burg identified and fixed the + random failures appearing on OSX, caused by a UDP timeout. + [FEATURE] Added Win32 event log support thanks to Yves Orton. + [FEATURE] Added new macros from modern BSD and IRIX. + [FEATURE] Each non-standard macro now fall backs to a standard macro. + [CODE] Merged changes from Jerry D. Hedden to use ppport.h only when not + built from core distribution (blead@30657). + [TESTS] t/syslog.t now generates a more detailled TAP output. + [TESTS] Merged change blead@29176: suppress taint mode from t/constants.t + [TESTS] Added regression tests for CPAN-RT#21866 and #25488. + [EG] Added example script eg/syslog.pl + [DOC] CPAN-RT#26097: man pages were not installed. + [DOC] Added the Sys::Syslog Rules. + +0.18 -- 2006.08.28 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] Rewrote the way the default identifiant is constructed. + [TESTS] CPAN-RT#20946: Removed the console mechanism from the main + test loop because writing to the console hangs on several systems. + [DOC] Added a note discouraging the use of setlogsock(). + +0.17 -- 2006.07.23 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] CPAN-RT#20622, #20164: Fixed path handling in connect_unix(). + [CODE] Renamed some variables ($that is not a valid name), and removed + some dead code. + [CODE] Actually added the macros from Mac OS X that were announced in + the 0.14 version. + [DOC] CPAN-RT#20545: Rewrote the documentation about setlogsock(). + +0.16 -- 2006.06.20 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] Perl-RT#20557: Save errno before trying to connect. + [FEATURE] Perl-RT#35406: Applied the patch proposed by Keisuke Hirata + for a more lax handling of "stream" or "unix" path. + [FEATURE] Now try the "native" mechanism first. + [TESTS] Silence warnings generated by t/syslog.t in Perl 5.8.8 and + later. + [DOC] Added documentation about the "native" mechanism. + [DOC] Now indicates whether tickets are from CPAN or Perl RT. + +0.15 -- 2006.06.10 -- Sebastien Aperghis-Tramoni (SAPER) + [FEATURE] CPAN-RT#17316: Added a "nofatal" option to openlog(). + [FEATURE] Sys::Syslog warnings can now be controled by the warnings + category of the same name. + [FEATURE] Added support for using the native C syslog(3) functions. + [CODE] Removed most "our" variables. + [CODE] Improved readability by removing cargo-cult brackets and + parentheses. + +0.14 -- 2006.05.25 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] CPAN-RT#19259, #17518: Now allowing all levels and facilities. + [CODE] Removed useless "&". + [CODE] Improved readability by adding empty lines and reworking the + code here and there. + [CODE] Added new macros from Mac OS X. + [TESTS] Added more tests in order to increase coverage. + [DOC] CPAN-RT#19085: Corrected errors in the documentation for setlogmask(). + [DOC] Added several links to online manual pages, RFCs and articles. + [DOC] Corrected minor things in Changes. + +0.13 -- 2006.01.11 -- Sebastien Aperghis-Tramoni (SAPER) + [CODE] Applied Gisle Aas patch for a better handling of error messages, + then optimized it. + [CODE] Merged blead@26768: If getservbyname fails tell what service + the lookup attempt tried to use. + [CODE] Merged blead@26769: suppress Sys::Hostname usage and directly + use INADDR_LOOPBACK. + [CODE] Merged blead@26772: $host needs to stay in case the user sets it. + [CODE] Merged blead@26773: check that $syslog_path is a socket. + [TESTS] CPAN-RT#16980: Sys::Syslog blows up rather spectacularly on + Solaris. Corrected by previous patches. + [TESTS] CPAN-RT#16974: Failed test in t/podspell. This test is now skipped. + +0.12 -- 2006.01.07 -- Sebastien Aperghis-Tramoni (SAPER) + [DOC] Added a link to an article about Sys::Syslog. + [TESTS] Merged some modifications from bleadperl. + [TESTS] Removed optional dependency on Test::Exception. + [TESTS] Improved t/constant.t + [TESTS] Rewrote t/constants.t because future versions of + ExtUtils::Constant will prevent the constant() function from + being directly called. + +0.11 -- 2005.12.28 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] setlogmask() now behaves like its C counterpart. + [FEATURE] Can now export and use the macros. + [FEATURE] Support for three Exporter tags. + [FEATURE] XSLoader is now optional. + [CODE] No longer "use"s Sys::Hostname as it was "require"d where needed. + [CODE] CPAN-RT#16604: Use local timestamp. + [DIST] Merged blead@26343: Fix realclean target. + [DOC] Improved documentation. + [TESTS] Added more tests to t/syslog.t in order to increase code coverage. + +0.10 -- 2005.12.08 -- Sebastien Aperghis-Tramoni (SAPER) + [DOC] Improved documentation. + [TESTS] Added -T to t/syslog.t + [TESTS] Added t/constants.t to check the macros. + [TESTS] Added t/distchk.t, t/podspell.t, t/podcover.t, t/portfs.t + +0.09 -- 2005.12.06 -- Sebastien Aperghis-Tramoni (SAPER) + [CODE] Now setlogsock() really croak(), as documented. + [DIST] CPANized from blead@26281. + [DIST] Modified Makefile.PL so that ExtUtils::Constant is conditionaly + used, with a fallback in the case it's not available. + [DIST] Bumped version to 0.09 + [DOC] Added support and license information. + [TESTS] Rewrote and ported t/syslog.t to Test::More + diff --git a/cpan/Sys-Syslog/Makefile.PL b/cpan/Sys-Syslog/Makefile.PL new file mode 100644 index 0000000000..790853ce8a --- /dev/null +++ b/cpan/Sys-Syslog/Makefile.PL @@ -0,0 +1,196 @@ +use strict; +use Config; +use ExtUtils::MakeMaker; +eval 'use ExtUtils::MakeMaker::Coverage'; +use File::Copy; +use File::Path; +use File::Spec; +require 5.005; + + +# create a typemap for Perl 5.6 +if ($] < 5.008) { + open(TYPEMAP, ">typemap") or die "fatal: can't write typemap: $!"; + print TYPEMAP "const char *\t\tT_PV\n"; + close(TYPEMAP); +} + +# create a lib/ dir in order to avoid warnings in Test::Distribution +mkdir "lib", 0755; + +# virtual paths given to EU::MM +my %virtual_path = ( 'Syslog.pm' => '$(INST_LIBDIR)/Syslog.pm' ); + +# detect when to use Win32::EvenLog +my (@extra_params, @extra_prereqs); +my $use_eventlog = eval "use Win32::EventLog; 1"; + +if ($use_eventlog) { + print " * Win32::EventLog detected.\n"; + my $name = "PerlLog"; + + push @extra_prereqs, + Win32 => 0, "Win32::TieRegistry" => 0, "Win32::EventLog" => 0; + + $virtual_path{'win32/Win32.pm' } = '$(INST_LIBDIR)/Syslog/Win32.pm'; + $virtual_path{'win32/PerlLog.dll'} = '$(INST_ARCHAUTODIR)/PerlLog.dll'; + + push @extra_params, CCFLAGS => "-Ifallback"; + + # recreate the DLL from its uuencoded form if it's not here + if (! -f File::Spec->catfile("win32", "$name.dll")) { + # read the uuencoded data + open(UU, '<' . File::Spec->catfile("win32", "$name\_dll.uu")) + or die "fatal: Can't read file '$name\_dll.uu': $!"; + my $uudata = do { local $/; <UU> }; + close(UU); + + # write the DLL + open(DLL, '>' . File::Spec->catfile("win32", "$name.dll")) + or die "fatal: Can't write DLL '$name.dll': $!"; + binmode(DLL); + print DLL unpack "u", $uudata; + close(DLL); + } +} +elsif ($^O =~ /Win32/) { + print <<"NOTICE" + *** You're running on a Win32 system, but you lack the Win32::EventLog\a + *** module, part of the libwin32 distribution. Although Sys::Syslog can + *** be used without Win32::EventLog, it won't be very useful except for + *** sending remote syslog messages. If you want to log messages on the + *** local host as well, please install libwin32 then Sys::Syslog again. +NOTICE +} + +# detect when being built in Perl core +if (grep { $_ eq 'PERL_CORE=1' } @ARGV) { + push @extra_params, + MAN3PODS => {}; # Pods will be built by installman. +} +else { + push @extra_params, + DEFINE => '-DUSE_PPPORT_H'; +} + +# on pre-5.6 Perls, add warnings::compat to the prereq modules +push @extra_prereqs, "warnings::compat" => "0.06" if $] < 5.006; + +WriteMakefile( + NAME => 'Sys::Syslog', + LICENSE => 'perl', + AUTHOR => 'Sebastien Aperghis-Tramoni <sebastien@aperghis.net>', + VERSION_FROM => 'Syslog.pm', + ABSTRACT_FROM => 'Syslog.pm', + INSTALLDIRS => 'perl', + XSPROTOARG => '-noprototypes', + PM => \%virtual_path, + PREREQ_PM => { + # run prereqs + 'Carp' => 0, + 'Fcntl' => 0, + 'File::Basename' => 0, + 'File::Spec' => 0, + 'POSIX' => 0, + 'Socket' => 0, + 'XSLoader' => 0, + @extra_prereqs, + + # build/test prereqs + 'Test::More' => 0, + }, + PL_FILES => {}, + dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, + clean => { FILES => 'Sys-Syslog-*' }, + realclean => { FILES => 'lib const-c.inc const-xs.inc macros.all ' + .'PerlLog.h typemap *.bak *.bin *.rc win32/PerlLog_dll' }, + @extra_params +); + + +# find a default value for _PATH_LOG +my $_PATH_LOG; + +if (-c "/dev/conslog" and -w _) { + # SunOS 5.8 has a worldwritable /dev/conslog STREAMS log driver. + # The /dev/log STREAMS log driver on this platform has permissions + # and ownership `crw-r----- root sys'. /dev/conslog has more liberal + # permissions. + $_PATH_LOG = "/dev/conslog"; +} +elsif (-S "/var/run/syslog" and -w _) { + # Mac OS X puts it at a different path. + $_PATH_LOG = "/var/run/syslog"; +} +elsif (-p "/dev/log" and -w _) { + # On HP-UX, /dev/log isn't a unix domain socket but a named pipe. + $_PATH_LOG = "/dev/log"; +} +elsif ((-S "/dev/log" or -c _) and -w _) { + # Most unixes have a unix domain socket /dev/log. + $_PATH_LOG = "/dev/log"; +} +else { + $_PATH_LOG = ""; +} + + +# if possible, generate the code that handles the constants with +# ExtUtils::Constant, otherwise use cached copy in fallback/ +if(eval {require ExtUtils::Constant; 1}) { + my @levels = qw( + LOG_ALERT LOG_CRIT LOG_DEBUG LOG_EMERG LOG_ERR + LOG_INFO LOG_NOTICE LOG_WARNING + ); + + my @facilities = ( + # standard facilities + qw( + LOG_AUTH LOG_AUTHPRIV LOG_CRON LOG_DAEMON LOG_FTP LOG_KERN + LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 + LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_LPR LOG_MAIL LOG_NEWS + LOG_SYSLOG LOG_USER LOG_UUCP + ), + # Mac OS X specific facilities + { name => "LOG_INSTALL", type => "IV", default => [ "IV", "LOG_USER" ] }, + { name => "LOG_LAUNCHD", type => "IV", default => [ "IV", "LOG_DAEMON"] }, + { name => "LOG_NETINFO", type => "IV", default => [ "IV", "LOG_DAEMON"] }, + { name => "LOG_RAS", type => "IV", default => [ "IV", "LOG_AUTH" ] }, + { name => "LOG_REMOTEAUTH", type => "IV", default => [ "IV", "LOG_AUTH" ] }, + # modern BSD specific facilities + { name => "LOG_CONSOLE", type => "IV", default => [ "IV", "LOG_USER" ] }, + { name => "LOG_NTP", type => "IV", default => [ "IV", "LOG_DAEMON"] }, + { name => "LOG_SECURITY", type => "IV", default => [ "IV", "LOG_AUTH" ] }, + # IRIX specific facilities + { name => "LOG_AUDIT", type => "IV", default => [ "IV", "LOG_AUTH" ] }, + { name => "LOG_LFMT", type => "IV", default => [ "IV", "LOG_USER" ] }, + ); + + my @options = qw( + LOG_CONS LOG_PID LOG_NDELAY LOG_NOWAIT LOG_ODELAY LOG_PERROR + ); + + my @others_macros = ( + qw(LOG_FACMASK), + { name => "_PATH_LOG", type => "PV", default => [ "PV", qq("$_PATH_LOG") ] }, + { name => "LOG_PRIMASK", type => "IV", default => [ "IV", 7] }, + { name => "LOG_NFACILITIES", type => "IV", default => [ "IV", scalar @facilities] }, + ); + + ExtUtils::Constant::WriteConstants( + NAME => 'Sys::Syslog', + NAMES => [ @levels, @facilities, @options, @others_macros ], + ($] > 5.009002 ? (PROXYSUBS => 1) : ()), + ); + + my @names = map { ref $_ ? $_->{name} : $_ } @levels, @facilities, @options; + open(MACROS, '>macros.all') or warn "warning: Can't write 'macros.all': $!\n"; + print MACROS join $/, @names; + close(MACROS); +} +else { + foreach my $file ('const-c.inc', 'const-xs.inc') { + my $fallback = File::Spec->catfile('fallback', $file); + copy($fallback, $file) or die "fatal: Can't copy $fallback to $file: $!"; + } +} diff --git a/cpan/Sys-Syslog/README b/cpan/Sys-Syslog/README new file mode 100644 index 0000000000..68bf1b69e0 --- /dev/null +++ b/cpan/Sys-Syslog/README @@ -0,0 +1,69 @@ +NAME + + Sys::Syslog - Perl interface to the UNIX syslog(3) calls + + +DESCRIPTION + + Sys::Syslog is an interface to the UNIX syslog(3) program. + Call syslog() with a string priority and a list of printf() args + just like syslog(3). + + +INSTALLATION + + To install this module, run the following commands: + + $ perl Makefile.PL + $ make + $ make test + $ make install + + An ANSI-compliant compiler is required to compile the extension. + + Sys::Syslog should work on any Perl since 5.6.0. This module has + been tested by the author on the following Perl and system versions + but is likely to run on many more: + + Perl Architecture GCC + ----------------------------------------------------- + 5.6.2 i686-linux 3.4.1 + 5.8.5 i386-linux-thread-multi 3.4.1 + 5.8.8 i386-freebsd-64int 3.4.4 + 5.8.6 darwin-thread-multi-2level (PowerPC) 4.0.1 + + See also the corresponding CPAN Testers page: + http://testers.cpan.org/show/Sys-Syslog.html + + +SUPPORT AND DOCUMENTATION + + After installing, you can find documentation for this module + with the perldoc command. + + perldoc Sys::Syslog + + You can also look for information at: + + Search CPAN + http://search.cpan.org/dist/Sys-Syslog/ + + Kobes' CPAN Search + http://cpan.uwinnipeg.ca/dist/Sys-Syslog + + CPAN Request Tracker: + http://rt.cpan.org/NoAuth/Bugs.html?Dist=Sys-Syslog + + AnnoCPAN, annotated CPAN documentation: + http://annocpan.org/dist/Sys-Syslog + + CPAN Ratings: + http://cpanratings.perl.org/d/Sys-Syslog + + +COPYRIGHT AND LICENCE + + Copyright (C) 1990-2008 by Larry Wall and others. + + This program is free software; you can redistribute it and/or modify it + under the same terms as Perl itself. diff --git a/cpan/Sys-Syslog/README.win32 b/cpan/Sys-Syslog/README.win32 new file mode 100644 index 0000000000..adf253ab96 --- /dev/null +++ b/cpan/Sys-Syslog/README.win32 @@ -0,0 +1,30 @@ +NAME + + README.win32 - Customise and build Sys::Syslog with Win32 EventLog support + + +DESCRIPTION + + This package includes support for the Win32 Event log. This requires + building a message file and then compiling it and linking it into the + final .DLL produced by MakeMaker. The default message text file used + by Sys::Syslog is PerlLog.mc, located in the win32/ subdirectory. + + If the message file is updated then you need to go in the win32/ + subdirectory and run the "compile.pl" command to update the relevent + files. Note that Sys::Syslog::Win32 is built by this process. + + The following files are in the win32 directory: + + PerlLog.mc -- Message file, change this if you change anything. + compile.pl -- Compile the message file and produce Win32.pm and + PerlLog.RES. Requires that mc.exe and rc.exe are + in the path. + + PerlLog.RES -- Precompiled resource file, used when building the DLL + Win32.pm -- Generated Win32 module for working with the resource file + + When building win32/PerlLog.RES will be linked into the final XS file, + and win32/Win32.pm will be copied to lib/Sys/Syslog/Win32.pm, which will + then be installed by MakeMaker as per normal. + diff --git a/cpan/Sys-Syslog/Syslog.pm b/cpan/Sys-Syslog/Syslog.pm new file mode 100644 index 0000000000..002e6e4f16 --- /dev/null +++ b/cpan/Sys-Syslog/Syslog.pm @@ -0,0 +1,1600 @@ +package Sys::Syslog; +use strict; +use warnings; +use warnings::register; +use Carp; +use Exporter (); +use Fcntl qw(O_WRONLY); +use File::Basename; +use POSIX qw(strftime setlocale LC_TIME); +use Socket ':all'; +require 5.005; + +{ no strict 'vars'; + $VERSION = '0.27'; + @ISA = qw(Exporter); + + %EXPORT_TAGS = ( + standard => [qw(openlog syslog closelog setlogmask)], + extended => [qw(setlogsock)], + macros => [ + # levels + qw( + LOG_ALERT LOG_CRIT LOG_DEBUG LOG_EMERG LOG_ERR + LOG_INFO LOG_NOTICE LOG_WARNING + ), + + # standard facilities + qw( + LOG_AUTH LOG_AUTHPRIV LOG_CRON LOG_DAEMON LOG_FTP LOG_KERN + LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 + LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_LPR LOG_MAIL LOG_NEWS + LOG_SYSLOG LOG_USER LOG_UUCP + ), + # Mac OS X specific facilities + qw( LOG_INSTALL LOG_LAUNCHD LOG_NETINFO LOG_RAS LOG_REMOTEAUTH ), + # modern BSD specific facilities + qw( LOG_CONSOLE LOG_NTP LOG_SECURITY ), + # IRIX specific facilities + qw( LOG_AUDIT LOG_LFMT ), + + # options + qw( + LOG_CONS LOG_PID LOG_NDELAY LOG_NOWAIT LOG_ODELAY LOG_PERROR + ), + + # others macros + qw( + LOG_FACMASK LOG_NFACILITIES LOG_PRIMASK + LOG_MASK LOG_UPTO + ), + ], + ); + + @EXPORT = ( + @{$EXPORT_TAGS{standard}}, + ); + + @EXPORT_OK = ( + @{$EXPORT_TAGS{extended}}, + @{$EXPORT_TAGS{macros}}, + ); + + eval { + require XSLoader; + XSLoader::load('Sys::Syslog', $VERSION); + 1 + } or do { + require DynaLoader; + push @ISA, 'DynaLoader'; + bootstrap Sys::Syslog $VERSION; + }; +} + + +# +# Public variables +# +use vars qw($host); # host to send syslog messages to (see notes at end) + +# +# Prototypes +# +sub silent_eval (&); + +# +# Global variables +# +use vars qw($facility); +my $connected = 0; # flag to indicate if we're connected or not +my $syslog_send; # coderef of the function used to send messages +my $syslog_path = undef; # syslog path for "stream" and "unix" mechanisms +my $syslog_xobj = undef; # if defined, holds the external object used to send messages +my $transmit_ok = 0; # flag to indicate if the last message was transmited +my $sock_timeout = 0; # socket timeout, see below +my $current_proto = undef; # current mechanism used to transmit messages +my $ident = ''; # identifiant prepended to each message +$facility = ''; # current facility +my $maskpri = LOG_UPTO(&LOG_DEBUG); # current log mask + +my %options = ( + ndelay => 0, + nofatal => 0, + nowait => 0, + perror => 0, + pid => 0, +); + +# Default is now to first use the native mechanism, so Perl programs +# behave like other normal Unix programs, then try other mechanisms. +my @connectMethods = qw(native tcp udp unix pipe stream console); +if ($^O =~ /^(freebsd|linux)$/) { + @connectMethods = grep { $_ ne 'udp' } @connectMethods; +} + +# And on Win32 systems, we try to use the native mechanism for this +# platform, the events logger, available through Win32::EventLog. +EVENTLOG: { + my $is_Win32 = $^O =~ /Win32/i; + + if (can_load("Sys::Syslog::Win32")) { + unshift @connectMethods, 'eventlog'; + } + elsif ($is_Win32) { + warn $@; + } +} + +my @defaultMethods = @connectMethods; +my @fallbackMethods = (); + +# The timeout in connection_ok() was pushed up to 0.25 sec in +# Sys::Syslog v0.19 in order to address a heisenbug on MacOSX: +# http://london.pm.org/pipermail/london.pm/Week-of-Mon-20061211/005961.html +# +# However, this also had the effect of slowing this test for +# all other operating systems, which apparently impacted some +# users (cf. CPAN-RT #34753). So, in order to make everybody +# happy, the timeout is now zero by default on all systems +# except on OSX where it is set to 250 msec, and can be set +# with the infamous setlogsock() function. +$sock_timeout = 0.25 if $^O =~ /darwin/; + +# coderef for a nicer handling of errors +my $err_sub = $options{nofatal} ? \&warnings::warnif : \&croak; + + +sub AUTOLOAD { + # This AUTOLOAD is used to 'autoload' constants from the constant() + # XS function. + no strict 'vars'; + my $constname; + ($constname = $AUTOLOAD) =~ s/.*:://; + croak "Sys::Syslog::constant() not defined" if $constname eq 'constant'; + my ($error, $val) = constant($constname); + croak $error if $error; + no strict 'refs'; + *$AUTOLOAD = sub { $val }; + goto &$AUTOLOAD; +} + + +sub openlog { + ($ident, my $logopt, $facility) = @_; + + # default values + $ident ||= basename($0) || getlogin() || getpwuid($<) || 'syslog'; + $logopt ||= ''; + $facility ||= LOG_USER(); + + for my $opt (split /\b/, $logopt) { + $options{$opt} = 1 if exists $options{$opt} + } + + $err_sub = delete $options{nofatal} ? \&warnings::warnif : \&croak; + return 1 unless $options{ndelay}; + connect_log(); +} + +sub closelog { + $facility = $ident = ''; + disconnect_log(); +} + +sub setlogmask { + my $oldmask = $maskpri; + $maskpri = shift unless $_[0] == 0; + $oldmask; +} + +sub setlogsock { + my ($setsock, $setpath, $settime) = @_; + + # check arguments + my $diag_invalid_arg + = "Invalid argument passed to setlogsock; must be 'stream', 'pipe', " + . "'unix', 'native', 'eventlog', 'tcp', 'udp' or 'inet'"; + croak $diag_invalid_arg unless defined $setsock; + croak "Invalid number of arguments" unless @_ >= 1 and @_ <= 3; + + $syslog_path = $setpath if defined $setpath; + $sock_timeout = $settime if defined $settime; + + disconnect_log() if $connected; + $transmit_ok = 0; + @fallbackMethods = (); + @connectMethods = @defaultMethods; + + if (ref $setsock eq 'ARRAY') { + @connectMethods = @$setsock; + + } elsif (lc $setsock eq 'stream') { + if (not defined $syslog_path) { + my @try = qw(/dev/log /dev/conslog); + + if (length &_PATH_LOG) { # Undefined _PATH_LOG is "". + unshift @try, &_PATH_LOG; + } + + for my $try (@try) { + if (-w $try) { + $syslog_path = $try; + last; + } + } + + if (not defined $syslog_path) { + warnings::warnif "stream passed to setlogsock, but could not find any device"; + return undef + } + } + + if (not -w $syslog_path) { + warnings::warnif "stream passed to setlogsock, but $syslog_path is not writable"; + return undef; + } else { + @connectMethods = qw(stream); + } + + } elsif (lc $setsock eq 'unix') { + if (length _PATH_LOG() || (defined $syslog_path && -w $syslog_path)) { + $syslog_path = _PATH_LOG() unless defined $syslog_path; + @connectMethods = qw(unix); + } else { + warnings::warnif 'unix passed to setlogsock, but path not available'; + return undef; + } + + } elsif (lc $setsock eq 'pipe') { + for my $path ($syslog_path, &_PATH_LOG, "/dev/log") { + next unless defined $path and length $path and -p $path and -w _; + $syslog_path = $path; + last + } + + if (not $syslog_path) { + warnings::warnif "pipe passed to setlogsock, but path not available"; + return undef + } + + @connectMethods = qw(pipe); + + } elsif (lc $setsock eq 'native') { + @connectMethods = qw(native); + + } elsif (lc $setsock eq 'eventlog') { + if (can_load("Win32::EventLog")) { + @connectMethods = qw(eventlog); + } else { + warnings::warnif "eventlog passed to setlogsock, but no Win32 API available"; + $@ = ""; + return undef; + } + + } elsif (lc $setsock eq 'tcp') { + if (getservbyname('syslog', 'tcp') || getservbyname('syslogng', 'tcp')) { + @connectMethods = qw(tcp); + $host = $syslog_path; + } else { + warnings::warnif "tcp passed to setlogsock, but tcp service unavailable"; + return undef; + } + + } elsif (lc $setsock eq 'udp') { + if (getservbyname('syslog', 'udp')) { + @connectMethods = qw(udp); + $host = $syslog_path; + } else { + warnings::warnif "udp passed to setlogsock, but udp service unavailable"; + return undef; + } + + } elsif (lc $setsock eq 'inet') { + @connectMethods = ( 'tcp', 'udp' ); + + } elsif (lc $setsock eq 'console') { + @connectMethods = qw(console); + + } else { + croak $diag_invalid_arg + } + + return 1; +} + +sub syslog { + my $priority = shift; + my $mask = shift; + my ($message, $buf); + my (@words, $num, $numpri, $numfac, $sum); + my $failed = undef; + my $fail_time = undef; + my $error = $!; + + # if $ident is undefined, it means openlog() wasn't previously called + # so do it now in order to have sensible defaults + openlog() unless $ident; + + local $facility = $facility; # may need to change temporarily. + + croak "syslog: expecting argument \$priority" unless defined $priority; + croak "syslog: expecting argument \$format" unless defined $mask; + + croak "syslog: invalid level/facility: $priority" if $priority =~ /^-\d+$/; + @words = split(/\W+/, $priority, 2); # Allow "level" or "level|facility". + undef $numpri; + undef $numfac; + + for my $word (@words) { + next if length $word == 0; + + $num = xlate($word); # Translate word to number. + + if ($num < 0) { + croak "syslog: invalid level/facility: $word" + } + elsif ($num <= &LOG_PRIMASK) { + croak "syslog: too many levels given: $word" if defined $numpri; + $numpri = $num; + return 0 unless LOG_MASK($numpri) & $maskpri; + } + else { + croak "syslog: too many facilities given: $word" if defined $numfac; + $facility = $word; + $numfac = $num; + } + } + + croak "syslog: level must be given" unless defined $numpri; + + if (not defined $numfac) { # Facility not specified in this call. + $facility = 'user' unless $facility; + $numfac = xlate($facility); + } + + connect_log() unless $connected; + + if ($mask =~ /%m/) { + # escape percent signs for sprintf() + $error =~ s/%/%%/g if @_; + # replace %m with $error, if preceded by an even number of percent signs + $mask =~ s/(?<!%)((?:%%)*)%m/$1$error/g; + } + + $mask .= "\n" unless $mask =~ /\n$/; + $message = @_ ? sprintf($mask, @_) : $mask; + + # See CPAN-RT#24431. Opened on Apple Radar as bug #4944407 on 2007.01.21 + # Supposedly resolved on Leopard. + chomp $message if $^O =~ /darwin/; + + if ($current_proto eq 'native') { + $buf = $message; + } + elsif ($current_proto eq 'eventlog') { + $buf = $message; + } + else { + my $whoami = $ident; + $whoami .= "[$$]" if $options{pid}; + + $sum = $numpri + $numfac; + my $oldlocale = setlocale(LC_TIME); + setlocale(LC_TIME, 'C'); + my $timestamp = strftime "%b %e %T", localtime; + setlocale(LC_TIME, $oldlocale); + $buf = "<$sum>$timestamp $whoami: $message\0"; + } + + # handle PERROR option + # "native" mechanism already handles it by itself + if ($options{perror} and $current_proto ne 'native') { + chomp $message; + my $whoami = $ident; + $whoami .= "[$$]" if $options{pid}; + print STDERR "$whoami: $message\n"; + } + + # it's possible that we'll get an error from sending + # (e.g. if method is UDP and there is no UDP listener, + # then we'll get ECONNREFUSED on the send). So what we + # want to do at this point is to fallback onto a different + # connection method. + while (scalar @fallbackMethods || $syslog_send) { + if ($failed && (time - $fail_time) > 60) { + # it's been a while... maybe things have been fixed + @fallbackMethods = (); + disconnect_log(); + $transmit_ok = 0; # make it look like a fresh attempt + connect_log(); + } + + if ($connected && !connection_ok()) { + # Something was OK, but has now broken. Remember coz we'll + # want to go back to what used to be OK. + $failed = $current_proto unless $failed; + $fail_time = time; + disconnect_log(); + } + + connect_log() unless $connected; + $failed = undef if ($current_proto && $failed && $current_proto eq $failed); + + if ($syslog_send) { + if ($syslog_send->($buf, $numpri, $numfac)) { + $transmit_ok++; + return 1; + } + # typically doesn't happen, since errors are rare from write(). + disconnect_log(); + } + } + # could not send, could not fallback onto a working + # connection method. Lose. + return 0; +} + +sub _syslog_send_console { + my ($buf) = @_; + chop($buf); # delete the NUL from the end + # The console print is a method which could block + # so we do it in a child process and always return success + # to the caller. + if (my $pid = fork) { + + if ($options{nowait}) { + return 1; + } else { + if (waitpid($pid, 0) >= 0) { + return ($? >> 8); + } else { + # it's possible that the caller has other + # plans for SIGCHLD, so let's not interfere + return 1; + } + } + } else { + if (open(CONS, ">/dev/console")) { + my $ret = print CONS $buf . "\r"; # XXX: should this be \x0A ? + exit $ret if defined $pid; + close CONS; + } + exit if defined $pid; + } +} + +sub _syslog_send_stream { + my ($buf) = @_; + # XXX: this only works if the OS stream implementation makes a write + # look like a putmsg() with simple header. For instance it works on + # Solaris 8 but not Solaris 7. + # To be correct, it should use a STREAMS API, but perl doesn't have one. + return syswrite(SYSLOG, $buf, length($buf)); +} + +sub _syslog_send_pipe { + my ($buf) = @_; + return print SYSLOG $buf; +} + +sub _syslog_send_socket { + my ($buf) = @_; + return syswrite(SYSLOG, $buf, length($buf)); + #return send(SYSLOG, $buf, 0); +} + +sub _syslog_send_native { + my ($buf, $numpri) = @_; + syslog_xs($numpri, $buf); + return 1; +} + + +# xlate() +# ----- +# private function to translate names to numeric values +# +sub xlate { + my ($name) = @_; + + return $name+0 if $name =~ /^\s*\d+\s*$/; + $name = uc $name; + $name = "LOG_$name" unless $name =~ /^LOG_/; + + # ExtUtils::Constant 0.20 introduced a new way to implement + # constants, called ProxySubs. When it was used to generate + # the C code, the constant() function no longer returns the + # correct value. Therefore, we first try a direct call to + # constant(), and if the value is an error we try to call the + # constant by its full name. + my $value = constant($name); + + if (index($value, "not a valid") >= 0) { + $name = "Sys::Syslog::$name"; + $value = eval { no strict "refs"; &$name }; + $value = $@ unless defined $value; + } + + $value = -1 if index($value, "not a valid") >= 0; + + return defined $value ? $value : -1; +} + + +# connect_log() +# ----------- +# This function acts as a kind of front-end: it tries to connect to +# a syslog service using the selected methods, trying each one in the +# selected order. +# +sub connect_log { + @fallbackMethods = @connectMethods unless scalar @fallbackMethods; + + if ($transmit_ok && $current_proto) { + # Retry what we were on, because it has worked in the past. + unshift(@fallbackMethods, $current_proto); + } + + $connected = 0; + my @errs = (); + my $proto = undef; + + while ($proto = shift @fallbackMethods) { + no strict 'refs'; + my $fn = "connect_$proto"; + $connected = &$fn(\@errs) if defined &$fn; + last if $connected; + } + + $transmit_ok = 0; + if ($connected) { + $current_proto = $proto; + my ($old) = select(SYSLOG); $| = 1; select($old); + } else { + @fallbackMethods = (); + $err_sub->(join "\n\t- ", "no connection to syslog available", @errs); + return undef; + } +} + +sub connect_tcp { + my ($errs) = @_; + + my $tcp = getprotobyname('tcp'); + if (!defined $tcp) { + push @$errs, "getprotobyname failed for tcp"; + return 0; + } + + my $syslog = getservbyname('syslog', 'tcp'); + $syslog = getservbyname('syslogng', 'tcp') unless defined $syslog; + if (!defined $syslog) { + push @$errs, "getservbyname failed for syslog/tcp and syslogng/tcp"; + return 0; + } + + my $addr; + if (defined $host) { + $addr = inet_aton($host); + if (!$addr) { + push @$errs, "can't lookup $host"; + return 0; + } + } else { + $addr = INADDR_LOOPBACK; + } + $addr = sockaddr_in($syslog, $addr); + + if (!socket(SYSLOG, AF_INET, SOCK_STREAM, $tcp)) { + push @$errs, "tcp socket: $!"; + return 0; + } + + setsockopt(SYSLOG, SOL_SOCKET, SO_KEEPALIVE, 1); + if (silent_eval { IPPROTO_TCP() }) { + # These constants don't exist in 5.005. They were added in 1999 + setsockopt(SYSLOG, IPPROTO_TCP(), TCP_NODELAY(), 1); + } + if (!connect(SYSLOG, $addr)) { + push @$errs, "tcp connect: $!"; + return 0; + } + + $syslog_send = \&_syslog_send_socket; + + return 1; +} + +sub connect_udp { + my ($errs) = @_; + + my $udp = getprotobyname('udp'); + if (!defined $udp) { + push @$errs, "getprotobyname failed for udp"; + return 0; + } + + my $syslog = getservbyname('syslog', 'udp'); + if (!defined $syslog) { + push @$errs, "getservbyname failed for syslog/udp"; + return 0; + } + + my $addr; + if (defined $host) { + $addr = inet_aton($host); + if (!$addr) { + push @$errs, "can't lookup $host"; + return 0; + } + } else { + $addr = INADDR_LOOPBACK; + } + $addr = sockaddr_in($syslog, $addr); + + if (!socket(SYSLOG, AF_INET, SOCK_DGRAM, $udp)) { + push @$errs, "udp socket: $!"; + return 0; + } + if (!connect(SYSLOG, $addr)) { + push @$errs, "udp connect: $!"; + return 0; + } + + # We want to check that the UDP connect worked. However the only + # way to do that is to send a message and see if an ICMP is returned + _syslog_send_socket(""); + if (!connection_ok()) { + push @$errs, "udp connect: nobody listening"; + return 0; + } + + $syslog_send = \&_syslog_send_socket; + + return 1; +} + +sub connect_stream { + my ($errs) = @_; + # might want syslog_path to be variable based on syslog.h (if only + # it were in there!) + $syslog_path = '/dev/conslog' unless defined $syslog_path; + if (!-w $syslog_path) { + push @$errs, "stream $syslog_path is not writable"; + return 0; + } + if (!sysopen(SYSLOG, $syslog_path, O_WRONLY, 0400)) { + push @$errs, "stream can't open $syslog_path: $!"; + return 0; + } + $syslog_send = \&_syslog_send_stream; + return 1; +} + +sub connect_pipe { + my ($errs) = @_; + + $syslog_path ||= &_PATH_LOG || "/dev/log"; + + if (not -w $syslog_path) { + push @$errs, "$syslog_path is not writable"; + return 0; + } + + if (not open(SYSLOG, ">$syslog_path")) { + push @$errs, "can't write to $syslog_path: $!"; + return 0; + } + + $syslog_send = \&_syslog_send_pipe; + + return 1; +} + +sub connect_unix { + my ($errs) = @_; + + $syslog_path ||= _PATH_LOG() if length _PATH_LOG(); + + if (not defined $syslog_path) { + push @$errs, "_PATH_LOG not available in syslog.h and no user-supplied socket path"; + return 0; + } + + if (not (-S $syslog_path or -c _)) { + push @$errs, "$syslog_path is not a socket"; + return 0; + } + + my $addr = sockaddr_un($syslog_path); + if (!$addr) { + push @$errs, "can't locate $syslog_path"; + return 0; + } + if (!socket(SYSLOG, AF_UNIX, SOCK_STREAM, 0)) { + push @$errs, "unix stream socket: $!"; + return 0; + } + + if (!connect(SYSLOG, $addr)) { + if (!socket(SYSLOG, AF_UNIX, SOCK_DGRAM, 0)) { + push @$errs, "unix dgram socket: $!"; + return 0; + } + if (!connect(SYSLOG, $addr)) { + push @$errs, "unix dgram connect: $!"; + return 0; + } + } + + $syslog_send = \&_syslog_send_socket; + + return 1; +} + +sub connect_native { + my ($errs) = @_; + my $logopt = 0; + + # reconstruct the numeric equivalent of the options + for my $opt (keys %options) { + $logopt += xlate($opt) if $options{$opt} + } + + openlog_xs($ident, $logopt, xlate($facility)); + $syslog_send = \&_syslog_send_native; + + return 1; +} + +sub connect_eventlog { + my ($errs) = @_; + + $syslog_xobj = Sys::Syslog::Win32::_install(); + $syslog_send = \&Sys::Syslog::Win32::_syslog_send; + + return 1; +} + +sub connect_console { + my ($errs) = @_; + if (!-w '/dev/console') { + push @$errs, "console is not writable"; + return 0; + } + $syslog_send = \&_syslog_send_console; + return 1; +} + +# To test if the connection is still good, we need to check if any +# errors are present on the connection. The errors will not be raised +# by a write. Instead, sockets are made readable and the next read +# would cause the error to be returned. Unfortunately the syslog +# 'protocol' never provides anything for us to read. But with +# judicious use of select(), we can see if it would be readable... +sub connection_ok { + return 1 if defined $current_proto and ( + $current_proto eq 'native' or $current_proto eq 'console' + or $current_proto eq 'eventlog' + ); + + my $rin = ''; + vec($rin, fileno(SYSLOG), 1) = 1; + my $ret = select $rin, undef, $rin, $sock_timeout; + return ($ret ? 0 : 1); +} + +sub disconnect_log { + $connected = 0; + $syslog_send = undef; + + if (defined $current_proto and $current_proto eq 'native') { + closelog_xs(); + return 1; + } + elsif (defined $current_proto and $current_proto eq 'eventlog') { + $syslog_xobj->Close(); + return 1; + } + + return close SYSLOG; +} + + +# +# Wrappers around eval() that makes sure that nobody, and I say NOBODY, +# ever knows that I wanted to test if something was here or not. +# It is needed because some applications are trying to be too smart, +# do it wrong, and it ends up in EPIC FAIL. +# Yes I'm speaking of YOU, SpamAssassin. +# +sub silent_eval (&) { + local($SIG{__DIE__}, $SIG{__WARN__}, $@); + return eval { $_[0]->() } +} + +sub can_load { + local($SIG{__DIE__}, $SIG{__WARN__}, $@); + return eval "use $_[0]; 1" +} + + +"Eighth Rule: read the documentation." + +__END__ + +=head1 NAME + +Sys::Syslog - Perl interface to the UNIX syslog(3) calls + +=head1 VERSION + +Version 0.27 + +=head1 SYNOPSIS + + use Sys::Syslog; # all except setlogsock(), or: + use Sys::Syslog qw(:DEFAULT setlogsock); # default set, plus setlogsock() + use Sys::Syslog qw(:standard :macros); # standard functions, plus macros + + openlog $ident, $logopt, $facility; # don't forget this + syslog $priority, $format, @args; + $oldmask = setlogmask $mask_priority; + closelog; + + +=head1 DESCRIPTION + +C<Sys::Syslog> is an interface to the UNIX C<syslog(3)> program. +Call C<syslog()> with a string priority and a list of C<printf()> args +just like C<syslog(3)>. + +You can find a kind of FAQ in L<"THE RULES OF SYS::SYSLOG">. Please read +it before coding, and again before asking questions. + + +=head1 EXPORTS + +C<Sys::Syslog> exports the following C<Exporter> tags: + +=over 4 + +=item * + +C<:standard> exports the standard C<syslog(3)> functions: + + openlog closelog setlogmask syslog + +=item * + +C<:extended> exports the Perl specific functions for C<syslog(3)>: + + setlogsock + +=item * + +C<:macros> exports the symbols corresponding to most of your C<syslog(3)> +macros and the C<LOG_UPTO()> and C<LOG_MASK()> functions. +See L<"CONSTANTS"> for the supported constants and their meaning. + +=back + +By default, C<Sys::Syslog> exports the symbols from the C<:standard> tag. + + +=head1 FUNCTIONS + +=over 4 + +=item B<openlog($ident, $logopt, $facility)> + +Opens the syslog. +C<$ident> is prepended to every message. C<$logopt> contains zero or +more of the options detailed below. C<$facility> specifies the part +of the system to report about, for example C<LOG_USER> or C<LOG_LOCAL0>: +see L<"Facilities"> for a list of well-known facilities, and your +C<syslog(3)> documentation for the facilities available in your system. +Check L<"SEE ALSO"> for useful links. Facility can be given as a string +or a numeric macro. + +This function will croak if it can't connect to the syslog daemon. + +Note that C<openlog()> now takes three arguments, just like C<openlog(3)>. + +B<You should use C<openlog()> before calling C<syslog()>.> + +B<Options> + +=over 4 + +=item * + +C<cons> - This option is ignored, since the failover mechanism will drop +down to the console automatically if all other media fail. + +=item * + +C<ndelay> - Open the connection immediately (normally, the connection is +opened when the first message is logged). + +=item * + +C<nofatal> - When set to true, C<openlog()> and C<syslog()> will only +emit warnings instead of dying if the connection to the syslog can't +be established. + +=item * + +C<nowait> - Don't wait for child processes that may have been created +while logging the message. (The GNU C library does not create a child +process, so this option has no effect on Linux.) + +=item * + +C<perror> - Write the message to standard error output as well to the +system log. + +=item * + +C<pid> - Include PID with each message. + +=back + +B<Examples> + +Open the syslog with options C<ndelay> and C<pid>, and with facility C<LOCAL0>: + + openlog($name, "ndelay,pid", "local0"); + +Same thing, but this time using the macro corresponding to C<LOCAL0>: + + openlog($name, "ndelay,pid", LOG_LOCAL0); + + +=item B<syslog($priority, $message)> + +=item B<syslog($priority, $format, @args)> + +If C<$priority> permits, logs C<$message> or C<sprintf($format, @args)> +with the addition that C<%m> in $message or C<$format> is replaced with +C<"$!"> (the latest error message). + +C<$priority> can specify a level, or a level and a facility. Levels and +facilities can be given as strings or as macros. When using the C<eventlog> +mechanism, priorities C<DEBUG> and C<INFO> are mapped to event type +C<informational>, C<NOTICE> and C<WARNIN> to C<warning> and C<ERR> to +C<EMERG> to C<error>. + +If you didn't use C<openlog()> before using C<syslog()>, C<syslog()> will +try to guess the C<$ident> by extracting the shortest prefix of +C<$format> that ends in a C<":">. + +B<Examples> + + syslog("info", $message); # informational level + syslog(LOG_INFO, $message); # informational level + + syslog("info|local0", $message); # information level, Local0 facility + syslog(LOG_INFO|LOG_LOCAL0, $message); # information level, Local0 facility + +=over 4 + +=item B<Note> + +C<Sys::Syslog> version v0.07 and older passed the C<$message> as the +formatting string to C<sprintf()> even when no formatting arguments +were provided. If the code calling C<syslog()> might execute with +older versions of this module, make sure to call the function as +C<syslog($priority, "%s", $message)> instead of C<syslog($priority, +$message)>. This protects against hostile formatting sequences that +might show up if $message contains tainted data. + +=back + + +=item B<setlogmask($mask_priority)> + +Sets the log mask for the current process to C<$mask_priority> and +returns the old mask. If the mask argument is 0, the current log mask +is not modified. See L<"Levels"> for the list of available levels. +You can use the C<LOG_UPTO()> function to allow all levels up to a +given priority (but it only accept the numeric macros as arguments). + +B<Examples> + +Only log errors: + + setlogmask( LOG_MASK(LOG_ERR) ); + +Log everything except informational messages: + + setlogmask( ~(LOG_MASK(LOG_INFO)) ); + +Log critical messages, errors and warnings: + + setlogmask( LOG_MASK(LOG_CRIT) | LOG_MASK(LOG_ERR) | LOG_MASK(LOG_WARNING) ); + +Log all messages up to debug: + + setlogmask( LOG_UPTO(LOG_DEBUG) ); + + +=item B<setlogsock($sock_type)> + +=item B<setlogsock($sock_type, $stream_location)> (added in Perl 5.004_02) + +=item B<setlogsock($sock_type, $stream_location, $sock_timeout)> (added in 0.25) + +Sets the socket type to be used for the next call to +C<openlog()> or C<syslog()> and returns true on success, +C<undef> on failure. The available mechanisms are: + +=over + +=item * + +C<"native"> - use the native C functions from your C<syslog(3)> library +(added in C<Sys::Syslog> 0.15). + +=item * + +C<"eventlog"> - send messages to the Win32 events logger (Win32 only; +added in C<Sys::Syslog> 0.19). + +=item * + +C<"tcp"> - connect to a TCP socket, on the C<syslog/tcp> or C<syslogng/tcp> +service. If defined, the second parameter is used as a hostname to connect to. + +=item * + +C<"udp"> - connect to a UDP socket, on the C<syslog/udp> service. +If defined, the second parameter is used as a hostname to connect to, +and the third parameter as the timeout used to check for UDP response. + +=item * + +C<"inet"> - connect to an INET socket, either TCP or UDP, tried in that +order. If defined, the second parameter is used as a hostname to connect to. + +=item * + +C<"unix"> - connect to a UNIX domain socket (in some systems a character +special device). The name of that socket is the second parameter or, if +you omit the second parameter, the value returned by the C<_PATH_LOG> macro +(if your system defines it), or F</dev/log> or F</dev/conslog>, whatever is +writable. + +=item * + +C<"stream"> - connect to the stream indicated by the pathname provided as +the optional second parameter, or, if omitted, to F</dev/conslog>. +For example Solaris and IRIX system may prefer C<"stream"> instead of C<"unix">. + +=item * + +C<"pipe"> - connect to the named pipe indicated by the pathname provided as +the optional second parameter, or, if omitted, to the value returned by +the C<_PATH_LOG> macro (if your system defines it), or F</dev/log> +(added in C<Sys::Syslog> 0.21). + +=item * + +C<"console"> - send messages directly to the console, as for the C<"cons"> +option of C<openlog()>. + +=back + +A reference to an array can also be passed as the first parameter. +When this calling method is used, the array should contain a list of +mechanisms which are attempted in order. + +The default is to try C<native>, C<tcp>, C<udp>, C<unix>, C<pipe>, C<stream>, +C<console>. +Under systems with the Win32 API, C<eventlog> will be added as the first +mechanism to try if C<Win32::EventLog> is available. + +Giving an invalid value for C<$sock_type> will C<croak>. + +B<Examples> + +Select the UDP socket mechanism: + + setlogsock("udp"); + +Select the native, UDP socket then UNIX domain socket mechanisms: + + setlogsock(["native", "udp", "unix"]); + +=over + +=item B<Note> + +Now that the "native" mechanism is supported by C<Sys::Syslog> and selected +by default, the use of the C<setlogsock()> function is discouraged because +other mechanisms are less portable across operating systems. Authors of +modules and programs that use this function, especially its cargo-cult form +C<setlogsock("unix")>, are advised to remove any occurence of it unless they +specifically want to use a given mechanism (like TCP or UDP to connect to +a remote host). + +=back + +=item B<closelog()> + +Closes the log file and returns true on success. + +=back + + +=head1 THE RULES OF SYS::SYSLOG + +I<The First Rule of Sys::Syslog is:> +You do not call C<setlogsock>. + +I<The Second Rule of Sys::Syslog is:> +You B<do not> call C<setlogsock>. + +I<The Third Rule of Sys::Syslog is:> +The program crashes, C<die>s, calls C<closelog>, the log is over. + +I<The Fourth Rule of Sys::Syslog is:> +One facility, one priority. + +I<The Fifth Rule of Sys::Syslog is:> +One log at a time. + +I<The Sixth Rule of Sys::Syslog is:> +No C<syslog> before C<openlog>. + +I<The Seventh Rule of Sys::Syslog is:> +Logs will go on as long as they have to. + +I<The Eighth, and Final Rule of Sys::Syslog is:> +If this is your first use of Sys::Syslog, you must read the doc. + + +=head1 EXAMPLES + +An example: + + openlog($program, 'cons,pid', 'user'); + syslog('info', '%s', 'this is another test'); + syslog('mail|warning', 'this is a better test: %d', time); + closelog(); + + syslog('debug', 'this is the last test'); + +Another example: + + openlog("$program $$", 'ndelay', 'user'); + syslog('notice', 'fooprogram: this is really done'); + +Example of use of C<%m>: + + $! = 55; + syslog('info', 'problem was %m'); # %m == $! in syslog(3) + +Log to UDP port on C<$remotehost> instead of logging locally: + + setlogsock("udp", $remotehost); + openlog($program, 'ndelay', 'user'); + syslog('info', 'something happened over here'); + + +=head1 CONSTANTS + +=head2 Facilities + +=over 4 + +=item * + +C<LOG_AUDIT> - audit daemon (IRIX); falls back to C<LOG_AUTH> + +=item * + +C<LOG_AUTH> - security/authorization messages + +=item * + +C<LOG_AUTHPRIV> - security/authorization messages (private) + +=item * + +C<LOG_CONSOLE> - C</dev/console> output (FreeBSD); falls back to C<LOG_USER> + +=item * + +C<LOG_CRON> - clock daemons (B<cron> and B<at>) + +=item * + +C<LOG_DAEMON> - system daemons without separate facility value + +=item * + +C<LOG_FTP> - FTP daemon + +=item * + +C<LOG_KERN> - kernel messages + +=item * + +C<LOG_INSTALL> - installer subsystem (Mac OS X); falls back to C<LOG_USER> + +=item * + +C<LOG_LAUNCHD> - launchd - general bootstrap daemon (Mac OS X); +falls back to C<LOG_DAEMON> + +=item * + +C<LOG_LFMT> - logalert facility; falls back to C<LOG_USER> + +=item * + +C<LOG_LOCAL0> through C<LOG_LOCAL7> - reserved for local use + +=item * + +C<LOG_LPR> - line printer subsystem + +=item * + +C<LOG_MAIL> - mail subsystem + +=item * + +C<LOG_NETINFO> - NetInfo subsystem (Mac OS X); falls back to C<LOG_DAEMON> + +=item * + +C<LOG_NEWS> - USENET news subsystem + +=item * + +C<LOG_NTP> - NTP subsystem (FreeBSD, NetBSD); falls back to C<LOG_DAEMON> + +=item * + +C<LOG_RAS> - Remote Access Service (VPN / PPP) (Mac OS X); +falls back to C<LOG_AUTH> + +=item * + +C<LOG_REMOTEAUTH> - remote authentication/authorization (Mac OS X); +falls back to C<LOG_AUTH> + +=item * + +C<LOG_SECURITY> - security subsystems (firewalling, etc.) (FreeBSD); +falls back to C<LOG_AUTH> + +=item * + +C<LOG_SYSLOG> - messages generated internally by B<syslogd> + +=item * + +C<LOG_USER> (default) - generic user-level messages + +=item * + +C<LOG_UUCP> - UUCP subsystem + +=back + + +=head2 Levels + +=over 4 + +=item * + +C<LOG_EMERG> - system is unusable + +=item * + +C<LOG_ALERT> - action must be taken immediately + +=item * + +C<LOG_CRIT> - critical conditions + +=item * + +C<LOG_ERR> - error conditions + +=item * + +C<LOG_WARNING> - warning conditions + +=item * + +C<LOG_NOTICE> - normal, but significant, condition + +=item * + +C<LOG_INFO> - informational message + +=item * + +C<LOG_DEBUG> - debug-level message + +=back + + +=head1 DIAGNOSTICS + +=over + +=item C<Invalid argument passed to setlogsock> + +B<(F)> You gave C<setlogsock()> an invalid value for C<$sock_type>. + +=item C<eventlog passed to setlogsock, but no Win32 API available> + +B<(W)> You asked C<setlogsock()> to use the Win32 event logger but the +operating system running the program isn't Win32 or does not provides Win32 +compatible facilities. + +=item C<no connection to syslog available> + +B<(F)> C<syslog()> failed to connect to the specified socket. + +=item C<stream passed to setlogsock, but %s is not writable> + +B<(W)> You asked C<setlogsock()> to use a stream socket, but the given +path is not writable. + +=item C<stream passed to setlogsock, but could not find any device> + +B<(W)> You asked C<setlogsock()> to use a stream socket, but didn't +provide a path, and C<Sys::Syslog> was unable to find an appropriate one. + +=item C<tcp passed to setlogsock, but tcp service unavailable> + +B<(W)> You asked C<setlogsock()> to use a TCP socket, but the service +is not available on the system. + +=item C<syslog: expecting argument %s> + +B<(F)> You forgot to give C<syslog()> the indicated argument. + +=item C<syslog: invalid level/facility: %s> + +B<(F)> You specified an invalid level or facility. + +=item C<syslog: too many levels given: %s> + +B<(F)> You specified too many levels. + +=item C<syslog: too many facilities given: %s> + +B<(F)> You specified too many facilities. + +=item C<syslog: level must be given> + +B<(F)> You forgot to specify a level. + +=item C<udp passed to setlogsock, but udp service unavailable> + +B<(W)> You asked C<setlogsock()> to use a UDP socket, but the service +is not available on the system. + +=item C<unix passed to setlogsock, but path not available> + +B<(W)> You asked C<setlogsock()> to use a UNIX socket, but C<Sys::Syslog> +was unable to find an appropriate an appropriate device. + +=back + + +=head1 SEE ALSO + +=head2 Manual Pages + +L<syslog(3)> + +SUSv3 issue 6, IEEE Std 1003.1, 2004 edition, +L<http://www.opengroup.org/onlinepubs/000095399/basedefs/syslog.h.html> + +GNU C Library documentation on syslog, +L<http://www.gnu.org/software/libc/manual/html_node/Syslog.html> + +Solaris 10 documentation on syslog, +L<http://docs.sun.com/app/docs/doc/816-5168/syslog-3c?a=view> + +Mac OS X documentation on syslog, +L<http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/syslog.3.html> + +IRIX 6.5 documentation on syslog, +L<http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0650&db=man&fname=3c+syslog> + +AIX 5L 5.3 documentation on syslog, +L<http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf2/syslog.htm> + +HP-UX 11i documentation on syslog, +L<http://docs.hp.com/en/B2355-60130/syslog.3C.html> + +Tru64 5.1 documentation on syslog, +L<http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51_HTML/MAN/MAN3/0193____.HTM> + +Stratus VOS 15.1, +L<http://stratadoc.stratus.com/vos/15.1.1/r502-01/wwhelp/wwhimpl/js/html/wwhelp.htm?context=r502-01&file=ch5r502-01bi.html> + +=head2 RFCs + +I<RFC 3164 - The BSD syslog Protocol>, L<http://www.faqs.org/rfcs/rfc3164.html> +-- Please note that this is an informational RFC, and therefore does not +specify a standard of any kind. + +I<RFC 3195 - Reliable Delivery for syslog>, L<http://www.faqs.org/rfcs/rfc3195.html> + +=head2 Articles + +I<Syslogging with Perl>, L<http://lexington.pm.org/meetings/022001.html> + +=head2 Event Log + +Windows Event Log, +L<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wes/wes/windows_event_log.asp> + + +=head1 AUTHORS & ACKNOWLEDGEMENTS + +Tom Christiansen E<lt>F<tchrist (at) perl.com>E<gt> and Larry Wall +E<lt>F<larry (at) wall.org>E<gt>. + +UNIX domain sockets added by Sean Robinson +E<lt>F<robinson_s (at) sc.maricopa.edu>E<gt> with support from Tim Bunce +E<lt>F<Tim.Bunce (at) ig.co.uk>E<gt> and the C<perl5-porters> mailing list. + +Dependency on F<syslog.ph> replaced with XS code by Tom Hughes +E<lt>F<tom (at) compton.nu>E<gt>. + +Code for C<constant()>s regenerated by Nicholas Clark E<lt>F<nick (at) ccl4.org>E<gt>. + +Failover to different communication modes by Nick Williams +E<lt>F<Nick.Williams (at) morganstanley.com>E<gt>. + +Extracted from core distribution for publishing on the CPAN by +SE<eacute>bastien Aperghis-Tramoni E<lt>sebastien (at) aperghis.netE<gt>. + +XS code for using native C functions borrowed from C<L<Unix::Syslog>>, +written by Marcus Harnisch E<lt>F<marcus.harnisch (at) gmx.net>E<gt>. + +Yves Orton suggested and helped for making C<Sys::Syslog> use the native +event logger under Win32 systems. + +Jerry D. Hedden and Reini Urban provided greatly appreciated help to +debug and polish C<Sys::Syslog> under Cygwin. + + +=head1 BUGS + +Please report any bugs or feature requests to +C<bug-sys-syslog (at) rt.cpan.org>, or through the web interface at +L<http://rt.cpan.org/Public/Dist/Display.html?Name=Sys-Syslog>. +I will be notified, and then you'll automatically be notified of progress on +your bug as I make changes. + + +=head1 SUPPORT + +You can find documentation for this module with the perldoc command. + + perldoc Sys::Syslog + +You can also look for information at: + +=over 4 + +=item * AnnoCPAN: Annotated CPAN documentation + +L<http://annocpan.org/dist/Sys-Syslog> + +=item * CPAN Ratings + +L<http://cpanratings.perl.org/d/Sys-Syslog> + +=item * RT: CPAN's request tracker + +L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Sys-Syslog> + +=item * Search CPAN + +L<http://search.cpan.org/dist/Sys-Syslog/> + +=item * Kobes' CPAN Search + +L<http://cpan.uwinnipeg.ca/dist/Sys-Syslog> + +=item * Perl Documentation + +L<http://perldoc.perl.org/Sys/Syslog.html> + +=back + + +=head1 COPYRIGHT + +Copyright (C) 1990-2008 by Larry Wall and others. + + +=head1 LICENSE + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +=cut + +=begin comment + +Notes for the future maintainer (even if it's still me..) +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +Using Google Code Search, I search who on Earth was relying on $host being +public. It found 5 hits: + +* First was inside Indigo Star Perl2exe documentation. Just an old version +of Sys::Syslog. + + +* One real hit was inside DalWeathDB, a weather related program. It simply +does a + + $Sys::Syslog::host = '127.0.0.1'; + +- L<http://www.gallistel.net/nparker/weather/code/> + + +* Two hits were in TPC, a fax server thingy. It does a + + $Sys::Syslog::host = $TPC::LOGHOST; + +but also has this strange piece of code: + + # work around perl5.003 bug + sub Sys::Syslog::hostname {} + +I don't know what bug the author referred to. + +- L<http://www.tpc.int/> +- L<ftp://ftp.tpc.int/tpc/server/UNIX/> +- L<ftp://ftp-usa.tpc.int/pub/tpc/server/UNIX/> + + +* Last hit was in Filefix, which seems to be a FIDOnet mail program (!). +This one does not use $host, but has the following piece of code: + + sub Sys::Syslog::hostname + { + use Sys::Hostname; + return hostname; + } + +I guess this was a more elaborate form of the previous bit, maybe because +of a bug in Sys::Syslog back then? + +- L<ftp://ftp.kiae.su/pub/unix/fido/> + + +Links +----- +Linux Fast-STREAMS +- L<http://www.openss7.org/streams.html> + +II12021: SYSLOGD HOWTO TCPIPINFO (z/OS, OS/390, MVS) +- L<http://www-1.ibm.com/support/docview.wss?uid=isg1II12021> + +Getting the most out of the Event Viewer +- L<http://www.codeproject.com/dotnet/evtvwr.asp?print=true> + +Log events to the Windows NT Event Log with JNI +- L<http://www.javaworld.com/javaworld/jw-09-2001/jw-0928-ntmessages.html> + +=end comment + diff --git a/cpan/Sys-Syslog/Syslog.xs b/cpan/Sys-Syslog/Syslog.xs new file mode 100644 index 0000000000..704ed9e778 --- /dev/null +++ b/cpan/Sys-Syslog/Syslog.xs @@ -0,0 +1,171 @@ +#if defined(_WIN32) +# include <windows.h> +#endif + +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" +#ifdef USE_PPPORT_H +# include "ppport.h" +#endif + +#ifndef HAVE_SYSLOG +#define HAVE_SYSLOG 1 +#endif + +#if defined(_WIN32) && !defined(__CYGWIN__) +# undef HAVE_SYSLOG +# include "fallback/syslog.h" +#else +# if defined(I_SYSLOG) || PATCHLEVEL < 6 +# include <syslog.h> +# endif +#endif + +static SV *ident_svptr; + +#include "const-c.inc" + +MODULE = Sys::Syslog PACKAGE = Sys::Syslog + +INCLUDE: const-xs.inc + +int +LOG_FAC(p) + INPUT: + int p + CODE: +#ifdef LOG_FAC + RETVAL = LOG_FAC(p); +#else + croak("Your vendor has not defined the Sys::Syslog macro LOG_FAC"); + RETVAL = -1; +#endif + OUTPUT: + RETVAL + +int +LOG_PRI(p) + INPUT: + int p + CODE: +#ifdef LOG_PRI + RETVAL = LOG_PRI(p); +#else + croak("Your vendor has not defined the Sys::Syslog macro LOG_PRI"); + RETVAL = -1; +#endif + OUTPUT: + RETVAL + +int +LOG_MAKEPRI(fac,pri) + INPUT: + int fac + int pri + CODE: +#ifdef LOG_MAKEPRI + RETVAL = LOG_MAKEPRI(fac,pri); +#else + croak("Your vendor has not defined the Sys::Syslog macro LOG_MAKEPRI"); + RETVAL = -1; +#endif + OUTPUT: + RETVAL + +int +LOG_MASK(pri) + INPUT: + int pri + CODE: +#ifdef LOG_MASK + RETVAL = LOG_MASK(pri); +#else + croak("Your vendor has not defined the Sys::Syslog macro LOG_MASK"); + RETVAL = -1; +#endif + OUTPUT: + RETVAL + +int +LOG_UPTO(pri) + INPUT: + int pri + CODE: +#ifdef LOG_UPTO + RETVAL = LOG_UPTO(pri); +#else + croak("Your vendor has not defined the Sys::Syslog macro LOG_UPTO"); + RETVAL = -1; +#endif + OUTPUT: + RETVAL + +#ifdef HAVE_SYSLOG + +void +openlog_xs(ident, option, facility) + INPUT: + SV* ident + int option + int facility + PREINIT: + STRLEN len; + char* ident_pv; + CODE: + ident_svptr = newSVsv(ident); + ident_pv = SvPV(ident_svptr, len); + openlog(ident_pv, option, facility); + +void +syslog_xs(priority, message) + INPUT: + int priority + const char * message + CODE: + syslog(priority, "%s", message); + +int +setlogmask_xs(mask) + INPUT: + int mask + CODE: + RETVAL = setlogmask(mask); + OUTPUT: + RETVAL + +void +closelog_xs() + CODE: + closelog(); + if (SvREFCNT(ident_svptr)) + SvREFCNT_dec(ident_svptr); + +#else /* HAVE_SYSLOG */ + +void +openlog_xs(ident, option, facility) + INPUT: + SV* ident + int option + int facility + CODE: + +void +syslog_xs(priority, message) + INPUT: + int priority + const char * message + CODE: + +int +setlogmask_xs(mask) + INPUT: + int mask + CODE: + +void +closelog_xs() + CODE: + +#endif /* HAVE_SYSLOG */ diff --git a/cpan/Sys-Syslog/fallback/const-c.inc b/cpan/Sys-Syslog/fallback/const-c.inc new file mode 100644 index 0000000000..8fb8cb6b98 --- /dev/null +++ b/cpan/Sys-Syslog/fallback/const-c.inc @@ -0,0 +1,689 @@ +#define PERL_constant_NOTFOUND 1 +#define PERL_constant_NOTDEF 2 +#define PERL_constant_ISIV 3 +#define PERL_constant_ISNO 4 +#define PERL_constant_ISNV 5 +#define PERL_constant_ISPV 6 +#define PERL_constant_ISPVN 7 +#define PERL_constant_ISSV 8 +#define PERL_constant_ISUNDEF 9 +#define PERL_constant_ISUV 10 +#define PERL_constant_ISYES 11 + +#ifndef NVTYPE +typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */ +#endif +#ifndef aTHX_ +#define aTHX_ /* 5.6 or later define this for threading support. */ +#endif +#ifndef pTHX_ +#define pTHX_ /* 5.6 or later define this for threading support. */ +#endif + +static int +constant_7 (pTHX_ const char *name, IV *iv_return) { + /* When generated this function returned values for the list of names given + here. However, subsequent manual editing may have added or removed some. + LOG_ERR LOG_FTP LOG_LPR LOG_NTP LOG_PID LOG_RAS */ + /* Offset 4 gives the best switch position. */ + switch (name[4]) { + case 'E': + if (memEQ(name, "LOG_ERR", 7)) { + /* ^ */ +#ifdef LOG_ERR + *iv_return = LOG_ERR; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'F': + if (memEQ(name, "LOG_FTP", 7)) { + /* ^ */ +#ifdef LOG_FTP + *iv_return = LOG_FTP; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'L': + if (memEQ(name, "LOG_LPR", 7)) { + /* ^ */ +#ifdef LOG_LPR + *iv_return = LOG_LPR; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'N': + if (memEQ(name, "LOG_NTP", 7)) { + /* ^ */ +#ifdef LOG_NTP + *iv_return = LOG_NTP; + return PERL_constant_ISIV; +#else + *iv_return = LOG_DAEMON; + return PERL_constant_ISIV; +#endif + } + break; + case 'P': + if (memEQ(name, "LOG_PID", 7)) { + /* ^ */ +#ifdef LOG_PID + *iv_return = LOG_PID; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'R': + if (memEQ(name, "LOG_RAS", 7)) { + /* ^ */ +#ifdef LOG_RAS + *iv_return = LOG_RAS; + return PERL_constant_ISIV; +#else + *iv_return = LOG_AUTH; + return PERL_constant_ISIV; +#endif + } + break; + } + return PERL_constant_NOTFOUND; +} + +static int +constant_8 (pTHX_ const char *name, IV *iv_return) { + /* When generated this function returned values for the list of names given + here. However, subsequent manual editing may have added or removed some. + LOG_AUTH LOG_CONS LOG_CRIT LOG_CRON LOG_INFO LOG_KERN LOG_LFMT LOG_MAIL + LOG_NEWS LOG_USER LOG_UUCP */ + /* Offset 6 gives the best switch position. */ + switch (name[6]) { + case 'C': + if (memEQ(name, "LOG_UUCP", 8)) { + /* ^ */ +#ifdef LOG_UUCP + *iv_return = LOG_UUCP; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'E': + if (memEQ(name, "LOG_USER", 8)) { + /* ^ */ +#ifdef LOG_USER + *iv_return = LOG_USER; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'F': + if (memEQ(name, "LOG_INFO", 8)) { + /* ^ */ +#ifdef LOG_INFO + *iv_return = LOG_INFO; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'I': + if (memEQ(name, "LOG_CRIT", 8)) { + /* ^ */ +#ifdef LOG_CRIT + *iv_return = LOG_CRIT; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + if (memEQ(name, "LOG_MAIL", 8)) { + /* ^ */ +#ifdef LOG_MAIL + *iv_return = LOG_MAIL; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'M': + if (memEQ(name, "LOG_LFMT", 8)) { + /* ^ */ +#ifdef LOG_LFMT + *iv_return = LOG_LFMT; + return PERL_constant_ISIV; +#else + *iv_return = LOG_USER; + return PERL_constant_ISIV; +#endif + } + break; + case 'N': + if (memEQ(name, "LOG_CONS", 8)) { + /* ^ */ +#ifdef LOG_CONS + *iv_return = LOG_CONS; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'O': + if (memEQ(name, "LOG_CRON", 8)) { + /* ^ */ +#ifdef LOG_CRON + *iv_return = LOG_CRON; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'R': + if (memEQ(name, "LOG_KERN", 8)) { + /* ^ */ +#ifdef LOG_KERN + *iv_return = LOG_KERN; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'T': + if (memEQ(name, "LOG_AUTH", 8)) { + /* ^ */ +#ifdef LOG_AUTH + *iv_return = LOG_AUTH; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'W': + if (memEQ(name, "LOG_NEWS", 8)) { + /* ^ */ +#ifdef LOG_NEWS + *iv_return = LOG_NEWS; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + } + return PERL_constant_NOTFOUND; +} + +static int +constant_9 (pTHX_ const char *name, IV *iv_return, const char **pv_return) { + /* When generated this function returned values for the list of names given + here. However, subsequent manual editing may have added or removed some. + LOG_ALERT LOG_AUDIT LOG_DEBUG LOG_EMERG _PATH_LOG */ + /* Offset 5 gives the best switch position. */ + switch (name[5]) { + case 'E': + if (memEQ(name, "LOG_DEBUG", 9)) { + /* ^ */ +#ifdef LOG_DEBUG + *iv_return = LOG_DEBUG; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'L': + if (memEQ(name, "LOG_ALERT", 9)) { + /* ^ */ +#ifdef LOG_ALERT + *iv_return = LOG_ALERT; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'M': + if (memEQ(name, "LOG_EMERG", 9)) { + /* ^ */ +#ifdef LOG_EMERG + *iv_return = LOG_EMERG; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'U': + if (memEQ(name, "LOG_AUDIT", 9)) { + /* ^ */ +#ifdef LOG_AUDIT + *iv_return = LOG_AUDIT; + return PERL_constant_ISIV; +#else + *iv_return = LOG_AUTH; + return PERL_constant_ISIV; +#endif + } + break; + case '_': + if (memEQ(name, "_PATH_LOG", 9)) { + /* ^ */ +#ifdef _PATH_LOG + *pv_return = _PATH_LOG; + return PERL_constant_ISPV; +#else + *pv_return = "/var/run/syslog"; + return PERL_constant_ISPV; +#endif + } + break; + } + return PERL_constant_NOTFOUND; +} + +static int +constant_10 (pTHX_ const char *name, IV *iv_return) { + /* When generated this function returned values for the list of names given + here. However, subsequent manual editing may have added or removed some. + LOG_DAEMON LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 + LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_NDELAY LOG_NOTICE LOG_NOWAIT + LOG_ODELAY LOG_PERROR LOG_SYSLOG */ + /* Offset 9 gives the best switch position. */ + switch (name[9]) { + case '0': + if (memEQ(name, "LOG_LOCAL", 9)) { + /* 0 */ +#ifdef LOG_LOCAL0 + *iv_return = LOG_LOCAL0; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case '1': + if (memEQ(name, "LOG_LOCAL", 9)) { + /* 1 */ +#ifdef LOG_LOCAL1 + *iv_return = LOG_LOCAL1; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case '2': + if (memEQ(name, "LOG_LOCAL", 9)) { + /* 2 */ +#ifdef LOG_LOCAL2 + *iv_return = LOG_LOCAL2; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case '3': + if (memEQ(name, "LOG_LOCAL", 9)) { + /* 3 */ +#ifdef LOG_LOCAL3 + *iv_return = LOG_LOCAL3; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case '4': + if (memEQ(name, "LOG_LOCAL", 9)) { + /* 4 */ +#ifdef LOG_LOCAL4 + *iv_return = LOG_LOCAL4; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case '5': + if (memEQ(name, "LOG_LOCAL", 9)) { + /* 5 */ +#ifdef LOG_LOCAL5 + *iv_return = LOG_LOCAL5; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case '6': + if (memEQ(name, "LOG_LOCAL", 9)) { + /* 6 */ +#ifdef LOG_LOCAL6 + *iv_return = LOG_LOCAL6; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case '7': + if (memEQ(name, "LOG_LOCAL", 9)) { + /* 7 */ +#ifdef LOG_LOCAL7 + *iv_return = LOG_LOCAL7; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'E': + if (memEQ(name, "LOG_NOTIC", 9)) { + /* E */ +#ifdef LOG_NOTICE + *iv_return = LOG_NOTICE; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'G': + if (memEQ(name, "LOG_SYSLO", 9)) { + /* G */ +#ifdef LOG_SYSLOG + *iv_return = LOG_SYSLOG; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'N': + if (memEQ(name, "LOG_DAEMO", 9)) { + /* N */ +#ifdef LOG_DAEMON + *iv_return = LOG_DAEMON; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'R': + if (memEQ(name, "LOG_PERRO", 9)) { + /* R */ +#ifdef LOG_PERROR + *iv_return = LOG_PERROR; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'T': + if (memEQ(name, "LOG_NOWAI", 9)) { + /* T */ +#ifdef LOG_NOWAIT + *iv_return = LOG_NOWAIT; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'Y': + if (memEQ(name, "LOG_NDELA", 9)) { + /* Y */ +#ifdef LOG_NDELAY + *iv_return = LOG_NDELAY; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + if (memEQ(name, "LOG_ODELA", 9)) { + /* Y */ +#ifdef LOG_ODELAY + *iv_return = LOG_ODELAY; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + } + return PERL_constant_NOTFOUND; +} + +static int +constant_11 (pTHX_ const char *name, IV *iv_return) { + /* When generated this function returned values for the list of names given + here. However, subsequent manual editing may have added or removed some. + LOG_CONSOLE LOG_FACMASK LOG_INSTALL LOG_LAUNCHD LOG_NETINFO LOG_PRIMASK + LOG_WARNING */ + /* Offset 6 gives the best switch position. */ + switch (name[6]) { + case 'C': + if (memEQ(name, "LOG_FACMASK", 11)) { + /* ^ */ +#ifdef LOG_FACMASK + *iv_return = LOG_FACMASK; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'I': + if (memEQ(name, "LOG_PRIMASK", 11)) { + /* ^ */ +#ifdef LOG_PRIMASK + *iv_return = LOG_PRIMASK; + return PERL_constant_ISIV; +#else + *iv_return = 7; + return PERL_constant_ISIV; +#endif + } + break; + case 'N': + if (memEQ(name, "LOG_CONSOLE", 11)) { + /* ^ */ +#ifdef LOG_CONSOLE + *iv_return = LOG_CONSOLE; + return PERL_constant_ISIV; +#else + *iv_return = LOG_USER; + return PERL_constant_ISIV; +#endif + } + break; + case 'R': + if (memEQ(name, "LOG_WARNING", 11)) { + /* ^ */ +#ifdef LOG_WARNING + *iv_return = LOG_WARNING; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'S': + if (memEQ(name, "LOG_INSTALL", 11)) { + /* ^ */ +#ifdef LOG_INSTALL + *iv_return = LOG_INSTALL; + return PERL_constant_ISIV; +#else + *iv_return = LOG_USER; + return PERL_constant_ISIV; +#endif + } + break; + case 'T': + if (memEQ(name, "LOG_NETINFO", 11)) { + /* ^ */ +#ifdef LOG_NETINFO + *iv_return = LOG_NETINFO; + return PERL_constant_ISIV; +#else + *iv_return = LOG_DAEMON; + return PERL_constant_ISIV; +#endif + } + break; + case 'U': + if (memEQ(name, "LOG_LAUNCHD", 11)) { + /* ^ */ +#ifdef LOG_LAUNCHD + *iv_return = LOG_LAUNCHD; + return PERL_constant_ISIV; +#else + *iv_return = LOG_DAEMON; + return PERL_constant_ISIV; +#endif + } + break; + } + return PERL_constant_NOTFOUND; +} + +static int +constant (pTHX_ const char *name, STRLEN len, IV *iv_return, const char **pv_return) { + /* Initially switch on the length of the name. */ + /* When generated this function returned values for the list of names given + in this section of perl code. Rather than manually editing these functions + to add or remove constants, which would result in this comment and section + of code becoming inaccurate, we recommend that you edit this section of + code, and use it to regenerate a new set of constant functions which you + then use to replace the originals. + + Regenerate these constant functions by feeding this entire source file to + perl -x + +#!perl -w +use ExtUtils::Constant qw (constant_types C_constant XS_constant); + +my $types = {map {($_, 1)} qw(IV PV)}; +my @names = (qw(LOG_ALERT LOG_AUTH LOG_AUTHPRIV LOG_CONS LOG_CRIT LOG_CRON + LOG_DAEMON LOG_DEBUG LOG_EMERG LOG_ERR LOG_FACMASK LOG_FTP + LOG_INFO LOG_KERN LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 + LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_LPR LOG_MAIL + LOG_NDELAY LOG_NEWS LOG_NOTICE LOG_NOWAIT LOG_ODELAY LOG_PERROR + LOG_PID LOG_SYSLOG LOG_USER LOG_UUCP LOG_WARNING), + {name=>"LOG_AUDIT", type=>"IV", default=>["IV", "LOG_AUTH"]}, + {name=>"LOG_CONSOLE", type=>"IV", default=>["IV", "LOG_USER"]}, + {name=>"LOG_INSTALL", type=>"IV", default=>["IV", "LOG_USER"]}, + {name=>"LOG_LAUNCHD", type=>"IV", default=>["IV", "LOG_DAEMON"]}, + {name=>"LOG_LFMT", type=>"IV", default=>["IV", "LOG_USER"]}, + {name=>"LOG_NETINFO", type=>"IV", default=>["IV", "LOG_DAEMON"]}, + {name=>"LOG_NFACILITIES", type=>"IV", default=>["IV", "30"]}, + {name=>"LOG_NTP", type=>"IV", default=>["IV", "LOG_DAEMON"]}, + {name=>"LOG_PRIMASK", type=>"IV", default=>["IV", "7"]}, + {name=>"LOG_RAS", type=>"IV", default=>["IV", "LOG_AUTH"]}, + {name=>"LOG_REMOTEAUTH", type=>"IV", default=>["IV", "LOG_AUTH"]}, + {name=>"LOG_SECURITY", type=>"IV", default=>["IV", "LOG_AUTH"]}, + {name=>"_PATH_LOG", type=>"PV", default=>["PV", "\"/var/run/syslog\""]}); + +print constant_types(); # macro defs +foreach (C_constant ("Sys::Syslog", 'constant', 'IV', $types, undef, 3, @names) ) { + print $_, "\n"; # C constant subs +} +print "#### XS Section:\n"; +print XS_constant ("Sys::Syslog", $types); +__END__ + */ + + switch (len) { + case 7: + return constant_7 (aTHX_ name, iv_return); + break; + case 8: + return constant_8 (aTHX_ name, iv_return); + break; + case 9: + return constant_9 (aTHX_ name, iv_return, pv_return); + break; + case 10: + return constant_10 (aTHX_ name, iv_return); + break; + case 11: + return constant_11 (aTHX_ name, iv_return); + break; + case 12: + /* Names all of length 12. */ + /* LOG_AUTHPRIV LOG_SECURITY */ + /* Offset 8 gives the best switch position. */ + switch (name[8]) { + case 'P': + if (memEQ(name, "LOG_AUTHPRIV", 12)) { + /* ^ */ +#ifdef LOG_AUTHPRIV + *iv_return = LOG_AUTHPRIV; + return PERL_constant_ISIV; +#else + return PERL_constant_NOTDEF; +#endif + } + break; + case 'R': + if (memEQ(name, "LOG_SECURITY", 12)) { + /* ^ */ +#ifdef LOG_SECURITY + *iv_return = LOG_SECURITY; + return PERL_constant_ISIV; +#else + *iv_return = LOG_AUTH; + return PERL_constant_ISIV; +#endif + } + break; + } + break; + case 14: + if (memEQ(name, "LOG_REMOTEAUTH", 14)) { +#ifdef LOG_REMOTEAUTH + *iv_return = LOG_REMOTEAUTH; + return PERL_constant_ISIV; +#else + *iv_return = LOG_AUTH; + return PERL_constant_ISIV; +#endif + } + break; + case 15: + if (memEQ(name, "LOG_NFACILITIES", 15)) { +#ifdef LOG_NFACILITIES + *iv_return = LOG_NFACILITIES; + return PERL_constant_ISIV; +#else + *iv_return = 30; + return PERL_constant_ISIV; +#endif + } + break; + } + return PERL_constant_NOTFOUND; +} + diff --git a/cpan/Sys-Syslog/fallback/const-xs.inc b/cpan/Sys-Syslog/fallback/const-xs.inc new file mode 100644 index 0000000000..4da6b66805 --- /dev/null +++ b/cpan/Sys-Syslog/fallback/const-xs.inc @@ -0,0 +1,87 @@ +void +constant(sv) + PREINIT: +#ifdef dXSTARG + dXSTARG; /* Faster if we have it. */ +#else + dTARGET; +#endif + STRLEN len; + int type; + IV iv; + /* NV nv; Uncomment this if you need to return NVs */ + const char *pv; + INPUT: + SV * sv; + const char * s = SvPV(sv, len); + PPCODE: + /* Change this to constant(aTHX_ s, len, &iv, &nv); + if you need to return both NVs and IVs */ + type = constant(aTHX_ s, len, &iv, &pv); + /* Return 1 or 2 items. First is error message, or undef if no error. + Second, if present, is found value */ + switch (type) { + case PERL_constant_NOTFOUND: + sv = sv_2mortal(newSVpvf("%s is not a valid Sys::Syslog macro", s)); + PUSHs(sv); + break; + case PERL_constant_NOTDEF: + sv = sv_2mortal(newSVpvf( + "Your vendor has not defined Sys::Syslog macro %s, used", s)); + PUSHs(sv); + break; + case PERL_constant_ISIV: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHi(iv); + break; + /* Uncomment this if you need to return NOs + case PERL_constant_ISNO: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHs(&PL_sv_no); + break; */ + /* Uncomment this if you need to return NVs + case PERL_constant_ISNV: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHn(nv); + break; */ + case PERL_constant_ISPV: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHp(pv, strlen(pv)); + break; + /* Uncomment this if you need to return PVNs + case PERL_constant_ISPVN: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHp(pv, iv); + break; */ + /* Uncomment this if you need to return SVs + case PERL_constant_ISSV: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHs(sv); + break; */ + /* Uncomment this if you need to return UNDEFs + case PERL_constant_ISUNDEF: + break; */ + /* Uncomment this if you need to return UVs + case PERL_constant_ISUV: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHu((UV)iv); + break; */ + /* Uncomment this if you need to return YESs + case PERL_constant_ISYES: + EXTEND(SP, 1); + PUSHs(&PL_sv_undef); + PUSHs(&PL_sv_yes); + break; */ + default: + sv = sv_2mortal(newSVpvf( + "Unexpected return type %d while processing Sys::Syslog macro %s, used", + type, s)); + PUSHs(sv); + } diff --git a/cpan/Sys-Syslog/fallback/syslog.h b/cpan/Sys-Syslog/fallback/syslog.h new file mode 100644 index 0000000000..ac20dabbcc --- /dev/null +++ b/cpan/Sys-Syslog/fallback/syslog.h @@ -0,0 +1,111 @@ +/* + * Copyright (c) 1982, 1986, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)syslog.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _SYS_SYSLOG_H +#define _SYS_SYSLOG_H 1 + +#define _PATH_LOG "" + +/* + * priorities/facilities are encoded into a single 32-bit quantity, where the + * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility + * (0-big number). Both the priorities and the facilities map roughly + * one-to-one to strings in the syslogd(8) source code. This mapping is + * included in this file. + * + * priorities (these are ordered) + */ +#define LOG_EMERG 0 /* system is unusable */ +#define LOG_ALERT 1 /* action must be taken immediately */ +#define LOG_CRIT 2 /* critical conditions */ +#define LOG_ERR 3 /* error conditions */ +#define LOG_WARNING 4 /* warning conditions */ +#define LOG_NOTICE 5 /* normal but significant condition */ +#define LOG_INFO 6 /* informational */ +#define LOG_DEBUG 7 /* debug-level messages */ + +#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ + /* extract priority */ +#define LOG_PRI(p) ((p) & LOG_PRIMASK) +#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) + +/* facility codes */ +#define LOG_KERN (0<<3) /* kernel messages */ +#define LOG_USER (1<<3) /* random user-level messages */ +#define LOG_MAIL (2<<3) /* mail system */ +#define LOG_DAEMON (3<<3) /* system daemons */ +#define LOG_AUTH (4<<3) /* security/authorization messages */ +#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ +#define LOG_LPR (6<<3) /* line printer subsystem */ +#define LOG_NEWS (7<<3) /* network news subsystem */ +#define LOG_UUCP (8<<3) /* UUCP subsystem */ +#define LOG_CRON (9<<3) /* clock daemon */ +#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ +#define LOG_FTP (11<<3) /* ftp daemon */ +#define LOG_NETINFO (12<<3) /* NetInfo */ +#define LOG_REMOTEAUTH (13<<3) /* remote authentication/authorization */ +#define LOG_INSTALL (14<<3) /* installer subsystem */ +#define LOG_RAS (15<<3) /* Remote Access Service (VPN / PPP) */ +#define LOG_LOCAL0 (16<<3) /* reserved for local use */ +#define LOG_LOCAL1 (17<<3) /* reserved for local use */ +#define LOG_LOCAL2 (18<<3) /* reserved for local use */ +#define LOG_LOCAL3 (19<<3) /* reserved for local use */ +#define LOG_LOCAL4 (20<<3) /* reserved for local use */ +#define LOG_LOCAL5 (21<<3) /* reserved for local use */ +#define LOG_LOCAL6 (22<<3) /* reserved for local use */ +#define LOG_LOCAL7 (23<<3) /* reserved for local use */ +#define LOG_LAUNCHD (24<<3) /* launchd - general bootstrap daemon */ + +#define LOG_NFACILITIES 25 /* current number of facilities */ +#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ + /* facility of pri */ +#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) + +/* + * arguments to setlogmask. + */ +#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ +#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ + +/* + * Option flags for openlog. + * + * LOG_ODELAY no longer does anything. + * LOG_NDELAY is the inverse of what it used to be. + */ +#define LOG_PID 0x01 /* log the pid with each message */ +#define LOG_CONS 0x02 /* log on the console if errors in sending */ +#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ +#define LOG_NDELAY 0x08 /* don't delay open */ +#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ +#define LOG_PERROR 0x20 /* log to stderr as well */ + +#endif /* sys/syslog.h */ diff --git a/cpan/Sys-Syslog/t/00-load.t b/cpan/Sys-Syslog/t/00-load.t new file mode 100644 index 0000000000..bbf2289457 --- /dev/null +++ b/cpan/Sys-Syslog/t/00-load.t @@ -0,0 +1,8 @@ +#!perl -wT +use strict; +use Test::More tests => 1; + +use_ok( 'Sys::Syslog' ); + +diag( "Testing Sys::Syslog $Sys::Syslog::VERSION, Perl $], $^X" ) + unless $ENV{PERL_CORE}; diff --git a/cpan/Sys-Syslog/t/constants.t b/cpan/Sys-Syslog/t/constants.t new file mode 100644 index 0000000000..04fce81587 --- /dev/null +++ b/cpan/Sys-Syslog/t/constants.t @@ -0,0 +1,42 @@ +#!perl -wT +use strict; +use File::Spec; +use Test::More; + +# NB. For PERL_CORE to be set, taint mode must not be enabled +my $macrosall = $ENV{PERL_CORE} ? File::Spec->catfile(qw(.. ext Sys-Syslog macros.all)) + : 'macros.all'; +open(MACROS, $macrosall) or plan skip_all => "can't read '$macrosall': $!"; +my @names = map {chomp;$_} <MACROS>; +close(MACROS); +plan tests => @names * 2 + 2; + +my $callpack = my $testpack = 'Sys::Syslog'; +eval "use $callpack"; + +eval "${callpack}::This()"; +like( $@, "/^This is not a valid $testpack macro/", "trying a non-existing macro"); + +eval "${callpack}::NOSUCHNAME()"; +like( $@, "/^NOSUCHNAME is not a valid $testpack macro/", "trying a non-existing macro"); + +# Testing all macros +if(@names) { + for my $name (@names) { + SKIP: { + $name =~ /^(\w+)$/ or skip "invalid name '$name'", 2; + $name = $1; + my $v = eval "${callpack}::$name()"; + + if(defined $v and $v =~ /^\d+$/) { + is( $@, '', "calling the constant $name as a function" ); + like( $v, '/^\d+$/', "checking that $name is a number ($v)" ); + + } else { + like( $@, "/^Your vendor has not defined $testpack macro $name/", + "calling the constant via its name" ); + skip "irrelevant test in this case", 1 + } + } + } +} diff --git a/cpan/Sys-Syslog/t/syslog.t b/cpan/Sys-Syslog/t/syslog.t new file mode 100644 index 0000000000..0b7a9c42b3 --- /dev/null +++ b/cpan/Sys-Syslog/t/syslog.t @@ -0,0 +1,266 @@ +#!perl -T + +use strict; +use Config; +use File::Spec; +use Test::More; + +# we enable all Perl warnings, but we don't "use warnings 'all'" because +# we want to disable the warnings generated by Sys::Syslog +no warnings; +use warnings qw(closure deprecated exiting glob io misc numeric once overflow + pack portable recursion redefine regexp severe signal substr + syntax taint uninitialized unpack untie utf8 void); + +# if someone is using warnings::compat, the previous trick won't work, so we +# must manually disable warnings +$^W = 0 if $] < 5.006; + +my $is_Win32 = $^O =~ /win32/i; +my $is_Cygwin = $^O =~ /cygwin/i; + +# if testing in core, check that the module is at least available +if ($ENV{PERL_CORE}) { + plan skip_all => "Sys::Syslog was not build" + unless $Config{'extensions'} =~ /\bSyslog\b/; +} + +# we also need Socket +plan skip_all => "Socket was not build" + unless $Config{'extensions'} =~ /\bSocket\b/; + +my $tests; +plan tests => $tests; + +# any remaining warning should be severly punished +BEGIN { eval "use Test::NoWarnings"; $tests = $@ ? 0 : 1; } + +BEGIN { $tests += 1 } +# ok, now loads them +eval 'use Socket'; +use_ok('Sys::Syslog', ':standard', ':extended', ':macros'); + +BEGIN { $tests += 1 } +# check that the documented functions are correctly provided +can_ok( 'Sys::Syslog' => qw(openlog syslog syslog setlogmask setlogsock closelog) ); + + +BEGIN { $tests += 1 } +# check the diagnostics +# setlogsock() +eval { setlogsock() }; +like( $@, qr/^Invalid argument passed to setlogsock/, + "calling setlogsock() with no argument" ); + +BEGIN { $tests += 3 } +# syslog() +eval { syslog() }; +like( $@, qr/^syslog: expecting argument \$priority/, + "calling syslog() with no argument" ); + +eval { syslog(undef) }; +like( $@, qr/^syslog: expecting argument \$priority/, + "calling syslog() with one undef argument" ); + +eval { syslog('') }; +like( $@, qr/^syslog: expecting argument \$format/, + "calling syslog() with one empty argument" ); + + +my $test_string = "uid $< is testing Perl $] syslog(3) capabilities"; +my $r = 0; + +BEGIN { $tests += 8 } +# try to open a syslog using a Unix or stream socket +SKIP: { + skip "can't connect to Unix socket: _PATH_LOG unavailable", 8 + unless -e Sys::Syslog::_PATH_LOG(); + + # The only known $^O eq 'svr4' that needs this is NCR MP-RAS, + # but assuming 'stream' in SVR4 is probably not that bad. + my $sock_type = $^O =~ /^(solaris|irix|svr4|powerux)$/ ? 'stream' : 'unix'; + + eval { setlogsock($sock_type) }; + is( $@, '', "setlogsock() called with '$sock_type'" ); + TODO: { + local $TODO = "minor bug"; + ok( $r, "setlogsock() should return true: '$r'" ); + } + + # open syslog with a "local0" facility + SKIP: { + # openlog() + $r = eval { openlog('perl', 'ndelay', 'local0') } || 0; + skip "can't connect to syslog", 6 if $@ =~ /^no connection to syslog available/; + is( $@, '', "openlog() called with facility 'local0'" ); + ok( $r, "openlog() should return true: '$r'" ); + + # syslog() + $r = eval { syslog('info', "$test_string by connecting to a $sock_type socket") } || 0; + is( $@, '', "syslog() called with level 'info'" ); + ok( $r, "syslog() should return true: '$r'" ); + + # closelog() + $r = eval { closelog() } || 0; + is( $@, '', "closelog()" ); + ok( $r, "closelog() should return true: '$r'" ); + } +} + + +BEGIN { $tests += 22 * 8 } +# try to open a syslog using all the available connection methods +my @passed = (); +for my $sock_type (qw(native eventlog unix pipe stream inet tcp udp)) { + SKIP: { + skip "the 'stream' mechanism because a previous mechanism with similar interface succeeded", 22 + if $sock_type eq 'stream' and grep {/pipe|unix/} @passed; + + # setlogsock() called with an arrayref + $r = eval { setlogsock([$sock_type]) } || 0; + skip "can't use '$sock_type' socket", 22 unless $r; + is( $@, '', "[$sock_type] setlogsock() called with ['$sock_type']" ); + ok( $r, "[$sock_type] setlogsock() should return true: '$r'" ); + + # setlogsock() called with a single argument + $r = eval { setlogsock($sock_type) } || 0; + skip "can't use '$sock_type' socket", 20 unless $r; + is( $@, '', "[$sock_type] setlogsock() called with '$sock_type'" ); + ok( $r, "[$sock_type] setlogsock() should return true: '$r'" ); + + # openlog() without option NDELAY + $r = eval { openlog('perl', '', 'local0') } || 0; + skip "can't connect to syslog", 18 if $@ =~ /^no connection to syslog available/; + is( $@, '', "[$sock_type] openlog() called with facility 'local0' and without option 'ndelay'" ); + ok( $r, "[$sock_type] openlog() should return true: '$r'" ); + + # openlog() with the option NDELAY + $r = eval { openlog('perl', 'ndelay', 'local0') } || 0; + skip "can't connect to syslog", 16 if $@ =~ /^no connection to syslog available/; + is( $@, '', "[$sock_type] openlog() called with facility 'local0' with option 'ndelay'" ); + ok( $r, "[$sock_type] openlog() should return true: '$r'" ); + + # syslog() with negative level, should fail + $r = eval { syslog(-1, "$test_string by connecting to a $sock_type socket") } || 0; + like( $@, '/^syslog: invalid level\/facility: /', "[$sock_type] syslog() called with level -1" ); + ok( !$r, "[$sock_type] syslog() should return false: '$r'" ); + + # syslog() with invalid level, should fail + $r = eval { syslog("plonk", "$test_string by connecting to a $sock_type socket") } || 0; + like( $@, '/^syslog: invalid level\/facility: /', "[$sock_type] syslog() called with level plonk" ); + ok( !$r, "[$sock_type] syslog() should return false: '$r'" ); + + # syslog() with levels "info" and "notice" (as a strings), should fail + $r = eval { syslog('info,notice', "$test_string by connecting to a $sock_type socket") } || 0; + like( $@, '/^syslog: too many levels given: notice/', "[$sock_type] syslog() called with level 'info,notice'" ); + ok( !$r, "[$sock_type] syslog() should return false: '$r'" ); + + # syslog() with facilities "local0" and "local1" (as a strings), should fail + $r = eval { syslog('local0,local1', "$test_string by connecting to a $sock_type socket") } || 0; + like( $@, '/^syslog: too many facilities given: local1/', "[$sock_type] syslog() called with level 'local0,local1'" ); + ok( !$r, "[$sock_type] syslog() should return false: '$r'" ); + + # syslog() with level "info" (as a string), should pass + $r = eval { syslog('info', "$test_string by connecting to a $sock_type socket") } || 0; + is( $@, '', "[$sock_type] syslog() called with level 'info' (string)" ); + ok( $r, "[$sock_type] syslog() should return true: '$r'" ); + + # syslog() with level "info" (as a macro), should pass + { local $! = 1; + $r = eval { syslog(LOG_INFO(), "$test_string by connecting to a $sock_type socket, setting a fake errno: %m") } || 0; + } + is( $@, '', "[$sock_type] syslog() called with level 'info' (macro)" ); + ok( $r, "[$sock_type] syslog() should return true: '$r'" ); + + push @passed, $sock_type; + + SKIP: { + skip "skipping closelog() tests for 'console'", 2 if $sock_type eq 'console'; + # closelog() + $r = eval { closelog() } || 0; + is( $@, '', "[$sock_type] closelog()" ); + ok( $r, "[$sock_type] closelog() should return true: '$r'" ); + } + } +} + + +BEGIN { $tests += 10 } +SKIP: { + skip "not testing setlogsock('stream') on Win32", 10 if $is_Win32; + skip "the 'unix' mechanism works, so the tests will likely fail with the 'stream' mechanism", 10 + if grep {/unix/} @passed; + + skip "not testing setlogsock('stream'): _PATH_LOG unavailable", 10 + unless -e Sys::Syslog::_PATH_LOG(); + + # setlogsock() with "stream" and an undef path + $r = eval { setlogsock("stream", undef ) } || ''; + is( $@, '', "setlogsock() called, with 'stream' and an undef path" ); + if ($is_Cygwin) { + if (-x "/usr/sbin/syslog-ng") { + ok( $r, "setlogsock() on Cygwin with syslog-ng should return true: '$r'" ); + } + else { + ok( !$r, "setlogsock() on Cygwin without syslog-ng should return false: '$r'" ); + } + } + else { + ok( $r, "setlogsock() should return true: '$r'" ); + } + + # setlogsock() with "stream" and an empty path + $r = eval { setlogsock("stream", '' ) } || ''; + is( $@, '', "setlogsock() called, with 'stream' and an empty path" ); + ok( !$r, "setlogsock() should return false: '$r'" ); + + # setlogsock() with "stream" and /dev/null + $r = eval { setlogsock("stream", '/dev/null' ) } || ''; + is( $@, '', "setlogsock() called, with 'stream' and '/dev/null'" ); + ok( $r, "setlogsock() should return true: '$r'" ); + + # setlogsock() with "stream" and a non-existing file + $r = eval { setlogsock("stream", 'test.log' ) } || ''; + is( $@, '', "setlogsock() called, with 'stream' and 'test.log' (file does not exist)" ); + ok( !$r, "setlogsock() should return false: '$r'" ); + + # setlogsock() with "stream" and a local file + SKIP: { + my $logfile = "test.log"; + open(LOG, ">$logfile") or skip "can't create file '$logfile': $!", 2; + close(LOG); + $r = eval { setlogsock("stream", $logfile ) } || ''; + is( $@, '', "setlogsock() called, with 'stream' and '$logfile' (file exists)" ); + ok( $r, "setlogsock() should return true: '$r'" ); + unlink($logfile); + } +} + + +BEGIN { $tests += 3 + 4 * 3 } +# setlogmask() +{ + my $oldmask = 0; + + $oldmask = eval { setlogmask(0) } || 0; + is( $@, '', "setlogmask() called with a null mask" ); + $r = eval { setlogmask(0) } || 0; + is( $@, '', "setlogmask() called with a null mask (second time)" ); + is( $r, $oldmask, "setlogmask() must return the same mask as previous call"); + + my @masks = ( + LOG_MASK(LOG_ERR()), + ~LOG_MASK(LOG_INFO()), + LOG_MASK(LOG_CRIT()) | LOG_MASK(LOG_ERR()) | LOG_MASK(LOG_WARNING()), + ); + + for my $newmask (@masks) { + $r = eval { setlogmask($newmask) } || 0; + is( $@, '', "setlogmask() called with a new mask" ); + is( $r, $oldmask, "setlogmask() must return the same mask as previous call"); + $r = eval { setlogmask(0) } || 0; + is( $@, '', "setlogmask() called with a null mask" ); + is( $r, $newmask, "setlogmask() must return the new mask"); + setlogmask($oldmask); + } +} diff --git a/cpan/Sys-Syslog/win32/PerlLog.mc b/cpan/Sys-Syslog/win32/PerlLog.mc new file mode 100644 index 0000000000..3a7c1fdd06 --- /dev/null +++ b/cpan/Sys-Syslog/win32/PerlLog.mc @@ -0,0 +1,602 @@ +; // Sys::Syslog Message File 1.0.0
+
+MessageIdTypedef = DWORD
+
+SeverityNames = (
+ Success = 0x0:STATUS_SEVERITY_SUCCESS
+ Informational = 0x1:STATUS_SEVERITY_INFORMATIONAL
+ Warning = 0x2:STATUS_SEVERITY_WARNING
+ Error = 0x3:STATUS_SEVERITY_ERROR
+)
+
+LanguageNames = ( English = 0x0409:MSG00409 )
+LanguageNames = ( French = 0x040C:MSG0040C )
+
+
+; // =================================================================
+; // The following are facility name definitions
+
+MessageId = 0x0001
+SymbolicName = CAT_KERN
+Language = English
+Kernel
+.
+Language = French
+Kernel
+.
+
+MessageId = 0x0002
+SymbolicName = CAT_USER
+Language = English
+User
+.
+Language = French
+User
+.
+
+MessageId = 0x0003
+SymbolicName = CAT_MAIL
+Language = English
+Mail
+.
+Language = French
+Mail
+.
+
+MessageId = 0x0004
+SymbolicName = CAT_DAEMON
+Language = English
+Daemon
+.
+Language = French
+Daemon
+.
+
+MessageId = 0x0005
+SymbolicName = CAT_AUTH
+Language = English
+Auth
+.
+Language = French
+Auth
+.
+
+MessageId = 0x0006
+SymbolicName = CAT_SYSLOG
+Language = English
+Syslog
+.
+Language = French
+Syslog
+.
+
+MessageId = 0x0007
+SymbolicName = CAT_LPR
+Language = English
+LPR
+.
+Language = French
+LPR
+.
+
+MessageId = 0x0008
+SymbolicName = CAT_NEWS
+Language = English
+News
+.
+Language = French
+News
+.
+
+MessageId = 0x0009
+SymbolicName = CAT_UUCP
+Language = English
+UUCP
+.
+Language = French
+UUCP
+.
+
+MessageId = 0x000a
+SymbolicName = CAT_CRON
+Language = English
+Cron
+.
+Language = French
+Cron
+.
+
+MessageId = 0x000b
+SymbolicName = CAT_AUTHPRIV
+Language = English
+AuthPrivate
+.
+Language = French
+AuthPrivate
+.
+
+MessageId = 0x000c
+SymbolicName = CAT_FTP
+Language = English
+FTP
+.
+Language = French
+FTP
+.
+
+MessageId = 0x000d
+SymbolicName = CAT_LOCAL0
+Language = English
+Local0
+.
+Language = French
+Local0
+.
+
+MessageId = 0x000e
+SymbolicName = CAT_LOCAL1
+Language = English
+Local1
+.
+Language = French
+Local1
+.
+
+MessageId = 0x000f
+SymbolicName = CAT_LOCAL2
+Language = English
+Local2
+.
+Language = French
+Local2
+.
+
+MessageId = 0x0010
+SymbolicName = CAT_LOCAL3
+Language = English
+Local3
+.
+Language = French
+Local3
+.
+
+MessageId = 0x0011
+SymbolicName = CAT_LOCAL4
+Language = English
+Local4
+.
+Language = French
+Local4
+.
+
+MessageId = 0x0012
+SymbolicName = CAT_LOCAL5
+Language = English
+Local5
+.
+Language = French
+Local5
+.
+
+MessageId = 0x0013
+SymbolicName = CAT_LOCAL6
+Language = English
+Local6
+.
+Language = French
+Local6
+.
+
+MessageId = 0x0014
+SymbolicName = CAT_LOCAL7
+Language = English
+Local7
+.
+Language = French
+Local7
+.
+
+; // Mac OS X specific facilities ------------------------------------
+
+MessageId = 0x0015
+SymbolicName = CAT_NETINFO
+Language = English
+NetInfo
+.
+Language = French
+NetInfo
+.
+
+MessageId = 0x0016
+SymbolicName = CAT_REMOTEAUTH
+Language = English
+RemoteAuth
+.
+Language = French
+RemoteAuth
+.
+
+MessageId = 0x0017
+SymbolicName = CAT_RAS
+Language = English
+RAS
+.
+Language = French
+RAS
+.
+
+MessageId = 0x0018
+SymbolicName = CAT_INSTALL
+Language = English
+Install
+.
+Language = French
+Install
+.
+
+MessageId = 0x0019
+SymbolicName = CAT_LAUNCHD
+Language = English
+Launchd
+.
+Language = French
+Launchd
+.
+
+; //modern BSD specific facilities ----------------------------------
+
+MessageId = 0x001a
+SymbolicName = CAT_CONSOLE
+Language = English
+Console
+.
+Language = French
+Console
+.
+
+MessageId = 0x001b
+SymbolicName = CAT_NTP
+Language = English
+NTP
+.
+Language = French
+NTP
+.
+
+MessageId = 0x001c
+SymbolicName = CAT_SECURITY
+Language = English
+Security
+.
+Language = French
+Sécurité
+.
+
+; // IRIX specific facilities ----------------------------------------
+
+MessageId = 0x001d
+SymbolicName = CAT_AUDIT
+Language = English
+Audit
+.
+Language = French
+Audit
+.
+
+MessageId = 0x001e
+SymbolicName = CAT_LFMT
+Language = English
+LogAlert
+.
+Language = French
+LogAlert
+.
+
+
+; // =================================================================
+; // The following are message definitions.
+
+MessageId = 0x0080
+SymbolicName = MSG_KERNEL
+Language = English
+Kernel message: %1
+.
+Language = French
+Message du noyau : %1
+.
+
+
+MessageId = 0x0081
+SymbolicName = MSG_USER
+Language = English
+User message: %1
+.
+Language = French
+Message utilisateur : %1
+.
+
+
+MessageId = 0x0082
+SymbolicName = MSG_MAIL
+Language = English
+Mail subsystem message: %1
+.
+Language = French
+Message du sous-système de courrier : %1
+.
+
+
+MessageId = 0x0083
+SymbolicName = MSG_DAEMON
+Language = English
+Message from a system daemon without separate facility value: %1
+.
+Language = French
+Message d'un daemon sans catégorie spécifique : %1
+.
+
+
+MessageId = 0x0084
+SymbolicName = MSG_AUTH
+Language = English
+Security/authorization message: %1
+.
+Language = French
+Message de sécurite ou d'authorisation : %1
+.
+
+
+MessageId = 0x0085
+SymbolicName = MSG_SYSLOG
+Language = English
+Message generated internally by syslogd: %1
+.
+Language = French
+Message interne généré par le daemon syslogd : %1
+.
+
+
+MessageId = 0x0086
+SymbolicName = MSG_LPR
+Language = English
+Line printer subsystem message: %1
+.
+Language = French
+Message du sous-système d'impression : %1
+.
+
+
+MessageId = 0x0087
+SymbolicName = MSG_NEWS
+Language = English
+USENET news subsystem message: %1
+.
+Language = French
+Message du sous-système de nouvelles USENET : %1
+.
+
+
+MessageId = 0x0088
+SymbolicName = MSG_UUCP
+Language = English
+UUCP subsystem message: %1
+.
+Language = French
+Message du sous-système UUCP : %1
+.
+
+
+MessageId = 0x0089
+SymbolicName = MSG_CRON
+Language = English
+Message generated by the clock daemons (cron and at): %1
+.
+Language = French
+Message généré par les daemons d'exécution programmée (cron et at) : %1
+.
+
+
+MessageId = 0x008A
+SymbolicName = MSG_AUTHPRIV
+Language = English
+Security or authorization private message: %1
+.
+Language = French
+Message privé de sécurité ou d'authorisation : %1
+.
+
+
+MessageId = 0x008B
+SymbolicName = MSG_FTP
+Language = English
+FTP daemon message: %1
+.
+Language = French
+Message du daemon FTP : %1
+.
+
+
+MessageId = 0x008C
+SymbolicName = MSG_LOCAL0
+Language = English
+Local message on channel 0: %1
+.
+Language = French
+Message local sur le canal 0 : %1
+.
+
+
+MessageId = 0x008D
+SymbolicName = MSG_LOCAL1
+Language = English
+Local message on channel 1: %1
+.
+Language = French
+Message local sur le canal 1 : %1
+.
+
+
+MessageId = 0x008E
+SymbolicName = MSG_LOCAL2
+Language = English
+Local message on channel 2: %1
+.
+Language = French
+Message local sur le canal 2 : %1
+.
+
+
+MessageId = 0x008F
+SymbolicName = MSG_LOCAL3
+Language = English
+Local message on channel 3: %1
+.
+Language = French
+Message local sur le canal 3 : %1
+.
+
+
+MessageId = 0x0090
+SymbolicName = MSG_LOCAL4
+Language = English
+Local message on channel 4: %1
+.
+Language = French
+Message local sur le canal 4 : %1
+.
+
+
+MessageId = 0x0091
+SymbolicName = MSG_LOCAL5
+Language = English
+Local message on channel 5: %1
+.
+Language = French
+Message local sur le canal 5 : %1
+.
+
+
+MessageId = 0x0092
+SymbolicName = MSG_LOCAL6
+Language = English
+Local message on channel 6: %1
+.
+Language = French
+Message local sur le canal 6 : %1
+.
+
+
+MessageId = 0x0093
+SymbolicName = MSG_LOCAL7
+Language = English
+Local message on channel 7: %1
+.
+Language = French
+Message local sur le canal 7 : %1
+.
+
+
+; // Mac OS X specific facilities ------------------------------------
+
+MessageId = 0x0094
+SymbolicName = MSG_NETINFO
+Language = English
+NetInfo subsystem message: %1
+.
+Language = French
+Message du sous-système NetInfo : %1
+.
+
+
+MessageId = 0x0095
+SymbolicName = MSG_REMOTEAUTH
+Language = English
+Remote authentication or authorization message: %1
+.
+Language = French
+Message d'authentification ou d'authorisation distante : %1
+.
+
+
+MessageId = 0x0096
+SymbolicName = MSG_RAS
+Language = English
+Message generated by the Remote Access Service (VPN / PPP): %1
+.
+Language = French
+Message généré par le Service d'Accès Distant (Remote Access Service) (VPN / PPP) : %1
+.
+
+
+MessageId = 0x0097
+SymbolicName = MSG_INSTALL
+Language = English
+Installer subsystem message: %1
+.
+Language = French
+Message du sous-système d'installation : %1
+.
+
+
+MessageId = 0x0098
+SymbolicName = MSG_LAUNCHD
+Language = English
+Message generated by launchd, the general bootstrap daemon: %1
+.
+Language = French
+Message généré par launchd, le daemon générique de démarrage : %1
+.
+
+; //modern BSD specific facilities ----------------------------------
+
+MessageId = 0x0099
+SymbolicName = MSG_CONSOLE
+Language = English
+Message for the console: %1
+.
+Language = French
+Message pour la console : %1
+.
+
+
+MessageId = 0x009a
+SymbolicName = MSG_NTP
+Language = English
+NTP subsystem message: %1
+.
+Language = French
+Message du sous-système NTP : %1
+.
+
+
+MessageId = 0x009b
+SymbolicName = MSG_SECURITY
+Language = English
+Security subsystem message (firewalling, etc.): %1
+.
+Language = French
+Message du sous-système de sécurité (pare-feu, etc.) : %1
+.
+
+
+; // IRIX specific facilities ----------------------------------------
+
+MessageId = 0x009c
+SymbolicName = MSG_AUDIT
+Language = English
+Audit daemon message: %1
+.
+Language = French
+Message du daemon d'audit NTP : %1
+.
+
+
+MessageId = 0x009d
+SymbolicName = MSG_LFMT
+Language = English
+Logalert facility: %1
+.
+Language = French
+Message de logalert : %1
+.
+
diff --git a/cpan/Sys-Syslog/win32/PerlLog_RES.uu b/cpan/Sys-Syslog/win32/PerlLog_RES.uu new file mode 100644 index 0000000000..036cecf5e9 --- /dev/null +++ b/cpan/Sys-Syslog/win32/PerlLog_RES.uu @@ -0,0 +1,130 @@ +M`````"````#__P``__\```````````````````````"\"P``(````/__"P#_ +M_P$``````#``#`0```````````8````!````&0```$P```"`````B````(0" +M``",````F````*`%``":"```F@@``'@*``"K"```JP@``!`+``"\"```O`@` +M`'P+```8``$`2P!E`'(`;@!E`&P`#0`*```````4``$`50!S`&4`<@`-``H` +M`````!0``0!-`&$`:0!L``T`"@``````&``!`$0`80!E`&T`;P!N``T`"@`` +M````%``!`$$`=0!T`&@`#0`*```````8``$`4P!Y`',`;`!O`&<`#0`*```` +M```0``$`3`!0`%(`#0`*````%``!`$X`90!W`',`#0`*```````4``$`50!5 +M`$,`4``-``H``````!0``0!#`'(`;P!N``T`"@``````(``!`$$`=0!T`&@` +M4`!R`&D`=@!A`'0`90`-``H````0``$`1@!4`%``#0`*````&``!`$P`;P!C +M`&$`;``P``T`"@``````&``!`$P`;P!C`&$`;``Q``T`"@``````&``!`$P` +M;P!C`&$`;``R``T`"@``````&``!`$P`;P!C`&$`;``S``T`"@``````&``! +M`$P`;P!C`&$`;``T``T`"@``````&``!`$P`;P!C`&$`;``U``T`"@`````` +M&``!`$P`;P!C`&$`;``V``T`"@``````&``!`$P`;P!C`&$`;``W``T`"@`` +M````&``!`$X`90!T`$D`;@!F`&\`#0`*````(``!`%(`90!M`&\`=`!E`$$` +M=0!T`&@`#0`*```````0``$`4@!!`%,`#0`*````&``!`$D`;@!S`'0`80!L +M`&P`#0`*````&``!`$P`80!U`&X`8P!H`&0`#0`*````-``!`$T`90!S`',` +M80!G`&4`(`!D`'4`(`!N`&\`>0!A`'4`(``Z`"``)0`Q``T`"@```#P``0!- +M`&4`<P!S`&$`9P!E`"``=0!T`&D`;`!I`',`80!T`&4`=0!R`"``.@`@`"4` +M,0`-``H``````%P``0!-`&4`<P!S`&$`9P!E`"``9`!U`"``<P!O`'4`<P`M +M`',`>0!S`'0`I@-M`&4`(`!D`&4`(`!C`&\`=0!R`'(`:0!E`'(`(``Z`"`` +M)0`Q``T`"@``````<``!`$T`90!S`',`80!G`&4`(`!D`"<`=0!N`"``9`!A +M`&4`;0!O`&X`(`!S`&$`;@!S`"``8P!A`'0`F`-G`&\`<@!I`&4`(`!S`'`` +MF`-C`&D`9@!I`'$`=0!E`"``.@`@`"4`,0`-``H``````&```0!-`&4`<P!S +M`&$`9P!E`"``9`!E`"``<P"8`V,`=0!R`&D`=`!E`"``;P!U`"``9``G`&$` +M=0!T`&@`;P!R`&D`<P!A`'0`:0!O`&X`(``Z`"``)0`Q``T`"@```&P``0!- +M`&4`<P!S`&$`9P!E`"``:0!N`'0`90!R`&X`90`@`&<`F`-N`)@#<@"8`R`` +M<`!A`'(`(`!L`&4`(`!D`&$`90!M`&\`;@`@`',`>0!S`&P`;P!G`&0`(``Z +M`"``)0`Q``T`"@```%P``0!-`&4`<P!S`&$`9P!E`"``9`!U`"``<P!O`'4` +M<P`M`',`>0!S`'0`I@-M`&4`(`!D`"<`:0!M`'``<@!E`',`<P!I`&\`;@`@ +M`#H`(``E`#$`#0`*````;``!`$T`90!S`',`80!G`&4`(`!D`'4`(`!S`&\` +M=0!S`"T`<P!Y`',`=`"F`VT`90`@`&0`90`@`&X`;P!U`'8`90!L`&P`90!S +M`"``50!3`$4`3@!%`%0`(``Z`"``)0`Q``T`"@``````3``!`$T`90!S`',` +M80!G`&4`(`!D`'4`(`!S`&\`=0!S`"T`<P!Y`',`=`"F`VT`90`@`%4`50!# +M`%``(``Z`"``)0`Q``T`"@```$P``0!-`&4`<P!S`&$`9P!E`"``;`!O`&,` +M80!L`"``<P!U`'(`(`!L`&4`(`!C`&$`;@!A`&P`(``P`"``.@`@`"4`,0`- +M``H```!,``$`30!E`',`<P!A`&<`90`@`&P`;P!C`&$`;``@`',`=0!R`"`` +M;`!E`"``8P!A`&X`80!L`"``,0`@`#H`(``E`#$`#0`*````3``!`$T`90!S +M`',`80!G`&4`(`!L`&\`8P!A`&P`(`!S`'4`<@`@`&P`90`@`&,`80!N`&$` +M;``@`#(`(``Z`"``)0`Q``T`"@```$P``0!-`&4`<P!S`&$`9P!E`"``;`!O +M`&,`80!L`"``<P!U`'(`(`!L`&4`(`!C`&$`;@!A`&P`(``S`"``.@`@`"4` +M,0`-``H```!,``$`30!E`',`<P!A`&<`90`@`&P`;P!C`&$`;``@`',`=0!R +M`"``;`!E`"``8P!A`&X`80!L`"``-``@`#H`(``E`#$`#0`*````3``!`$T` +M90!S`',`80!G`&4`(`!L`&\`8P!A`&P`(`!S`'4`<@`@`&P`90`@`&,`80!N +M`&$`;``@`#4`(``Z`"``)0`Q``T`"@```$P``0!-`&4`<P!S`&$`9P!E`"`` +M;`!O`&,`80!L`"``<P!U`'(`(`!L`&4`(`!C`&$`;@!A`&P`(``V`"``.@`@ +M`"4`,0`-``H```!,``$`30!E`',`<P!A`&<`90`@`&P`;P!C`&$`;``@`',` +M=0!R`"``;`!E`"``8P!A`&X`80!L`"``-P`@`#H`(``E`#$`#0`*````5``! +M`$T`90!S`',`80!G`&4`(`!D`'4`(`!S`&\`=0!S`"T`<P!Y`',`=`"F`VT` +M90`@`$X`90!T`$D`;@!F`&\`(``Z`"``)0`Q``T`"@``````@``!`$T`90!S +M`',`80!G`&4`(`!D`"<`80!U`'0`:`!E`&X`=`!I`&8`:0!C`&$`=`!I`&\` +M;@`@`&\`=0`@`&0`)P!A`'4`=`!H`&\`<@!I`',`80!T`&D`;P!N`"``9`!I +M`',`=`!A`&X`=`!E`"``.@`@`"4`,0`-``H```"X``$`30!E`',`<P!A`&<` +M90`@`&<`F`-N`)@#<@"8`R``<`!A`'(`(`!L`&4`(`!3`&4`<@!V`&D`8P!E +M`"``9``G`$$`8P!C`*8#<P`@`$0`:0!S`'0`80!N`'0`(``H`%(`90!M`&\` +M=`!E`"``00!C`&,`90!S`',`(`!3`&4`<@!V`&D`8P!E`"D`(``H`%8`4`!. +M`"``+P`@`%``4`!0`"D`(``Z`"``)0`Q``T`"@``````8``!`$T`90!S`',` +M80!G`&4`(`!D`'4`(`!S`&\`=0!S`"T`<P!Y`',`=`"F`VT`90`@`&0`)P!I +M`&X`<P!T`&$`;`!L`&$`=`!I`&\`;@`@`#H`(``E`#$`#0`*````C``!`$T` +M90!S`',`80!G`&4`(`!G`)@#;@"8`W(`F`,@`'``80!R`"``;`!A`'4`;@!C +M`&@`9``L`"``;`!E`"``9`!A`&4`;0!O`&X`(`!G`)@#;@"8`W(`:0!Q`'4` +M90`@`&0`90`@`&4`;0!A`'(`<@!A`&<`90`@`#H`(``E`#$`#0`*``````"8 +M``$`30!E`',`<P!A`&<`90`@`&<`F`-N`)@#<@"8`R``<`!A`'(`(`!L`&4` +M<P`@`&0`80!E`&T`;P!N`',`(`!D`"<`90!X`)@#8P!U`'0`:0!O`&X`(`!P +M`'(`;P!G`'(`80!M`&T`F`-E`"``*`!C`'(`;P!N`"``90!T`"``80!T`"D` +M(``Z`"``)0`Q``T`"@```&P``0!-`&4`<P!S`&$`9P!E`"``<`!R`&D`=@"8 +M`R``9`!E`"``<P"8`V,`=0!R`&D`=`"8`R``;P!U`"``9``G`&$`=0!T`&@` +M;P!R`&D`<P!A`'0`:0!O`&X`(``Z`"``)0`Q``T`"@```$```0!-`&4`<P!S +M`&$`9P!E`"``9`!U`"``9`!A`&4`;0!O`&X`(`!&`%0`4``@`#H`(``E`#$` +M#0`*``````"<"@``(````/__"P#__P$``````#``"00```````````8````! +M````&0```$P```"`````B````(0"``",````F````#@%``":"```F@@``(0) +M``"K"```JP@````*``"\"```O`@``&0*```8``$`2P!E`'(`;@!E`&P`#0`* +M```````4``$`50!S`&4`<@`-``H``````!0``0!-`&$`:0!L``T`"@`````` +M&``!`$0`80!E`&T`;P!N``T`"@``````%``!`$$`=0!T`&@`#0`*```````8 +M``$`4P!Y`',`;`!O`&<`#0`*```````0``$`3`!0`%(`#0`*````%``!`$X` +M90!W`',`#0`*```````4``$`50!5`$,`4``-``H``````!0``0!#`'(`;P!N +M``T`"@``````(``!`$$`=0!T`&@`4`!R`&D`=@!A`'0`90`-``H````0``$` +M1@!4`%``#0`*````&``!`$P`;P!C`&$`;``P``T`"@``````&``!`$P`;P!C +M`&$`;``Q``T`"@``````&``!`$P`;P!C`&$`;``R``T`"@``````&``!`$P` +M;P!C`&$`;``S``T`"@``````&``!`$P`;P!C`&$`;``T``T`"@``````&``! +M`$P`;P!C`&$`;``U``T`"@``````&``!`$P`;P!C`&$`;``V``T`"@`````` +M&``!`$P`;P!C`&$`;``W``T`"@``````&``!`$X`90!T`$D`;@!F`&\`#0`* +M````(``!`%(`90!M`&\`=`!E`$$`=0!T`&@`#0`*```````0``$`4@!!`%,` +M#0`*````&``!`$D`;@!S`'0`80!L`&P`#0`*````&``!`$P`80!U`&X`8P!H +M`&0`#0`*````,``!`$L`90!R`&X`90!L`"``;0!E`',`<P!A`&<`90`Z`"`` +M)0`Q``T`"@``````+``!`%4`<P!E`'(`(`!M`&4`<P!S`&$`9P!E`#H`(``E +M`#$`#0`*``````!```$`30!A`&D`;``@`',`=0!B`',`>0!S`'0`90!M`"`` +M;0!E`',`<P!A`&<`90`Z`"``)0`Q``T`"@``````C``!`$T`90!S`',`80!G +M`&4`(`!F`'(`;P!M`"``80`@`',`>0!S`'0`90!M`"``9`!A`&4`;0!O`&X` +M(`!W`&D`=`!H`&\`=0!T`"``<P!E`'``80!R`&$`=`!E`"``9@!A`&,`:0!L +M`&D`=`!Y`"``=@!A`&P`=0!E`#H`(``E`#$`#0`*``````!0``$`4P!E`&,` +M=0!R`&D`=`!Y`"\`80!U`'0`:`!O`'(`:0!Z`&$`=`!I`&\`;@`@`&T`90!S +M`',`80!G`&4`.@`@`"4`,0`-``H``````&```0!-`&4`<P!S`&$`9P!E`"`` +M9P!E`&X`90!R`&$`=`!E`&0`(`!I`&X`=`!E`'(`;@!A`&P`;`!Y`"``8@!Y +M`"``<P!Y`',`;`!O`&<`9``Z`"``)0`Q``T`"@```%```0!,`&D`;@!E`"`` +M<`!R`&D`;@!T`&4`<@`@`',`=0!B`',`>0!S`'0`90!M`"``;0!E`',`<P!A +M`&<`90`Z`"``)0`Q``T`"@``````3``!`%4`4P!%`$X`10!4`"``;@!E`'<` +M<P`@`',`=0!B`',`>0!S`'0`90!M`"``;0!E`',`<P!A`&<`90`Z`"``)0`Q +M``T`"@```$```0!5`%4`0P!0`"``<P!U`&(`<P!Y`',`=`!E`&T`(`!M`&4` +M<P!S`&$`9P!E`#H`(``E`#$`#0`*``````!(``$`3`!O`&,`80!L`"``;0!E +M`',`<P!A`&<`90`@`&\`;@`@`&,`:`!A`&X`;@!E`&P`(``P`#H`(``E`#$` +M#0`*``````!(``$`3`!O`&,`80!L`"``;0!E`',`<P!A`&<`90`@`&\`;@`@ +M`&,`:`!A`&X`;@!E`&P`(``Q`#H`(``E`#$`#0`*``````!(``$`3`!O`&,` +M80!L`"``;0!E`',`<P!A`&<`90`@`&\`;@`@`&,`:`!A`&X`;@!E`&P`(``R +M`#H`(``E`#$`#0`*``````!(``$`3`!O`&,`80!L`"``;0!E`',`<P!A`&<` +M90`@`&\`;@`@`&,`:`!A`&X`;@!E`&P`(``S`#H`(``E`#$`#0`*``````!( +M``$`3`!O`&,`80!L`"``;0!E`',`<P!A`&<`90`@`&\`;@`@`&,`:`!A`&X` +M;@!E`&P`(``T`#H`(``E`#$`#0`*``````!(``$`3`!O`&,`80!L`"``;0!E +M`',`<P!A`&<`90`@`&\`;@`@`&,`:`!A`&X`;@!E`&P`(``U`#H`(``E`#$` +M#0`*``````!(``$`3`!O`&,`80!L`"``;0!E`',`<P!A`&<`90`@`&\`;@`@ +M`&,`:`!A`&X`;@!E`&P`(``V`#H`(``E`#$`#0`*``````!(``$`3`!O`&,` +M80!L`"``;0!E`',`<P!A`&<`90`@`&\`;@`@`&,`:`!A`&X`;@!E`&P`(``W +M`#H`(``E`#$`#0`*``````!$``$`3@!E`'0`20!N`&8`;P`@`',`=0!B`',` +M>0!S`'0`90!M`"``;0!E`',`<P!A`&<`90`Z`"``)0`Q``T`"@```'```0!2 +M`&4`;0!O`'0`90`@`&$`=0!T`&@`90!N`'0`:0!C`&$`=`!I`&\`;@`@`&\` +M<@`@`&$`=0!T`&@`;P!R`&D`>@!A`'0`:0!O`&X`(`!M`&4`<P!S`&$`9P!E +M`#H`(``E`#$`#0`*``````"(``$`30!E`',`<P!A`&<`90`@`&<`90!N`&4` +M<@!A`'0`90!D`"``8@!Y`"``=`!H`&4`(`!2`&4`;0!O`'0`90`@`$$`8P!C +M`&4`<P!S`"``4P!E`'(`=@!I`&,`90`@`"@`5@!0`$X`(``O`"``4`!0`%`` +M*0`Z`"``)0`Q``T`"@``````2``!`$D`;@!S`'0`80!L`&P`90!R`"``<P!U +M`&(`<P!Y`',`=`!E`&T`(`!M`&4`<P!S`&$`9P!E`#H`(``E`#$`#0`*```` +MB``!`$T`90!S`',`80!G`&4`(`!G`&4`;@!E`'(`80!T`&4`9``@`&(`>0`@ +M`&P`80!U`&X`8P!H`&0`+``@`'0`:`!E`"``9P!E`&X`90!R`&$`;``@`&(` +M;P!O`'0`<P!T`'(`80!P`"``9`!A`&4`;0!O`&X`.@`@`"4`,0`-``H````` +M`'P``0!-`&4`<P!S`&$`9P!E`"``9P!E`&X`90!R`&$`=`!E`&0`(`!B`'D` +M(`!T`&@`90`@`&,`;`!O`&,`:P`@`&0`80!E`&T`;P!N`',`(``H`&,`<@!O +M`&X`(`!A`&X`9``@`&$`=``I`#H`(``E`#$`#0`*``````!D``$`4P!E`&,` +M=0!R`&D`=`!Y`"``;P!R`"``80!U`'0`:`!O`'(`:0!Z`&$`=`!I`&\`;@`@ +M`'``<@!I`'8`80!T`&4`(`!M`&4`<P!S`&$`9P!E`#H`(``E`#$`#0`*```` +M.``!`$8`5`!0`"``9`!A`&4`;0!O`&X`(`!M`&4`<P!S`&$`9P!E`#H`(``E ++`#$`#0`*```````` diff --git a/cpan/Sys-Syslog/win32/PerlLog_dll.uu b/cpan/Sys-Syslog/win32/PerlLog_dll.uu new file mode 100644 index 0000000000..2661a9c173 --- /dev/null +++ b/cpan/Sys-Syslog/win32/PerlLog_dll.uu @@ -0,0 +1,171 @@ +M35J0``,````$````__\``+@`````````0```````````````````````````
+M````````````````````L`````X?N@X`M`G-(;@!3,TA5&AI<R!P<F]G<F%M
+M(&-A;FYO="!B92!R=6X@:6X@1$]3(&UO9&4N#0T*)`````````"?JCW:V\M3
+MB=O+4XG;RU.)(>\6B=K+4XDX[6Z)VLM3B5)I8VC;RU.)``````````!010``
+M3`$"`!LK3D4``````````.``#B$+`0<````````<```````````````0````
+M$```````8``0`````@``!``````````$``````````!``````@``IAX```(`
+M`````!```!``````$```$````````!```````````````````````````!``
+M`+`8`````````````````````````#````@`````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````"YR<W)C````L!@````0````&@````(`````
+M`````````````$```$`N<F5L;V,```@`````,`````(````<````````````
+M``````!```!"``````````````````````````````$`"P```!@``(``````
+M``````````````$``0```#```(````````````````````(`"00``%`````,
+M!```8````"`=``","P````````````!P$```K`P`````````````&@````$`
+M```9````/`$``(```0"```$`=`,``($``@"!``(`J`,``((``P""``,`Y`,`
+M`(,`!`"#``0`0`0``(0`!0"$``4`L`0``(4`!@"%``8`$`4``(8`!P"&``<`
+M?`4``(<`"`"'``@`V`4``(@`"0"(``D`1`8``)H("@":"`H`D`8``*L("P"K
+M"`L`*`<``+P(#`"\"`P`E`<``(P`$`",`!``U`<``(T`$0"-`!$`(`@``(X`
+M$@".`!(`;`@``(\`$P"/`!,`N`@``)``%`"0`!0`!`D``)$`%0"1`!4`4`D`
+M`)(`%@"2`!8`G`D``),`%P"3`!<`Z`D``)0`(`"4`"``-`H``)4`(0"5`"$`
+MB`H``)8`(@"6`"(`"`L``)<`(P"7`",`P`L``)@`)`"8`"0`(`P``!@``0!+
+M`&4`<@!N`&4`;``-``H``````!0``0!5`',`90!R``T`"@``````%``!`$T`
+M80!I`&P`#0`*```````8``$`1`!A`&4`;0!O`&X`#0`*```````4``$`00!U
+M`'0`:``-``H``````!@``0!3`'D`<P!L`&\`9P`-``H``````!```0!,`%``
+M4@`-``H````4``$`3@!E`'<`<P`-``H``````!0``0!5`%4`0P!0``T`"@``
+M````%``!`$,`<@!O`&X`#0`*```````@``$`00!U`'0`:`!0`'(`:0!V`&$`
+M=`!E``T`"@```!```0!&`%0`4``-``H````8``$`3`!O`&,`80!L`#``#0`*
+M```````8``$`3`!O`&,`80!L`#$`#0`*```````8``$`3`!O`&,`80!L`#(`
+M#0`*```````8``$`3`!O`&,`80!L`#,`#0`*```````8``$`3`!O`&,`80!L
+M`#0`#0`*```````8``$`3`!O`&,`80!L`#4`#0`*```````8``$`3`!O`&,`
+M80!L`#8`#0`*```````8``$`3`!O`&,`80!L`#<`#0`*```````8``$`3@!E
+M`'0`20!N`&8`;P`-``H````@``$`4@!E`&T`;P!T`&4`00!U`'0`:``-``H`
+M`````!```0!2`$$`4P`-``H````8``$`20!N`',`=`!A`&P`;``-``H````8
+M``$`3`!A`'4`;@!C`&@`9``-``H````T``$`30!E`',`<P!A`&<`90`@`&0`
+M=0`@`&X`;P!Y`&$`=0`@`#H`(``E`#$`#0`*````/``!`$T`90!S`',`80!G
+M`&4`(`!U`'0`:0!L`&D`<P!A`'0`90!U`'(`(``Z`"``)0`Q``T`"@``````
+M7``!`$T`90!S`',`80!G`&4`(`!D`'4`(`!S`&\`=0!S`"T`<P!Y`',`=`"F
+M`VT`90`@`&0`90`@`&,`;P!U`'(`<@!I`&4`<@`@`#H`(``E`#$`#0`*````
+M``!P``$`30!E`',`<P!A`&<`90`@`&0`)P!U`&X`(`!D`&$`90!M`&\`;@`@
+M`',`80!N`',`(`!C`&$`=`"8`V<`;P!R`&D`90`@`',`<`"8`V,`:0!F`&D`
+M<0!U`&4`(``Z`"``)0`Q``T`"@``````8``!`$T`90!S`',`80!G`&4`(`!D
+M`&4`(`!S`)@#8P!U`'(`:0!T`&4`(`!O`'4`(`!D`"<`80!U`'0`:`!O`'(`
+M:0!S`&$`=`!I`&\`;@`@`#H`(``E`#$`#0`*````;``!`$T`90!S`',`80!G
+M`&4`(`!I`&X`=`!E`'(`;@!E`"``9P"8`VX`F`-R`)@#(`!P`&$`<@`@`&P`
+M90`@`&0`80!E`&T`;P!N`"``<P!Y`',`;`!O`&<`9``@`#H`(``E`#$`#0`*
+M````7``!`$T`90!S`',`80!G`&4`(`!D`'4`(`!S`&\`=0!S`"T`<P!Y`',`
+M=`"F`VT`90`@`&0`)P!I`&T`<`!R`&4`<P!S`&D`;P!N`"``.@`@`"4`,0`-
+M``H```!L``$`30!E`',`<P!A`&<`90`@`&0`=0`@`',`;P!U`',`+0!S`'D`
+M<P!T`*8#;0!E`"``9`!E`"``;@!O`'4`=@!E`&P`;`!E`',`(`!5`%,`10!.
+M`$4`5``@`#H`(``E`#$`#0`*``````!,``$`30!E`',`<P!A`&<`90`@`&0`
+M=0`@`',`;P!U`',`+0!S`'D`<P!T`*8#;0!E`"``50!5`$,`4``@`#H`(``E
+M`#$`#0`*````F``!`$T`90!S`',`80!G`&4`(`!G`)@#;@"8`W(`F`,@`'``
+M80!R`"``;`!E`',`(`!D`&$`90!M`&\`;@!S`"``9``G`&4`>`"8`V,`=0!T
+M`&D`;P!N`"``<`!R`&\`9P!R`&$`;0!M`)@#90`@`"@`8P!R`&\`;@`@`&4`
+M=``@`&$`=``I`"``.@`@`"4`,0`-``H```!L``$`30!E`',`<P!A`&<`90`@
+M`'``<@!I`'8`F`,@`&0`90`@`',`F`-C`'4`<@!I`'0`F`,@`&\`=0`@`&0`
+M)P!A`'4`=`!H`&\`<@!I`',`80!T`&D`;P!N`"``.@`@`"4`,0`-``H```!`
+M``$`30!E`',`<P!A`&<`90`@`&0`=0`@`&0`80!E`&T`;P!N`"``1@!4`%``
+M(``Z`"``)0`Q``T`"@``````3``!`$T`90!S`',`80!G`&4`(`!L`&\`8P!A
+M`&P`(`!S`'4`<@`@`&P`90`@`&,`80!N`&$`;``@`#``(``Z`"``)0`Q``T`
+M"@```$P``0!-`&4`<P!S`&$`9P!E`"``;`!O`&,`80!L`"``<P!U`'(`(`!L
+M`&4`(`!C`&$`;@!A`&P`(``Q`"``.@`@`"4`,0`-``H```!,``$`30!E`',`
+M<P!A`&<`90`@`&P`;P!C`&$`;``@`',`=0!R`"``;`!E`"``8P!A`&X`80!L
+M`"``,@`@`#H`(``E`#$`#0`*````3``!`$T`90!S`',`80!G`&4`(`!L`&\`
+M8P!A`&P`(`!S`'4`<@`@`&P`90`@`&,`80!N`&$`;``@`#,`(``Z`"``)0`Q
+M``T`"@```$P``0!-`&4`<P!S`&$`9P!E`"``;`!O`&,`80!L`"``<P!U`'(`
+M(`!L`&4`(`!C`&$`;@!A`&P`(``T`"``.@`@`"4`,0`-``H```!,``$`30!E
+M`',`<P!A`&<`90`@`&P`;P!C`&$`;``@`',`=0!R`"``;`!E`"``8P!A`&X`
+M80!L`"``-0`@`#H`(``E`#$`#0`*````3``!`$T`90!S`',`80!G`&4`(`!L
+M`&\`8P!A`&P`(`!S`'4`<@`@`&P`90`@`&,`80!N`&$`;``@`#8`(``Z`"``
+M)0`Q``T`"@```$P``0!-`&4`<P!S`&$`9P!E`"``;`!O`&,`80!L`"``<P!U
+M`'(`(`!L`&4`(`!C`&$`;@!A`&P`(``W`"``.@`@`"4`,0`-``H```!4``$`
+M30!E`',`<P!A`&<`90`@`&0`=0`@`',`;P!U`',`+0!S`'D`<P!T`*8#;0!E
+M`"``3@!E`'0`20!N`&8`;P`@`#H`(``E`#$`#0`*``````"```$`30!E`',`
+M<P!A`&<`90`@`&0`)P!A`'4`=`!H`&4`;@!T`&D`9@!I`&,`80!T`&D`;P!N
+M`"``;P!U`"``9``G`&$`=0!T`&@`;P!R`&D`<P!A`'0`:0!O`&X`(`!D`&D`
+M<P!T`&$`;@!T`&4`(``Z`"``)0`Q``T`"@```+@``0!-`&4`<P!S`&$`9P!E
+M`"``9P"8`VX`F`-R`)@#(`!P`&$`<@`@`&P`90`@`%,`90!R`'8`:0!C`&4`
+M(`!D`"<`00!C`&,`I@-S`"``1`!I`',`=`!A`&X`=``@`"@`4@!E`&T`;P!T
+M`&4`(`!!`&,`8P!E`',`<P`@`%,`90!R`'8`:0!C`&4`*0`@`"@`5@!0`$X`
+M(``O`"``4`!0`%``*0`@`#H`(``E`#$`#0`*``````!@``$`30!E`',`<P!A
+M`&<`90`@`&0`=0`@`',`;P!U`',`+0!S`'D`<P!T`*8#;0!E`"``9``G`&D`
+M;@!S`'0`80!L`&P`80!T`&D`;P!N`"``.@`@`"4`,0`-``H```",``$`30!E
+M`',`<P!A`&<`90`@`&<`F`-N`)@#<@"8`R``<`!A`'(`(`!L`&$`=0!N`&,`
+M:`!D`"P`(`!L`&4`(`!D`&$`90!M`&\`;@`@`&<`F`-N`)@#<@!I`'$`=0!E
+M`"``9`!E`"``90!M`&$`<@!R`&$`9P!E`"``.@`@`"4`,0`-``H`````````
+M```:`````0```!D````\`0``@``!`(```0!T`P``@0`"`($``@"D`P``@@`#
+M`((``P#0`P``@P`$`(,`!``0!```A``%`(0`!0"<!```A0`&`(4`!@#L!```
+MA@`'`(8`!P!,!0``AP`(`(<`"`"<!0``B``)`(@`"0#H!0``F@@*`)H("@`H
+M!@``JP@+`*L("P"D!@``O`@,`+P(#``(!P``C``0`(P`$`!`!P``C0`1`(T`
+M$0"(!P``C@`2`(X`$@#0!P``CP`3`(\`$P`8"```D``4`)``%`!@"```D0`5
+M`)$`%0"H"```D@`6`)(`%@#P"```DP`7`),`%P`X"0``E``@`)0`(`"`"0``
+ME0`A`)4`(0#$"0``E@`B`)8`(@`T"@``EP`C`)<`(P"\"@``F``D`)@`)``$
+M"P``&``!`$L`90!R`&X`90!L``T`"@``````%``!`%4`<P!E`'(`#0`*````
+M```4``$`30!A`&D`;``-``H``````!@``0!$`&$`90!M`&\`;@`-``H`````
+M`!0``0!!`'4`=`!H``T`"@``````&``!`%,`>0!S`&P`;P!G``T`"@``````
+M$``!`$P`4`!2``T`"@```!0``0!.`&4`=P!S``T`"@``````%``!`%4`50!#
+M`%``#0`*```````4``$`0P!R`&\`;@`-``H``````"```0!!`'4`=`!H`%``
+M<@!I`'8`80!T`&4`#0`*````$``!`$8`5`!0``T`"@```!@``0!,`&\`8P!A
+M`&P`,``-``H``````!@``0!,`&\`8P!A`&P`,0`-``H``````!@``0!,`&\`
+M8P!A`&P`,@`-``H``````!@``0!,`&\`8P!A`&P`,P`-``H``````!@``0!,
+M`&\`8P!A`&P`-``-``H``````!@``0!,`&\`8P!A`&P`-0`-``H``````!@`
+M`0!,`&\`8P!A`&P`-@`-``H``````!@``0!,`&\`8P!A`&P`-P`-``H`````
+M`!@``0!.`&4`=`!)`&X`9@!O``T`"@```"```0!2`&4`;0!O`'0`90!!`'4`
+M=`!H``T`"@``````$``!`%(`00!3``T`"@```!@``0!)`&X`<P!T`&$`;`!L
+M``T`"@```!@``0!,`&$`=0!N`&,`:`!D``T`"@```#```0!+`&4`<@!N`&4`
+M;``@`&T`90!S`',`80!G`&4`.@`@`"4`,0`-``H``````"P``0!5`',`90!R
+M`"``;0!E`',`<P!A`&<`90`Z`"``)0`Q``T`"@``````0``!`$T`80!I`&P`
+M(`!S`'4`8@!S`'D`<P!T`&4`;0`@`&T`90!S`',`80!G`&4`.@`@`"4`,0`-
+M``H``````(P``0!-`&4`<P!S`&$`9P!E`"``9@!R`&\`;0`@`&$`(`!S`'D`
+M<P!T`&4`;0`@`&0`80!E`&T`;P!N`"``=P!I`'0`:`!O`'4`=``@`',`90!P
+M`&$`<@!A`'0`90`@`&8`80!C`&D`;`!I`'0`>0`@`'8`80!L`'4`90`Z`"``
+M)0`Q``T`"@``````4``!`%,`90!C`'4`<@!I`'0`>0`O`&$`=0!T`&@`;P!R
+M`&D`>@!A`'0`:0!O`&X`(`!M`&4`<P!S`&$`9P!E`#H`(``E`#$`#0`*````
+M``!@``$`30!E`',`<P!A`&<`90`@`&<`90!N`&4`<@!A`'0`90!D`"``:0!N
+M`'0`90!R`&X`80!L`&P`>0`@`&(`>0`@`',`>0!S`&P`;P!G`&0`.@`@`"4`
+M,0`-``H```!0``$`3`!I`&X`90`@`'``<@!I`&X`=`!E`'(`(`!S`'4`8@!S
+M`'D`<P!T`&4`;0`@`&T`90!S`',`80!G`&4`.@`@`"4`,0`-``H``````$P`
+M`0!5`%,`10!.`$4`5``@`&X`90!W`',`(`!S`'4`8@!S`'D`<P!T`&4`;0`@
+M`&T`90!S`',`80!G`&4`.@`@`"4`,0`-``H```!```$`50!5`$,`4``@`',`
+M=0!B`',`>0!S`'0`90!M`"``;0!E`',`<P!A`&<`90`Z`"``)0`Q``T`"@``
+M````?``!`$T`90!S`',`80!G`&4`(`!G`&4`;@!E`'(`80!T`&4`9``@`&(`
+M>0`@`'0`:`!E`"``8P!L`&\`8P!K`"``9`!A`&4`;0!O`&X`<P`@`"@`8P!R
+M`&\`;@`@`&$`;@!D`"``80!T`"D`.@`@`"4`,0`-``H``````&0``0!3`&4`
+M8P!U`'(`:0!T`'D`(`!O`'(`(`!A`'4`=`!H`&\`<@!I`'H`80!T`&D`;P!N
+M`"``<`!R`&D`=@!A`'0`90`@`&T`90!S`',`80!G`&4`.@`@`"4`,0`-``H`
+M```X``$`1@!4`%``(`!D`&$`90!M`&\`;@`@`&T`90!S`',`80!G`&4`.@`@
+M`"4`,0`-``H``````$@``0!,`&\`8P!A`&P`(`!M`&4`<P!S`&$`9P!E`"``
+M;P!N`"``8P!H`&$`;@!N`&4`;``@`#``.@`@`"4`,0`-``H``````$@``0!,
+M`&\`8P!A`&P`(`!M`&4`<P!S`&$`9P!E`"``;P!N`"``8P!H`&$`;@!N`&4`
+M;``@`#$`.@`@`"4`,0`-``H``````$@``0!,`&\`8P!A`&P`(`!M`&4`<P!S
+M`&$`9P!E`"``;P!N`"``8P!H`&$`;@!N`&4`;``@`#(`.@`@`"4`,0`-``H`
+M`````$@``0!,`&\`8P!A`&P`(`!M`&4`<P!S`&$`9P!E`"``;P!N`"``8P!H
+M`&$`;@!N`&4`;``@`#,`.@`@`"4`,0`-``H``````$@``0!,`&\`8P!A`&P`
+M(`!M`&4`<P!S`&$`9P!E`"``;P!N`"``8P!H`&$`;@!N`&4`;``@`#0`.@`@
+M`"4`,0`-``H``````$@``0!,`&\`8P!A`&P`(`!M`&4`<P!S`&$`9P!E`"``
+M;P!N`"``8P!H`&$`;@!N`&4`;``@`#4`.@`@`"4`,0`-``H``````$@``0!,
+M`&\`8P!A`&P`(`!M`&4`<P!S`&$`9P!E`"``;P!N`"``8P!H`&$`;@!N`&4`
+M;``@`#8`.@`@`"4`,0`-``H``````$@``0!,`&\`8P!A`&P`(`!M`&4`<P!S
+M`&$`9P!E`"``;P!N`"``8P!H`&$`;@!N`&4`;``@`#<`.@`@`"4`,0`-``H`
+M`````$0``0!.`&4`=`!)`&X`9@!O`"``<P!U`&(`<P!Y`',`=`!E`&T`(`!M
+M`&4`<P!S`&$`9P!E`#H`(``E`#$`#0`*````<``!`%(`90!M`&\`=`!E`"``
+M80!U`'0`:`!E`&X`=`!I`&,`80!T`&D`;P!N`"``;P!R`"``80!U`'0`:`!O
+M`'(`:0!Z`&$`=`!I`&\`;@`@`&T`90!S`',`80!G`&4`.@`@`"4`,0`-``H`
+M`````(@``0!-`&4`<P!S`&$`9P!E`"``9P!E`&X`90!R`&$`=`!E`&0`(`!B
+M`'D`(`!T`&@`90`@`%(`90!M`&\`=`!E`"``00!C`&,`90!S`',`(`!3`&4`
+M<@!V`&D`8P!E`"``*`!6`%``3@`@`"\`(`!0`%``4``I`#H`(``E`#$`#0`*
+M``````!(``$`20!N`',`=`!A`&P`;`!E`'(`(`!S`'4`8@!S`'D`<P!T`&4`
+M;0`@`&T`90!S`',`80!G`&4`.@`@`"4`,0`-``H```"(``$`30!E`',`<P!A
+M`&<`90`@`&<`90!N`&4`<@!A`'0`90!D`"``8@!Y`"``;`!A`'4`;@!C`&@`
+M9``L`"``=`!H`&4`(`!G`&4`;@!E`'(`80!L`"``8@!O`&\`=`!S`'0`<@!A
+M`'``(`!D`&$`90!M`&\`;@`Z`"``)0`Q``T`"@``````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````````````(````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+>````````````````````````````````````````
diff --git a/cpan/Sys-Syslog/win32/Win32.pm b/cpan/Sys-Syslog/win32/Win32.pm new file mode 100644 index 0000000000..70caf33143 --- /dev/null +++ b/cpan/Sys-Syslog/win32/Win32.pm @@ -0,0 +1,283 @@ +package Sys::Syslog::Win32; +use strict; +use warnings; +use Carp; +use File::Spec; + +# === WARNING === WARNING === WARNING === WARNING === WARNING === WARNING === +# +# This file was generated by Sys-Syslog/win32/compile.pl on Wed Aug 22 01:33:58 2007 +# Any changes being made here will be lost the next time Sys::Syslog +# is installed. +# +# Do NOT USE THIS MODULE DIRECTLY: this is a utility module for Sys::Syslog. +# It may change at any time to fit the needs of Sys::Syslog therefore no +# warranty is made WRT to its API. You Have Been Warned. +# +# === WARNING === WARNING === WARNING === WARNING === WARNING === WARNING === + +our $Source; +my $logger; +my $Registry; + +use Win32::EventLog; +use Win32::TieRegistry 0.20 ( + TiedRef => \$Registry, + Delimiter => "/", + ArrayValues => 1, + SplitMultis => 1, + AllowLoad => 1, + qw( + REG_SZ + REG_EXPAND_SZ + REG_DWORD + REG_BINARY + REG_MULTI_SZ + KEY_READ + KEY_WRITE + KEY_ALL_ACCESS + ), +); + +my $is_Cygwin = $^O =~ /Cygwin/i; +my $is_Win32 = $^O =~ /Win32/i; + +my %const = ( + CAT_KERN => 1, + CAT_USER => 2, + CAT_MAIL => 3, + CAT_DAEMON => 4, + CAT_AUTH => 5, + CAT_SYSLOG => 6, + CAT_LPR => 7, + CAT_NEWS => 8, + CAT_UUCP => 9, + CAT_CRON => 10, + CAT_AUTHPRIV => 11, + CAT_FTP => 12, + CAT_LOCAL0 => 13, + CAT_LOCAL1 => 14, + CAT_LOCAL2 => 15, + CAT_LOCAL3 => 16, + CAT_LOCAL4 => 17, + CAT_LOCAL5 => 18, + CAT_LOCAL6 => 19, + CAT_LOCAL7 => 20, + CAT_NETINFO => 21, + CAT_REMOTEAUTH => 22, + CAT_RAS => 23, + CAT_INSTALL => 24, + CAT_LAUNCHD => 25, + CAT_CONSOLE => 26, + CAT_NTP => 27, + CAT_SECURITY => 28, + CAT_AUDIT => 29, + CAT_LFMT => 30, + MSG_KERNEL => 128, + MSG_USER => 129, + MSG_MAIL => 130, + MSG_DAEMON => 131, + MSG_AUTH => 132, + MSG_SYSLOG => 133, + MSG_LPR => 134, + MSG_NEWS => 135, + MSG_UUCP => 136, + MSG_CRON => 137, + MSG_AUTHPRIV => 138, + MSG_FTP => 139, + MSG_LOCAL0 => 140, + MSG_LOCAL1 => 141, + MSG_LOCAL2 => 142, + MSG_LOCAL3 => 143, + MSG_LOCAL4 => 144, + MSG_LOCAL5 => 145, + MSG_LOCAL6 => 146, + MSG_LOCAL7 => 147, + MSG_NETINFO => 148, + MSG_REMOTEAUTH => 149, + MSG_RAS => 150, + MSG_INSTALL => 151, + MSG_LAUNCHD => 152, + MSG_CONSOLE => 153, + MSG_NTP => 154, + MSG_SECURITY => 155, + MSG_AUDIT => 156, + MSG_LFMT => 157, + STATUS_SEVERITY_SUCCESS => 0, + STATUS_SEVERITY_INFORMATIONAL => 1, + STATUS_SEVERITY_WARNING => 2, + STATUS_SEVERITY_ERROR => 3, + +); + +my %id2name = ( + Sys::Syslog::LOG_KERN() => 'KERN', + Sys::Syslog::LOG_USER() => 'USER', + Sys::Syslog::LOG_MAIL() => 'MAIL', + Sys::Syslog::LOG_DAEMON() => 'DAEMON', + Sys::Syslog::LOG_AUTH() => 'AUTH', + Sys::Syslog::LOG_SYSLOG() => 'SYSLOG', + Sys::Syslog::LOG_LPR() => 'LPR', + Sys::Syslog::LOG_NEWS() => 'NEWS', + Sys::Syslog::LOG_UUCP() => 'UUCP', + Sys::Syslog::LOG_CRON() => 'CRON', + Sys::Syslog::LOG_AUTHPRIV() => 'AUTHPRIV', + Sys::Syslog::LOG_FTP() => 'FTP', + Sys::Syslog::LOG_LOCAL0() => 'LOCAL0', + Sys::Syslog::LOG_LOCAL1() => 'LOCAL1', + Sys::Syslog::LOG_LOCAL2() => 'LOCAL2', + Sys::Syslog::LOG_LOCAL3() => 'LOCAL3', + Sys::Syslog::LOG_LOCAL4() => 'LOCAL4', + Sys::Syslog::LOG_LOCAL5() => 'LOCAL5', + Sys::Syslog::LOG_LOCAL6() => 'LOCAL6', + Sys::Syslog::LOG_LOCAL7() => 'LOCAL7', + Sys::Syslog::LOG_NETINFO() => 'NETINFO', + Sys::Syslog::LOG_REMOTEAUTH() => 'REMOTEAUTH', + Sys::Syslog::LOG_RAS() => 'RAS', + Sys::Syslog::LOG_INSTALL() => 'INSTALL', + Sys::Syslog::LOG_LAUNCHD() => 'LAUNCHD', + Sys::Syslog::LOG_CONSOLE() => 'CONSOLE', + Sys::Syslog::LOG_NTP() => 'NTP', + Sys::Syslog::LOG_SECURITY() => 'SECURITY', + Sys::Syslog::LOG_AUDIT() => 'AUDIT', + Sys::Syslog::LOG_LFMT() => 'LFMT', + +); + +my @priority2eventtype = ( + EVENTLOG_ERROR_TYPE(), # LOG_EMERG + EVENTLOG_ERROR_TYPE(), # LOG_ALERT + EVENTLOG_ERROR_TYPE(), # LOG_CRIT + EVENTLOG_ERROR_TYPE(), # LOG_ERR + EVENTLOG_WARNING_TYPE(), # LOG_WARNING + EVENTLOG_WARNING_TYPE(), # LOG_NOTICE + EVENTLOG_INFORMATION_TYPE(), # LOG_INFO + EVENTLOG_INFORMATION_TYPE(), # LOG_DEBUG +); + + +# +# _install() +# -------- +# Used to set up a connection to the eventlog. +# +sub _install { + return $logger if $logger; + + # can't just use basename($0) here because Win32 path often are a + # a mix of / and \, and File::Basename::fileparse() can't handle that, + # while File::Spec::splitpath() can.. Go figure.. + my (undef, undef, $basename) = File::Spec->splitpath($0); + ($Source) ||= $basename; + + $Source.=" [SSW:1.0.1]"; + + #$Registry->Delimiter("/"); # is this needed? + my $root = 'LMachine/SYSTEM/CurrentControlSet/Services/Eventlog/Application/'; + my $dll = 'Sys/Syslog/PerlLog.dll'; + + if (!$Registry->{$root.$Source} || + !$Registry->{$root.$Source.'/CategoryMessageFile'}[0] || + !-e $Registry->{$root.$Source.'/CategoryMessageFile'}[0] ) + { + + # find the resource DLL, which should be along Syslog.dll + my ($file) = grep { -e $_ } map { ("$_/$dll" => "$_/auto/$dll") } @INC; + $dll = $file if $file; + + # on Cygwin, convert the Unix path into absolute Windows path + if ($is_Cygwin) { + if ($] > 5.009005) { + chomp($file = Cygwin::posix_to_win_path($file, 1)); + } + else { + local $ENV{PATH} = ''; + chomp($dll = `/usr/bin/cygpath --absolute --windows "$dll"`); + } + } + + $dll =~ s![\\/]+!\\!g; # must be backslashes! + die "fatal: Can't find resource DLL for Sys::Syslog\n" if !$dll; + + $Registry->{$root.$Source} = { + '/EventMessageFile' => [ $dll, REG_EXPAND_SZ ], + '/CategoryMessageFile' => [ $dll, REG_EXPAND_SZ ], + '/CategoryCount' => [ '0x0000001e', REG_DWORD ], + #'/TypesSupported' => [ '0x0000001e', REG_DWORD ], + }; + + warn "Configured eventlog to use $dll for $Source\n" if $Sys::Syslog::DEBUG; + } + + #Carp::confess("Registry has the wrong value for '$Source', possibly mismatched dll!\nMine:$dll\nGot :$Registry->{$root.$Source.'/CategoryMessageFile'}[0]\n") + # if $Registry->{$root.$Source.'/CategoryMessageFile'}[0] ne $dll; + + # we really should do something useful with this but for now + # we set it to "" to prevent Win32::EventLog from warning + my $host = ""; + + $logger = Win32::EventLog->new($Source, $host) + or Carp::confess("Failed to connect to the '$Source' event log"); + + return $logger; +} + + +# +# _syslog_send() +# ------------ +# Used to convert syslog messages into eventlog messages +# +sub _syslog_send { + my ($buf, $numpri, $numfac) = @_; + $numpri ||= EVENTLOG_INFORMATION_TYPE(); + $numfac ||= Sys::Syslog::LOG_USER(); + my $name = $id2name{$numfac}; + + my $opts = { + EventType => $priority2eventtype[$numpri], + EventID => $const{"MSG_$name"}, + Category => $const{"CAT_$name"}, + Strings => "$buf\0", + Data => "", + }; + + if ($Sys::Syslog::DEBUG) { + require Data::Dumper; + warn Data::Dumper->Dump( + [$numpri, $numfac, $name, $opts], + [qw(numpri numfac name opts)] + ); + } + + return $logger->Report($opts); +} + + +=head1 NAME + +Sys::Syslog::Win32 - Win32 support for Sys::Syslog + +=head1 DESCRIPTION + +This module is a back-end plugin for C<Sys::Syslog>, for supporting the Win32 +event log. It is not expected to be directly used by any module other than +C<Sys::Syslog> therefore it's API may change at any time and no warranty is +made with regards to backward compatibility. You Have Been Warned. + +=head1 SEE ALSO + +L<Sys::Syslog> + +=head1 AUTHORS + +SE<eacute>bastien Aperghis-Tramoni and Yves Orton + +=head1 LICENSE + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +=cut + +1; diff --git a/cpan/Sys-Syslog/win32/compile.pl b/cpan/Sys-Syslog/win32/compile.pl new file mode 100644 index 0000000000..8502309bc7 --- /dev/null +++ b/cpan/Sys-Syslog/win32/compile.pl @@ -0,0 +1,277 @@ +#!perl +use strict; +use warnings; +use File::Basename; +use File::Copy; +use File::Path; + +my $name = shift || 'PerlLog'; + +# get the version from the message file +open(my $msgfh, '<', "$name.mc") or die "fatal: Can't read file '$name.mc': $!\n"; +my $top = <$msgfh>; +close($msgfh); + +my ($version) = $top =~ /Sys::Syslog Message File (\d+\.\d+\.\d+)/ + or die "error: File '$name.mc' doesn't have a version number\n"; + +# compile the message text files +system("mc -d $name.mc"); +system("rc $name.rc"); +system(qq{ link -nodefaultlib -incremental:no -release /nologo -base:0x60000000 } + .qq{ -comment:"Perl Syslog Message File v$version" } + .qq{ -machine:i386 -dll -noentry -out:$name.dll $name.res }); + +# uuencode the resource file +open(my $rsrc, '<', "$name.RES") or die "fatal: Can't read resource file '$name.RES': $!"; +binmode($rsrc); +my $uudata = pack "u", do { local $/; <$rsrc> }; +close($rsrc); + +open(my $uufh, '>', "$name\_RES.uu") or die "fatal: Can't write file '$name\_RES.uu': $!"; +print $uufh $uudata; +close($uufh); + +# uuencode the DLL +open(my $dll, '<', "$name.dll") or die "fatal: Can't read DLL '$name.dll': $!"; +binmode($dll); +$uudata = pack "u", do { local $/; <$dll> }; +close($dll); + +open($uufh, '>', "$name\_dll.uu") or die "fatal: Can't write file '$name\_dll.uu': $!"; +print $uufh $uudata; +close($uufh); + +# parse the generated header to extract the constants +open(my $header, '<', "$name.h") or die "fatal: Can't read header file '$name.h': $!"; +my %vals; +my $max = 0; + +while (<$header>) { + if (/^#define\s+(\w+)\s+(\d+)$/ || /^#define\s+(\w+)\s+\(\(DWORD\)(\d+)L\)/) { + $vals{$1} = $2; + if (substr($1, 0, 1) eq 'C') { + $max = $2 if $max < $2; + } + } +} + +close($header); + +my ($hash, $f2c, %fac); + +for my $name (sort { substr($a,0,1) cmp substr($b,0,1) || $vals{$a} <=> $vals{$b} } keys %vals) { + $hash .= " $name => $vals{$name},\n" ; + if ($name =~ /^CAT_(\w+)$/) { + $fac{$1} = $vals{$name}; + } +} + +for my $name (sort {$fac{$a} <=> $fac{$b}} keys %fac) { + $f2c .= " Sys::Syslog::LOG_$name() => '$name',\n"; +} + +# write the Sys::Syslog::Win32 module +open my $out, '>', "Win32.pm" or die "fatal: Can't write Win32.pm: $!"; +my $template = join '', <DATA>; +$template =~ s/__CONSTANT__/$hash/; +$template =~ s/__F2C__/$f2c/; +$template =~ s/__NAME_VER__/$name/; +$template =~ s/__VER__/$version/; +$max = sprintf "0x%08x", $max; +$template =~ s/__MAX__/'$max'/g; +$template =~ s/__TIME__/localtime()/ge; +print $out $template; +close $out; +print "Updated Win32.pm and relevent message files\n"; + +__END__ +package Sys::Syslog::Win32; +use strict; +use warnings; +use Carp; +use File::Spec; + +# === WARNING === WARNING === WARNING === WARNING === WARNING === WARNING === +# +# This file was generated by Sys-Syslog/win32/compile.pl on __TIME__ +# Any changes being made here will be lost the next time Sys::Syslog +# is installed. +# +# Do NOT USE THIS MODULE DIRECTLY: this is a utility module for Sys::Syslog. +# It may change at any time to fit the needs of Sys::Syslog therefore no +# warranty is made WRT to its API. You Have Been Warned. +# +# === WARNING === WARNING === WARNING === WARNING === WARNING === WARNING === + +our $Source; +my $logger; +my $Registry; + +use Win32::EventLog; +use Win32::TieRegistry 0.20 ( + TiedRef => \$Registry, + Delimiter => "/", + ArrayValues => 1, + SplitMultis => 1, + AllowLoad => 1, + qw( + REG_SZ + REG_EXPAND_SZ + REG_DWORD + REG_BINARY + REG_MULTI_SZ + KEY_READ + KEY_WRITE + KEY_ALL_ACCESS + ), +); + +my $is_Cygwin = $^O =~ /Cygwin/i; +my $is_Win32 = $^O =~ /Win32/i; + +my %const = ( +__CONSTANT__ +); + +my %id2name = ( +__F2C__ +); + +my @priority2eventtype = ( + EVENTLOG_ERROR_TYPE(), # LOG_EMERG + EVENTLOG_ERROR_TYPE(), # LOG_ALERT + EVENTLOG_ERROR_TYPE(), # LOG_CRIT + EVENTLOG_ERROR_TYPE(), # LOG_ERR + EVENTLOG_WARNING_TYPE(), # LOG_WARNING + EVENTLOG_WARNING_TYPE(), # LOG_NOTICE + EVENTLOG_INFORMATION_TYPE(), # LOG_INFO + EVENTLOG_INFORMATION_TYPE(), # LOG_DEBUG +); + + +# +# _install() +# -------- +# Used to set up a connection to the eventlog. +# +sub _install { + return $logger if $logger; + + # can't just use basename($0) here because Win32 path often are a + # a mix of / and \, and File::Basename::fileparse() can't handle that, + # while File::Spec::splitpath() can.. Go figure.. + my (undef, undef, $basename) = File::Spec->splitpath($0); + ($Source) ||= $basename; + + $Source.=" [SSW:__VER__]"; + + #$Registry->Delimiter("/"); # is this needed? + my $root = 'LMachine/SYSTEM/CurrentControlSet/Services/Eventlog/Application/'; + my $dll = 'Sys/Syslog/__NAME_VER__.dll'; + + if (!$Registry->{$root.$Source} || + !$Registry->{$root.$Source.'/CategoryMessageFile'}[0] || + !-e $Registry->{$root.$Source.'/CategoryMessageFile'}[0] ) + { + + # find the resource DLL, which should be along Syslog.dll + my ($file) = grep { -e $_ } map { ("$_/$dll" => "$_/auto/$dll") } @INC; + $dll = $file if $file; + + # on Cygwin, convert the Unix path into absolute Windows path + if ($is_Cygwin) { + if ($] > 5.009005) { + chomp($file = Cygwin::posix_to_win_path($file, 1)); + } + else { + local $ENV{PATH} = ''; + chomp($dll = `/usr/bin/cygpath --absolute --windows "$dll"`); + } + } + + $dll =~ s![\\/]+!\\!g; # must be backslashes! + die "fatal: Can't find resource DLL for Sys::Syslog\n" if !$dll; + + $Registry->{$root.$Source} = { + '/EventMessageFile' => [ $dll, REG_EXPAND_SZ ], + '/CategoryMessageFile' => [ $dll, REG_EXPAND_SZ ], + '/CategoryCount' => [ __MAX__, REG_DWORD ], + #'/TypesSupported' => [ __MAX__, REG_DWORD ], + }; + + warn "Configured eventlog to use $dll for $Source\n" if $Sys::Syslog::DEBUG; + } + + #Carp::confess("Registry has the wrong value for '$Source', possibly mismatched dll!\nMine:$dll\nGot :$Registry->{$root.$Source.'/CategoryMessageFile'}[0]\n") + # if $Registry->{$root.$Source.'/CategoryMessageFile'}[0] ne $dll; + + # we really should do something useful with this but for now + # we set it to "" to prevent Win32::EventLog from warning + my $host = ""; + + $logger = Win32::EventLog->new($Source, $host) + or Carp::confess("Failed to connect to the '$Source' event log"); + + return $logger; +} + + +# +# _syslog_send() +# ------------ +# Used to convert syslog messages into eventlog messages +# +sub _syslog_send { + my ($buf, $numpri, $numfac) = @_; + $numpri ||= EVENTLOG_INFORMATION_TYPE(); + $numfac ||= Sys::Syslog::LOG_USER(); + my $name = $id2name{$numfac}; + + my $opts = { + EventType => $priority2eventtype[$numpri], + EventID => $const{"MSG_$name"}, + Category => $const{"CAT_$name"}, + Strings => "$buf\0", + Data => "", + }; + + if ($Sys::Syslog::DEBUG) { + require Data::Dumper; + warn Data::Dumper->Dump( + [$numpri, $numfac, $name, $opts], + [qw(numpri numfac name opts)] + ); + } + + return $logger->Report($opts); +} + + +=head1 NAME + +Sys::Syslog::Win32 - Win32 support for Sys::Syslog + +=head1 DESCRIPTION + +This module is a back-end plugin for C<Sys::Syslog>, for supporting the Win32 +event log. It is not expected to be directly used by any module other than +C<Sys::Syslog> therefore it's API may change at any time and no warranty is +made with regards to backward compatibility. You Have Been Warned. + +=head1 SEE ALSO + +L<Sys::Syslog> + +=head1 AUTHORS + +SE<eacute>bastien Aperghis-Tramoni and Yves Orton + +=head1 LICENSE + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +=cut + +1; |