In order to better support the pkg tools we include Term::ReadKey with the base system, that means I totally forgot about it. So, this picks up a few years of updates.
This patch updates the 2.33 we have in-tree to the current 2.38. https://metacpan.org/changes/distribution/TermReadKey Comments? OK? Index: gnu/usr.bin/perl/MANIFEST =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/MANIFEST,v retrieving revision 1.56 diff -u -p -r1.56 MANIFEST --- gnu/usr.bin/perl/MANIFEST 30 Dec 2019 02:16:39 -0000 1.56 +++ gnu/usr.bin/perl/MANIFEST 25 Feb 2020 01:27:42 -0000 @@ -2024,8 +2024,8 @@ cpan/Term-ReadKey/example/test.pl Term: cpan/Term-ReadKey/genchars.pl Term::ReadKey cpan/Term-ReadKey/Makefile.PL Term::ReadKey cpan/Term-ReadKey/ppport.h Term::ReadKey -cpan/Term-ReadKey/ReadKey.pm Term::ReadKey cpan/Term-ReadKey/ReadKey.xs Term::ReadKey +cpan/Term-ReadKey/ReadKey.pm.PL Term::ReadKey cpan/Term-ReadKey/README Term::ReadKey cpan/Term-ReadKey/t/01_basic.t Term::ReadKey cpan/Term-ReadKey/t/02_terminal_functions.t Term::ReadKey Index: gnu/usr.bin/perl/cpan/Term-ReadKey/Changes =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Term-ReadKey/Changes,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 Changes --- gnu/usr.bin/perl/cpan/Term-ReadKey/Changes 7 May 2016 16:03:09 -0000 1.1.1.1 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/Changes 25 Feb 2020 01:27:42 -0000 @@ -1,240 +1,123 @@ -2015-06-04 Jonathan Stowe <[email protected]> +2.38 - 2019-01-05 + * Bundle up various changes including: + * Indexing improvements + * Makefile improvements for some make utils + * Various code cleanups and modernizations - * .gitignore, Changes, META.yml, README, ReadKey.pm: Up version +2.37 - 2016-10-07 -2015-06-04 Jonathan Stowe <[email protected]> + * Make minimum version of ExtUtils::MakeMaker 6.58 + * Better support parallel builds by making 'dynamic' a dependency of the ReadKey.pm + * Add a 'provides' META section to help indexing - * .gitignore: Add .bs file to .gitignore +2.36 - 2016-10-07 -2015-06-04 Jonathan Stowe <[email protected]> + * Add a package declaration to the ReadKey_pm.PL to aid indexing - * : Merge pull request #6 from ntyni/master Make genchars.pl output reproducible by sorting hash keys +2.35 - 2016-10-06 -2015-04-30 Jonathan Stowe <[email protected]> + * Use FULLPERLRUNINST to run the ReadKey_pm.PL to get the 'blib' - * Makefile.PL: Fix for "[rt.cpan.org #100932] Parallel build fails" - from Petr Pisar +2.34 - 2016-10-06 -2015-04-30 Jonathan Stowe <[email protected]> + * Fix GetTerminalSize() argument handling + * Fix miniperl build on Win32 + * Remove unused Cwd + * Fix TAP output + * Fix warnings in XS file + * Don't attempt some tests if STDIN is not a terminal + * Generate ReadKey.pm from ReadKey_pm.PL to expand blockoptions + * demand-load Carp, + * remove unneeded AutoLoader, + * Improve genchars.pl, support make -s silence. + * Improve Makefile.PL add SIGN, fix pure_site_install, support dual-life, fix realclean - * MANIFEST.SKIP: Add .git directory to the MANIFEST.SKIP +2.33 - 2015-06-04 -2015-04-13 Jonathan Stowe <[email protected]> + * Make genchars.pl output reproducible by sorting hash keys + * Fix for "[rt.cpan.org #100932] Parallel build fails" from Petr Pisar + * Move tests to t directory from Sébastien Deseille <[email protected]> + * Move original test to example directory + * Don't use 'resize' or 'stty' on MS Windows - * MANIFEST, MANIFEST.SKIP: Add new artefacts - -2015-04-13 Jonathan Stowe <[email protected]> - - * .travis.yml: Add travis-ci testing - -2015-04-13 Jonathan Stowe <[email protected]> - - * .gitignore: Add .gitignore - -2015-04-13 Jonathan Stowe <[email protected]> - - * : Merge pull request #5 from - sdeseille/Create_T_directory_and_split_test.pl Create t directory and split test.pl - -2015-04-11 Sébastien Deseille <[email protected]> - - * README: Update README to reflect the move of test.pl in example - subdirectory - -2015-04-11 Sébastien Deseille <[email protected]> - - * README: Revert "Update README to reflect the move of test.pl in - example subdirectory" This reverts commit 09402dcd68d8d0417e0eb2f9ea0aeaf4b4c72e9a. - -2015-04-11 Sébastien Deseille <[email protected]> - - * README: Update README to reflect the move of test.pl in example - subdirectory - -2015-04-11 Sébastien Deseille <[email protected]> - - * example/test.pl, test.pl: Move test.pl in example's subdirectory - in order to keep the possibility to use its interactive mode - -2015-04-11 Sébastien Deseille <[email protected]> - - * t/02_terminal_functions.t: Finished to implement all tests from - test.pl - -2015-04-11 Sébastien Deseille <[email protected]> - - * t/02_terminal_functions.t: Add test to Check TerminalSize OUT - -2015-04-11 Sébastien Deseille <[email protected]> - - * t/02_terminal_functions.t: Add test to Check non-blocking read - -2015-04-10 Sébastien Deseille <[email protected]> - - * t/02_terminal_functions.t: Add second test about Comparing - TerminalSize - -2015-04-10 Sébastien Deseille <[email protected]> - - * t/01_basic.t: Add first test to validate module loading - -2015-04-03 Jonathan Stowe <[email protected]> - - * : Merge pull request #3 from kmx/master no resize, no stty on MS Windows - -2014-05-10 Jonathan Stowe <[email protected]> - - * Changes: Update changes with git2cl (some manual reordering) - -2014-05-10 Jonathan Stowe <[email protected]> +2.32 - 2014-05-10 * Makefile.PL: Makefile.PL more specific + * Fix some warnings + * Don't index Configure.pm + * POD fixes + * Change licensing to optional Artistic -2014-05-10 Jonathan Stowe <[email protected]> - - * : Merge pull request #2 from jacquesg/warnings Fix some warnings - -2014-03-09 Jonathan Stowe <[email protected]> - - * Configure.pm, META.yml, Makefile.PL: Don't index Configure.pm - -2014-03-03 Jonathan Stowe <[email protected]> - - * Changes, README, ReadKey.pm: Added documentation patch as per - Chris Marshall Bumped version +2.31 - 2013-10-26 + + * Update pport.h + * Added additional metadata to Makefile.PL -2013-10-28 Jonathan Stowe <[email protected]> +2.30.02 - 2011-02-07 - * README: Some changes to README +2.30.01 - 2008-06-24 -2013-10-28 Brian Wightman <[email protected]> +2.30 - 2005-01-12 - * ReadKey.pm: Promote SUPPORT and LICENSE to top-level head sections SUPPORT and LICENSE sections were in item sections, but outside of - an over/back block. - -2013-10-27 Jonathan Stowe <[email protected]> - - * Makefile.PL, README, ReadKey.pm, ReadKey.xs, genchars.pl: Change - licensing Fix some warnings - -2013-10-26 Jonathan Stowe <[email protected]> - - * ReadKey.pm: Applied patch from rt #35669 - -2013-10-26 Jonathan Stowe <[email protected]> - - * Makefile.PL, ReadKey.xs: Applied change from rt #26235 Also fixed - repo name - -2013-10-26 Jonathan Stowe <[email protected]> - - * ReadKey.pm: Patch from rt #35671 - -2013-10-26 Jonathan Stowe <[email protected]> - - * ppport.h: Updated ppport.h as per #78831 - -2013-10-26 Jonathan Stowe <[email protected]> - - * Makefile.PL: Changed distname per RT #87885 Added additional - metadata - -2013-10-26 Jonathan Stowe <[email protected]> - - * ReadKey.pm: Added changes for RT #86584 - -2013-10-26 Jonathan Stowe <[email protected]> - - * ReadKey.pm: Added patch from [email protected] for RT #88266 - -2011-04-19 Jonathan Stowe <[email protected]> - - * Changes: Added Changes - -2011-04-19 Jonathan Stowe <[email protected]> - - * : commit 40ba6a2a80ae495b921ab416f6b024014daac25e Author: Stas - Grabois <CENSORED> Date: Tue Jun 24 01:57:37 2008 -0800 - -2006-01-13 jonathan <jonathan@d4a3e428-c23c-0410-a93a-b1ce904c0fb3> - - * MANIFEST, Makefile.PL: Added Changes git-svn-id: http://jstowe.googlecode.com/svn/trunk/TermReadKey@74 - d4a3e428-c23c-0410-a93a-b1ce904c0fb3 - -2005-01-11 jonathan <jonathan@d4a3e428-c23c-0410-a93a-b1ce904c0fb3> - - * test.pl: Skip tests if /dev/tty for automated testing git-svn-id: http://jstowe.googlecode.com/svn/trunk/TermReadKey@53 - d4a3e428-c23c-0410-a93a-b1ce904c0fb3 - -2005-01-11 jonathan <jonathan@d4a3e428-c23c-0410-a93a-b1ce904c0fb3> - - * ReadKey.pm: Fixed POD git-svn-id: http://jstowe.googlecode.com/svn/trunk/TermReadKey@52 - d4a3e428-c23c-0410-a93a-b1ce904c0fb3 - -2005-01-11 jonathan <jonathan@d4a3e428-c23c-0410-a93a-b1ce904c0fb3> - - * README, ReadKey.pm, ReadKey.xs, genchars.pl, ppport.h: * Updated ppport.h * Fixed example in synopsis * termio branch not updated git-svn-id: http://jstowe.googlecode.com/svn/trunk/TermReadKey@51 - d4a3e428-c23c-0410-a93a-b1ce904c0fb3 - -2004-03-02 jonathan <jonathan@d4a3e428-c23c-0410-a93a-b1ce904c0fb3> - - * Put back in CVS git-svn-id: http://jstowe.googlecode.com/svn/trunk/TermReadKey@19 - d4a3e428-c23c-0410-a93a-b1ce904c0fb3 - -2005-01-12 Jonathan Stowe <[email protected]> - - * Configure.pm, MANIFEST, META.yml, Makefile.PL, README, - ReadKey.pm, ReadKey.xs, genchars.pl, ppport.h, test.pl: import - TermReadKey 2.30 from CPAN git-cpan-module: TermReadKey git-cpan-version: 2.30 - git-cpan-authorid: JSTOWE git-cpan-file: - authors/id/J/JS/JSTOWE/TermReadKey-2.30.tar.gz + * Skip tests if /dev/tty for automated testing + * Fixed POD + * Fixed example in synopsis + * Update ppport.h -2002-07-28 Jonathan Stowe <[email protected]> +2.21 - 2002-07-28 + 2002-07-28 Jonathan Stowe <[email protected]> * README, ReadKey.pm, ReadKey.xs, ppport.h, test.pl: import TermReadKey 2.21 from CPAN git-cpan-module: TermReadKey git-cpan-version: 2.21 git-cpan-authorid: JSTOWE git-cpan-file: authors/id/J/JS/JSTOWE/TermReadKey-2.21.tar.gz -2002-05-24 Jonathan Stowe <[email protected]> +2.20 - 2002-05-24 + 2002-05-24 Jonathan Stowe <[email protected]> * README, ReadKey.pm, ReadKey.xs: import TermReadKey 2.20 from CPAN git-cpan-module: TermReadKey git-cpan-version: 2.20 git-cpan-authorid: JSTOWE git-cpan-file: authors/id/J/JS/JSTOWE/TermReadKey-2.20.tar.gz -2002-03-21 Jonathan Stowe <[email protected]> +2.19 - 2002-03-21 + 2002-03-21 Jonathan Stowe <[email protected]> * README, ReadKey.pm, ReadKey.xs: import TermReadKey 2.19 from CPAN git-cpan-module: TermReadKey git-cpan-version: 2.19 git-cpan-authorid: JSTOWE git-cpan-file: authors/id/J/JS/JSTOWE/TermReadKey-2.19.tar.gz -2002-02-10 Jonathan Stowe <[email protected]> +2.18 - 2002-02-10 + 2002-02-10 Jonathan Stowe <[email protected]> * Configure.pm, Makefile.PL, README, ReadKey.pm, ReadKey.xs, genchars.pl: import TermReadKey 2.18 from CPAN git-cpan-module: TermReadKey git-cpan-version: 2.18 git-cpan-authorid: JSTOWE git-cpan-file: authors/id/J/JS/JSTOWE/TermReadKey-2.18.tar.gz -2002-01-25 Jonathan Stowe <[email protected]> +2.17 - 2002-01-25 + 2002-01-25 Jonathan Stowe <[email protected]> * Makefile.PL, README, ReadKey.pm, ReadKey.xs, test.pl: import TermReadKey 2.17 from CPAN git-cpan-module: TermReadKey git-cpan-version: 2.17 git-cpan-authorid: JSTOWE git-cpan-file: authors/id/J/JS/JSTOWE/TermReadKey-2.17.tar.gz -2001-11-29 Jonathan Stowe <[email protected]> +2.16 - 2001-11-29 + 2001-11-29 Jonathan Stowe <[email protected]> * ReadKey.pm, ReadKey.xs, genchars.pl, ppport.h: import TermReadKey 2.16 from CPAN git-cpan-module: TermReadKey git-cpan-version: 2.16 git-cpan-authorid: JSTOWE git-cpan-file: authors/id/J/JS/JSTOWE/TermReadKey-2.16.tar.gz -2001-11-07 Jonathan Stowe <[email protected]> +2.15 - 2001-11-07 + 2001-11-07 Jonathan Stowe <[email protected]> * ReadKey.pm, ReadKey.xs: import TermReadKey 2.15 from CPAN git-cpan-module: TermReadKey git-cpan-version: 2.15 git-cpan-authorid: JSTOWE git-cpan-file: authors/id/J/JS/JSTOWE/TermReadKey-2.15.tar.gz +2.14 - 1999-03-29 1999-03-29 Kenneth Albanowski <[email protected]> * Makefile.PL, ReadKey.pm, ReadKey.xs, ppport.h: import TermReadKey @@ -242,6 +125,7 @@ git-cpan-authorid: KJALB git-cpan-file: authors/id/K/KJ/KJALB/TermReadKey-2.14.tar.gz +2.13 - 1999-03-24 1999-03-24 Kenneth Albanowski <[email protected]> * MANIFEST, Makefile.PL, README, ReadKey.pm, ReadKey.xs, @@ -249,6 +133,7 @@ git-cpan-authorid: KJALB git-cpan-file: authors/id/K/KJ/KJALB/TermReadKey-2.13.tar.gz +2.12 - 1998-01-07 1998-01-07 Kenneth Albanowski <[email protected]> * Makefile.PL, README, ReadKey.pm, ReadKey.xs, test.pl: import @@ -256,6 +141,7 @@ git-cpan-authorid: KJALB git-cpan-file: authors/id/K/KJ/KJALB/TermReadKey-2.12.tar.gz +2.11 - 1997-12-14 1997-12-13 Kenneth Albanowski <[email protected]> * Makefile.PL, README, ReadKey.pm, ReadKey.xs, test.pl: import @@ -263,6 +149,7 @@ git-cpan-authorid: KJALB git-cpan-file: authors/id/K/KJ/KJALB/TermReadKey-2.11.tar.gz +2.09 - 1997-10-07 1997-10-07 Kenneth Albanowski <[email protected]> * Makefile.PL, ReadKey.pm, ReadKey.xs, genchars.pl: import @@ -270,6 +157,7 @@ git-cpan-authorid: KJALB git-cpan-file: authors/id/K/KJ/KJALB/TermReadKey-2.09.tar.gz +2.08 - 1997-10-06 1997-10-06 Kenneth Albanowski <[email protected]> * Makefile.PL, README, ReadKey.pm, ReadKey.xs: import TermReadKey @@ -277,6 +165,7 @@ git-cpan-authorid: KJALB git-cpan-file: authors/id/K/KJ/KJALB/TermReadKey-2.08.tar.gz +2.07 - 1997-01-27 1997-01-27 Kenneth Albanowski <[email protected]> * Makefile.PL, ReadKey.pm, ReadKey.xs: import TermReadKey 2.07 from @@ -284,6 +173,7 @@ git-cpan-authorid: KJALB git-cpan-file: authors/id/K/KJ/KJALB/TermReadKey-2.07.tar.gz +2.06 - 1996-11-26 1996-11-25 Kenneth Albanowski <[email protected]> * Makefile.PL, README, ReadKey.pm, ReadKey.xs, test.pl: import @@ -291,6 +181,7 @@ git-cpan-authorid: KJALB git-cpan-file: authors/id/K/KJ/KJALB/TermReadKey-2.06.tar.gz +2.05 - 1996-03-14 1996-03-14 Kenneth Albanowski <[email protected]> * Makefile.PL, README, ReadKey.pm, ReadKey.xs: import TermReadKey @@ -298,12 +189,14 @@ git-cpan-authorid: KJALB git-cpan-file: authors/id/K/KJ/KJALB/TermReadKey-2.05.tar.gz +2.04 - 1995-10-11 1995-10-11 Kenneth Albanowski <[email protected]> * Makefile.PL, README, ReadKey.xs: import TermReadKey 2.04 from CPAN git-cpan-module: TermReadKey git-cpan-version: 2.04 git-cpan-authorid: KJALB git-cpan-file: authors/id/K/KJ/KJALB/TermReadKey-2.04.tar.gz +2.03 - 1995-09-29 1995-09-29 Kenneth Albanowski <[email protected]> * Configure.pm, MANIFEST, Makefile.PL, README, ReadKey.pm, Index: gnu/usr.bin/perl/cpan/Term-ReadKey/Configure.pm =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Term-ReadKey/Configure.pm,v retrieving revision 1.3 diff -u -p -r1.3 Configure.pm --- gnu/usr.bin/perl/cpan/Term-ReadKey/Configure.pm 3 Jul 2016 01:07:58 -0000 1.3 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/Configure.pm 25 Feb 2020 01:27:42 -0000 @@ -16,10 +16,9 @@ # for when no_index is not enough package -Configure; + Configure; use strict; - use vars qw(@EXPORT @ISA); use Carp; @@ -71,7 +70,7 @@ levels of specificity, so here is a summ CheckHeader: Look for headers. -CheckStructure: Look for a structure. +CheckStructure: Look for a structure. CheckField: Look for a field in a structure. @@ -85,11 +84,11 @@ GetTextSymbol: Get the contents of a sy GetNumericSymbol: Get the contents of a symbol as a number. -Apply: Try compiling code with a set of headers and libs. +Apply: Try compiling code with a set of headers and libs. ApplyHeaders: Try compiling code with a set of headers. -ApplyLibraries: Try linking code with a set of libraries. +ApplyLibraries: Try linking code with a set of libraries. ApplyHeadersAndLibaries: You get the idea. @@ -99,7 +98,7 @@ CPP: Feed some code through the C prepr Compile: Try to compile some C code. -Link: Try to compile & link some C code. +Link: Try to compile & link some C code. Execute: Try to compile, link, & execute some C code. @@ -175,7 +174,7 @@ sub Compile { # Feed code to compiler. O my($result) = scalar(`$C_cc $C_ccflags -c $in $C_ldflags $C_libs $options 2>&1`); print "Executing '$C_cc $C_ccflags -c $in $C_ldflags $C_libs $options 2>&1'\n" if $Verbose; my($error) = $?; - my($error2) = ! -e $out; + my($error2) = ! -e $out; unlink($in,$out); return (($error || $error2) ? 0 : 1) unless wantarray; ($error,$result,$error2); @@ -427,11 +426,12 @@ sub Apply { # @l = split(/\s+/,$lookup[$i+1]); } - if($ret=&{$cmd == \&Link && !@l?\&Compile:$cmd}(join("",map($_?"#include <$_>\n":"",grep(!/^-I/,@h))). + if ($ret=&{$cmd == \&Link && !@l?\&Compile:$cmd}( + join("",map($_?"#include <$_>\n":"",grep(!/^-I/,@h))). $code,grep(/^-I/,@h),@l)) { print "Ret=|$ret|\n" if $Verbose; return $ret unless wantarray; - return (join(" ",@h),join(" ",@l)); + return (join(" ",@h),join(" ",@l)); } } return 0 unless wantarray; @@ -531,7 +531,7 @@ be returned if nothing succeeds. sub CheckField { # Check for the existance of specified field in structure my($structname,$fieldname,@headers) = @_; ApplyHeaders("main(){ struct $structname s1; struct $structname s2; - s1.$fieldname = s2.$fieldname; }",@headers); + s1.$fieldname = s2.$fieldname; }",@headers); } =head2 CheckLSymbol @@ -592,7 +592,7 @@ sub CheckHPrototype { # Check for header my($function,$proto,@headers) = @_; my(@proto) = @{$proto}; ApplyHeaders("main() { extern ".$proto[0]." $function(". - join(",",@proto[1..$#proto])."); }",@headers); + join(",",@proto[1..$#proto])."); }",@headers); } =head2 GetSymbol @@ -705,48 +705,61 @@ sub DeducePrototype { if($firstdeduce) { $firstdeduce=0; - my $checknumber=!Compile("extern int func(int a,int b); - extern int func(int a,int b,int c); - main(){}"); - $checkreturn=!Compile("extern int func(int a,int b); - extern long func(int a,int b); - main(){}"); - my $checketc= !Compile("extern int func(int a,int b); - extern long func(int a,...); - main(){}"); - my $checknumberetc=!Compile("extern int func(int a,int b); - extern int func(int a,int b,...); - main(){}"); - my $checketcnumber=!Compile("extern int func(int a,int b,int c,...); - extern int func(int a,int b,...); - main(){}"); - my $checkargtypes=!Compile("extern int func(int a); - extern int func(long a); - main(){}"); - my $checkargsnil=!Compile("extern int func(); - extern int func(int a,int b,int c); - main(){}"); - $checknilargs=!Compile("extern int func(int a,int b,int c); - extern int func(); - main(){}"); - my $checkargsniletc=!Compile("extern int func(...); - extern int func(int a,int b,int c); - main(){}"); - $checkniletcargs=!Compile("extern int func(int a,int b,int c); - extern int func(...); - main(){}"); - - my $checkconst=!Compile("extern int func(const int * a); - extern int func(int * a); - main(){ }"); - - my $checksign=!Compile("extern int func(int a); - extern int func(unsigned int a); - main(){ }"); - - $checkreturnnil=!Compile("extern func(int a); - extern void func(int a); - main(){ }"); + my $checknumber=!Compile(" +extern int func(int a,int b); +extern int func(int a,int b,int c); +main(){}"); + $checkreturn=!Compile(" +extern int func(int a,int b); +extern long func(int a,int b); +main(){}"); + my $checketc= !Compile(" +extern int func(int a,int b); +extern long func(int a,...); +main(){}"); + my $checknumberetc=!Compile(" +extern int func(int a,int b); +extern int func(int a,int b,...); +main(){}"); + my $checketcnumber=!Compile(" +extern int func(int a,int b,int c,...); +extern int func(int a,int b,...); +main(){}"); + my $checkargtypes=!Compile(" +extern int func(int a); +extern int func(long a); +main(){}"); + my $checkargsnil=!Compile(" +extern int func(); +extern int func(int a,int b,int c); +main(){}"); + $checknilargs=!Compile(" +extern int func(int a,int b,int c); +extern int func(); +main(){}"); + my $checkargsniletc=!Compile(" +extern int func(...); +extern int func(int a,int b,int c); +main(){}"); + $checkniletcargs=!Compile(" +extern int func(int a,int b,int c); +extern int func(...); +main(){}"); + + my $checkconst=!Compile(" +extern int func(const int * a); +extern int func(int * a); +main(){ }"); + + my $checksign=!Compile(" +extern int func(int a); +extern int func(unsigned int a); +main(){ }"); + + $checkreturnnil=!Compile(" +extern func(int a); +extern void func(int a); +main(){ }"); @types = sort grep(Compile("main(){$_ a;}"), "void","int","long int","unsigned int","unsigned long int","long long int", @@ -765,11 +778,13 @@ sub DeducePrototype { for ($i=0;$i<=$#types;$i++) { for ($j=$i+1;$j<=$#types;$j++) { next if $j==$i; - if(Compile("extern void func($types[$i]); - extern void func($types[$j]); main(){}")) { - print "Removing type $types[$j] because it equals $types[$i]\n"; - splice(@types,$j,1); - $j--; + if(Compile(" +extern void func($types[$i]); +extern void func($types[$j]); +main(){}")) { + print "Removing type $types[$j] because it equals $types[$i]\n"; + splice(@types,$j,1); + $j--; } } } @@ -777,8 +792,10 @@ sub DeducePrototype { for ($i=0;$i<=$#types;$i++) { for ($j=$i+1;$j<=$#types;$j++) { next if $j==$i; - if(Compile("$types[$i] func(void); - extern $types[$j] func(void); main(){}")) { + if(Compile(" +$types[$i] func(void); +extern $types[$j] func(void); +main(){}")) { print "Removing type $types[$j] because it equals $types[$i]\n"; splice(@types,$j,1); $j--; Index: gnu/usr.bin/perl/cpan/Term-ReadKey/MANIFEST =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Term-ReadKey/MANIFEST,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 MANIFEST --- gnu/usr.bin/perl/cpan/Term-ReadKey/MANIFEST 7 May 2016 16:03:09 -0000 1.1.1.1 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/MANIFEST 25 Feb 2020 01:27:42 -0000 @@ -3,7 +3,7 @@ MANIFEST MANIFEST.SKIP Makefile.PL README -ReadKey.pm +ReadKey.pm.PL ReadKey.xs genchars.pl ppport.h @@ -11,5 +11,6 @@ example/test.pl t/01_basic.t t/02_terminal_functions.t Changes -META.yml Module meta-data (added by MakeMaker) +META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) +SIGNATURE Public-key signature (added by MakeMaker) Index: gnu/usr.bin/perl/cpan/Term-ReadKey/MANIFEST.SKIP =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Term-ReadKey/MANIFEST.SKIP,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 MANIFEST.SKIP --- gnu/usr.bin/perl/cpan/Term-ReadKey/MANIFEST.SKIP 7 May 2016 16:03:08 -0000 1.1.1.1 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/MANIFEST.SKIP 25 Feb 2020 01:27:42 -0000 @@ -1,3 +1,4 @@ .gitignore .travis.yml .git +.gz Index: gnu/usr.bin/perl/cpan/Term-ReadKey/META.json =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Term-ReadKey/META.json,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 META.json --- gnu/usr.bin/perl/cpan/Term-ReadKey/META.json 7 May 2016 16:03:09 -0000 1.1.1.1 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/META.json 25 Feb 2020 01:27:42 -0000 @@ -1,23 +1,20 @@ { - "abstract" : "unknown", + "abstract" : "Change terminal modes, and perform non-blocking reads.", "author" : [ - "unknown" + "Kenneth Albanowski", + "Jonathan Stowe" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142060", + "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" + "version" : 2 }, "name" : "TermReadKey", "no_index" : { - "directory" : [ - "t", - "inc" - ], "file" : [ "Configure.pm" ], @@ -28,15 +25,21 @@ "prereqs" : { "build" : { "requires" : { - "ExtUtils::MakeMaker" : "0" + "ExtUtils::MakeMaker" : "6.58" } }, "configure" : { "requires" : { - "ExtUtils::MakeMaker" : "0" + "ExtUtils::MakeMaker" : "6.58" } } }, + "provides" : { + "Term::ReadKey" : { + "file" : "ReadKey.pm.PL", + "version" : "2.38" + } + }, "release_status" : "stable", "resources" : { "repository" : { @@ -45,5 +48,6 @@ "web" : "https://github.com/jonathanstowe/TermReadKey" } }, - "version" : "2.33" + "version" : "2.38", + "x_serialization_backend" : "JSON::PP version 2.97001" } Index: gnu/usr.bin/perl/cpan/Term-ReadKey/META.yml =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Term-ReadKey/META.yml,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 META.yml --- gnu/usr.bin/perl/cpan/Term-ReadKey/META.yml 7 May 2016 16:03:08 -0000 1.1.1.1 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/META.yml 25 Feb 2020 01:27:42 -0000 @@ -1,26 +1,29 @@ --- -abstract: unknown +abstract: 'Change terminal modes, and perform non-blocking reads.' author: - - unknown + - 'Kenneth Albanowski' + - 'Jonathan Stowe' build_requires: - ExtUtils::MakeMaker: '0' + ExtUtils::MakeMaker: '6.58' configure_requires: - ExtUtils::MakeMaker: '0' + ExtUtils::MakeMaker: '6.58' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142060' +generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: TermReadKey no_index: - directory: - - t - - inc file: - Configure.pm package: - Configure +provides: + Term::ReadKey: + file: ReadKey.pm.PL + version: '2.38' resources: repository: https://github.com/jonathanstowe/TermReadKey.git -version: '2.33' +version: '2.38' +x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Index: gnu/usr.bin/perl/cpan/Term-ReadKey/Makefile.PL =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Term-ReadKey/Makefile.PL,v retrieving revision 1.3 diff -u -p -r1.3 Makefile.PL --- gnu/usr.bin/perl/cpan/Term-ReadKey/Makefile.PL 3 Jul 2016 01:07:58 -0000 1.3 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/Makefile.PL 25 Feb 2020 01:27:42 -0000 @@ -1,20 +1,37 @@ /VERS+use strict; +use warnings; use ExtUtils::MakeMaker; use Carp; -my $mm_version = $ExtUtils::MakeMaker::VERSION || $ExtUtils::MakeMaker::Version; -if( $mm_version < 3.5 ) { - croak("Sorry, but MakeMaker 3.5 or better is needed to build this package."); +my $mm_version = $ExtUtils::MakeMaker::VERSION; +if ( $mm_version < 6.58 ) { + croak("Sorry, but MakeMaker 6.58 or better is needed to build this package."); } -&WriteMakefile( - NAME => 'Term::ReadKey', - DISTNAME => 'TermReadKey', - LICENSE => 'perl', - META_MERGE => { +WriteMakefile( + NAME => 'Term::ReadKey', + DISTNAME => 'TermReadKey', + LICENSE => 'perl', + ABSTRACT => 'Change terminal modes, and perform non-blocking reads.', + AUTHOR => ['Kenneth Albanowski','Jonathan Stowe'], + CONFIGURE_REQUIRES => { + 'ExtUtils::MakeMaker' => 6.58, + }, + BUILD_REQUIRES => { + 'ExtUtils::MakeMaker' => 6.58, + }, + META_ADD => { # needs to _ADD because I want over-ride the dynamic_config + dynamic_config => 1, no_index => { - file => [qw(Configure.pm)], - package => [qw(Configure)], + file => [ qw(Configure.pm) ], + package => [ qw(Configure) ], + }, + provides => { + 'Term::ReadKey' => { + file => 'ReadKey.pm.PL', + version => '2.38', + }, }, 'meta-spec' => { version => 2 }, resources => { @@ -25,62 +42,62 @@ if( $mm_version < 3.5 ) { }, }, }, - VERSION_FROM => 'ReadKey.pm', - XSPROTOARG => '-noprototypes', - PM => { "ReadKey.pm" => '$(INST_LIBDIR)/ReadKey.pm'}, - - 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" }, - "test" => { - "TESTS" => "t/*.t" - } - -# Uncomment these to allow testing of sgtty under Linux. Not needed normally. -# INC => "-I/usr/include/bsd", -# LIBS => "-lbsd" + VERSION_FROM => 'ReadKey.pm.PL', + XSPROTOARG => '-noprototypes', + PL_FILES => { 'ReadKey.pm.PL' => 'ReadKey.pm' }, + PM => { 'ReadKey.pm' => '$(INST_ARCHLIBDIR)/ReadKey.pm' }, + clean => { FILES => 'cchars.h ReadKey.pm' }, + SIGN => 1, + + # Uncomment these to allow testing of sgtty under Linux. Not needed normally. + # INC => "-I/usr/include/bsd", + # LIBS => "-lbsd" ); -sub MY::realclean { - my $self = shift; - $_ = $self->MM::realclean(); - s/\t/\trm -f cchars.h\n\t/; - $_; -} - sub MY::top_targets { - my $self = shift; - $_ = $self->MM::top_targets(); - $_ .= " + my $self = shift; + $_ = $self->MM::top_targets(); + # ensure that the XS is built before the PM + s/pure_all :: config pm_to_blib (.* )linkext/pure_all :: config linkext pm_to_blib $1/; + + $_ .= " sgtty cchars.h: genchars.pl - \$(PERL) -I. -I\$(PERL_LIB) genchars.pl + \$(PERLRUN) genchars.pl distcc: genchars.pl - \$(PERL) -I. -I\$(PERL_LIB) genchars.pl dist + \$(PERLRUN) genchars.pl dist -ReadKey.c: cchars.h +ReadKey\$(OBJ_EXT): ReadKey.c cchars.h "; - $_; + return $_; +} +# The template needs DynaLoader. don't use miniperl (dual-life only) +sub MY::processPL { + my $self = shift; + $_ = $self->MM::processPL(); + s/ReadKey.pm :: ReadKey.pm.PL/ReadKey.pm :: ReadKey.pm.PL dynamic/; + s/\$\(PERLRUN\)/\$(FULLPERLRUNINST)/; + return $_; } sub MY::test { - my $self = shift; - $_ = $self->MM::test(); - s#example/test.pl#-w example/test.pl#; - $_; + my $self = shift; + $_ = $self->MM::test(); + s#example/test.pl#-w example/test.pl#; + return $_; } -sub MY::test_interactive -{ +sub MY::test_interactive { return "Fooo"; } -sub MY::pure_site_install -{ +sub MY::pure_site_install { my $self = shift; my $new = $self->MM::test(); - $new .= "\n\t./register_module Your::Module"; + $new .= "\n\t./register_module Term::ReadKey"; return $new; } Index: gnu/usr.bin/perl/cpan/Term-ReadKey/README =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Term-ReadKey/README,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 README --- gnu/usr.bin/perl/cpan/Term-ReadKey/README 7 May 2016 16:03:09 -0000 1.1.1.1 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/README 25 Feb 2020 01:27:42 -0000 @@ -1,7 +1,7 @@ - Term::ReadKey 2.33 - Change terminal modes, and perform non-blocking reads. + Term::ReadKey 2.36 - Change terminal modes, and perform non-blocking reads. Copyright (C) 1994-1999 Kenneth Albanowski. - 2001-2015 Jonathan Stowe and others + 2001-2016 Jonathan Stowe and others This package is dual licensed. You can either choose to license it under the original terms which were: Index: gnu/usr.bin/perl/cpan/Term-ReadKey/ReadKey.pm.PL =================================================================== RCS file: gnu/usr.bin/perl/cpan/Term-ReadKey/ReadKey.pm.PL diff -N gnu/usr.bin/perl/cpan/Term-ReadKey/ReadKey.pm.PL --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/ReadKey.pm.PL 25 Feb 2020 01:27:42 -0000 @@ -0,0 +1,733 @@ +#! perl + +package Term::ReadKey; + +# This also needs to be adjusted in the generated code below +# and in the Makefile.PL +use vars qw($VERSION); + +$VERSION = '2.38'; + +use Config; +use File::Basename qw(&basename &dirname); +use File::Spec; +use Cwd; + +# List explicitly here the variables you want Configure to +# generate. Metaconfig only looks for shell variables, so you +# have to mention them as if they were shell variables, not +# %Config entries. Thus you write +# $startperl +# to ensure Configure will look for $Config{startperl}. +# Wanted: $archlibexp + +# This forces PL files to create target in same directory as PL file. +# This is so that make depend always knows where to find PL derivatives. +my $origdir = cwd; +my $dir = dirname($0); +chdir $dir; +my $file = 'ReadKey.pm'; + +open OUT, ">", $file or die "Can't create $file: $!"; + +print "Creating $file\n"; + +print OUT <<'!FIRSTPART'; +# -*- buffer-read-only: t -*- +# +# This file is auto-generated. ***ANY*** changes here will be lost +# +package Term::ReadKey; + +use strict; +use warnings; + +=head1 NAME + +Term::ReadKey - A perl module for simple terminal control + +=head1 SYNOPSIS + + use Term::ReadKey; + ReadMode 4; # Turn off controls keys + while (not defined ($key = ReadKey(-1))) { + # No key yet + } + print "Get key $key\n"; + ReadMode 0; # Reset tty mode before exiting + +=head1 DESCRIPTION + +Term::ReadKey is a compiled perl module dedicated to providing simple +control over terminal driver modes (cbreak, raw, cooked, etc.,) support for +non-blocking reads, if the architecture allows, and some generalized handy +functions for working with terminals. One of the main goals is to have the +functions as portable as possible, so you can just plug in "use +Term::ReadKey" on any architecture and have a good likelihood of it working. + +Version 2.30.01: +Added handling of arrows, page up/down, home/end, insert/delete keys +under Win32. These keys emit xterm-compatible sequences. +Works with Term::ReadLine::Perl. + +=over 4 + +=item ReadMode MODE [, Filehandle] + +Takes an integer argument or a string synonym (case insensitive), which +can currently be one of the following values: + + INT SYNONYM DESCRIPTION + + 0 'restore' Restore original settings. + + 1 'normal' Change to what is commonly the default mode, + echo on, buffered, signals enabled, Xon/Xoff + possibly enabled, and 8-bit mode possibly disabled. + + 2 'noecho' Same as 1, just with echo off. Nice for + reading passwords. + + 3 'cbreak' Echo off, unbuffered, signals enabled, Xon/Xoff + possibly enabled, and 8-bit mode possibly enabled. + + 4 'raw' Echo off, unbuffered, signals disabled, Xon/Xoff + disabled, and 8-bit mode possibly disabled. + + 5 'ultra-raw' Echo off, unbuffered, signals disabled, Xon/Xoff + disabled, 8-bit mode enabled if parity permits, + and CR to CR/LF translation turned off. + + +These functions are automatically applied to the STDIN handle if no +other handle is supplied. Modes 0 and 5 have some special properties +worth mentioning: not only will mode 0 restore original settings, but it +cause the next ReadMode call to save a new set of default settings. Mode +5 is similar to mode 4, except no CR/LF translation is performed, and if +possible, parity will be disabled (only if not being used by the terminal, +however. It is no different from mode 4 under Windows.) + +If you just need to read a key at a time, then modes 3 or 4 are probably +sufficient. Mode 4 is a tad more flexible, but needs a bit more work to +control. If you use ReadMode 3, then you should install a SIGINT or END +handler to reset the terminal (via ReadMode 0) if the user aborts the +program via C<^C>. (For any mode, an END handler consisting of "ReadMode 0" +is actually a good idea.) + +If you are executing another program that may be changing the terminal mode, +you will either want to say + + ReadMode 1; # same as ReadMode 'normal' + system('someprogram'); + ReadMode 1; + +which resets the settings after the program has run, or: + + $somemode=1; + ReadMode 0; # same as ReadMode 'restore' + system('someprogram'); + ReadMode 1; + +which records any changes the program may have made, before resetting the +mode. + +=item ReadKey MODE [, Filehandle] + +Takes an integer argument, which can currently be one of the following +values: + + 0 Perform a normal read using getc + -1 Perform a non-blocked read + >0 Perform a timed read + +If the filehandle is not supplied, it will default to STDIN. If there is +nothing waiting in the buffer during a non-blocked read, then undef will be +returned. In most situations, you will probably want to use C<ReadKey -1>. + +I<NOTE> that if the OS does not provide any known mechanism for non-blocking +reads, then a C<ReadKey -1> can die with a fatal error. This will hopefully +not be common. + +If MODE is greater then zero, then ReadKey will use it as a timeout value in +seconds (fractional seconds are allowed), and won't return C<undef> until +that time expires. + +I<NOTE>, again, that some OS's may not support this timeout behaviour. + +If MODE is less then zero, then this is treated as a timeout +of zero, and thus will return immediately if no character is waiting. A MODE +of zero, however, will act like a normal getc. + +I<NOTE>, there are currently some limitations with this call under Windows. +It may be possible that non-blocking reads will fail when reading repeating +keys from more then one console. + + +=item ReadLine MODE [, Filehandle] + +Takes an integer argument, which can currently be one of the following +values: + + 0 Perform a normal read using scalar(<FileHandle>) + -1 Perform a non-blocked read + >0 Perform a timed read + +If there is nothing waiting in the buffer during a non-blocked read, then +undef will be returned. + +I<NOTE>, that if the OS does not provide any known mechanism for +non-blocking reads, then a C<ReadLine 1> can die with a fatal +error. This will hopefully not be common. + +I<NOTE> that a non-blocking test is only performed for the first character +in the line, not the entire line. This call will probably B<not> do what +you assume, especially with C<ReadMode> MODE values higher then 1. For +example, pressing Space and then Backspace would appear to leave you +where you started, but any timeouts would now be suspended. + +B<This call is currently not available under Windows>. + +=item GetTerminalSize [Filehandle] + +Returns either an empty array if this operation is unsupported, or a four +element array containing: the width of the terminal in characters, the +height of the terminal in character, the width in pixels, and the height in +pixels. (The pixel size will only be valid in some environments.) + +I<NOTE>, under Windows, this function must be called with an B<output> +filehandle, such as C<STDOUT>, or a handle opened to C<CONOUT$>. + +=item SetTerminalSize WIDTH,HEIGHT,XPIX,YPIX [, Filehandle] + +Return -1 on failure, 0 otherwise. + +I<NOTE> that this terminal size is only for B<informative> value, and +changing the size via this mechanism will B<not> change the size of +the screen. For example, XTerm uses a call like this when +it resizes the screen. If any of the new measurements vary from the old, the +OS will probably send a SIGWINCH signal to anything reading that tty or pty. + +B<This call does not work under Windows>. + +=item GetSpeed [, Filehandle] + +Returns either an empty array if the operation is unsupported, or a two +value array containing the terminal in and out speeds, in B<decimal>. E.g, +an in speed of 9600 baud and an out speed of 4800 baud would be returned as +(9600,4800). Note that currently the in and out speeds will always be +identical in some OS's. + +B<No speeds are reported under Windows>. + +=item GetControlChars [, Filehandle] + +Returns an array containing key/value pairs suitable for a hash. The pairs +consist of a key, the name of the control character/signal, and the value +of that character, as a single character. + +B<This call does nothing under Windows>. + +Each key will be an entry from the following list: + + DISCARD + DSUSPEND + EOF + EOL + EOL2 + ERASE + ERASEWORD + INTERRUPT + KILL + MIN + QUIT + QUOTENEXT + REPRINT + START + STATUS + STOP + SUSPEND + SWITCH + TIME + +Thus, the following will always return the current interrupt character, +regardless of platform. + + %keys = GetControlChars; + $int = $keys{INTERRUPT}; + +=item SetControlChars [, Filehandle] + +Takes an array containing key/value pairs, as a hash will produce. The pairs +should consist of a key that is the name of a legal control +character/signal, and the value should be either a single character, or a +number in the range 0-255. SetControlChars will die with a runtime error if +an invalid character name is passed or there is an error changing the +settings. The list of valid names is easily available via + + %cchars = GetControlChars(); + @cnames = keys %cchars; + +B<This call does nothing under Windows>. + +=back + +=head1 AUTHOR + +Kenneth Albanowski <[email protected]> + +Currently maintained by Jonathan Stowe <[email protected]> + +=head1 SUPPORT + +The code is maintained at + + https://github.com/jonathanstowe/TermReadKey + +Please feel free to fork and suggest patches. + + +=head1 LICENSE + +Prior to the 2.31 release the license statement was: + + Copyright (C) 1994-1999 Kenneth Albanowski. + 2001-2005 Jonathan Stowe and others + + Unlimited distribution and/or modification is allowed as long as this + copyright notice remains intact. + +And was only stated in the README file. + +Because I believe the original author's intent was to be more open than the +other commonly used licenses I would like to leave that in place. However if +you or your lawyers require something with some more words you can optionally +choose to license this under the standard Perl license: + + This module is free software; you can redistribute it and/or modify it + under the terms of the Artistic License. For details, see the full + text of the license in the file "Artistic" that should have been provided + with the version of perl you are using. + + This program is distributed in the hope that it will be useful, but + without any warranty; without even the implied warranty of merchantability + or fitness for a particular purpose. + + +=cut + +use vars qw($VERSION); + +$VERSION = '2.38'; + +require Exporter; +require DynaLoader; + +use vars qw(@ISA @EXPORT_OK @EXPORT); + +@ISA = qw(Exporter DynaLoader); + +# Items to export into callers namespace by default +# (move infrequently used names to @EXPORT_OK below) + +@EXPORT = qw( + ReadKey + ReadMode + ReadLine + GetTerminalSize + SetTerminalSize + GetSpeed + GetControlChars + SetControlChars +); + +@EXPORT_OK = qw(); + +bootstrap Term::ReadKey; + +# Should we use LINES and COLUMNS to try and get the terminal size? +# Change this to zero if you have systems where these are commonly +# set to erroneous values. (But if either are near zero, they won't be +# used anyhow.) + +use vars qw($UseEnv $CurrentMode %modes); + +$UseEnv = 1; + +$CurrentMode = 0; + +%modes = ( # lowercase is canonical + original => 0, + restore => 0, + normal => 1, + noecho => 2, + cbreak => 3, + raw => 4, + 'ultra-raw' => 5 +); + +# reduce Carp memory footprint, only load when needed +sub croak { require Carp; goto &Carp::croak; } +sub carp { require Carp; goto &Carp::carp; } + +sub ReadMode +{ + my $mode = $modes{ lc $_[0] }; # lowercase is canonical + my $fh = normalizehandle( ( @_ > 1 ? $_[1] : \*STDIN ) ); + + if ( defined($mode) ) { $CurrentMode = $mode } + elsif ( $_[0] =~ /^\d/ ) { $CurrentMode = $_[0] } + else { croak("Unknown terminal mode `$_[0]'"); } + + SetReadMode($CurrentMode, $fh); +} + +sub normalizehandle +{ + my ($file) = @_; # allows fake signature optimization + + no strict; + # print "Handle = $file\n"; + if ( ref($file) ) { return $file; } # Reference is fine + + # if ($file =~ /^\*/) { return $file; } # Type glob is good + if ( ref( \$file ) eq 'GLOB' ) { return $file; } # Glob is good + + # print "Caller = ",(caller(1))[0],"\n"; + return \*{ ( ( caller(1) )[0] ) . "::$file" }; +} + +sub GetTerminalSize +{ + my $file = normalizehandle( ( @_ > 0 ? $_[0] : \*STDOUT ) ); + + my (@results, @fail); + + if ( &termsizeoptions() & 1 ) # VIO + { + @results = GetTermSizeVIO($file); + push( @fail, "VIOGetMode call" ); + } + elsif ( &termsizeoptions() & 2 ) # GWINSZ + { + @results = GetTermSizeGWINSZ($file); + push( @fail, "TIOCGWINSZ ioctl" ); + } + elsif ( &termsizeoptions() & 4 ) # GSIZE + { + @results = GetTermSizeGSIZE($file); + push( @fail, "TIOCGSIZE ioctl" ); + } + elsif ( &termsizeoptions() & 8 ) # WIN32 + { + @results = GetTermSizeWin32($file); + push( @fail, "Win32 GetConsoleScreenBufferInfo call" ); + } + else + { + @results = (); + } + + if ( @results < 4 and $UseEnv ) + { + my ($C) = defined( $ENV{COLUMNS} ) ? $ENV{COLUMNS} : 0; + my ($L) = defined( $ENV{LINES} ) ? $ENV{LINES} : 0; + if ( ( $C >= 2 ) and ( $L >= 2 ) ) + { + @results = ( $C + 0, $L + 0, 0, 0 ); + } + push( @fail, "COLUMNS and LINES environment variables" ); + } + + if ( @results < 4 && $^O ne 'MSWin32') + { + my ($prog) = "resize"; + + # Workaround for Solaris path silliness + if ( -f "/usr/openwin/bin/resize" ) { + $prog = "/usr/openwin/bin/resize"; + } + + my ($resize) = scalar(`$prog 2>/dev/null`); + if (defined $resize + and ( $resize =~ /COLUMNS\s*=\s*(\d+)/ + or $resize =~ /setenv\s+COLUMNS\s+'?(\d+)/ ) + ) + { + $results[0] = $1; + if ( $resize =~ /LINES\s*=\s*(\d+)/ + or $resize =~ /setenv\s+LINES\s+'?(\d+)/ ) + { + $results[1] = $1; + @results[ 2, 3 ] = ( 0, 0 ); + } + else + { + @results = (); + } + } + else + { + @results = (); + } + push( @fail, "resize program" ); + } + + if ( @results < 4 && $^O ne 'MSWin32' ) + { + my ($prog) = "stty size"; + + my ($stty) = scalar(`$prog 2>/dev/null`); + if (defined $stty + and ( $stty =~ /(\d+) (\d+)/ ) + ) + { + $results[0] = $2; + $results[1] = $1; + @results[ 2, 3 ] = ( 0, 0 ); + } + else + { + @results = (); + } + push( @fail, "stty program" ); + } + + if ( @results != 4 ) + { + carp("Unable to get Terminal Size." + . join( "", map( " The $_ didn't work.", @fail ) )); + return undef; + } + + @results; +} + +!FIRSTPART + +close OUT; +# preload the XS module needed for the blockoptions() expansions below +# does not work with miniperl +package Term::ReadKey; +require DynaLoader; +our @ISA = qw(DynaLoader); + +print "Bootstrapping the XS for blockoptions: "; +bootstrap Term::ReadKey or die; +print blockoptions()."\n"; + +open OUT, ">>", $file or die "Can't append to $file: $!"; +print OUT "# blockoptions: \n"; +if ( &blockoptions() & 1 ) # Use nodelay +{ + print OUT "#nodelay\n"; + if ( &blockoptions() & 2 ) #poll + { + print OUT <<'!NO!SUBS!'; +# poll +sub ReadKey { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if (defined $_[0] && $_[0] > 0) { + if ($_[0]) { + return undef if &pollfile($File,$_[0]) == 0; + } + } + if (defined $_[0] && $_[0] < 0) { &setnodelay($File,1); } + my $value = getc $File; + if (defined $_[0] && $_[0] < 0) { &setnodelay($File,0); } + $value; +} +sub ReadLine { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if (defined $_[0] && $_[0] > 0) { + if ($_[0]) { + return undef if &pollfile($File,$_[0]) == 0; + } + } + if (defined $_[0] && $_[0] < 0) { &setnodelay($File,1) }; + my $value = scalar(<$File>); + if (defined $_[0] && $_[0] < 0) { &setnodelay($File,0) }; + $value; +} +!NO!SUBS! + + } + elsif ( &blockoptions() & 4 ) #select + { + print OUT <<'!NO!SUBS!'; +#select +sub ReadKey { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if (defined $_[0] && $_[0] > 0) { + if ($_[0]) { return undef if &selectfile($File,$_[0]) == 0 } + } + if (defined $_[0] && $_[0] < 0) { &setnodelay($File,1); } + my $value = getc $File; + if (defined $_[0] && $_[0] < 0) { &setnodelay($File,0); } + $value; +} +sub ReadLine { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if (defined $_[0] && $_[0] > 0) { + if ($_[0]) { return undef if &selectfile($File,$_[0]) == 0 } + } + if (defined $_[0] && $_[0] < 0) { &setnodelay($File,1) }; + my $value = scalar(<$File>); + if (defined $_[0] && $_[0] < 0) { &setnodelay($File,0) }; + $value; +} +!NO!SUBS! + + } + else + { #nothing + print OUT <<'!NO!SUBS!'; +sub ReadKey { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if (defined $_[0] && $_[0] > 0) { + # Nothing better seems to exist, so I just use time-of-day + # to timeout the read. This isn't very exact, though. + $starttime = time; + $endtime = $starttime + $_[0]; + &setnodelay($File,1); + my $value; + while (time < $endtime) { # This won't catch wraparound! + $value = getc $File; + last if defined($value); + } + &setnodelay($File,0); + return $value; + } + if (defined $_[0] && $_[0] < 0) { &setnodelay($File,1); } + my $value = getc $File; + if (defined $_[0] && $_[0] < 0) { &setnodelay($File,0); } + $value; +} +sub ReadLine { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if (defined $_[0] && $_[0] > 0) { + # Nothing better seems to exist, so I just use time-of-day + # to timeout the read. This isn't very exact, though. + $starttime = time; + $endtime = $starttime + $_[0]; + &setnodelay($File,1); + my $value; + while (time < $endtime) { # This won't catch wraparound! + $value = scalar(<$File>); + last if defined($value); + } + &setnodelay($File,0); + return $value; + } + if (defined $_[0] && $_[0] < 0) { &setnodelay($File,1) }; + my $value = scalar(<$File>); + if (defined $_[0] && $_[0] < 0) { &setnodelay($File,0) }; + $value; +} +!NO!SUBS! + + } +} +else { + print OUT "#no nodelay\n"; + + if ( &blockoptions() & 2 ) # Use poll + { + print OUT <<'!NO!SUBS!'; +#poll +sub ReadKey { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if (defined $_[0] && $_[0] != 0) { + return undef if &pollfile($File,$_[0]) == 0 + } + getc $File; +} +sub ReadLine { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if (defined $_[0] && $_[0] != 0 ) { + return undef if &pollfile($File,$_[0]) == 0; + } + scalar(<$File>); +} +!NO!SUBS! + + } + elsif ( &blockoptions() & 4 ) # Use select + { + print OUT <<'!NO!SUBS!'; +#select +sub ReadKey { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if (defined $_[0] && $_[0] != 0) { + return undef if &selectfile($File,$_[0]) == 0 + } + getc $File; +} +sub ReadLine { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if (defined $_[0] && $_[0] != 0) { + return undef if &selectfile($File,$_[0]) == 0; + } + scalar(<$File>); +} +!NO!SUBS! + + } + elsif ( &blockoptions() & 8 ) # Use Win32 + { + print OUT <<'!NO!SUBS!'; +#Win32 +sub ReadKey { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if ($_[0] || $CurrentMode >= 3) { + Win32PeekChar($File, $_[0]); + } else { + getc $File; + } + #if ($_[0]!=0) {return undef if !Win32PeekChar($File, $_[0])}; + #getc $File; +} +sub ReadLine { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + #if ($_[0]!=0) {return undef if !Win32PeekChar($File, $_[0])}; + #scalar(<$File>); + if ($_[0]) { + croak("Non-blocking ReadLine is not supported on this architecture") + } + scalar(<$File>); +} +!NO!SUBS! + + } + else + { + print OUT <<'!NO!SUBS!'; +sub ReadKey { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if ($_[0]) { + croak("Non-blocking ReadKey is not supported on this architecture") + } + getc $File; +} +sub ReadLine { + my $File = normalizehandle((@_>1?$_[1]:\*STDIN)); + if ($_[0]) { + croak("Non-blocking ReadLine is not supported on this architecture") + } + scalar(<$File>); +} +!NO!SUBS! + + } +} + +print OUT <<'EOF'; +1; +# ex: set ro: +EOF + +close OUT; +if (-s $file < 1000) { + warn "WARNING: $file probably too small"; +} else { + print "Done\n"; +} Index: gnu/usr.bin/perl/cpan/Term-ReadKey/ReadKey.xs =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Term-ReadKey/ReadKey.xs,v retrieving revision 1.2 diff -u -p -r1.2 ReadKey.xs --- gnu/usr.bin/perl/cpan/Term-ReadKey/ReadKey.xs 3 Jul 2016 01:07:58 -0000 1.2 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/ReadKey.xs 25 Feb 2020 01:27:42 -0000 @@ -1,5 +1,6 @@ /* -*-C-*- */ +#define PERL_NO_GET_CONTEXT /* we want efficiency */ #include "EXTERN.h" #include "perl.h" #include "XSUB.h" @@ -16,7 +17,10 @@ Written by Kenneth Albanowski on Thu Oct 6 11:42:20 EDT 1994 Contact at [email protected] or CIS:70705,126 - Maintained by Jonathan Stowe <[email protected]> + Maintained by Jonathan Stowe <[email protected]> + + The below captures the history prior to it being in full time version + control: $Id: ReadKey.xs,v 2.22 2005/01/11 21:15:17 jonathan Exp $ @@ -375,41 +379,41 @@ #include "cchars.h" -int GetTermSizeVIO _((PerlIO * file, +STATIC int GetTermSizeVIO _((pTHX_ PerlIO * file, int * retwidth, int * retheight, int * xpix, int * ypix)); -int GetTermSizeGWINSZ _((PerlIO * file, +STATIC int GetTermSizeGWINSZ _((pTHX_ PerlIO * file, int * retwidth, int * retheight, int * xpix, int * ypix)); -int GetTermSizeGSIZE _((PerlIO * file, +STATIC int GetTermSizeGSIZE _((pTHX_ PerlIO * file, int * retwidth, int * retheight, int * xpix, int * ypix)); -int GetTermSizeWin32 _((PerlIO * file, +STATIC int GetTermSizeWin32 _((pTHX_ PerlIO * file, int * retwidth, int * retheight, int * xpix, int * ypix)); -int SetTerminalSize _((PerlIO * file, +STATIC int SetTerminalSize _((pTHX_ PerlIO * file, int width, int height, int xpix, int ypix)); -void ReadMode _((PerlIO * file,int mode)); +STATIC void ReadMode _((pTHX_ PerlIO * file,int mode)); -int pollfile _((PerlIO * file, double delay)); +STATIC int pollfile _((pTHX_ PerlIO * file, double delay)); -int setnodelay _((PerlIO * file, int mode)); +STATIC int setnodelay _((pTHX_ PerlIO * file, int mode)); -int selectfile _((PerlIO * file, double delay)); +STATIC int selectfile _((pTHX_ PerlIO * file, double delay)); -int Win32PeekChar _((PerlIO * file, double delay, char * key)); +STATIC int Win32PeekChar _((pTHX_ PerlIO * file, double delay, char * key)); -int getspeed _((PerlIO * file, I32 *in, I32 * out )); +STATIC int getspeed _((pTHX_ PerlIO * file, I32 *in, I32 * out )); #ifdef VIOMODE -int GetTermSizeVIO(PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) +int GetTermSizeVIO(pTHX_ PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) { /*int handle=PerlIO_fileno(file); @@ -431,7 +435,7 @@ int GetTermSizeVIO(PerlIO *file,int *ret return 0; } #else -int GetTermSizeVIO(PerlIO *file,int * retwidth,int *retheight, int *xpix,int *ypix) +int GetTermSizeVIO(pTHX_ PerlIO *file,int * retwidth,int *retheight, int *xpix,int *ypix) { croak("TermSizeVIO is not implemented on this architecture"); return 0; @@ -440,7 +444,7 @@ int GetTermSizeVIO(PerlIO *file,int * re #if defined(TIOCGWINSZ) && !defined(DONT_USE_GWINSZ) -int GetTermSizeGWINSZ(PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) +int GetTermSizeGWINSZ(pTHX_ PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) { int handle=PerlIO_fileno(file); struct winsize w; @@ -455,7 +459,7 @@ int GetTermSizeGWINSZ(PerlIO *file,int * } #else -int GetTermSizeGWINSZ(PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) +int GetTermSizeGWINSZ(pTHX_ PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) { croak("TermSizeGWINSZ is not implemented on this architecture"); return 0; @@ -463,7 +467,7 @@ int GetTermSizeGWINSZ(PerlIO *file,int * #endif #if (!defined(TIOCGWINSZ) || defined(DONT_USE_GWINSZ)) && (defined(TIOCGSIZE) && !defined(DONT_USE_GSIZE)) -int GetTermSizeGSIZE(PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) +int GetTermSizeGSIZE(pTHX_ PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) { int handle=PerlIO_fileno(file); @@ -478,7 +482,7 @@ int GetTermSizeGSIZE(PerlIO *file,int *r } } #else -int GetTermSizeGSIZE(PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) +int GetTermSizeGSIZE(pTHX_ PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) { croak("TermSizeGSIZE is not implemented on this architecture"); return 0; @@ -486,7 +490,7 @@ int GetTermSizeGSIZE(PerlIO *file,int *r #endif #ifdef USE_WIN32 -int GetTermSizeWin32(PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) +int GetTermSizeWin32(pTHX_ PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) { int handle=PerlIO_fileno(file); HANDLE whnd = (HANDLE)_get_osfhandle(handle); @@ -509,7 +513,7 @@ int GetTermSizeWin32(PerlIO *file,int *r return -1; } #else -int GetTermSizeWin32(PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) +int GetTermSizeWin32(pTHX_ PerlIO *file,int *retwidth,int *retheight,int *xpix,int *ypix) { croak("TermSizeWin32 is not implemented on this architecture"); return 0; @@ -517,7 +521,7 @@ int GetTermSizeWin32(PerlIO *file,int *r #endif /* USE_WIN32 */ -int termsizeoptions() { +STATIC int termsizeoptions() { return 0 #ifdef VIOMODE | 1 @@ -535,9 +539,8 @@ int termsizeoptions() { } -int SetTerminalSize(PerlIO *file,int width,int height,int xpix,int ypix) +int SetTerminalSize(pTHX_ PerlIO *file,int width,int height,int xpix,int ypix) { - char buffer[10]; int handle=PerlIO_fileno(file); #ifdef VIOMODE @@ -545,6 +548,7 @@ int SetTerminalSize(PerlIO *file,int wid #else #if defined(TIOCSWINSZ) && !defined(DONT_USE_SWINSZ) + char buffer[10]; struct winsize w; w.ws_col=width; @@ -564,6 +568,7 @@ int SetTerminalSize(PerlIO *file,int wid } #else # if defined(TIOCSSIZE) && !defined(DONT_USE_SSIZE) + char buffer[10]; struct ttysize w; w.ts_lines=height; @@ -594,7 +599,7 @@ int SetTerminalSize(PerlIO *file,int wid } -I32 terminal_speeds[] = { +STATIC const I32 terminal_speeds[] = { #ifdef B50 50, B50, #endif @@ -658,10 +663,12 @@ I32 terminal_speeds[] = { -1,-1 }; -int getspeed(PerlIO *file,I32 *in, I32 *out) +int getspeed(pTHX_ PerlIO *file,I32 *in, I32 *out) { int handle=PerlIO_fileno(file); +#if defined(I_TERMIOS) || defined(I_TERMIO) || defined(I_SGTTY) int i; +#endif # ifdef I_TERMIOS /* Posixy stuff */ @@ -762,10 +769,10 @@ struct tbuffer { #endif #endif -HV * filehash; /* Used to store the original terminal settings for each handle*/ -HV * modehash; /* Used to record the current terminal "mode" for each handle*/ +static HV * filehash; /* Used to store the original terminal settings for each handle*/ +static HV * modehash; /* Used to record the current terminal "mode" for each handle*/ -void ReadMode(PerlIO *file,int mode) +void ReadMode(pTHX_ PerlIO *file,int mode) { dTHR; int handle; @@ -1450,7 +1457,7 @@ understand this syntax, either fix the c DONT_USE_SELECT. */ #ifdef Have_select -int selectfile(PerlIO *file,double delay) +int selectfile(pTHX_ PerlIO *file,double delay) { struct timeval t; int handle=PerlIO_fileno(file); @@ -1479,7 +1486,7 @@ int selectfile(PerlIO *file,double delay } #else -int selectfile(PerlIO *file, double delay) +int selectfile(pTHX_ PerlIO *file, double delay) { croak("select is not supported on this architecture"); return 0; @@ -1487,7 +1494,7 @@ int selectfile(PerlIO *file, double dela #endif #ifdef Have_nodelay -int setnodelay(PerlIO *file, int mode) +int setnodelay(pTHX_ PerlIO *file, int mode) { int handle=PerlIO_fileno(file); int flags; @@ -1501,7 +1508,7 @@ int setnodelay(PerlIO *file, int mode) } #else -int setnodelay(PerlIO *file, int mode) +int setnodelay(pTHX_ PerlIO *file, int mode) { croak("setnodelay is not supported on this architecture"); return 0; @@ -1509,7 +1516,7 @@ int setnodelay(PerlIO *file, int mode) #endif #ifdef Have_poll -int pollfile(PerlIO *file,double delay) +int pollfile(pTHX_ pTHX_ PerlIO *file,double delay) { int handle=PerlIO_fileno(file); struct pollfd fds; @@ -1522,7 +1529,7 @@ int pollfile(PerlIO *file,double delay) return (poll(&fds,1,(long)(delay * 1000.0))>0); } #else -int pollfile(PerlIO *file,double delay) +int pollfile(pTHX_ PerlIO *file,double delay) { croak("pollfile is not supported on this architecture"); return 0; @@ -1567,7 +1574,7 @@ typedef struct { goto again; \ } while (0) -int Win32PeekChar(PerlIO *file,double delay,char *key) +int Win32PeekChar(pTHX_ PerlIO *file,double delay,char *key) { int handle; HANDLE whnd; @@ -1611,7 +1618,7 @@ again: } if (delay > 0) { - if (WaitForSingleObject(whnd, delay * 1000.0) != WAIT_OBJECT_0) + if (WaitForSingleObject(whnd, delay * 1000) != WAIT_OBJECT_0) { return FALSE; } @@ -1703,7 +1710,7 @@ again: } #else -int Win32PeekChar(PerlIO *file, double delay,char *key) +int Win32PeekChar(pTHX_ PerlIO *file, double delay,char *key) { croak("Win32PeekChar is not supported on this architecture"); return 0; @@ -1711,7 +1718,7 @@ int Win32PeekChar(PerlIO *file, double d #endif -int blockoptions() { +STATIC int blockoptions() { return 0 #ifdef Have_nodelay | 1 @@ -1728,7 +1735,7 @@ int blockoptions() { ; } -int termoptions() { +STATIC int termoptions() { int i=0; #ifdef USE_TERMIOS i=1; @@ -1756,6 +1763,10 @@ int selectfile(file,delay) InputStream file double delay +CODE: + RETVAL = selectfile(aTHX_ file, delay); +OUTPUT: + RETVAL # Clever, eh? void @@ -1764,18 +1775,26 @@ SetReadMode(mode,file=STDIN) InputStream file CODE: { - ReadMode(file,mode); + ReadMode(aTHX_ file,mode); } int setnodelay(file,mode) InputStream file int mode +CODE: + RETVAL = setnodelay(aTHX_ file, mode); +OUTPUT: + RETVAL int pollfile(file,delay) InputStream file double delay +CODE: + RETVAL = pollfile(aTHX_ file, delay); +OUTPUT: + RETVAL SV * Win32PeekChar(file, delay) @@ -1784,7 +1803,7 @@ Win32PeekChar(file, delay) CODE: { char key; - if (Win32PeekChar(file, delay, &key)) + if (Win32PeekChar(aTHX_ file, delay, &key)) RETVAL = newSVpv(&key, 1); else RETVAL = newSVsv(&PL_sv_undef); @@ -1807,7 +1826,7 @@ GetTermSizeWin32(file=STDIN) PPCODE: { int x,y,xpix,ypix; - if( GetTermSizeWin32(file,&x,&y,&xpix,&ypix)==0) + if( GetTermSizeWin32(aTHX_ file,&x,&y,&xpix,&ypix)==0) { EXTEND(sp, 4); PUSHs(sv_2mortal(newSViv((IV)x))); @@ -1827,7 +1846,7 @@ GetTermSizeVIO(file=STDIN) PPCODE: { int x,y,xpix,ypix; - if( GetTermSizeVIO(file,&x,&y,&xpix,&ypix)==0) + if( GetTermSizeVIO(aTHX_ file,&x,&y,&xpix,&ypix)==0) { EXTEND(sp, 4); PUSHs(sv_2mortal(newSViv((IV)x))); @@ -1847,7 +1866,7 @@ GetTermSizeGWINSZ(file=STDIN) PPCODE: { int x,y,xpix,ypix; - if( GetTermSizeGWINSZ(file,&x,&y,&xpix,&ypix)==0) + if( GetTermSizeGWINSZ(aTHX_ file,&x,&y,&xpix,&ypix)==0) { EXTEND(sp, 4); PUSHs(sv_2mortal(newSViv((IV)x))); @@ -1867,7 +1886,7 @@ GetTermSizeGSIZE(file=STDIN) PPCODE: { int x,y,xpix,ypix; - if( GetTermSizeGSIZE(file,&x,&y,&xpix,&ypix)==0) + if( GetTermSizeGSIZE(aTHX_ file,&x,&y,&xpix,&ypix)==0) { EXTEND(sp, 4); PUSHs(sv_2mortal(newSViv((IV)x))); @@ -1890,7 +1909,7 @@ SetTerminalSize(width,height,xpix,ypix,f InputStream file CODE: { - RETVAL=SetTerminalSize(file,width,height,xpix,ypix); + RETVAL=SetTerminalSize(aTHX_ file,width,height,xpix,ypix); } OUTPUT: RETVAL @@ -1901,10 +1920,14 @@ GetSpeed(file=STDIN) PPCODE: { I32 in,out; +/* + * experimentally relaxed for + * https://rt.cpan.org/Ticket/Display.html?id=88050 if(items!=0) { croak("Usage: Term::ReadKey::GetSpeed()"); } - if(getspeed(file,&in,&out)) { +*/ + if(getspeed(aTHX_ file,&in,&out)) { /* Failure */ ST( 0) = sv_newmortal(); } else { Index: gnu/usr.bin/perl/cpan/Term-ReadKey/SIGNATURE =================================================================== RCS file: gnu/usr.bin/perl/cpan/Term-ReadKey/SIGNATURE diff -N gnu/usr.bin/perl/cpan/Term-ReadKey/SIGNATURE --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/SIGNATURE 25 Feb 2020 01:27:42 -0000 @@ -0,0 +1,41 @@ +This file contains message digests of all files listed in MANIFEST, +signed via the Module::Signature module, version 0.81. + +To verify the content in this distribution, first make sure you have +Module::Signature installed, then type: + + % cpansign -v + +It will check each file's integrity, as well as the signature's +validity. If "==> Signature verified OK! <==" is not displayed, +the distribution may already have been compromised, and you should +not run its Makefile.PL or Build.PL. + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +SHA1 616229399c8babf4256fadad2571aad7d72a3ea8 Changes +SHA1 87c9015c9692363397e1b5a8895db403bb6b24ad Configure.pm +SHA1 fb4e59f63cf055ed8d1a7578d797b365c00ae276 MANIFEST +SHA1 9bc08cea258bfe3fb880b2a5c7dd941a55d7860c MANIFEST.SKIP +SHA1 0264821daf45fa82f1305fc31448e78f17d36432 META.json +SHA1 4cc1f0b60a13222510e07f1aacf9e8c0609e6901 META.yml +SHA1 fdcaac61068156a6823f79c61eed02942c012fda Makefile.PL +SHA1 86fe91551c70c1899796cda79bb5c8d265d987aa README +SHA1 463beea66445d64a7d7c877b234ecf8ad046f515 ReadKey.pm.PL +SHA1 3bd8375779236d70dcc5c70aa269618b35a76a34 ReadKey.xs +SHA1 c009e9a2bbd000588fbcba9a9ae08dfdaa1e8ad1 example/test.pl +SHA1 f2e7df00c08c34872cedcce1746cc71d642c1d80 genchars.pl +SHA1 58a50d6a9276b38cb76fae60561c2e1e9f95801b ppport.h +SHA1 a4ac8dc9eee6dbc7f1522c733068c7ac1c31db61 t/01_basic.t +SHA1 24ce32574887ccf5f7b3ec5619f840e5944d8c75 t/02_terminal_functions.t +-----BEGIN PGP SIGNATURE----- + +iQEcBAEBAgAGBQJcMJqnAAoJECBWhy2NZBIANEQIAI7mZf0PDoA65wgUhSXXkQNv +n/eWk5R6ykla6smZII5Jf7kwBThbwlIFXlGgr4Ub1SWnupXm82mcjMzk/Qpfl+au +svGrr6c9S3uSliGTSwEq8LSjU7LDOkUDkCDx4fT88+4fQvWnagkMMxJ3UujNgyIa +MmBFx5GqDJyakW85AK9KtMvUGFrXb9in/5ADkgrd0fuM607cn519ogUNejHnRL6y +FLxguVH7WT8+0urUTIvK8VC4nU2t8Rng9z+NYATDYmA5/+DpEoRt35dJPwgqsVbk +rZWt9zPaPMvnRPPK85FiAL6nvTWaXP1OoJu73OmamBTZC6ffdniKS74gH0V+7dc= +=8p+z +-----END PGP SIGNATURE----- Index: gnu/usr.bin/perl/cpan/Term-ReadKey/genchars.pl =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Term-ReadKey/genchars.pl,v retrieving revision 1.2 diff -u -p -r1.2 genchars.pl --- gnu/usr.bin/perl/cpan/Term-ReadKey/genchars.pl 3 Jul 2016 01:07:58 -0000 1.2 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/genchars.pl 25 Feb 2020 01:27:42 -0000 @@ -1,14 +1,16 @@ #!/usr/bin/perl - # # $Id: genchars.pl,v 2.22 2005/01/11 21:15:17 jonathan Exp $ # ############################## -$version="1.97"; +$version="1.98"; ############################## use Config; +BEGIN { push @INC, "."; } use Configure; +use constant SILENT => + (defined $ENV{MAKEFLAGS} and $ENV{MAKEFLAGS} =~ /\b(s|silent|quiet)\b/ ? 1 : 0); #sub report { # my($prog)=join(" ",@_); @@ -88,19 +90,21 @@ open(CCHARS,">cchars.h") || die "Fatal e ); print CCHARS " +/* -*- buffer-read-only: t -*- -/* Written by genchars.pl version $version */ + This file is auto-generated. ***ANY*** changes here will be lost. + Written by genchars.pl version $version */ "; print CCHARS "#define HAVE_POLL_H\n" if CheckHeader("poll.h"); print CCHARS "#define HAVE_SYS_POLL_H\n" if CheckHeader("sys/poll.h"); -print "\n"; +print "\n" unless SILENT; if(1) { @values = sort { $possible{$a} cmp $possible{$b} or $a cmp $b } keys %possible; - print "Writing termio/termios section of cchars.h... "; + print "Writing termio/termios section of cchars.h... " unless SILENT; print CCHARS " #ifdef CC_TERMIOS @@ -129,9 +133,15 @@ if(1) { # define LEGALMAXCC 126 #endif +#ifdef XS_INTERNAL +# define TRTXS(a) XS_INTERNAL(a) +#else +# define TRTXS(a) XS(a) +#endif + #if defined(CC_TERMIO) || defined(CC_TERMIOS) -char * cc_names[] = { ".join('',map(" +STATIC const char * const cc_names[] = { ".join('',map(" #if defined($_) && ($_ < LEGALMAXCC) \"$possible{$_}\", "." #else "." @@ -139,13 +149,13 @@ char * cc_names[] = { ".join('',map(" #endif ", @values ))." }; -const int MAXCC = 0 ",join('',map(" +STATIC const int MAXCC = 0 ",join('',map(" #if defined($_) && ($_ < LEGALMAXCC) +1 /* $possible{$_} */ #endif ", @values ))." ; -XS(XS_Term__ReadKey_GetControlChars) +TRTXS(XS_Term__ReadKey_GetControlChars) { dXSARGS; if (items < 0 || items > 1) { @@ -182,7 +192,7 @@ PUSHs(sv_2mortal(newSVpv((char*)&s.c_cc[ } } -XS(XS_Term__ReadKey_SetControlChars) +TRTXS(XS_Term__ReadKey_SetControlChars) { dXSARGS; /*if ((items % 2) != 0) { @@ -243,7 +253,7 @@ XS(XS_Term__ReadKey_SetControlChars) "; - print "Done.\n"; + print "Done.\n" unless SILENT; } @@ -252,9 +262,9 @@ undef %billy; if(@ARGV) { # If any argument is supplied on the command-line don't check sgtty $SGTTY=0; #skip tests } else { - print "Checking for sgtty...\n"; + print "Checking for sgtty...\n" unless SILENT; - $SGTTY = CheckStructure "sgttyb","sgtty.h"; + $SGTTY = CheckStructure("sgttyb","sgtty.h"); # $SGTTY = !Compile(" ##include <sgtty.h> #struct sgttyb s; @@ -271,7 +281,7 @@ if(@ARGV) { # If any argument is supplie #ioctl(0,TIOCGETP,&s); #}"); - print " Sgtty ",($SGTTY?"":"NOT "),"found.\n"; + print " Sgtty ",($SGTTY?"":"NOT "),"found.\n" unless SILENT; } $billy{"ERASE"} = "s1.sg_erase"; @@ -280,27 +290,27 @@ $tchars=$ltchars=0; if($SGTTY) { - print "Checking sgtty...\n"; + print "Checking sgtty...\n" unless SILENT; - $tchars = CheckStructure "tchars","sgtty.h"; + $tchars = CheckStructure("tchars","sgtty.h"); # $tchars = !report( ' ##include <sgtty.h> #struct tchars t; #main() { ioctl(0,TIOCGETC,&t); } #'); - print " tchars structure found.\n" if $tchars; + print " tchars structure found.\n" if $tchars and !SILENT; - $ltchars = CheckStructure "ltchars","sgtty.h"; + $ltchars = CheckStructure("ltchars","sgtty.h"); # $ltchars = !report( ' ##include <sgtty.h> #struct ltchars t; #main() { ioctl(0,TIOCGLTC,&t); } #'); - print " ltchars structure found.\n" if $ltchars; + print " ltchars structure found.\n" if $ltchars and !SILENT; - print "Checking symbols\n"; + print "Checking symbols\n" unless SILENT; for $c (sort keys %possible2) { @@ -312,7 +322,7 @@ if($SGTTY) { #")) { if($tchars and CheckField("tchars","t_$c","sgtty.h")) { - print " t_$c ($possible2{$c}) found in tchars\n"; + print " t_$c ($possible2{$c}) found in tchars\n" unless SILENT; $billy{$possible2{$c}} = "s2.t_$c"; } @@ -322,7 +332,7 @@ if($SGTTY) { #main () { char c = s3.t_$c; } #")) { elsif($ltchars and CheckField("ltchars","t_$c","sgtty.h")) { - print " t_$c ($possible2{$c}) found in ltchars\n"; + print " t_$c ($possible2{$c}) found in ltchars\n" unless SILENT; $billy{$possible2{$c}} = "s3.t_$c"; } @@ -355,7 +365,7 @@ struct termstruct { $struct .= " };"; -print "Writing sgtty section of cchars.h... "; +print "Writing sgtty section of cchars.h... " unless SILENT; print CCHARS " @@ -363,13 +373,13 @@ print "Writing sgtty section of cchars.h $struct #define TermStructure struct termstruct -char * cc_names[] = { ".join('',map(" +STATIC const char * const cc_names[] = { ".join('',map(" \"$_\", ", @values ))." }; #define MAXCC ". ($#values+1)." -XS(XS_Term__ReadKey_GetControlChars) +TRTXS(XS_Term__ReadKey_GetControlChars) { dXSARGS; if (items < 0 || items > 1) { @@ -401,7 +411,7 @@ PUSHs(sv_2mortal(newSVpv(&s.$billy{$valu } } -XS(XS_Term__ReadKey_SetControlChars) +TRTXS(XS_Term__ReadKey_SetControlChars) { dXSARGS; /*if ((items % 2) != 0) { @@ -452,7 +462,7 @@ XS(XS_Term__ReadKey_SetControlChars) #if !defined(CC_TERMIO) && !defined(CC_TERMIOS) && !defined(CC_SGTTY) #define TermStructure int -XS(XS_Term__ReadKey_GetControlChars) +TRTXS(XS_Term__ReadKey_GetControlChars) { dXSARGS; if (items <0 || items>1) { @@ -466,7 +476,7 @@ XS(XS_Term__ReadKey_GetControlChars) } } -XS(XS_Term__ReadKey_SetControlChars) +TRTXS(XS_Term__ReadKey_SetControlChars) { dXSARGS; if (items < 0 || items > 1) { @@ -478,9 +488,10 @@ XS(XS_Term__ReadKey_SetControlChars) #endif +/* ex: set ro: */ "; -print "Done.\n"; +print "Done.\n" unless SILENT; Index: gnu/usr.bin/perl/cpan/Term-ReadKey/example/test.pl =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Term-ReadKey/example/test.pl,v retrieving revision 1.2 diff -u -p -r1.2 test.pl --- gnu/usr.bin/perl/cpan/Term-ReadKey/example/test.pl 3 Jul 2016 01:07:58 -0000 1.2 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/example/test.pl 25 Feb 2020 01:27:42 -0000 @@ -59,7 +59,8 @@ else *IN = *IN; # Make single-use warning go away $| = 1; -my $size1 = join( ",", GetTerminalSize( \IN ) ); +# Bad filehandle: IN at ../lib/Term/ReadKey.pm line 377 with \IN and harness +my $size1 = join( ",", GetTerminalSize( -t \IN ? \IN : "IN" ) ); my $size2 = join( ",", GetTerminalSize("IN") ); my $size3 = join( ",", GetTerminalSize(*IN) ); my $size4 = join( ",", GetTerminalSize( \*IN ) ); Index: gnu/usr.bin/perl/cpan/Term-ReadKey/t/02_terminal_functions.t =================================================================== RCS file: /cvs/src/gnu/usr.bin/perl/cpan/Term-ReadKey/t/02_terminal_functions.t,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 02_terminal_functions.t --- gnu/usr.bin/perl/cpan/Term-ReadKey/t/02_terminal_functions.t 7 May 2016 16:03:09 -0000 1.1.1.1 +++ gnu/usr.bin/perl/cpan/Term-ReadKey/t/02_terminal_functions.t 25 Feb 2020 01:27:42 -0000 @@ -2,11 +2,20 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More ; + +if ( -t STDIN ) { + plan tests => 7; +} +else { + plan skip_all => "Need a terminal to test"; +} use Term::ReadKey; use Fcntl; +$| = 1; + if ( not exists $ENV{COLUMNS} ){ $ENV{COLUMNS} = 80; $ENV{LINES} = 24; @@ -29,24 +38,23 @@ SKIP: } } }; - skip( 'Because Term::ReadKey need at least a tty to be useful', 1 ) if $@; + skip( 'Because Term::ReadKey need at least a tty to be useful', 7 ) if $@; *IN = *IN; # Make single-use warning go away $| = 1; no strict "subs"; - my $size1 = join( ",", GetTerminalSize( \IN ) ); my $size2 = join( ",", GetTerminalSize("IN") ); my $size3 = join( ",", GetTerminalSize(*IN) ); my $size4 = join( ",", GetTerminalSize( \*IN ) ); my $size_result=0; - if ( ( $size1 eq $size2 ) && ( $size2 eq $size3 ) && ( $size3 eq $size4 ) ){ + if ( ( $size2 eq $size3 ) && ( $size3 eq $size4 ) ){ $size_result = 1; } is($size_result, 1, "Comparing TerminalSize IN"); my $usable_terminal=0; for (my $i = 1; $i < 6; $i++){ - if ( &Term::ReadKey::termoptions() == $i ){ + if ( Term::ReadKey::termoptions() == $i ){ $usable_terminal = 1; last; } @@ -55,10 +63,10 @@ SKIP: my @modes; eval { - push( @modes, "O_NODELAY" ) if &Term::ReadKey::blockoptions() & 1; - push( @modes, "poll()" ) if &Term::ReadKey::blockoptions() & 2; - push( @modes, "select()" ) if &Term::ReadKey::blockoptions() & 4; - push( @modes, "Win32" ) if &Term::ReadKey::blockoptions() & 8; + push( @modes, "O_NODELAY" ) if Term::ReadKey::blockoptions() & 1; + push( @modes, "poll()" ) if Term::ReadKey::blockoptions() & 2; + push( @modes, "select()" ) if Term::ReadKey::blockoptions() & 4; + push( @modes, "Win32" ) if Term::ReadKey::blockoptions() & 8; }; is($@, '', "Check non-blocking read");
