diff --git a/COPYRIGHT b/COPYRIGHT index ff394bd4e971..48ddcc63a00d 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -16,8 +16,8 @@ ksh 93u+m general copyright notice # # # Martijn Dekker # # Johnothan King # -# hyenias <58673227+hyenias@users.noreply.github.com> # # K. Eugene Carlson # +# hyenias <58673227+hyenias@users.noreply.github.com> # # Anuradha Weeraman # # Lev Kujawski # # Phi # diff --git a/bin/mamprobe b/bin/mamprobe deleted file mode 100755 index 28487443179c..000000000000 --- a/bin/mamprobe +++ /dev/null @@ -1,257 +0,0 @@ -######################################################################## -# # -# This software is part of the ast package # -# Copyright (c) 1994-2011 AT&T Intellectual Property # -# Copyright (c) 2020-2022 Contributors to ksh 93u+m # -# and is licensed under the # -# Eclipse Public License, Version 2.0 # -# # -# A copy of the License is available at # -# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html # -# (with md5 checksum 84283fa8859daf213bdda5a9f8d1be1d) # -# # -# Glenn Fowler # -# Martijn Dekker # -# # -######################################################################## -### this script contains archaic constructs that work with all sh variants ### -# mamprobe - generate MAM cc probe info -# Glenn Fowler - -(command set -o posix) 2>/dev/null && set -o posix - -command=mamprobe - -bins=` - ( - userPATH=$PATH - PATH=/run/current-system/sw/bin:/usr/xpg7/bin:/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin:$PATH - getconf PATH 2>/dev/null && echo "$userPATH" || echo /bin:/usr/bin:/sbin:/usr/sbin:"$userPATH" - ) | sed 's/:/ /g' -` || exit - -# check the options - -opt= - -case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in -0123) USAGE=$' -[-? -@(#)$Id: mamprobe (ksh 93u+m) 2022-10-26 $ -] -[+NAME?mamprobe - generate MAM cc probe info] -[+DESCRIPTION?\bmamprobe\b generates MAM (make abstract machine) \bcc\b(1) - probe information for use by \bmamake\b(1). \acc-path\a is the - absolute path of the probed compiler and \ainfo-file\a is where - the information is placed. \ainfo-file\a is usually - \b$INSTALLROOT/lib/probe/C/mam/\b\ahash\a, where \ahash\a is a hash - of \acc-path\a. Any \ainfo-file\a directories are created if needed. - If \ainfo-file\a is \b-\b then the probe information is written to - the standard output.] -[+?\bmamprobe\b and \bmamake\b are used in the bootstrap phase of - \bpackage\b(1) installation before \bnmake\b(1) is built. The - probed variable names are the \bnmake\b(1) names with a \bmam_\b - prefix, \bCC\b converted to \bcc\b, and \b.\b converted to \b_\b. - Additional variables are:]{ - [+_hosttype_?the \bpackage\b(1) host type] - [+mam_cc_L?\b-L\b\adir\a supported] - [+STDCAT?command to execute for \bcat\b(1)] - [+STDCHMOD?command to execute for \bchmod\b(1)] - [+STDCMP?command to execute for \bcmp\b(1)] - [+STDCP?command to execute for \bcp\b(1)] - [+STDED?command to execute for \bed\b(1) or \bex\b(1)] - [+STDEDFLAGS?flags for \bSTDED\b] - [+STDLN?command to execute for \bln\b(1)] - [+STDMV?command to execute for \bmv\b(1)] - [+STDRM?command to execute for \brm\b(1)] -} -[d:debug?Enable probe script debug trace.] - -info-file cc-path - -[+SEE ALSO?\bpackage\b(1), \bmamake\b(1), \bnmake\b(1), \bprobe\b(1)] -' - while getopts -a "$command" "$USAGE" OPT - do case $OPT in - d) opt=-d ;; - esac - done - shift `expr $OPTIND - 1` - ;; -*) while : - do case $# in - 0) break ;; - esac - case $1 in - --) shift - break - ;; - -) break - ;; - -d) opt=-d - ;; - -*) echo $command: $1: unknown option >&2 - ;; - *) break - ;; - esac - set '' - break - done - ;; -esac - -# check the args - -case $1 in --) ;; -/*) ;; -*) set '' ;; -esac -case $2 in -/*) ;; -*) set '' ;; -esac -case $# in -0|1) echo "Usage: $command info-file cc-path" >&2; exit 2 ;; -esac -info=$1 -shift -cc=$* - -# find the make probe script - -ifs=${IFS-' - '} -IFS=: -set $PATH -IFS=$ifs -script=lib/probe/C/make/probe -while : -do case $# in - 0) echo "$0: ../$script: probe script not found on PATH" >&2 - exit 1 - ;; - esac - case $1 in - '') continue ;; - esac - makeprobe=`echo $1 | sed 's,[^/]*$,'$script,` - if test -x $makeprobe - then break - fi - shift -done - -# create the info dir if necessary - -case $info in -/*) i=X$info - ifs=${IFS-' - '} - IFS=/ - set $i - IFS=$ifs - while : - do i=$1 - shift - case $i in - X) break ;; - esac - done - case $info in - //*) path=/ ;; - *) path= ;; - esac - while : - do case $# in - 0|1) break ;; - esac - comp=$1 - shift - case $comp in - '') continue ;; - esac - path=$path/$comp - if test ! -d $path - then mkdir $path || exit - fi - done - ;; -esac - -# generate info in a tmp file and rename when finished - -case $info in --) ;; -*) tmp=${TMPDIR:-/tmp}/mam$$ - trap "exec >/dev/null; rm -f $tmp" 0 1 2 3 15 - exec > $tmp - echo "probing C language processor $cc for mam information" >&2 - ;; -esac - -echo "note generated by $0 for $cc" - -( - set '' $opt $cc - shift - . $makeprobe "$@" - - case " $CC_DIALECT " in - *" -L "*) echo "CC.L = 1" ;; - esac - -) | sed \ - -e '/^CC\./!d' \ - -e 's/^CC./setv mam_cc_/' \ - -e 's/^\([^=.]*\)\./\1_/' \ - -e 's/^\([^=.]*\)\./\1_/' \ - -e 's/ =//' \ - -e 's/\$("\([^"]*\)")/\1/g' \ - -e 's/\$(\([^)]*\))/${\1}/g' \ - -e 's/\${CC\./${mam_cc_}/g' - -echo 'setv _hosttype_ ${mam_cc_HOSTTYPE}' - -# STD* are standard commands/flags - -if ( -ed < /dev/null 2>&1 -then STDED=ed -else STDED=ex -fi -STDEDFLAGS=- -set STDCAT cat STDCHMOD chmod STDCMP cmp STDCP cp STDLN ln STDMV mv STDRM rm -while : -do case $# in - 0|1) break ;; - esac - p=$2 - for d in $bins - do if test -x $d/$p - then p=$d/$p - break - fi - done - eval $1=\$p - shift - shift -done -for n in STDCAT STDCHMOD STDCMP STDCP STDED STDEDFLAGS STDLN STDMV STDRM -do eval echo setv \$n \$$n -done - -# all done - -case $info in --) ;; -*) exec >/dev/null - test -f "$info" && rm -f "$info" - cp "$tmp" "$info" - chmod -w "$info" - ;; -esac diff --git a/bin/package b/bin/package index 260f326be61d..8597c4876b43 100755 --- a/bin/package +++ b/bin/package @@ -2,7 +2,7 @@ # # # This software is part of the ast package # # Copyright (c) 1994-2012 AT&T Intellectual Property # -# Copyright (c) 2020-2023 Contributors to ksh 93u+m # +# Copyright (c) 2020-2024 Contributors to ksh 93u+m # # and is licensed under the # # Eclipse Public License, Version 2.0 # # # @@ -115,12 +115,12 @@ command=${0##*/} case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in 0123) USAGE=$' [-? -@(#)$Id: '$command$' (ksh 93u+m) 2023-06-18 $ +@(#)$Id: '$command$' (ksh 93u+m) 2024-01-02 $ ] [-author?Glenn Fowler ] [-author?Contributors to https://github.com/ksh93/ksh] [-copyright?(c) 1994-2012 AT&T Intellectual Property] -[-copyright?(c) 2020-2023 Contributors to ksh 93u+m] +[-copyright?(c) 2020-2024 Contributors to ksh 93u+m] [-license?https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html] [+NAME?'$command$' - build, test and install ksh 93u+m] [+DESCRIPTION?The \b'$command$'\b command is the main control script @@ -543,11 +543,11 @@ SEE ALSO pkgadd(1), pkgmk(1), rpm(1), sh(1), tar(1), optget(3) IMPLEMENTATION - version package (ksh 93u+m) 2023-06-18 + version package (ksh 93u+m) 2024-01-02 author Glenn Fowler author Contributors to https://github.com/ksh93/ksh copyright (c) 1994-2012 AT&T Intellectual Property - copyright (c) 2020-2023 Contributors to ksh 93u+m + copyright (c) 2020-2024 Contributors to ksh 93u+m license https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html' case $1 in html) echo "" ;; @@ -1351,10 +1351,6 @@ int main(void) [Cc][Yy][Gg][Ww][Ii][Nn]_*) type=cygwin ;; - [Uu][Ww][Ii][Nn]*|[Ww]indows_[0123456789][0123456789]|[Ww]indows_[Nn][Tt]) - type=win32 - arch=$(echo $arch | sed -e 's/_[^_]*$//') - ;; esac case $arch in '') case $mach in @@ -1837,24 +1833,6 @@ case $x in for i in lib do test -d $INSTALLROOT/$i || $exec mkdir $INSTALLROOT/$i || exit done - - # no $INITROOT means INIT already installed elsewhere - - if test -d $INITROOT - then - # update the basic package commands - - for i in mamprobe - do test -h $PACKAGEROOT/bin/$i 2>/dev/null || - case $(ls -t $INITROOT/$i.sh $PACKAGEROOT/bin/$i 2>/dev/null) in - "$INITROOT/$i.sh"*) - note "update $PACKAGEROOT/bin/$i" - $exec cp $INITROOT/$i.sh $PACKAGEROOT/bin/$i || exit - $exec chmod +x $PACKAGEROOT/bin/$i || exit - ;; - esac - done - fi ;; esac path=$PATH @@ -2875,33 +2853,38 @@ make|view) ;; esac - # no $INITROOT means INIT already installed elsewhere + # update probe scripts - if test -d $INITROOT - then - # update probe scripts + i=$INSTALLROOT/bin/mamprobe + j=$INITROOT/mamprobe.sh + case $(ls -t "$i" "$j" 2>/dev/null) in + "$i"*) ;; + *) note "update $i" + $exec cp "$j" "$i" || exit + $exec chmod +x "$i" || exit + ;; + esac - for i in lib/probe lib/probe/C lib/probe/C/make - do test -d $INSTALLROOT/$i || $exec mkdir $INSTALLROOT/$i || exit - done - i=$INSTALLROOT/lib/probe/C/make/probe - j=$INITROOT/C+probe - k=$INITROOT/make.probe - case $(ls -t $i $j $k 2>/dev/null) in - $i*) ;; - *) if test -f "$j" && test -f "$k" - then note "update $i" - case $exec in - '') cat $j $k > $i || exit - ;; - *) echo "cat $j $k > $i" - ;; - esac - $exec chmod +x $i || exit - fi - ;; - esac - fi + for i in lib/probe lib/probe/C lib/probe/C/make + do test -d "$INSTALLROOT/$i" || $exec mkdir "$INSTALLROOT/$i" || exit + done + i=$INSTALLROOT/lib/probe/C/make/probe + j=$INITROOT/C+probe + k=$INITROOT/make.probe + case $(ls -t "$i" "$j" "$k" 2>/dev/null) in + "$i"*) ;; + *) if test -f "$j" && test -f "$k" + then note "update $i" + case $exec in + '') cat "$j" "$k" > $i || exit + ;; + *) echo "cat $j $k > $i" + ;; + esac + $exec chmod +x "$i" || exit + fi + ;; + esac # initialize mamake diff --git a/src/cmd/INIT/Mamfile b/src/cmd/INIT/Mamfile index 69eb53c8aa39..a8a528892728 100644 --- a/src/cmd/INIT/Mamfile +++ b/src/cmd/INIT/Mamfile @@ -341,46 +341,6 @@ make install exec - then mkdir -p ${PACKAGEROOT}/bin exec - fi done ${PACKAGEROOT}/bin generated - make ${PACKAGEROOT}/bin/mamprobe - make mamprobe - prev mamprobe.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 : mamprobe contains archaic constructs : - exec - else ENV= LC_ALL=C $SHELL -n mamprobe.sh - exec - fi - exec - fi - exec - ;; - exec - esac - exec - case '${mam_cc_SHELLMAGIC}' in - exec - "") case 0 in - exec - 0) ${STDCP} mamprobe.sh mamprobe - exec - ;; - exec - *) { - exec - i=`(read x; echo $x) < mamprobe.sh` - exec - case $i in - exec - '#!'*|*'||'*|':'*|'":"'*|"':'"*) echo "$i" ;; - exec - esac - exec - ${STDCAT} - mamprobe.sh <<'!' - exec - - exec - ! - exec - } > mamprobe - exec - ;; - exec - esac - exec - ;; - exec - *) ${STDCAT} - mamprobe.sh > mamprobe <<'!' - exec - ${mam_cc_SHELLMAGIC} - exec - - exec - ! - exec - ;; - exec - esac - exec - test -w mamprobe -a -x mamprobe || ${STDCHMOD} u+w,+x mamprobe - done mamprobe generated - exec - ${STDCMP} 2>/dev/null -s mamprobe ${PACKAGEROOT}/bin/mamprobe || { ${STDMV} ${PACKAGEROOT}/bin/mamprobe ${PACKAGEROOT}/bin/mamprobe.old 2>/dev/null || true; ${STDCP} mamprobe ${PACKAGEROOT}/bin/mamprobe ;} - done ${PACKAGEROOT}/bin/mamprobe generated make ${PACKAGEROOT}/bin/package prev package exec - ${STDCMP} 2>/dev/null -s package ${PACKAGEROOT}/bin/package || { ${STDMV} ${PACKAGEROOT}/bin/package ${PACKAGEROOT}/bin/package.old 2>/dev/null || true; ${STDCP} package ${PACKAGEROOT}/bin/package ;} diff --git a/src/cmd/INIT/make.probe b/src/cmd/INIT/make.probe index c9090f276fbf..7281f0504cb8 100644 --- a/src/cmd/INIT/make.probe +++ b/src/cmd/INIT/make.probe @@ -3,7 +3,7 @@ # Glenn Fowler # AT&T Research # -# @(#)make.probe (ksh 93u+m) 2023-03-09 +# @(#)make.probe (ksh 93u+m) 2024-01-02 # # C probe for make # @@ -995,7 +995,7 @@ case " $cc_dll " in esac case $hosttype in -win32.*|cygwin.*|os2.*) +cygwin.*|os2.*) Lflag=1 ;; *) if $cc -c doti.$src diff --git a/src/cmd/INIT/package.sh b/src/cmd/INIT/package.sh index 260f326be61d..8597c4876b43 100644 --- a/src/cmd/INIT/package.sh +++ b/src/cmd/INIT/package.sh @@ -2,7 +2,7 @@ # # # This software is part of the ast package # # Copyright (c) 1994-2012 AT&T Intellectual Property # -# Copyright (c) 2020-2023 Contributors to ksh 93u+m # +# Copyright (c) 2020-2024 Contributors to ksh 93u+m # # and is licensed under the # # Eclipse Public License, Version 2.0 # # # @@ -115,12 +115,12 @@ command=${0##*/} case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in 0123) USAGE=$' [-? -@(#)$Id: '$command$' (ksh 93u+m) 2023-06-18 $ +@(#)$Id: '$command$' (ksh 93u+m) 2024-01-02 $ ] [-author?Glenn Fowler ] [-author?Contributors to https://github.com/ksh93/ksh] [-copyright?(c) 1994-2012 AT&T Intellectual Property] -[-copyright?(c) 2020-2023 Contributors to ksh 93u+m] +[-copyright?(c) 2020-2024 Contributors to ksh 93u+m] [-license?https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html] [+NAME?'$command$' - build, test and install ksh 93u+m] [+DESCRIPTION?The \b'$command$'\b command is the main control script @@ -543,11 +543,11 @@ SEE ALSO pkgadd(1), pkgmk(1), rpm(1), sh(1), tar(1), optget(3) IMPLEMENTATION - version package (ksh 93u+m) 2023-06-18 + version package (ksh 93u+m) 2024-01-02 author Glenn Fowler author Contributors to https://github.com/ksh93/ksh copyright (c) 1994-2012 AT&T Intellectual Property - copyright (c) 2020-2023 Contributors to ksh 93u+m + copyright (c) 2020-2024 Contributors to ksh 93u+m license https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html' case $1 in html) echo "" ;; @@ -1351,10 +1351,6 @@ int main(void) [Cc][Yy][Gg][Ww][Ii][Nn]_*) type=cygwin ;; - [Uu][Ww][Ii][Nn]*|[Ww]indows_[0123456789][0123456789]|[Ww]indows_[Nn][Tt]) - type=win32 - arch=$(echo $arch | sed -e 's/_[^_]*$//') - ;; esac case $arch in '') case $mach in @@ -1837,24 +1833,6 @@ case $x in for i in lib do test -d $INSTALLROOT/$i || $exec mkdir $INSTALLROOT/$i || exit done - - # no $INITROOT means INIT already installed elsewhere - - if test -d $INITROOT - then - # update the basic package commands - - for i in mamprobe - do test -h $PACKAGEROOT/bin/$i 2>/dev/null || - case $(ls -t $INITROOT/$i.sh $PACKAGEROOT/bin/$i 2>/dev/null) in - "$INITROOT/$i.sh"*) - note "update $PACKAGEROOT/bin/$i" - $exec cp $INITROOT/$i.sh $PACKAGEROOT/bin/$i || exit - $exec chmod +x $PACKAGEROOT/bin/$i || exit - ;; - esac - done - fi ;; esac path=$PATH @@ -2875,33 +2853,38 @@ make|view) ;; esac - # no $INITROOT means INIT already installed elsewhere + # update probe scripts - if test -d $INITROOT - then - # update probe scripts + i=$INSTALLROOT/bin/mamprobe + j=$INITROOT/mamprobe.sh + case $(ls -t "$i" "$j" 2>/dev/null) in + "$i"*) ;; + *) note "update $i" + $exec cp "$j" "$i" || exit + $exec chmod +x "$i" || exit + ;; + esac - for i in lib/probe lib/probe/C lib/probe/C/make - do test -d $INSTALLROOT/$i || $exec mkdir $INSTALLROOT/$i || exit - done - i=$INSTALLROOT/lib/probe/C/make/probe - j=$INITROOT/C+probe - k=$INITROOT/make.probe - case $(ls -t $i $j $k 2>/dev/null) in - $i*) ;; - *) if test -f "$j" && test -f "$k" - then note "update $i" - case $exec in - '') cat $j $k > $i || exit - ;; - *) echo "cat $j $k > $i" - ;; - esac - $exec chmod +x $i || exit - fi - ;; - esac - fi + for i in lib/probe lib/probe/C lib/probe/C/make + do test -d "$INSTALLROOT/$i" || $exec mkdir "$INSTALLROOT/$i" || exit + done + i=$INSTALLROOT/lib/probe/C/make/probe + j=$INITROOT/C+probe + k=$INITROOT/make.probe + case $(ls -t "$i" "$j" "$k" 2>/dev/null) in + "$i"*) ;; + *) if test -f "$j" && test -f "$k" + then note "update $i" + case $exec in + '') cat "$j" "$k" > $i || exit + ;; + *) echo "cat $j $k > $i" + ;; + esac + $exec chmod +x "$i" || exit + fi + ;; + esac # initialize mamake diff --git a/src/cmd/ksh93/bltins/mkservice.c b/src/cmd/ksh93/bltins/mkservice.c index af0c21452682..0836285e2ae1 100644 --- a/src/cmd/ksh93/bltins/mkservice.c +++ b/src/cmd/ksh93/bltins/mkservice.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -210,7 +210,7 @@ static void process_stream(Sfio_t* iop) static int waitnotify(int fd, long timeout, int rw) { - Sfio_t *special=0, **pstream; + Sfio_t *special=0, **pstream; int i; if (fd >= 0) @@ -279,7 +279,7 @@ void service_add(Service_t *sp) static int Accept(Service_t *sp, int accept_fd) { Namval_t* nq = sp->disc[ACCEPT]; - int fd; + int fd; fd = fcntl(accept_fd, F_DUPFD, 10); if (fd >= 0) @@ -307,7 +307,7 @@ static int Accept(Service_t *sp, int accept_fd) static int Action(Service_t *sp, int fd, int close) { Namval_t* nq; - int r=0; + int r=0; if(close) nq = sp->disc[CLOSE]; @@ -329,7 +329,7 @@ static int Action(Service_t *sp, int fd, int close) static int Error(Service_t *sp, int level, const char* arg, ...) { - va_list ap; + va_list ap; va_start(ap, arg); if(sp->node) diff --git a/src/cmd/ksh93/bltins/trap.c b/src/cmd/ksh93/bltins/trap.c index c675cfb3c901..5ddd44686d9a 100644 --- a/src/cmd/ksh93/bltins/trap.c +++ b/src/cmd/ksh93/bltins/trap.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -339,7 +339,7 @@ int b_suspend(int argc,char *argv[],Shbltin_t *context) static int sig_number(const char *string) { const Shtable_t *tp; - int n,o,sig=0; + int n, o, sig=0; char *last, *name; if(isdigit(*string)) { diff --git a/src/cmd/ksh93/sh.1 b/src/cmd/ksh93/sh.1 index 486a77a274d5..f575d92ec943 100644 --- a/src/cmd/ksh93/sh.1 +++ b/src/cmd/ksh93/sh.1 @@ -1347,7 +1347,7 @@ The number of elements in the array is substituted. .TP \f3${@\fP\f2vname\^\fP\f3}\fP -Expands to the type name (See +Expands to the type name (see .I "Type Variables"\^ below) or attributes of the variable referred to by .IR vname . diff --git a/src/cmd/ksh93/sh/args.c b/src/cmd/ksh93/sh/args.c index 63f46ed1bba7..a2ddc8fad9fb 100644 --- a/src/cmd/ksh93/sh/args.c +++ b/src/cmd/ksh93/sh/args.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -119,10 +119,10 @@ int sh_argopts(int argc,char *argv[]) #endif Shopt_t newflags; int defaultflag=0, setflag=0, action=0, trace=(int)sh_isoption(SH_XTRACE); - Namval_t *np = NULL; - const char *cp; - int verbose,f; - Optdisc_t disc; + Namval_t *np = NULL; + const char *cp; + int verbose, f; + Optdisc_t disc; newflags=sh.options; memset(&disc, 0, sizeof(disc)); disc.version = OPT_VERSION; diff --git a/src/cmd/ksh93/sh/init.c b/src/cmd/ksh93/sh/init.c index 15c0736ae169..fef132f9342d 100644 --- a/src/cmd/ksh93/sh/init.c +++ b/src/cmd/ksh93/sh/init.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -827,7 +827,7 @@ void sh_setmatch(const char *v, int vsize, int nmatch, int match[], int index) { Init_t *ip = sh.init_context; struct match *mp = &ip->SH_MATCH_init; - int i,n,x, savesub=sh.subshell; + int i,n,x, savesub=sh.subshell; Namarr_t *ap = nv_arrayptr(SH_MATCHNOD); Namval_t *np; if(sh.intrace) @@ -1001,7 +1001,7 @@ static Sfdouble_t nget_version(Namval_t* np, Namfun_t *fp) { const char *cp = e_version + strlen(e_version)-10; int c; - Sflong_t t = 0; + Sflong_t t = 0; NOT_USED(fp); while (c = *cp++) diff --git a/src/cmd/ksh93/sh/io.c b/src/cmd/ksh93/sh/io.c index 2b08a9e342a2..d292481c22c6 100644 --- a/src/cmd/ksh93/sh/io.c +++ b/src/cmd/ksh93/sh/io.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -1122,7 +1122,7 @@ int sh_redirect(struct ionod *iop, int flag) { Sfoff_t off; char *fname; - int fd, iof; + int fd, iof; const char *message = e_open; int o_mode; /* mode flag for open */ static char io_op[7]; /* used for -x trace info */ @@ -1670,7 +1670,7 @@ static ssize_t tee_write(Sfio_t *iop,const void *buff,size_t n,Sfdisc_t *unused) */ void sh_iosave(int origfd, int oldtop, char *name) { - int savefd; + int savefd; int flag = (oldtop&(IOSUBSHELL|IOPICKFD)); oldtop &= ~(IOSUBSHELL|IOPICKFD); /* see if already saved, only save once */ @@ -1768,7 +1768,7 @@ void sh_iounsave(void) */ void sh_iorestore(int last, int jmpval) { - int origfd, savefd, fd; + int origfd, savefd, fd; int flag = (last&IOSUBSHELL); last &= ~IOSUBSHELL; for (fd = sh.topfd - 1; fd >= last; fd--) diff --git a/src/cmd/ksh93/sh/parse.c b/src/cmd/ksh93/sh/parse.c index fadae7e4e5a9..06fc377d4068 100644 --- a/src/cmd/ksh93/sh/parse.c +++ b/src/cmd/ksh93/sh/parse.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -1197,8 +1197,8 @@ static struct argnod *assign(Lex_t *lexp, struct argnod *ap, int type) */ static Shnode_t *item(Lex_t *lexp,int flag) { - Shnode_t *t; - struct ionod *io; + Shnode_t *t; + struct ionod *io; int tok = (lexp->token&0xff); int savwdval = lexp->lasttok; int savline = lexp->lastline; diff --git a/src/cmd/ksh93/sh/path.c b/src/cmd/ksh93/sh/path.c index 5799705452cd..87a0653b53bb 100644 --- a/src/cmd/ksh93/sh/path.c +++ b/src/cmd/ksh93/sh/path.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -1653,7 +1653,7 @@ void path_newdir(Pathcomp_t *first) Pathcomp_t *path_unsetfpath(void) { Pathcomp_t *first = (Pathcomp_t*)sh.pathlist; - Pathcomp_t *pp=first, *old=0; + Pathcomp_t *pp=first, *old=0; if(sh.fpathdict) { struct Ufunction *rp, *rpnext; diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c index bd7af66e8abd..c0f0fc32d44e 100644 --- a/src/cmd/ksh93/sh/xec.c +++ b/src/cmd/ksh93/sh/xec.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -501,7 +501,7 @@ static void out_string(Sfio_t *iop, const char *cp, int c, int quoted) static void put_level(Namval_t* np,const char *val,int flags,Namfun_t *fp) { Shscope_t *sp; - int16_t level, oldlevel = np->nvalue.s; + int16_t level, oldlevel = np->nvalue.s; if(val) nv_putv(np,val,flags,fp); else @@ -2962,7 +2962,7 @@ int sh_funscope(int argn, char *argv[],int(*fun)(void*),void *arg,int execflg) char save_invoc_local; char **savsig, *save_debugtrap = 0; struct funenv *fp = 0; - struct checkpt *buffp = (struct checkpt*)stkalloc(sh.stk,sizeof(struct checkpt)); + struct checkpt *buffp = (struct checkpt*)stkalloc(sh.stk,sizeof(struct checkpt)); Namval_t *nspace = sh.namespace; Dt_t *last_root = sh.last_root; Shopt_t options; @@ -3127,8 +3127,8 @@ int sh_funscope(int argn, char *argv[],int(*fun)(void*),void *arg,int execflg) static void sh_funct(Namval_t *np,int argn, char *argv[],struct argnod *envlist,int execflg) { - struct funenv fun; - char *fname = nv_getval(SH_FUNNAMENOD); + struct funenv fun; + char *fname = nv_getval(SH_FUNNAMENOD); pid_t pipepid = sh.pipepid; #if !SHOPT_DEVFD Dt_t *save_fifo_tree = sh.fifo_tree; diff --git a/src/lib/libast/Mamfile b/src/lib/libast/Mamfile index 0a35576894af..951891fa3576 100644 --- a/src/lib/libast/Mamfile +++ b/src/lib/libast/Mamfile @@ -5302,50 +5302,17 @@ make install exec - ${STDCMP} 2>/dev/null -s misc/magic.tab ${INSTALLROOT}/lib/file/magic || { ${STDMV} ${INSTALLROOT}/lib/file/magic ${INSTALLROOT}/lib/file/magic.old 2>/dev/null || true; ${STDCP} misc/magic.tab ${INSTALLROOT}/lib/file/magic ;} done ${INSTALLROOT}/lib/file/magic generated prev comp/fmtmsg.h - prev ast_lib.h - exec - case ${mam_cc_HOSTTYPE} in - exec - win32.*) - exec - if ! ${STDCMP} -s comp/fmtmsg.h ${INSTALLROOT}/include/ast/fmtmsg.h - exec - then ${STDCP} comp/fmtmsg.h ${INSTALLROOT}/include/ast/fmtmsg.h - exec - fi - exec - ;; - exec - *) grep -q 'define[ ][ ]*_[hl][di][rb]_fmtmsg' ast_lib.h || { - exec - if ! ${STDCMP} -s comp/fmtmsg.h ${INSTALLROOT}/include/ast/fmtmsg.h - exec - then ${STDCP} comp/fmtmsg.h ${INSTALLROOT}/include/ast/fmtmsg.h - exec - fi - exec - } - exec - ;; - exec - esac prev comp/libgen.h - prev ast_lib.h - exec - case ${mam_cc_HOSTTYPE} in - exec - win32.*) - exec - if ! ${STDCMP} -s comp/libgen.h ${INSTALLROOT}/include/ast/libgen.h - exec - then ${STDCP} comp/libgen.h ${INSTALLROOT}/include/ast/libgen.h - exec - fi - exec - ;; - exec - *) grep -q 'define[ ][ ]*_[hl][di][rb]_libgen' ast_lib.h || { - exec - if ! ${STDCMP} -s comp/libgen.h ${INSTALLROOT}/include/ast/libgen.h - exec - then ${STDCP} comp/libgen.h ${INSTALLROOT}/include/ast/libgen.h - exec - fi - exec - } - exec - ;; - exec - esac prev comp/syslog.h prev ast_lib.h - exec - case ${mam_cc_HOSTTYPE} in - exec - win32.*) - exec - if ! ${STDCMP} -s comp/syslog.h ${INSTALLROOT}/include/ast/syslog.h - exec - then ${STDCP} comp/syslog.h ${INSTALLROOT}/include/ast/syslog.h - exec - fi - exec - ;; - exec - *) grep -q 'define[ ][ ]*_[hl][di][rb]_syslog' ast_lib.h || { - exec - if ! ${STDCMP} -s comp/syslog.h ${INSTALLROOT}/include/ast/syslog.h - exec - then ${STDCP} comp/syslog.h ${INSTALLROOT}/include/ast/syslog.h - exec - fi - exec - } - exec - ;; - exec - esac + note * install our own versions of these if iffe hasn't detected these in the system + exec - CCt=' ' # one tab + exec - for hdr in fmtmsg libgen syslog + exec - do grep -q "define[ $CCt][ $CCt]*_[hl][di][rb]_$hdr" ast_lib.h && continue + exec - if ! ${STDCMP} -s comp/$hdr.h ${INSTALLROOT}/include/ast/$hdr.h + exec - then ${STDCP} comp/$hdr.h ${INSTALLROOT}/include/ast/$hdr.h + exec - fi + exec - done exec - exec - if ! ${STDCMP} -s releaseflags.h ${INSTALLROOT}/include/ast/releaseflags.h exec - then ${STDCP} releaseflags.h ${INSTALLROOT}/include/ast/releaseflags.h diff --git a/src/lib/libast/path/pathbin.c b/src/lib/libast/path/pathbin.c index 8648a03830a1..b68c273415f0 100644 --- a/src/lib/libast/path/pathbin.c +++ b/src/lib/libast/path/pathbin.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2011 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -28,7 +28,7 @@ char* pathbin(void) { - char* bin; + char* bin; static char* val; diff --git a/src/lib/libast/path/pathcheck.c b/src/lib/libast/path/pathcheck.c index e4d006624fd0..dacbd91195ac 100644 --- a/src/lib/libast/path/pathcheck.c +++ b/src/lib/libast/path/pathcheck.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2011 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -48,7 +48,7 @@ int pathcheck(const char* package, const char* tool, Pathcheck_t* pc) { #ifdef PARANOID - char* s; + char* s; struct stat st; if (strmatch(tool, PARANOID) && environ && (s = *environ) && *s++ == '_' && *s++ == '=' && !stat(s, &st)) diff --git a/src/lib/libast/path/pathfind.c b/src/lib/libast/path/pathfind.c index 3453f89c6c8c..19140fef06ad 100644 --- a/src/lib/libast/path/pathfind.c +++ b/src/lib/libast/path/pathfind.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2011 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -49,7 +49,7 @@ static struct /* directory list state */ int pathinclude(const char* dir) { - Dir_t* dp; + Dir_t* dp; struct stat st; if (dir && *dir && !streq(dir, ".") && directory(dir, &st)) @@ -82,8 +82,8 @@ pathfind(const char* name, const char* lib, const char* type, char* buf, size_t { Dir_t* dp; char* s; - char tmp[PATH_MAX]; - struct stat st; + char tmp[PATH_MAX]; + struct stat st; if (((s = strrchr(name, '/')) || (s = (char*)name)) && strchr(s, '.')) type = 0; diff --git a/src/lib/libast/path/pathpath.c b/src/lib/libast/path/pathpath.c index 761fb6d5d63d..29dad620edb1 100644 --- a/src/lib/libast/path/pathpath.c +++ b/src/lib/libast/path/pathpath.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -47,7 +47,7 @@ pathpath(char* path, const char* p, const char* a, int mode) char* pathpath_20100601(const char* p, const char* a, int mode, char* path, size_t size) { - char* s; + char* s; char* x; char buf[PATH_MAX]; diff --git a/src/lib/libast/path/pathrepl.c b/src/lib/libast/path/pathrepl.c index 9ca8ba3d6439..ac6a92e1c184 100644 --- a/src/lib/libast/path/pathrepl.c +++ b/src/lib/libast/path/pathrepl.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2011 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -43,7 +43,7 @@ pathrepl_20100601(char* path, size_t size, const char* match, const char* replac { const char* m = match; const char* r; - char* t; + char* t; if (!match) match = ""; diff --git a/src/lib/libast/vmalloc/vmbest.c b/src/lib/libast/vmalloc/vmbest.c index 5daea4447127..cab0d6344946 100644 --- a/src/lib/libast/vmalloc/vmbest.c +++ b/src/lib/libast/vmalloc/vmbest.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -1250,10 +1250,10 @@ static Vmdata_t _Vmdata = VM_MTBEST|VM_SHARE, /* mode */ 0, /* incr */ 0, /* pool */ - NULL, /* seg */ - NULL, /* free */ - NULL, /* wild */ - NULL /* root */ + NULL, /* seg */ + NULL, /* free */ + NULL, /* wild */ + NULL /* root */ /* tiny[] */ /* cache[] */ }; @@ -1268,12 +1268,12 @@ Vmalloc_t _Vmheap = bestalign, VM_MTBEST }, - NULL, /* file */ + NULL, /* file */ 0, /* line */ 0, /* func */ (Vmdisc_t*)(&_Vmdcsystem), /* disc */ &_Vmdata, /* data */ - NULL /* next */ + NULL /* next */ }; Vmalloc_t* Vmheap = &_Vmheap; diff --git a/src/lib/libcmd/pathchk.c b/src/lib/libcmd/pathchk.c index 39703815718c..5b1c6058a48b 100644 --- a/src/lib/libcmd/pathchk.c +++ b/src/lib/libcmd/pathchk.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1992-2012 AT&T Intellectual Property * -* Copyright (c) 2020-2023 Contributors to ksh 93u+m * +* Copyright (c) 2020-2024 Contributors to ksh 93u+m * * and is licensed under the * * Eclipse Public License, Version 2.0 * * * @@ -74,6 +74,13 @@ static const char usage[] = #include #include +#ifndef _POSIX_NAME_MAX +#define _POSIX_NAME_MAX 14 +#endif +#ifndef _POSIX_PATH_MAX +#define _POSIX_PATH_MAX 256 +#endif + #define COMPONENTS 0x1 #define PATH 0x2