1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

package: remove a lot more unused AT&T cruft

This reduces the bin/package script by more than half!

bin/package, src/cmd/INIT/package.sh:
- Remove obsolete and unused package commands: admin, contents,
  license, list, remote, regress, setup, update, verify, write.
- Remove associated documentation.
- Replace install command with a dummy. It'll come back when we
  reintroduce the building of dynamic libaries.
- Update the test command to run the regression tests properly
  and capture the output in arch/*/lib/package/gen/tests.out, as
  documented. Arguments are simply passed to bin/shtests.

src/cmd/INIT/{ditto.sh,hurl.sh,release.c}:
- Removed. These were support scripts for some of the removed
  package commands.

src/cmd/ksh93/tests/pty.sh:
- Avoid failure when capturing output via 'bin/package test' by
  redirecting standard error to /dev/tty when running the tests.
This commit is contained in:
Martijn Dekker 2021-12-14 21:13:43 +01:00
parent 61fa1b68bf
commit 6137b99a6b
7 changed files with 100 additions and 8282 deletions

File diff suppressed because it is too large Load diff

View file

@ -18,43 +18,6 @@ setv CCLDFLAGS ${-strip-symbols?1?${mam_cc_LD_STRIP}??}
setv COTEMP $$
setv LDFLAGS
make install
make hurl
make hurl.sh
done hurl.sh
meta hurl %.sh>% hurl.sh hurl
prev hurl.sh
exec - case static,port:$OPTIND:$RANDOM in
exec - ?*:*:*|*::*|*:*:$RANDOM)
exec - ;;
exec - *) if ENV= LC_ALL=C x= $SHELL -nc '[[ a || b ]] && : ${list[level]} !(pattern)' 2>/dev/null
exec - then if grep '### .*archaic.* ###' >/dev/null
exec - then : hurl contains archaic constructs :
exec - else ENV= LC_ALL=C $SHELL -n hurl.sh
exec - fi
exec - fi
exec - ;;
exec - esac
exec - case '${mam_cc_SHELLMAGIC}' in
exec - "") case 184 in
exec - 0) cp hurl.sh hurl
exec - ;;
exec - *) {
exec - i=`(read x; echo $x) < hurl.sh`
exec - case $i in
exec - '#!'*|*'||'*|':'*|'":"'*|"':'"*) echo "$i" ;;
exec - esac
exec - cat hurl.sh
exec - } > hurl
exec - ;;
exec - esac
exec - ;;
exec - *) cat - hurl.sh > hurl <<'!'
exec - ${mam_cc_SHELLMAGIC}
exec - !
exec - ;;
exec - esac
exec - test -w hurl -a -x hurl || chmod u+w,+x hurl
done hurl generated
make iffe
make iffe.sh
done iffe.sh
@ -277,43 +240,6 @@ make install
exec - esac
exec - test -w crossexec -a -x crossexec || chmod u+w,+x crossexec
done crossexec generated
make ditto
make ditto.sh
done ditto.sh
meta ditto %.sh>% ditto.sh ditto
prev ditto.sh
exec - case static,port:$OPTIND:$RANDOM in
exec - ?*:*:*|*::*|*:*:$RANDOM)
exec - ;;
exec - *) if ENV= LC_ALL=C x= $SHELL -nc '[[ a || b ]] && : ${list[level]} !(pattern)' 2>/dev/null
exec - then if grep '### .*archaic.* ###' >/dev/null
exec - then : ditto contains archaic constructs :
exec - else ENV= LC_ALL=C $SHELL -n ditto.sh
exec - fi
exec - fi
exec - ;;
exec - esac
exec - case '${mam_cc_SHELLMAGIC}' in
exec - "") case 232 in
exec - 0) cp ditto.sh ditto
exec - ;;
exec - *) {
exec - i=`(read x; echo $x) < ditto.sh`
exec - case $i in
exec - '#!'*|*'||'*|':'*|'":"'*|"':'"*) echo "$i" ;;
exec - esac
exec - cat ditto.sh
exec - } > ditto
exec - ;;
exec - esac
exec - ;;
exec - *) cat - ditto.sh > ditto <<'!'
exec - ${mam_cc_SHELLMAGIC}
exec - !
exec - ;;
exec - esac
exec - test -w ditto -a -x ditto || chmod u+w,+x ditto
done ditto generated
make execrate
make execrate.sh
done execrate.sh
@ -517,17 +443,6 @@ make install
done ratz.o generated
exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${CCFLAGS} ${LDFLAGS} -o ratz ratz.o
done ratz generated
make release
make release.o
make release.c
prev ast.h implicit
done release.c
meta release.o %.c>%.o release.c release
prev release.c
exec - ${CC} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${CCFLAGS} -c release.c
done release.o generated
exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${CCFLAGS} ${LDFLAGS} -o release release.o
done release generated
make mprobe
make mprobe.sh
done mprobe.sh
@ -618,11 +533,6 @@ make install
exec - then mkdir -p ${INSTALLROOT}/bin
exec - fi
done ${INSTALLROOT}/bin generated
make ${INSTALLROOT}/bin/hurl
prev ${INSTALLROOT}/bin
prev hurl
exec - test '' = 'hurl' || ${STDCMP} 2>/dev/null -s hurl ${INSTALLROOT}/bin/hurl || { ${STDMV} ${INSTALLROOT}/bin/hurl ${INSTALLROOT}/bin/hurl.old 2>/dev/null || true; ${STDCP} hurl ${INSTALLROOT}/bin/hurl ;}
done ${INSTALLROOT}/bin/hurl generated
make ${INSTALLROOT}/bin/iffe
prev iffe
exec - test '' = 'iffe' || ${STDCMP} 2>/dev/null -s iffe ${INSTALLROOT}/bin/iffe || { ${STDMV} ${INSTALLROOT}/bin/iffe ${INSTALLROOT}/bin/iffe.old 2>/dev/null || true; ${STDCP} iffe ${INSTALLROOT}/bin/iffe ;}
@ -711,10 +621,6 @@ make install
prev crossexec
exec - test '' = 'crossexec' || ${STDCMP} 2>/dev/null -s crossexec ${INSTALLROOT}/bin/crossexec || { ${STDMV} ${INSTALLROOT}/bin/crossexec ${INSTALLROOT}/bin/crossexec.old 2>/dev/null || true; ${STDCP} crossexec ${INSTALLROOT}/bin/crossexec ;}
done ${INSTALLROOT}/bin/crossexec generated
make ${INSTALLROOT}/bin/ditto
prev ditto
exec - test '' = 'ditto' || ${STDCMP} 2>/dev/null -s ditto ${INSTALLROOT}/bin/ditto || { ${STDMV} ${INSTALLROOT}/bin/ditto ${INSTALLROOT}/bin/ditto.old 2>/dev/null || true; ${STDCP} ditto ${INSTALLROOT}/bin/ditto ;}
done ${INSTALLROOT}/bin/ditto generated
make ${INSTALLROOT}/bin/filter
prev filter
exec - test '' = 'filter' || ${STDCMP} 2>/dev/null -s filter ${INSTALLROOT}/bin/filter || { ${STDMV} ${INSTALLROOT}/bin/filter ${INSTALLROOT}/bin/filter.old 2>/dev/null || true; ${STDCP} filter ${INSTALLROOT}/bin/filter ;}
@ -736,10 +642,6 @@ make install
prev ratz
exec - test '' = 'ratz' || ${STDCMP} 2>/dev/null -s ratz ${INSTALLROOT}/bin/ratz || { ${STDMV} ${INSTALLROOT}/bin/ratz ${INSTALLROOT}/bin/ratz.old 2>/dev/null || true; ${STDCP} ratz ${INSTALLROOT}/bin/ratz ;}
done ${INSTALLROOT}/bin/ratz generated
make ${INSTALLROOT}/bin/release
prev release
exec - test '' = 'release' || ${STDCMP} 2>/dev/null -s release ${INSTALLROOT}/bin/release || { ${STDMV} ${INSTALLROOT}/bin/release ${INSTALLROOT}/bin/release.old 2>/dev/null || true; ${STDCP} release ${INSTALLROOT}/bin/release ;}
done ${INSTALLROOT}/bin/release generated
make ${INSTALLROOT}/bin/mkdir
make mkdir.sh
done mkdir.sh

View file

@ -1,464 +0,0 @@
########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1994-2011 AT&T Intellectual Property #
# Copyright (c) 2020-2021 Contributors to ksh 93u+m #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# http://www.eclipse.org/org/documents/epl-v10.html #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# #
########################################################################
: replicate directory hierarchies
COMMAND=ditto
case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
0123) ARGV0="-a $COMMAND"
USAGE=$'
[-?
@(#)$Id: ditto (AT&T Labs Research) 2010-11-22 $
]
[-author?Glenn Fowler <gsf@research.att.com>]
[-author?Lefty Koutsofios <ek@research.att.com>]
[-copyright?Copyright (c) 2001-2012 AT&T Intellectual Property]
[-license?http://www.eclipse.org/org/documents/epl-v10.html]
[+NAME?ditto - replicate directory hierarchies]
[+DESCRIPTION?\bditto\b replicates the \asource\a directory hierarchy
to the \adestination\a directory hierarchy. Both \asource\a and
\adestination\a may be of the form
[\auser\a@]][\ahost\a:]][\adirectory\a]]. At least one of
\ahost\a: or \adirectory\a must be specified. The current user is used
if \auser@\a is omitted, the local host is used if \ahost\a: is
omitted, and the user home directory is used if \adirectory\a is
omitted.]
[+?Remote hosts and files are accessed via \bssh\b(1) or \brsh\b(1). \bksh\b(1),
\bpax\b(1), and \btw\b(1) must be installed on the local and remote hosts.]
[+?For each source file \bditto\b does one of these actions:]{
[+chmod|chown?change the mode and/or ownership of the destination
file to match the source]
[+copy?copy the source file to the destination]
[+delete?delete the destination file]
[+skip?the destination file is not changed]
}
[+?The source and destination hierarchies are generated by \btw\b(1) with
the \b--logical\b option. An \b--expr\b option may
be specified to prune the search. The \btw\b searches are relative to
the \asource\a and \adestination\a directories.]
[c:checksum?Copy if the \btw\b(1) 32x4 checksum mismatches.]
[d:delete?Delete \adestination\a files that are not in the \asource\a.]
[e:expr?\btw\b(1) select expression.]:[tw-expression]
[m!:mode?Preserve file mode.]
[n:show?Show the operations but do not execute.]
[o:owner?Preserve file user and group ownership.]
[p:physical?Generate source and destination hierarchies by \btw\b(1) with
the \b--physical\b option.]
[r:remote?The remote access protocol; either \bssh\b or
\brsh\b.]:[protocol:=ssh]
[u:update?Copy only if the \asource\a file is newer than the
\adestination\a file.]
[v:verbose?Trace the operations as they are executed.]
[D:debug?Enable the debug trace.]
source destination
[+SEE ALSO?\brdist\b(1), \brsync\b(1), \brsh\b(1), \bssh\b(1), \btw\b(1)]
'
;;
*) ARGV0=""
USAGE="de:[tw-expression]mnouvD source destination"
;;
esac
usage()
{
OPTIND=0
getopts $ARGV0 "$USAGE" OPT '-?'
exit 2
}
parse() # id user@host:dir
{
typeset id dir user host
id=$1
dir=$2
(( debug || ! exec )) && print -r $id $dir
if [[ $dir == *@* ]]
then
user=${dir%%@*}
dir=${dir#${user}@}
else
user=
fi
if [[ $dir == *:* ]]
then
host=${dir%%:*}
dir=${dir#${host}:}
else
host=
fi
if [[ $user ]]
then
user="-l $user"
if [[ ! $host ]]
then
host=$(hostname)
fi
fi
eval ${id}_user='$user'
eval ${id}_host='$host'
eval ${id}_dir='$dir'
}
# initialize
typeset -A chown chmod
typeset tw cp rm link
integer ntw=0 ncp=0 nrm=0 nlink=0 n
typeset src_user src_host src_path src_type src_uid src_gid src_perm src_sum
typeset dst_user dst_host dst_path dst_type dst_uid dst_gid dst_perm dst_sum
integer src_size src_mtime src_eof
integer dst_size dst_mtime dst_eof
integer debug=0 delete=0 exec=1 mode=1 owner=0 update=0 verbose=0 logical
typeset remote=ssh trace
typeset checksum='"-"' pax="pax"
typeset paxreadflags="" paxwriteflags="--write --format=tgz --nosummary"
tw[ntw++]=tw
(( logical=ntw ))
tw[ntw++]=--logical
tw[ntw++]=--chop
tw[ntw++]=--ignore-errors
tw[ntw++]=--expr=sort:name
# grab the options
while getopts $ARGV0 "$USAGE" OPT
do case $OPT in
c) checksum=checksum ;;
d) delete=1 ;;
e) tw[ntw++]=--expr=\"$OPTARG\" ;;
m) mode=0 ;;
n) exec=0 verbose=1 ;;
o) owner=1 ;;
p) tw[logical]=--physical ;;
r) remote=$OPTARG ;;
u) update=1 ;;
v) verbose=1 ;;
D) debug=1 ;;
*) usage ;;
esac
done
shift $OPTIND-1
if (( $# != 2 ))
then usage
fi
tw[ntw++]=--expr=\''action:printf("%d\t%d\t%s\t%s\t%s\t%-.1s\t%o\t%s\t%s\n", size, mtime, '$checksum', uid, gid, mode, perm, path, symlink);'\'
if (( exec ))
then
paxreadflags="$paxreadflags --read"
fi
if (( verbose ))
then
paxreadflags="$paxreadflags --verbose"
fi
# start the source and destination path list generators
parse src "$1"
parse dst "$2"
# the |& command may exit before the exec &p
# the print sync + read delays the |& until the exec &p finishes
if [[ $src_host ]]
then ($remote $src_user $src_host "{ test ! -f .profile || . ./.profile ;} && cd $src_dir && read && ${tw[*]}") 2>&1 |&
else (cd $src_dir && read && eval "${tw[@]}") 2>&1 |&
fi
exec 5<&p 7>&p
print -u7 sync
exec 7>&-
if [[ $dst_host ]]
then ($remote $dst_user $dst_host "{ test ! -f .profile || . ./.profile ;} && cd $dst_dir && read && ${tw[*]}") 2>&1 |&
else (cd $dst_dir && read && eval "${tw[@]}") 2>&1 |&
fi
exec 6<&p 7>&p
print -u7 sync
exec 7>&-
# scan through the sorted path lists
if (( exec ))
then
src_skip=*
dst_skip=*
else
src_skip=
dst_skip=
fi
src_path='' src_eof=0
dst_path='' dst_eof=0
ifs=${IFS-$' \t\n'}
IFS=$'\t'
while :
do
# get the next source path
if [[ ! $src_path ]] && (( ! src_eof ))
then
if read -r -u5 text src_mtime src_sum src_uid src_gid src_type src_perm src_path src_link
then
if [[ $text != +([[:digit:]]) ]]
then
print -u2 $COMMAND: source: "'$text'"
src_path=
continue
fi
src_size=$text
elif (( dst_eof ))
then
break
elif (( src_size==0 ))
then
exit 1
else
src_path=
src_eof=1
fi
fi
# get the next destination path
if [[ ! $dst_path ]] && (( ! dst_eof ))
then
if read -r -u6 text dst_mtime dst_sum dst_uid dst_gid dst_type dst_perm dst_path dst_link
then
if [[ $text != +([[:digit:]]) ]]
then
print -u2 $COMMAND: destination: $text
dst_path=
continue
fi
dst_size=$text
elif (( src_eof ))
then
break
elif (( dst_size==0 ))
then
exit 1
else
dst_path=
dst_eof=1
fi
fi
# determine the { cp rm chmod chown } ops
if (( debug ))
then
[[ $src_path ]] && print -r -u2 -f $': src %8s %10s %s %s %s %s %3s %s\n' $src_size $src_mtime $src_sum $src_uid $src_gid $src_type $src_perm "$src_path"
[[ $dst_path ]] && print -r -u2 -f $': dst %8s %10s %s %s %s %s %3s %s\n' $dst_size $dst_mtime $dst_sum $dst_uid $dst_gid $dst_type $dst_perm "$dst_path"
fi
if [[ $src_path == $dst_path ]]
then
if [[ $src_type != $dst_type ]]
then
rm[nrm++]=$dst_path
if [[ $dst_path != $dst_skip ]]
then
if [[ $dst_type == d ]]
then
dst_skip="$dst_path/*"
print -r rm -r "'$dst_path'"
else
dst_skip=
print -r rm "'$dst_path'"
fi
fi
fi
if [[ $src_type == l ]]
then if [[ $src_link != $dst_link ]]
then
cp[ncp++]=$src_path
if [[ $src_path != $src_skip ]]
then
src_skip=
print -r cp "'$src_path'"
fi
fi
elif [[ $src_type != d ]] && { (( update && src_mtime > dst_mtime )) || (( ! update )) && { (( src_size != dst_size )) || [[ $src_sum != $dst_sum ]] ;} ;}
then
if [[ $src_path != . ]]
then
cp[ncp++]=$src_path
if [[ $src_path != $src_skip ]]
then
src_skip=
print -r cp "'$src_path'"
fi
fi
else
if (( owner )) && [[ $src_uid != $dst_uid || $src_gid != $dst_gid ]]
then
chown[$src_uid.$src_gid]="${chown[$src_uid.$src_gid]} '$src_path'"
if [[ $src_path != $src_skip ]]
then
src_skip=
print -r chown $src_uid.$src_gid "'$src_path'"
fi
if (( (src_perm & 07000) || mode && src_perm != dst_perm ))
then
chmod[$src_perm]="${chmod[$src_perm]} '$src_path'"
if [[ $src_path != $src_skip ]]
then
src_skip=
print -r chmod $src_perm "'$src_path'"
fi
fi
elif (( mode && src_perm != dst_perm ))
then
chmod[$src_perm]="${chmod[$src_perm]} '$src_path'"
if [[ $src_path != $src_skip ]]
then
src_skip=
print -r chmod $src_perm "'$src_path'"
fi
fi
fi
src_path=
dst_path=
elif [[ ! $dst_path || $src_path && $src_path < $dst_path ]]
then
if [[ $src_path != . ]]
then
cp[ncp++]=$src_path
if [[ $src_path != $src_skip ]]
then
if [[ $src_type == d ]]
then
src_skip="$src_path/*"
print -r cp -r "'$src_path'"
else
src_skip=
print -r cp "'$src_path'"
fi
fi
fi
src_path=
elif [[ $dst_path ]]
then
if (( delete ))
then
rm[nrm++]=$dst_path
if [[ $dst_path != $dst_skip ]]
then
if [[ $dst_type == d ]]
then
dst_skip="$dst_path/*"
print -r rm -r "'$dst_path'"
else
dst_skip=
print -r rm "'$dst_path'"
fi
fi
fi
dst_path=
fi
done
IFS=$ifs
(( exec )) || exit 0
# generate, transfer and execute the { rm chown chmod } script
if (( ${#rm[@]} || ${#chmod[@]} || ${#chown[@]} ))
then
{
if (( verbose ))
then
print -r -- set -x
fi
print -nr -- cd "'$dst_dir'"
n=0
for i in ${rm[@]}
do
if (( --n <= 0 ))
then
n=32
print
print -nr -- rm -rf
fi
print -nr -- " '$i'"
done
for i in ${!chown[@]}
do
n=0
for j in ${chown[$i]}
do
if (( --n <= 0 ))
then
n=32
print
print -nr -- chown $i
fi
print -nr -- " $j"
done
done
for i in ${!chmod[@]}
do
n=0
for j in ${chmod[$i]}
do
if (( --n <= 0 ))
then
n=32
print
print -nr -- chmod $i
fi
print -nr -- " $j"
done
done
print
} | {
if (( ! exec ))
then
cat
elif [[ $dst_host ]]
then
$remote $dst_user $dst_host sh
else
$SHELL
fi
}
fi
# generate, transfer and read back the { cp } tarball
if (( ${#cp[@]} ))
then
{
cd $src_dir &&
print -r -f $'%s\n' "${cp[@]}" |
$pax $paxwriteflags
} | {
if [[ $dst_host ]]
then
$remote $dst_user $dst_host "{ test ! -f .profile || . ./.profile ;} && { test -d \"$dst_dir\" || mkdir -p \"$dst_dir\" ;} && cd \"$dst_dir\" && gunzip | $pax $paxreadflags"
else
( { test -d "$dst_dir" || mkdir -p "$dst_dir" ;} && cd "$dst_dir" && gunzip | $pax $paxreadflags )
fi
}
wait
fi

View file

@ -1,212 +0,0 @@
########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1994-2011 AT&T Intellectual Property #
# Copyright (c) 2020-2021 Contributors to ksh 93u+m #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# http://www.eclipse.org/org/documents/epl-v10.html #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# #
########################################################################
: copy http url data
(command set -o posix) 2>/dev/null && set -o posix
command=hurl
agent="$command/2009-01-20 (AT&T Research)"
authorize=
verbose=0
case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
0123) ARGV0="-a $command"
USAGE=$'
[-?
@(#)$Id: hurl (AT&T Research) 2009-01-20 $
]
[-author?Glenn Fowler <gsf@research.att.com>]
[-copyright?Copyright (c) 2003-2012 AT&T Intellectual Property]
[-license?http://www.eclipse.org/org/documents/epl-v10.html]
[+NAME?hurl - copy http url data]
[+DESCRIPTION?\bhurl\b copies the data for the \bhttp\b \aurl\a operand
to the standard output. The \aurl\a must be of the form
\b[http://]]\b\ahost\a[\b:\b\aport\a]]\b/\b\apath\a. The default
\aport\a is \b80\b.]
[+?\bhurl\b is a shell script that attempts to access the \aurl\a by
these methods:]{
[+/dev/tcp/\ahost\a\b/80\b?Supported by \bksh\b(1) and recent
\bbash\b(1).]
[+wget -nv -O - \aurl\a?]
[+lynx -source \aurl\a?]
[+curl -s -L -o - \aurl\a?]
}
[a:authorize?The url authorization user name and password, separated
by \b:\b (one colon character).]:[user::password]
[s:size?Terminate the data transmission after \abytes\a have been
transferred.]:[bytes]
[v:verbose?Verbose trace.]
url
[+SEE ALSO?\bcurl\b(1), \blynx\b(1), \bwget\b(1)]
'
;;
*) ARGV0=""
USAGE="a:v"
;;
esac
usage()
{
OPTIND=0
getopts $ARGV0 "$USAGE" OPT '-?'
exit 2
}
integer limit=0 total=0 block=8*1024
while getopts $ARGV0 "$USAGE" OPT
do case $OPT in
a) authorize=$OPTARG ;;
s) limit=$OPTARG ;;
v) verbose=1 ;;
esac
done
shift `expr $OPTIND - 1`
url=$1
AUTHORIZE=
exec 9<&0
while :
do test 0 != $verbose && echo "$command: url=$url" >&2
case $url in
*://*/*)prot=${url%%:*}
url=${url#*://}
;;
*) prot=http
;;
esac
host=$url
path=/${host#*/}
host=${host%%/*}
case $host in
*:+([0-9]))
port=${host##*:}
host=${host%:*}
;;
*) port=80
;;
esac
test 0 != $verbose && echo "$command: prot=$prot host=$host port=$port path=$path" >&2
case $prot in
http) if (eval "exec >" || exit 0) 2>/dev/null &&
eval "exec 8<> /dev/tcp/\$host/$port" 2>/dev/null
then test 0 != $verbose && echo "$command: using /dev/tcp/$host/$port" >&2
if ! echo "GET $path HTTP/1.0
Host: $host
User-Agent: $agent ${AUTHORIZE}
" >&8
then echo "$command: $host: write error"
exit 1
fi
{
if ! read prot code text
then echo "$command: $host: read error" >&2
exit 1
fi
code=${code%:*}
type=Basic
realm=access
test 0 != $verbose && echo "$command: prot=$prot code=$code $text" >&2
while :
do if ! read head data
then echo "$command: $host: read error" >&2
exit 1
fi
test 0 != $verbose && echo "$command: head=$head $data" >&2
case $head in
Location:)
case $code in
30[123])url=$data
continue 2
;;
esac
;;
WWW-Authenticate:)
set -- $data
type=$1
shift
eval "$@"
realm=${realm%$'\r'}
;;
''|?) break
;;
esac
done
case $code in
200) if (( limit ))
then (( limit = (limit + block - 1) / block))
dd bs=$block count=$limit silent=1
else cat
fi
exit
;;
401) {
if [[ $AUTHORIZE || $type != Basic ]]
then print authorization failed
exit 1
fi
if [[ ! $authorize ]]
then if [[ ! -t 0 ]]
then print authorization failed
exit 1
fi
print -n "Enter user name for $realm: "
read -u9 user
print -n "Password: "
trap 'stty echo <&9' 0 1 2 3 15
stty -echo
read password
stty echo
print
trap - 0 1 2 3 15
authorize=$user:$password
fi
AUTHORIZE=$'\nAuthorization: '$type' '$(print -n -r -- "$authorize" | uuencode -h -x base64)$'\r'
} <&9 >&2
continue 2
;;
*) echo "$0: $url: $code: $text" >&2
exit 1
;;
esac
} <&8
elif wget ${authorize:+--http-user="${authorize%:*}"} ${password:+--http-passwd="${password##*:}"} -nv -O - $url 2>/dev/null
then test 0 != $verbose && echo "$command: using wget" >&2
exit
elif lynx ${authorize:+-auth "$authorize"} -source $url 2>/dev/null
then test 0 != $verbose && echo "$command: using wget" >&2
exit
elif curl ${authorize:+-u "$authorize"} -s -L -o - $url 2>/dev/null
then test 0 != $verbose && echo "$command: using curl" >&2
exit
else echo "$command: $url: { /dev/tcp/$host/$port wget curl } failed" >&2
exit 1
fi
;;
*) echo "$command: $prot: protocol not supported" >&2
exit 1
;;
esac
done

File diff suppressed because it is too large Load diff

View file

@ -1,374 +0,0 @@
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1990-2011 AT&T Intellectual Property *
* Copyright (c) 2020-2021 Contributors to ksh 93u+m *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.eclipse.org/org/documents/epl-v10.html *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
#pragma clang diagnostic ignored "-Wdeprecated-register"
#pragma clang diagnostic ignored "-Wparentheses"
/*
* release -- list recent release changes
*
* coded for portability
*/
static char id[] = "\n@(#)$Id: release (AT&T Research) 2000-01-28 $\0\n";
#if _PACKAGE_ast
#include <ast.h>
#include <error.h>
static const char usage[] =
"[-?\n@(#)$Id: release (AT&T Research) 2000-01-28 $\n]"
"[-author?Glenn Fowler <gsf@research.att.com>]"
"[-copyright?Copyright (c) 1994-2012 AT&T Intellectual Property]"
"[-license?http://www.eclipse.org/org/documents/epl-v10.html]"
"[+NAME?release - list recent changes]"
"[+DESCRIPTION?\brelease\b lists the changes within the date range specified"
" by the \b--from\b and \b--to\b options. The input files are assumed to"
" contain date tag lines of the form [\acc\a]]\ayy-mm-dd\a [ \atext\a ]]"
" (or \bdate\b(1) default format), where \acc\a is determined by a Y2K"
" window year of 69 (we can produce an example coding dated 1991 - this"
" can be patented?, how about 1+1=2?). The date tag lines are followed by"
" \areadme\a text in reverse chronological order (newer entries at the"
" top of the file). If no selection options are specified then all"
" changes are listed. If no \afile\a operands are specified then the"
" standard input is read.]"
"[+?The entries for each \afile\a are annotated with the file directory name.]"
"[f:from?Entries older than \adate\a are omitted.]:[date]"
"[r:release?List all changes that include the first \acount\a release marks."
" A release mark has a date tag followed by optional space and at least"
" three \b-\b characters. Changes from release mark \acount\a+1 are not"
" listed. If there are no release marks then the date range is used;"
" if there is at least one release mark then the date range is ignored"
" and at most \acount\a release marks will be listed.]#[count]"
"[t:to?Entries newer than \adate\a are omitted.]:[date]"
"[V?Print the program version and exit.]"
"\n"
"\n[ file ... ]\n"
"\n"
"[+SEE ALSO?\bpackage\b(1)]"
;
#else
#define elementsof(x) ((int)(sizeof(x)/sizeof(x[0])))
#define NiL ((char*)0)
#endif
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/types.h>
#if !_PACKAGE_ast && defined(__STDC__)
#include <stdlib.h>
#include <string.h>
#endif
static char mon[] = "janfebmaraprmayjunjulaugsepoctnovdec";
static char day[] = "sunmontuewedthufrisat";
#if !_PACKAGE_ast
static void
usage()
{
fprintf(stderr, "Usage: release [-V] [-h hi-date] [-l lo-date] [-r count] [ file ...]\n");
exit(2);
}
#endif
static unsigned long
number(register char* s, char** e)
{
unsigned long q = 0;
while (isspace(*s))
s++;
while (isdigit(*s))
q = q * 10 + *s++ - '0';
if (e)
*e = s;
return q;
}
unsigned long
string(register char* s, char* tab, int num, int siz, char** e)
{
register int i;
register int j;
char buf[16];
while (isspace(*s))
s++;
for (i = 0; i < siz; i++)
buf[i] = isupper(s[i]) ? tolower(s[i]) : s[i];
for (i = 0; i < num; i += siz)
for (j = 0; j < siz && buf[j] == tab[j+i]; j++)
if (j == (siz - 1))
{
*e = s + siz;
return i / siz + 1;
}
return 0;
}
static unsigned long
date(char* s, char** e)
{
char* t;
unsigned long y;
unsigned long m;
unsigned long d;
if (isdigit(*s))
{
y = number(s, &t);
if (*t != '-')
return 0;
switch (t - s)
{
case 2:
y += 1900;
if (y <= 1969)
y += 100;
break;
case 4:
if (y < 1969)
return 0;
break;
}
if (!(m = number(++t, &s)))
return 0;
if ((s - t) != 2 || *s != '-' || m < 1 || m > 12)
return 0;
if (!(d = number(++s, &t)))
return 0;
if ((t - s) != 2 || d < 1 || d > 31)
return 0;
}
else
{
if (string(s, day, elementsof(day), 3, &t))
s = t;
if (!(m = string(s, mon, elementsof(mon), 3, &t)))
return 0;
if (!(d = number(t, &s)))
return 0;
for (y = 1969; *s; s++)
if ((y = number(s, &t)) && (t - s) == 4)
{
if (y < 1969)
return 0;
break;
}
}
if (e)
{
while (isspace(*t))
t++;
*e = t;
}
return ((y - 1969) * 13 + m) * 32 + d;
}
int
main(int argc, char** argv)
{
register char* s;
register char* u;
register char* v;
char* p;
char* e;
int i;
unsigned long t;
unsigned long lo;
unsigned long hi;
int mk;
FILE* f;
char buf[1024];
mk = 0;
lo = hi = 0;
#if _PACKAGE_ast
error_info.id = "release";
for (;;)
{
switch (optget(argv, usage))
{
case 'f':
if (!(lo = date(opt_info.arg, &e)) || *e)
{
error(2, "%s: invalid from date [%s]", opt_info.arg, e);
return 1;
}
continue;
case 'r':
mk = opt_info.num + 1;
continue;
case 't':
if (!(hi = date(opt_info.arg, &e)) || *e)
{
error(2, "%s: invalid to date [%s]", opt_info.arg, e);
return 1;
}
continue;
case 'V':
sfprintf(sfstdout, "%s\n", id + 10);
return 0;
case '?':
error(ERROR_usage(2), "%s", opt_info.arg);
UNREACHABLE();
case ':':
error(2, "%s", opt_info.arg);
continue;
}
break;
}
if (error_info.errors)
{
error(ERROR_usage(2), "%s", optusage(NiL));
UNREACHABLE();
}
argv += opt_info.index;
#else
while ((s = *++argv) && *s == '-' && *(s + 1))
{
if (*(s + 1) == '-')
{
if (!*(s + 2))
{
argv++;
break;
}
usage();
break;
}
for (;;)
{
switch (i = *++s)
{
case 0:
break;
case 'f':
case 't':
if (!*(v = ++s) && !(v = *++argv))
{
s = "??";
continue;
}
if (!(t = date(v, &e)) || *e)
{
fprintf(stderr, "release: -%c%s: invalid date [%s]\n", i, s, e);
return 1;
}
switch (i)
{
case 'f':
lo = t;
break;
case 't':
hi = t;
break;
}
break;
case 'r':
if (!*(v = ++s) && !(v = *++argv))
{
s = "??";
continue;
}
mk = number(v, &e) + 1;
if (*e)
{
fprintf(stderr, "release: -%c%s: invalid count\n", i, s);
return 1;
}
break;
case 'V':
fprintf(stdout, "%s\n", id + 10);
return 0;
default:
fprintf(stderr, "release: -%c: unknown option\n", i);
/* FALLTHROUGH */
case '?':
usage();
break;
}
break;
}
}
#endif
do
{
if (!(p = *argv++) || !*p || *p == '-' && !*(p + 1))
{
argv--;
p = "";
f = stdin;
}
else if (!(f = fopen(p, "r")))
{
fprintf(stderr, "release: %s: cannot read", p);
return 1;
}
while (s = fgets(buf, sizeof(buf), f))
{
if (t = date(s, &e))
{
if (mk && e[0] == '-' && e[1] == '-' && e[2] == '-' && !--mk)
break;
if (t < lo)
break;
if (hi && t > hi)
continue;
if (p)
{
if (*p)
{
for (u = v = p; *p; p++)
if (*p == '/')
{
v = u;
u = p + 1;
}
printf("\n:::::::: ");
while ((i = *v++) && i != '/')
fputc(i, stdout);
printf(" ::::::::\n\n");
}
p = 0;
}
}
if (!p)
fputs(s, stdout);
}
if (f == stdin)
break;
fclose(f);
} while (*argv);
return 0;
}

View file

@ -45,7 +45,7 @@ esac
# To avoid false regressions, we have to set 'erase' and 'kill' on the real terminal.
if test -t 0 2>/dev/null </dev/tty && stty_restore=$(stty -g </dev/tty)
then trap 'stty "$stty_restore" </dev/tty' EXIT # note: on ksh, the EXIT trap is also triggered for termination due to a signal
stty erase ^H kill ^X
stty erase ^H kill ^X </dev/tty >/dev/tty 2>&1
else warning "cannot set tty state -- tests skipped"
exit 0
fi
@ -75,7 +75,7 @@ function tst
integer lineno=$1 offset
typeset text
pty $debug --dialogue --messages='/dev/fd/1' $SHELL |
pty $debug --dialogue --messages='/dev/fd/1' 2>/dev/tty $SHELL |
while read -r text
do if [[ $text == *debug* ]]
then print -u2 -r -- "$text"