diff --git a/src/cmd/INIT/iffe.sh b/src/cmd/INIT/iffe.sh index 817bcc20255c..154df7fd725c 100644 --- a/src/cmd/INIT/iffe.sh +++ b/src/cmd/INIT/iffe.sh @@ -636,7 +636,7 @@ case $( (getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null ) in [D:define?Successful test macro definitions are emitted. This is the default.] [E:explicit?Disable implicit test output.] [F:features?Sets the feature test header to \ahdr\a. This header typically - defines *_SOURCE feature test macros.]:[hdr:=NONE] + defines *_SOURCE feature test macros.]:[hdr:=NONE] [i:input?Sets the input file name to \afile\a, which must contain \biffe\b statements.]:[file] [I:include?Adds \b-I\b\adir\a to the C compiler flags.]:[dir] diff --git a/src/cmd/INIT/mktest.sh b/src/cmd/INIT/mktest.sh index d58434945f09..b69b0352aeca 100755 --- a/src/cmd/INIT/mktest.sh +++ b/src/cmd/INIT/mktest.sh @@ -44,8 +44,8 @@ case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in '$PREFIX$'\aunit\a.out.] [s:style?The script style:]:[style:='$STYLE$'] { - [+regress?\bregress\b(1) command input.] - [+shell?Standalone test shell script.] + [+regress?\bregress\b(1) command input.] + [+shell?Standalone test shell script.] } [w:width?Set the output format width to approximately \awidth\a.]:[width:='$WIDTH$'] @@ -55,50 +55,50 @@ unit.rt [ unit [ arg ... ] ] [+INPUT FILES?The regression test command file \aunit\a\b.rt\b is a \bksh\b(1) script that makes calls to the following functions:] { - [+DATA \afile\a [ - | [ options ]] data]]?Create input data - \afile\a that is empty (-) or contains \adata\a subject to - \bprint\b(1) \aoptions\a or that is a copy of the DATA command - standard input. Set \afile\a to \b-\b to name the standard - input.] - [+DIAGNOSTICS?Diagnostic messages of unspecified format are + [+DATA \afile\a [ - | [ options ]] data]]?Create input data + \afile\a that is empty (-) or contains \adata\a subject to + \bprint\b(1) \aoptions\a or that is a copy of the DATA command + standard input. Set \afile\a to \b-\b to name the standard + input.] + [+DIAGNOSTICS?Diagnostic messages of unspecified format are expected.] - [+DO \acommand\a [ \aarg\a ... ]]?Execute \acommand\a if the + [+DO \acommand\a [ \aarg\a ... ]]?Execute \acommand\a if the current test is active.] - [+EXEC [ \aarg\a ... ]]?Run the command under test with - optional arguments. If the standard input is not specified then - the standard input of the previous EXEC is used. The standard - input of the first EXEC in a TEST group is an empty regular - file.] - [+EXPORT \aname\a=\avalue\a ...?Export list for subsequent - commands in the TEST group or for all TEST groups if before + [+EXEC [ \aarg\a ... ]]?Run the command under test with + optional arguments. If the standard input is not specified then + the standard input of the previous EXEC is used. The standard + input of the first EXEC in a TEST group is an empty regular + file.] + [+EXPORT \aname\a=\avalue\a ...?Export list for subsequent + commands in the TEST group or for all TEST groups if before the first TEST group.] - [+IGNORESPACE [ 0 | 1 ] - ?Ignore space differences when comparing expected output.] - [+KEEP \apattern\a ...?File match patterns of files to retain - between TEST groups.] - [+NOTE \acomment\a?\acomment\a is added to the current test - script.] - [+PROG \acommand\a [ \aarg\a ... ]]?Run \acommand\a with - optional arguments.] - [+TEST [ \anumber\a ]] [ \adescription\a ... ]]?Define a new - test group with optional \anumber\a and \adescription\a.] - [+TWD [ \adir\a ... ]]?Set the temporary test dir to \adir\a. - The default is \aunit\a\b.tmp\b, where \aunit\a is the test - input file sans directory and suffix. If \adir\a matches \b/*\b - then it is the directory name; if \adir\a is non-null then the - prefix \b${TMPDIR:-/tmp}\b is added; otherwise if \adir\a is - omitted then - \b${TMPDIR:-/tmp}/tst-\b\aunit\a-$$-$RANDOM.\b\aunit\a is - used.] - [+UMASK [ \amask\a ]]?Run subsequent tests with \bumask\b(1) - \amask\a. If \amask\a is omitted then the original \bumask\b is - used.] - [+UNIT \acommand\a [ \aarg\a ... ]]?Define the command and - optional default arguments to be tested. \bUNIT\b explicitly - overrides the default command name derived from the test script - file name.] - [+WIDTH \awidth\a?Set the output format width to approximately - \awidth\a.] + [+IGNORESPACE [ 0 | 1 ] + ?Ignore space differences when comparing expected output.] + [+KEEP \apattern\a ...?File match patterns of files to retain + between TEST groups.] + [+NOTE \acomment\a?\acomment\a is added to the current test + script.] + [+PROG \acommand\a [ \aarg\a ... ]]?Run \acommand\a with + optional arguments.] + [+TEST [ \anumber\a ]] [ \adescription\a ... ]]?Define a new + test group with optional \anumber\a and \adescription\a.] + [+TWD [ \adir\a ... ]]?Set the temporary test dir to \adir\a. + The default is \aunit\a\b.tmp\b, where \aunit\a is the test + input file sans directory and suffix. If \adir\a matches \b/*\b + then it is the directory name; if \adir\a is non-null then the + prefix \b${TMPDIR:-/tmp}\b is added; otherwise if \adir\a is + omitted then + \b${TMPDIR:-/tmp}/tst-\b\aunit\a-$$-$RANDOM.\b\aunit\a is + used.] + [+UMASK [ \amask\a ]]?Run subsequent tests with \bumask\b(1) + \amask\a. If \amask\a is omitted then the original \bumask\b is + used.] + [+UNIT \acommand\a [ \aarg\a ... ]]?Define the command and + optional default arguments to be tested. \bUNIT\b explicitly + overrides the default command name derived from the test script + file name.] + [+WIDTH \awidth\a?Set the output format width to approximately + \awidth\a.] } [+SEE ALSO?\bregress\b(1), \bksh\b(1)] ' diff --git a/src/cmd/INIT/regress.sh b/src/cmd/INIT/regress.sh index d3402392e41a..127242ad4bae 100644 --- a/src/cmd/INIT/regress.sh +++ b/src/cmd/INIT/regress.sh @@ -64,143 +64,143 @@ unit [ command [ arg ... ] ] script that is executed in an environment with the following functions defined:] { - [+BODY \b{ ... }?Defines the test body; used for complex tests.] - [+CD \b\adirectory\a?Create and change to working directory for - one test.] - [+CLEANUP?Called at exit time to remove the - temporary directory \aunit\a\b.tmp\b, list the tests totals via - \bTALLY\b, and exit with the number of test failures or 125, - whichever is lower, as the exit status.] - [+COMMAND \b\aarg\a ...?Runs the current command under test with - \aarg\a ... appended to the default args.] - [+CONTINUE?The background job must be running.] - [+COPY \b\afrom to\a?Copy file \afrom\a to \ato\a. \afrom\a may - be a regular file or \bINPUT\b, \bOUTPUT\b or \bERROR\b. Post - test comparisons are still done for \afrom\a.] - [+DIAGNOSTICS \b[ \b1\b | \b0\b | \apattern\a ]]?No argument or an + [+BODY \b{ ... }?Defines the test body; used for complex tests.] + [+CD \b\adirectory\a?Create and change to working directory for + one test.] + [+CLEANUP?Called at exit time to remove the + temporary directory \aunit\a\b.tmp\b, list the tests totals via + \bTALLY\b, and exit with the number of test failures or 125, + whichever is lower, as the exit status.] + [+COMMAND \b\aarg\a ...?Runs the current command under test with + \aarg\a ... appended to the default args.] + [+CONTINUE?The background job must be running.] + [+COPY \b\afrom to\a?Copy file \afrom\a to \ato\a. \afrom\a may + be a regular file or \bINPUT\b, \bOUTPUT\b or \bERROR\b. Post + test comparisons are still done for \afrom\a.] + [+DIAGNOSTICS \b[ \b1\b | \b0\b | \apattern\a ]]?No argument or an argument of \b1\b declares that diagnostics are to expected for the remainder of the current \bTEST\b; \b0\b reverts to the default - state that diagnostics are not expected; otherwise the argument + state that diagnostics are not expected; otherwise the argument is a \bksh\b(1) pattern that must match the non-empty contents of the standard error.] - [+DO \b\astatement\a?Defines additional statements to be executed - for the current test. \astatement\a may be a { ... } group.] - [+EMPTY \bINPUT|OUTPUT|ERROR|SAME?The corresponding file is - expected to be empty.] - [+ERROR \b[ \b-e\b \afilter\a ]] [ \b-n\b ]] \afile\a | - \adata\a ...?The + [+DO \b\astatement\a?Defines additional statements to be executed + for the current test. \astatement\a may be a { ... } group.] + [+EMPTY \bINPUT|OUTPUT|ERROR|SAME?The corresponding file is + expected to be empty.] + [+ERROR \b[ \b-e\b \afilter\a ]] [ \b-n\b ]] \afile\a | - \adata\a ...?The standard error is expected to match either the contents of \afile\a or the line \adata\a. \bERROR -n\b does not append a newline to \adata\a. \afilter\a is a shell command or pipeline that reads standard input and writes standard output that is applied to ERROR before comparison with the expected contents.] - [+EXEC \b[ \aarg\a ... ]]?Runs the command under test with - optional arguments. \bINPUT\b, \bOUTPUT\b, \bERROR\b, \bEXIT\b - and \bSAME\b calls following this \bEXEC\b up until the next - \bEXEC\b or the end of the script provide details for the - expected results. If no arguments are specified then the - arguments from the previous \bEXEC\b in the current \bTEST\b - group are used, or no arguments if this is the first \bEXEC\b - in the group.] - [+EXIT \b\astatus\a?The command exit status is expected to match - the pattern \astatus\a.] - [+EXITED?The background job must have exited.] - [+EXPORT \b[-]] \aname\a=\avalue\a ...?Export environment - variables for one test.] - [+FATAL \b\amessage\a ...?\amessage\a is printed on the standard - error and \bregress\b exits with status \b1\b.] - [+FIFO \bINPUT|OUTPUT|ERROR\b [ \b-n\b ]] \afile\a | - \adata\a ...?The + [+EXEC \b[ \aarg\a ... ]]?Runs the command under test with + optional arguments. \bINPUT\b, \bOUTPUT\b, \bERROR\b, \bEXIT\b + and \bSAME\b calls following this \bEXEC\b up until the next + \bEXEC\b or the end of the script provide details for the + expected results. If no arguments are specified then the + arguments from the previous \bEXEC\b in the current \bTEST\b + group are used, or no arguments if this is the first \bEXEC\b + in the group.] + [+EXIT \b\astatus\a?The command exit status is expected to match + the pattern \astatus\a.] + [+EXITED?The background job must have exited.] + [+EXPORT \b[-]] \aname\a=\avalue\a ...?Export environment + variables for one test.] + [+FATAL \b\amessage\a ...?\amessage\a is printed on the standard + error and \bregress\b exits with status \b1\b.] + [+FIFO \bINPUT|OUTPUT|ERROR\b [ \b-n\b ]] \afile\a | - \adata\a ...?The \bIO\B file is a fifo.] - [+IF \b\acommand\a [\anote\a]]?If the \bsh\b(1) \acommand\a exits - 0 then tests until the next \bELIF\b, \bELSE\b or \bFI\b are - enabled. Otherwise those tests are skipped. \bIF\b ... \bFI\b - may be nested, but must not cross \bTEST\b boundaries. \anote\a - is listed on the standard error if the corresponding test block - is enabled; \bIF\b, \bELIF\b, \bELSE\b may nave a \anote\a - operand.] - [+IGNORE \b\afile\a ...?\afile\a is ignored for subsequent result - comparisons. \afile\a may be \bOUTPUT\b or \bERROR\b.] - [+IGNORESPACE?Ignore space differences when comparing expected - output.] - [+INCLUDE \b\afile\a ...?One or more \afile\a operands are read - via the \bksh\b(1) \b.\b(1) command. \bVIEW\b is used to locate - the files.] - [+INFO \b\adescription\a?\adescription\a is printed on the - standard error.] - [+INITIALIZE?Called by \bregress\b to initialize each - \bTEST\b group.] - [+INPUT \b[ \b-e\b \afilter\a ]] [ \b-n\b ]] \afile\a | - \adata\a ...?The + [+IF \b\acommand\a [\anote\a]]?If the \bsh\b(1) \acommand\a exits + 0 then tests until the next \bELIF\b, \bELSE\b or \bFI\b are + enabled. Otherwise those tests are skipped. \bIF\b ... \bFI\b + may be nested, but must not cross \bTEST\b boundaries. \anote\a + is listed on the standard error if the corresponding test block + is enabled; \bIF\b, \bELIF\b, \bELSE\b may nave a \anote\a + operand.] + [+IGNORE \b\afile\a ...?\afile\a is ignored for subsequent result + comparisons. \afile\a may be \bOUTPUT\b or \bERROR\b.] + [+IGNORESPACE?Ignore space differences when comparing expected + output.] + [+INCLUDE \b\afile\a ...?One or more \afile\a operands are read + via the \bksh\b(1) \b.\b(1) command. \bVIEW\b is used to locate + the files.] + [+INFO \b\adescription\a?\adescription\a is printed on the + standard error.] + [+INITIALIZE?Called by \bregress\b to initialize each + \bTEST\b group.] + [+INPUT \b[ \b-e\b \afilter\a ]] [ \b-n\b ]] \afile\a | - \adata\a ...?The standard input is set to either the contents of \afile\a or the line \adata\a. \bINPUT -n\b does not append a newline to \adata\a. \afilter\a is a shell command or pipeline that reads standard input and writes standard output that is applied to OUTPUT before comparison with the expected contents.] - [+INTRO?Called by \bregress\b to introduce all \bTEST\b - groups.] - [+IO \b[ \bFIFO\b | \bPIPE\b ]] \bINPUT|OUTPUT|ERROR\b [ \b-e\b \afilter\a ]] [ \b-n\b ]] \afile\a | - \adata\a ...?Internal - support for the \bINPUT\b, \bOUTPUT\b and \bERROR\b functions.] - [+JOB \b\aop\a [ ... ]]?Like \bEXEC\b except the command is run - as a background job for the duration of the group or until it - is killed via \bKILL\b.] - [+KEEP \b\apattern\a ...?The temporary directory is cleared for - each test. Files matching \apattern\a are retained between - tests.] - [+KILL \b[ \asignal\a ]]?Kill the background job with \asignal\a - [ \bSIGKILL\b ]].] - [+MOVE \b\afrom to\a?Rename file \afrom\a to \ato\a. \afrom\a may - be a regular file or \bINPUT\b, \bOUTPUT\b or \bERROR\b. Post - test comparisons are ignored for \afrom\a.] - [+NOTE \b\acomment\a?\acomment\a is added to the current test - trace output.] - [+OUTPUT \b[ \b-e\b \afilter\a ]] [ \b-n\b ]] \afile\a | - \adata\a ...?The + [+INTRO?Called by \bregress\b to introduce all \bTEST\b + groups.] + [+IO \b[ \bFIFO\b | \bPIPE\b ]] \bINPUT|OUTPUT|ERROR\b [ \b-e\b \afilter\a ]] [ \b-n\b ]] \afile\a | - \adata\a ...?Internal + support for the \bINPUT\b, \bOUTPUT\b and \bERROR\b functions.] + [+JOB \b\aop\a [ ... ]]?Like \bEXEC\b except the command is run + as a background job for the duration of the group or until it + is killed via \bKILL\b.] + [+KEEP \b\apattern\a ...?The temporary directory is cleared for + each test. Files matching \apattern\a are retained between + tests.] + [+KILL \b[ \asignal\a ]]?Kill the background job with \asignal\a + [ \bSIGKILL\b ]].] + [+MOVE \b\afrom to\a?Rename file \afrom\a to \ato\a. \afrom\a may + be a regular file or \bINPUT\b, \bOUTPUT\b or \bERROR\b. Post + test comparisons are ignored for \afrom\a.] + [+NOTE \b\acomment\a?\acomment\a is added to the current test + trace output.] + [+OUTPUT \b[ \b-e\b \afilter\a ]] [ \b-n\b ]] \afile\a | - \adata\a ...?The standard output is expected to match either the contents of \afile\a or the line \adata\a. \bOUTPUT -n\b does not append a newline to \adata\a. \afilter\a is a shell command or pipeline that reads standard input and writes standard output that is applied to ERROR before comparison with the expected contents.] - [+PIPE \bINPUT|OUTPUT|ERROR\b [ \b-n\b ]] \afile\a | - \adata\a ...?The + [+PIPE \bINPUT|OUTPUT|ERROR\b [ \b-n\b ]] \afile\a | - \adata\a ...?The \bIO\B file is a pipe.] - [+PROG \b\acommand\a [ \aarg\a ... ]]?\acommand\a is run with - optional arguments.] - [+REMOVE \b\afile\a ...?\afile\a ... are removed after the - current test is done.] - [+RUN?Called by \bregress\b to run the current test.] - [+SAME \b\anew old\a?\anew\a is expected to be the same as - \aold\a after the current test completes.] - [+SET \b[\bno\b]]\aname\a[=\avalue\a]]?Set the command line - option --\aname\a. The setting is in effect for all tests until - the next explicit \bSET\b.] - [+TALLY?Called by \bregress\b display the \bTEST\b results.] - [+TEST \b\anumber\a [ \adescription\a ... ]]?Define a new test - group labelled \anumber\a with optional \adescription\a.] - [+TITLE \b[+]] \atext\a?Set the \bTEST\b output title to - \atext\a. If \b+\b is specified then \atext\a is appended to - the default title. The default title is the test file base - name, and, if different from the test file base name, the test - unit base name.] - [+TWD \b[ \adir\a ... ]]?Set the temporary test dir to \adir\a. - The default is \aunit\a\b.tmp\b, where \aunit\a is the test - input file sans directory and suffix. If \adir\a matches \b/*\b - then it is the directory name; if \adir\a is non-null then the - prefix \b${TMPDIR:-/tmp}\b is added; otherwise if \adir\a is - omitted then - \b${TMPDIR:-/tmp}/tst-\b\aunit\a-$$-$RANDOM.\b\aunit\a is - used.] - [+UMASK \b[ \amask\a ]]?Run subsequent tests with \bumask\b(1) - \amask\a. If \amask\a is omitted then the original \bumask\b is - used.] - [+UNIT \b\acommand\a [ \aarg\a ... ]]?Define the command and - optional default arguments to be tested. \bUNIT\b explicitly - overrides the default command name derived from the test script - file name. A \acommand\a operand with optional arguments - overrides the \bUNIT\b \acommand\a and arguments, with the - exception that if the \bUNIT\b \acommand\a is \b-\b or \b+\b - the \bUNIT\b arguments are appended to the operand or default - unit command and arguments.] - [+VIEW \b\avar\a [ \afile\a ]]?\avar\a is set to the full - pathname of \avar\a [ \afile\a ]] in the current \b$VPATH\b - view if defined.] + [+PROG \b\acommand\a [ \aarg\a ... ]]?\acommand\a is run with + optional arguments.] + [+REMOVE \b\afile\a ...?\afile\a ... are removed after the + current test is done.] + [+RUN?Called by \bregress\b to run the current test.] + [+SAME \b\anew old\a?\anew\a is expected to be the same as + \aold\a after the current test completes.] + [+SET \b[\bno\b]]\aname\a[=\avalue\a]]?Set the command line + option --\aname\a. The setting is in effect for all tests until + the next explicit \bSET\b.] + [+TALLY?Called by \bregress\b display the \bTEST\b results.] + [+TEST \b\anumber\a [ \adescription\a ... ]]?Define a new test + group labelled \anumber\a with optional \adescription\a.] + [+TITLE \b[+]] \atext\a?Set the \bTEST\b output title to + \atext\a. If \b+\b is specified then \atext\a is appended to + the default title. The default title is the test file base + name, and, if different from the test file base name, the test + unit base name.] + [+TWD \b[ \adir\a ... ]]?Set the temporary test dir to \adir\a. + The default is \aunit\a\b.tmp\b, where \aunit\a is the test + input file sans directory and suffix. If \adir\a matches \b/*\b + then it is the directory name; if \adir\a is non-null then the + prefix \b${TMPDIR:-/tmp}\b is added; otherwise if \adir\a is + omitted then + \b${TMPDIR:-/tmp}/tst-\b\aunit\a-$$-$RANDOM.\b\aunit\a is + used.] + [+UMASK \b[ \amask\a ]]?Run subsequent tests with \bumask\b(1) + \amask\a. If \amask\a is omitted then the original \bumask\b is + used.] + [+UNIT \b\acommand\a [ \aarg\a ... ]]?Define the command and + optional default arguments to be tested. \bUNIT\b explicitly + overrides the default command name derived from the test script + file name. A \acommand\a operand with optional arguments + overrides the \bUNIT\b \acommand\a and arguments, with the + exception that if the \bUNIT\b \acommand\a is \b-\b or \b+\b + the \bUNIT\b arguments are appended to the operand or default + unit command and arguments.] + [+VIEW \b\avar\a [ \afile\a ]]?\avar\a is set to the full + pathname of \avar\a [ \afile\a ]] in the current \b$VPATH\b + view if defined.] } [+SEE ALSO?\bnmake\b(1), \bksh\b(1)] ' diff --git a/src/cmd/builtin/pty.c b/src/cmd/builtin/pty.c index c989de5e3b11..9729df5971dc 100644 --- a/src/cmd/builtin/pty.c +++ b/src/cmd/builtin/pty.c @@ -54,8 +54,8 @@ static const char usage[] = "\be\b or \bf\b]" "[f?end of \bi\b/\be\b block]" "[m \atext\a?write \atext\a to the standard error]" - "[p \atext\a?peek input until \atext\a is found at the beginning " - "of a line; input is not consumed]" + "[p \atext\a?peek input until \atext\a is found at the beginning " + "of a line; input is not consumed]" "[r [\are\a]]?read a line from the master [and it should match " "re]]]" "[s \amilliseconds\a?sleep for \amilliseconds\a]" diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index b21c3e57b399..c675a73e00e9 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -182,12 +182,12 @@ const struct shtable3 shtab_builtins[] = #define _JOB_ "[+?Each \ajob\a can be specified as one of the following:]{" \ "[+\anumber\a?\anumber\a refers to a process ID.]" \ - "[+-\anumber\a?\anumber\a refers to a process group ID.]" \ - "[+%\anumber\a?\anumber\a refer to a job number.]" \ - "[+%\astring\a?Refers to a job whose name begins with \astring\a.]" \ - "[+%??\astring\a?Refers to a job whose name contains \astring\a.]" \ - "[+%+ \bor\b %%?Refers to the current job.]" \ - "[+%-?Refers to the previous job.]" \ + "[+-\anumber\a?\anumber\a refers to a process group ID.]" \ + "[+%\anumber\a?\anumber\a refer to a job number.]" \ + "[+%\astring\a?Refers to a job whose name begins with \astring\a.]" \ + "[+%??\astring\a?Refers to a job whose name contains \astring\a.]" \ + "[+%+ \bor\b %%?Refers to the current job.]" \ + "[+%-?Refers to the previous job.]" \ "}" @@ -416,7 +416,7 @@ const char sh_optalias[] = "\n[name[=value]...]\n" "\n" "[+EXIT STATUS?]{" - "[+0?Successful completion.]" + "[+0?Successful completion.]" "[+>0?One or more \aname\a operands did not have an alias " "definition, or an error occurred.]" "}" diff --git a/src/cmd/ksh93/tests/arith.sh b/src/cmd/ksh93/tests/arith.sh index 6988aa05aa7c..d47ea8cdd0c0 100755 --- a/src/cmd/ksh93/tests/arith.sh +++ b/src/cmd/ksh93/tests/arith.sh @@ -584,7 +584,7 @@ done function .sh.math.mysin x { - ((.sh.value = x - x**3/6. + x**5/120.-x**7/5040. + x**9/362880.)) + ((.sh.value = x - x**3/6. + x**5/120.-x**7/5040. + x**9/362880.)) } (( abs(sin(.5)-mysin(.5)) < 1e-6 )) || err_exit 'mysin() not close to sin()' diff --git a/src/cmd/ksh93/tests/arrays.sh b/src/cmd/ksh93/tests/arrays.sh index 5f8028ec97f8..ea1cbde6099b 100755 --- a/src/cmd/ksh93/tests/arrays.sh +++ b/src/cmd/ksh93/tests/arrays.sh @@ -355,11 +355,11 @@ foo=one [[ ! ${foo[@]:1} ]] || err_exit '${foo[@]:1} not null' function EMPTY { - typeset i - typeset -n ARRAY=$1 - for i in ${!ARRAY[@]} - do unset ARRAY[$i] - done + typeset i + typeset -n ARRAY=$1 + for i in ${!ARRAY[@]} + do unset ARRAY[$i] + done } unset foo typeset -A foo @@ -614,9 +614,9 @@ x=$( print '(' integer i for ((i=0 ; i < 16384 ; i++ )) ; do - printf '\tinteger var%i=%i\n' i i - done - printf 'typeset -a ar=(\n' + printf '\tinteger var%i=%i\n' i i + done + printf 'typeset -a ar=(\n' for ((i=0 ; i < 16384 ; i++ )) ; do printf '\t[%d]=%d\n' i i done diff --git a/src/cmd/ksh93/tests/arrays2.sh b/src/cmd/ksh93/tests/arrays2.sh index 5f1f47dc2b01..f4169cbc01f0 100755 --- a/src/cmd/ksh93/tests/arrays2.sh +++ b/src/cmd/ksh93/tests/arrays2.sh @@ -174,7 +174,7 @@ fx values[1] function test_short_integer { - compound out=( typeset stdout stderr ; integer res ) + compound out=( typeset stdout stderr ; integer res ) compound -r -a tests=( ( cmd='integer -s -r -a x=( 1 2 3 ) ; print "${x[2]}"' stdoutpattern='3' ) ( cmd='integer -s -r -A x=( [0]=1 [1]=2 [2]=3 ) ; print "${x[2]}"' stdoutpattern='3' ) diff --git a/src/cmd/ksh93/tests/attributes.sh b/src/cmd/ksh93/tests/attributes.sh index 52ed9f0a31a5..1a331657285a 100755 --- a/src/cmd/ksh93/tests/attributes.sh +++ b/src/cmd/ksh93/tests/attributes.sh @@ -154,10 +154,10 @@ typeset -Z LAST=00 unset -f foo function foo { - if [[ $1 ]] - then LAST=$1 - else ((LAST++)) - fi + if [[ $1 ]] + then LAST=$1 + else ((LAST++)) + fi } foo 1 if (( ${#LAST} != 2 )) @@ -426,7 +426,7 @@ fi { $SHELL <<- \EOF compound -a a1 for ((i=1 ; i < 100 ; i++ )) - do [[ "$( typeset + a1[$i] )" == '' ]] && a1[$i].text='hello' + do [[ "$( typeset + a1[$i] )" == '' ]] && a1[$i].text='hello' done [[ ${a1[70].text} == hello ]] EOF diff --git a/src/cmd/ksh93/tests/basic.sh b/src/cmd/ksh93/tests/basic.sh index 7f4b815894a8..62aa649587df 100755 --- a/src/cmd/ksh93/tests/basic.sh +++ b/src/cmd/ksh93/tests/basic.sh @@ -176,7 +176,7 @@ rm -f foobar > foobar for i in 1 2 do print foobar* - rm -f foobar + rm -f foobar done > out if [[ "$( 1 )) @@ -725,15 +725,15 @@ read baz <<< 'foo\\\\bar' actual=$( set +x { - ( - trap "" PIPE - for ((i = SECONDS + 1; SECONDS < i; )); do - print hi || { - print $? >&2 - exit - } - done - ) | true + ( + trap "" PIPE + for ((i = SECONDS + 1; SECONDS < i; )); do + print hi || { + print $? >&2 + exit + } + done + ) | true } 2>&1 ) expect='1' diff --git a/src/cmd/ksh93/tests/comvar.sh b/src/cmd/ksh93/tests/comvar.sh index dcae21d89053..de31b936e3c8 100755 --- a/src/cmd/ksh93/tests/comvar.sh +++ b/src/cmd/ksh93/tests/comvar.sh @@ -48,8 +48,8 @@ if (( newrec.born.day != 16 )) then err_exit 'copying integer field of compound object not working' fi p_t=( - integer z=0 - typeset -A tokens + integer z=0 + typeset -A tokens ) unset x typeset -A x @@ -98,76 +98,76 @@ suitable=( " entries=( vieworigin=( - type=coord var=vieworigin val="0 0" label="Window Position" + type=coord var=vieworigin val="0 0" label="Window Position" ) viewsize=( - type=coord var=viewsize val="400 400" label="Window Size" + type=coord var=viewsize val="400 400" label="Window Size" ) viewcolor=( - type=2colors var=viewcolor val="gray black" - label="Window Colors" + type=2colors var=viewcolor val="gray black" + label="Window Colors" ) viewfontname=( - type=fontname var=viewfontname val="Times-Roman" - label="Window Font Name" + type=fontname var=viewfontname val="Times-Roman" + label="Window Font Name" ) viewfontsize=( - type=fontsize var=viewfontsize val=14 label="Window Font Size" + type=fontsize var=viewfontsize val=14 label="Window Font Size" ) showheader=( - type=yesno var=showheader val=no label="Show Header" + type=yesno var=showheader val=no label="Show Header" ) header=( - type=text var=header val="" label="Header" + type=text var=header val="" label="Header" ) showfooter=( - type=yesno var=showfooter val=no label="Show Footer" + type=yesno var=showfooter val=no label="Show Footer" ) footer=( - type=text var=footer val="" label="Footer" + type=text var=footer val="" label="Footer" ) showtitle=( - type=yesno var=showtitle val=yes label="Show Title" + type=yesno var=showtitle val=yes label="Show Title" ) title=( - type=text var=title val="SWIFTUI - Table View" label="Title" + type=text var=title val="SWIFTUI - Table View" label="Title" ) showlegends=( - type=yesno var=showlegends val=yes label="Show Legends" + type=yesno var=showlegends val=yes label="Show Legends" ) class_td_lg1_style=( - type=style var=class_td_lg1_style - val="color: black; font-family: Times-Roman; font-size: 14pt" - label="Legend 1 Style" + type=style var=class_td_lg1_style + val="color: black; font-family: Times-Roman; font-size: 14pt" + label="Legend 1 Style" ) class_tr_tr1_style=( - type=style var=class_tr_tr1_style val="background: black" - label="Table Row 1 Style" + type=style var=class_tr_tr1_style val="background: black" + label="Table Row 1 Style" ) class_th_th1_style=( - type=style var=class_th_th1_style - val="color: black; font-family: Times-Roman; font-size: 14pt; text-align: left" - label="Table Header 1 Style" + type=style var=class_th_th1_style + val="color: black; font-family: Times-Roman; font-size: 14pt; text-align: left" + label="Table Header 1 Style" ) class_td_td1_style=( - type=style var=class_td_td1_style - val="color: black; font-family: Times-Roman; font-size: 14pt; text-align: left" - label="Table Cell 1 Style" + type=style var=class_td_td1_style + val="color: black; font-family: Times-Roman; font-size: 14pt; text-align: left" + label="Table Cell 1 Style" ) fields=( - type=text var=fields val= label="List of Fields" + type=text var=fields val= label="List of Fields" ) fieldorder=( - type=text var=fieldorder val= label="Order of Fields" + type=text var=fieldorder val= label="Order of Fields" ) ) ) @@ -190,13 +190,13 @@ function staticvar then print -r -- "$point" return fi - typeset -S point=(typeset -i x=3 y=4) - (( (point.x*point.x + point.y*point.y) == 25 )) || err_exit "local compound variable not working" + typeset -S point=(typeset -i x=3 y=4) + (( (point.x*point.x + point.y*point.y) == 25 )) || err_exit "local compound variable not working" point.y=5 point.z=foobar } staticvar - (( (point.x*point.x + point.y*point.y) == 100 )) || err_exit "global compound variable not preserved" + (( (point.x*point.x + point.y*point.y) == 100 )) || err_exit "global compound variable not preserved" [[ $(staticvar x) == $'(\n\ttypeset -i x=3\n\ttypeset -i y=5\n\tz=foobar\n)' ]] || err_exit 'static variables in function not working' integer x=3 ( typeset -S x=+++)2> /dev/null || err_exit "typeset -S doesn't unset first" @@ -401,7 +401,7 @@ got=$r # array of compound variables typeset -C data=( - typeset -a samples + typeset -a samples ) data.samples+=( type1="greeting1" @@ -492,14 +492,14 @@ add_one "foo2[1234]" typeset -C tree function f1 { - nameref tr=$1 - typeset -A tr.subtree - typeset -C node - node.one="hello" - node.two="world" - - # move local note into the array - typeset -m tr.subtree["a_node"]=node + nameref tr=$1 + typeset -A tr.subtree + typeset -C node + node.one="hello" + node.two="world" + + # move local note into the array + typeset -m tr.subtree["a_node"]=node } f1 tree expected=$'(\n\ttypeset -A subtree=(\n\t\t[a_node]=(\n\t\t\tone=hello\n\t\t\ttwo=world\n\t\t)\n\t)\n)' @@ -511,17 +511,17 @@ expected='typeset -C -A array=([12]=(typeset -l -E amount=2.9))' [[ $(typeset -p array) == "$expected" ]] || err_exit 'typeset with compound variable with compound variable array not working' typeset -T foo_t=( - function diff - { + function diff + { print 1.0 - return 0 - } + return 0 + } ) foo_t sw compound output=( - integer one=1 - float mydiff=sw.diff - float end=.314 + integer one=1 + float mydiff=sw.diff + float end=.314 ) [[ $output == *end=* ]] || err_exit "The field 'name' end is missing" @@ -534,9 +534,9 @@ compound x=( unset x compound x=( - compound -a nodes=( - [4]=( ) - ) + compound -a nodes=( + [4]=( ) + ) ) expected='typeset -C x=(typeset -C -a nodes=([4]=());)' [[ $(typeset -p x) == "$expected" ]] || err_exit 'typeset -p with nested compound indexed array not working' diff --git a/src/cmd/ksh93/tests/comvario.sh b/src/cmd/ksh93/tests/comvario.sh index d3baa0bdfd25..421e2f810098 100755 --- a/src/cmd/ksh93/tests/comvario.sh +++ b/src/cmd/ksh93/tests/comvario.sh @@ -339,7 +339,7 @@ s=$($SHELL -c 'compound myvar ; print " unfinished=1 )" | read -C myvar 2>'/dev function test6 { - compound out=( typeset stdout stderr ; integer res ) + compound out=( typeset stdout stderr ; integer res ) compound val integer testid @@ -391,9 +391,9 @@ function test6 out.stderr="${ { out.stdout="${ ${SHELL} -c "${test.cmd}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }" - (( out.res == 0 )) || err_exit "${testname}: Test shell returned with exit code ${out.res}" - [[ "${out.stdout}" == ${test.stdoutpattern} ]] || err_exit "${testname}: Expected match for ${test.stdoutpattern}, got $(printf "%q\n" "${out.stdout}")" - [[ "${out.stderr}" == "" ]] || err_exit "${testname}: Expected empty stderr, got $(printf "%q\n" "${out.stderr}")" + (( out.res == 0 )) || err_exit "${testname}: Test shell returned with exit code ${out.res}" + [[ "${out.stdout}" == ${test.stdoutpattern} ]] || err_exit "${testname}: Expected match for ${test.stdoutpattern}, got $(printf "%q\n" "${out.stdout}")" + [[ "${out.stderr}" == "" ]] || err_exit "${testname}: Expected empty stderr, got $(printf "%q\n" "${out.stderr}")" read -C val <<<"${out.stdout}" || err_exit "${testname}: read -C val failed with exit code $?" nameref ar="val.${test.arrefname}" @@ -408,7 +408,7 @@ test6 function test_3D_array_read_C { - compound out=( typeset stdout stderr ; integer res ) + compound out=( typeset stdout stderr ; integer res ) integer i typeset -r -a tests=( # ast-ksh.2010-03-09 will print "ksh93[1]: read: line 4: 0[0]: invalid variable name" for 3D arrays passed to read -C @@ -422,7 +422,7 @@ function test_3D_array_read_C out.stderr="${ { out.stdout="${ ${SHELL} -o nounset -c "${tests[i]}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }" [[ "${out.stdout}" == '' ]] || err_exit "$0/${i}: Expected empty stdout, got $(printf '%q\n' "${out.stdout}")" - [[ "${out.stderr}" == '' ]] || err_exit "$0/${i}: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")" + [[ "${out.stderr}" == '' ]] || err_exit "$0/${i}: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")" done return 0 @@ -431,7 +431,7 @@ function test_3D_array_read_C function test_access_2Darray_in_type_in_compound { - compound out=( typeset stdout stderr ; integer res ) + compound out=( typeset stdout stderr ; integer res ) integer i typeset -r -a tests=( # ast-ksh.2010-03-09 will print 'ksh: line 1: l.c.x[i][j]=: no parent' @@ -442,7 +442,7 @@ function test_access_2Darray_in_type_in_compound out.stderr="${ { out.stdout="${ ${SHELL} -o nounset -c "${tests[i]}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }" [[ "${out.stdout}" == '' ]] || err_exit "$0/${i}: Expected empty stdout, got $(printf '%q\n' "${out.stdout}")" - [[ "${out.stderr}" == '' ]] || err_exit "$0/${i}: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")" + [[ "${out.stderr}" == '' ]] || err_exit "$0/${i}: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")" done return 0 @@ -450,7 +450,7 @@ function test_access_2Darray_in_type_in_compound function test_read_type_crash { - compound out=( typeset stdout stderr ; integer res ) + compound out=( typeset stdout stderr ; integer res ) typeset -r test=' typeset -T field_t=( typeset -a f @@ -497,7 +497,7 @@ print -v c2 out.stderr="${ { out.stdout="${ ${SHELL} -o nounset -c "${test}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }" - [[ "${out.stdout}" != '' ]] || err_exit "$0: Expected nonempty stdout." + [[ "${out.stdout}" != '' ]] || err_exit "$0: Expected nonempty stdout." [[ "${out.stderr}" == '' ]] || err_exit "$0: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")" return 0 @@ -506,7 +506,7 @@ print -v c2 function test_read_C_into_array { - compound out=( typeset stdout stderr ; integer res ) + compound out=( typeset stdout stderr ; integer res ) # fixme: # - The tests should cover 3D and 5D indexed arrays and namerefs to sub-dimensions of a 5D indexed array compound -r -a tests=( @@ -621,7 +621,7 @@ function test_read_C_special_shell_keywords typeset testcmd typeset testname typeset shkeyword - compound out=( typeset stdout stderr ; integer res ) + compound out=( typeset stdout stderr ; integer res ) for (( tcpi=0 ; tcpi < ${#testcmdpatterns[@]} ; tcpi++ )) ; do for (( spwi=0 ; spwi < ${#shell_special_words[@]} ; spwi++ )) ; do @@ -631,7 +631,7 @@ function test_read_C_special_shell_keywords out.stderr="${ { out.stdout="${ ${SHELL} -o nounset -o errexit -c "${testcmd}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }" - [[ "${out.stdout}" == "X${shkeyword}X" ]] || err_exit "${testname}: Expected stdout to match $(printf '%q\n' "X${shkeyword}X"), got $(printf '%q\n' "${out.stdout}")" + [[ "${out.stdout}" == "X${shkeyword}X" ]] || err_exit "${testname}: Expected stdout to match $(printf '%q\n' "X${shkeyword}X"), got $(printf '%q\n' "${out.stdout}")" [[ "${out.stderr}" == '' ]] || err_exit "${testname}: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")" (( out.res == 0 )) || err_exit "${testname}: Unexpected exit code ${out.res}" done diff --git a/src/cmd/ksh93/tests/coprocess.sh b/src/cmd/ksh93/tests/coprocess.sh index 643dbdaedbb5..e60d6d310cc1 100755 --- a/src/cmd/ksh93/tests/coprocess.sh +++ b/src/cmd/ksh93/tests/coprocess.sh @@ -333,8 +333,8 @@ wait function cop { - read - print ok + read + print ok } exp=ok cop |& diff --git a/src/cmd/ksh93/tests/exit.sh b/src/cmd/ksh93/tests/exit.sh index 8d1ff7cecb0b..c3234a8c3178 100755 --- a/src/cmd/ksh93/tests/exit.sh +++ b/src/cmd/ksh93/tests/exit.sh @@ -27,11 +27,11 @@ fi function abspath { - base=$(basename $SHELL) - cd ${SHELL%/$base} - newdir=$(pwd) - cd ~- - print $newdir/$base + base=$(basename $SHELL) + cd ${SHELL%/$base} + newdir=$(pwd) + cd ~- + print $newdir/$base } # test for proper exit of shell if ((!execve_ignores_argv0)) && builtin getconf 2>/dev/null; then diff --git a/src/cmd/ksh93/tests/functions.sh b/src/cmd/ksh93/tests/functions.sh index 93a90d3e9cbf..6a061a5bc497 100755 --- a/src/cmd/ksh93/tests/functions.sh +++ b/src/cmd/ksh93/tests/functions.sh @@ -209,13 +209,13 @@ fi unset -f foo bar function bar { - print "$y" + print "$y" } function foo { - typeset x=3 - y=$x bar + typeset x=3 + y=$x bar } x=1 if [[ $(foo) != 3 ]] @@ -266,7 +266,7 @@ fi unset -f x function x { - print "$@" + print "$@" } typeset -ft x if [[ $(x x=y 2>/dev/null) != x=y ]] @@ -365,11 +365,11 @@ then err_exit 'attributes on unset variables not saved/restored' fi function xpd { typeset i j=$1 - for i - do print i=$i j=$j - [[ $i == a ]] && xpd b - done - } + for i + do print i=$i j=$j + [[ $i == a ]] && xpd b + done + } if [[ $(xpd a c) != $'i=a j=a\ni=b j=b\ni=c j=a' ]] then err_exit 'for loop function optimization error' fi @@ -458,9 +458,9 @@ eval "$x" || err_exit 'typeset -f generates syntax error' unset -f a b c a() { - b - b - print ${.sh.fun} + b + b + print ${.sh.fun} } b() { : ;} [[ $(a) == a ]] || err_exit '.sh.fun not set correctly in a function' @@ -867,12 +867,12 @@ main optind=$OPTIND sub() { - ( - OPTIND=1 - while getopts :abc OPTION "$@" - do print OPTIND=$OPTIND - done - ) + ( + OPTIND=1 + while getopts :abc OPTION "$@" + do print OPTIND=$OPTIND + done + ) } [[ $(sub -a) == OPTIND=2 ]] || err_exit 'OPTIND should be 2' [[ $(sub -a) == OPTIND=2 ]] || err_exit 'OPTIND should be 2 again' @@ -1123,16 +1123,16 @@ foo sub function A { - trap "> /dev/null;print TRAP A" EXIT + trap "> /dev/null;print TRAP A" EXIT # (( stderr )) && print >&2 } function B { - trap "> /dev/null;print TRAP B" EXIT - A + trap "> /dev/null;print TRAP B" EXIT + A } - + x=$(B) [[ $x == $'TRAP A\nTRAP B' ]] || err_exit "trap from functions in subshells fails got" $x diff --git a/src/cmd/ksh93/tests/io.sh b/src/cmd/ksh93/tests/io.sh index 669c72529707..802a13a4c130 100755 --- a/src/cmd/ksh93/tests/io.sh +++ b/src/cmd/ksh93/tests/io.sh @@ -156,7 +156,7 @@ exec 3>&- 4>&- read -r line; print -r -- "$line" ) & wait while read -r line - do print -r -- "$line" + do print -r -- "$line" done } << ! line 1 diff --git a/src/cmd/ksh93/tests/locale.sh b/src/cmd/ksh93/tests/locale.sh index 9fae8b1c932c..fa096a390dc8 100755 --- a/src/cmd/ksh93/tests/locale.sh +++ b/src/cmd/ksh93/tests/locale.sh @@ -315,7 +315,7 @@ unset LC_ALL LC_MESSAGES export LANG=debug function message { - print -r $"An error occurred." + print -r $"An error occurred." } exp=$'(libshell,3,46)\nAn error occurred.\n(libshell,3,46)' alt=$'(debug,message,libshell,An error occurred.)\nAn error occurred.\n(debug,message,libshell,An error occurred.)' diff --git a/src/cmd/ksh93/tests/math.sh b/src/cmd/ksh93/tests/math.sh index c2f1ab6ab82a..edb46318e587 100755 --- a/src/cmd/ksh93/tests/math.sh +++ b/src/cmd/ksh93/tests/math.sh @@ -29,7 +29,7 @@ function test_arithmetic_expression_access_array_element_through_nameref { ((xtrace)) && set -x - compound out=( typeset stdout stderr ; integer res ) + compound out=( typeset stdout stderr ; integer res ) compound -r -a tests=( ( cmd='@@TYPE@@ -a @@VAR@@ ; @@VAR@@[1]=90 ; function x { nameref nz=$1 ; print " $(( round(nz) ))==$(( round($nz) ))" ; } ; x @@VAR@@[1]' ; stdoutpattern=' 90==90' diff --git a/src/cmd/ksh93/tests/nameref.sh b/src/cmd/ksh93/tests/nameref.sh index c15523ff5635..26a9be94ef11 100755 --- a/src/cmd/ksh93/tests/nameref.sh +++ b/src/cmd/ksh93/tests/nameref.sh @@ -50,14 +50,14 @@ then err_exit ".foo.bar.child=${.foo.bar.child} != child" fi function func1 { - nameref color=$1 - func2 color + nameref color=$1 + func2 color } function func2 { - nameref color=$1 - set -s -- ${!color[@]} + nameref color=$1 + set -s -- ${!color[@]} print -r -- "$@" } @@ -175,7 +175,7 @@ do typeset -n x=$i done) != ok ]] && err_exit 'invalid for loop optimization of name references' function setval # name value { - nameref arg=$1 + nameref arg=$1 nameref var=arg.bar var=$2 } @@ -184,8 +184,8 @@ setval foo 5 (( foo.bar == 5)) || err_exit 'nested nameref not working' function selfref { - typeset -n ps=$1 - print -r -- "${ps}" + typeset -n ps=$1 + print -r -- "${ps}" } ps=(a=1 b=2) [[ $(selfref ps) == *a=1* ]] || err_exit 'local nameref cannot reference global variable of the same name' @@ -213,8 +213,8 @@ unset fun i foo=(x=hi) function fun { - nameref i=$1 - print -r -- "${i.x}" + nameref i=$1 + print -r -- "${i.x}" } i=foo [[ $(fun $i) == hi ]] || err_exit 'nameref for compound variable with in function name of caller fails' @@ -327,16 +327,16 @@ ref=x [[ $ref == 3 ]] || err_exit "\$ref is $ref, it should be 3" function foobar { - typeset fvar=() - typeset -n ref=fvar.foo - ref=ok - print -r $ref + typeset fvar=() + typeset -n ref=fvar.foo + ref=ok + print -r $ref } [[ $(foobar) == ok ]] 2> /dev/null || err_exit 'nameref in function not creating variable in proper scope' function foobar { - nameref doc=docs - nameref bar=doc.num + nameref doc=docs + nameref bar=doc.num [[ $bar == 2 ]] || err_exit 'nameref scoping error' } diff --git a/src/cmd/ksh93/tests/path.sh b/src/cmd/ksh93/tests/path.sh index 8a4bbec2b94c..c534d96e4452 100755 --- a/src/cmd/ksh93/tests/path.sh +++ b/src/cmd/ksh93/tests/path.sh @@ -621,20 +621,20 @@ expect="printf is a function printf is a shell builtin $(all_paths printf | sed 's/^/printf is /')" [[ $actual == "$expect" ]] || err_exit "'whence -a': incorrect output for function+builtin" \ - "(expected $(printf %q "$expect"), got $(printf %q "$actual"))" + "(expected $(printf %q "$expect"), got $(printf %q "$actual"))" actual=$(autoload printf; whence -a printf) expect="printf is an undefined function printf is a shell builtin $(all_paths printf | sed 's/^/printf is /')" [[ $actual == "$expect" ]] || err_exit "'whence -a': incorrect output for autoload+builtin" \ - "(expected $(printf %q "$expect"), got $(printf %q "$actual"))" + "(expected $(printf %q "$expect"), got $(printf %q "$actual"))" # 'whence -v' canonicalized paths improperly: https://github.com/ksh93/ksh/issues/84 cmdpath=${ whence -p printf; } actual=$(cd /; whence -v "${cmdpath#/}") expect="${cmdpath#/} is $cmdpath" [[ $actual == "$expect" ]] || err_exit "'whence -v': incorrect canonicalization of initial /" \ - "(expected $(printf %q "$expect"), got $(printf %q "$actual"))" + "(expected $(printf %q "$expect"), got $(printf %q "$actual"))" dotdot= num=$(set -f; IFS=/; set -- $PWD; echo $#) for ((i=1; i&1) exp=$PWD$'\n'$PWD [[ $got == "$exp" ]] || err_exit "child shell failed to obtain PWD" \ - "(expected $(printf %q "$exp"), got $(printf %q "$got"))" + "(expected $(printf %q "$exp"), got $(printf %q "$got"))" # ====== # Test backported from ksh93v- 2013-06-28 for deleting diff --git a/src/cmd/ksh93/tests/pointtype.sh b/src/cmd/ksh93/tests/pointtype.sh index e6e6e9af8899..031b884d5daf 100755 --- a/src/cmd/ksh93/tests/pointtype.sh +++ b/src/cmd/ksh93/tests/pointtype.sh @@ -2,7 +2,7 @@ # # # This software is part of the ast package # # Copyright (c) 1982-2011 AT&T Intellectual Property # -# Copyright (c) 2020-2022 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 # # # @@ -112,10 +112,10 @@ eval "$(typeset -p y)" unset z y typeset -T A_t=( - Pt_t -a b + Pt_t -a b ) typeset -T B_t=( - Pt_t -A b + Pt_t -A b ) A_t r r.b[1]=(y=2) diff --git a/src/cmd/ksh93/tests/sigchld.sh b/src/cmd/ksh93/tests/sigchld.sh index 32b0990a1e47..b2c6588363c1 100755 --- a/src/cmd/ksh93/tests/sigchld.sh +++ b/src/cmd/ksh93/tests/sigchld.sh @@ -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 # # # @@ -132,8 +132,8 @@ trap '' CHLD integer d for ((d=0; d < 2000; d++)) do if print foo | grep bar - then break - fi + then break + fi done (( d==2000 )) || err_exit "trap '' CHLD causes side effects d=$d" trap - CHLD diff --git a/src/cmd/ksh93/tests/signal.sh b/src/cmd/ksh93/tests/signal.sh index 004fc23e35c9..c8100cc234ca 100755 --- a/src/cmd/ksh93/tests/signal.sh +++ b/src/cmd/ksh93/tests/signal.sh @@ -425,14 +425,14 @@ fi x=$( $SHELL <<- \++EOF set -o pipefail - foobar() - { + foobar() + { for ((i=0; i < 10000; i++)) do print abcdefghijklmnopqrstuvwxyz done | head > /dev/null - } - foobar - print ok + } + foobar + print ok ++EOF ) [[ $x == ok ]] || err_exit 'SIGPIPE exit status causes PIPE signal to be propagated' diff --git a/src/cmd/ksh93/tests/statics.sh b/src/cmd/ksh93/tests/statics.sh index e68d69fc7095..123b0e992732 100755 --- a/src/cmd/ksh93/tests/statics.sh +++ b/src/cmd/ksh93/tests/statics.sh @@ -70,7 +70,7 @@ function test1 # test2: test the more complex datatypes function test2 { - compound out=( typeset stdout stderr ; integer res ) + compound out=( typeset stdout stderr ; integer res ) integer i test_t -r -a tests=( @@ -659,14 +659,14 @@ test_hx_scope false false out=$(function fun2 { - nameref sn=$1 - (( sn.a++, sn.b++ )) - $2 && printf "a=%d, b=%d\n" sn.a sn.b + nameref sn=$1 + (( sn.a++, sn.b++ )) + $2 && printf "a=%d, b=%d\n" sn.a sn.b } function fun1 { - compound -S s=( a=0 b=0 ) - fun2 s $1 + compound -S s=( a=0 b=0 ) + fun2 s $1 } (fun1 false ; fun1 false ; fun1 true) (fun1 false ; fun1 false ; fun1 true) diff --git a/src/cmd/ksh93/tests/subshell.sh b/src/cmd/ksh93/tests/subshell.sh index 7a91abf9b6ed..61fff0caceb3 100755 --- a/src/cmd/ksh93/tests/subshell.sh +++ b/src/cmd/ksh93/tests/subshell.sh @@ -604,12 +604,12 @@ $SHELL 2> /dev/null "$tmpfile" || err_exit 'IFS in subshell causes core dump' unset i if [[ -d /dev/fd ]] then integer i - for ((i=11; i < 29; i++)) - do if ! [[ -r /dev/fd/$i || -w /dev/fd/$i ]] - then a=$($SHELL -c "[[ -r /dev/fd/$i || -w /dev/fd/$i ]]") - (( $? )) || err_exit "file descriptor $i not close on exec" - fi - done + for ((i=11; i < 29; i++)) + do if ! [[ -r /dev/fd/$i || -w /dev/fd/$i ]] + then a=$($SHELL -c "[[ -r /dev/fd/$i || -w /dev/fd/$i ]]") + (( $? )) || err_exit "file descriptor $i not close on exec" + fi + done fi trap USR1 USR1 @@ -1075,11 +1075,11 @@ sleep 2 & spid=$! for ((i=1; i<2048; i++)) do print $i done | ( # trigger 1: read from pipe - foo=`: &` # trigger 2: bg job in backtick comsub - while read -r line - do : - done - kill $spid + foo=`: &` # trigger 2: bg job in backtick comsub + while read -r line + do : + done + kill $spid ) & tpid=$! wait $spid 2>/dev/null diff --git a/src/cmd/ksh93/tests/substring.sh b/src/cmd/ksh93/tests/substring.sh index 91188baa7d2c..6504c3f3d077 100755 --- a/src/cmd/ksh93/tests/substring.sh +++ b/src/cmd/ksh93/tests/substring.sh @@ -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 # # # @@ -169,8 +169,8 @@ xx='a:b' str='(){}[]*?|&^%$#@l' for ((i=0 ; i < ${#str}; i++)) do [[ $(eval print -r -- \"\${xx//:/\\${str:i:1}}\") == "a${str:i:1}b" ]] || err_exit "substitution of \\${str:i:1}} failed" - [[ $(eval print -rn -- \"\${xx//:/\'${str:i:1}\'}\") == "a${str:i:1}b" ]] || err_exit "substitution of '${str:i:1}' failed" - [[ $(eval print -r -- \"\${xx//:/\"${str:i:1}\"}\") == "a${str:i:1}b" ]] || err_exit "substitution of \"${str:i:1}\" failed" + [[ $(eval print -rn -- \"\${xx//:/\'${str:i:1}\'}\") == "a${str:i:1}b" ]] || err_exit "substitution of '${str:i:1}' failed" + [[ $(eval print -r -- \"\${xx//:/\"${str:i:1}\"}\") == "a${str:i:1}b" ]] || err_exit "substitution of \"${str:i:1}\" failed" done [[ ${xx//:/\\n} == 'a\nb' ]] || err_exit "substitution of \\\\n failed" [[ ${xx//:/'\n'} == 'a\nb' ]] || err_exit "substitution of '\\n' failed" diff --git a/src/cmd/ksh93/tests/types.sh b/src/cmd/ksh93/tests/types.sh index 30d61721eb27..6a8e20d90c93 100755 --- a/src/cmd/ksh93/tests/types.sh +++ b/src/cmd/ksh93/tests/types.sh @@ -400,23 +400,23 @@ bar.foo[a]=b { x=$( $SHELL 2> /dev/null << \++EOF++ typeset -T ab_t=( - integer a=1 b=2 - function increment - { - (( _.a++, _.b++ )) - } + integer a=1 b=2 + function increment + { + (( _.a++, _.b++ )) + } ) function ar_n { - nameref sn=$2 - sn.increment - $1 && printf "a=%d, b=%d\n" sn.a sn.b + nameref sn=$2 + sn.increment + $1 && printf "a=%d, b=%d\n" sn.a sn.b } function ar { - ab_t -S -a s - [[ -v s[5] ]] || s[5]=( ) - ar_n $1 s[5] + ab_t -S -a s + [[ -v s[5] ]] || s[5]=( ) + ar_n $1 s[5] } x=$(ar false ; ar false ; ar true ; printf ";") y=$(ar false ; ar false ; ar true ; printf ";") diff --git a/src/cmd/ksh93/tests/variables.sh b/src/cmd/ksh93/tests/variables.sh index d21d1a5d0113..b68d9dee8c7f 100755 --- a/src/cmd/ksh93/tests/variables.sh +++ b/src/cmd/ksh93/tests/variables.sh @@ -160,7 +160,7 @@ sleep $secSleep secElapsed=SECONDS if (( secElapsed < secSleep )) then err_exit "slept ${secElapsed} seconds instead of ${secSleep}: " \ - "either 'sleep' or \$SECONDS not working" + "either 'sleep' or \$SECONDS not working" fi unset -v secElapsed secSleep # _ @@ -277,7 +277,7 @@ fi ACCESS=0 function COUNT.set { - (( ACCESS++ )) + (( ACCESS++ )) } COUNT=0 (( COUNT++ )) @@ -362,11 +362,11 @@ fi unset y function setdisc # var { - eval function $1.get' - { - .sh.value=good - } - ' + eval function $1.get' + { + .sh.value=good + } + ' } y=bad setdisc y @@ -1552,7 +1552,7 @@ got=$(f && bar) unset var function three { - : + : } function two { var+='wrong ' sh -c 'true' diff --git a/src/lib/libsum/sum-sha2.c b/src/lib/libsum/sum-sha2.c index 65d5cb92141e..276d37d2f833 100644 --- a/src/lib/libsum/sum-sha2.c +++ b/src/lib/libsum/sum-sha2.c @@ -393,7 +393,7 @@ typedef struct Sha256_s #define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ REVERSE32(*data++, W256[j]); \ T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \ - K256[j] + W256[j]; \ + K256[j] + W256[j]; \ (d) += T1; \ (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ j++ @@ -761,7 +761,7 @@ typedef struct Sha512_s #define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ REVERSE64(*data++, W512[j]); \ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ - K512[j] + W512[j]; \ + K512[j] + W512[j]; \ (d) += T1, \ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \ j++ @@ -771,7 +771,7 @@ typedef struct Sha512_s #define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ - K512[j] + (W512[j] = *data++); \ + K512[j] + (W512[j] = *data++); \ (d) += T1; \ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ j++ @@ -784,7 +784,7 @@ typedef struct Sha512_s s1 = W512[(j+14)&0x0f]; \ s1 = sigma1_512(s1); \ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \ - (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \ + (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \ (d) += T1; \ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ j++