From nobody Fri Apr 26 16:39:16 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VQz2X3dHtz5Hmwp; Fri, 26 Apr 2024 16:39:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VQz2X35MLz4p9S; Fri, 26 Apr 2024 16:39:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714149556; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G04ZG6NLqcJ8+PVM0XQV/LuItP2BKRsHKR/FFk5f21A=; b=bBXy2U/ImSfl/ej+Z5hBwo8UqasisXsm/PysTTa7GygrqxNQT/0jwSHc1JmdsyMdPOD/cU X3hTCfnag7zLl1xmrwrbO2ynr1XWCvjJucXiPPl35Psq50LtsETn7YSJ8I3gfo59DAnYNC MHh2ilNFK1acSoYreicCsxZU8NkNcqqIMvn2th/GjzII+LQuMD/i5ViqdHv8bfwjIz9ppI aVJtuosRK7d6vUYy+X3IgG/MLy/Uh7o5YVCuohnrWNf/oAQbuS7gY9lM0iattxqsYKkqM9 6MdvCh8fAd0O+8kLgvr1VKMsF1yD0bZk/B4/aOr1e8WN4nD1ipTJIxrhhhIwGw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714149556; a=rsa-sha256; cv=none; b=ofmL1Sy5jb0NF+ne6313lN9Fl54cy4Y9xss+fatYjtjOL6V0BC3ESaHweNKAQTe6ZHWc2F ZmyNWA2IqwthniF+gzjucX44TBtNQBjX+IPBMy/79bdtPAUh4J8QUjhkDBn6jKrJEFPyVk Omzuy+GqicszUzu6SjqC4ESkprMSV39w5XO2lQjRWTEgyQpGjtHNTPzTtiNTFOYkBI0a7U yaIHuMe8R93VuXj/Br0jzQ3NY/yLjqGgmARW2BJbkhjjwyLW23ydU+BvkKVxfvY0+eJgr/ ykzO6+VFZ6/kW09Fa6ViNdcC+ZS8qObdx9gjIlrU1ctwrJaOiRLZBJnzz7KaGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714149556; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G04ZG6NLqcJ8+PVM0XQV/LuItP2BKRsHKR/FFk5f21A=; b=Dbm/uS5DpQejEeDRNkxabcWpRE+6sRvS1xteo06YbpmcHkYYUYJx1dBvnrqcgU3leUcNHW K3QLGvPx0tVS2jnYgGB4nfZe4nBq2KGR7fP4QaRA4pwuObBDXWFIh583Yl/sDl4Ex2iZpi oqyXQXyUd2p6cj8filo0+LXdG2iYZoCCten5HQ50RwKsynibeIwSGYoOTk82dUM/wQpmpq Errz1K7R/Eeb0ruiaR5+QaNw+zIsaAZdNKITZO4N60zOKm9B0N5weixft7lB/uF1uaRIt/ lz4IADuUTbgKzad/IxB8m8SnNWUs66J1LhkOVNz5OthsTFOwdpSmyEAzqXqveg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VQz2X2ZHjzqll; Fri, 26 Apr 2024 16:39:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43QGdGZY064878; Fri, 26 Apr 2024 16:39:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43QGdGqG064875; Fri, 26 Apr 2024 16:39:16 GMT (envelope-from git) Date: Fri, 26 Apr 2024 16:39:16 GMT Message-Id: <202404261639.43QGdGqG064875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 4459abe334eb - main - script: minor style improvements List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4459abe334eb4dbd416fa8094a64afc065ccd1cc Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4459abe334eb4dbd416fa8094a64afc065ccd1cc commit 4459abe334eb4dbd416fa8094a64afc065ccd1cc Author: Xavier Beaudouin AuthorDate: 2024-04-26 16:10:15 +0000 Commit: Kyle Evans CommitDate: 2024-04-26 16:38:52 +0000 script: minor style improvements Fix some nits pointed out by checkstyle9.pl in advance of functional changes to script(1). Reviewed by: des Sponsored by: Modirum MDPay Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D44167 --- usr.bin/script/script.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index a1fd6967c35c..0373a6667784 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -114,19 +115,19 @@ main(int argc, char *argv[]) usesleep = 1; rawout = 0; flushtime = 30; - fm_fd = -1; /* Shut up stupid "may be used uninitialized" GCC - warning. (not needed w/clang) */ + fm_fd = -1; showexit = 0; while ((ch = getopt(argc, argv, "adeFfkpqrT:t:")) != -1) - switch(ch) { + switch (ch) { case 'a': aflg = 1; break; case 'd': usesleep = 0; break; - case 'e': /* Default behavior, accepted for linux compat */ + case 'e': + /* Default behavior, accepted for linux compat. */ break; case 'F': Fflg = 1; @@ -239,6 +240,8 @@ main(int argc, char *argv[]) (void)tcsetattr(STDIN_FILENO, TCSAFLUSH, &rtt); } + assert(fflg ? fm_fd >= 0 : fm_fd < 0); + child = fork(); if (child < 0) { warn("fork"); @@ -331,7 +334,7 @@ main(int argc, char *argv[]) } } if (n > 0 && FD_ISSET(master, &rfd)) { - cc = read(master, obuf, sizeof (obuf)); + cc = read(master, obuf, sizeof(obuf)); if (cc <= 0) break; (void)write(STDOUT_FILENO, obuf, cc); @@ -417,7 +420,7 @@ done(int eno) if (showexit) (void)fprintf(fscript, "\nCommand exit status:" " %d", eno); - (void)fprintf(fscript,"\nScript done on %s", + (void)fprintf(fscript, "\nScript done on %s", ctime(&tvec)); } (void)printf("\nScript done, output file is %s\n", fname); @@ -459,8 +462,7 @@ consume(FILE *fp, off_t len, char *buf, int reg) if (reg) { if (fseeko(fp, len, SEEK_CUR) == -1) err(1, NULL); - } - else { + } else { while (len > 0) { l = MIN(DEF_BUF, len); if (fread(buf, sizeof(char), l, fp) != l)