Module Name: src Committed By: kre Date: Fri Apr 7 10:34:13 UTC 2023
Modified Files: src/bin/sh: eval.c histedit.c jobs.c jobs.h main.c memalloc.c mktokens mystring.c output.c parser.c show.c src/bin/sh/funcs: dirs popd pushd Log Message: The great shell trailing whitespace cleanup of 2023... Inspired by private e-mail comments from mouse@ NFCI. To generate a diff of this commit: cvs rdiff -u -r1.188 -r1.189 src/bin/sh/eval.c cvs rdiff -u -r1.65 -r1.66 src/bin/sh/histedit.c cvs rdiff -u -r1.117 -r1.118 src/bin/sh/jobs.c cvs rdiff -u -r1.25 -r1.26 src/bin/sh/jobs.h cvs rdiff -u -r1.89 -r1.90 src/bin/sh/main.c cvs rdiff -u -r1.37 -r1.38 src/bin/sh/memalloc.c cvs rdiff -u -r1.14 -r1.15 src/bin/sh/mktokens cvs rdiff -u -r1.19 -r1.20 src/bin/sh/mystring.c cvs rdiff -u -r1.40 -r1.41 src/bin/sh/output.c cvs rdiff -u -r1.179 -r1.180 src/bin/sh/parser.c cvs rdiff -u -r1.54 -r1.55 src/bin/sh/show.c cvs rdiff -u -r1.8 -r1.9 src/bin/sh/funcs/dirs src/bin/sh/funcs/popd \ src/bin/sh/funcs/pushd Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/sh/eval.c diff -u src/bin/sh/eval.c:1.188 src/bin/sh/eval.c:1.189 --- src/bin/sh/eval.c:1.188 Wed Jan 5 15:25:44 2022 +++ src/bin/sh/eval.c Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: eval.c,v 1.188 2022/01/05 15:25:44 kre Exp $ */ +/* $NetBSD: eval.c,v 1.189 2023/04/07 10:34:13 kre Exp $ */ /*- * Copyright (c) 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; #else -__RCSID("$NetBSD: eval.c,v 1.188 2022/01/05 15:25:44 kre Exp $"); +__RCSID("$NetBSD: eval.c,v 1.189 2023/04/07 10:34:13 kre Exp $"); #endif #endif /* not lint */ @@ -96,7 +96,7 @@ STATIC int funcnest; /* depth of functi STATIC int builtin_flags; /* evalcommand flags for builtins */ /* * Base function nesting level inside a dot command. Set to 0 initially - * and to (funcnest + 1) before every dot command to enable + * and to (funcnest + 1) before every dot command to enable * 1) detection of being in a file sourced by a dot command and * 2) counting of function nesting in that file for the implementation * of the return command. @@ -1398,7 +1398,7 @@ evalcommand(union node *cmd, int flgs, s default: VXTRACE(DBG_EVAL, ("normal command%s: ", vforked?" VF":""), trargs(argv)); - redirect(cmd->ncmd.redirect, + redirect(cmd->ncmd.redirect, (vforked ? REDIR_VFORK : 0) | REDIR_KEEP); if (!vforked) for (sp = varlist.list ; sp ; sp = sp->next) Index: src/bin/sh/histedit.c diff -u src/bin/sh/histedit.c:1.65 src/bin/sh/histedit.c:1.66 --- src/bin/sh/histedit.c:1.65 Mon Aug 22 17:33:11 2022 +++ src/bin/sh/histedit.c Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: histedit.c,v 1.65 2022/08/22 17:33:11 kre Exp $ */ +/* $NetBSD: histedit.c,v 1.66 2023/04/07 10:34:13 kre Exp $ */ /*- * Copyright (c) 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: histedit.c,v 1.65 2022/08/22 17:33:11 kre Exp $"); +__RCSID("$NetBSD: histedit.c,v 1.66 2023/04/07 10:34:13 kre Exp $"); #endif #endif /* not lint */ @@ -189,7 +189,7 @@ bad: el_set(el, EL_EDITOR, "emacs"); VTRACE(DBG_HISTORY, ("reading $EDITRC\n")); el_source(el, lookupvar("EDITRC")); - el_set(el, EL_BIND, "^I", + el_set(el, EL_BIND, "^I", tabcomplete ? "rl-complete" : "ed-insert", NULL); INTON; } Index: src/bin/sh/jobs.c diff -u src/bin/sh/jobs.c:1.117 src/bin/sh/jobs.c:1.118 --- src/bin/sh/jobs.c:1.117 Sun Oct 30 01:46:16 2022 +++ src/bin/sh/jobs.c Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: jobs.c,v 1.117 2022/10/30 01:46:16 kre Exp $ */ +/* $NetBSD: jobs.c,v 1.118 2023/04/07 10:34:13 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: jobs.c,v 1.117 2022/10/30 01:46:16 kre Exp $"); +__RCSID("$NetBSD: jobs.c,v 1.118 2023/04/07 10:34:13 kre Exp $"); #endif #endif /* not lint */ @@ -857,7 +857,7 @@ waitcmd(int argc, char **argv) * (eg: a child of the executable that exec'd us) * Simply go back and start all over again * (this is rare). - */ + */ if (job == NULL) continue; @@ -894,9 +894,8 @@ waitcmd(int argc, char **argv) * (that is, no pid args) */ snprintf(idstring, sizeof idstring, - "%d", job->ps[ job->nprocs ? - job->nprocs-1 : - 0 ].pid); + "%d", job->ps[ job->nprocs ? + job->nprocs-1 : 0 ].pid); fpid = idstring; } VTRACE(DBG_WAIT, (" (for %s)", fpid)); Index: src/bin/sh/jobs.h diff -u src/bin/sh/jobs.h:1.25 src/bin/sh/jobs.h:1.26 --- src/bin/sh/jobs.h:1.25 Sat Sep 11 20:43:32 2021 +++ src/bin/sh/jobs.h Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: jobs.h,v 1.25 2021/09/11 20:43:32 christos Exp $ */ +/* $NetBSD: jobs.h,v 1.26 2023/04/07 10:34:13 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -77,7 +77,7 @@ struct job { #define JOBSTOPPED 1 /* all procs are stopped */ #define JOBDONE 2 /* all procs are completed */ char used; /* true if this entry is in used */ - char flags; + char flags; #define JOBCHANGED 1 /* set if status has changed */ #define JOBWANTED 2 /* set if this is a job being sought */ #define JPIPEFAIL 4 /* set if -o pipefail when job created */ Index: src/bin/sh/main.c diff -u src/bin/sh/main.c:1.89 src/bin/sh/main.c:1.90 --- src/bin/sh/main.c:1.89 Sun Sep 18 06:03:19 2022 +++ src/bin/sh/main.c Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.89 2022/09/18 06:03:19 kre Exp $ */ +/* $NetBSD: main.c,v 1.90 2023/04/07 10:34:13 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19 #if 0 static char sccsid[] = "@(#)main.c 8.7 (Berkeley) 7/19/95"; #else -__RCSID("$NetBSD: main.c,v 1.89 2022/09/18 06:03:19 kre Exp $"); +__RCSID("$NetBSD: main.c,v 1.90 2023/04/07 10:34:13 kre Exp $"); #endif #endif /* not lint */ @@ -269,7 +269,7 @@ main(int argc, char **argv) if (sflag == 0 || minusc) { static int sigs[] = { - SIGINT, SIGQUIT, SIGHUP, + SIGINT, SIGQUIT, SIGHUP, #ifdef SIGTSTP SIGTSTP, #endif Index: src/bin/sh/memalloc.c diff -u src/bin/sh/memalloc.c:1.37 src/bin/sh/memalloc.c:1.38 --- src/bin/sh/memalloc.c:1.37 Tue May 31 08:43:13 2022 +++ src/bin/sh/memalloc.c Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: memalloc.c,v 1.37 2022/05/31 08:43:13 andvar Exp $ */ +/* $NetBSD: memalloc.c,v 1.38 2023/04/07 10:34:13 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)memalloc.c 8.3 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: memalloc.c,v 1.37 2022/05/31 08:43:13 andvar Exp $"); +__RCSID("$NetBSD: memalloc.c,v 1.38 2023/04/07 10:34:13 kre Exp $"); #endif #endif /* not lint */ @@ -240,7 +240,7 @@ growstackblock(void) /* * Stack marks pointing to the start of the old block - * must be relocated to point to the new block + * must be relocated to point to the new block */ xmark = markp; while (xmark != NULL && xmark->stackp == oldstackp) { Index: src/bin/sh/mktokens diff -u src/bin/sh/mktokens:1.14 src/bin/sh/mktokens:1.15 --- src/bin/sh/mktokens:1.14 Wed Jul 26 03:46:54 2017 +++ src/bin/sh/mktokens Fri Apr 7 10:34:13 2023 @@ -1,5 +1,5 @@ #!/bin/sh - -# $NetBSD: mktokens,v 1.14 2017/07/26 03:46:54 kre Exp $ +# $NetBSD: mktokens,v 1.15 2023/04/07 10:34:13 kre Exp $ # # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. @@ -90,7 +90,7 @@ ${SED} -e 's/"/\\"/g' \ echo '}; ' ${SED} 's/"//g' /tmp/ka$$ | ${AWK} ' -/TWORD/{print "#define KWDOFFSET " NR; print ""; +/TWORD/{print "#define KWDOFFSET " NR; print ""; print "const char *const parsekwd[] = {"} /TIF/,/neverfound/{print " \"" $3 "\","}' echo ' 0 Index: src/bin/sh/mystring.c diff -u src/bin/sh/mystring.c:1.19 src/bin/sh/mystring.c:1.20 --- src/bin/sh/mystring.c:1.19 Sat Apr 16 14:20:45 2022 +++ src/bin/sh/mystring.c Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: mystring.c,v 1.19 2022/04/16 14:20:45 kre Exp $ */ +/* $NetBSD: mystring.c,v 1.20 2023/04/07 10:34:13 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)mystring.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: mystring.c,v 1.19 2022/04/16 14:20:45 kre Exp $"); +__RCSID("$NetBSD: mystring.c,v 1.20 2023/04/07 10:34:13 kre Exp $"); #endif #endif /* not lint */ @@ -115,7 +115,7 @@ number(const char *s) char *ep = NULL; intmax_t n; - if (!is_digit(*s) || ((n = strtoimax(s, &ep, 10)), + if (!is_digit(*s) || ((n = strtoimax(s, &ep, 10)), (ep == NULL || ep == s || *ep != '\0'))) error("Invalid number: '%s'", s); if (n < INT_MIN || n > INT_MAX) Index: src/bin/sh/output.c diff -u src/bin/sh/output.c:1.40 src/bin/sh/output.c:1.41 --- src/bin/sh/output.c:1.40 Tue Nov 21 03:42:39 2017 +++ src/bin/sh/output.c Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: output.c,v 1.40 2017/11/21 03:42:39 kre Exp $ */ +/* $NetBSD: output.c,v 1.41 2023/04/07 10:34:13 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)output.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: output.c,v 1.40 2017/11/21 03:42:39 kre Exp $"); +__RCSID("$NetBSD: output.c,v 1.41 2023/04/07 10:34:13 kre Exp $"); #endif #endif /* not lint */ @@ -409,7 +409,7 @@ doformat(struct output *dest, const char if (s == NULL) error("Could not allocate formatted output buffer"); outstr(s, dest); - free(s); + free(s); #else /* !HAVE_VASPRINTF */ static const char digit[] = "0123456789ABCDEF"; char c; Index: src/bin/sh/parser.c diff -u src/bin/sh/parser.c:1.179 src/bin/sh/parser.c:1.180 --- src/bin/sh/parser.c:1.179 Sun Apr 17 21:24:52 2022 +++ src/bin/sh/parser.c Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: parser.c,v 1.179 2022/04/17 21:24:52 andvar Exp $ */ +/* $NetBSD: parser.c,v 1.180 2023/04/07 10:34:13 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95"; #else -__RCSID("$NetBSD: parser.c,v 1.179 2022/04/17 21:24:52 andvar Exp $"); +__RCSID("$NetBSD: parser.c,v 1.180 2023/04/07 10:34:13 kre Exp $"); #endif #endif /* not lint */ @@ -1508,7 +1508,7 @@ parsebackq(VSS *const stack, char * cons VTRACE(DBG_PARSE|DBG_LEXER, (" produced %d\n", psavelen)); if (psavelen > 0) { pstr = grabstackstr(out); - CTRACE(DBG_LEXER, + CTRACE(DBG_LEXER, ("parsebackq() reprocessing as $(%s)\n", pstr)); setinputstring(pstr, 1, line1); } @@ -2704,7 +2704,7 @@ expandonstack(char *ps, int cmdsub, int readtoken1(pgetc(), DQSYNTAX, 1); if (backquotelist != NULL) { - if (!cmdsub) + if (!cmdsub) result = ps; else if (!promptcmds) result = "-o promptcmds not set: "; Index: src/bin/sh/show.c diff -u src/bin/sh/show.c:1.54 src/bin/sh/show.c:1.55 --- src/bin/sh/show.c:1.54 Fri Sep 10 22:11:03 2021 +++ src/bin/sh/show.c Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: show.c,v 1.54 2021/09/10 22:11:03 rillig Exp $ */ +/* $NetBSD: show.c,v 1.55 2023/04/07 10:34:13 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)show.c 8.3 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: show.c,v 1.54 2021/09/10 22:11:03 rillig Exp $"); +__RCSID("$NetBSD: show.c,v 1.55 2023/04/07 10:34:13 kre Exp $"); #endif #endif /* not lint */ @@ -1075,12 +1075,12 @@ static struct debug_flag { { 'w', DBG_WAIT }, /* waits for processes to finish */ { 'x', DBG_EXPAND }, /* word expansion ${} $() $(( )) */ { 'z', DBG_ERRS }, /* error control, jumps, cleanup */ - + { '0', DBG_U0 }, /* ad-hoc temp debug flag #0 */ { '1', DBG_U1 }, /* ad-hoc temp debug flag #1 */ { '2', DBG_U2 }, /* ad-hoc temp debug flag #2 */ { '3', DBG_U3 }, /* ad-hoc temp debug flag #3 */ - + { '@', DBG_LINE }, /* prefix trace lines with line# */ { '$', DBG_PID }, /* prefix trace lines with sh pid */ { '^', DBG_NEST }, /* show shell nesting level */ Index: src/bin/sh/funcs/dirs diff -u src/bin/sh/funcs/dirs:1.8 src/bin/sh/funcs/dirs:1.9 --- src/bin/sh/funcs/dirs:1.8 Mon Feb 29 23:50:59 2016 +++ src/bin/sh/funcs/dirs Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -# $NetBSD: dirs,v 1.8 2016/02/29 23:50:59 christos Exp $ +# $NetBSD: dirs,v 1.9 2023/04/07 10:34:13 kre Exp $ # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # @@ -34,7 +34,7 @@ pushd () { SAVE=`pwd` - if [ "$1" = "" ] + if [ "$1" = "" ] then if [ "$DSTACK" = "" ] then echo "pushd: directory stack empty." return 1 @@ -50,7 +50,7 @@ pushd () { } popd () { - if [ "$DSTACK" = "" ] + if [ "$DSTACK" = "" ] then echo "popd: directory stack empty." return 1 fi Index: src/bin/sh/funcs/popd diff -u src/bin/sh/funcs/popd:1.8 src/bin/sh/funcs/popd:1.9 --- src/bin/sh/funcs/popd:1.8 Mon Feb 29 23:50:59 2016 +++ src/bin/sh/funcs/popd Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -# $NetBSD: popd,v 1.8 2016/02/29 23:50:59 christos Exp $ +# $NetBSD: popd,v 1.9 2023/04/07 10:34:13 kre Exp $ # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # @@ -34,7 +34,7 @@ pushd () { SAVE=`pwd` - if [ "$1" = "" ] + if [ "$1" = "" ] then if [ "$DSTACK" = "" ] then echo "pushd: directory stack empty." return 1 @@ -50,7 +50,7 @@ pushd () { } popd () { - if [ "$DSTACK" = "" ] + if [ "$DSTACK" = "" ] then echo "popd: directory stack empty." return 1 fi Index: src/bin/sh/funcs/pushd diff -u src/bin/sh/funcs/pushd:1.8 src/bin/sh/funcs/pushd:1.9 --- src/bin/sh/funcs/pushd:1.8 Mon Feb 29 23:50:59 2016 +++ src/bin/sh/funcs/pushd Fri Apr 7 10:34:13 2023 @@ -1,4 +1,4 @@ -# $NetBSD: pushd,v 1.8 2016/02/29 23:50:59 christos Exp $ +# $NetBSD: pushd,v 1.9 2023/04/07 10:34:13 kre Exp $ # Copyright (c) 1991, 1993 # The Regents of the University of California. All rights reserved. # @@ -34,7 +34,7 @@ pushd () { SAVE=`pwd` - if [ "$1" = "" ] + if [ "$1" = "" ] then if [ "$DSTACK" = "" ] then echo "pushd: directory stack empty." return 1 @@ -50,7 +50,7 @@ pushd () { } popd () { - if [ "$DSTACK" = "" ] + if [ "$DSTACK" = "" ] then echo "popd: directory stack empty." return 1 fi