From 038839877f36abdb8b08dc21367cda64d59d1d3f Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Sun, 1 Dec 2024 01:10:40 +0000 Subject: [PATCH] Fix a large amount of whitespace issues in the code Inconsistent tab indentation is annoying, especially if you set your tab width to something other than 8 spaces. This commit fixes indentation by converting all sets of 8 leading spaces to tabs. Trailing tabs and spaces are also removed (even on lines consisting of only tabs or spaces). --- src/cmd/INIT/iffe.sh | 2 +- src/cmd/INIT/mamake.c | 6 +- src/cmd/ksh93/DESIGN | 2 +- src/cmd/ksh93/RELEASE88 | 8 +-- src/cmd/ksh93/bltins/alarm.c | 4 +- src/cmd/ksh93/bltins/enum.c | 36 ++++++------ src/cmd/ksh93/bltins/getopts.c | 6 +- src/cmd/ksh93/bltins/misc.c | 2 +- src/cmd/ksh93/bltins/mkservice.c | 18 +++--- src/cmd/ksh93/bltins/print.c | 48 ++++++++-------- src/cmd/ksh93/bltins/read.c | 8 +-- src/cmd/ksh93/bltins/test.c | 12 ++-- src/cmd/ksh93/bltins/typeset.c | 6 +- src/cmd/ksh93/bltins/ulimit.c | 12 ++-- src/cmd/ksh93/bltins/umask.c | 24 ++++---- src/cmd/ksh93/bltins/whence.c | 4 +- src/cmd/ksh93/data/builtins.c | 90 ++++++++++++++--------------- src/cmd/ksh93/data/limits.c | 4 +- src/cmd/ksh93/data/strdata.c | 6 +- src/cmd/ksh93/edit/completion.c | 4 +- src/cmd/ksh93/edit/edit.c | 6 +- src/cmd/ksh93/edit/emacs.c | 98 ++++++++++++++++---------------- src/cmd/ksh93/edit/hexpand.c | 12 ++-- src/cmd/ksh93/edit/history.c | 64 ++++++++++----------- src/cmd/ksh93/edit/vi.c | 12 ++-- src/cmd/ksh93/include/argnod.h | 2 +- src/cmd/ksh93/include/edit.h | 2 +- src/cmd/ksh93/include/history.h | 4 +- src/cmd/ksh93/include/name.h | 4 +- src/cmd/ksh93/include/nval.h | 2 +- src/cmd/ksh93/include/shnodes.h | 2 +- src/cmd/ksh93/include/streval.h | 2 +- src/cmd/ksh93/sh/args.c | 6 +- src/cmd/ksh93/sh/array.c | 8 +-- src/cmd/ksh93/sh/deparse.c | 10 ++-- src/cmd/ksh93/sh/fault.c | 6 +- src/cmd/ksh93/sh/fcin.c | 2 +- src/cmd/ksh93/sh/init.c | 14 ++--- src/cmd/ksh93/sh/io.c | 44 +++++++------- src/cmd/ksh93/sh/jobs.c | 18 +++--- src/cmd/ksh93/sh/lex.c | 22 +++---- src/cmd/ksh93/sh/macro.c | 16 +++--- src/cmd/ksh93/sh/main.c | 4 +- src/cmd/ksh93/sh/name.c | 54 +++++++++--------- src/cmd/ksh93/sh/nvdisc.c | 40 ++++++------- src/cmd/ksh93/sh/nvtree.c | 14 ++--- src/cmd/ksh93/sh/nvtype.c | 20 +++---- src/cmd/ksh93/sh/parse.c | 8 +-- src/cmd/ksh93/sh/path.c | 8 +-- src/cmd/ksh93/sh/shcomp.c | 8 +-- src/cmd/ksh93/sh/streval.c | 16 +++--- src/cmd/ksh93/sh/string.c | 2 +- src/cmd/ksh93/sh/subshell.c | 6 +- src/cmd/ksh93/sh/timers.c | 4 +- src/cmd/ksh93/sh/trestore.c | 2 +- src/cmd/ksh93/sh/xec.c | 22 +++---- src/cmd/ksh93/tests/arrays.sh | 2 +- src/cmd/ksh93/tests/arrays2.sh | 2 +- src/cmd/ksh93/tests/comvario.sh | 42 +++++++------- src/cmd/ksh93/tests/coprocess.sh | 26 ++++----- src/cmd/ksh93/tests/libcmd.sh | 4 +- src/cmd/ksh93/tests/math.sh | 14 ++--- src/cmd/ksh93/tests/nameref.sh | 2 +- src/cmd/ksh93/tests/readcsv.sh | 4 +- src/cmd/ksh93/tests/statics.sh | 76 ++++++++++++------------- src/lib/libast/aso/aso-sem.c | 10 ++-- src/lib/libast/cdt/cdtlib.h | 4 +- src/lib/libast/cdt/dthash.c | 6 +- src/lib/libast/cdt/dtmethod.c | 6 +- src/lib/libast/cdt/dttree.c | 18 +++--- src/lib/libast/cdt/dtview.c | 4 +- src/lib/libast/comp/conf.sh | 6 +- src/lib/libast/comp/conf.tab | 2 +- src/lib/libast/comp/eaccess.c | 4 +- src/lib/libast/comp/iconv.c | 2 +- src/lib/libast/comp/setlocale.c | 2 +- src/lib/libast/comp/wordexp.c | 4 +- src/lib/libast/disc/sfdcfilter.c | 2 +- src/lib/libast/disc/sfdcmore.c | 4 +- src/lib/libast/disc/sfdcprefix.c | 4 +- src/lib/libast/disc/sfdcsubstr.c | 2 +- src/lib/libast/features/aso | 18 +++--- src/lib/libast/features/common | 24 ++++---- src/lib/libast/features/fcntl.c | 2 +- src/lib/libast/features/float | 4 +- src/lib/libast/features/lib | 2 +- src/lib/libast/features/limits.c | 2 +- src/lib/libast/features/mmap | 22 +++---- src/lib/libast/hash/hashalloc.c | 2 +- src/lib/libast/hash/hashlook.c | 4 +- src/lib/libast/include/cdt.h | 10 ++-- src/lib/libast/include/shcmd.h | 4 +- src/lib/libast/misc/debug.c | 4 +- src/lib/libast/misc/fastfind.c | 10 ++-- src/lib/libast/misc/fts.c | 10 ++-- src/lib/libast/misc/magic.tab | 4 +- src/lib/libast/misc/optget.c | 2 +- src/lib/libast/misc/procopen.c | 2 +- src/lib/libast/misc/stk.c | 12 ++-- src/lib/libast/misc/translate.c | 26 ++++----- src/lib/libast/path/pathcanon.c | 4 +- src/lib/libast/path/pathtemp.c | 4 +- src/lib/libast/port/lc.c | 6 +- src/lib/libast/port/lclang.h | 36 ++++++------ src/lib/libast/port/mc.c | 4 +- src/lib/libast/port/mnt.c | 4 +- src/lib/libast/regex/regclass.c | 2 +- src/lib/libast/regex/regcomp.c | 14 ++--- src/lib/libast/regex/regnexec.c | 2 +- src/lib/libast/sfio/sfcvt.c | 12 ++-- src/lib/libast/sfio/sfhdr.h | 2 +- src/lib/libast/sfio/sfmode.c | 4 +- src/lib/libast/sfio/sfmove.c | 2 +- src/lib/libast/sfio/sfpkrd.c | 4 +- src/lib/libast/sfio/sfputr.c | 2 +- src/lib/libast/sfio/sfread.c | 2 +- src/lib/libast/sfio/sfsetbuf.c | 8 +-- src/lib/libast/sfio/sfswap.c | 2 +- src/lib/libast/sfio/sftable.c | 4 +- src/lib/libast/sfio/sftell.c | 2 +- src/lib/libast/sfio/sftmp.c | 6 +- src/lib/libast/sfio/sfungetc.c | 2 +- src/lib/libast/sfio/sfvprintf.c | 8 +-- src/lib/libast/sfio/sfvscanf.c | 6 +- src/lib/libast/stdio/fgets.c | 2 +- src/lib/libast/stdio/setvbuf.c | 4 +- src/lib/libast/stdio/vsnprintf.c | 2 +- src/lib/libast/string/fmtip6.c | 4 +- src/lib/libast/string/strexpr.c | 4 +- src/lib/libast/string/strtoi.h | 4 +- src/lib/libast/string/tokline.c | 2 +- src/lib/libast/tm/tmlex.c | 4 +- src/lib/libast/tm/tmxdate.c | 2 +- src/lib/libast/tm/tmxfmt.c | 6 +- src/lib/libcmd/basename.c | 6 +- src/lib/libcmd/cmp.c | 6 +- src/lib/libcmd/comm.c | 2 +- src/lib/libcmd/cp.c | 24 ++++---- src/lib/libcmd/cut.c | 8 +-- src/lib/libcmd/date.c | 8 +-- src/lib/libcmd/dirname.c | 8 +-- src/lib/libcmd/fold.c | 10 ++-- src/lib/libcmd/getconf.c | 18 +++--- src/lib/libcmd/head.c | 4 +- src/lib/libcmd/id.c | 14 ++--- src/lib/libcmd/join.c | 4 +- src/lib/libcmd/logname.c | 6 +- src/lib/libcmd/mkdir.c | 4 +- src/lib/libcmd/mkfifo.c | 6 +- src/lib/libcmd/mktemp.c | 10 ++-- src/lib/libcmd/paste.c | 2 +- src/lib/libcmd/pathchk.c | 36 ++++++------ src/lib/libcmd/pids.c | 12 ++-- src/lib/libcmd/rev.c | 8 +-- src/lib/libcmd/rm.c | 2 +- src/lib/libcmd/rmdir.c | 6 +- src/lib/libcmd/stty.c | 16 +++--- src/lib/libcmd/sync.c | 6 +- src/lib/libcmd/tail.c | 8 +-- src/lib/libcmd/tee.c | 4 +- src/lib/libcmd/tty.c | 10 ++-- src/lib/libcmd/uniq.c | 8 +-- src/lib/libcmd/wc.c | 8 +-- src/lib/libcmd/wclib.c | 2 +- src/lib/libsum/sum-sha1.c | 2 +- src/lib/libsum/sum-sha2.c | 6 +- src/lib/libsum/sumlib.c | 2 +- 167 files changed, 867 insertions(+), 867 deletions(-) diff --git a/src/cmd/INIT/iffe.sh b/src/cmd/INIT/iffe.sh index 9c4683d65ffa..817bcc20255c 100644 --- a/src/cmd/INIT/iffe.sh +++ b/src/cmd/INIT/iffe.sh @@ -2309,7 +2309,7 @@ int x; # NOTE() support case $ext in - *""*) + *""*) case $ext in *"#define NOTE("*) ;; diff --git a/src/cmd/INIT/mamake.c b/src/cmd/INIT/mamake.c index 688d0c553614..aafc9ca83656 100644 --- a/src/cmd/INIT/mamake.c +++ b/src/cmd/INIT/mamake.c @@ -582,7 +582,7 @@ static Dict_item_t *search(Dict_t *dict, char *name, int create) if (!(cmp = strcmp(name, root->name))) break; else if (cmp < 0) - { + { if (root->left && (cmp = strcmp(name, root->left->name)) <= 0) { /* rotate(left, right) */ @@ -602,7 +602,7 @@ static Dict_item_t *search(Dict_t *dict, char *name, int create) right->left = NULL; } else - { + { if (root->right && (cmp = strcmp(name, root->right->name)) >= 0) { /* rotate(right, left) */ @@ -3084,7 +3084,7 @@ int main(int argc, char **argv) */ if (SA_RESTART && state.maxjobs > 1) - { + { struct sigaction act; sigemptyset(&empty_sigmask); act.sa_handler = sigchld_dummy; diff --git a/src/cmd/ksh93/DESIGN b/src/cmd/ksh93/DESIGN index ef00b3cd36bb..7d16659fda34 100644 --- a/src/cmd/ksh93/DESIGN +++ b/src/cmd/ksh93/DESIGN @@ -115,7 +115,7 @@ sh directory: 8. fcin.c contains code for reading and writing a character at a time from a file or string. 9. init.c contains initialization code and callbacks - for get and set functions for built-in variables. + for get and set functions for built-in variables. 10. io.o contains code for redirections and managing file descriptors and file streams. 11. jobs.c contains the code for job management. diff --git a/src/cmd/ksh93/RELEASE88 b/src/cmd/ksh93/RELEASE88 index bbeebae968cf..b6bb2fe55436 100644 --- a/src/cmd/ksh93/RELEASE88 +++ b/src/cmd/ksh93/RELEASE88 @@ -135,7 +135,7 @@ of ksh. then ${foo.bar} is equivalent to ${.top.bar}. When used as the index of a for or select loop, each assignment causes a new name reference to occur. - + l. The KEYBD trap has been added which is triggered when a key or escape sequence is typed while reading from the keyboard in an edit mode. This, combined with some new variables @@ -220,7 +220,7 @@ of ksh. 2. Functions declared as function name, preserve the old ksh semantics can be also used as the first argument to the dot (.) command to have them executed in a dot script environment. - + c. The command search rules have changed as follows: 1. Special built-ins (those with a dagger in front of them) are executed first. @@ -315,7 +315,7 @@ of ksh. timeout after n seconds when reading from a slow device. 3. A -d char option has been added which causes the read to terminate at char rather than at new-line. - + n. The trap command has been changed as follows: 1. Trap names can be either upper case or lower case. 2. Trap -p only causes the specified trap values to be displayed. @@ -409,7 +409,7 @@ of ksh. e. There are far fewer global names. This should make it must easier to add built-in commands without worrying about conflicts. - + f. The code uses the sfio library which makes it possible to mix with stdio. diff --git a/src/cmd/ksh93/bltins/alarm.c b/src/cmd/ksh93/bltins/alarm.c index f31bed711863..34517613b3c1 100644 --- a/src/cmd/ksh93/bltins/alarm.c +++ b/src/cmd/ksh93/bltins/alarm.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 * * * @@ -164,7 +164,7 @@ void sh_timetraps(void) */ static char *setdisc(Namval_t *np, const char *event, Namval_t* action, Namfun_t *fp) { - struct tevent *tp = (struct tevent*)fp; + struct tevent *tp = (struct tevent*)fp; if(!event) return action ? Empty : (char*)ALARM; if(strcmp(event,ALARM)!=0) diff --git a/src/cmd/ksh93/bltins/enum.c b/src/cmd/ksh93/bltins/enum.c index c313bd4122fb..afa25c6eb7cb 100644 --- a/src/cmd/ksh93/bltins/enum.c +++ b/src/cmd/ksh93/bltins/enum.c @@ -30,7 +30,7 @@ const char sh_optenum[] = "For example, \benum bool=(false true)\b creates a Boolean variable " "type of which variables may be declared like \bbool x=true y=false\b.]" "[+?If the list of \avalue\as is omitted, then \atypename\a must name an " - "indexed array variable with at least two elements.]" + "indexed array variable with at least two elements.]" "[+?For more information, create a type, then use \atypename\a \b--man\b.]" "[+USE IN ARITHMETIC EXPRESSIONS?When an enumeration variable is used in an " "arithmetic expression, its value is the index into the array that " @@ -48,8 +48,8 @@ const char sh_optenum[] = "\n" "[+EXIT STATUS]" "{" - "[+0?Successful completion.]" - "[+>0?An error occurred.]" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bksh\b(1), \btypeset\b(1).]" ; @@ -69,30 +69,30 @@ static const char enum_type[] = "It is an error for an arithmetic expression to assign a value " "outside of that range. Decimal fractions are ignored.]" "[+?If no \aname\as are specified then the names and values of all " - "variables of this type are written to standard output.]" + "variables of this type are written to standard output.]" "[+?\b\f?\f\b is built in to the shell as a declaration command so that " - "field splitting and pathname expansion are not performed on " - "the arguments. Tilde expansion occurs on \avalue\a.]" + "field splitting and pathname expansion are not performed on " + "the arguments. Tilde expansion occurs on \avalue\a.]" "[r?Enables readonly. Once enabled, the value cannot be changed or unset.]" "[a?Indexed array. Each \aname\a is converted to an indexed " - "array of type \b\f?\f\b. If a variable already exists, the current " - "value will become index \b0\b.]" + "array of type \b\f?\f\b. If a variable already exists, the current " + "value will become index \b0\b.]" "[A?Associative array. Each \aname\a is converted to an associative " - "array of type \b\f?\f\b. If a variable already exists, the current " - "value will become subscript \b0\b.]" + "array of type \b\f?\f\b. If a variable already exists, the current " + "value will become subscript \b0\b.]" "[h]:[string?Used within a type definition to provide a help string " - "for variable \aname\a. Otherwise, it is ignored.]" + "for variable \aname\a. Otherwise, it is ignored.]" "[S?Used with a type definition to indicate that the variable is shared by " - "each instance of the type. When used inside a function defined " - "with the \bfunction\b reserved word, the specified variables " - "will have function static scope. Otherwise, the variable is " - "unset prior to processing the assignment list.]" + "each instance of the type. When used inside a function defined " + "with the \bfunction\b reserved word, the specified variables " + "will have function static scope. Otherwise, the variable is " + "unset prior to processing the assignment list.]" "\n" "\n[name[=value]...]\n" "\n" "[+EXIT STATUS?]{" - "[+0?Successful completion.]" - "[+>0?An error occurred.]" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\benum\b(1), \btypeset\b(1)]" @@ -293,7 +293,7 @@ int b_enum(int argc, char** argv, Shbltin_t *context) memset(&optdisc,0,sizeof(optdisc)); optdisc.opt.infof = enuminfo; optdisc.np = tp; - nv_addtype(tp, enum_type, &optdisc.opt, sizeof(optdisc)); + nv_addtype(tp, enum_type, &optdisc.opt, sizeof(optdisc)); } return error_info.errors != 0; } diff --git a/src/cmd/ksh93/bltins/getopts.c b/src/cmd/ksh93/bltins/getopts.c index 797628137533..e3e4723a8c53 100644 --- a/src/cmd/ksh93/bltins/getopts.c +++ b/src/cmd/ksh93/bltins/getopts.c @@ -48,7 +48,7 @@ static int infof(Opt_t* op, Sfio_t* sp, const char* s, Optdisc_t* dp) sfputr(sp,sh_mactry(stkfreeze(stkp,1)),-1); stkset(stkp,savptr,savtop); } - return 1; + return 1; } int b_getopts(int argc,char *argv[],Shbltin_t *context) @@ -61,7 +61,7 @@ int b_getopts(int argc,char *argv[],Shbltin_t *context) volatile int extended, r= -1; struct checkpt buff, *pp; Optdisc_t disc; - memset(&disc, 0, sizeof(disc)); + memset(&disc, 0, sizeof(disc)); disc.version = OPT_VERSION; disc.infof = infof; value[1] = 0; @@ -196,6 +196,6 @@ int b_getopts(int argc,char *argv[],Shbltin_t *context) else nv_putval(np, opt_info.arg, NV_RDONLY); sh_popcontext(&buff); - opt_info.disc = 0; + opt_info.disc = 0; return r; } diff --git a/src/cmd/ksh93/bltins/misc.c b/src/cmd/ksh93/bltins/misc.c index 129fa6dbfdca..fe0f38e81137 100644 --- a/src/cmd/ksh93/bltins/misc.c +++ b/src/cmd/ksh93/bltins/misc.c @@ -440,7 +440,7 @@ int b_wait(int n,char *argv[],Shbltin_t *context) int b_bg(int n,char *argv[],Shbltin_t *context) { int flag = **argv; - const char *optstr = sh_optbg; + const char *optstr = sh_optbg; NOT_USED(context); if(*argv[0]=='f') optstr = sh_optfg; diff --git a/src/cmd/ksh93/bltins/mkservice.c b/src/cmd/ksh93/bltins/mkservice.c index 401368b4d5c0..d0a6d62a945a 100644 --- a/src/cmd/ksh93/bltins/mkservice.c +++ b/src/cmd/ksh93/bltins/mkservice.c @@ -51,7 +51,7 @@ static const char mkservice_usage[] = "to be read from one of the active connections. It is " "called with the file descriptor number that has data " "to be read. If the function returns a non-zero " - "value, this connection will be closed.]" + "value, this connection will be closed.]" "[+close?This function is invoked when the connection is closed.]" "}" "[+?If \avarname\a is unset, then all active connection, and the service " @@ -61,8 +61,8 @@ static const char mkservice_usage[] = "\nvarname service_path\n" "\n" "[+EXIT STATUS?]{" - "[+0?Success.]" - "[+>0?An error occurred.]" + "[+0?Success.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\beloop\b(1)]" ; @@ -81,8 +81,8 @@ static const char eloop_usage[] = "\n" "[+EXIT STATUS?If no timeout is specified, \beloop\b will not return " "unless interrupted. Otherwise]{" - "[+0?The specified timeout interval occurred.]" - "[+>0?An error occurred.]" + "[+0?The specified timeout interval occurred.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bmkservice\b(1)]" ; @@ -207,7 +207,7 @@ static void process_stream(Sfio_t* iop) close(fd); } } - + static int waitnotify(int fd, long timeout, int rw) { Sfio_t *special=0, **pstream; @@ -335,8 +335,8 @@ static int Error(Service_t *sp, int level, const char* arg, ...) if(sp->node) nv_unset(sp->node); free(sp); - errorv(NULL, ERROR_exit(1), ap); - va_end(ap); + errorv(NULL, ERROR_exit(1), ap); + va_end(ap); return 0; } @@ -451,7 +451,7 @@ int b_mkservice(int argc, char** argv, Shbltin_t *context) sp->fd = fd; np = nv_open(var,sh.var_tree,NV_ARRAY|NV_VARNAME); sp->node = np; - nv_putval(np, path, 0); + nv_putval(np, path, 0); nv_stack(np, (Namfun_t*)sp); service_add(sp); return 0; diff --git a/src/cmd/ksh93/bltins/print.c b/src/cmd/ksh93/bltins/print.c index 3c3675ce0c34..3e28083b0881 100644 --- a/src/cmd/ksh93/bltins/print.c +++ b/src/cmd/ksh93/bltins/print.c @@ -469,27 +469,27 @@ static int echolist(Sfio_t *outfile, int raw, char *argv[]) */ static char strformat(char *s) { - char* t; - int c; - char* b; - char* p; + char* t; + int c; + char* b; + char* p; #if SHOPT_MULTIBYTE && defined(FMT_EXP_WIDE) int w; #endif - b = t = s; - for (;;) - { - switch (c = *s++) - { - case '\\': + b = t = s; + for (;;) + { + switch (c = *s++) + { + case '\\': if(*s==0) break; #if SHOPT_MULTIBYTE && defined(FMT_EXP_WIDE) - c = chrexp(s - 1, &p, &w, FMT_EXP_CHAR|FMT_EXP_LINE|FMT_EXP_WIDE); + c = chrexp(s - 1, &p, &w, FMT_EXP_CHAR|FMT_EXP_LINE|FMT_EXP_WIDE); #else - c = chresc(s - 1, &p); + c = chresc(s - 1, &p); #endif - s = p; + s = p; #if SHOPT_MULTIBYTE #if defined(FMT_EXP_WIDE) if(w) @@ -512,13 +512,13 @@ static char strformat(char *s) *t++ = '%'; c = 'Z'; } - break; - case 0: - *t = 0; - return t - b; - } - *t++ = c; - } + break; + case 0: + *t = 0; + return t - b; + } + *t++ = c; + } } static char *genformat(char *format) @@ -647,7 +647,7 @@ static ssize_t fmtbase64(Sfio_t *iop, char *string, int alt) else { size = sizeof(short); - number.i = (int)d; + number.i = (int)d; } } return sfwrite(iop, &number, size); @@ -661,7 +661,7 @@ static ssize_t fmtbase64(Sfio_t *iop, char *string, int alt) break; } if(fp) - return (*fp->disc->writef)(np, iop, 0, fp); + return (*fp->disc->writef)(np, iop, 0, fp); else { int n = nv_size(np); @@ -800,7 +800,7 @@ static int extend(Sfio_t* sp, void* v, Sffmt_t* fe) case 'E': case 'F': case 'G': - if(SFFMT_LDOUBLE) + if(SFFMT_LDOUBLE) value->ld = 0.; else value->d = 0.; @@ -996,7 +996,7 @@ static int extend(Sfio_t* sp, void* v, Sffmt_t* fe) d = sh_strnum(argp,&lastchar,0); break; } - if(SFFMT_LDOUBLE) + if(SFFMT_LDOUBLE) { value->ld = d; fe->size = sizeof(value->ld); diff --git a/src/cmd/ksh93/bltins/read.c b/src/cmd/ksh93/bltins/read.c index 3f090a073288..500c3f1795a6 100644 --- a/src/cmd/ksh93/bltins/read.c +++ b/src/cmd/ksh93/bltins/read.c @@ -50,13 +50,13 @@ struct read_save { - char **argv; + char **argv; char *prompt; - int fd; - int plen; + int fd; + int plen; int flags; ssize_t len; - Sflong_t timeout; + Sflong_t timeout; }; int b_read(int argc,char *argv[], Shbltin_t *context) diff --git a/src/cmd/ksh93/bltins/test.c b/src/cmd/ksh93/bltins/test.c index 402a9f10cd62..d73007440e5d 100644 --- a/src/cmd/ksh93/bltins/test.c +++ b/src/cmd/ksh93/bltins/test.c @@ -69,9 +69,9 @@ static int test_mode(const char*); struct test { - int ap; - int ac; - char **av; + int ap; + int ac; + char **av; }; static char *nxtarg(struct test*,int); @@ -82,7 +82,7 @@ static int test_strmatch(const char *str, const char *pat) { int match[2*(MATCH_MAX+1)],n; int c, m=0; - const char *cp=pat; + const char *cp=pat; while(c = *cp++) { if(c=='(') @@ -654,7 +654,7 @@ int sh_access(const char *name, int mode) else { static int maxgroups; - gid_t *groups; + gid_t *groups; int n; if(maxgroups==0) { @@ -684,7 +684,7 @@ int sh_access(const char *name, int mode) } /* - * Return the mode bits of file + * Return the mode bits of file * If is null, then the previous stat buffer is used. * The mode bits are zero if the file doesn't exist. */ diff --git a/src/cmd/ksh93/bltins/typeset.c b/src/cmd/ksh93/bltins/typeset.c index 50db69e364b4..7be70a8dc5d1 100644 --- a/src/cmd/ksh93/bltins/typeset.c +++ b/src/cmd/ksh93/bltins/typeset.c @@ -713,7 +713,7 @@ static int setall(char **argv,int flag,Dt_t *troot,struct tdata *tp) #endif /* SHOPT_NAMESPACE */ np = nv_open(name,sh_subfuntree(1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE); } - else + else { if(sh.prefix) { @@ -762,7 +762,7 @@ static int setall(char **argv,int flag,Dt_t *troot,struct tdata *tp) np = nv_search(stkptr(sh.stk,offset),troot,0); stkseek(sh.stk,offset); } - if(np && np->nvalue) + if(np && np->nvalue) ((struct Ufunction*)np->nvalue)->help = tp->help; } continue; @@ -810,7 +810,7 @@ static int setall(char **argv,int flag,Dt_t *troot,struct tdata *tp) _nv_unset(np,0); ap->nelem--; } - else if(iarray && ap && ap->fun) + else if(iarray && ap && ap->fun) { errormsg(SH_DICT,ERROR_exit(1),"cannot change associative array %s to indexed array",nv_name(np)); UNREACHABLE(); diff --git a/src/cmd/ksh93/bltins/ulimit.c b/src/cmd/ksh93/bltins/ulimit.c index de5aff2b5855..2827a97a99e8 100644 --- a/src/cmd/ksh93/bltins/ulimit.c +++ b/src/cmd/ksh93/bltins/ulimit.c @@ -57,7 +57,7 @@ static int infof(Opt_t* op, Sfio_t* sp, const char* s, Optdisc_t* dp) sfprintf(sp, " in %ss", e_units[tp->type]); sfprintf(sp, ".]"); } - return 1; + return 1; } #define HARD 2 @@ -76,11 +76,11 @@ int b_ulimit(int argc,char *argv[],Shbltin_t *context) int label, unit, nosupport, ret=0; rlim_t i=0; char tmp[41]; - Optdisc_t disc; - NOT_USED(context); - memset(&disc, 0, sizeof(disc)); - disc.version = OPT_VERSION; - disc.infof = infof; + Optdisc_t disc; + NOT_USED(context); + memset(&disc, 0, sizeof(disc)); + disc.version = OPT_VERSION; + disc.infof = infof; opt_info.disc = &disc; while((n = optget(argv,sh_optulimit))) switch(n) { diff --git a/src/cmd/ksh93/bltins/umask.c b/src/cmd/ksh93/bltins/umask.c index 9f2f6ecaf523..b11bc3d3c623 100644 --- a/src/cmd/ksh93/bltins/umask.c +++ b/src/cmd/ksh93/bltins/umask.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 * * * @@ -25,12 +25,12 @@ */ #include "shopt.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "builtins.h" #ifndef SH_DICT # define SH_DICT "libshell" @@ -61,13 +61,13 @@ int b_umask(int argc,char *argv[],Shbltin_t *context) argv += opt_info.index; if(mask = *argv) { - int c; + int c; if(isdigit(*mask)) { while(c = *mask++) { - if (c>='0' && c<='7') - flag = (flag<<3) + (c-'0'); + if (c>='0' && c<='7') + flag = (flag<<3) + (c-'0'); else { errormsg(SH_DICT,ERROR_exit(1),e_number,*argv); @@ -88,8 +88,8 @@ int b_umask(int argc,char *argv[],Shbltin_t *context) } flag = (~c&0777); } - umask(flag); - } + umask(flag); + } else { umask(flag=umask(0)); diff --git a/src/cmd/ksh93/bltins/whence.c b/src/cmd/ksh93/bltins/whence.c index 4d8edf141abc..2167cdd7ce78 100644 --- a/src/cmd/ksh93/bltins/whence.c +++ b/src/cmd/ksh93/bltins/whence.c @@ -186,7 +186,7 @@ static int whence(char **argv, int flags) /* non-tracked aliases */ if((np=nv_search(name,sh.alias_tree,0)) && !nv_isnull(np) && !nv_isattr(np,NV_TAGGED) - && (cp=nv_getval(np))) + && (cp=nv_getval(np))) { if(flags&V_FLAG) { @@ -324,7 +324,7 @@ static int whence(char **argv, int flags) sfputr(sfstdout,sh_fmtq(cp),'\n'); free((void*)cp); } - else if(aflag<=1) + else if(aflag<=1) { ret = 1; if(flags&V_FLAG) diff --git a/src/cmd/ksh93/data/builtins.c b/src/cmd/ksh93/data/builtins.c index 2018c2ec7fdc..b21c3e57b399 100644 --- a/src/cmd/ksh93/data/builtins.c +++ b/src/cmd/ksh93/data/builtins.c @@ -56,7 +56,7 @@ const struct shtable3 shtab_builtins[] = { "exec", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(exec), "redirect", NV_BLTIN|BLT_ENV, bltin(exec), - "set", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(set), + "set", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(set), ":", NV_BLTIN|BLT_ENV|BLT_SPC, bltin(true), "true", NV_BLTIN|BLT_ENV, bltin(true), "command", NV_BLTIN|BLT_ENV|BLT_EXIT, bltin(command), @@ -177,11 +177,11 @@ const struct shtable3 shtab_builtins[] = #if SHOPT_REGRESS "__regress__", NV_BLTIN|BLT_ENV, bltin(__regress__), #endif - "", 0, 0 + "", 0, 0 }; #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 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.]" \ @@ -370,7 +370,7 @@ const char sh_optcont[] = "[-1c?\n@(#)$Id: continue (ksh 93u+m) 2023-03-09 $\n]" "[--catalog?" SH_DICT "]" "[+NAME?continue - continue execution at top of the loop]" -"[+DESCRIPTION?\bcontinue\b is a shell special built-in that continues " +"[+DESCRIPTION?\bcontinue\b is a shell special built-in that continues " "execution at the top of smallest enclosing enclosing \bfor\b, " "\bselect\b, \bwhile\b, or \buntil\b loop, if any; or the top of " "the \an\a-th enclosing loop if \an\a is specified.]" @@ -402,7 +402,7 @@ const char sh_optalias[] = "each \aname\a that is specified, and \b=\b\avalue\a is not " "specified, the current value of the alias corresponding to " "\aname\a is written to standard output. If \b=\b\avalue\a is " - "specified, the alias \aname\a will be created or redefined.]" + "specified, the alias \aname\a will be created or redefined.]" "[+?Aliasing is performed when scripts are read, not while they are executed. " "So, for an alias to take effect, the alias definition command must " "be executed before the command that references the alias is read.]" @@ -417,7 +417,7 @@ const char sh_optalias[] = "\n" "[+EXIT STATUS?]{" "[+0?Successful completion.]" - "[+>0?One or more \aname\a operands did not have an alias " + "[+>0?One or more \aname\a operands did not have an alias " "definition, or an error occurred.]" "}" "[+SEE ALSO?\bsh\b(1), \bhash\b(1), \bunalias\b(1)]" @@ -608,7 +608,7 @@ const char sh_optdot[] = "the script completes execution.]" "[+?When \aname\a refers to a file, the \bPATH\b variable is searched " "for the file containing commands. In this case execute permission " - "is not required for \aname\a.]" + "is not required for \aname\a.]" "[+?If any \aarg\as are specified, these become the positional parameters " "for the duration of the function or script and are restored " "upon completion.]" @@ -716,7 +716,7 @@ const char sh_optexport[] = "If \b=\b\avalue\a is specified, the variable \aname\a is " "set to \avalue\a.]" "[+?If no \aname\as are specified then the names and values of all " - "exported variables are written to standard output.]" + "exported variables are written to standard output.]" "[+?\bexport\b is built in to the shell as a declaration command so that " "field splitting and pathname expansion are not performed on " "the arguments. Tilde expansion occurs on \avalue\a.]" @@ -726,8 +726,8 @@ const char sh_optexport[] = "\n[name[=value]...]\n" "\n" "[+EXIT STATUS?]{" - "[+0?Successful completion.]" - "[+>0?An error occurred.]" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bsh\b(1), \btypeset\b(1)]" @@ -791,15 +791,15 @@ const char sh_optgetopts[] = "combining \aoptstring\a values from multiple passes.]" "[+l?Display only \alongname\a options in help messages.]" "[+n?Associate -\anumber\a and +\anumber\a options with the first " - "option with numeric arguments.]" + "option with numeric arguments.]" "[+o?The \b-\b option character prefix is optional (supports " - "obsolete \bps\b(1) option syntax).]" + "obsolete \bps\b(1) option syntax).]" "[+p?\anumber\a specifies the number of \b-\b characters that must " "prefix long option names. The default is \b2\b; \b0\b, \b1\b or " "\b2\b are accepted (e.g., \bp0\b for \bdd\b(1) and \bp1\b for " "\bfind\b(1)).]" "[+s?\anumber\a specifies the \b--??man\b section number, " - "\b1\b by default.]" + "\b1\b by default.]" "}" "[+2.?An option specification of the form " "[\aoption\a[!]][=\anumber\a]][:\alongname\a]][?\atext\a]]]]. In this " @@ -918,7 +918,7 @@ _JOB_ "[+EXIT STATUS?]{" "[+0?If all background jobs are started.]" "[+>0?If one more jobs does not exist or there are no background " - "jobs.]" + "jobs.]" "}" "[+SEE ALSO?\bwait\b(1), \bfg\b(1), \bdisown\b(1), \bjobs\b(1)]" @@ -1019,7 +1019,7 @@ const char sh_opthash[] = ; #if !SHOPT_SCRIPTONLY -const char sh_opthist[] = +const char sh_opthist[] = "[-1cn?\n@(#)$Id: hist (AT&T Research) 2000-04-02 $\n]" "[--catalog?" SH_DICT "]" "[+NAME?\f?\f - process command history list]" @@ -1062,7 +1062,7 @@ const char sh_opthist[] = "command. A value of \b-\b for \aeditor\a is equivalent to " "specifying the \b-s\b option.]" "[l?List the commands rather than editing and re-executing them.]" -"[N]#[num?Start at \anum\a commands back.]" +"[N]#[num?Start at \anum\a commands back.]" "[n?Suppress the command numbers when the commands are listed.]" #if SHOPT_HISTEXPAND "[p?Writes the result of history expansion for each operand to standard " @@ -1081,14 +1081,14 @@ const char sh_opthist[] = "the command that gets re-executed. Otherwise, it is one of the " "following:]{" "[+0?Successfully completion of the listing.]" - "[+>0?An error occurred.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bksh\b(1), \bsh\b(1), \bed\b(1)]" ; #endif /* !SHOPT_SCRIPTONLY */ -const char sh_optkill[] = +const char sh_optkill[] = "[-1c?\n@(#)$Id: kill (ksh 93u+m) 2023-09-16 $\n]" "[--catalog?" SH_DICT "]" "[+NAME?kill - terminate or signal process]" @@ -1203,7 +1203,7 @@ const char sh_optprint[] = "[--catalog?" SH_DICT "]" "[+NAME?print - write arguments to standard output]" "[+DESCRIPTION?By default, \bprint\b writes each \astring\a operand to " - "standard output and appends a newline character.]" + "standard output and appends a newline character.]" "[+?Unless the \b-r\b or \b-f\b option is specified, each \b\\\b " "character in each \astring\a operand is processed specially as " "follows:]{" @@ -1226,7 +1226,7 @@ const char sh_optprint[] = "operands than format specifiers, the format string is " "reprocessed from the beginning. If there are fewer \astring\a " "operands than format specifiers, then outputting will end " - "at the first unneeded format specifier.]" + "at the first unneeded format specifier.]" "[e?Unless \b-f\b is specified, process \b\\\b sequences in each \astring\a " "operand as described above. This is the default behavior.]" "[n?Do not append a new-line character to the output.]" @@ -1261,7 +1261,7 @@ const char sh_optprintf[] = "[--catalog?" SH_DICT "]" "[+NAME?printf - write formatted output]" "[+DESCRIPTION?\bprintf\b writes each \astring\a operand to " - "standard output using \aformat\a to control the output format.]" + "standard output using \aformat\a to control the output format.]" #if SHOPT_PRINTF_LEGACY "[+?For backward compatibility with this system's external \bprintf\b(1) " "command, this built-in version allows the \aformat\a operand to " @@ -1472,7 +1472,7 @@ const char sh_optread[] = "the bytes that are read are stored directly into \bvar\b.]" "[+?If you append \b?\b\aprompt\a to the first \avar\a, then \bread\b " "will display \aprompt\a on standard error before reading " - "if standard input is a terminal or pipe. " + "if standard input is a terminal or pipe. " "The \b?\b should be quoted to protect it from pathname expansion.]" "[+?If an end-of file is encountered on a line " "that is not terminated by a newline control character, the data is " @@ -1527,9 +1527,9 @@ const char sh_optreadonly[] = "default.]" "[+?Within a type definition, if the value is not specified, then a " "value must be specified when creating each instance of the type " - "and the value is readonly for each instance.]" + "and the value is readonly for each instance.]" "[+?If no \aname\as are specified then the names and values of all " - "readonly variables are written to standard output.]" + "readonly variables are written to standard output.]" "[+?\breadonly\b is built in to the shell as a declaration command so that " "field splitting and pathname expansion are not performed on " "the arguments. Tilde expansion occurs on \avalue\a.]" @@ -1540,8 +1540,8 @@ const char sh_optreadonly[] = "\n[name[=value]...]\n" "\n" "[+EXIT STATUS?]{" - "[+0?Successful completion.]" - "[+>0?An error occurred.]" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bsh\b(1), \btypeset\b(1)]" @@ -1678,11 +1678,11 @@ const char sh_optksh[] = "\n[arg ...]\n" "\n" "[+EXIT STATUS?If \b\f?\f\b executes commands, the exit status will be that " - "of the last command executed. Otherwise, it will be one of " - "the following:]{" - "[+0?The script or command line to be executed consists entirely " + "of the last command executed. Otherwise, it will be one of " + "the following:]{" + "[+0?The script or command line to be executed consists entirely " "of zero or more blank lines or comments.]" - "[+1-125?A noninteractive shell detected a syntax error, a variable " + "[+1-125?A noninteractive shell detected a syntax error, a variable " "assignment error, or an error in a special built-in.]" "[+126?\b-c\b and \b-s\b were not specified and the command script " "was found on \bPATH\b but was not executable.]" @@ -1726,8 +1726,8 @@ const char sh_optset[] = "\n[arg ...]\n" "\n" "[+EXIT STATUS?]{" - "[+0?No errors occurred.]" - "[+>0?An error occurred.]" + "[+0?No errors occurred.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\btypeset\b(1), \bshift\b(1)]" @@ -1743,7 +1743,7 @@ const char sh_optshift[] = "positional parameters to the left by the number of places " "defined by \an\a, or \b1\b if \an\a is omitted. The number of " "positional parameters remaining will be reduced by the " - "number of places that are shifted.]" + "number of places that are shifted.]" "[+?If \an\a is given, it will be evaluated as an arithmetic expression " "to determine the number of places to shift. It is an error " "to shift more than the number of positional parameters or a " @@ -1752,8 +1752,8 @@ const char sh_optshift[] = "\n[n]\n" "\n" "[+EXIT STATUS?]{" - "[+0?The positional parameters were successfully shifted.]" - "[+>0?An error occurred.]" + "[+0?The positional parameters were successfully shifted.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bset\b(1)]" ; @@ -1831,15 +1831,15 @@ const char sh_opttrap[] = "the shell does not know about causes \btrap\b to exit with a " "non-zero exit status, but does not terminate the invoking shell.]" "[+?If no \aaction\a or \acondition\as are specified then all the current " - "trap settings are written to standard output.]" + "trap settings are written to standard output.]" "[p?Causes the current traps to be output in a format that can be processed " "as input to the shell to recreate the current traps.]" "\n" "\n[action condition ...]\n" "\n" "[+EXIT STATUS?]{" - "[+0?Successful completion.]" - "[+>0?An error occurred.]" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bkill\b(1), \beval\b(1), \bsignal\b(2)]" @@ -1973,8 +1973,8 @@ const char sh_opttypeset[] = " -T [tname[=(type definition)]...]\n" "\n" "[+EXIT STATUS?]{" - "[+0?No errors occurred.]" - "[+>0?An error occurred.]" + "[+0?No errors occurred.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\breadonly\b(1), \bexport\b(1)]" @@ -2073,8 +2073,8 @@ const char sh_optunset[] = "\nname...\n" "\n" "[+EXIT STATUS?]{" - "[+0?All \aname\as were successfully unset.]" - "[+>0?One or more \aname\a operands could not be unset " + "[+0?All \aname\as were successfully unset.]" + "[+>0?One or more \aname\a operands could not be unset " "or an error occurred.]" "}" @@ -2095,8 +2095,8 @@ const char sh_optunalias[] = "\nname...\n" "\n" "[+EXIT STATUS?]{" - "[+0?Successful completion.]" - "[+>0?\b-a\b was not specified and one or more \aname\a operands " + "[+0?Successful completion.]" + "[+>0?\b-a\b was not specified and one or more \aname\a operands " "did not have an alias definition, or an error occurred.]" "}" @@ -2141,7 +2141,7 @@ const char sh_optwhence[] = "is not found, then no output is produced.]" "[+?If \b-v\b is specified, the output will also contain information " "that indicates how the given \aname\a would be interpreted by " - "the shell in the current execution environment.]" + "the shell in the current execution environment.]" "[+?The \btype\b command is equivalent to \bwhence -v\b.]" "[a?Like \b-v\b but displays all uses for each \aname\a rather than the first.]" "[f?Do not check for functions.]" diff --git a/src/cmd/ksh93/data/limits.c b/src/cmd/ksh93/data/limits.c index a55dcd1d9175..6478d697bf13 100644 --- a/src/cmd/ksh93/data/limits.c +++ b/src/cmd/ksh93/data/limits.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-2012 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 * * * @@ -25,7 +25,7 @@ * This command requires getrlimit(), vlimit(), or ulimit() */ -#ifndef _no_ulimit +#ifndef _no_ulimit const char e_unlimited[] = "unlimited"; const char* e_units[] = { 0, "block", "byte", "Kibyte", "second", "microsecond" }; diff --git a/src/cmd/ksh93/data/strdata.c b/src/cmd/ksh93/data/strdata.c index 5f5733c492e2..177e182b74a7 100644 --- a/src/cmd/ksh93/data/strdata.c +++ b/src/cmd/ksh93/data/strdata.c @@ -38,18 +38,18 @@ const unsigned char strval_precedence[35] = /* POW */ 14|NOASSIGN|RASSOC, /* TIMES */ 14, /* PLUSPLUS */ 15|NOASSIGN|NOFLOAT|SEQPOINT, - /* PLUS */ 13, + /* PLUS */ 13, /* COMMA */ 1|NOASSIGN|SEQPOINT, /* MINUSMINUS */ 15|NOASSIGN|NOFLOAT|SEQPOINT, /* MINUS */ 13, /* DIV */ 14, /* LSHIFT */ 12|NOFLOAT, /* LE */ 11|NOASSIGN, - /* LT */ 11|NOASSIGN, + /* LT */ 11|NOASSIGN, /* EQ */ 10|NOASSIGN, /* ASSIGNMENT */ 2|RASSOC, /* COLON */ 0|NOASSIGN, - /* RSHIFT */ 12|NOFLOAT, + /* RSHIFT */ 12|NOFLOAT, /* GE */ 11|NOASSIGN, /* GT */ 11|NOASSIGN, /* QCOLON */ 3|NOASSIGN|SEQPOINT, diff --git a/src/cmd/ksh93/edit/completion.c b/src/cmd/ksh93/edit/completion.c index 63ba57af986c..487278b39e15 100644 --- a/src/cmd/ksh93/edit/completion.c +++ b/src/cmd/ksh93/edit/completion.c @@ -404,7 +404,7 @@ int ed_expand(Edit_t *ep, char outbuff[],int *cur,int *eol,int mode, int count) } } sh_offstate(SH_COMPLETE); - /* allow a search to be aborted */ + /* allow a search to be aborted */ if(sh.trapnote&SH_SIGSET) { rval = -1; @@ -627,7 +627,7 @@ int ed_macro(Edit_t *ep, int i) while(i-- > 0) ed_ungetchar(ep,buff[i]); return 1; - } + } return 0; } #endif /* SHOPT_ESH || SHOPT_VSH */ diff --git a/src/cmd/ksh93/edit/edit.c b/src/cmd/ksh93/edit/edit.c index 07765bd129d3..c06196b541ad 100644 --- a/src/cmd/ksh93/edit/edit.c +++ b/src/cmd/ksh93/edit/edit.c @@ -235,7 +235,7 @@ int tty_raw(int fd, int echomode) nttyparm.c_iflag &= ~(IGNPAR|PARMRK|INLCR|IGNCR|ICRNL); nttyparm.c_iflag |= BRKINT; #else - nttyparm.c_iflag &= + nttyparm.c_iflag &= ~(IGNBRK|PARMRK|INLCR|IGNCR|ICRNL|INPCK); nttyparm.c_iflag |= (BRKINT|IGNPAR); #endif /* u370 */ @@ -755,7 +755,7 @@ int ed_read(void *context, int fd, char *buff, int size, int reedit) * onto the stack so that it can be checked for KEYTRAP * putstack() returns 1 except when in the middle of a multi-byte char */ -static int putstack(Edit_t *ep,char string[], int nbyte, int type) +static int putstack(Edit_t *ep,char string[], int nbyte, int type) { int c; #if SHOPT_MULTIBYTE @@ -990,7 +990,7 @@ Edpos_t ed_curpos(Edit_t *ep,genchar *phys, int off, int cur, Edpos_t curpos) #endif /* SHOPT_MULTIBYTE */ if(cur && off>=cur) { - sp += cur; + sp += cur; off -= cur; pos = curpos; col = pos.col; diff --git a/src/cmd/ksh93/edit/emacs.c b/src/cmd/ksh93/edit/emacs.c index fdde3d7eccb5..c94a7e0fcc67 100644 --- a/src/cmd/ksh93/edit/emacs.c +++ b/src/cmd/ksh93/edit/emacs.c @@ -16,9 +16,9 @@ * K. Eugene Carlson * * * ***********************************************************************/ -/* Original version by Michael T. Veach +/* Original version by Michael T. Veach * Adapted for ksh by David Korn */ -/* EMACS_MODES: c tabstop=4 +/* EMACS_MODES: c tabstop=4 One line screen editor for any program @@ -114,7 +114,7 @@ typedef struct _emacs_ int offset; /* Screen offset */ char ehist; /* hist handling required */ Histloc_t _location; - int prevdirection; + int prevdirection; Edit_t *ed; /* pointer to edit data */ } Emacs_t; @@ -300,7 +300,7 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit) else if (c == usrerase) { c = ERASECHAR ; - } + } else if (c == usrlnext) { c = LNEXTCHAR ; @@ -505,10 +505,10 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit) case cntl(']') : c = ed_getchar(ep->ed,1); if ((count == 0) || (count > eol)) - { - beep(); - continue; - } + { + beep(); + continue; + } if (out[i]) i++; while (i < eol) @@ -605,13 +605,13 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit) search(ep,out,count); goto drawline; case cntl('P') : - if (count <= hloff) - hloff -= count; - else - { - hline -= count - hloff; - hloff = 0; - } + if (count <= hloff) + hloff -= count; + else + { + hline -= count - hloff; + hloff = 0; + } #ifdef ESH_NFIRST if (hline <= hismin) #else @@ -830,7 +830,7 @@ static int escape(Emacs_t* ep,genchar *out,int count) return -1; } } - + case 'b': /* M-b == go backward one word */ case DELETE : case '\b': @@ -857,7 +857,7 @@ static int escape(Emacs_t* ep,genchar *out,int count) return cur-i; } } - + case '>': ed_ungetchar(ep->ed,cntl('N')); #ifdef ESH_NFIRST @@ -876,7 +876,7 @@ static int escape(Emacs_t* ep,genchar *out,int count) hloff = 0; #endif /* ESH_NFIRST */ return 0; - + case '<': ed_ungetchar(ep->ed,cntl('P')); hloff = 0; @@ -1198,21 +1198,21 @@ static int escape(Emacs_t* ep,genchar *out,int count) static void xcommands(Emacs_t *ep,int count) { - int i = ed_getchar(ep->ed,0); + int i = ed_getchar(ep->ed,0); NOT_USED(count); - switch(i) - { - case cntl('X'): /* exchange dot and mark */ - if (ep->mark > eol) - ep->mark = eol; - i = ep->mark; - ep->mark = cur; - cur = i; - draw(ep,UPDATE); - return; + switch(i) + { + case cntl('X'): /* exchange dot and mark */ + if (ep->mark > eol) + ep->mark = eol; + i = ep->mark; + ep->mark = cur; + cur = i; + draw(ep,UPDATE); + return; #ifdef ESH_BETTER - case cntl('E'): /* invoke emacs on current command */ + case cntl('E'): /* invoke emacs on current command */ if(eol>=0 && sh.hist_ptr) { if(blankline(ep,drawbuff)) @@ -1308,9 +1308,9 @@ static void xcommands(Emacs_t *ep,int count) # endif /* debugging code */ #endif /* ESH_BETTER */ - default: - beep(); - return; + default: + beep(); + return; } } @@ -1504,13 +1504,13 @@ static void draw(Emacs_t *ep,Draw_t option) genchar *logcursor; genchar *nscend; /* end of logical screen */ int i; - + nptr = nscreen; sptr = drawbuff; logcursor = sptr + cur; longline = NORMAL; ep->lastdraw = option; - + if (option == FIRST || option == REFRESH) { ep->overflow = NORMAL; @@ -1525,17 +1525,17 @@ static void draw(Emacs_t *ep,Draw_t option) *ep->cursor = '\0'; ed_putstring(ep->ed,Prompt); /* start with prompt */ } - + /********************* Do not update screen if pending characters **********************/ - + if ((lookahead)&&(option != FINAL)) { ep->scvalid = 0; /* Screen is out of date, APPEND will not work */ return; } - + /*************************************** If in append mode, cursor at end of line, screen up to date, the previous character was a 'normal' character, @@ -1547,7 +1547,7 @@ static void draw(Emacs_t *ep,Draw_t option) i = *(logcursor-1); /* last character inserted */ else i = 0; - + if ((option == APPEND)&&(ep->scvalid)&&(*logcursor == '\0')&& print(i)&&((ep->cursor-ep->screen)<(w_size-1))) { @@ -1564,12 +1564,12 @@ static void draw(Emacs_t *ep,Draw_t option) nscend = nptr - 1; if(sptr == logcursor) ncursor = nptr; - + /********************* Does ncursor appear on the screen? If not, adjust the screen offset so it does. **********************/ - + i = ncursor - nscreen; if ((ep->offset && i<=ep->offset)||(i >= (ep->offset+w_size))) { @@ -1578,13 +1578,13 @@ static void draw(Emacs_t *ep,Draw_t option) if (--ep->offset < 0) ep->offset = 0; } - + /********************* Is the range of screen[0] through screen[w_size] up-to-date with nscreen[offset] through nscreen[offset+w_size] ? If not, update as need be. ***********************/ - + nptr = &nscreen[ep->offset]; sptr = ep->screen; i = w_size; @@ -1623,11 +1623,11 @@ static void draw(Emacs_t *ep,Draw_t option) ed_setcursor(ep->ed, ep->screen, ep->ed->e_peol, ep->ed->e_peol, -1); /****************** - - Screen overflow checks - + + Screen overflow checks + ********************/ - + if (nscend >= &nscreen[ep->offset+w_size]) { if (ep->offset > 0) @@ -1640,9 +1640,9 @@ static void draw(Emacs_t *ep,Draw_t option) if (ep->offset > 0) longline = LOWER; } - + /* Update screen overflow indicator if need be */ - + if (longline != ep->overflow) { setcursor(ep,w_size,longline); diff --git a/src/cmd/ksh93/edit/hexpand.c b/src/cmd/ksh93/edit/hexpand.c index a84fa3c678ca..973d3be93174 100644 --- a/src/cmd/ksh93/edit/hexpand.c +++ b/src/cmd/ksh93/edit/hexpand.c @@ -48,7 +48,7 @@ struct subst }; -/* +/* * parse an /old/new/ string, delimiter expected as first char. * if "old" not specified, keep sb->str[0] * if "new" not specified, set sb->str[1] to empty string @@ -194,7 +194,7 @@ int hist_expand(const char *ln, char **xp) while(cp && *cp) { /* read until event/quick substitution/comment designator */ - if((*cp != hc[0] && *cp != hc[1] && *cp != hc[2]) + if((*cp != hc[0] && *cp != hc[1] && *cp != hc[2]) || (*cp == hc[1] && cp != ln)) { if(*cp == '\\' || (cp > ln && cp[-1]=='$' && *cp == '{')) /* skip escaped designators */ @@ -452,7 +452,7 @@ int hist_expand(const char *ln, char **xp) /* open temp buffer, let sfio do the (re)allocation */ tmp = sfopen(NULL, NULL, "swr"); - /* push selected words into buffer, squash + /* push selected words into buffer, squash whitespace into single blank or a newline */ n = i = q = 0; @@ -617,8 +617,8 @@ int hist_expand(const char *ln, char **xp) { c = *cp; *cp = '\0'; - errormsg(SH_DICT, ERROR_ERROR, - "%s%s: no previous substitution", + errormsg(SH_DICT, ERROR_ERROR, + "%s%s: no previous substitution", (flag & HIST_QUICKSUBST) ? ":s" : "", evp); *cp = c; @@ -689,7 +689,7 @@ int hist_expand(const char *ln, char **xp) { flag = flag & ~HIST_NEWLINE; - /* squash white space to either a + /* squash white space to either a blank or a newline */ do flag |= (c == '\n' ? HIST_NEWLINE : 0); diff --git a/src/cmd/ksh93/edit/history.c b/src/cmd/ksh93/edit/history.c index 579d1190a1b8..94cf50536a52 100644 --- a/src/cmd/ksh93/edit/history.c +++ b/src/cmd/ksh93/edit/history.c @@ -57,9 +57,9 @@ #if SHOPT_AUDIT # define _HIST_AUDIT Sfio_t *auditfp; \ char *tty; \ - int auditmask; + int auditmask; #else -# define _HIST_AUDIT +# define _HIST_AUDIT #endif #define _HIST_PRIVATE \ @@ -106,7 +106,7 @@ static History_t *hist_ptr; static int acctfd; static char *logname; # include - + static int acctinit(History_t *hp) { char *cp, *acctfile; @@ -486,44 +486,44 @@ static History_t* hist_trim(History_t *hp, int n) } /* - * position history file at size and find next command number + * position history file at size and find next command number */ static int hist_nearend(History_t *hp, Sfio_t *iop, off_t size) { - unsigned char *cp, *endbuff; - int n, incmd=1; - unsigned char *buff, marker[4]; + unsigned char *cp, *endbuff; + int n, incmd=1; + unsigned char *buff, marker[4]; if(size <= 2L || sfseek(iop,size,SEEK_SET)<0) goto begin; /* skip to marker command and return the number */ /* numbering commands occur after a null and begin with HIST_CMDNO */ - while(cp=buff=(unsigned char*)sfreserve(iop,SFIO_UNBOUND,SFIO_LOCKR)) - { + while(cp=buff=(unsigned char*)sfreserve(iop,SFIO_UNBOUND,SFIO_LOCKR)) + { n = sfvalue(iop); - *(endbuff=cp+n) = 0; - while(1) - { + *(endbuff=cp+n) = 0; + while(1) + { /* check for marker */ - if(!incmd && *cp++==HIST_CMDNO && *cp==0) - { - n = cp+1 - buff; - incmd = -1; - break; - } - incmd = 0; - while(*cp++); - if(cp>endbuff) - { - incmd = 1; - break; - } - if(*cp==0 && ++cp>endbuff) - break; - } - size += n; + if(!incmd && *cp++==HIST_CMDNO && *cp==0) + { + n = cp+1 - buff; + incmd = -1; + break; + } + incmd = 0; + while(*cp++); + if(cp>endbuff) + { + incmd = 1; + break; + } + if(*cp==0 && ++cp>endbuff) + break; + } + size += n; sfread(iop,(char*)buff,n); if(incmd < 0) - { + { if((n=sfread(iop,(char*)marker,4))==4) { n = (marker[0]<<16)|(marker[1]<<8)|marker[2]; @@ -571,7 +571,7 @@ void hist_eof(History_t *hp) } again: sfseek(hp->histfp,count,SEEK_SET); - while(cp=(char*)sfreserve(hp->histfp,SFIO_UNBOUND,0)) + while(cp=(char*)sfreserve(hp->histfp,SFIO_UNBOUND,0)) { n = sfvalue(hp->histfp); *(endbuff = cp+n) = 0; @@ -976,7 +976,7 @@ int hist_copy(char *s1,int size,int command,int line) { if(count++ ==line) break; - else if(line >= 0) + else if(line >= 0) continue; } if(s1 && (line<0 || line==count)) diff --git a/src/cmd/ksh93/edit/vi.c b/src/cmd/ksh93/edit/vi.c index 3a328dd88bf3..31b3b79e80fe 100644 --- a/src/cmd/ksh93/edit/vi.c +++ b/src/cmd/ksh93/edit/vi.c @@ -219,7 +219,7 @@ int ed_viread(void *context, int fd, char *shbuf, int nchar, int reedit) vp->direction = -1; vp->ed = ed; } - + /*** setup prompt ***/ Prompt = prompt; @@ -946,7 +946,7 @@ static void endword(Vi_t *vp, int nwords, int cmd) if( tcur_virt <= last_virt && !isblank(tcur_virt) ) ++tcur_virt; while( tcur_virt <= last_virt && isblank(tcur_virt) ) - ++tcur_virt; + ++tcur_virt; if( cmd == 'E' ) { while( tcur_virt <= last_virt && !isblank(tcur_virt) ) @@ -1190,7 +1190,7 @@ static void getline(Vi_t* vp,int mode) break; case UWERASE: /** delete back word **/ - if( cur_virt > first_virt && + if( cur_virt > first_virt && !isblank(cur_virt) && !ispunct(virtual[cur_virt]) && isblank(cur_virt-1) ) @@ -1590,7 +1590,7 @@ static int mvcursor(Vi_t* vp,int motion) tcur_virt -= incr; break; - case '%': + case '%': { int nextmotion; int nextc; @@ -2231,7 +2231,7 @@ static int textmod(Vi_t *vp,int c, int mode) int savecur; int ch; - if(mode && (fold(vp->lastmotion)=='F' || fold(vp->lastmotion)=='T')) + if(mode && (fold(vp->lastmotion)=='F' || fold(vp->lastmotion)=='T')) vp->lastmotion = ';'; if( fold(c) == 'P' ) @@ -2247,7 +2247,7 @@ static int textmod(Vi_t *vp,int c, int mode) { /***** Input commands *****/ - case '\t': + case '\t': if(vp->ed->e_tabcount!=1) return BAD; c = '='; diff --git a/src/cmd/ksh93/include/argnod.h b/src/cmd/ksh93/include/argnod.h index dfeda66c2847..600dd347e098 100644 --- a/src/cmd/ksh93/include/argnod.h +++ b/src/cmd/ksh93/include/argnod.h @@ -61,7 +61,7 @@ struct slnod /* struct for linked list of stacks */ struct slnod *slchild; Sfio_t *slptr; /* slpad aligns struct functnod = struct slnod + 1 on some architectures */ - struct slnod *slpad; + struct slnod *slpad; }; /* diff --git a/src/cmd/ksh93/include/edit.h b/src/cmd/ksh93/include/edit.h index aa4131347e3c..f54e4ee51c63 100644 --- a/src/cmd/ksh93/include/edit.h +++ b/src/cmd/ksh93/include/edit.h @@ -120,7 +120,7 @@ typedef struct edit #if SHOPT_ESH || SHOPT_VSH int e_multiline; /* allow multiple lines for editing */ #endif - int e_winsz; /* columns in window */ + int e_winsz; /* columns in window */ Edpos_t e_curpos; /* cursor line and column */ Namval_t *e_default; /* variable containing default value */ } Edit_t; diff --git a/src/cmd/ksh93/include/history.h b/src/cmd/ksh93/include/history.h index d70290423701..10a39c9b2800 100644 --- a/src/cmd/ksh93/include/history.h +++ b/src/cmd/ksh93/include/history.h @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1982-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 * * * @@ -26,7 +26,7 @@ #define HIST_CHAR '!' #define HIST_VERSION 1 /* history file format version no. */ -typedef struct +typedef struct { Sfdisc_t histdisc; /* discipline for history */ Sfio_t *histfp; /* history file stream pointer */ diff --git a/src/cmd/ksh93/include/name.h b/src/cmd/ksh93/include/name.h index e1611bdb2782..68a1467a2084 100644 --- a/src/cmd/ksh93/include/name.h +++ b/src/cmd/ksh93/include/name.h @@ -31,7 +31,7 @@ #define ARRAY_MAX (1L< * so that is a legal index. If is 0, an array - * of the required size is allocated. A pointer to the + * of the required size is allocated. A pointer to the * allocated Namarr_t structure is returned. * becomes the current index of the array. */ @@ -965,7 +965,7 @@ Namarr_t *nv_setarray(Namval_t *np, void *(*fun)(Namval_t*,const char*,int)) if(fun && (ap = nv_arrayptr(np))) { /* - * if it's already an indexed array, convert to + * if it's already an indexed array, convert to * associative structure */ if(!is_associative(ap)) @@ -1741,14 +1741,14 @@ void *nv_associative(Namval_t *np,const char *sp,int mode) else if(ap->header.nelem&ARRAY_NOSCOPE) mode = NV_NOSCOPE; if(*sp==0 && sh_isoption(SH_XTRACE) && (mode&NV_ADD)) - errormsg(SH_DICT,ERROR_warn(0),"adding empty subscript"); + errormsg(SH_DICT,ERROR_warn(0),"adding empty subscript"); if(sh.subshell && (mp=nv_search(sp,ap->header.table,0)) && nv_isnull(mp)) ap->cur = mp; if((mp || (mp=nv_search(sp,ap->header.table,mode))) && nv_isnull(mp) && (mode&NV_ADD)) { nv_onattr(mp,type); mp->nvmeta = np; - if((mode&NV_ADD) && nv_type(np)) + if((mode&NV_ADD) && nv_type(np)) nv_arraychild(np,mp,0); if(sh.subshell) sh_assignok(np,1); diff --git a/src/cmd/ksh93/sh/deparse.c b/src/cmd/ksh93/sh/deparse.c index 71a1fcc9618c..f687ec120de4 100644 --- a/src/cmd/ksh93/sh/deparse.c +++ b/src/cmd/ksh93/sh/deparse.c @@ -149,7 +149,7 @@ static void p_tree(const Shnode_t *t,int tflags) begin_line = 1; } break; - + case TIF: p_keyword("if",BEGIN); p_tree(t->if_.iftre,0); @@ -253,7 +253,7 @@ static void p_tree(const Shnode_t *t,int tflags) level--; break; } - + case TPAR: { char indented_block = (begin_line || !level); @@ -295,7 +295,7 @@ static void p_tree(const Shnode_t *t,int tflags) p_tree(t,0); p_keyword("done",END); break; - + case TSW: p_keyword("case",BEGIN|NOTAB); p_arg(t->sw.swarg,' ',0); @@ -334,7 +334,7 @@ static void p_tree(const Shnode_t *t,int tflags) } begin_line = 1; p_keyword("{",BEGIN); - p_tree(t->funct.functtre,0); + p_tree(t->funct.functtre,0); p_keyword("}",END); break; @@ -345,7 +345,7 @@ static void p_tree(const Shnode_t *t,int tflags) if((t->tre.tretyp&TPAREN)==TPAREN) { p_keyword("(",BEGIN|NOTAB); - p_tree(t->lst.lstlef,NO_BRACKET|NO_NEWLINE); + p_tree(t->lst.lstlef,NO_BRACKET|NO_NEWLINE); p_keyword(")",END); } else diff --git a/src/cmd/ksh93/sh/fault.c b/src/cmd/ksh93/sh/fault.c index 4c5b2cbaeb0c..57796703d5e3 100644 --- a/src/cmd/ksh93/sh/fault.c +++ b/src/cmd/ksh93/sh/fault.c @@ -288,7 +288,7 @@ void sh_sigtrap(int sig) else if(!((flag=sh.sigflag[sig])&(SH_SIGFAULT|SH_SIGOFF))) { /* don't set signal if already set or off by parent */ - if((fun=signal(sig,sh_fault))==SIG_IGN) + if((fun=signal(sig,sh_fault))==SIG_IGN) { signal(sig,SIG_IGN); flag |= SH_SIGOFF; @@ -322,7 +322,7 @@ void sh_sigdone(void) /* * Restore to default signals * Free the trap strings if mode is non-zero - * If mode>1 then ignored traps cause signal to be ignored + * If mode>1 then ignored traps cause signal to be ignored * If mode==-1 we're entering a new function scope in sh_funscope() */ void sh_sigreset(int mode) @@ -609,7 +609,7 @@ void sh_exit(int xno) sh.tilde_block = 0; if(job.in_critical) job_unlock(); - if(pp->mode == SH_JMPSCRIPT && !pp->prev) + if(pp->mode == SH_JMPSCRIPT && !pp->prev) sh_done(sig); if(pp->mode) siglongjmp(pp->buff,pp->mode); diff --git a/src/cmd/ksh93/sh/fcin.c b/src/cmd/ksh93/sh/fcin.c index 91d0d6092504..cb18e96ef831 100644 --- a/src/cmd/ksh93/sh/fcin.c +++ b/src/cmd/ksh93/sh/fcin.c @@ -161,5 +161,5 @@ int _fcmbget(short *len) c = mbchar(_Fcin.fcptr); } return c; -} +} #endif /* SHOPT_MULTIBYTE */ diff --git a/src/cmd/ksh93/sh/init.c b/src/cmd/ksh93/sh/init.c index 855a989b98ce..4b2f6f16a66d 100644 --- a/src/cmd/ksh93/sh/init.c +++ b/src/cmd/ksh93/sh/init.c @@ -338,7 +338,7 @@ static void put_history(Namval_t* np,const char *val,int flags,Namfun_t *fp) char *cp; if(val && histopen) { - if(np==HISTFILE && (cp=nv_getval(np)) && strcmp(val,cp)==0) + if(np==HISTFILE && (cp=nv_getval(np)) && strcmp(val,cp)==0) return; if(np==HISTSIZE && sh_arith(val)==nv_getnum(HISTSIZE)) return; @@ -389,7 +389,7 @@ static void put_restricted(Namval_t* np,const char *val,int flags,Namfun_t *fp) errormsg(SH_DICT,ERROR_exit(1),e_restricted,nv_name(np)); UNREACHABLE(); } - if(np==PATHNOD || (path_scoped=(strcmp(name,PATHNOD->nvname)==0))) + if(np==PATHNOD || (path_scoped=(strcmp(name,PATHNOD->nvname)==0))) { /* Clear the hash table */ nv_scan(sh_subtracktree(1),nv_rehash,NULL,NV_TAGGED,NV_TAGGED); @@ -398,7 +398,7 @@ static void put_restricted(Namval_t* np,const char *val,int flags,Namfun_t *fp) } if(val && !(flags&NV_RDONLY) && np->nvalue && strcmp(val,np->nvalue)==0) return; - if(np==FPATHNOD || (fpath_scoped=(strcmp(name,FPATHNOD->nvname)==0))) + if(np==FPATHNOD || (fpath_scoped=(strcmp(name,FPATHNOD->nvname)==0))) sh.pathlist = path_unsetfpath(); nv_putv(np, val, flags, fp); sh.universe = 0; @@ -794,7 +794,7 @@ static char* get_lastarg(Namval_t* np, Namfun_t *fp) { char *cp; int pid; - if(sh_isstate(SH_INIT) && (cp=sh.lastarg) && *cp=='*' && (pid=strtol(cp+1,&cp,10)) && *cp=='*') + if(sh_isstate(SH_INIT) && (cp=sh.lastarg) && *cp=='*' && (pid=strtol(cp+1,&cp,10)) && *cp=='*') nv_putval(np,cp+1,0); return sh.lastarg; } @@ -1042,7 +1042,7 @@ void sh_invalidate_ifs(void) } const Namdisc_t RESTRICTED_disc = { sizeof(Namfun_t), put_restricted }; -static const Namdisc_t CDPATH_disc = { sizeof(Namfun_t), put_cdpath }; +static const Namdisc_t CDPATH_disc = { sizeof(Namfun_t), put_cdpath }; #if SHOPT_VSH || SHOPT_ESH static const Namdisc_t EDITOR_disc = { sizeof(Namfun_t), put_ed }; #endif @@ -1496,7 +1496,7 @@ Shell_t *sh_init(int argc,char *argv[], Shinit_f userinit) sh.jmpbuffer = &sh.checkbase; sh_pushcontext(&sh.checkbase,SH_JMPSCRIPT); sh.st.self = &sh.global; - sh.topscope = (Shscope_t*)sh.st.self; + sh.topscope = (Shscope_t*)sh.st.self; login_files[0] = (char*)e_profile; sh.login_files = login_files; sh.bltindata.version = SH_VERSION; @@ -2076,7 +2076,7 @@ static void put_trans(Namval_t* np,const char *val,int flags,Namfun_t *fp) if(mp->lctype!=lctype) { mp->lctype = lctype; - mp->trans = wctrans(mp->name); + mp->trans = wctrans(mp->name); } if(!mp->trans || (flags&NV_INTEGER)) goto skip; diff --git a/src/cmd/ksh93/sh/io.c b/src/cmd/ksh93/sh/io.c index 9daf29f78507..c58761f385f9 100644 --- a/src/cmd/ksh93/sh/io.c +++ b/src/cmd/ksh93/sh/io.c @@ -116,13 +116,13 @@ static int (*fdnotify)(int,int); struct addrinfo { - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; - socklen_t ai_addrlen; - struct sockaddr* ai_addr; - struct addrinfo* ai_next; + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + socklen_t ai_addrlen; + struct sockaddr* ai_addr; + struct addrinfo* ai_next; }; static int @@ -135,7 +135,7 @@ getaddrinfo(const char* node, const char* service, const struct addrinfo* hint, struct sockaddr_in* ip; char* prot; long n; - + if (!(hp = gethostbyname(node)) || hp->h_addrtype!=AF_INET || hp->h_length>sizeof(struct in_addr)) { errno = EADDRNOTAVAIL; @@ -155,7 +155,7 @@ getaddrinfo(const char* node, const char* service, const struct addrinfo* hint, case SOCK_STREAM: switch (hint->ai_protocol) { - case 0: + case 0: protocol = "tcp"; break; #ifdef IPPROTO_SCTP @@ -367,7 +367,7 @@ static Sfdouble_t nget_cur_eof(Namval_t* np, Namfun_t *fp) return (Sfdouble_t)-1; end =lseek(ep->fd, 0, SEEK_END); lseek(ep->fd, 0, SEEK_CUR); - return (Sfdouble_t)end; + return (Sfdouble_t)end; } static const Namdisc_t EOF_disc = { sizeof(struct Eof), 0, 0, nget_cur_eof}; @@ -670,7 +670,7 @@ int sh_iorenumber(int f1,int f2) sfswap(spnew,sp); sfset(sp,SFIO_SHARE|SFIO_PUBLIC,1); } - else + else { sh.fdstatus[f2] = (sh.fdstatus[f1]&~IOCLEX); if((f2 = sh_fcntl(f1,F_DUPFD, f2)) < 0) @@ -698,7 +698,7 @@ int sh_iorenumber(int f1,int f2) } /* - * close a file descriptor and update stream table and attributes + * close a file descriptor and update stream table and attributes */ int sh_close(int fd) { @@ -1121,7 +1121,7 @@ static char *io_usename(char *name, int *perm, int fno, int mode) */ int sh_redirect(struct ionod *iop, int flag) { - Sfoff_t off; + Sfoff_t off; char *fname; int fd = -1, iof; const char *message = e_open; @@ -1560,7 +1560,7 @@ int sh_redirect(struct ionod *iop, int flag) sh.fdstatus[fd] |= IOCLEX; } } - else + else goto fail; } return indx; @@ -2324,7 +2324,7 @@ struct eval }; /* - * Create a stream consisting of a space separated argv[] list + * Create a stream consisting of a space separated argv[] list */ Sfio_t *sh_sfeval(char *argv[]) { @@ -2454,7 +2454,7 @@ static int subexcept(Sfio_t* sp,int mode, void *data, Sfdisc_t* handle) #define NROW 15 /* number of rows before going to multi-columns */ #define LBLSIZ 3 /* size of label field and interfield spacing */ -/* +/* * print a list of arguments in columns */ void sh_menu(Sfio_t *outfile,int argn,char *argv[]) @@ -2514,7 +2514,7 @@ void sh_menu(Sfio_t *outfile,int argn,char *argv[]) /* * shell version of read() for user added builtins */ -ssize_t sh_read(int fd, void* buff, size_t n) +ssize_t sh_read(int fd, void* buff, size_t n) { Sfio_t *sp; if(sp=sh.sftable[fd]) @@ -2527,7 +2527,7 @@ ssize_t sh_read(int fd, void* buff, size_t n) /* * shell version of write() for user added builtins */ -ssize_t sh_write(int fd, const void* buff, size_t n) +ssize_t sh_write(int fd, const void* buff, size_t n) { Sfio_t *sp; if(sp=sh.sftable[fd]) @@ -2605,7 +2605,7 @@ mode_t sh_umask(mode_t m) /* * give file descriptor and , return an iostream pointer * must be SFIO_READ or SFIO_WRITE - * must be a non-negative number ofr SH_IOCOPROCESS or SH_IOHISTFILE. + * must be a non-negative number ofr SH_IOCOPROCESS or SH_IOHISTFILE. * returns NULL on failure and may set errno. */ Sfio_t *sh_iogetiop(int fd, int mode) @@ -2655,9 +2655,9 @@ typedef int (*Notify_f)(int,int); Notify_f sh_fdnotify(Notify_f notify) { Notify_f old; - old = fdnotify; - fdnotify = notify; - return old; + old = fdnotify; + fdnotify = notify; + return old; } Sfio_t *sh_fd2sfio(int fd) diff --git a/src/cmd/ksh93/sh/jobs.c b/src/cmd/ksh93/sh/jobs.c index 737b43d53ab0..89f23cda3d79 100644 --- a/src/cmd/ksh93/sh/jobs.c +++ b/src/cmd/ksh93/sh/jobs.c @@ -505,11 +505,11 @@ void job_init(int lflag) job.mypgid = getpgrp(); /* some systems have job control, but not initialized */ if(job.mypgid<=0) - { + { /* Get a controlling terminal and set process group */ /* This should have already been done by rlogin */ - int fd; - char *ttynam; + int fd; + char *ttynam; if(job.mypgid<0 || !(ttynam=ttyname(JOBTTY))) return; while(close(JOBTTY)<0 && errno==EINTR) @@ -519,8 +519,8 @@ void job_init(int lflag) if(fd!=JOBTTY) sh_iorenumber(fd,JOBTTY); tcsetpgrp(JOBTTY,sh.pid); - job.mypgid = sh.pid; - } + job.mypgid = sh.pid; + } possible = (setpgid(0,job.mypgid) >= 0) || errno==EPERM; if(possible) { @@ -950,7 +950,7 @@ int job_kill(struct process *pw,int sig) sh_delay(.05,0); } } - while(pw && pw->p_pgrp==0 && (r=kill(pw->p_pid,sig))>=0) + while(pw && pw->p_pgrp==0 && (r=kill(pw->p_pid,sig))>=0) { if(also_send_sigcont(pw,sig)) { @@ -1140,7 +1140,7 @@ int job_post(pid_t pid, pid_t join) pw->p_nxtjob = job.pwlist; pw->p_nxtproc = 0; } - pw->p_exitval = job.exitval; + pw->p_exitval = job.exitval; job.pwlist = pw; pw->p_env = sh.curenv; pw->p_pid = pid; @@ -1554,7 +1554,7 @@ static struct process *job_unpost(struct process *pwtop,int notify) if(!pw) return NULL; #if SHOPT_BGX - if(pw->p_flag&P_BG) + if(pw->p_flag&P_BG) return pw; #endif /* SHOPT_BGX */ for(; pw && (pw->p_flag&P_DONE)&&(notify||!(pw->p_flag&P_NOTIFY)||pw->p_env); pw=pw->p_nxtproc); @@ -1572,7 +1572,7 @@ static struct process *job_unpost(struct process *pwtop,int notify) *pw->p_exitval = pw->p_exit; if(pw->p_flag&P_SIGNALLED) *pw->p_exitval |= SH_EXITSIG; - } + } /* save the exit status for background jobs */ if((pw->p_flag&P_EXITSAVE) || pw->p_pid==sh.spid) { diff --git a/src/cmd/ksh93/sh/lex.c b/src/cmd/ksh93/sh/lex.c index 100763b0c5b0..459fdab268cf 100644 --- a/src/cmd/ksh93/sh/lex.c +++ b/src/cmd/ksh93/sh/lex.c @@ -62,8 +62,8 @@ local_iswblank(wchar_t wc) #define pushlevel(lp,c,s) ((lp->lexd.level>=lex_max?stack_grow():1) &&\ ((lex_match[lp->lexd.level++]=lp->lexd.lastc),\ lp->lexd.lastc=(((s)<lexd.lastc>>CHAR_BIT) -#define endchar(lp) (lp->lexd.lastc&0xff) +#define oldmode(lp) (lp->lexd.lastc>>CHAR_BIT) +#define endchar(lp) (lp->lexd.lastc&0xff) #define setchar(lp,c) (lp->lexd.lastc = ((lp->lexd.lastc&~0xff)|(c))) #define poplevel(lp) (lp->lexd.lastc=lex_match[--lp->lexd.level]) @@ -197,7 +197,7 @@ static int lexfill(Lex_t *lp) } /* - * mode=1 for reinitialization + * mode=1 for reinitialization */ Lex_t *sh_lexopen(Lex_t *lp, int mode) { @@ -222,7 +222,7 @@ extern int lextoken(Lex_t*); int sh_lex(Lex_t *lp) { int flag; - char *quoted, *macro, *split, *expand; + char *quoted, *macro, *split, *expand; int tok = lextoken(lp); quoted = macro = split = expand = ""; if(tok==0 && (flag=lp->arg->argflag)) @@ -630,7 +630,7 @@ int sh_lex(Lex_t* lp) if(mode==ST_DOL) goto err; #ifndef STR_MAXIMAL - else if(mode==ST_NESTED && lp->lexd.warn && + else if(mode==ST_NESTED && lp->lexd.warn && endchar(lp)==RBRACE && sh_lexstates[ST_DOL][n]==S_DIG ) @@ -1142,7 +1142,7 @@ int sh_lex(Lex_t* lp) if(varnamefirst && !varnamelength && fcpeek(-LEN - 1)!='.') varnamelength = fcseek(0) - LEN - varnamefirst; /* check for possible subscript */ - if((n=endchar(lp))==RBRACT || n==RPAREN || + if((n=endchar(lp))==RBRACT || n==RPAREN || (mode==ST_BRACE) || (oldmode(lp)==ST_NONE) || (mode==ST_NAME && (lp->assignok||lp->lexd.level))) @@ -1278,7 +1278,7 @@ int sh_lex(Lex_t* lp) if(!lp->lex.intest && (c=='<' || c=='>') && isadigit(n)) { c = sh_lex(lp); - lp->digits = (n-'0'); + lp->digits = (n-'0'); return c; } if(n==LBRACT) @@ -1432,8 +1432,8 @@ int sh_lex(Lex_t* lp) lp->lex.incase = TEST_RE; lp->lex.testop2 = 0; lp->digits = c; - lp->token = TESTBINOP; - return lp->token; + lp->token = TESTBINOP; + return lp->token; } /* FALLTHROUGH */ case TEST_OR: case TEST_AND: @@ -1463,7 +1463,7 @@ int sh_lex(Lex_t* lp) c = 0; if(!lp->lex.skipword) { - if(n>1 && lp->lex.reservok==1 && mode==ST_NAME && + if(n>1 && lp->lex.reservok==1 && mode==ST_NAME && (c=sh_lookup(state,shtab_reserved))) { if(lp->lex.incase) @@ -1936,7 +1936,7 @@ static int here_copy(Lex_t *lp,struct ionod *iop) nsave = n = 0; while(1) { - if(!(c=fcget())) + if(!(c=fcget())) { if(!lp->lexd.dolparen && (c=cp-bufp)) { diff --git a/src/cmd/ksh93/sh/macro.c b/src/cmd/ksh93/sh/macro.c index 68108a23e8d6..64db600d55db 100644 --- a/src/cmd/ksh93/sh/macro.c +++ b/src/cmd/ksh93/sh/macro.c @@ -146,8 +146,8 @@ char *sh_mactry(char *string) /* * Perform parameter expansion, command substitution, and arithmetic - * expansion on . - * If greater than 1 file expansion is performed if the result + * expansion on . + * If greater than 1 file expansion is performed if the result * yields a single pathname. * If negative, then expansion rules for assignment are applied. */ @@ -248,7 +248,7 @@ int sh_macexpand(struct argnod *argp, struct argnod **arghead,int flag) endfield(mp,mp->quoted|mp->atmode); flags = mp->fields; if(flags==1 && nv_getoptimize()) - argp->argchn.ap = *arghead; + argp->argchn.ap = *arghead; } nv_setoptimize(saveoptimize); *mp = savemac; @@ -423,7 +423,7 @@ char *sh_macpat(struct argnod *arg, int flags) } /* - * Process the characters up to or end of input string + * Process the characters up to or end of input string */ static void copyto(Mac_t *mp,int endch, int newquote) { @@ -547,7 +547,7 @@ static void copyto(Mac_t *mp,int endch, int newquote) break; } /* followed by file expansion */ - if(!mp->lit && (n==S_ESC || (!mp->quote && + if(!mp->lit && (n==S_ESC || (!mp->quote && (n==S_PAT||n==S_ENDCH||n==S_SLASH||n==S_BRACT||*cp=='-')))) { cp += (n!=S_EOF); @@ -2240,7 +2240,7 @@ static void comsubst(Mac_t *mp,Shnode_t* t, int type) struct checkpt buff; struct ionod *ip=0; sh_pushcontext(&buff,SH_JMPIO); - if((ip=t->tre.treio) && + if((ip=t->tre.treio) && ((ip->iofile&IOLSEEK) || !(ip->iofile&IOUFD)) && (r=sigsetjmp(buff.buff,0))==0) fd = sh_redirect(ip,3); @@ -2290,7 +2290,7 @@ static void comsubst(Mac_t *mp,Shnode_t* t, int type) sh_offstate(SH_INTERACTIVE); if((foff = sfseek(sp,0,SEEK_END)) > 0) { - size_t soff = stktell(stkp); + size_t soff = stktell(stkp); sfseek(sp,0,SEEK_SET); stkseek(stkp,soff+foff+64); stkseek(stkp,soff); @@ -2887,7 +2887,7 @@ static noreturn void mac_error(void) * Given pattern/string, replace / with 0 and return pointer to string * \ characters are stripped from string. The \ are stripped in the * replacement string unless followed by a digit or \. - */ + */ static char *mac_getstring(char *pattern) { char *cp = pattern, *rep = NULL, *dp = NULL; diff --git a/src/cmd/ksh93/sh/main.c b/src/cmd/ksh93/sh/main.c index 66cb36498318..0ff34d19ee8f 100644 --- a/src/cmd/ksh93/sh/main.c +++ b/src/cmd/ksh93/sh/main.c @@ -351,7 +351,7 @@ int sh_main(int ac, char *av[], Shinit_f userinit) /* * iop is not null when the input is a string - * fdin is the input file descriptor + * fdin is the input file descriptor */ static void exfile(Sfio_t *iop,int fno) { @@ -655,7 +655,7 @@ static void chkmail(char *files) && statb.st_atime <= statb.st_mtime) { /* check for directory */ - if(!arglist && S_ISDIR(statb.st_mode)) + if(!arglist && S_ISDIR(statb.st_mode)) { /* generate list of directory entries */ path_complete(cp,"/*",&arglist); diff --git a/src/cmd/ksh93/sh/name.c b/src/cmd/ksh93/sh/name.c index 904304a92fe4..8a2816aeda70 100644 --- a/src/cmd/ksh93/sh/name.c +++ b/src/cmd/ksh93/sh/name.c @@ -1037,7 +1037,7 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp) #endif /* SHOPT_FIXEDARRAY */ if(!np) { - if(!nq && *sp=='[' && *cp==0 && cp[-1]==']') + if(!nq && *sp=='[' && *cp==0 && cp[-1]==']') { /* * for backward compatibility @@ -1097,7 +1097,7 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp) || (n&ARRAY_FILL) || (( #if SHOPT_FIXEDARRAY - ap || + ap || #endif (flags&NV_ASSIGN)) && (flags&NV_ARRAY))) { @@ -1412,7 +1412,7 @@ Namval_t *nv_open(const char *name, Dt_t *root, int flags) (c>=0x200 || !(c=sh_lexstates[ST_NORM][c]) || c==S_EPAT || c==S_COLON)); if(c= *--cp) *cp = 0; - np = nv_search(name, root, (flags&NV_NOADD)?0:NV_ADD); + np = nv_search(name, root, (flags&NV_NOADD)?0:NV_ADD); if(c) *cp = c; goto skip; @@ -1534,7 +1534,7 @@ Namval_t *nv_open(const char *name, Dt_t *root, int flags) if(sh_isoption(SH_XTRACE) && nv_isarray(np)) #endif /* SHOPT_FIXEDARRAY */ sub = nv_getsub(np); - c = msg==e_aliname? 0: (append | (flags&NV_EXPORT)); + c = msg==e_aliname? 0: (append | (flags&NV_EXPORT)); if(isref) nv_offattr(np,NV_REF); if(!append && (flags&NV_UNATTR)) @@ -1653,7 +1653,7 @@ void nv_putval(Namval_t *np, const char *string, int flags) nv_local=0; if(flags&(NV_NOREF|NV_NOFREE)) { - if(np->nvalue && np->nvalue!=sp && !nv_isattr(np,NV_NOFREE)) + if(np->nvalue && np->nvalue!=sp && !nv_isattr(np,NV_NOFREE)) free(np->nvalue); np->nvalue = (void*)sp; nv_setattr(np,(flags&~NV_RDONLY)|NV_NOFREE); @@ -1815,7 +1815,7 @@ void nv_putval(Namval_t *np, const char *string, int flags) int32_t ol=0; if(!*vpp) *vpp = new_of(int32_t,0); - else if(flags&NV_APPEND) + else if(flags&NV_APPEND) ol = *(int32_t*)*vpp; *(int32_t*)*vpp = l + ol; } @@ -2042,18 +2042,18 @@ static void rightjust(char *str, int size, int fill) if (n == size) return; if(n > size) - { - *(str+n) = 0; - for (sp = str, cp = str+n-size; sp <= str+size; *sp++ = *cp++); - return; - } + { + *(str+n) = 0; + for (sp = str, cp = str+n-size; sp <= str+size; *sp++ = *cp++); + return; + } else *(sp = str+size) = 0; - if (n == 0) - { - while (sp > str) - *--sp = ' '; - return; - } + if (n == 0) + { + while (sp > str) + *--sp = ' '; + return; + } while(n--) { sp--; @@ -2690,11 +2690,11 @@ char *nv_getval(Namval_t *np) else ll = *(uint32_t*)*vpp; } - else if(nv_isattr(np,NV_LONG)) + else if(nv_isattr(np,NV_LONG)) ll = *(Sflong_t*)*vpp; - else if(nv_isattr(np,NV_SHORT)) + else if(nv_isattr(np,NV_SHORT)) ll = *(int16_t*)*vpp; - else + else ll = *(uint32_t*)*vpp; base = nv_size(np); if(base==10) @@ -2705,7 +2705,7 @@ char *nv_getval(Namval_t *np) } done: /* - * if NV_RAW flag is on, return pointer to binary data + * if NV_RAW flag is on, return pointer to binary data * otherwise, base64 encode the data and return this string */ if(*vpp && nv_isattr(np,NV_BINARY) && !nv_isattr(np,NV_RAW)) @@ -2713,7 +2713,7 @@ char *nv_getval(Namval_t *np) char *cp; char *ep; int size= nv_size(np), insize=(4*size)/3+size/45+8; - base64encode(*vpp, size, NULL, cp=getbuf(insize), insize, (void**)&ep); + base64encode(*vpp, size, NULL, cp=getbuf(insize), insize, (void**)&ep); *ep = 0; return cp; } @@ -2820,14 +2820,14 @@ void nv_newattr (Namval_t *np, unsigned newatts, int size) if(((n^newatts)&NV_EXPORT)) /* EXPORT attribute has been toggled */ { /* record changes to the environment */ - if(n&NV_EXPORT) + if(n&NV_EXPORT) { /* EXPORT exists on old attributes therefore not on new */ nv_offattr(np,NV_EXPORT); env_change(); } else - { + { /* EXPORT is now turned on for new attributes */ nv_onattr(np,NV_EXPORT); env_change(); @@ -2955,7 +2955,7 @@ static char *oldgetenv(const char *string) c1= '='; while(cp = *av++) { - if(cp[0]!=c0 || cp[1]!=c1) + if(cp[0]!=c0 || cp[1]!=c1) continue; sp = string; while(*sp && *sp++ == *++cp); @@ -3242,7 +3242,7 @@ int nv_rename(Namval_t *np, int flags) } /* - * Create a reference node from to $np in dictionary + * Create a reference node from to $np in dictionary */ void nv_setref(Namval_t *np, Dt_t *hp, int flags) { @@ -3282,7 +3282,7 @@ void nv_setref(Namval_t *np, Dt_t *hp, int flags) hp = sh.last_root; else hp = hp?(openmatch?openmatch:sh.var_base):sh.var_tree; - if(nr==np) + if(nr==np) { if(sh.namespace && nv_dict(sh.namespace)==hp) { diff --git a/src/cmd/ksh93/sh/nvdisc.c b/src/cmd/ksh93/sh/nvdisc.c index a8590f8cf7bb..aabcdb3e8bbe 100644 --- a/src/cmd/ksh93/sh/nvdisc.c +++ b/src/cmd/ksh93/sh/nvdisc.c @@ -246,7 +246,7 @@ static void assign(Namval_t *np,const char* val,int flags,Namfun_t *handle) void *saveval = np->nvalue; Namval_t *tp, *nr; /* for 'typeset -T' types */ int jmpval = 0; - if(val && (tp=nv_type(np)) && (nr=nv_open(val,sh.var_tree,NV_VARNAME|NV_ARRAY|NV_NOADD|NV_NOFAIL)) && tp==nv_type(nr)) + if(val && (tp=nv_type(np)) && (nr=nv_open(val,sh.var_tree,NV_VARNAME|NV_ARRAY|NV_NOADD|NV_NOFAIL)) && tp==nv_type(nr)) { char *sub = nv_getsub(np); _nv_unset(np,0); @@ -702,7 +702,7 @@ int nv_adddisc(Namval_t *np, const char **names, Namval_t **funs) else while(n>=0) vp->bltins[n--] = 0; vp->fun.disc = &Nv_bdisc; - vp->bnames = names; + vp->bnames = names; nv_stack(np,&vp->fun); return 1; } @@ -1027,7 +1027,7 @@ Namval_t *nv_search(const char *name, Dt_t *root, int mode) * If var!=0, the variable pointer is returned and the built-in name is put onto the stack at the current offset. * Otherwise, a pointer to the built-in (variable or type) is returned and var contains the pointer to the variable. * If last==0 and first component of name is a reference, nv_bfsearch() will return NULL. - */ + */ Namval_t *nv_bfsearch(const char *name, Dt_t *root, Namval_t **var, char **last) { int c,offset = stktell(sh.stk); @@ -1037,7 +1037,7 @@ Namval_t *nv_bfsearch(const char *name, Dt_t *root, Namval_t **var, char **last) if(var) *var = 0; /* check for . in the name before = */ - for(sp=(char*)name+1; *sp; sp++) + for(sp=(char*)name+1; *sp; sp++) { if(*sp=='=') return NULL; @@ -1056,13 +1056,13 @@ Namval_t *nv_bfsearch(const char *name, Dt_t *root, Namval_t **var, char **last) cp = sp; } else if(*sp=='.') - cp = sp; + cp = sp; } if(!cp) return var ? nv_search(name,root,0) : NULL; sfputr(sh.stk,name,0); dname = cp+1; - cp = stkptr(sh.stk,offset) + (cp-name); + cp = stkptr(sh.stk,offset) + (cp-name); if(last) *last = cp; c = *cp; @@ -1307,13 +1307,13 @@ static char *get_table(Namval_t *np, Namfun_t *fp) static Sfio_t *out; int first=1; Dt_t *base = dtview(root,0); - if(out) - sfseek(out,0,SEEK_SET); - else - out = sfnew(NULL,NULL,-1,-1,SFIO_WRITE|SFIO_STRING); + if(out) + sfseek(out,0,SEEK_SET); + else + out = sfnew(NULL,NULL,-1,-1,SFIO_WRITE|SFIO_STRING); for(np=(Namval_t*)dtfirst(root);np;np=(Namval_t*)dtnext(root,np)) { - if(!nv_isnull(np) || np->nvfun || nv_isattr(np,~NV_NOFREE)) + if(!nv_isnull(np) || np->nvfun || nv_isattr(np,~NV_NOFREE)) { if(!first) sfputc(out,' '); @@ -1330,15 +1330,15 @@ static char *get_table(Namval_t *np, Namfun_t *fp) static const Namdisc_t table_disc = { - sizeof(struct table), - put_table, - get_table, - 0, - 0, - create_table, - clone_table, - 0, - next_table, + sizeof(struct table), + put_table, + get_table, + 0, + 0, + create_table, + clone_table, + 0, + next_table, }; Namval_t *nv_parent(Namval_t *np) diff --git a/src/cmd/ksh93/sh/nvtree.c b/src/cmd/ksh93/sh/nvtree.c index a098371d30da..7935d4746011 100644 --- a/src/cmd/ksh93/sh/nvtree.c +++ b/src/cmd/ksh93/sh/nvtree.c @@ -130,7 +130,7 @@ static Namfun_t *nextdisc(Namval_t *np) Namfun_t *fp; if(nv_isref(np)) return NULL; - for(fp=np->nvfun;fp;fp=fp->next) + for(fp=np->nvfun;fp;fp=fp->next) { if(fp && fp->disc && fp->disc->nextf) return fp; @@ -297,7 +297,7 @@ char *nv_dirnext(void *dir) else root = (Dt_t*)np; /* check for recursive walk */ - for(save=dp; save; save=save->prev) + for(save=dp; save; save=save->prev) { if(save->root==root) break; @@ -346,7 +346,7 @@ static void outtype(Namval_t *np, Namfun_t *fp, Sfio_t* out, const char *prefix) { char *type=0; Namval_t *tp = fp->type; - if(!tp && fp->disc && fp->disc->typef) + if(!tp && fp->disc && fp->disc->typef) tp = (*fp->disc->typef)(np,fp); for(fp=fp->next;fp;fp=fp->next) { @@ -380,7 +380,7 @@ void nv_attribute(Namval_t *np,Sfio_t *out,char *prefix,int noname) char *cp; unsigned val,mask,attr; char *ip=0; - Namfun_t *fp=0; + Namfun_t *fp=0; Namval_t *typep=0; #if SHOPT_FIXEDARRAY int fixed=0; @@ -762,7 +762,7 @@ static void outval(char *name, const char *vname, struct Walk *wp) #endif } nv_outname(wp->out,name,-1); - if((np->nvalue && np->nvalue!=Empty) || nv_isattr(np,~(NV_MINIMAL|NV_NOFREE)) || nv_isvtree(np)) + if((np->nvalue && np->nvalue!=Empty) || nv_isattr(np,~(NV_MINIMAL|NV_NOFREE)) || nv_isvtree(np)) sfputc(wp->out,(isarray==2?(wp->indent>=0?'\n':';'):'=')); if(isarray==2) return; @@ -945,7 +945,7 @@ static char *walk_tree(Namval_t *np, Namval_t *xp, int flags) Sfoff_t off = 0; int len, savtop = stktell(sh.stk); void *savptr = stkfreeze(sh.stk,0); - struct argnod *ap=0; + struct argnod *ap=0; struct argnod *arglist=0; char *name,*cp, **argv; char *subscript=0; @@ -1010,7 +1010,7 @@ static char *walk_tree(Namval_t *np, Namval_t *xp, int flags) sfputr(sh.stk,cp,-1); ap = stkfreeze(sh.stk,1); ap->argflag = ARG_RAW; - ap->argchn.ap = arglist; + ap->argchn.ap = arglist; n++; arglist = ap; } diff --git a/src/cmd/ksh93/sh/nvtype.c b/src/cmd/ksh93/sh/nvtype.c index 025ef8e22289..4587e6029e68 100644 --- a/src/cmd/ksh93/sh/nvtype.c +++ b/src/cmd/ksh93/sh/nvtype.c @@ -35,7 +35,7 @@ static const char sh_opttype[] = "the variable \aname\a is set to \avalue\a before the variable " "is converted to \b\f?\f\b.]" "[+?If no \aname\as are specified then the names and values of all " - "variables of this type are written to standard output.]" + "variables of this type are written to standard output.]" "[+?\b\f?\f\b is built in to the shell as a declaration command so that " "field splitting and pathname expansion are not performed on " "the arguments. Tilde expansion occurs on \avalue\a.]" @@ -46,7 +46,7 @@ static const char sh_opttype[] = "specified, each subscript is interpreted as a value of enumeration " "type \atype\a.]" "[A?Associative array. Each \aname\a is converted to an associative " - "array of type \b\f?\f\b. If a variable already exists, the current " + "array of type \b\f?\f\b. If a variable already exists, the current " "value will become subscript \b0\b.]" "[h]:[string?Used within a type definition to provide a help string " "for variable \aname\a. Otherwise, it is ignored.]" @@ -60,8 +60,8 @@ static const char sh_opttype[] = "\n[name[=value]...]\n" "\n" "[+EXIT STATUS?]{" - "[+0?Successful completion.]" - "[+>0?An error occurred.]" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\fother\f \breadonly\b(1), \btypeset\b(1)]" @@ -361,7 +361,7 @@ static Namfun_t *clone_type(Namval_t* np, Namval_t *mp, int flags, Namfun_t *fp) } if(flags&NV_TYPE) return nv_clone_disc(fp,flags); - if(size==0 && (!fp->disc || (size=fp->disc->dsize)==0)) + if(size==0 && (!fp->disc || (size=fp->disc->dsize)==0)) size = sizeof(Namfun_t); dp = (Namtype_t*)sh_malloc(size+pp->nref*sizeof(struct Namref)); if(pp->nref) @@ -523,7 +523,7 @@ static Namval_t *create_type(Namval_t *np,const char *name,int flag,Namfun_t *fp static void put_type(Namval_t* np, const char* val, int flag, Namfun_t* fp) { Namval_t *nq; - if(val && (nq=nv_open(val,sh.var_tree,NV_VARNAME|NV_ARRAY|NV_NOADD|NV_NOFAIL))) + if(val && (nq=nv_open(val,sh.var_tree,NV_VARNAME|NV_ARRAY|NV_NOADD|NV_NOFAIL))) { Namfun_t *pp; if((pp=nv_hasdisc(nq,fp->disc)) && pp->type==fp->type) @@ -638,7 +638,7 @@ static int typeinfo(Opt_t* op, Sfio_t *out, const char *str, Optdisc_t *fp) { if(nv_isattr(bp->bltins[i],NV_OPTGET)) sfprintf(out,"\b%s.%s\b(3), ",np->nvname,bp->bnames[i]); - } + } } return 0; } @@ -719,7 +719,7 @@ static int std_disc(Namval_t *mp, Namtype_t *pp) pp->cp = mp; return 0; } - for(argv=nv_discnames; sp=*argv; argv++) + for(argv=nv_discnames; sp=*argv; argv++) { if(strcmp(cp,sp)==0) { @@ -772,7 +772,7 @@ void nv_addtype(Namval_t *np, const char *optstr, Optdisc_t *op, size_t optsz) if(name=strrchr(np->nvname,'.')) name++; else - name = np->nvname; + name = np->nvname; #if SHOPT_NAMESPACE if(bp=(Namval_t*)sh.namespace) { @@ -1177,7 +1177,7 @@ Namval_t *nv_mkinttype(char *name, size_t size, int sign, const char *help, Namd int offset=stktell(sh.stk); sfputr(sh.stk,NV_CLASS,'.'); sfputr(sh.stk,name,0); - mp = nv_open(stkptr(sh.stk,offset), sh.var_tree, NV_VARNAME); + mp = nv_open(stkptr(sh.stk,offset), sh.var_tree, NV_VARNAME); stkseek(sh.stk,offset); offset = size + sizeof(Namdisc_t); fp = sh_newof(NULL, Namfun_t, 1, offset); diff --git a/src/cmd/ksh93/sh/parse.c b/src/cmd/ksh93/sh/parse.c index 93f4cbc30b68..fa8e8fdf3cb1 100644 --- a/src/cmd/ksh93/sh/parse.c +++ b/src/cmd/ksh93/sh/parse.c @@ -415,7 +415,7 @@ void *sh_parse(Sfio_t *iop, int flag) if(fcfile()) { char *cp = fcfirst(); - if( cp[0]==CNTL('k') && cp[1]==CNTL('s') && cp[2]==CNTL('h') && cp[3]==0) + if( cp[0]==CNTL('k') && cp[1]==CNTL('s') && cp[2]==CNTL('h') && cp[3]==0) { int version; fcseek(4); @@ -1718,7 +1718,7 @@ static struct ionod *inout(Lex_t *lexp,struct ionod *lastio,int flag) iop->iodelim = 0; if(token=sh_lex(lexp)) { - if(token==RPAREN && (iof&IOLSEEK) && lexp->comsub) + if(token==RPAREN && (iof&IOLSEEK) && lexp->comsub) { lexp->arg = stkalloc(sh.stk,sizeof(struct argnod)+3); strcpy(lexp->arg->argval,"CUR"); @@ -1911,8 +1911,8 @@ static void ere_match(void) if(!(base=fcfile())) base = sfopen(NULL,fcseek(0),"s"); fcclose(); - sfstack(base,iop); - fcfopen(base); + sfstack(base,iop); + fcfopen(base); } static Shnode_t *test_primary(Lex_t *lexp) diff --git a/src/cmd/ksh93/sh/path.c b/src/cmd/ksh93/sh/path.c index 737f089b90b2..4d8ef4591972 100644 --- a/src/cmd/ksh93/sh/path.c +++ b/src/cmd/ksh93/sh/path.c @@ -126,7 +126,7 @@ static pid_t command_xargs(const char *path, char *argv[],char *const envp[], in /* subtract lengths of leading and trailing static arguments */ for(av=argv; (cp= *av) && av< &argv[sh.xargmin]; av++) size -= strlen(cp) + 1 + arg_extra; - for(av=avlast; cp= *av; av++,nlast++) + for(av=avlast; cp= *av; av++,nlast++) size -= strlen(cp) + 1 + arg_extra; size -= 2 + 2 * arg_extra; /* final null env and arg elements */ if(size < 2048) @@ -273,7 +273,7 @@ void path_delete(Pathcomp_t *first) } else old = pp; - pp = ppnext; + pp = ppnext; } } @@ -1025,7 +1025,7 @@ noreturn void path_exec(const char *arg0,char *argv[],struct argnod *local) pid_t path_spawn(const char *opath,char **argv, char **envp, Pathcomp_t *libpath, int spawn) { char *path; - char **xp=0, *xval, *libenv = (libpath?libpath->lib:0); + char **xp=0, *xval, *libenv = (libpath?libpath->lib:0); Namval_t* np; char *s, *v; int r, n, pidsize=0; @@ -1486,7 +1486,7 @@ static Pathcomp_t *path_addcomp(Pathcomp_t *first, Pathcomp_t *old,const char *n /* * This function checks for the .paths file in directory in - * it assumes that the directory is on the stack at + * it assumes that the directory is on the stack at */ static int checkdotpaths(Pathcomp_t *first, Pathcomp_t* old,Pathcomp_t *pp, int offset) { diff --git a/src/cmd/ksh93/sh/shcomp.c b/src/cmd/ksh93/sh/shcomp.c index ef36d5d60c9a..1e5ca9555689 100644 --- a/src/cmd/ksh93/sh/shcomp.c +++ b/src/cmd/ksh93/sh/shcomp.c @@ -61,9 +61,9 @@ static const char usage[] = "\n[infile [outfile]]\n" "\n" "[+EXIT STATUS?]{" - "[+0?Successful completion.]" - "[+>0?An error occurred.]" -"}" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" +"}" "[+SEE ALSO?\bksh\b(1)]" ; @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) #endif sh.inlineno = 1; #if SHOPT_BRACEPAT - sh_onoption(SH_BRACEEXPAND); + sh_onoption(SH_BRACEEXPAND); #endif error_info.id = script_id; while(1) diff --git a/src/cmd/ksh93/sh/streval.c b/src/cmd/ksh93/sh/streval.c index 60b1fd186aff..9b8e70ba0d13 100644 --- a/src/cmd/ksh93/sh/streval.c +++ b/src/cmd/ksh93/sh/streval.c @@ -60,8 +60,8 @@ struct vars /* vars stacked per invocation */ { - const char *expr; /* current expression */ - const char *nextchr; /* next char in current expression */ + const char *expr; /* current expression */ + const char *nextchr; /* next char in current expression */ const char *errchr; /* next char after error */ const char *errstr; /* error string */ struct lval errmsg; /* error message text */ @@ -122,7 +122,7 @@ static int _seterror(struct vars *vp,const char *msg) static void arith_error(const char *message,const char *expr, int mode) { mode = (mode&3)!=0; - errormsg(SH_DICT,ERROR_exit(mode),message,expr); + errormsg(SH_DICT,ERROR_exit(mode),message,expr); } #if _ast_no_um2fm @@ -285,9 +285,9 @@ Sfdouble_t arith_exec(Arith_t *ep) node.isenum = 1; node.enum_p = 0; num = (*ep->fun)(&ptr,&node,ASSIGN,num); - if(lastval && node.enum_p) + if(lastval && node.enum_p) { - Sfdouble_t r; + Sfdouble_t r; node.flag = 0; node.value = lastval; r = (*ep->fun)(&ptr,&node,VALUE,num); @@ -560,7 +560,7 @@ static int gettok(struct vars *vp) } } -/* +/* * evaluate a subexpression with precedence */ static int expr(struct vars *vp,int precedence) @@ -904,7 +904,7 @@ Arith_t *arith_compile(const char *string,char **last,Sfdouble_t(*fun)(const cha cur.errmsg.emode = emode; stkseek(sh.stk,sizeof(Arith_t)); if(!expr(&cur,0) && cur.errmsg.value) - { + { if(cur.errstr) string = cur.errstr; if((*fun)( &string , &cur.errmsg, MESSAGE, 0) < 0) @@ -934,7 +934,7 @@ Arith_t *arith_compile(const char *string,char **last,Sfdouble_t(*fun)(const cha * evaluate an arithmetic expression in s * * (Sfdouble_t)(*convert)(char** end, struct lval* string, int type, Sfdouble_t value) - * is a user supplied conversion routine that is called when unknown + * is a user supplied conversion routine that is called when unknown * chars are encountered. * *end points to the part to be converted and must be adjusted by convert to * point to the next non-converted character; if typ is MESSAGE then string diff --git a/src/cmd/ksh93/sh/string.c b/src/cmd/ksh93/sh/string.c index 435845692256..4a3dd692707a 100644 --- a/src/cmd/ksh93/sh/string.c +++ b/src/cmd/ksh93/sh/string.c @@ -671,7 +671,7 @@ int sh_strchr(const char *string, const char *dp) wchar_t c, d; cp = string; mbinit(); - d = mbchar(dp); + d = mbchar(dp); mbinit(); while(c = mbchar(cp)) { diff --git a/src/cmd/ksh93/sh/subshell.c b/src/cmd/ksh93/sh/subshell.c index 0a72eca372a2..25929df25943 100644 --- a/src/cmd/ksh93/sh/subshell.c +++ b/src/cmd/ksh93/sh/subshell.c @@ -307,7 +307,7 @@ void sh_assignok(Namval_t *np,int add) } lp->dict = dp; mp = (Namval_t*)&lp->dict; - lp->next = subshell_data->svar; + lp->next = subshell_data->svar; subshell_data->svar = lp; save = sh.subshell; sh.subshell = 0; @@ -500,7 +500,7 @@ Sfio_t *sh_subshell(Shnode_t *t, volatile int flags, int comsub) subshell_data = sp; sp->options = sh.options; sp->jobs = job_subsave(); - /* make sure initialization has occurred */ + /* make sure initialization has occurred */ if(!sh.pathlist) { sh.pathinit = 1; @@ -527,7 +527,7 @@ Sfio_t *sh_subshell(Shnode_t *t, volatile int flags, int comsub) char *save_debugtrap = 0; #if _lib_fchdir sp->pwdfd = -1; - for(xp=sp->prev; xp; xp=xp->prev) + for(xp=sp->prev; xp; xp=xp->prev) { if(xp->pwdfd>0 && xp->pwd && strcmp(xp->pwd,sh.pwd)==0) { diff --git a/src/cmd/ksh93/sh/timers.c b/src/cmd/ksh93/sh/timers.c index 0e294384b1c4..dec628307c79 100644 --- a/src/cmd/ksh93/sh/timers.c +++ b/src/cmd/ksh93/sh/timers.c @@ -177,8 +177,8 @@ static void oldalrm(void *handle) free(handle); (*fn)(SIGALRM); } - -void *sh_timeradd(unsigned long msec,int flags,void (*action)(void*),void *handle) + +void *sh_timeradd(unsigned long msec,int flags,void (*action)(void*),void *handle) { Timer_t *tp; double t; diff --git a/src/cmd/ksh93/sh/trestore.c b/src/cmd/ksh93/sh/trestore.c index cf395762e969..fbaf437bdbe1 100644 --- a/src/cmd/ksh93/sh/trestore.c +++ b/src/cmd/ksh93/sh/trestore.c @@ -52,7 +52,7 @@ Shnode_t *sh_trestore(Sfio_t *in) */ static Shnode_t *r_tree(void) { - long l = sfgetl(infile); + long l = sfgetl(infile); int type; Shnode_t *t=0; if(l<0) diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c index a987d63c240c..7cfebbf14607 100644 --- a/src/cmd/ksh93/sh/xec.c +++ b/src/cmd/ksh93/sh/xec.c @@ -799,7 +799,7 @@ static Namval_t *enter_namespace(Namval_t *nsp) } if(!nsp && !onsp) return 0; - if(onsp == nsp) + if(onsp == nsp) return nsp; if(onsp) { @@ -1405,7 +1405,7 @@ int sh_exec(const Shnode_t *t, int flags) #if SHOPT_NAMESPACE if(*np->nvname=='.') { - char *cp = strchr(np->nvname+1,'.'); + char *cp = strchr(np->nvname+1,'.'); if(cp) { *cp = 0; @@ -2521,7 +2521,7 @@ int sh_exec(const Shnode_t *t, int flags) struct Ufunction *rp = np->nvalue; static Dtdisc_t _Rpdisc = { - offsetof(struct Ufunction,fname), -1, sizeof(struct Ufunction) + offsetof(struct Ufunction,fname), -1, sizeof(struct Ufunction) }; struct functnod *fp; struct comnod *ac = t->funct.functargs; @@ -2644,7 +2644,7 @@ int sh_exec(const Shnode_t *t, int flags) if(traceon) sfwrite(sfstderr,e_tstend,4); } - sh.exitval = ((!n)^negate); + sh.exitval = ((!n)^negate); if(!skipexitset) exitset(); break; @@ -2756,7 +2756,7 @@ int sh_trace(char *argv[], int nl) char *argv0 = *argv; nl = (nl?'\n':-1); /* don't quote [ and [[ */ - if(*(cp=argv[0])=='[' && (!cp[1] || !cp[2]&&cp[1]=='[')) + if(*(cp=argv[0])=='[' && (!cp[1] || !cp[2]&&cp[1]=='[')) { sfputr(sfstderr,cp,*++argv?' ':nl); bracket = 1; @@ -2962,14 +2962,14 @@ Sfdouble_t sh_mathfun(void *fp, int nargs, Sfdouble_t *arg) int i; np = (Namval_t*)fp; funenv.node = np; - funenv.nref = nref; + funenv.nref = nref; funenv.env = NULL; memcpy(&node,SH_VALNOD,sizeof(node)); SH_VALNOD->nvfun = NULL; SH_VALNOD->nvmeta = NULL; SH_VALNOD->nvflag = NV_LDOUBLE|NV_NOFREE; SH_VALNOD->nvalue = NULL; - for(i=0; i < nargs; i++) + for(i=0; i < nargs; i++) { *nr++ = mp = nv_namptr(sh.mathnodes,i); mp->nvalue = arg++; @@ -3297,7 +3297,7 @@ int sh_fun(Namval_t *np, Namval_t *nq, char *argv[]) } /* - * set up pipe for cooperating process + * set up pipe for cooperating process */ static void coproc_init(int pipes[]) { @@ -3313,7 +3313,7 @@ static void coproc_init(int pipes[]) /* first co-process */ sh_pclose(sh.cpipe); sh_pipe(sh.cpipe); - if((outfd=sh.cpipe[1]) < 10) + if((outfd=sh.cpipe[1]) < 10) { int fd=sh_fcntl(sh.cpipe[1],F_DUPFD,10); if(fd>=10) @@ -3386,7 +3386,7 @@ static pid_t sh_ntfork(const Shnode_t *t,char *argv[],int *jobid,int topfd) sh.invoc_local++; sh_scope(t->com.comset,0); } - if(!strchr(path=argv[0],'/')) + if(!strchr(path=argv[0],'/')) { Namval_t *np; if(np = path_gettrackedalias(path)) @@ -3467,7 +3467,7 @@ static pid_t sh_ntfork(const Shnode_t *t,char *argv[],int *jobid,int topfd) argv[0] = argv[-1]; } fail: - if(jobfork && spawnpid<0) + if(jobfork && spawnpid<0) job_fork(-2); if(spawnpid == -1) { diff --git a/src/cmd/ksh93/tests/arrays.sh b/src/cmd/ksh93/tests/arrays.sh index 824ba34602ea..5f8028ec97f8 100755 --- a/src/cmd/ksh93/tests/arrays.sh +++ b/src/cmd/ksh93/tests/arrays.sh @@ -607,7 +607,7 @@ x=$( "(expected $(printf %q "$exp"), got $(printf %q "$x"))" # test for cloning a very large indexed array - can core dump -( +( trap 'x=$?;exit $(( $x!=0 ))' EXIT $SHELL <<- \EOF ( diff --git a/src/cmd/ksh93/tests/arrays2.sh b/src/cmd/ksh93/tests/arrays2.sh index 26c35aa405aa..5f1f47dc2b01 100755 --- a/src/cmd/ksh93/tests/arrays2.sh +++ b/src/cmd/ksh93/tests/arrays2.sh @@ -195,7 +195,7 @@ function test_short_integer [[ "${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 - + return 0 } # run tests diff --git a/src/cmd/ksh93/tests/comvario.sh b/src/cmd/ksh93/tests/comvario.sh index 8e3e7315407e..d3baa0bdfd25 100755 --- a/src/cmd/ksh93/tests/comvario.sh +++ b/src/cmd/ksh93/tests/comvario.sh @@ -45,9 +45,9 @@ function count_brackets [[ "$c" == '(' ]] && (( bracketstat.bopen++ )) [[ "$c" == ')' ]] && (( bracketstat.bclose++ )) done - + (( bracketstat.bopen != bracketstat.bclose )) && return 1 - + return 0 } @@ -56,7 +56,7 @@ function cpvcat1 { set -o errexit compound tmp - + while read -C tmp ; do printf '%B\n' tmp ; done return 0 } @@ -66,7 +66,7 @@ function cpvcat2 { set -o errexit compound tmp - + while read -C tmp ; do printf '%#B\n' tmp ; done return 0 } @@ -76,7 +76,7 @@ function cpvcat3 { set -o errexit compound tmp - + while read -C tmp ; do print -C tmp ; done return 0 } @@ -86,7 +86,7 @@ function cpvcat4 { set -o errexit compound tmp - + while read -C tmp ; do print -v tmp ; done return 0 } @@ -211,7 +211,7 @@ s=${ read s read -C y2 } - + print "x${s}x" } || err_exit "test returned exit code $?" @@ -342,7 +342,7 @@ function test6 compound out=( typeset stdout stderr ; integer res ) compound val integer testid - + compound -r -a tests=( # subtests1: ( cmd='compound v=( integer -A ar=( [aa]=4 [bb]=9 ) ; ) ; print -C v' stdoutpattern=$'~(Alr)(.*\\[bb\\]=9.*)&(.*\\[aa\\]=4.*)' arrefname='ar' ) @@ -394,7 +394,7 @@ function test6 (( 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}" (( ar[aa] == 4 )) || err_exit "${testname}: Expected ar[aa] == 4, got ${ar[aa]}" @@ -424,7 +424,7 @@ function test_3D_array_read_C [[ "${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}")" done - + return 0 } @@ -444,7 +444,7 @@ function test_access_2Darray_in_type_in_compound [[ "${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}")" done - + return 0 } @@ -454,11 +454,11 @@ function test_read_type_crash typeset -r test=' typeset -T field_t=( typeset -a f - + function reset { integer i j - + for (( i=0 ; i < 3 ; i++ )) ; do for (( j=0 ; j < 3 ; j++ )) ; do _.f[i][j]="" @@ -466,11 +466,11 @@ typeset -T field_t=( done return 0 } - + function enumerate_empty_fields { integer i j - + for (( i=0 ; i < 3 ; i++ )) ; do for (( j=0 ; j < 3 ; j++ )) ; do [[ "${_.f[i][j]}" == "" ]] && printf "[%d][%d]\n" i j @@ -478,7 +478,7 @@ typeset -T field_t=( done return 0 } - + function setf { _.f[$1][$2]="$3" @@ -536,15 +536,15 @@ function test_read_C_into_array typeset cmd typeset pat integer i - + compound -a test_variants # build list of variations of the tests above for (( i=0 ; i < ${#tests[@]} ; i++ )) ; do nameref tst=tests[i] - + # plain test - cmd="${tst.cmd}" + cmd="${tst.cmd}" test_variants+=( testname="${0}/${i}/plain" cmd="$cmd" typeset -a stdoutpattern=( "${tst.stdoutpattern[@]}" ) ) # test with "read -C" in a function @@ -622,13 +622,13 @@ function test_read_C_special_shell_keywords typeset testname typeset shkeyword compound out=( typeset stdout stderr ; integer res ) - + for (( tcpi=0 ; tcpi < ${#testcmdpatterns[@]} ; tcpi++ )) ; do for (( spwi=0 ; spwi < ${#shell_special_words[@]} ; spwi++ )) ; do shkeyword=${shell_special_words[spwi]} testcmd="${testcmdpatterns[tcpi]//%keyword%/${shkeyword}}" testname="${0}/${tcpi}/${spwi}/" - + 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}")" diff --git a/src/cmd/ksh93/tests/coprocess.sh b/src/cmd/ksh93/tests/coprocess.sh index db8306fe3a09..643dbdaedbb5 100755 --- a/src/cmd/ksh93/tests/coprocess.sh +++ b/src/cmd/ksh93/tests/coprocess.sh @@ -51,13 +51,13 @@ do [[ $line == 'hello again' ]] || err_exit "$cat coprocess after moving fds fails" exec 5<&- 6<&- wait $! - + ping three |& exec 3>&p ping four |& exec 4>&p ping pipe |& - + integer count for i in three four pipe four pipe four three pipe pipe three pipe do case $i in @@ -68,7 +68,7 @@ do (( count++ )) print $to $i $count done - + while ((count > 0)) do (( count-- )) read -p @@ -84,7 +84,7 @@ do esac done kill $(jobs -p) 2>/dev/null - + file=$tmp/regress $cat > $file <<-! $cat |& @@ -96,7 +96,7 @@ do exec 5<&p 6>&p exec 5<&- 6>&- kill $(jobs -p) 2>/dev/null - + ${SHELL-ksh} |& cop=$! exp=Done @@ -116,7 +116,7 @@ do else err_exit "$cat coprocess hung after 'exec 5<&p 6>&p; exec 5<&- 6>&-'" fi wait - + { echo line1 | grep 'line2' echo line2 | grep 'line1' @@ -129,13 +129,13 @@ do then err_exit "$cat coprocess read -p hanging (SECONDS=$SECONDS count=$count)" fi wait $! - + ( sleep 3 |& sleep .1 && kill $!; sleep .5; sleep 3 |& sleep .1 && kill $! ) || err_exit "$cat coprocess cleanup not working correctly" { : |& } 2>/dev/null || err_exit "subshell $cat coprocess lingers in parent" wait $! - + unset N r e integer N=5 e=12345 @@ -150,7 +150,7 @@ do print ) 2>/dev/null | read -t 1 r [[ $r == $e ]] || err_exit "$cat coprocess timing bug -- expected $e, got '$r'" - + r= ( integer i @@ -163,7 +163,7 @@ do print $r ) 2>/dev/null | read -t 1 r [[ $r == $e ]] || err_exit "$cat coprocess command substitution bug -- expected $e, got '$r'" - + ( $cat |& sleep 0.01 @@ -198,7 +198,7 @@ do break fi done - + trap 'sleep_pid=; kill $pid; err_exit "$cat coprocess 1 hung"' TERM { sleep 5; kill $$; } & sleep_pid=$! @@ -212,7 +212,7 @@ do wait $pid trap - TERM [[ $sleep_pid ]] && kill $sleep_pid - + trap 'sleep_pid=; kill $pid; err_exit "$cat coprocess 2 hung"' TERM { sleep 5; kill $$; } & sleep_pid=$! @@ -228,7 +228,7 @@ do wait $pid 2> /dev/null trap - TERM [[ $sleep_pid ]] && kill $sleep_pid - + trap 'sleep_pid=; kill $pid; err_exit "$cat coprocess 3 hung"' TERM { sleep 5; kill $$; } & sleep_pid=$! diff --git a/src/cmd/ksh93/tests/libcmd.sh b/src/cmd/ksh93/tests/libcmd.sh index fbfb33650726..238dd82a6bc4 100755 --- a/src/cmd/ksh93/tests/libcmd.sh +++ b/src/cmd/ksh93/tests/libcmd.sh @@ -465,8 +465,8 @@ if builtin cat 2> /dev/null; then cat > "$tmp/sample_file" <<-EOF foo bar - - + + baz EOF print \\033x > "$tmp/file_with_control_character" diff --git a/src/cmd/ksh93/tests/math.sh b/src/cmd/ksh93/tests/math.sh index 99b9fb14d79f..c2f1ab6ab82a 100755 --- a/src/cmd/ksh93/tests/math.sh +++ b/src/cmd/ksh93/tests/math.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 # # # @@ -93,9 +93,9 @@ function test_arithmetic_expression_access_array_element_through_nameref 'in_associative_compound_array_nameref' \ ; do nameref tst=tests[i] - + cmd="${tst.cmd//@@TYPE@@/${ty}}" - + case "${mode}" in 'plain') cmd="${cmd//@@VAR@@/z}" @@ -136,7 +136,7 @@ function test_arithmetic_expression_access_array_element_through_nameref err_exit "Unexpected mode ${mode}" ;; esac - + testname="${0}/${cmd}" ((xtrace)) && set +x out.stderr="${ { out.stdout="${ ${SHELL} -o nounset -o errexit -c "${cmd}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }" @@ -148,7 +148,7 @@ function test_arithmetic_expression_access_array_element_through_nameref done done done - + return 0 } @@ -158,7 +158,7 @@ function test_has_iszero typeset str integer i - + typeset -r -a tests=( '(( iszero(0) )) && print "OK"' '(( iszero(0.) )) && print "OK"' @@ -171,7 +171,7 @@ function test_has_iszero 'float n=1. ; (( iszero(n-1.) )) && print "OK"' 'float n=-1. ; (( iszero(n+1.) )) && print "OK"' ) - + for (( i=0 ; i < ${#tests[@]} ; i++ )) ; do str="$( ${SHELL} -o errexit -c "${tests[i]}" 2>&1 )" || err_exit "test $i: returned non-zero exit code $?" [[ "${str}" == 'OK' ]] || err_exit "test $i: expected 'OK', got '${str}'" diff --git a/src/cmd/ksh93/tests/nameref.sh b/src/cmd/ksh93/tests/nameref.sh index dd901977a3d7..c15523ff5635 100755 --- a/src/cmd/ksh93/tests/nameref.sh +++ b/src/cmd/ksh93/tests/nameref.sh @@ -517,7 +517,7 @@ function add_file_to_tree node.elements[/]=(filepath=foobar) } function main -{ +{ compound filetree add_file_to_tree filetree } diff --git a/src/cmd/ksh93/tests/readcsv.sh b/src/cmd/ksh93/tests/readcsv.sh index 1ef83ff1404e..17d0c5ea7be9 100755 --- a/src/cmd/ksh93/tests/readcsv.sh +++ b/src/cmd/ksh93/tests/readcsv.sh @@ -2,7 +2,7 @@ # # # This software is part of the ast package # # Copyright (c) 1982-2012 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 # # # @@ -17,7 +17,7 @@ ######################################################################## . "${SHTESTS_COMMON:-${0%/*}/_common}" - + tmp1=$tmp/tmp1.csv tmp2=$tmp/tmp2.csv cat > $tmp1 <<- \EOF diff --git a/src/cmd/ksh93/tests/statics.sh b/src/cmd/ksh93/tests/statics.sh index c88f5d5b056c..e68d69fc7095 100755 --- a/src/cmd/ksh93/tests/statics.sh +++ b/src/cmd/ksh93/tests/statics.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 # # # @@ -34,9 +34,9 @@ function testfunc typeset cmd="$2" typeset expected_output="$3" typeset output - + output="$($SHELL -c "${cmd}" 2>&1 )" - + [[ "${output}" == "${expected_output}" ]] || err_exit ${line_number} "${output} != ${expected_output}" } @@ -48,7 +48,7 @@ function test1 testfunc ${LINENO} 'function l { typeset -S x=">" ; x+="#" ; $1 && print "$x" ; } ; l false ; l false ; l true' ">###" testfunc ${LINENO} 'function l { typeset -S x=">" ; x+="#" ; $1 && print "$x" ; } ; l false ; (l false) ; l true' ">##" testfunc ${LINENO} 'function l { typeset -S x=">" ; x+="#" ; $1 && print "$x" ; } ; l false; ( ulimit -c 0 ; l false) ; l true' ">##" - + # integer # (normal) testfunc ${LINENO} '(function l { integer -S x ; x+=1 ; $1 && print "$x" ; } ; l false ; l false ; l true )' "3" @@ -59,7 +59,7 @@ function test1 # (short) testfunc ${LINENO} '(function l { typeset -S -s -i x ; x+=1 ; $1 && print "$x" ; } ; l false ; l false ; l true )' "3" testfunc ${LINENO} '(function l { typeset -S -s -i x ; x+=1 ; $1 && print "$x" ; } ; l false ; (l false) ; l true )' "2" - + # float testfunc ${LINENO} '(function l { float -S x=0.5 ; (( x+=.5 )) ; $1 && print "$x" ; } ; l false ; l false ; l true )' "2" testfunc ${LINENO} '(function l { float -S x=0.5 ; (( x+=.5 )) ; $1 && print "$x" ; } ; l false ; (l false) ; l true )' "1.5" @@ -72,7 +72,7 @@ function test2 { compound out=( typeset stdout stderr ; integer res ) integer i - + test_t -r -a tests=( ( name='compound' @@ -83,9 +83,9 @@ function test2 integer a=1 integer b=2 ) - + (( s.a++, s.b++ )) - + $1 && printf "a=%d, b=%d\n" s.a s.b } (l false ; l false ; l true ; printf ";") @@ -100,7 +100,7 @@ function test2 { nameref sn=$2 (( sn.a++, sn.b++ )) - + $1 && printf "a=%d, b=%d\n" sn.a sn.b } function l @@ -120,7 +120,7 @@ function test2 typeset -T ab_t=( integer a=1 integer b=2 - + function increment { (( _.a++, _.b++ )) @@ -129,9 +129,9 @@ function test2 function l { ab_t -S s - + s.increment - + $1 && printf "a=%d, b=%d\n" s.a s.b } (l false ; l false ; l true ; printf ";") @@ -146,7 +146,7 @@ function test2 typeset -T ab_t=( integer a=1 integer b=2 - + function increment { (( _.a++, _.b++ )) @@ -157,13 +157,13 @@ function test2 nameref sn=$2 sn.increment - + $1 && printf "a=%d, b=%d\n" sn.a sn.b } function l { ab_t -S s - l_n $1 s + l_n $1 s } (l false ; l false ; l true ; printf ";") (l false ; l false ; l true ; printf ";") @@ -177,9 +177,9 @@ function test2 function ar { typeset -a -S s=( "hello" ) - + s+=( "an element" ) - + $1 && { printf "%s" "${s[@]}" ; printf "\n" ; } } (ar false ; ar false ; ar true ; printf ";") @@ -195,7 +195,7 @@ function test2 { nameref sn=$2 sn+=( "an element" ) - + $1 && { printf "%s" "${sn[@]}" ; printf "\n" ; } } function ar @@ -215,9 +215,9 @@ function test2 function ar { typeset -A -S s=( [0]="hello" ) - + s[$(( ${#s[@]} + 1))]="an element" - + $1 && { printf "%s" "${s[@]}" ; printf "\n" ; } } (ar false ; ar false ; ar true ; printf ";") @@ -232,15 +232,15 @@ function test2 function ar_n { nameref sn=$2 - + sn[$(( ${#sn[@]} + 1))]="an element" - + $1 && { printf "%s" "${sn[@]}" ; printf "\n" ; } } function ar { typeset -A -S s=( [0]="hello" ) - ar_n $1 s + ar_n $1 s } (ar false ; ar false ; ar true ; printf ";") (ar false ; ar false ; ar true ; printf ";") @@ -260,7 +260,7 @@ function test2 ) ) - (( s[5].a++, s[5].b++ )) + (( s[5].a++, s[5].b++ )) $1 && printf "a=%d, b=%d\n" s[5].a s[5].b } (ar false ; ar false ; ar true ; printf ";") @@ -276,7 +276,7 @@ function test2 { nameref sn=$2 - (( sn.a++, sn.b++ )) + (( sn.a++, sn.b++ )) $1 && printf "a=%d, b=%d\n" sn.a sn.b } function ar @@ -308,7 +308,7 @@ function test2 ) ) - (( s[8][5].a++, s[8][5].b++ )) + (( s[8][5].a++, s[8][5].b++ )) $1 && printf "a=%d, b=%d\n" s[8][5].a s[8][5].b } (ar false ; ar false ; ar true ; printf ";") @@ -324,7 +324,7 @@ function test2 { nameref sn=$2 - (( sn.a++, sn.b++ )) + (( sn.a++, sn.b++ )) $1 && printf "a=%d, b=%d\n" sn.a sn.b } function ar @@ -355,7 +355,7 @@ function test2 ) ) - (( s[8][5][0][9].a++, s[8][5][0][9].b++ )) + (( s[8][5][0][9].a++, s[8][5][0][9].b++ )) $1 && printf "a=%d, b=%d\n" s[8][5][0][9].a s[8][5][0][9].b } (ar false ; ar false ; ar true ; printf ";") @@ -371,7 +371,7 @@ function test2 { nameref sn=$2 - (( sn.a++, sn.b++ )) + (( sn.a++, sn.b++ )) $1 && printf "a=%d, b=%d\n" sn.a sn.b } function ar @@ -403,7 +403,7 @@ function test2 ) ) - (( s[5].a++, s[5].b++ )) + (( s[5].a++, s[5].b++ )) $1 && printf "a=%d, b=%d\n" s[5].a s[5].b } (ar false ; ar false ; ar true ; printf ";") @@ -419,7 +419,7 @@ function test2 { nameref sn=$2 - (( sn.a++, sn.b++ )) + (( sn.a++, sn.b++ )) $1 && printf "a=%d, b=%d\n" sn.a sn.b } function ar @@ -445,7 +445,7 @@ function test2 typeset -T ab_t=( integer a=1 integer b=2 - + function increment { (( _.a++, _.b++ )) @@ -472,7 +472,7 @@ function test2 typeset -T ab_t=( integer a=1 integer b=2 - + function increment { (( _.a++, _.b++ )) @@ -505,7 +505,7 @@ function test2 typeset -T ab_t=( integer a=1 integer b=2 - + function increment { (( _.a++, _.b++ )) @@ -532,7 +532,7 @@ function test2 typeset -T ab_t=( integer a=1 integer b=2 - + function increment { (( _.a++, _.b++ )) @@ -565,7 +565,7 @@ function test2 typeset -T ab_t=( integer a=1 integer b=2 - + function increment { (( _.a++, _.b++ )) @@ -592,7 +592,7 @@ function test2 typeset -T ab_t=( integer a=1 integer b=2 - + function increment { (( _.a++, _.b++ )) @@ -620,7 +620,7 @@ function test2 ) ) - + for (( i=0 ; i < ${#tests[@]} ; i++ )) ; do nameref currtest=tests[i] diff --git a/src/lib/libast/aso/aso-sem.c b/src/lib/libast/aso/aso-sem.c index 07d3dd81b40e..ac6d5478b4c9 100644 --- a/src/lib/libast/aso/aso-sem.c +++ b/src/lib/libast/aso/aso-sem.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 * * * @@ -99,7 +99,7 @@ aso_init_semaphore(void* data, const char* details) } key = (!path || !*path || streq(path, "private")) ? IPC_PRIVATE : (strsum(path, 0) & 0x7fff); for (;;) - { + { if ((id = semget(key, size, IPC_CREAT|IPC_EXCL|perm)) >= 0) { /* @@ -111,7 +111,7 @@ aso_init_semaphore(void* data, const char* details) sem.sem_flg = 0; for (sem.sem_num = 0; sem.sem_num < size; sem.sem_num++) if (semop(id, &sem, 1) < 0) - { + { (void)semctl(id, 0, IPC_RMID); return NULL; } @@ -122,7 +122,7 @@ aso_init_semaphore(void* data, const char* details) else if (errno != EEXIST) return NULL; else if ((id = semget(key, size, perm)) >= 0) - { + { struct semid_ds ds; Semun_t arg; unsigned int k; @@ -133,7 +133,7 @@ aso_init_semaphore(void* data, const char* details) arg.ds = &ds; for (k = 0; k < SPIN; ASOLOOP(k)) - { + { if (semctl(id, size-1, IPC_STAT, arg) < 0) return NULL; if (ds.sem_otime) diff --git a/src/lib/libast/cdt/cdtlib.h b/src/lib/libast/cdt/cdtlib.h index 5cbef65baeba..a92246ae9f96 100644 --- a/src/lib/libast/cdt/cdtlib.h +++ b/src/lib/libast/cdt/cdtlib.h @@ -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 * * * @@ -90,7 +90,7 @@ typedef struct _dtlib_s ** or as the position in the parent table. */ #define _left lh.__left -#define _hash lh.__hash +#define _hash lh.__hash #define _ppos lh.__hash #define _rght rh.__rght diff --git a/src/lib/libast/cdt/dthash.c b/src/lib/libast/cdt/dthash.c index 930f2c2901cb..b6a7525ea25c 100644 --- a/src/lib/libast/cdt/dthash.c +++ b/src/lib/libast/cdt/dthash.c @@ -32,7 +32,7 @@ /* internal data structure for hash table with chaining */ typedef struct _dthash_s { Dtdata_t data; - int type; + int type; Dtlink_t* here; /* fingered object */ Dtlink_t** htbl; /* hash table slots */ ssize_t tblz; /* size of hash table */ @@ -294,7 +294,7 @@ static void* dthashchain(Dt_t* dt, void* obj, int type) obj = _DTOBJ(disc,lnk); key = _DTKEY(disc,obj); } - else + else { lnk = NULL; if((type&DT_MATCH) ) { key = obj; @@ -319,7 +319,7 @@ static void* dthashchain(Dt_t* dt, void* obj, int type) else break; } } - if(l) /* found an object, use it */ + if(l) /* found an object, use it */ { pp = p; ll = l; } if(ll) /* found object */ diff --git a/src/lib/libast/cdt/dtmethod.c b/src/lib/libast/cdt/dtmethod.c index cbdfce4c2e26..22fca65e7f83 100644 --- a/src/lib/libast/cdt/dtmethod.c +++ b/src/lib/libast/cdt/dtmethod.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 @@ Dtmethod_t* dtmethod(Dt_t* dt, Dtmethod_t* meth) newdt = NULL; else newdt = dt->data; - /* see what need to be done to data of the old method */ + /* see what need to be done to data of the old method */ if(dt->searchf == meth->searchf) dt->searchf = oldmt->searchf; dt->meth = oldmt; @@ -65,7 +65,7 @@ Dtmethod_t* dtmethod(Dt_t* dt, Dtmethod_t* meth) return oldmt; } else /* switch failed, restore dictionary to previous states */ - { dtrestore(dt, list); + { dtrestore(dt, list); return NULL; } } diff --git a/src/lib/libast/cdt/dttree.c b/src/lib/libast/cdt/dttree.c index 92f82f7307b5..a6a9f6d080be 100644 --- a/src/lib/libast/cdt/dttree.c +++ b/src/lib/libast/cdt/dttree.c @@ -55,7 +55,7 @@ int dttreeprint(Dt_t* dt, Dtlink_t* here, int lev, char* (*objprintf)(void*) ) *endb++ = '<'; if(here->_left) - obj = (*objprintf)(_DTOBJ(disc,here->_left)); + obj = (*objprintf)(_DTOBJ(disc,here->_left)); else obj = "NIL"; k = strlen(obj); memcpy(endb, obj, k); endb += k; *endb++ = '>'; @@ -63,7 +63,7 @@ int dttreeprint(Dt_t* dt, Dtlink_t* here, int lev, char* (*objprintf)(void*) ) *endb++ = '<'; if(here->_rght) - obj = (*objprintf)(_DTOBJ(disc,here->_rght)); + obj = (*objprintf)(_DTOBJ(disc,here->_rght)); else obj = "NIL"; k = strlen(obj); memcpy(endb, obj, k); endb += k; *endb++ = '>'; @@ -315,7 +315,7 @@ static Dtlink_t* troot(Dt_t* dt, Dtlink_t* list, Dtlink_t* link, void* obj, int o = _DTOBJ(disc,t); k = _DTKEY(disc,o); if(_DTCMP(dt, key, k, disc) != 0 ) { link->_left = t; /* no more of this group in subtree */ - break; + break; } else if((type & (DT_REMOVE|DT_NEXT|DT_PREV)) && o == obj) { link->_left = t->_rght; /* found the exact object */ @@ -338,7 +338,7 @@ static Dtlink_t* troot(Dt_t* dt, Dtlink_t* list, Dtlink_t* link, void* obj, int } if(list) /* add the rest of the equal-list to the proper subtree */ - { if(type&DT_NEXT) + { if(type&DT_NEXT) { last->_left = link->_rght; link->_rght = list; } @@ -478,7 +478,7 @@ static void* dttree(Dt_t* dt, void* obj, int type) root->_rght = NULL; link._rght = root; dt_next: - if((root = link._left) ) + if((root = link._left) ) { while((t = root->_left) ) RROTATE(root,t); link._left = root->_rght; @@ -512,7 +512,7 @@ static void* dttree(Dt_t* dt, void* obj, int type) else { root->_left = link._rght; root->_rght = link._left; - tree->root = root; + tree->root = root; DTRETURN(obj, NULL); } } @@ -552,7 +552,7 @@ static void* dttree(Dt_t* dt, void* obj, int type) } else /* no matching object, tree has been split to LEFT&RIGHT subtrees */ { if(type&(DT_SEARCH|DT_MATCH)) - { no_root: + { no_root: if(!(l = link._rght) ) /* no LEFT subtree */ tree->root = link._left; /* tree is RIGHT tree */ else @@ -622,8 +622,8 @@ static int treeevent(Dt_t* dt, int event, void* arg) if(tree->root) (void)tclear(dt); (void)(*dt->memoryf)(dt, tree, 0, dt->disc); - dt->data = NULL; - return 0; + dt->data = NULL; + return 0; } else if(event == DT_OPTIMIZE) /* balance the search tree */ { toptimize(dt); diff --git a/src/lib/libast/cdt/dtview.c b/src/lib/libast/cdt/dtview.c index 854fa52ccc54..e086e2cd8161 100644 --- a/src/lib/libast/cdt/dtview.c +++ b/src/lib/libast/cdt/dtview.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 * * * @@ -94,7 +94,7 @@ static void* dtvsearch(Dt_t* dt, void* obj, int type) for(d = dt->walk, obj = (*d->meth->searchf)(d, obj, type);; ) { while(obj) /* keep moving until finding an uncovered object */ { for(p = dt; ; p = p->view) - { if(p == d) /* adjacent object is uncovered */ + { if(p == d) /* adjacent object is uncovered */ return obj; if((*(p->meth->searchf))(p, obj, DT_SEARCH) ) break; diff --git a/src/lib/libast/comp/conf.sh b/src/lib/libast/comp/conf.sh index f1ab6b66bd99..46c14cdfbf0e 100644 --- a/src/lib/libast/comp/conf.sh +++ b/src/lib/libast/comp/conf.sh @@ -1088,7 +1088,7 @@ do eval name=\"'$'CONF_name_$key\" x=`./$tmp.sh 2>/dev/null` ;; '') case $conf_name in - SIZE_*|U*|*_MAX) + SIZE_*|U*|*_MAX) f="%${LL_format}u" t="unsigned _ast_intmax_t" ;; @@ -1348,7 +1348,7 @@ ${script} ;; esac ;; - -*[2468]) + -*[2468]) case $shell in ksh) p=${conf_limit%?} s=${conf_limit#$p} @@ -1383,7 +1383,7 @@ ${script} ;; esac ;; - -*[2468]) + -*[2468]) case $shell in ksh) p=${conf_minmax%?} s=${conf_minmax#$p} diff --git a/src/lib/libast/comp/conf.tab b/src/lib/libast/comp/conf.tab index 9eaaa371d6ab..2d30d9afce6f 100644 --- a/src/lib/libast/comp/conf.tab +++ b/src/lib/libast/comp/conf.tab @@ -178,7 +178,7 @@ LPBIG_OFFBIG_LINTFLAGS XBS5 CS 1 FU MACHINE SVID SI 1 O MAPPED_FILES POSIX SC 1 CDFUW _lib_mmap MAX_CANON POSIX PC 1 LMU CANBSIZ 255 -MAX_INPUT POSIX PC 1 LMU MAX_CANON 255 +MAX_INPUT POSIX PC 1 LMU MAX_CANON 255 MB_LEN_MAX C XX 1 L 1 MCAS_OFFSET C QQ 1 L MEMLOCK POSIX SC 1 CDFUW diff --git a/src/lib/libast/comp/eaccess.c b/src/lib/libast/comp/eaccess.c index f23ae40c84f3..5afd2ecf8c22 100644 --- a/src/lib/libast/comp/eaccess.c +++ b/src/lib/libast/comp/eaccess.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 * * * @@ -97,7 +97,7 @@ eaccess(const char* path, int flags) int n; static int ngroups = -2; - static gid_t* groups; + static gid_t* groups; if (ngroups == -2) { diff --git a/src/lib/libast/comp/iconv.c b/src/lib/libast/comp/iconv.c index 54917fe81eb8..4b90ff0e8819 100644 --- a/src/lib/libast/comp/iconv.c +++ b/src/lib/libast/comp/iconv.c @@ -428,7 +428,7 @@ umeinit(void) if (!ume_d[ume_D[0]]) { - s = ume_D; + s = ume_D; while (c = *s++) ume_d[c] = 1; memset(ume_m, NOE, sizeof(ume_m)); diff --git a/src/lib/libast/comp/setlocale.c b/src/lib/libast/comp/setlocale.c index 92afb92a2d5e..8c761cdebb42 100644 --- a/src/lib/libast/comp/setlocale.c +++ b/src/lib/libast/comp/setlocale.c @@ -464,7 +464,7 @@ sjis_mbtowc(wchar_t* p, const char* s, size_t n) #if !AST_NOMULTIBYTE static int -utf8_wctomb(char* u, wchar_t w) +utf8_wctomb(char* u, wchar_t w) { return u ? wc2utf8(u, w) : 0; } diff --git a/src/lib/libast/comp/wordexp.c b/src/lib/libast/comp/wordexp.c index 4dc489b7c1d8..8142caff8688 100644 --- a/src/lib/libast/comp/wordexp.c +++ b/src/lib/libast/comp/wordexp.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 * * * @@ -19,7 +19,7 @@ ***********************************************************************/ /* * POSIX 1003.2 wordexp implementation - */ + */ #include #include diff --git a/src/lib/libast/disc/sfdcfilter.c b/src/lib/libast/disc/sfdcfilter.c index 1c4f21cf0581..c6f7b180a8ac 100644 --- a/src/lib/libast/disc/sfdcfilter.c +++ b/src/lib/libast/disc/sfdcfilter.c @@ -43,7 +43,7 @@ static ssize_t filterread(Sfio_t* f, /* stream reading from */ fi = (Filter_t*)disc; for(;;) - { + { /* get some raw data to stuff down the pipe */ if(fi->next && fi->next >= fi->endb ) { if((r = sfrd(f,fi->raw,sizeof(fi->raw),disc)) > 0) diff --git a/src/lib/libast/disc/sfdcmore.c b/src/lib/libast/disc/sfdcmore.c index 17cc95aacb4a..aff071ae0160 100644 --- a/src/lib/libast/disc/sfdcmore.c +++ b/src/lib/libast/disc/sfdcmore.c @@ -33,7 +33,7 @@ */ typedef struct -{ +{ Sfdisc_t disc; /* sfio discipline */ Sfio_t* input; /* tied with this input stream */ Sfio_t* error; /* tied with this error stream */ @@ -299,7 +299,7 @@ int sfdcmore(Sfio_t* f, const char* prompt, int rows, int cols) more->col = 1; if (sfdisc(f, &more->disc) != &more->disc) - { + { free(more); return -1; } diff --git a/src/lib/libast/disc/sfdcprefix.c b/src/lib/libast/disc/sfdcprefix.c index 45ef11df596e..61e9db893928 100644 --- a/src/lib/libast/disc/sfdcprefix.c +++ b/src/lib/libast/disc/sfdcprefix.c @@ -28,7 +28,7 @@ */ typedef struct -{ +{ Sfdisc_t disc; /* sfio discipline */ size_t length; /* prefix length */ size_t empty; /* empty line prefix length */ @@ -118,7 +118,7 @@ int sfdcprefix(Sfio_t* f, const char* prefix) pfx->empty = n; if (sfdisc(f, &pfx->disc) != &pfx->disc) - { + { free(pfx); return -1; } diff --git a/src/lib/libast/disc/sfdcsubstr.c b/src/lib/libast/disc/sfdcsubstr.c index 2bcbfa146207..f13d0899adaa 100644 --- a/src/lib/libast/disc/sfdcsubstr.c +++ b/src/lib/libast/disc/sfdcsubstr.c @@ -57,7 +57,7 @@ static ssize_t streamio(Sfio_t* f, void* buf, size_t n, Sfdisc_t* disc, int type if(sfsk(f,here,SEEK_SET,disc) != here) io = 0; else - { if(type == SFIO_WRITE) + { if(type == SFIO_WRITE) io = sfwr(f,buf,n,disc); else io = sfrd(f,buf,n,disc); if(io > 0) diff --git a/src/lib/libast/features/aso b/src/lib/libast/features/aso index b5de0aee1a84..7fe2d30aacc7 100644 --- a/src/lib/libast/features/aso +++ b/src/lib/libast/features/aso @@ -383,7 +383,7 @@ elif aso note{ i386|i386-64 asm compare and swap }end link{ cas32(uint32_t volatile* p, uint32_t o, uint32_t n) { uint32_t r; - + __asm__ __volatile__ ( "lock ; cmpxchg %3,%4" : "=a"(r), "=m"(*p) @@ -399,7 +399,7 @@ elif aso note{ i386|i386-64 asm compare and swap }end link{ cas64(uint64_t volatile* p, uint64_t o, uint64_t n) { uint64_t r; - + __asm__ __volatile__ ( "lock ; cmpxchg %3,%4" : "=a"(r), "=m"(*p) @@ -426,7 +426,7 @@ elif aso note{ i386|i386-64 asm compare and swap }end link{ cas32(uint32_t volatile* p, uint32_t o, uint32_t n) { uint32_t r; - + __asm__ __volatile__ ( "lock ; cmpxchg %3,%4" : "=a"(r), "=m"(*p) @@ -442,7 +442,7 @@ elif aso note{ i386|i386-64 asm compare and swap }end link{ cas64(uint64_t volatile* p, uint64_t o, uint64_t n) { uint64_t r; - + __asm__ __volatile__ ( "lock ; cmpxchg %3,%4" : "=a"(r), "=m"(*p) @@ -451,7 +451,7 @@ elif aso note{ i386|i386-64 asm compare and swap }end link{ ); return r; } - + #endif #define _aso_cas32(p,o,n) cas32(p,o,n) @@ -539,7 +539,7 @@ elif aso note{ ppc asm compare and swap }end link{ cas32(uint32_t volatile* p, uint32_t o, uint32_t n) { int r; - + __asm__ __volatile__ ( "0: lwarx %0,0,%1 ;" " xor. %0,%3,%0;" @@ -559,7 +559,7 @@ elif aso note{ ppc asm compare and swap }end link{ cas64(uint64_t volatile* p, uint64_t o, uint64_t n) { long r; - + __asm__ __volatile__ ( "0: ldarx %0,0,%1 ;" " xor. %0,%3,%0;" @@ -586,7 +586,7 @@ elif aso note{ ppc asm compare and swap }end link{ cas32(uint32_t volatile* p, uint32_t o, uint32_t n) { int r; - + __asm__ __volatile__ ( "0: lwarx %0,0,%1 ;" " xor. %0,%3,%0;" @@ -606,7 +606,7 @@ elif aso note{ ppc asm compare and swap }end link{ cas64(uint64_t volatile* p, uint64_t o, uint64_t n) { long r; - + __asm__ __volatile__ ( "0: ldarx %0,0,%1 ;" " xor. %0,%3,%0;" diff --git a/src/lib/libast/features/common b/src/lib/libast/features/common index 934453469dcf..c77912f50e52 100644 --- a/src/lib/libast/features/common +++ b/src/lib/libast/features/common @@ -133,7 +133,7 @@ tst - -DN=1 - -DN=2 - -DN=3 - -DN=4 - -DN=5 - -DN=6 - -DN=7 - -DN=8 - -DN=0 outp #endif #define elementsof(x) (sizeof(x)/sizeof(x[0])) - + static char i_char = 1; static short i_short = 1; static int i_int = 1; @@ -147,7 +147,7 @@ tst - -DN=1 - -DN=2 - -DN=3 - -DN=4 - -DN=5 - -DN=6 - -DN=7 - -DN=8 - -DN=0 outp static unsigned _ast_int8_t u_long_long = 18446744073709551615; #endif #endif - + static struct { char* name; @@ -163,9 +163,9 @@ tst - -DN=1 - -DN=2 - -DN=3 - -DN=4 - -DN=5 - -DN=6 - -DN=7 - -DN=8 - -DN=0 outp _ast_int8_str, sizeof(_ast_int8_t), (char*)&i_long_long, #endif }; - + static int int_size[] = { 1, 2, 4, 8 }; - + int main(void) { @@ -174,7 +174,7 @@ tst - -DN=1 - -DN=2 - -DN=3 - -DN=4 - -DN=5 - -DN=6 - -DN=7 - -DN=8 - -DN=0 outp int m = 1; int b = 1; int w = 0; - + #ifdef _ast_int8_t unsigned _ast_int8_t p; char buf[64]; @@ -235,7 +235,7 @@ tst - output{ #endif #define elementsof(x) (sizeof(x)/sizeof(x[0])) - + static struct { char* name; @@ -254,7 +254,7 @@ tst - output{ "long_double", sizeof(long double), 0, #endif }; - + int main(void) { @@ -292,7 +292,7 @@ tst - -DN=1 - -DN=0 output{ #endif #define elementsof(x) (sizeof(x)/sizeof(x[0])) - + static struct { char* name; @@ -305,13 +305,13 @@ tst - -DN=1 - -DN=0 output{ "long double", sizeof(long double), #endif }; - + int main(void) { int t; int m = 1; - + #if _typ_long_double long double p; char buf[64]; @@ -483,7 +483,7 @@ tst - -DTRY=1 - -DTRY=1 -Dvoid=char - -DTRY=2 - -DTRY=3 - -DTRY=4 output{ #endif /*TRY == 2*/ printf("/* va_arg() va_list type */\n"); #endif /*TRY == 4*/ - + #if !defined(va_copy) #if defined(__va_copy) printf("#ifndef va_copy\n"); @@ -504,7 +504,7 @@ tst - -DTRY=1 - -DTRY=1 -Dvoid=char - -DTRY=2 - -DTRY=3 - -DTRY=4 output{ #endif #endif #endif - + printf("#endif\n"); return 0; } diff --git a/src/lib/libast/features/fcntl.c b/src/lib/libast/features/fcntl.c index 79d345664ecb..b747e7758cb7 100644 --- a/src/lib/libast/features/fcntl.c +++ b/src/lib/libast/features/fcntl.c @@ -43,7 +43,7 @@ #include "FEATURE/fs" -#undef getdtablesize +#undef getdtablesize #undef getpagesize #undef ioctl diff --git a/src/lib/libast/features/float b/src/lib/libast/features/float index 156e91b584a7..efdcc52e32c2 100644 --- a/src/lib/libast/features/float +++ b/src/lib/libast/features/float @@ -330,7 +330,7 @@ tst - note{ missing floating point limits }end output{ unsigned int ui; unsigned long ul; unsigned _ast_intmax_t uq; - + #ifdef SIGFPE signal(SIGFPE, catch); #endif @@ -1059,7 +1059,7 @@ tst - -DSCAN=1 - -lm -DSTRTO=1 - -DMAC=1 - -DDIV=1 - -DEXP=1 - -DADD=1 - -DMPY=1 { unsigned char* u = (unsigned char*)val; unsigned char* e = u + siz; - + printf("#define _ast_%s_%s_init\t0x%02x", typ, var, *u); while (++u < e) printf(",0x%02x", *u); diff --git a/src/lib/libast/features/lib b/src/lib/libast/features/lib index 3a69256b0971..d11a460713a0 100644 --- a/src/lib/libast/features/lib +++ b/src/lib/libast/features/lib @@ -309,7 +309,7 @@ tst socket_peek note{ recv(MSG_PEEK) works on socketpair() }end execute{ #include int main(void) - { + { int i; int fds[2]; char buf[128]; diff --git a/src/lib/libast/features/limits.c b/src/lib/libast/features/limits.c index 1116c81c4b6a..30f66dff5418 100644 --- a/src/lib/libast/features/limits.c +++ b/src/lib/libast/features/limits.c @@ -73,7 +73,7 @@ #include "FEATURE/param" #undef getpagesize -#undef getdtablesize +#undef getdtablesize int main(void) { diff --git a/src/lib/libast/features/mmap b/src/lib/libast/features/mmap index ece23d5c4f14..ccb16636119d 100644 --- a/src/lib/libast/features/mmap +++ b/src/lib/libast/features/mmap @@ -9,7 +9,7 @@ tst lib_mmap note{ standard mmap interface that works }end execute{ #include #include #include - + #define MAPSIZE (64*1024) #define BUFSIZE (8*1024) #define WRITE (64) @@ -164,14 +164,14 @@ tst note{ mmap is fast enough to be worth using }end output{ #include #include #include - + #define MAPSIZE (64*1024) #define BUFSIZE (MAPSIZE/8) #define WRITE (64) #define RUN (64) - + #define Failed(file) (remove(file),1) - + int main(int argc, char** argv) { @@ -181,7 +181,7 @@ tst note{ mmap is fast enough to be worth using }end output{ char file[1024], buf[MAPSIZE]; struct tms stm, etm; clock_t rdtm, mmtm; - + /* create data file */ f = argv[0]; t = file; while (*t = *f++) @@ -189,14 +189,14 @@ tst note{ mmap is fast enough to be worth using }end output{ *t++ = '.'; *t++ = 'D'; *t = 0; if ((fd = open(file, O_CREAT|O_TRUNC|O_WRONLY, 0666)) < 0) return 1; - + for (i = 0; i < sizeof(buf); ++i) buf[i] = '0' + (i%10); for (i = 0; i < WRITE; ++i) if (write(fd,buf,sizeof(buf)) != sizeof(buf)) return Failed(file); close(fd); - + /* read time */ times(&stm); for(run = 0; run < RUN; ++run) @@ -211,7 +211,7 @@ tst note{ mmap is fast enough to be worth using }end output{ } times(&etm); rdtm = (etm.tms_utime-stm.tms_utime) + (etm.tms_stime-stm.tms_stime); - + /* mmap time */ times(&stm); for(run = 0; run < RUN; ++run) @@ -225,7 +225,7 @@ tst note{ mmap is fast enough to be worth using }end output{ MAP_PRIVATE, fd, i*MAPSIZE ); if(mm == (caddr_t)(-1) || mm == NULL) return Failed(file); - + /* the memcpy is < BUFSIZE to simulate the fact that functions like sfreserve/sfgetr do not do buffer copying. @@ -240,12 +240,12 @@ tst note{ mmap is fast enough to be worth using }end output{ mmtm = (etm.tms_utime-stm.tms_utime) + (etm.tms_stime-stm.tms_stime); remove(file); - + if(4*mmtm <= 3*rdtm) printf("#define _mmap_worthy 2 /* mmap is great */\n"); else if(4*mmtm <= 5*rdtm) printf("#define _mmap_worthy 1 /* mmap is good */\n"); - + else return 1; return 0; diff --git a/src/lib/libast/hash/hashalloc.c b/src/lib/libast/hash/hashalloc.c index d9fb612256e9..c8832e48ec69 100644 --- a/src/lib/libast/hash/hashalloc.c +++ b/src/lib/libast/hash/hashalloc.c @@ -90,7 +90,7 @@ hashalloc(Hash_table_t* ref, ...) tab->size = HASHMINSIZE; for (;;) { - switch (n) + switch (n) { case HASH_alloc: if (ref) goto out; diff --git a/src/lib/libast/hash/hashlook.c b/src/lib/libast/hash/hashlook.c index 6aa624b9df82..a02b25bcf155 100644 --- a/src/lib/libast/hash/hashlook.c +++ b/src/lib/libast/hash/hashlook.c @@ -137,14 +137,14 @@ hashlook(Hash_table_t* tab, const char* name, long flags, const char* value) /* * found the bucket */ - + found: if (prev && !tab->frozen) { /* * migrate popular buckets to the front */ - + prev->next = b->next; b->next = tab->table[n]; tab->table[n] = b; diff --git a/src/lib/libast/include/cdt.h b/src/lib/libast/include/cdt.h index ae2225e7b619..f1ae3a241fa4 100644 --- a/src/lib/libast/include/cdt.h +++ b/src/lib/libast/include/cdt.h @@ -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 * * * @@ -73,7 +73,7 @@ struct _dtuser_s /* for application to access and use */ }; struct _dtlink_s -{ +{ #if CDT_VERSION < 20111111L Dtlink_t* right; /* right child */ union @@ -99,7 +99,7 @@ struct _dthold_s }; /* method to manipulate dictionary structure */ -struct _dtmethod_s +struct _dtmethod_s { Dtsearch_f searchf; /* search function */ unsigned int type; /* type of operation */ int (*eventf)(Dt_t*, int, void*); @@ -147,7 +147,7 @@ struct _dt_s }; /* structure to get status of a dictionary */ -#define DT_MAXRECURSE 1024 /* limit to avoid stack overflow */ +#define DT_MAXRECURSE 1024 /* limit to avoid stack overflow */ #define DT_MAXSIZE 256 /* limit for size of below arrays */ struct _dtstat_s { unsigned int meth; /* method type */ @@ -270,7 +270,7 @@ extern void* dllmeth(const char*, const char*, unsigned long); #define _DTOBJ(dc,l) ((dc)->link >= 0 ? _DTO(dc,l) : ((Dthold_t*)(l))->obj ) #define _DTK(dc,o) ((char*)(o) + (dc)->key) /* get key from object */ -#define _DTKEY(dc,o) (void*)((dc)->size >= 0 ? _DTK(dc,o) : *((char**)_DTK(dc,o)) ) +#define _DTKEY(dc,o) (void*)((dc)->size >= 0 ? _DTK(dc,o) : *((char**)_DTK(dc,o)) ) #define _DTCMP(dt,k1,k2,dc) \ ((dc)->comparf ? (*(dc)->comparf)((dt), (k1), (k2), (dc)) : \ diff --git a/src/lib/libast/include/shcmd.h b/src/lib/libast/include/shcmd.h index 9fd2d31d0682..5ce99a7c601d 100644 --- a/src/lib/libast/include/shcmd.h +++ b/src/lib/libast/include/shcmd.h @@ -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 * * * @@ -69,7 +69,7 @@ struct Shbltin_s #if defined(shell_h_defined) || defined(defs_h_defined) # undef Shell_t # undef Namval_t -#else +#else # define sh_context(c) ((Shbltin_t*)(c)) # define sh_run(c, ac, av) ((c)?(*sh_context(c)->shrun)(ac,av):-1) # define sh_system(c,str) ((c)?(*sh_context(c)->shtrap)(str,0):system(str)) diff --git a/src/lib/libast/misc/debug.c b/src/lib/libast/misc/debug.c index 54efe1b71153..4620cf12860c 100644 --- a/src/lib/libast/misc/debug.c +++ b/src/lib/libast/misc/debug.c @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-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 * * * @@ -41,7 +41,7 @@ debug_fatal(const char* file, int line) #endif double debug_elapsed(int set) -{ +{ double tm; struct rusage ru; diff --git a/src/lib/libast/misc/fastfind.c b/src/lib/libast/misc/fastfind.c index 932e255b3b8e..2280aeb96219 100644 --- a/src/lib/libast/misc/fastfind.c +++ b/src/lib/libast/misc/fastfind.c @@ -26,7 +26,7 @@ * the bigram encoding steals the eighth bit (that's why it's FF_old) * maybe one day we'll limit it to readonly: * - * 0-2*FF_OFF likeliest differential counts + offset to make nonnegative + * 0-2*FF_OFF likeliest differential counts + offset to make nonnegative * FF_ESC 4 byte big-endian out-of-range count+FF_OFF follows * FF_MIN-FF_MAX ASCII residue * >=FF_MAX bigram codes @@ -141,7 +141,7 @@ findopen(const char* file, const char* pattern, const char* type, Finddisc_t* di char* p; char* s; char* b; - int i; + int i; int j; char* path; int brace = 0; @@ -399,7 +399,7 @@ findopen(const char* file, const char* pattern, const char* type, Finddisc_t* di setgid(getgid()); fp->stamp = st.st_mtime; b = (s = fp->decode.temp) + 1; - for (i = 0; i < elementsof(fp->decode.bigram1); i++) + for (i = 0; i < elementsof(fp->decode.bigram1); i++) { if ((j = sfgetc(fp->fp)) == EOF) goto invalid; @@ -857,7 +857,7 @@ findread(Find_t* fp) s--; if (*fp->decode.pattern == '/' && b > fp->decode.path) b--; - for (; s >= b; s--) + for (; s >= b; s--) if (*s == *fp->decode.end || ignorecase && tolower(*s) == *fp->decode.end) { if (ignorecase) @@ -1110,7 +1110,7 @@ findsync(Find_t* fp) fp->encode.code[n][m] = 0; /* - * commit the real file + * commit the real file */ if (sfseek(fp->fp, 0, SEEK_SET)) diff --git a/src/lib/libast/misc/fts.c b/src/lib/libast/misc/fts.c index a76c1ea26ea1..dd207f4b2e9d 100644 --- a/src/lib/libast/misc/fts.c +++ b/src/lib/libast/misc/fts.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 * * * @@ -254,7 +254,7 @@ search(FTSENT* e, FTSENT* root, int(*comparf)(FTSENT* const*, FTSENT* const*), i if (!(cmp = (*comparf)(&e, &root)) && !insert) break; if (cmp < 0) - { + { /* * this is the left zig-zig case */ @@ -279,7 +279,7 @@ search(FTSENT* e, FTSENT* root, int(*comparf)(FTSENT* const*, FTSENT* const*), i right->left = 0; } else - { + { /* * this is the right zig-zig case */ @@ -1099,7 +1099,7 @@ fts_read(FTS* fts) if (fts->root) getlist(&fts->top, &fts->bot, fts->root); if (fts->children) - { + { /* * try moving back to parent dir */ @@ -1481,7 +1481,7 @@ int fts_flags(void) { char* s; - + s = astconf("PATH_RESOLVE", NULL, NULL); if (streq(s, "logical")) return FTS_LOGICAL; diff --git a/src/lib/libast/misc/magic.tab b/src/lib/libast/misc/magic.tab index a3eb8e01471f..91cb04bca78e 100644 --- a/src/lib/libast/misc/magic.tab +++ b/src/lib/libast/misc/magic.tab @@ -681,7 +681,7 @@ o() 0 belong&0377777777 041400413 netbsd i386 d{ -0 byte &0x80 +0 byte &0x80 +20 lelong <4096 shared library x-system/dll +20 lelong >=4096 executable, dynamically linked x-system/exe } @@ -756,7 +756,7 @@ c() 0 belong&0377777777 041600413 netbsd m68k d{ -0 byte &0x80 +0 byte &0x80 +20 belong <8192 shared library x-system/dll +20 belong >=8192 executable, dynamically linked x-system/exe } diff --git a/src/lib/libast/misc/optget.c b/src/lib/libast/misc/optget.c index f1a33955a20c..0aba30878cb7 100644 --- a/src/lib/libast/misc/optget.c +++ b/src/lib/libast/misc/optget.c @@ -4124,7 +4124,7 @@ optusage(const char* opts) * 0x.* or #* for alternate bases */ -static intmax_t +static intmax_t optnumber(const char* s, char** t, int* e) { intmax_t n; diff --git a/src/lib/libast/misc/procopen.c b/src/lib/libast/misc/procopen.c index 4e7be6b800c1..a65458a5c079 100644 --- a/src/lib/libast/misc/procopen.c +++ b/src/lib/libast/misc/procopen.c @@ -34,7 +34,7 @@ #include /* - * not quite ready for _use_spawnveg + * not quite ready for _use_spawnveg */ #undef _use_spawnveg diff --git a/src/lib/libast/misc/stk.c b/src/lib/libast/misc/stk.c index a009a95f9bd1..f6c8cd329134 100644 --- a/src/lib/libast/misc/stk.c +++ b/src/lib/libast/misc/stk.c @@ -19,7 +19,7 @@ ***********************************************************************/ /* * Routines to implement a stack-like storage library - * + * * A stack consists of a link list of variable size frames * The beginning of each frame is initialized with a frame structure * that contains a pointer to the previous frame and a pointer to the @@ -86,7 +86,7 @@ static char *stkgrow(Sfio_t*, size_t); ((struct stk*)(((char*)(stream))+STK_HDRSIZE))) #define stk2stream(sp) ((Sfio_t*)(((char*)(sp))-STK_HDRSIZE)) #define stkleft(stream) ((stream)->_endb-(stream)->_data) - + static const char Omsg[] = "out of memory while growing stack\n"; /* @@ -120,7 +120,7 @@ static int stkexcept(Sfio_t *stream, int type, void* val, Sfdisc_t* dp) { case SFIO_CLOSING: { - struct stk *sp = stream2stk(stream); + struct stk *sp = stream2stk(stream); char *cp = sp->stkbase; struct frame *fp; if(--sp->stkref == 0) @@ -281,7 +281,7 @@ unsigned int stklink(Sfio_t* stream) */ int stkclose(Sfio_t* stream) { - struct stk *sp = stream2stk(stream); + struct stk *sp = stream2stk(stream); if(sp->stkref>1) { sp->stkref--; @@ -295,7 +295,7 @@ int stkclose(Sfio_t* stream) */ int stkon(Sfio_t * stream, char* loc) { - struct stk *sp = stream2stk(stream); + struct stk *sp = stream2stk(stream); struct frame *fp; for(fp=(struct frame*)sp->stkbase; fp; fp=(struct frame*)fp->prev) if(loc>=((char*)(fp+1)) && loc< fp->end) @@ -310,7 +310,7 @@ int stkon(Sfio_t * stream, char* loc) */ void *stkset(Sfio_t *stream, void *address, size_t offset) { - struct stk *sp = stream2stk(stream); + struct stk *sp = stream2stk(stream); char *cp, *loc = (char*)address; struct frame *fp; int frames = 0; diff --git a/src/lib/libast/misc/translate.c b/src/lib/libast/misc/translate.c index 905c6e255aee..04540f5afcd6 100644 --- a/src/lib/libast/misc/translate.c +++ b/src/lib/libast/misc/translate.c @@ -37,19 +37,19 @@ #define NOCAT ((nl_catd)-1) #define GAP 100 -typedef struct -{ +typedef struct +{ Dtlink_t link; /* dictionary link */ Dt_t* messages; /* message dictionary handle */ nl_catd cat; /* message catalog handle */ int debug; /* special debug locale */ - const char* locale; /* message catalog locale */ - const char* nlspath; /* message catalog NLSPATH */ + const char* locale; /* message catalog locale */ + const char* nlspath; /* message catalog NLSPATH */ char name[1]; /* catalog name */ } Catalog_t; typedef struct -{ +{ Dtlink_t link; /* dictionary link */ Catalog_t* cat; /* current catalog pointer */ int set; /* set number */ @@ -274,19 +274,19 @@ match(const char* cat, const char* msg) * the translated message text is returned on success * otherwise the original msg is returned * - * The first time translate() is called (for a non-C locale) + * The first time translate() is called (for a non-C locale) * it creates the state.catalogs dictionary. A dictionary entry * (Catalog_t) is made each time translate() is called with a new - * cmd:cat argument. - * - * The X/Open interface catgets() is used to obtain a translated + * cmd:cat argument. + * + * The X/Open interface catgets() is used to obtain a translated * message. Its arguments include the message catalog name - * and the set/sequence numbers within the catalog. An additional - * dictionary, with entries of type Message_t, is needed for - * mapping untranslated message strings to the set/sequence numbers + * and the set/sequence numbers within the catalog. An additional + * dictionary, with entries of type Message_t, is needed for + * mapping untranslated message strings to the set/sequence numbers * needed by catgets(). A separate Message_t dictionary is maintained * for each Catalog_t. - */ + */ char* translate(const char* loc, const char* cmd, const char* cat, const char* msg) diff --git a/src/lib/libast/path/pathcanon.c b/src/lib/libast/path/pathcanon.c index a4ee401e47ec..15d20b28bf7e 100644 --- a/src/lib/libast/path/pathcanon.c +++ b/src/lib/libast/path/pathcanon.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 * * * @@ -27,7 +27,7 @@ * remove redundant .'s and /'s * move ..'s to the front * /.. preserved (for pdu and newcastle hacks) - * + * * longer pathname possible if (flags&PATH_PHYSICAL) involved * 0 returned on error and if (flags&(PATH_DOTDOT|PATH_EXISTS)) then path * will contain the components following the failure point diff --git a/src/lib/libast/path/pathtemp.c b/src/lib/libast/path/pathtemp.c index c9e677a34aa0..5b5c099ad285 100644 --- a/src/lib/libast/path/pathtemp.c +++ b/src/lib/libast/path/pathtemp.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 * * * @@ -320,7 +320,7 @@ pathtemp(char* buf, size_t len, const char* dir, const char* pfx, int* fdp) for (attempt = 0; attempt < ATTEMPT; attempt++) { if (!tmp.rng || !tmp.seed && (attempt || tmp.pid != getpid())) - { + { int r; /* diff --git a/src/lib/libast/port/lc.c b/src/lib/libast/port/lc.c index a89206938395..826ae6860bb7 100644 --- a/src/lib/libast/port/lc.c +++ b/src/lib/libast/port/lc.c @@ -44,7 +44,7 @@ static Lc_t default_lc = &lc_languages[0], &lc_territories[0], &lc_charsets[0], - 0, + 0, LC_default|LC_checked|LC_local, 0, { @@ -73,7 +73,7 @@ static Lc_t debug_lc = &lc_languages[1], &lc_territories[1], &lc_charsets[0], - 0, + 0, LC_debug|LC_checked|LC_local, 0, { @@ -780,7 +780,7 @@ lcmake(const char* name) strcpy((char*)lc->code, s); lc->language = lp ? lp : &lc_languages[0]; lc->territory = tp ? tp : &lc_territories[0]; - lc->charset = cp ? cp : &lc_charsets[0]; + lc->charset = cp ? cp : &lc_charsets[0]; if (streq(lc->charset->code, "utf8")) lc->flags |= LC_utf8; lc->attributes = al; diff --git a/src/lib/libast/port/lclang.h b/src/lib/libast/port/lclang.h index b1029fce93f2..11ed52ddf96b 100644 --- a/src/lib/libast/port/lclang.h +++ b/src/lib/libast/port/lclang.h @@ -2,7 +2,7 @@ * * * This software is part of the ast package * * Copyright (c) 1985-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 * * * @@ -60,58 +60,58 @@ #ifndef SUBLANG_DUTCH_NETHERLANDS_ANTILLES #define SUBLANG_DUTCH_NETHERLANDS_ANTILLES SUBLANG_DUTCH #endif -#ifndef SUBLANG_DUTCH_BELGIUM +#ifndef SUBLANG_DUTCH_BELGIUM #define SUBLANG_DUTCH_BELGIUM SUBLANG_DUTCH_BELGIAN #endif -#ifndef SUBLANG_ENGLISH_AUSTRALIA +#ifndef SUBLANG_ENGLISH_AUSTRALIA #define SUBLANG_ENGLISH_AUSTRALIA SUBLANG_ENGLISH_AUS #endif -#ifndef SUBLANG_ENGLISH_CANADA +#ifndef SUBLANG_ENGLISH_CANADA #define SUBLANG_ENGLISH_CANADA SUBLANG_ENGLISH_CAN #endif -#ifndef SUBLANG_ENGLISH_IRELAND +#ifndef SUBLANG_ENGLISH_IRELAND #define SUBLANG_ENGLISH_IRELAND SUBLANG_ENGLISH_EIRE #endif -#ifndef SUBLANG_ENGLISH_NEW_ZEALAND +#ifndef SUBLANG_ENGLISH_NEW_ZEALAND #define SUBLANG_ENGLISH_NEW_ZEALAND SUBLANG_ENGLISH_NZ #endif -#ifndef SUBLANG_ENGLISH_TRINIDAD_TOBAGO +#ifndef SUBLANG_ENGLISH_TRINIDAD_TOBAGO #define SUBLANG_ENGLISH_TRINIDAD_TOBAGO SUBLANG_ENGLISH_CARIBBEAN #endif -#ifndef SUBLANG_ENGLISH_UNITED_KINGDOM +#ifndef SUBLANG_ENGLISH_UNITED_KINGDOM #define SUBLANG_ENGLISH_UNITED_KINGDOM SUBLANG_ENGLISH_UK #endif -#ifndef SUBLANG_ENGLISH_UNITED_STATES +#ifndef SUBLANG_ENGLISH_UNITED_STATES #define SUBLANG_ENGLISH_UNITED_STATES SUBLANG_ENGLISH_US #endif -#ifndef SUBLANG_FRENCH_BELGIUM +#ifndef SUBLANG_FRENCH_BELGIUM #define SUBLANG_FRENCH_BELGIUM SUBLANG_FRENCH_BELGIAN #endif -#ifndef SUBLANG_FRENCH_CANADA +#ifndef SUBLANG_FRENCH_CANADA #define SUBLANG_FRENCH_CANADA SUBLANG_FRENCH_CANADIAN #endif -#ifndef SUBLANG_FRENCH_SWITZERLAND +#ifndef SUBLANG_FRENCH_SWITZERLAND #define SUBLANG_FRENCH_SWITZERLAND SUBLANG_FRENCH_SWISS #endif -#ifndef SUBLANG_GERMAN_AUSTRIA +#ifndef SUBLANG_GERMAN_AUSTRIA #define SUBLANG_GERMAN_AUSTRIA SUBLANG_GERMAN_AUSTRIAN #endif -#ifndef SUBLANG_GERMAN_SWITZERLAND +#ifndef SUBLANG_GERMAN_SWITZERLAND #define SUBLANG_GERMAN_SWITZERLAND SUBLANG_GERMAN_SWISS #endif -#ifndef SUBLANG_ITALIAN_SWITZERLAND +#ifndef SUBLANG_ITALIAN_SWITZERLAND #define SUBLANG_ITALIAN_SWITZERLAND SUBLANG_ITALIAN_SWISS #endif -#ifndef SUBLANG_NORWEGIAN_BOKMAL_NORWAY +#ifndef SUBLANG_NORWEGIAN_BOKMAL_NORWAY #define SUBLANG_NORWEGIAN_BOKMAL_NORWAY SUBLANG_NORWEGIAN_BOKMAL #endif -#ifndef SUBLANG_NORWEGIAN_NORWAY +#ifndef SUBLANG_NORWEGIAN_NORWAY #define SUBLANG_NORWEGIAN_NORWAY SUBLANG_NORWEGIAN_BOKMAL #endif #ifndef SUBLANG_NORWEGIAN_NYNORSK_NORWAY #define SUBLANG_NORWEGIAN_NYNORSK_NORWAY SUBLANG_NORWEGIAN_NYNORSK #endif -#ifndef SUBLANG_PORTUGUESE_BRAZIL +#ifndef SUBLANG_PORTUGUESE_BRAZIL #define SUBLANG_PORTUGUESE_BRAZIL SUBLANG_PORTUGUESE_BRAZILIAN #endif diff --git a/src/lib/libast/port/mc.c b/src/lib/libast/port/mc.c index 9f85de96dc1c..492760eb6f1e 100644 --- a/src/lib/libast/port/mc.c +++ b/src/lib/libast/port/mc.c @@ -35,7 +35,7 @@ size_t nmsgs; \ iconv_t cvt; \ Sfio_t* tmp; - + #include #include #include @@ -513,7 +513,7 @@ mcdump(Mc_t* mc, Sfio_t* op) /* * write the magic */ - + if (sfwrite(op, MC_MAGIC, MC_MAGIC_SIZE) != MC_MAGIC_SIZE) return -1; diff --git a/src/lib/libast/port/mnt.c b/src/lib/libast/port/mnt.c index 234eac6b42da..4a0886bf9613 100644 --- a/src/lib/libast/port/mnt.c +++ b/src/lib/libast/port/mnt.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 * * * @@ -492,7 +492,7 @@ extern struct mntent* getmntent(FILE*); #endif #ifdef __Lynx__ -#undef MOUNTED +#undef MOUNTED #define MOUNTED "/etc/fstab" #define SEP ':' #endif diff --git a/src/lib/libast/regex/regclass.c b/src/lib/libast/regex/regclass.c index d9d8161fc797..04885549d432 100644 --- a/src/lib/libast/regex/regclass.c +++ b/src/lib/libast/regex/regclass.c @@ -179,7 +179,7 @@ static int Is_wc_16(int c) { return iswctype(c, ctype[CTYPES+15].wtype); } * return pointer to ctype function for :class:] in s * s points to the first char after the initial [ * dynamic wctype classes are locale-specific - * dynamic entry locale is punned in Ctype_t.next + * dynamic entry locale is punned in Ctype_t.next * the search does a lazy (one entry at a time) flush on locale mismatch * if e!=0 it points to next char in s * 0 returned on error diff --git a/src/lib/libast/regex/regcomp.c b/src/lib/libast/regex/regcomp.c index 1318bebf3b39..a55f0ba7e552 100644 --- a/src/lib/libast/regex/regcomp.c +++ b/src/lib/libast/regex/regcomp.c @@ -60,7 +60,7 @@ typedef struct Cchr_s /* * determine whether greedy matching will work, i.e. produce * the best match first. such expressions are "easy", and - * need no backtracking once a complete match is found. + * need no backtracking once a complete match is found. * if an expression has backreferences or alts it's hard * else if it has only one closure it's easy * else if all closures are simple (i.e. one-character) it's easy @@ -328,7 +328,7 @@ cat(Cenv_t* env, Rex_t* e, Rex_t* f) { if (e->hi > RE_DUP_MAX || f->hi > RE_DUP_MAX) { - n = RE_DUP_INF; + n = RE_DUP_INF; goto combine; } else if (n <= RE_DUP_MAX) @@ -2597,7 +2597,7 @@ seq(Cenv_t* env) { s = buf; while ((c = token(env)) < T_META && s < &buf[sizeof(buf) - env->token.len]) - { + { x = c; p = env->cursor; if (c >= 0) @@ -2729,13 +2729,13 @@ seq(Cenv_t* env) drop(env->disc, e); env->error = (*env->cursor == 0 || *env->cursor == env->delimiter || *env->cursor == env->terminator) ? REG_EPAREN : REG_ENULL; return NULL; - } + } if (token(env) != T_CLOSE) { drop(env->disc, e); env->error = REG_EPAREN; return NULL; - } + } env->parnest--; eat(env); if (!(f = node(env, REX_GROUP, 0, 0, 0))) @@ -3002,7 +3002,7 @@ bmtrie(Cenv_t* env, Rex_t* a, unsigned char* v, Trie_node_t* x, int n, int m, Bm * 2. max length fixed string found -- use BM algorithm * 3. it begins with an unanchored string - use KMP algorithm * 0 returned on success - */ + */ static int special(Cenv_t* env, regex_t* p) @@ -3222,7 +3222,7 @@ special(Cenv_t* env, regex_t* p) } p->env->once = 1; return 0; -} +} int regcomp(regex_t* p, const char* pattern, regflags_t flags) diff --git a/src/lib/libast/regex/regnexec.c b/src/lib/libast/regex/regnexec.c index e2ab174a4af4..7418bb855a1c 100644 --- a/src/lib/libast/regex/regnexec.c +++ b/src/lib/libast/regex/regnexec.c @@ -436,7 +436,7 @@ parserep(Env_t* env, Rex_t* rex, Rex_t* cont, unsigned char* s, int n) { if (matchpush(env, rex)) return BAD; - if (pospush(env, rex, s, BEG_ONE)) + if (pospush(env, rex, s, BEG_ONE)) return BAD; DEBUG_TEST(0x0004,(sfprintf(sfstdout,"AHA#%04d 0x%04x PUSH %d (%z,%z)(%z,%z)(%z,%z) (%z,%z)(%z,%z)(%z,%z)\n", __LINE__, debug_flag, rex->re.group.number, env->best[0].rm_so, env->best[0].rm_eo, env->best[1].rm_so, env->best[1].rm_eo, env->best[2].rm_so, env->best[2].rm_eo, env->match[0].rm_so, env->match[0].rm_eo, env->match[1].rm_so, env->match[1].rm_eo, env->match[2].rm_so, env->match[2].rm_eo)),(0)); } diff --git a/src/lib/libast/sfio/sfcvt.c b/src/lib/libast/sfio/sfcvt.c index 4c8dd946a955..07b342bcbd33 100644 --- a/src/lib/libast/sfio/sfcvt.c +++ b/src/lib/libast/sfio/sfcvt.c @@ -129,7 +129,7 @@ char* _sfcvt(void* vp, /* pointer to value to convert */ { Sfdouble_t f = *(Sfdouble_t*)vp; if(isnanl(f)) - { + { #if _lib_signbit if (signbit(f)) #else @@ -140,7 +140,7 @@ char* _sfcvt(void* vp, /* pointer to value to convert */ } #if _lib_isinf if (n = isinf(f)) - { + { #if _lib_signbit if (signbit(f)) #else @@ -245,7 +245,7 @@ char* _sfcvt(void* vp, /* pointer to value to convert */ } if((ep = (sp+n)) > (endsp = buf+(size-2))) - ep = endsp; + ep = endsp; if(sp > ep) sp = ep; else @@ -279,7 +279,7 @@ char* _sfcvt(void* vp, /* pointer to value to convert */ { double f = *(double*)vp; if(isnan(f)) - { + { #if _lib_signbit if (signbit(f)) #else @@ -290,7 +290,7 @@ char* _sfcvt(void* vp, /* pointer to value to convert */ } #if _lib_isinf if (n = isinf(f)) - { + { #if _lib_signbit if (signbit(f)) #else @@ -393,7 +393,7 @@ char* _sfcvt(void* vp, /* pointer to value to convert */ } if((ep = (sp+n)) > (endsp = buf+(size-2))) - ep = endsp; + ep = endsp; if(sp > ep) sp = ep; else diff --git a/src/lib/libast/sfio/sfhdr.h b/src/lib/libast/sfio/sfhdr.h index ef1d04d98ab6..e4262ef21b98 100644 --- a/src/lib/libast/sfio/sfhdr.h +++ b/src/lib/libast/sfio/sfhdr.h @@ -642,7 +642,7 @@ typedef struct _sftab_ { Sfdouble_t sf_pos10[SFIO_MAXEXP10]; /* positive powers of 10 */ Sfdouble_t sf_neg10[SFIO_MAXEXP10]; /* negative powers of 10 */ uchar sf_dec[200]; /* ASCII reps of values < 100 */ - char* sf_digits; /* digits for general bases */ + char* sf_digits; /* digits for general bases */ int (*sf_cvinitf)(); /* initialization function */ int sf_cvinit; /* initialization state */ Fmtpos_t* (*sf_fmtposf)(Sfio_t*,const char*,va_list,Sffmt_t*,int); diff --git a/src/lib/libast/sfio/sfmode.c b/src/lib/libast/sfio/sfmode.c index 058f764fdf48..677df4614a2a 100644 --- a/src/lib/libast/sfio/sfmode.c +++ b/src/lib/libast/sfio/sfmode.c @@ -51,7 +51,7 @@ static char* Version = "\n@(#)$Id: sfio (AT&T Labs - Research) 2009-09-15 $\0\n" #include #include #define Sfsignal_f Sig_handler_t -static int _Sfsigp = 0; /* # of streams needing SIGPIPE protection */ +static int _Sfsigp = 0; /* # of streams needing SIGPIPE protection */ /* done at exiting time */ static void _sfcleanup(void) @@ -369,7 +369,7 @@ int _sfmode(Sfio_t* f, /* change r/w mode and sync file pointer for this stream /* buffer initialization */ wanted &= SFIO_RDWR; if(f->mode&SFIO_INIT) - { + { if(!f->pool && _sfsetpool(f) < 0) { rv = -1; goto done; diff --git a/src/lib/libast/sfio/sfmove.c b/src/lib/libast/sfio/sfmove.c index b638a5c8ae95..ba770a5c0f81 100644 --- a/src/lib/libast/sfio/sfmove.c +++ b/src/lib/libast/sfio/sfmove.c @@ -30,7 +30,7 @@ Sfoff_t sfmove(Sfio_t* fr, /* moving data from this stream */ Sfio_t* fw, /* moving data to this stream */ - Sfoff_t n, /* number of bytes/records to move. <0 for unbounded move */ + Sfoff_t n, /* number of bytes/records to move. <0 for unbounded move */ int rc) /* record separator */ { uchar *cp, *next; diff --git a/src/lib/libast/sfio/sfpkrd.c b/src/lib/libast/sfio/sfpkrd.c index a205dab4f089..59ae234bc805 100644 --- a/src/lib/libast/sfio/sfpkrd.c +++ b/src/lib/libast/sfio/sfpkrd.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 * * * @@ -203,7 +203,7 @@ ssize_t sfpkrd(int fd, /* file descriptor */ /* successful peek, find the record end */ if(rc >= 0) - { char* sp; + { char* sp; t = action == 0 ? 1 : action < 0 ? -action : action; for(endbuf = (sp = buf)+r; sp < endbuf; ) diff --git a/src/lib/libast/sfio/sfputr.c b/src/lib/libast/sfio/sfputr.c index 6caf41a7fbad..5e6ed2ee3475 100644 --- a/src/lib/libast/sfio/sfputr.c +++ b/src/lib/libast/sfio/sfputr.c @@ -35,7 +35,7 @@ ssize_t sfputr(Sfio_t* f, /* write to this stream */ SFLOCK(f,0); - f->val = sn = -1; ss = (char*)s; + f->val = sn = -1; ss = (char*)s; for(w = 0; (*s || rc >= 0); ) { /* need to communicate string size to exception handler */ if((f->flags&SFIO_STRING) && f->next >= f->endb ) diff --git a/src/lib/libast/sfio/sfread.c b/src/lib/libast/sfio/sfread.c index 25143f4baa51..b82ec913956c 100644 --- a/src/lib/libast/sfio/sfread.c +++ b/src/lib/libast/sfio/sfread.c @@ -112,7 +112,7 @@ ssize_t sfread(Sfio_t* f, /* read from this stream. */ if(r == (ssize_t)n && (r = SFRD(f,s,r,f->disc)) >= 0) { s += r; n -= r; - if(r == 0 || n == 0) /* eof or eob */ + if(r == 0 || n == 0) /* eof or eob */ break; } else goto do_filbuf; diff --git a/src/lib/libast/sfio/sfsetbuf.c b/src/lib/libast/sfio/sfsetbuf.c index 09783b93443b..13c334ab366b 100644 --- a/src/lib/libast/sfio/sfsetbuf.c +++ b/src/lib/libast/sfio/sfsetbuf.c @@ -278,15 +278,15 @@ void* sfsetbuf(Sfio_t* f, /* stream to be buffered */ else /* special case /dev/null */ { int dev, ino; static int null_checked, null_dev, null_ino; - dev = (int)st.st_dev; - ino = (int)st.st_ino; + dev = (int)st.st_dev; + ino = (int)st.st_ino; if(!null_checked) { if(stat(DEVNULL,&st) < 0) null_checked = -1; else { null_checked = 1; - null_dev = (int)st.st_dev; - null_ino = (int)st.st_ino; + null_dev = (int)st.st_dev; + null_ino = (int)st.st_ino; } } if(null_checked >= 0 && dev == null_dev && ino == null_ino) diff --git a/src/lib/libast/sfio/sfswap.c b/src/lib/libast/sfio/sfswap.c index 416849f84361..26206807aef1 100644 --- a/src/lib/libast/sfio/sfswap.c +++ b/src/lib/libast/sfio/sfswap.c @@ -43,7 +43,7 @@ Sfio_t* sfswap(Sfio_t* f1, Sfio_t* f2) f1mode = f1->mode; SFLOCK(f1,0); f1->mode |= SFIO_PUSH; /* make sure there is no recursion on f1 */ - + if(f2) { f2mode = f2->mode; SFLOCK(f2,0); diff --git a/src/lib/libast/sfio/sftable.c b/src/lib/libast/sfio/sftable.c index 9447bc8664b1..a9b05549eb4e 100644 --- a/src/lib/libast/sfio/sftable.c +++ b/src/lib/libast/sfio/sftable.c @@ -27,7 +27,7 @@ */ static char* sffmtint(const char* str, int* v) -{ +{ for(*v = 0; isdigit(*str); ++str) *v = *v * 10 + (*str - '0'); *v -= 1; @@ -263,7 +263,7 @@ static Fmtpos_t* sffmtpos(Sfio_t* f,const char* form,va_list args,Sffmt_t* ft,in size = sizeof(char); else if(flags&SFFMT_TFLAG) size = sizeof(ptrdiff_t); - else if(flags&SFFMT_ZFLAG) + else if(flags&SFFMT_ZFLAG) size = sizeof(size_t); else if(flags&(SFFMT_LLONG|SFFMT_JFLAG) ) size = sizeof(Sflong_t); diff --git a/src/lib/libast/sfio/sftell.c b/src/lib/libast/sfio/sftell.c index 9d56fe958787..64fadd1f830c 100644 --- a/src/lib/libast/sfio/sftell.c +++ b/src/lib/libast/sfio/sftell.c @@ -24,7 +24,7 @@ */ Sfoff_t sftell(Sfio_t* f) -{ +{ int mode; Sfoff_t p; diff --git a/src/lib/libast/sfio/sftmp.c b/src/lib/libast/sfio/sftmp.c index a74ba03dd020..6c4d97b97861 100644 --- a/src/lib/libast/sfio/sftmp.c +++ b/src/lib/libast/sfio/sftmp.c @@ -34,7 +34,7 @@ ** Written by David Korn and Kiem-Phong Vo. */ -#if _tmp_rmfail +#if _tmp_rmfail /* File not removable while there is an open file descriptor. ** To ensure that temp files are properly removed, we need: @@ -234,9 +234,9 @@ Sfio_t* sftmp(size_t s) Sfio_t *f; int rv; Sfnotify_f notify = _Sfnotify; - static Sfdisc_t Tmpdisc = + static Sfdisc_t Tmpdisc = { NULL, NULL, NULL, _tmpexcept, -#if _tmp_rmfail +#if _tmp_rmfail &Rmdisc #else NULL diff --git a/src/lib/libast/sfio/sfungetc.c b/src/lib/libast/sfio/sfungetc.c index 1829a87db417..e1bf2912a4b2 100644 --- a/src/lib/libast/sfio/sfungetc.c +++ b/src/lib/libast/sfio/sfungetc.c @@ -24,7 +24,7 @@ ** Written by Kiem-Phong Vo. */ static int _uexcept(Sfio_t* f, int type, void* val, Sfdisc_t* disc) -{ +{ NOT_USED(val); /* hmm! This should never happen */ diff --git a/src/lib/libast/sfio/sfvprintf.c b/src/lib/libast/sfio/sfvprintf.c index 6628f3072332..51f5495b663a 100644 --- a/src/lib/libast/sfio/sfvprintf.c +++ b/src/lib/libast/sfio/sfvprintf.c @@ -480,7 +480,7 @@ loop_fmt : size = sizeof(char); else if(flags&SFFMT_TFLAG) size = sizeof(ptrdiff_t); - else if(flags&SFFMT_ZFLAG) + else if(flags&SFFMT_ZFLAG) size = sizeof(size_t); else if(flags&(SFFMT_LLONG|SFFMT_JFLAG) ) size = sizeof(Sflong_t); @@ -758,13 +758,13 @@ loop_fmt : } } if(n < 0 && (flags & SFFMT_CHOP) && width > 0 && precis < 0) - { + { #if _has_multibyte if(flags & SFFMT_LONG) { SFMBCLR(&mbs); wsp = (wchar_t*)sp; while(n < 0) - { + { int wd; if ((wd = mbwidth(*wsp)) > 0) n += wd; @@ -1246,7 +1246,7 @@ loop_fmt : { if((n = decpt - 1) < 0) n = -n; while(n > 9) - { v = n; n /= 10; + { v = n; n /= 10; *--ep = (char)('0' + (v - n*10)); } } diff --git a/src/lib/libast/sfio/sfvscanf.c b/src/lib/libast/sfio/sfvscanf.c index 7b14c60f2c33..4dfd42eaea4e 100644 --- a/src/lib/libast/sfio/sfvscanf.c +++ b/src/lib/libast/sfio/sfvscanf.c @@ -494,7 +494,7 @@ int sfvscanf(Sfio_t* f, /* file to be scanned */ goto dot_set; } else goto loop_flags; - + case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : dot_size : @@ -592,7 +592,7 @@ int sfvscanf(Sfio_t* f, /* file to be scanned */ size = sizeof(char); else if(flags&SFFMT_TFLAG) size = sizeof(ptrdiff_t); - else if(flags&SFFMT_ZFLAG) + else if(flags&SFFMT_ZFLAG) size = sizeof(size_t); else if(flags&(SFFMT_LLONG|SFFMT_JFLAG) ) size = sizeof(Sflong_t); @@ -928,7 +928,7 @@ int sfvscanf(Sfio_t* f, /* file to be scanned */ goto do_string; } else if(fmt == 's' || fmt == 'c' || fmt == '[' ) - { do_string: + { do_string: if(value) { if(size < 0) size = MAXWIDTH; diff --git a/src/lib/libast/stdio/fgets.c b/src/lib/libast/stdio/fgets.c index 959eb26d087c..958dba6bf811 100644 --- a/src/lib/libast/stdio/fgets.c +++ b/src/lib/libast/stdio/fgets.c @@ -33,7 +33,7 @@ _stdgets(Sfio_t* f, char* us, int n, int isgets) n -= 1; is = (uchar*)us; - + while(n) { /* peek the read buffer for data */ if((p = f->endb - (ps = f->next)) <= 0 ) diff --git a/src/lib/libast/stdio/setvbuf.c b/src/lib/libast/stdio/setvbuf.c index 4bc3cc44782b..f2a80b7db85c 100644 --- a/src/lib/libast/stdio/setvbuf.c +++ b/src/lib/libast/stdio/setvbuf.c @@ -27,12 +27,12 @@ setvbuf(Sfio_t* f, char* buf, int type, size_t size) else if (f->flags & SFIO_STRING) return -1; else if (type == _IONBF) - { + { sfsync(f); sfsetbuf(f, NULL, 0); } else if (type == _IOFBF) - { + { if (size == 0) size = SFIO_BUFSIZE; sfsync(f); diff --git a/src/lib/libast/stdio/vsnprintf.c b/src/lib/libast/stdio/vsnprintf.c index 6d3e99e10306..61a7dcd52ba8 100644 --- a/src/lib/libast/stdio/vsnprintf.c +++ b/src/lib/libast/stdio/vsnprintf.c @@ -27,7 +27,7 @@ vsnprintf(char* s, int n, const char* form, va_list args) /* make a temp stream */ if(!(f = sfnew(NULL,NULL,(size_t)SFIO_UNBOUND, - -1,SFIO_WRITE|SFIO_STRING)) ) + -1,SFIO_WRITE|SFIO_STRING)) ) return -1; if((rv = sfvprintf(f,form,args)) >= 0 ) diff --git a/src/lib/libast/string/fmtip6.c b/src/lib/libast/string/fmtip6.c index eb0934696b4b..750cedecd472 100644 --- a/src/lib/libast/string/fmtip6.c +++ b/src/lib/libast/string/fmtip6.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 * * * @@ -21,7 +21,7 @@ #include #include -/* +/* * copy p to s, then convert 0<=n<=999 to text * next char in s returned * caller ensures that s can take strlen(p)+3 bytes diff --git a/src/lib/libast/string/strexpr.c b/src/lib/libast/string/strexpr.c index 7942df8c9017..3fdd5a6e12ef 100644 --- a/src/lib/libast/string/strexpr.c +++ b/src/lib/libast/string/strexpr.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 * * * @@ -64,7 +64,7 @@ seterror(Expr_t* ex, char* msg) return 0; } -/* +/* * evaluate a subexpression with precedence */ diff --git a/src/lib/libast/string/strtoi.h b/src/lib/libast/string/strtoi.h index 25df859a6bc3..546195f41b0b 100644 --- a/src/lib/libast/string/strtoi.h +++ b/src/lib/libast/string/strtoi.h @@ -65,7 +65,7 @@ * * qualifier: [lL] * [uU] - * [uU][lL] + * [uU][lL] * [lL][uU] * [lL][lL][uU] * [uU][lL][lL] @@ -373,7 +373,7 @@ S2I_function(const char* a, char** e, int base) SFCVINIT(); cv = base <= 36 ? _Sfcv36 : _Sfcv64; if ((base & ~(base - 1)) == base) - { + { #if !S2I_unsigned qualifier |= QU; #endif diff --git a/src/lib/libast/string/tokline.c b/src/lib/libast/string/tokline.c index ba7d4094379a..5eed4f3f45e3 100644 --- a/src/lib/libast/string/tokline.c +++ b/src/lib/libast/string/tokline.c @@ -143,7 +143,7 @@ spliceline(Sfio_t* s, int op, void* val, Sfdisc_t* ad) /* * open a stream to parse lines * - * flags: 0 arg: open Sfio_t* + * flags: 0 arg: open Sfio_t* * flags: SFIO_READ arg: file name * flags: SFIO_STRING arg: null-terminated char* * diff --git a/src/lib/libast/tm/tmlex.c b/src/lib/libast/tm/tmlex.c index 0b17b3ef7d52..bf3ecd2ac81d 100644 --- a/src/lib/libast/tm/tmlex.c +++ b/src/lib/libast/tm/tmlex.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 * * * @@ -35,7 +35,7 @@ * -1 for 0 sentinel * * all isalpha() chars in str must match - * suf is a table of nsuf valid str suffixes + * suf is a table of nsuf valid str suffixes * if e is non-null then it will point to first unmatched char in str * which will always be non-isalpha() */ diff --git a/src/lib/libast/tm/tmxdate.c b/src/lib/libast/tm/tmxdate.c index f5eced5240b3..ae6d56df77ba 100644 --- a/src/lib/libast/tm/tmxdate.c +++ b/src/lib/libast/tm/tmxdate.c @@ -1225,7 +1225,7 @@ tmxdate(const char* s, char** e, Time_t now) continue; case TM_NEXT: /* - * disambiguate english "last ... in" + * disambiguate english "last ... in" */ if (!((state|set) & LAST)) diff --git a/src/lib/libast/tm/tmxfmt.c b/src/lib/libast/tm/tmxfmt.c index fca2b5aacec7..873d2aafae63 100644 --- a/src/lib/libast/tm/tmxfmt.c +++ b/src/lib/libast/tm/tmxfmt.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 * * * @@ -433,12 +433,12 @@ tmxfmt(char* buf, size_t len, const char* format, Time_t t) } if (!n) break; - + /* * right, the global state stinks * but we respect its locale-like status */ - + if (c == '+') { if (!(flags & n)) diff --git a/src/lib/libcmd/basename.c b/src/lib/libcmd/basename.c index b4479ff873ea..e6880528297c 100644 --- a/src/lib/libcmd/basename.c +++ b/src/lib/libcmd/basename.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 * * * @@ -54,8 +54,8 @@ static const char usage[] = "\n" "[+EXIT STATUS?]" "{" - "[+0?Successful completion.]" - "[+>0?An error occurred.]" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bdirname\b(1), \bgetconf\b(1), \bbasename\b(3)]" ; diff --git a/src/lib/libcmd/cmp.c b/src/lib/libcmd/cmp.c index 670f9210d4c5..041ab8f886f3 100644 --- a/src/lib/libcmd/cmp.c +++ b/src/lib/libcmd/cmp.c @@ -65,9 +65,9 @@ static const char usage[] = "\n" "[+EXIT STATUS?]" "{" - "[+0?The files or portions compared are identical.]" - "[+1?The files are different.]" - "[+>1?An error occurred.]" + "[+0?The files or portions compared are identical.]" + "[+1?The files are different.]" + "[+>1?An error occurred.]" "}" "[+SEE ALSO?\bcomm\b(1), \bdiff\b(1), \bcat\b(1)]" ; diff --git a/src/lib/libcmd/comm.c b/src/lib/libcmd/comm.c index 084b626270a2..b3cef8199bbf 100644 --- a/src/lib/libcmd/comm.c +++ b/src/lib/libcmd/comm.c @@ -37,7 +37,7 @@ static const char usage[] = "[+?If lines in either file are not ordered according to the collating " "sequence of the current locale, the results are not specified.]" "[+?If either \afile1\a or \afile2\a is \b-\b, \bcomm\b " - "uses standard input starting at the current location.]" + "uses standard input starting at the current location.]" "[1?Suppress the output column of lines unique to \afile1\a.]" "[2?Suppress the output column of lines unique to \afile2\a.]" diff --git a/src/lib/libcmd/cp.c b/src/lib/libcmd/cp.c index 36c1b55632fb..a8cb81280453 100644 --- a/src/lib/libcmd/cp.c +++ b/src/lib/libcmd/cp.c @@ -41,10 +41,10 @@ static const char usage_cp[] = "\b--preserve\b \b--recursive\b.]" "[A:attributes?Preserve selected file attributes:]:[eipt]" "{" - "[+e?Everything permissible.]" - "[+i?Owner UID and GID.]" - "[+p?Permissions.]" - "[+t?Access and modify times.]" + "[+e?Everything permissible.]" + "[+i?Owner UID and GID.]" + "[+p?Permissions.]" + "[+t?Access and modify times.]" "}" "[p:preserve?Preserve file owner, group, permissions and timestamps.]" "[h:hierarchy|parents?Form the name of each destination file by " @@ -100,13 +100,13 @@ static const char usage_tail[] = "this order: this option, the \bVERSION_CONTROL\b environment variable, " "or the default value \bexisting\b. \atype\a may be one of:]:?[type]" "{" - "[+numbered|t?Always make numbered backups. The numbered backup " - "suffix is \b.\aSNS\a, where \aS\a is the \bbackup-suffix\b and " - "\aN\a is the version number, starting at 1, incremented with " - "each version.]" - "[+existing|nil?Make numbered backups of files that already have " - "them, otherwise simple backups.]" - "[+simple|never?Always make simple backups.]" + "[+numbered|t?Always make numbered backups. The numbered backup " + "suffix is \b.\aSNS\a, where \aS\a is the \bbackup-suffix\b and " + "\aN\a is the version number, starting at 1, incremented with " + "each version.]" + "[+existing|nil?Make numbered backups of files that already have " + "them, otherwise simple backups.]" + "[+simple|never?Always make simple backups.]" "[+none|off?Disable backups.]" "}" "[S:suffix?A backup file is made by renaming the file to the same name " @@ -451,7 +451,7 @@ visit(State_t* state, FTSENT* ent) { protection = #ifdef ETXTBSY - errno == ETXTBSY ? "``running program''" : + errno == ETXTBSY ? "``running program''" : #endif st.st_uid != state->uid ? "``not owner''" : fmtmode(st.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO), 0) + 1; diff --git a/src/lib/libcmd/cut.c b/src/lib/libcmd/cut.c index 90c0cec4a6d0..3c6b2243c18d 100644 --- a/src/lib/libcmd/cut.c +++ b/src/lib/libcmd/cut.c @@ -42,8 +42,8 @@ static const char usage[] = "output is that of the input.]" "[+?One and only one of \b-b\b, \b-c\b, or \b-f\b must be specified.]" "[+?If no \afile\a is given, or if the \afile\a is \b-\b, \bcut\b " - "cuts from standard input. The start of the file is defined " - "as the current offset.]" + "cuts from standard input. The start of the file is defined " + "as the current offset.]" "[b:bytes]:[list?\bcut\b based on a list of byte counts.]" "[c:characters]:[list?\bcut\b based on a list of character counts.]" "[d:delimiter]:[delim?The field character for the \b-f\b option is set " @@ -328,7 +328,7 @@ cutcols(Cut_t* cut, Sfio_t* fdin, Sfio_t* fdout) z = 1; s += z; w -= z; - + } c = s - bp; ncol = !w && (ncol || !skip); @@ -519,7 +519,7 @@ cutfields(Cut_t* cut, Sfio_t* fdin, Sfio_t* fdout) if (!sp[lastchar]) break; } - nodelim = 0; + nodelim = 0; if (--nfields > 0) continue; nfields = *++lp; diff --git a/src/lib/libcmd/date.c b/src/lib/libcmd/date.c index 9957db3ec3d3..77fc0758c715 100644 --- a/src/lib/libcmd/date.c +++ b/src/lib/libcmd/date.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 * * * @@ -171,9 +171,9 @@ static const char usage[] = "[T:rfc-3339?List date and time in RFC 3339 format according to " "\atype\a:]:[type]" "{" - "[d:date?(%Y-%m-%d)]" - "[s:seconds?(%Y-%m-%d %H:%M:%S%_z)]" - "[n:ns|nanoseconds?(%Y-%m-%d %H:%M:%S.%N%_z)]" + "[d:date?(%Y-%m-%d)]" + "[s:seconds?(%Y-%m-%d %H:%M:%S%_z)]" + "[n:ns|nanoseconds?(%Y-%m-%d %H:%M:%S.%N%_z)]" "}" "[s:show?Show the date without setting the system time.]" "[u:utc|gmt|zulu|universal?Output dates in \acoordinated universal time\a (UTC).]" diff --git a/src/lib/libcmd/dirname.c b/src/lib/libcmd/dirname.c index 242aeba91878..d2c83f8ecbc4 100644 --- a/src/lib/libcmd/dirname.c +++ b/src/lib/libcmd/dirname.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 * * * @@ -44,7 +44,7 @@ static const char usage[] = "the output will be as if the original string had consisted solely " "as \b/\b characters as described above. Otherwise, all " "trailing slashes are removed and the output will be this string " - "unless this string is empty. If empty the output will be \b.\b.]" + "unless this string is empty. If empty the output will be \b.\b.]" "[f:file?Print the \b$PATH\b relative regular file path for \astring\a.]" "[r:relative?Print the \b$PATH\b relative readable file path for \astring\a.]" "[x:executable?Print the \b$PATH\b relative executable file path for \astring\a.]" @@ -52,8 +52,8 @@ static const char usage[] = "\nstring\n" "\n" "[+EXIT STATUS?]{" - "[+0?Successful completion.]" - "[+>0?An error occurred.]" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bbasename\b(1), \bgetconf\b(1), \bdirname\b(3), \bpathname\b(3)]" ; diff --git a/src/lib/libcmd/fold.c b/src/lib/libcmd/fold.c index a998648f60a1..8c1a0fb9fada 100644 --- a/src/lib/libcmd/fold.c +++ b/src/lib/libcmd/fold.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 * * * @@ -47,8 +47,8 @@ static const char usage[] = "column position \an\a, where \an\a modulo 8 equals 1.]" "}" "[+?If no \afile\a is given, or if the \afile\a is \b-\b, \bfold\b " - "reads from standard input. The start of the file is defined " - "as the current offset.]" + "reads from standard input. The start of the file is defined " + "as the current offset.]" "[b:bytes?Count bytes rather than columns so that each carriage-return, " "backspace, and tab counts as 1.]" @@ -98,7 +98,7 @@ static void fold(Sfio_t *in, Sfio_t *out, int width, const char *cont, size_t co x = cp[--n]; cp[n] = '\n'; } - /* special case -b since no column adjustment is needed */ + /* special case -b since no column adjustment is needed */ if(cols['\b']==0 && (n=sfvalue(in))<=width) { sfwrite(out,cp,n); @@ -133,7 +133,7 @@ static void fold(Sfio_t *in, Sfio_t *out, int width, const char *cont, size_t co col = 0; continue; case T_BS: - if((cp+(--col)-first)>0) + if((cp+(--col)-first)>0) col--; continue; case T_TAB: diff --git a/src/lib/libcmd/getconf.c b/src/lib/libcmd/getconf.c index 460fbc04d311..ab25e8528ec4 100644 --- a/src/lib/libcmd/getconf.c +++ b/src/lib/libcmd/getconf.c @@ -103,15 +103,15 @@ static const char usage[] = "[+ENVIRONMENT]" "{" - "[+_AST_FEATURES?Process local writable values that are " - "different from the default are stored in the \b_AST_FEATURES\b " - "environment variable. The \b_AST_FEATURES\b value is a " - "space-separated list of \aname\a \apath\a \avalue\a 3-tuples, " - "where \aname\a is the system configuration name, \apath\a is " - "the corresponding path, \b-\b if no path is applicable, and " - "\avalue\a is the system configuration value. \b_AST_FEATURES\b " - "is an implementation detail of process inheritance; it may " - "change or vanish in the future; don't rely on it.]" + "[+_AST_FEATURES?Process local writable values that are " + "different from the default are stored in the \b_AST_FEATURES\b " + "environment variable. The \b_AST_FEATURES\b value is a " + "space-separated list of \aname\a \apath\a \avalue\a 3-tuples, " + "where \aname\a is the system configuration name, \apath\a is " + "the corresponding path, \b-\b if no path is applicable, and " + "\avalue\a is the system configuration value. \b_AST_FEATURES\b " + "is an implementation detail of process inheritance; it may " + "change or vanish in the future; don't rely on it.]" "}" "[+SEE ALSO?\bpathchk\b(1), \bconfstr\b(3), \bpathconf\b(2)," " \bsysconf\b(3), \bastgetconf\b(3)]" diff --git a/src/lib/libcmd/head.c b/src/lib/libcmd/head.c index 73231ca3d61b..ad7b699b2f76 100644 --- a/src/lib/libcmd/head.c +++ b/src/lib/libcmd/head.c @@ -59,8 +59,8 @@ static const char usage[] = "\n\n" "[+EXIT STATUS?]" "{" - "[+0?All files copied successfully.]" - "[+>0?One or more files did not copy.]" + "[+0?All files copied successfully.]" + "[+>0?One or more files did not copy.]" "}" "[+SEE ALSO?\bcat\b(1), \btail\b(1)]" ; diff --git a/src/lib/libcmd/id.c b/src/lib/libcmd/id.c index 0f381a888e99..aa3880a8a22f 100644 --- a/src/lib/libcmd/id.c +++ b/src/lib/libcmd/id.c @@ -50,8 +50,8 @@ static const char usage[] = "\n[user]\n" "\n" "[+EXIT STATUS?]{" - "[+0?Successful completion.]" - "[+>0?An error occurred.]" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\blogname\b(1), \bwho\b(1), \bgetgroups\b(2)]" ; @@ -265,14 +265,14 @@ getids(Sfio_t* sp, const char* name, int flags) { setfsgent(); do - { - if (!(fs = getfsgnam(name))) + { + if (!(fs = getfsgnam(name))) { - error(ERROR_exit(1), "%u: fss name not found", name); + error(ERROR_exit(1), "%u: fss name not found", name); UNREACHABLE(); } - } while (isfsg(fs)); - fs_id = fs->fs_id; + } while (isfsg(fs)); + fs_id = fs->fs_id; } #endif } diff --git a/src/lib/libcmd/join.c b/src/lib/libcmd/join.c index ec8653a959ab..38ece28a9c79 100644 --- a/src/lib/libcmd/join.c +++ b/src/lib/libcmd/join.c @@ -46,7 +46,7 @@ static const char usage[] = "sequence of \bsort -b\b on the fields on which they are to be " "joined otherwise the results are unspecified.]" "[+?If either \afile1\a or \afile2\a is \b-\b, \bjoin\b " - "uses standard input starting at the current location.]" + "uses standard input starting at the current location.]" "[e:empty]:[string?Replace empty output fields in the list selected with" " \b-o\b with \astring\a.]" @@ -322,7 +322,7 @@ getrec(Join_t* jp, int index, int discard) else do /* separate into fields */ { - if (field >= fieldmax) + if (field >= fieldmax) { n = 2 * fp->maxfields; fp->fields = newof(fp->fields, Field_t, n + 1, 0); diff --git a/src/lib/libcmd/logname.c b/src/lib/libcmd/logname.c index b134997010d2..ce2e59276ed3 100644 --- a/src/lib/libcmd/logname.c +++ b/src/lib/libcmd/logname.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 * * * @@ -37,8 +37,8 @@ static const char usage[] = "\n\n" "\n" "[+EXIT STATUS?]{" - "[+0?Successful completion.]" - "[+>0?An error occurred.]" + "[+0?Successful completion.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bgetlogin\b(2)]" ; diff --git a/src/lib/libcmd/mkdir.c b/src/lib/libcmd/mkdir.c index 4c9219be76ac..1219f31fcd32 100644 --- a/src/lib/libcmd/mkdir.c +++ b/src/lib/libcmd/mkdir.c @@ -46,9 +46,9 @@ static const char usage[] = "\ndirectory ...\n" "\n" "[+EXIT STATUS?]{" - "[+0?All directories created successfully, or the \b-p\b option " + "[+0?All directories created successfully, or the \b-p\b option " "was specified and all the specified directories now exist.]" - "[+>0?An error occurred.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bchmod\b(1), \brmdir\b(1), \bumask\b(1)]" ; diff --git a/src/lib/libcmd/mkfifo.c b/src/lib/libcmd/mkfifo.c index 99dabfdbaca1..ff718bfdaae6 100644 --- a/src/lib/libcmd/mkfifo.c +++ b/src/lib/libcmd/mkfifo.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 * * * @@ -37,8 +37,8 @@ static const char usage[] = "\nfile ...\n" "\n" "[+EXIT STATUS?]{" - "[+0?All FIFOs created successfully.]" - "[+>0?One or more FIFOs could not be created.]" + "[+0?All FIFOs created successfully.]" + "[+>0?One or more FIFOs could not be created.]" "}" "[+SEE ALSO?\bchmod\b(1), \bumask\b(1)]" ; diff --git a/src/lib/libcmd/mktemp.c b/src/lib/libcmd/mktemp.c index 80287997da68..9dddf5abb8bd 100644 --- a/src/lib/libcmd/mktemp.c +++ b/src/lib/libcmd/mktemp.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 * * * @@ -29,10 +29,10 @@ static const char usage[] = "will have mode \brwx------\b, subject to \bumask\b(1). Generated paths " "have these attributes:]" "{" - "[+*?Lower case to avoid clashes on case ignorant filesystems.]" - "[+*?Pseudo-random part to deter denial of service attacks.]" - "[+*?Default pseudo-random part (no specific \bX...\b template) " - "formatted to accommodate 8.3 filesystems.]" + "[+*?Lower case to avoid clashes on case ignorant filesystems.]" + "[+*?Pseudo-random part to deter denial of service attacks.]" + "[+*?Default pseudo-random part (no specific \bX...\b template) " + "formatted to accommodate 8.3 filesystems.]" "}" "[+?A consecutive trailing sequence of \bX\b's in \aprefix\a is replaced " "by the pseudo-random part. If there are no \bX\b's then the " diff --git a/src/lib/libcmd/paste.c b/src/lib/libcmd/paste.c index 1259c9dc7339..0f2a3b1d186b 100644 --- a/src/lib/libcmd/paste.c +++ b/src/lib/libcmd/paste.c @@ -148,7 +148,7 @@ static int spaste(Sfio_t *in,Sfio_t* out,const char *delim,int dsiz,int dlen,Del int d=0; if((cp = sfgetr(in,'\n',0)) && sfwrite(out,cp,sfvalue(in)-1) < 0) return -1; - while(cp=sfgetr(in, '\n',0)) + while(cp=sfgetr(in, '\n',0)) { if(dlen) { diff --git a/src/lib/libcmd/pathchk.c b/src/lib/libcmd/pathchk.c index 5b1c6058a48b..ef4bc3433f4b 100644 --- a/src/lib/libcmd/pathchk.c +++ b/src/lib/libcmd/pathchk.c @@ -35,28 +35,28 @@ static const char usage[] = "based on the underlying file system. A diagnostic is written to " "standard error for each pathname that:]" "{" - "[+-?Is longer than \b$(getconf PATH_MAX)\b bytes.]" - "[+-?Contains any component longer than \b$(getconf NAME_MAX)\b " - "bytes.]" - "[+-?Contains any directory component in a directory that is not " - "searchable.]" - "[+-?Contains any character in any component that is not valid " - "in its containing directory.]" - "[+-?Is empty.]" + "[+-?Is longer than \b$(getconf PATH_MAX)\b bytes.]" + "[+-?Contains any component longer than \b$(getconf NAME_MAX)\b " + "bytes.]" + "[+-?Contains any directory component in a directory that is not " + "searchable.]" + "[+-?Contains any character in any component that is not valid " + "in its containing directory.]" + "[+-?Is empty.]" "}" "[p:components?Instead of performing length checks on the underlying " "file system, write a diagnostic for each pathname operand that:]" "{" - "[+-?Is longer than \b$(getconf _POSIX_PATH_MAX)\b bytes.]" - "[+-?Contains any component longer than \b$(getconf " - "_POSIX_NAME_MAX)\b bytes.]" - "[+-?Contains any character in any component that is not in the " - "portable filename character set.]" + "[+-?Is longer than \b$(getconf _POSIX_PATH_MAX)\b bytes.]" + "[+-?Contains any component longer than \b$(getconf " + "_POSIX_NAME_MAX)\b bytes.]" + "[+-?Contains any character in any component that is not in the " + "portable filename character set.]" "}" "[P:path?Write a diagnostic for each pathname operand that:]" "{" - "[+-?Contains any component with \b-\b as the first character.]" - "[+-?Is empty.]" + "[+-?Contains any component with \b-\b as the first character.]" + "[+-?Is empty.]" "}" "[a:all|portability?Equivalent to \b--components\b \b--path\b.]" "\n" @@ -64,8 +64,8 @@ static const char usage[] = "\n" "[+EXIT STATUS?]" "{" - "[+0?All \apathname\a operands passed all of the checks.]" - "[+>0?An error occurred.]" + "[+0?All \apathname\a operands passed all of the checks.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bgetconf\b(1), \bcreat\b(2), \bpathchk\b(2)]" ; @@ -88,7 +88,7 @@ static const char usage[] = /* * call pathconf and handle unlimited sizes - */ + */ static long mypathconf(const char *path, int op) { long r; diff --git a/src/lib/libcmd/pids.c b/src/lib/libcmd/pids.c index c37979b5f010..df4532155282 100644 --- a/src/lib/libcmd/pids.c +++ b/src/lib/libcmd/pids.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 * * * @@ -33,11 +33,11 @@ static const char usage[] = "%[-+]][\awidth\a[.\aprecis\a[.\abase\a]]]]]](\aid\a)\achar\a. The " "supported \aid\as are:]:[format:=" FORMAT "]" "{" - "[+pid?The process ID.]" - "[+pgid?The process group ID.]" - "[+ppid?The parent process ID.]" - "[+tid|tty?The controlling terminal ID.]" - "[+sid?The session ID.]" + "[+pid?The process ID.]" + "[+pgid?The process group ID.]" + "[+ppid?The parent process ID.]" + "[+tid|tty?The controlling terminal ID.]" + "[+sid?The session ID.]" "}" "[+SEE ALSO?\bgetpid\b(2), \bgetppid\b(2), \bgetpgrp\b(2), " "\btcgetpgrp\b(3), \bgetsid\b(2)]" diff --git a/src/lib/libcmd/rev.c b/src/lib/libcmd/rev.c index b3c543ec761c..290dcd3fac7e 100644 --- a/src/lib/libcmd/rev.c +++ b/src/lib/libcmd/rev.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 * * * @@ -35,15 +35,15 @@ static const char usage[] = "reversing the order of characters on every line of the file " "or reversing the order of lines of the file if \b-l\b is specified.]" "[+?If no \afile\a is given, or if the \afile\a is \b-\b, \brev\b " - "copies from standard input starting at the current offset.]" + "copies from standard input starting at the current offset.]" "[l:line?Reverse the lines of the file.]" "\n" "\n[file ...]\n" "\n" "[+EXIT STATUS?]{" - "[+0?All files copied successfully.]" - "[+>0?One or more files did not copy.]" + "[+0?All files copied successfully.]" + "[+>0?One or more files did not copy.]" "}" "[+SEE ALSO?\bcat\b(1), \btail\b(1)]" ; diff --git a/src/lib/libcmd/rm.c b/src/lib/libcmd/rm.c index 7db4111f4d51..3cff071ac5f0 100644 --- a/src/lib/libcmd/rm.c +++ b/src/lib/libcmd/rm.c @@ -263,7 +263,7 @@ rm(State_t* state, FTSENT* ent) { if ((v = astquery(-1, "override protection %s for %s? ", #ifdef ETXTBSY - errno == ETXTBSY ? "``running program''" : + errno == ETXTBSY ? "``running program''" : #endif ent->fts_statp->st_uid != state->uid ? "``not owner''" : fmtmode(ent->fts_statp->st_mode & S_IPERM, 0) + 1, ent->fts_path)) < 0 || diff --git a/src/lib/libcmd/rmdir.c b/src/lib/libcmd/rmdir.c index 71ef29d4e170..6f8611b127ab 100644 --- a/src/lib/libcmd/rmdir.c +++ b/src/lib/libcmd/rmdir.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 * * * @@ -42,8 +42,8 @@ static const char usage[] = "\ndirectory ...\n" "\n" "[+EXIT STATUS?]{" - "[+0?All directories deleted successfully.]" - "[+>0?One or more directories could not be deleted.]" + "[+0?All directories deleted successfully.]" + "[+>0?One or more directories could not be deleted.]" "}" "[+SEE ALSO?\bmkdir\b(1), \brm\b(1), \brmdir\b(2), \bunlink\b(2)]" ; diff --git a/src/lib/libcmd/stty.c b/src/lib/libcmd/stty.c index 1c2f15ba2d30..a6f760cddd4b 100644 --- a/src/lib/libcmd/stty.c +++ b/src/lib/libcmd/stty.c @@ -50,9 +50,9 @@ static const char usage[] = "{\fabc\f}" "[+EXIT STATUS?]" "{" - "[+0?All modes reported or set successfully.]" - "[+>0?Standard input not a terminal or one or more modes " - "failed.]" + "[+0?All modes reported or set successfully.]" + "[+>0?Standard input not a terminal or one or more modes " + "failed.]" "}" "[+SEE ALSO?\btegetattr\b(2), \btcsetattr\b(2), \bioctl\b(2)]" ; @@ -121,7 +121,7 @@ typedef struct tty_s unsigned long mask; unsigned long val; const char description[76]; -} Tty_t; +} Tty_t; static const Tty_t Ttable[] = { @@ -189,7 +189,7 @@ static const Tty_t Ttable[] = #ifdef VLNEXT { "lnext", CHAR, T_CHAR, NL|SS, VLNEXT, 'V', C("Enter the next input character literally") }, #endif /* VLNEXT */ - + #if _mem_c_line_termios { "line", NUM, C_LINE, 0, 0, 0, C("Line discipline number") }, #endif @@ -215,7 +215,7 @@ static const Tty_t Ttable[] = { "crtscts", BIT, C_FLAG, 0, CRTSCTS, CRTSCTS, C("Enable (disable) RTS/CTS handshaking") }, #endif /* CRTSCTS */ { "clocal", BIT, C_FLAG, NL, CLOCAL, CLOCAL, C("Disable (enable) modem control signals") }, - + { "ignbrk", BIT, I_FLAG, US, IGNBRK, IGNBRK, C("Ignore (do not ignore) break characters") }, { "brkint", BIT, I_FLAG, SS, BRKINT, BRKINT, C("Generate (do not generate) INTR signal on break") }, { "ignpar", BIT, I_FLAG, 0, IGNPAR, IGNPAR, C("Ignore (do not ignore) characters with parity errors") }, @@ -237,7 +237,7 @@ static const Tty_t Ttable[] = { "imaxbel", BIT, I_FLAG, SS, IMAXBEL, IMAXBEL, C("Beep (do not beep) if a character arrives with full input buffer") }, #endif /* IMAXBEL */ { "icrnl", BIT, I_FLAG, NL|SS, ICRNL, ICRNL, C("Translate (do not translate) carriage return to newline") }, - + { "isig", BIT, L_FLAG, SS, ISIG, ISIG, C("Enable (disable) \bintr\b, \bquit\b, and \bsusp\b special characters") }, { "icanon", BIT, L_FLAG, SS, ICANON, ICANON, C("Enable (disable) \berase\b, \bkill\b, \bwerase\b, and \brprnt\b special characters") }, { "icannon", BIT, L_FLAG, SS, ICANON, ICANON }, @@ -336,7 +336,7 @@ static const Tty_t Ttable[] = { "ff1", BITS, O_FLAG, US, FFDLY, FF1 }, #endif { "", MIXED, O_FLAG, NL|IG }, - + { "evenp", MIXED, C_FLAG, IG, PARENB, 0, C("Same as \bparenb -parodd cs7\b") }, { "oddp", MIXED, C_FLAG, IG, PARODD, 0, C("Same as \bparenb parodd cs7\b") }, { "parity", MIXED, C_FLAG, IG, 0, 0, C("Same as parenb \b-parodd cs7\b") }, diff --git a/src/lib/libcmd/sync.c b/src/lib/libcmd/sync.c index dc6b759a704e..31535205a559 100644 --- a/src/lib/libcmd/sync.c +++ b/src/lib/libcmd/sync.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 * * * @@ -38,8 +38,8 @@ static const char usage[] = "use them if possible.]" "[+EXIT STATUS?]" "{" - "[+0?\bsync\b(2) returned.]" - "[+>0?Option/operand syntax error.]" + "[+0?\bsync\b(2) returned.]" + "[+>0?Option/operand syntax error.]" "}" "[+SEE ALSO?\bsync\b(2), \bshutdown\b(8)]" ; diff --git a/src/lib/libcmd/tail.c b/src/lib/libcmd/tail.c index d702d1944708..2f345fc6608c 100644 --- a/src/lib/libcmd/tail.c +++ b/src/lib/libcmd/tail.c @@ -250,14 +250,14 @@ pipetail(Sfio_t* infile, Sfio_t* outfile, Sfoff_t number, int delim) if (offset[fno]) { sfseek(tmp[1], 0, SEEK_SET); - if ((n = number - nleft) > 0) - sfmove(tmp[!fno], NULL, n, delim); + if ((n = number - nleft) > 0) + sfmove(tmp[!fno], NULL, n, delim); if ((n = offset[!fno] - sftell(tmp[!fno])) > 0) - sfmove(tmp[!fno], outfile, n, -1); + sfmove(tmp[!fno], outfile, n, -1); } else fno = !fno; - sfmove(tmp[fno], outfile, offset[fno], -1); + sfmove(tmp[fno], outfile, offset[fno], -1); sfclose(tmp[0]); sfclose(tmp[1]); } diff --git a/src/lib/libcmd/tee.c b/src/lib/libcmd/tee.c index 6eaedc677f11..512ec7ebf446 100644 --- a/src/lib/libcmd/tee.c +++ b/src/lib/libcmd/tee.c @@ -43,8 +43,8 @@ static const char usage[] = "\n[file ...]\n" "\n" "[+EXIT STATUS?]{" - "[+0?All files copies successfully.]" - "[+>0?An error occurred.]" + "[+0?All files copies successfully.]" + "[+>0?An error occurred.]" "}" "[+SEE ALSO?\bcat\b(1), \bsignal\b(2)]" ; diff --git a/src/lib/libcmd/tty.c b/src/lib/libcmd/tty.c index e2b067fff299..c51ca0e9c79a 100644 --- a/src/lib/libcmd/tty.c +++ b/src/lib/libcmd/tty.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 * * * @@ -36,10 +36,10 @@ static const char usage[] = "\"\bnot on an active synchronous line\b\" is written.]" "[s:silent|quiet?Disable the terminal name line. Use \b[[ -t 0 ]]]]\b instead.]" "[+EXIT STATUS?]{" - "[+0?Standard input is a tty.]" - "[+1?Standard input is not a tty.]" - "[+2?Invalid arguments.]" - "[+3?A an error occurred.]" + "[+0?Standard input is a tty.]" + "[+1?Standard input is not a tty.]" + "[+2?Invalid arguments.]" + "[+3?A an error occurred.]" "}" ; diff --git a/src/lib/libcmd/uniq.c b/src/lib/libcmd/uniq.c index af4e993b2d24..a30b4fdf54d0 100644 --- a/src/lib/libcmd/uniq.c +++ b/src/lib/libcmd/uniq.c @@ -40,9 +40,9 @@ static const char usage[] = "[D:all-repeated?Output all duplicate lines as a group with an empty " "line delimiter specified by \adelimit\a:]:?[delimit:=none]" "{" - "[n:none?Do not delimit duplicate groups.]" - "[p:prepend?Prepend an empty line before each group.]" - "[s:separate?Separate each group with an empty line.]" + "[n:none?Do not delimit duplicate groups.]" + "[p:prepend?Prepend an empty line before each group.]" + "[s:separate?Separate each group with an empty line.]" "}" "[f:skip-fields]#[fields?\afields\a is the number of fields to skip over " "before checking for uniqueness. A field is the minimal string matching " @@ -56,7 +56,7 @@ static const char usage[] = "an empty string will be used for comparison. +\anumber\a is " "equivalent to \b--skip-chars\b=\anumber\a.]" "[u:unique?Output unique lines.]" -"[w:check-chars]#[chars?\achars\a is the number of characters to compare " +"[w:check-chars]#[chars?\achars\a is the number of characters to compare " "after skipping any specified fields and characters.]" "\n" "\n[infile [outfile]]\n" diff --git a/src/lib/libcmd/wc.c b/src/lib/libcmd/wc.c index 0812f9067a40..06b69d2a9bf5 100644 --- a/src/lib/libcmd/wc.c +++ b/src/lib/libcmd/wc.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 * * * @@ -40,7 +40,7 @@ static const char usage[] = "so that only certain counts are written. The options \b-c\b " "and \b-m\b are mutually exclusive.]" "[+?If no \afile\a is given, or if the \afile\a is \b-\b, \bwc\b " - "reads from standard input and no filename is written to standard " + "reads from standard input and no filename is written to standard " "output. The start of the file is defined as the current offset.]" "[l:lines?List the line counts.]" "[w:words?List the word counts.]" @@ -55,8 +55,8 @@ static const char usage[] = "\n[file ...]\n" "\n" "[+EXIT STATUS?]{" - "[+0?All files processed successfully.]" - "[+>0?One or more files failed to open or could not be read.]" + "[+0?All files processed successfully.]" + "[+>0?One or more files failed to open or could not be read.]" "}" "[+SEE ALSO?\bcat\b(1), \bisspace\b(3)]" ; diff --git a/src/lib/libcmd/wclib.c b/src/lib/libcmd/wclib.c index 2848afb67fcf..08e57c609f97 100644 --- a/src/lib/libcmd/wclib.c +++ b/src/lib/libcmd/wclib.c @@ -456,7 +456,7 @@ int wc_count(Wc_t *wp, Sfio_t *fd, const char* file) state = 0; if(eline!=nlines && !(wp->mode & WC_QUIET)) eline = invalid(file, nlines); - while(mbc(c) && ((c|WC_ERR) || (c&7)==0)) + while(mbc(c) && ((c|WC_ERR) || (c&7)==0)) c=type[*cp++]; if(eol(c) && (cp > endbuff)) goto eob; diff --git a/src/lib/libsum/sum-sha1.c b/src/lib/libsum/sum-sha1.c index 51216a65ca2c..6d1950e8d1f9 100644 --- a/src/lib/libsum/sum-sha1.c +++ b/src/lib/libsum/sum-sha1.c @@ -224,7 +224,7 @@ sha1_block(Sum_t* p, const void* s, size_t len) } else { i = 0; } - + (void)memcpy(&sha->buffer[j], &data[i], len - i); } return 0; diff --git a/src/lib/libsum/sum-sha2.c b/src/lib/libsum/sum-sha2.c index 019643369f79..65d5cb92141e 100644 --- a/src/lib/libsum/sum-sha2.c +++ b/src/lib/libsum/sum-sha2.c @@ -21,7 +21,7 @@ * 3. Neither the name of the copyright holder nor the names of contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -524,11 +524,11 @@ static void SHA256_Transform(SHA256_CTX* sha, const sha2_word32* data) { /* Part of the message block expansion: */ s0 = W256[(j+1)&0x0f]; s0 = sigma0_256(s0); - s1 = W256[(j+14)&0x0f]; + s1 = W256[(j+14)&0x0f]; s1 = sigma1_256(s1); /* Apply the SHA-256 compression function to update a..h */ - T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); T2 = Sigma0_256(a) + Maj(a, b, c); h = g; diff --git a/src/lib/libsum/sumlib.c b/src/lib/libsum/sumlib.c index 38bd7522147b..0771f5932e78 100644 --- a/src/lib/libsum/sumlib.c +++ b/src/lib/libsum/sumlib.c @@ -63,7 +63,7 @@ typedef struct Map_s #define _INTEGRAL_PRIVATE_ \ uint32_t sum; \ uint32_t total_sum; - + typedef struct Integral_s { _SUM_PUBLIC_