summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/ext/Sys
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/ext/Sys')
-rw-r--r--gnu/usr.bin/perl/ext/Sys/Syslog/Changes50
-rw-r--r--gnu/usr.bin/perl/ext/Sys/Syslog/README70
-rw-r--r--gnu/usr.bin/perl/ext/Sys/Syslog/fallback/const-c.inc559
-rw-r--r--gnu/usr.bin/perl/ext/Sys/Syslog/fallback/const-xs.inc87
-rwxr-xr-xgnu/usr.bin/perl/ext/Sys/Syslog/t/00-load.t9
-rwxr-xr-xgnu/usr.bin/perl/ext/Sys/Syslog/t/constants.t41
6 files changed, 816 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/ext/Sys/Syslog/Changes b/gnu/usr.bin/perl/ext/Sys/Syslog/Changes
new file mode 100644
index 00000000000..0a0e15e1478
--- /dev/null
+++ b/gnu/usr.bin/perl/ext/Sys/Syslog/Changes
@@ -0,0 +1,50 @@
+Revision history for Sys-Syslog
+
+0.13 2006.01.11
+ [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] RT#16980 (Alan Burlison): Sys::Syslog blows up rather
+ spectacularly on Solaris. Corrected by previous patches.
+ [TESTS] Applied Gisle Aas patch for a better handling of error messages,
+ then optimized it.
+ [TESTS] RT#16974: Failed test in t/podspell. This test is now skipped.
+
+0.12 2006.01.07
+ [CODE] Merged some modifications from bleadperl.
+ [DOC] Added a link to an article about Sys::Syslog.
+ [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
+ [BUGFIX] setlogmask() now behaves like its C counterpart.
+ [CODE] Can now export and use the macros.
+ [CODE] Support for three Exporter tags.
+ [CODE] XSLoader is now optional.
+ [CODE] No longer "use"s Sys::Hostname as it was "require"d where needed.
+ [CODE] RT#16604: Use local timestamp.
+ [DIST] Merged change from blead@26343
+ [DOC] Improved documentation.
+ [TESTS] Added more tests to t/syslog.t in order to increase code coverage.
+
+0.10 2005.12.08
+ [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
+ [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/gnu/usr.bin/perl/ext/Sys/Syslog/README b/gnu/usr.bin/perl/ext/Sys/Syslog/README
new file mode 100644
index 00000000000..0d468645ee5
--- /dev/null
+++ b/gnu/usr.bin/perl/ext/Sys/Syslog/README
@@ -0,0 +1,70 @@
+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
+
+ A ANSI-compliant compiler is required to compile the extension.
+
+ Sys::Syslog has been tested by the author on the following systems,
+ but is likely to run on many more:
+
+ - Linux 2.6, gcc 3.4.1
+ - FreeBSD 4.7, gcc 2.95.4
+ - Mac OS X 10.4, gcc 4.0.1
+
+ Sys::Syslog should on any Perl since 5.6.0. This module has been
+ tested by the author to check that it works with the following
+ versions ot Perl:
+
+ - Perl 5.6.2 i686-linux (custom build)
+ - Perl 5.8.5 i386-linux-thread-multi (vendor build)
+ - Perl 5.6.1 i386-freebsd (custom build)
+ - Perl 5.8.7 i386-freebsd (custom build)
+ - Perl 5.8.6 darwin-thread-multi-2level (vendor build)
+
+ 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
+
+ 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
+
+ This program is free software; you can redistribute it and/or modify it
+ under the same terms as Perl itself.
diff --git a/gnu/usr.bin/perl/ext/Sys/Syslog/fallback/const-c.inc b/gnu/usr.bin/perl/ext/Sys/Syslog/fallback/const-c.inc
new file mode 100644
index 00000000000..b0a08bdfa4e
--- /dev/null
+++ b/gnu/usr.bin/perl/ext/Sys/Syslog/fallback/const-c.inc
@@ -0,0 +1,559 @@
+#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_PID */
+ /* 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 '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;
+ }
+ 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
+ return PERL_constant_NOTDEF;
+#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_DEBUG LOG_EMERG _PATH_LOG */
+ /* Offset 4 gives the best switch position. */
+ switch (name[4]) {
+ case 'A':
+ 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 'D':
+ 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 'E':
+ 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 'H':
+ if (memEQ(name, "_PATH_LOG", 9)) {
+ /* ^ */
+#ifdef _PATH_LOG
+ *pv_return = _PATH_LOG;
+ return PERL_constant_ISPV;
+#else
+ *pv_return = "/dev/log";
+ 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_FACMASK 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
+ return PERL_constant_NOTDEF;
+#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;
+ }
+ 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
+
+#!/usr/bin/perl5.8.5 -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_LFMT 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_NFACILITIES LOG_NOTICE
+ LOG_NOWAIT LOG_ODELAY LOG_PERROR LOG_PID LOG_PRIMASK LOG_SYSLOG
+ LOG_USER LOG_UUCP LOG_WARNING),
+ {name=>"_PATH_LOG", type=>"PV", default=>["PV", "\"/dev/log\""]});
+
+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:
+ 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 15:
+ if (memEQ(name, "LOG_NFACILITIES", 15)) {
+#ifdef LOG_NFACILITIES
+ *iv_return = LOG_NFACILITIES;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
+#endif
+ }
+ break;
+ }
+ return PERL_constant_NOTFOUND;
+}
+
diff --git a/gnu/usr.bin/perl/ext/Sys/Syslog/fallback/const-xs.inc b/gnu/usr.bin/perl/ext/Sys/Syslog/fallback/const-xs.inc
new file mode 100644
index 00000000000..4da6b668050
--- /dev/null
+++ b/gnu/usr.bin/perl/ext/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/gnu/usr.bin/perl/ext/Sys/Syslog/t/00-load.t b/gnu/usr.bin/perl/ext/Sys/Syslog/t/00-load.t
new file mode 100755
index 00000000000..35d90426801
--- /dev/null
+++ b/gnu/usr.bin/perl/ext/Sys/Syslog/t/00-load.t
@@ -0,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'Sys::Syslog' );
+}
+
+#diag( "Testing Sys::Syslog $Sys::Syslog::VERSION, Perl $], $^X" );
diff --git a/gnu/usr.bin/perl/ext/Sys/Syslog/t/constants.t b/gnu/usr.bin/perl/ext/Sys/Syslog/t/constants.t
new file mode 100755
index 00000000000..d7c7b0c7dfe
--- /dev/null
+++ b/gnu/usr.bin/perl/ext/Sys/Syslog/t/constants.t
@@ -0,0 +1,41 @@
+#!/usr/bin/perl -T
+use strict;
+use File::Spec;
+use Test::More;
+
+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) && $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
+ }
+ }
+ }
+}