Added Cyg-Win

This commit is contained in:
Frank Harris 2026-06-06 18:46:40 -04:00
parent 82cbc206eb
commit 413c315806
10586 changed files with 3806249 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,2 @@
#!/bin/sh
builtin alias "$@"

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Agent-Windows/OGP64/bin/awk Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,278 @@
#!/bin/sh -
#
# bashbug - create a bug report and mail it to the bug address
#
# The bug address depends on the release status of the shell. Versions
# with status `devel', `alpha', `beta', or `rc' mail bug reports to
# chet.ramey@case.edu and, optionally, to bash-testers@cwru.edu.
# Other versions send mail to bug-bash@gnu.org.
#
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# configuration section:
# these variables are filled in by the make target in Makefile
#
MACHINE="x86_64"
OS="cygwin"
CC="gcc"
CFLAGS="-ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fdebug-prefix-map=/cygdrive/d/a/scallywag/bash/bash-5.2.21-1.x86_64/build=/usr/src/debug/bash-5.2.21-1 -fdebug-prefix-map=/cygdrive/d/a/scallywag/bash/bash-5.2.21-1.x86_64/src/bash-5.2.21=/usr/src/debug/bash-5.2.21-1"
RELEASE="5.2"
PATCHLEVEL="21"
RELSTATUS="release"
MACHTYPE="x86_64-pc-cygwin"
PATH=/bin:/usr/bin:/usr/local/bin:$PATH
export PATH
# Check if TMPDIR is set, default to /tmp
: ${TMPDIR:=/tmp}
#Securely create a temporary directory for the temporary files
TEMPDIR=$TMPDIR/bbug.$$
(umask 077 && mkdir "$TEMPDIR") || {
echo "$0: could not create temporary directory" >&2
exit 1
}
TEMPFILE1=$TEMPDIR/bbug1
TEMPFILE2=$TEMPDIR/bbug2
USAGE="Usage: $0 [--help] [--version] [bug-report-email-address]"
VERSTR="GNU bashbug, version ${RELEASE}.${PATCHLEVEL}-${RELSTATUS}"
do_help= do_version=
while [ $# -gt 0 ]; do
case "$1" in
--help) shift ; do_help=y ;;
--version) shift ; do_version=y ;;
--) shift ; break ;;
-*) echo "bashbug: ${1}: invalid option" >&2
echo "$USAGE" >&2
exit 2 ;;
*) break ;;
esac
done
if [ -n "$do_version" ]; then
echo "${VERSTR}"
exit 0
fi
if [ -n "$do_help" ]; then
echo "${VERSTR}"
echo "${USAGE}"
echo
cat << HERE_EOF
Bashbug is used to send mail to the Bash maintainers
for when Bash doesn't behave like you'd like, or expect.
Bashbug will start up your editor (as defined by the shell's
EDITOR environment variable) with a preformatted bug report
template for you to fill in. The report will be mailed to the
bug-bash mailing list by default. See the manual for details.
If you invoke bashbug by accident, just quit your editor without
saving any changes to the template, and no bug report will be sent.
HERE_EOF
exit 0
fi
# Figure out how to echo a string without a trailing newline
N=`echo 'hi there\c'`
case "$N" in
*c) n=-n c= ;;
*) n= c='\c' ;;
esac
BASHTESTERS="bash-testers@cwru.edu"
case "$RELSTATUS" in
alpha*|beta*|devel*|rc*) BUGBASH=chet.ramey@case.edu ;;
*) BUGBASH=bug-bash@gnu.org ;;
esac
case "$RELSTATUS" in
alpha*|beta*|devel*|rc*)
echo "$0: This is a testing release. Would you like your bug report"
echo "$0: to be sent to the bash-testers mailing list?"
echo $n "$0: Send to bash-testers? $c"
read ans
case "$ans" in
y*|Y*) BUGBASH="${BUGBASH},${BASHTESTERS}" ;;
esac ;;
esac
BUGADDR="${1-$BUGBASH}"
if [ -z "$DEFEDITOR" ] && [ -z "$EDITOR" ]; then
if [ -x /usr/bin/editor ]; then
DEFEDITOR=editor
elif [ -x /usr/local/bin/ce ]; then
DEFEDITOR=ce
elif [ -x /usr/local/bin/emacs ]; then
DEFEDITOR=emacs
elif [ -x /usr/contrib/bin/emacs ]; then
DEFEDITOR=emacs
elif [ -x /usr/bin/emacs ]; then
DEFEDITOR=emacs
elif [ -x /usr/bin/xemacs ]; then
DEFEDITOR=xemacs
elif [ -x /usr/bin/vim; then
DEFEDITOR=vim
elif [ -x /usr/bin/gvim; then
DEFEDITOR=gvim
elif [ -x /usr/bin/nano ]; then
DEFEDITOR=nano
elif [ -x /usr/contrib/bin/jove ]; then
DEFEDITOR=jove
elif [ -x /usr/local/bin/jove ]; then
DEFEDITOR=jove
elif [ -x /usr/bin/vi ]; then
DEFEDITOR=vi
else
echo "$0: No default editor found: attempting to use vi" >&2
DEFEDITOR=vi
fi
fi
: ${EDITOR=$DEFEDITOR}
: ${USER=${LOGNAME-`whoami`}}
trap 'rm -rf "$TEMPDIR"; exit 1' 1 2 3 13 15
trap 'rm -rf "$TEMPDIR"' 0
UN=
if (uname) >/dev/null 2>&1; then
UN=`uname -a`
fi
if [ -f /usr/lib/sendmail ] ; then
RMAIL="/usr/lib/sendmail"
SMARGS="-i -t"
elif [ -f /usr/sbin/sendmail ] ; then
RMAIL="/usr/sbin/sendmail"
SMARGS="-i -t"
else
RMAIL=rmail
SMARGS="$BUGADDR"
fi
INITIAL_SUBJECT='[50 character or so descriptive subject here (for reference)]'
cat > "$TEMPFILE1" <<EOF
From: ${USER}
To: ${BUGADDR}
Subject: ${INITIAL_SUBJECT}
Configuration Information [Automatically generated, do not change]:
Machine: $MACHINE
OS: $OS
Compiler: $CC
Compilation CFLAGS: $CFLAGS
uname output: $UN
Machine Type: $MACHTYPE
Bash Version: $RELEASE
Patch Level: $PATCHLEVEL
Release Status: $RELSTATUS
Description:
[Detailed description of the problem, suggestion, or complaint.]
Repeat-By:
[Describe the sequence of events that causes the problem
to occur.]
Fix:
[Description of how to fix the problem. If you don't know a
fix for the problem, don't include this section.]
EOF
cp "$TEMPFILE1" "$TEMPFILE2"
chmod u+w "$TEMPFILE1"
trap '' 2 # ignore interrupts while in editor
edstat=1
while [ $edstat -ne 0 ]; do
$EDITOR "$TEMPFILE1"
edstat=$?
if [ $edstat -ne 0 ]; then
echo "$0: editor \`$EDITOR' exited with nonzero status."
echo "$0: Perhaps it was interrupted."
echo "$0: Type \`y' to give up, and lose your bug report;"
echo "$0: type \`n' to re-enter the editor."
echo $n "$0: Do you want to give up? $c"
read ans
case "$ans" in
[Yy]*) exit 1 ;;
esac
continue
fi
# find the subject from the temp file and see if it's been changed
CURR_SUB=`grep '^Subject: ' "$TEMPFILE1" | sed 's|^Subject:[ ]*||' | sed 1q`
case "$CURR_SUB" in
"${INITIAL_SUBJECT}")
echo
echo "$0: You have not changed the subject from the default."
echo "$0: Please use a more descriptive subject header."
echo "$0: Type \`y' to give up, and lose your bug report;"
echo "$0: type \`n' to re-enter the editor."
echo $n "$0: Do you want to give up? $c"
read ans
case "$ans" in
[Yy]*) exit 1 ;;
esac
echo "$0: The editor will be restarted in five seconds."
sleep 5
edstat=1
;;
esac
done
trap 'rm -rf "$TEMPDIR"; exit 1' 2 # restore trap on SIGINT
if cmp -s "$TEMPFILE1" "$TEMPFILE2"
then
echo "File not changed, no bug report submitted."
exit
fi
echo $n "Send bug report to ${BUGADDR}? [y/n] $c"
read ans
case "$ans" in
[Nn]*) exit 0 ;;
esac
${RMAIL} $SMARGS < "$TEMPFILE1" || {
cat "$TEMPFILE1" >> $HOME/dead.bashbug
echo "$0: mail to ${BUGADDR} failed: report saved in $HOME/dead.bashbug" >&2
echo "$0: please send it manually to ${BUGADDR}" >&2
}
exit 0

View file

@ -0,0 +1,2 @@
#!/bin/sh
builtin bg "$@"

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,76 @@
#!/bin/sh
# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
# Bzcmp/diff wrapped for bzip2,
# adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
# Bzcmp and bzdiff are used to invoke the cmp or the diff pro-
# gram on compressed files. All options specified are passed
# directly to cmp or diff. If only 1 file is specified, then
# the files compared are file1 and an uncompressed file1.gz.
# If two files are specified, then they are uncompressed (if
# necessary) and fed to cmp or diff. The exit status from cmp
# or diff is preserved.
PATH="/usr/bin:/bin:$PATH"; export PATH
prog=`echo $0 | sed 's|.*/||'`
case "$prog" in
*cmp) comp=${CMP-cmp} ;;
*) comp=${DIFF-diff} ;;
esac
OPTIONS=
FILES=
for ARG
do
case "$ARG" in
-*) OPTIONS="$OPTIONS $ARG";;
*) if test -f "$ARG"; then
FILES="$FILES $ARG"
else
echo "${prog}: $ARG not found or not a regular file"
exit 1
fi ;;
esac
done
if test -z "$FILES"; then
echo "Usage: $prog [${comp}_options] file [file]"
exit 1
fi
set $FILES
if test $# -eq 1; then
FILE=`echo "$1" | sed 's/.bz2$//'`
bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE"
STAT="$?"
elif test $# -eq 2; then
case "$1" in
*.bz2)
case "$2" in
*.bz2)
F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || {
echo 'cannot create a temporary file' >&2
exit 1
}
bzip2 -cdfq "$2" > "$tmp"
bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp"
STAT="$?"
/bin/rm -f "$tmp";;
*) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
STAT="$?";;
esac;;
*) case "$2" in
*.bz2)
bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -
STAT="$?";;
*) $comp $OPTIONS "$1" "$2"
STAT="$?";;
esac;;
esac
else
echo "Usage: $prog [${comp}_options] file [file]"
exit 1
fi
exit "$STAT"

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,85 @@
#!/bin/sh
# Bzgrep wrapped for bzip2,
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
## zgrep notice:
## zgrep -- a wrapper around a grep program that decompresses files as needed
## Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
PATH="/usr/bin:$PATH"; export PATH
prog=`echo $0 | sed 's|.*/||'`
case "$prog" in
*egrep) grep=${EGREP-egrep} ;;
*fgrep) grep=${FGREP-fgrep} ;;
*) grep=${GREP-grep} ;;
esac
pat=""
while test $# -ne 0; do
case "$1" in
-e | -f) opt="$opt $1"; shift; pat="$1"
if test "$grep" = grep; then # grep is buggy with -e on SVR4
grep=egrep
fi;;
-A | -B) opt="$opt $1 $2"; shift;;
-*) opt="$opt $1";;
*) if test -z "$pat"; then
pat="$1"
else
break;
fi;;
esac
shift
done
if test -z "$pat"; then
echo "grep through bzip2 files"
echo "usage: $prog [grep_options] pattern [files]"
exit 1
fi
list=0
silent=0
op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
case "$op" in
*l*) list=1
esac
case "$op" in
*h*) silent=1
esac
if test $# -eq 0; then
bzip2 -cdfq | $grep $opt "$pat"
exit $?
fi
res=0
for i do
if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
if test $list -eq 1; then
bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
r=$?
elif test $# -eq 1 -o $silent -eq 1; then
bzip2 -cdfq "$i" | $grep $opt "$pat"
r=$?
else
j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
j=`printf "%s" "$j" | tr '\n' ' '`
# A trick adapted from
# https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J
# that has the same effect as the following bash code:
# bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
# r=${PIPESTATUS[1]}
exec 3>&1
eval `
exec 4>&1 >&3 3>&-
{
bzip2 -cdfq "$i" 4>&-
} | {
$grep $opt "$pat" 4>&-; echo "r=$?;" >&4
} | sed "s|^|${j}:|"
`
fi
test "$r" -ne 0 && res="$r"
done
exit $res

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,61 @@
#!/bin/sh
# Bzmore wrapped for bzip2,
# adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
PATH="/usr/bin:$PATH"; export PATH
prog=`echo $0 | sed 's|.*/||'`
case "$prog" in
*less) more=less ;;
*) more=more ;;
esac
if test "`echo -n a`" = "-n a"; then
# looks like a SysV system:
n1=''; n2='\c'
else
n1='-n'; n2=''
fi
oldtty=`stty -g 2>/dev/null`
if stty -cbreak 2>/dev/null; then
cb='cbreak'; ncb='-cbreak'
else
# 'stty min 1' resets eof to ^a on both SunOS and SysV!
cb='min 1 -icanon'; ncb='icanon eof ^d'
fi
if test $? -eq 0 -a -n "$oldtty"; then
trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
else
trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
fi
if test $# = 0; then
if test -t 0; then
echo usage: $prog files...
else
bzip2 -cdfq | eval $more
fi
else
FIRST=1
for FILE
do
if test $FIRST -eq 0; then
echo $n1 "--More--(Next file: $FILE)$n2"
stty $cb -echo 2>/dev/null
ANS=`dd bs=1 count=1 2>/dev/null`
stty $ncb echo 2>/dev/null
echo " "
if test "$ANS" = 'e' -o "$ANS" = 'q'; then
exit
fi
fi
if test "$ANS" != 's'; then
echo "------> $FILE <------"
bzip2 -cdfq "$FILE" | eval $more
fi
if test -t; then
FIRST=0
fi
done
fi

View file

@ -0,0 +1,87 @@
#!/bin/bash
#set -vx
LCFILE=/etc/pki/ca-trust/ca-legacy.conf
LLINK=/etc/pki/ca-trust/source/ca-bundle.legacy.crt
LDEFAULT=/usr/share/pki/ca-trust-legacy/ca-bundle.legacy.default.crt
LDISABLE=/usr/share/pki/ca-trust-legacy/ca-bundle.legacy.disable.crt
# An absent value, or any unexpected value, is treated as "default".
is_disabled()
{
grep -i "^legacy *= *disable *$" $LCFILE >/dev/null 2>&1
}
do_check()
{
is_disabled
if [ $? -eq 0 ]; then
echo "Legacy CAs are set to DISABLED in file $LCFILE (affects install/upgrade)"
LEXPECT=$LDISABLE
else
echo "Legacy CAs are set to DEFAULT in file $LCFILE (affects install/upgrade)"
LEXPECT=$LDEFAULT
fi
echo "Status of symbolic link $LLINK:"
readlink -v $LLINK
}
do_install()
{
is_disabled
if [ $? -eq 0 ]; then
# found, legacy is disabled
ln -sf $LDISABLE $LLINK
else
# expression not found, legacy is set to default
ln -sf $LDEFAULT $LLINK
fi
}
do_default()
{
sed -i 's/^legacy *=.*$/legacy=default/' $LCFILE
do_install
/usr/bin/update-ca-trust
}
do_disable()
{
sed -i 's/^legacy *=.*$/legacy=disable/' $LCFILE
do_install
/usr/bin/update-ca-trust
}
do_help()
{
echo "usage: $0 [check | default | disable | install]"
}
if [[ $# -eq 0 ]]; then
# no parameters
do_help
exit $?
fi
if [[ "$1" = "install" ]]; then
do_install
exit $?
fi
if [[ "$1" = "default" ]]; then
do_default
exit $?
fi
if [[ "$1" = "disable" ]]; then
do_disable
exit $?
fi
if [[ "$1" = "check" ]]; then
do_check
exit $?
fi
echo "$0: Unsupported command $1"
do_help

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,2 @@
#!/bin/sh
builtin cd "$@"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,2 @@
#!/bin/sh
builtin command "$@"

View file

@ -0,0 +1,577 @@
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # ^ Run only under a shell
#!/usr/bin/perl
=head1 NAME
corelist - a commandline frontend to Module::CoreList
=head1 DESCRIPTION
See L<Module::CoreList> for one.
=head1 SYNOPSIS
corelist -v
corelist [-a|-d] <ModuleName> | /<ModuleRegex>/ [<ModuleVersion>] ...
corelist [-v <PerlVersion>] [ <ModuleName> | /<ModuleRegex>/ ] ...
corelist [-r <PerlVersion>] ...
corelist --utils [-d] <UtilityName> [<UtilityName>] ...
corelist --utils -v <PerlVersion>
corelist --feature <FeatureName> [<FeatureName>] ...
corelist --diff PerlVersion PerlVersion
corelist --upstream <ModuleName>
=head1 OPTIONS
=over
=item -a
lists all versions of the given module (or the matching modules, in case you
used a module regexp) in the perls Module::CoreList knows about.
corelist -a Unicode
Unicode was first released with perl v5.6.2
v5.6.2 3.0.1
v5.8.0 3.2.0
v5.8.1 4.0.0
v5.8.2 4.0.0
v5.8.3 4.0.0
v5.8.4 4.0.1
v5.8.5 4.0.1
v5.8.6 4.0.1
v5.8.7 4.1.0
v5.8.8 4.1.0
v5.8.9 5.1.0
v5.9.0 4.0.0
v5.9.1 4.0.0
v5.9.2 4.0.1
v5.9.3 4.1.0
v5.9.4 4.1.0
v5.9.5 5.0.0
v5.10.0 5.0.0
v5.10.1 5.1.0
v5.11.0 5.1.0
v5.11.1 5.1.0
v5.11.2 5.1.0
v5.11.3 5.2.0
v5.11.4 5.2.0
v5.11.5 5.2.0
v5.12.0 5.2.0
v5.12.1 5.2.0
v5.12.2 5.2.0
v5.12.3 5.2.0
v5.12.4 5.2.0
v5.13.0 5.2.0
v5.13.1 5.2.0
v5.13.2 5.2.0
v5.13.3 5.2.0
v5.13.4 5.2.0
v5.13.5 5.2.0
v5.13.6 5.2.0
v5.13.7 6.0.0
v5.13.8 6.0.0
v5.13.9 6.0.0
v5.13.10 6.0.0
v5.13.11 6.0.0
v5.14.0 6.0.0
v5.14.1 6.0.0
v5.15.0 6.0.0
=item -d
finds the first perl version where a module has been released by
date, and not by version number (as is the default).
=item --diff
Given two versions of perl, this prints a human-readable table of all module
changes between the two. The output format may change in the future, and is
meant for I<humans>, not programs. For programs, use the L<Module::CoreList>
API.
=item -? or -help
help! help! help! to see more help, try --man.
=item -man
all of the help
=item -v
lists all of the perl release versions we got the CoreList for.
If you pass a version argument (value of C<$]>, like C<5.00503> or C<5.008008>),
you get a list of all the modules and their respective versions.
(If you have the C<version> module, you can also use new-style version numbers,
like C<5.8.8>.)
In module filtering context, it can be used as Perl version filter.
=item -r
lists all of the perl releases and when they were released
If you pass a perl version you get the release date for that version only.
=item --utils
lists the first version of perl each named utility program was released with
May be used with -d to modify the first release criteria.
If used with -v <version> then all utilities released with that version of perl
are listed, and any utility programs named on the command line are ignored.
=item --feature, -f
lists the first version bundle of each named feature given
=item --upstream, -u
Shows if the given module is primarily maintained in perl core or on CPAN
and bug tracker URL.
=back
As a special case, if you specify the module name C<Unicode>, you'll get
the version number of the Unicode Character Database bundled with the
requested perl versions.
=cut
BEGIN { pop @INC if $INC[-1] eq '.' }
use Module::CoreList;
use Getopt::Long qw(:config no_ignore_case);
use Pod::Usage;
use strict;
use warnings;
use List::Util qw/maxstr/;
my %Opts;
GetOptions(
\%Opts,
qw[ help|?! man! r|release:s v|version:s a! d diff|D utils feature|f u|upstream ]
);
pod2usage(1) if $Opts{help};
pod2usage(-verbose=>2) if $Opts{man};
if(exists $Opts{r} ){
if ( !$Opts{r} ) {
print "\nModule::CoreList has release info for the following perl versions:\n";
my $versions = { };
my $max_ver_len = max_mod_len(\%Module::CoreList::released);
for my $ver ( grep !/0[01]0$/, sort keys %Module::CoreList::released ) {
printf "%-${max_ver_len}s %s\n", format_perl_version($ver), $Module::CoreList::released{$ver};
}
print "\n";
exit 0;
}
my $num_r = numify_version( $Opts{r} );
my $version_hash = Module::CoreList->find_version($num_r);
if( !$version_hash ) {
print "\nModule::CoreList has no info on perl $Opts{r}\n\n";
exit 1;
}
printf "Perl %s was released on %s\n\n", format_perl_version($num_r), $Module::CoreList::released{$num_r};
exit 0;
}
if(exists $Opts{v} ){
if( !$Opts{v} ) {
print "\nModule::CoreList has info on the following perl versions:\n";
print format_perl_version($_)."\n" for grep !/0[01]0$/, sort keys %Module::CoreList::version;
print "\n";
exit 0;
}
my $num_v = numify_version( $Opts{v} );
if ($Opts{utils}) {
utilities_in_version($num_v);
exit 0;
}
my $version_hash = Module::CoreList->find_version($num_v);
if( !$version_hash ) {
print "\nModule::CoreList has no info on perl $Opts{v}\n\n";
exit 1;
}
if ( !@ARGV ) {
print "\nThe following modules were in perl $Opts{v} CORE\n";
my $max_mod_len = max_mod_len($version_hash);
for my $mod ( sort keys %$version_hash ) {
printf "%-${max_mod_len}s %s\n", $mod, $version_hash->{$mod} || "";
}
print "\n";
exit 0;
}
}
if ($Opts{diff}) {
if(@ARGV != 2) {
die "\nprovide exactly two perl core versions to diff with --diff\n";
}
my ($old_ver, $new_ver) = @ARGV;
my $old = numify_version($old_ver);
if ( !Module::CoreList->find_version($old) ) {
print "\nModule::CoreList has no info on perl $old_ver\n\n";
exit 1;
}
my $new = numify_version($new_ver);
if ( !Module::CoreList->find_version($new) ) {
print "\nModule::CoreList has no info on perl $new_ver\n\n";
exit 1;
}
my %diff = Module::CoreList::changes_between($old, $new);
for my $lib (sort keys %diff) {
my $diff = $diff{$lib};
my $was = ! exists $diff->{left} ? '(absent)'
: ! defined $diff->{left} ? '(undef)'
: $diff->{left};
my $now = ! exists $diff->{right} ? '(absent)'
: ! defined $diff->{right} ? '(undef)'
: $diff->{right};
printf "%-35s %10s %10s\n", $lib, $was, $now;
}
exit(0);
}
if ($Opts{utils}) {
die "\n--utils only available with perl v5.19.1 or greater\n"
if $] < 5.019001;
die "\nprovide at least one utility name to --utils\n"
unless @ARGV;
warn "\n-a has no effect when --utils is used\n" if $Opts{a};
warn "\n--diff has no effect when --utils is used\n" if $Opts{diff};
warn "\n--upstream, or -u, has no effect when --utils is used\n" if $Opts{u};
my $when = maxstr(values %Module::CoreList::released);
print "\n","Data for $when\n";
utility_version($_) for @ARGV;
exit(0);
}
if ($Opts{feature}) {
die "\n--feature is only available with perl v5.16.0 or greater\n"
if $] < 5.016;
die "\nprovide at least one feature name to --feature\n"
unless @ARGV;
no warnings 'once';
require feature;
my %feature2version;
my @bundles = map { $_->[0] }
sort { $b->[1] <=> $a->[1] }
map { [$_, numify_version($_)] }
grep { not /[^0-9.]/ }
keys %feature::feature_bundle;
for my $version (@bundles) {
$feature2version{$_} = $version =~ /^\d\.\d+$/ ? "$version.0" : $version
for @{ $feature::feature_bundle{$version} };
}
# allow internal feature names, just in case someone gives us __SUB__
# instead of current_sub.
while (my ($name, $internal) = each %feature::feature) {
$internal =~ s/^feature_//;
$feature2version{$internal} = $feature2version{$name}
if $feature2version{$name};
}
my $when = maxstr(values %Module::CoreList::released);
print "\n","Data for $when\n";
for my $feature (@ARGV) {
print "feature \"$feature\" ",
exists $feature2version{$feature}
? "was first released with the perl "
. format_perl_version(numify_version($feature2version{$feature}))
. " feature bundle\n"
: "doesn't exist (or so I think)\n";
}
exit(0);
}
if ( !@ARGV ) {
pod2usage(0);
}
while (@ARGV) {
my ($mod, $ver);
if ($ARGV[0] =~ /=/) {
($mod, $ver) = split /=/, shift @ARGV;
} else {
$mod = shift @ARGV;
$ver = (@ARGV && $ARGV[0] =~ /^\d/) ? shift @ARGV : "";
}
if ($mod !~ m|^/(.*)/([imosx]*)$|) { # not a regex
module_version($mod,$ver);
} else {
my $re;
eval { $re = $2 ? qr/(?$2)($1)/ : qr/$1/; }; # trap exceptions while building regex
if ($@) {
# regex errors are usually like 'Quantifier follow nothing in regex; marked by ...'
# then we drop text after ';' to shorten message
my $errmsg = $@ =~ /(.*);/ ? $1 : $@;
warn "\n$mod is a bad regex: $errmsg\n";
next;
}
my @mod = Module::CoreList->find_modules($re);
if (@mod) {
module_version($_, $ver) for @mod;
} else {
$ver |= '';
print "\n$mod $ver has no match in CORE (or so I think)\n";
}
}
}
exit();
sub module_version {
my($mod,$ver) = @_;
if ( $Opts{v} ) {
my $numeric_v = numify_version($Opts{v});
my $version_hash = Module::CoreList->find_version($numeric_v);
if ($version_hash) {
print $mod, " ", $version_hash->{$mod} || 'undef', "\n";
return;
}
else { die "Shouldn't happen" }
}
my $ret = $Opts{d}
? Module::CoreList->first_release_by_date(@_)
: Module::CoreList->first_release(@_);
my $msg = $mod;
$msg .= " $ver" if $ver;
my $rem = $Opts{d}
? Module::CoreList->removed_from_by_date($mod)
: Module::CoreList->removed_from($mod);
my $when = maxstr(values %Module::CoreList::released);
print "\n","Data for $when\n";
if( defined $ret ) {
my $deprecated = Module::CoreList->deprecated_in($mod);
$msg .= " was ";
$msg .= "first " unless $ver;
$msg .= "released with perl " . format_perl_version($ret);
$msg .= ( $rem ? ',' : ' and' ) . " deprecated (will be CPAN-only) in " . format_perl_version($deprecated) if $deprecated;
$msg .= " and removed from " . format_perl_version($rem) if $rem;
} else {
$msg .= " was not in CORE (or so I think)";
}
print $msg,"\n";
if( defined $ret and exists $Opts{u} ) {
my $upstream = $Module::CoreList::upstream{$mod};
$upstream = 'undef' unless $upstream;
print "upstream: $upstream\n";
if ( $upstream ne 'blead' ) {
my $bugtracker = $Module::CoreList::bug_tracker{$mod};
$bugtracker = 'unknown' unless $bugtracker;
print "bug tracker: $bugtracker\n";
}
}
if(defined $ret and exists $Opts{a} and $Opts{a}){
display_a($mod);
}
}
sub utility_version {
my ($utility) = @_;
require Module::CoreList::Utils;
my $released = $Opts{d}
? Module::CoreList::Utils->first_release_by_date($utility)
: Module::CoreList::Utils->first_release($utility);
my $removed = $Opts{d}
? Module::CoreList::Utils->removed_from_by_date($utility)
: Module::CoreList::Utils->removed_from($utility);
if ($released) {
print "$utility was first released with perl ", format_perl_version($released);
print " and later removed in ", format_perl_version($removed)
if $removed;
print "\n";
} else {
print "$utility was not in CORE (or so I think)\n";
}
}
sub utilities_in_version {
my ($version) = @_;
require Module::CoreList::Utils;
my @utilities = Module::CoreList::Utils->utilities($version);
if (not @utilities) {
print "\nModule::CoreList::Utils has no info on perl $version\n\n";
exit 1;
}
print "\nThe following utilities were in perl ",
format_perl_version($version), " CORE\n";
print "$_\n" for sort { lc($a) cmp lc($b) } @utilities;
print "\n";
}
sub max_mod_len {
my $versions = shift;
my $max = 0;
for my $mod (keys %$versions) {
$max = max($max, length $mod);
}
return $max;
}
sub max {
my($this, $that) = @_;
return $this if $this > $that;
return $that;
}
sub display_a {
my $mod = shift;
for my $v (grep !/0[01]0$/, sort keys %Module::CoreList::version ) {
next unless exists $Module::CoreList::version{$v}{$mod};
my $mod_v = $Module::CoreList::version{$v}{$mod} || 'undef';
printf " %-10s %-10s\n", format_perl_version($v), $mod_v;
}
print "\n";
}
{
my $have_version_pm;
sub have_version_pm {
return $have_version_pm if defined $have_version_pm;
return $have_version_pm = eval { require version; 1 };
}
}
sub format_perl_version {
my $v = shift;
return $v if $v < 5.006 or !have_version_pm;
return version->new($v)->normal;
}
sub numify_version {
my $ver = shift;
if ($ver =~ /\..+\./) {
have_version_pm()
or die "You need to install version.pm to use dotted version numbers\n";
$ver = version->new($ver)->numify;
}
$ver += 0;
return $ver;
}
=head1 EXAMPLES
$ corelist File::Spec
File::Spec was first released with perl 5.005
$ corelist File::Spec 0.83
File::Spec 0.83 was released with perl 5.007003
$ corelist File::Spec 0.89
File::Spec 0.89 was not in CORE (or so I think)
$ corelist File::Spec::Aliens
File::Spec::Aliens was not in CORE (or so I think)
$ corelist /IPC::Open/
IPC::Open2 was first released with perl 5
IPC::Open3 was first released with perl 5
$ corelist /MANIFEST/i
ExtUtils::Manifest was first released with perl 5.001
$ corelist /Template/
/Template/ has no match in CORE (or so I think)
$ corelist -v 5.8.8 B
B 1.09_01
$ corelist -v 5.8.8 /^B::/
B::Asmdata 1.01
B::Assembler 0.07
B::Bblock 1.02_01
B::Bytecode 1.01_01
B::C 1.04_01
B::CC 1.00_01
B::Concise 0.66
B::Debug 1.02_01
B::Deparse 0.71
B::Disassembler 1.05
B::Lint 1.03
B::O 1.00
B::Showlex 1.02
B::Stackobj 1.00
B::Stash 1.00
B::Terse 1.03_01
B::Xref 1.01
=head1 COPYRIGHT
Copyright (c) 2002-2007 by D.H. aka PodMaster
Currently maintained by the perl 5 porters E<lt>perl5-porters@perl.orgE<gt>.
This program is distributed under the same terms as perl itself.
See http://perl.org/ or http://cpan.org/ for more info on that.
=cut

Binary file not shown.

View file

@ -0,0 +1,352 @@
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # ^ Run only under a shell
#!/usr/local/bin/perl
BEGIN { pop @INC if $INC[-1] eq '.' }
use strict;
use vars qw($VERSION);
use App::Cpan;
use CPAN::Version;
my $minver = '1.64';
if ( CPAN::Version->vlt($App::Cpan::VERSION, $minver) ) {
warn "WARNING: your version of App::Cpan is $App::Cpan::VERSION while we would expect at least $minver";
}
$VERSION = '1.64';
my $rc = App::Cpan->run( @ARGV );
# will this work under Strawberry Perl?
exit( $rc || 0 );
=head1 NAME
cpan - easily interact with CPAN from the command line
=head1 SYNOPSIS
# with arguments and no switches, installs specified modules
cpan module_name [ module_name ... ]
# with switches, installs modules with extra behavior
cpan [-cfFimtTw] module_name [ module_name ... ]
# use local::lib
cpan -I module_name [ module_name ... ]
# one time mirror override for faster mirrors
cpan -p ...
# with just the dot, install from the distribution in the
# current directory
cpan .
# without arguments, starts CPAN.pm shell
cpan
# without arguments, but some switches
cpan [-ahpruvACDLOPX]
=head1 DESCRIPTION
This script provides a command interface (not a shell) to CPAN. At the
moment it uses CPAN.pm to do the work, but it is not a one-shot command
runner for CPAN.pm.
=head2 Options
=over 4
=item -a
Creates a CPAN.pm autobundle with CPAN::Shell->autobundle.
=item -A module [ module ... ]
Shows the primary maintainers for the specified modules.
=item -c module
Runs a `make clean` in the specified module's directories.
=item -C module [ module ... ]
Show the F<Changes> files for the specified modules
=item -D module [ module ... ]
Show the module details. This prints one line for each out-of-date module
(meaning, modules locally installed but have newer versions on CPAN).
Each line has three columns: module name, local version, and CPAN
version.
=item -f
Force the specified action, when it normally would have failed. Use this
to install a module even if its tests fail. When you use this option,
-i is not optional for installing a module when you need to force it:
% cpan -f -i Module::Foo
=item -F
Turn off CPAN.pm's attempts to lock anything. You should be careful with
this since you might end up with multiple scripts trying to muck in the
same directory. This isn't so much of a concern if you're loading a special
config with C<-j>, and that config sets up its own work directories.
=item -g module [ module ... ]
Downloads to the current directory the latest distribution of the module.
=item -G module [ module ... ]
UNIMPLEMENTED
Download to the current directory the latest distribution of the
modules, unpack each distribution, and create a git repository for each
distribution.
If you want this feature, check out Yanick Champoux's C<Git::CPAN::Patch>
distribution.
=item -h
Print a help message and exit. When you specify C<-h>, it ignores all
of the other options and arguments.
=item -i module [ module ... ]
Install the specified modules. With no other switches, this switch
is implied.
=item -I
Load C<local::lib> (think like C<-I> for loading lib paths). Too bad
C<-l> was already taken.
=item -j Config.pm
Load the file that has the CPAN configuration data. This should have the
same format as the standard F<CPAN/Config.pm> file, which defines
C<$CPAN::Config> as an anonymous hash.
=item -J
Dump the configuration in the same format that CPAN.pm uses. This is useful
for checking the configuration as well as using the dump as a starting point
for a new, custom configuration.
=item -l
List all installed modules with their versions
=item -L author [ author ... ]
List the modules by the specified authors.
=item -m
Make the specified modules.
=item -M mirror1,mirror2,...
A comma-separated list of mirrors to use for just this run. The C<-P>
option can find them for you automatically.
=item -n
Do a dry run, but don't actually install anything. (unimplemented)
=item -O
Show the out-of-date modules.
=item -p
Ping the configured mirrors and print a report
=item -P
Find the best mirrors you could be using and use them for the current
session.
=item -r
Recompiles dynamically loaded modules with CPAN::Shell->recompile.
=item -s
Drop in the CPAN.pm shell. This command does this automatically if you don't
specify any arguments.
=item -t module [ module ... ]
Run a `make test` on the specified modules.
=item -T
Do not test modules. Simply install them.
=item -u
Upgrade all installed modules. Blindly doing this can really break things,
so keep a backup.
=item -v
Print the script version and CPAN.pm version then exit.
=item -V
Print detailed information about the cpan client.
=item -w
UNIMPLEMENTED
Turn on cpan warnings. This checks various things, like directory permissions,
and tells you about problems you might have.
=item -x module [ module ... ]
Find close matches to the named modules that you think you might have
mistyped. This requires the optional installation of Text::Levenshtein or
Text::Levenshtein::Damerau.
=item -X
Dump all the namespaces to standard output.
=back
=head2 Examples
# print a help message
cpan -h
# print the version numbers
cpan -v
# create an autobundle
cpan -a
# recompile modules
cpan -r
# upgrade all installed modules
cpan -u
# install modules ( sole -i is optional )
cpan -i Netscape::Booksmarks Business::ISBN
# force install modules ( must use -i )
cpan -fi CGI::Minimal URI
# install modules but without testing them
cpan -Ti CGI::Minimal URI
=head2 Environment variables
There are several components in CPAN.pm that use environment variables.
The build tools, L<ExtUtils::MakeMaker> and L<Module::Build> use some,
while others matter to the levels above them. Some of these are specified
by the Perl Toolchain Gang:
Lancaster Consensus: L<https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/lancaster-consensus.md>
Oslo Consensus: L<https://github.com/Perl-Toolchain-Gang/toolchain-site/blob/master/oslo-consensus.md>
=over 4
=item NONINTERACTIVE_TESTING
Assume no one is paying attention and skips prompts for distributions
that do that correctly. C<cpan(1)> sets this to C<1> unless it already
has a value (even if that value is false).
=item PERL_MM_USE_DEFAULT
Use the default answer for a prompted questions. C<cpan(1)> sets this
to C<1> unless it already has a value (even if that value is false).
=item CPAN_OPTS
As with C<PERL5OPT>, a string of additional C<cpan(1)> options to
add to those you specify on the command line.
=item CPANSCRIPT_LOGLEVEL
The log level to use, with either the embedded, minimal logger or
L<Log::Log4perl> if it is installed. Possible values are the same as
the C<Log::Log4perl> levels: C<TRACE>, C<DEBUG>, C<INFO>, C<WARN>,
C<ERROR>, and C<FATAL>. The default is C<INFO>.
=item GIT_COMMAND
The path to the C<git> binary to use for the Git features. The default
is C</usr/local/bin/git>.
=back
=head1 EXIT VALUES
The script exits with zero if it thinks that everything worked, or a
positive number if it thinks that something failed. Note, however, that
in some cases it has to divine a failure by the output of things it does
not control. For now, the exit codes are vague:
1 An unknown error
2 The was an external problem
4 There was an internal problem with the script
8 A module failed to install
=head1 TO DO
* one shot configuration values from the command line
=head1 BUGS
* none noted
=head1 SEE ALSO
Most behaviour, including environment variables and configuration,
comes directly from CPAN.pm.
=head1 SOURCE AVAILABILITY
This code is in Github in the CPAN.pm repository:
https://github.com/andk/cpanpm
The source used to be tracked separately in another GitHub repo,
but the canonical source is now in the above repo.
=head1 CREDITS
Japheth Cleaver added the bits to allow a forced install (-f).
Jim Brandt suggest and provided the initial implementation for the
up-to-date and Changes features.
Adam Kennedy pointed out that exit() causes problems on Windows
where this script ends up with a .bat extension
=head1 AUTHOR
brian d foy, C<< <bdfoy@cpan.org> >>
=head1 COPYRIGHT
Copyright (c) 2001-2015, brian d foy, All Rights Reserved.
You may redistribute this under the same terms as Perl itself.
=cut
1;

View file

@ -0,0 +1,48 @@
#!/usr/bin/perl
# Computes and prints to stdout the CRC-32 values of the given files
use 5.006;
use strict;
use lib qw( blib/lib lib );
use Archive::Zip;
use FileHandle;
use vars qw( $VERSION );
BEGIN {
$VERSION = '1.51';
}
my $totalFiles = scalar(@ARGV);
foreach my $file (@ARGV) {
if ( -d $file ) {
warn "$0: ${file}: Is a directory\n";
next;
}
my $fh = FileHandle->new();
if ( !$fh->open( $file, 'r' ) ) {
warn "$0: $!\n";
next;
}
binmode($fh);
my $buffer;
my $bytesRead;
my $crc = 0;
while ( $bytesRead = $fh->read( $buffer, 32768 ) ) {
$crc = Archive::Zip::computeCRC32( $buffer, $crc );
}
my $fileCrc = sprintf("%08x", $crc);
printf("$fileCrc");
print("\t$file") if ( $totalFiles > 1 );
if ( $file =~ /[^[:xdigit:]]([[:xdigit:]]{8})[^[:xdigit:]]/ ) {
my $filenameCrc = $1;
if ( lc($filenameCrc) eq lc($fileCrc) ) {
print("\tOK")
} else {
print("\tBAD $fileCrc != $filenameCrc");
}
}
print("\n");
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more