From owner-svn-src-head@freebsd.org Mon Nov 12 16:44:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54581110AB3E; Mon, 12 Nov 2018 16:44:27 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3400766AA; Mon, 12 Nov 2018 16:44:26 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5A28235B8; Mon, 12 Nov 2018 16:44:26 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wACGiQ1i029031; Mon, 12 Nov 2018 16:44:26 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wACGiQUD029030; Mon, 12 Nov 2018 16:44:26 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201811121644.wACGiQUD029030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 12 Nov 2018 16:44:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340370 - head/usr.bin/head X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/usr.bin/head X-SVN-Commit-Revision: 340370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D3400766AA X-Spamd-Result: default: False [-106.87 / 200.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; ALLOW_DOMAIN_WHITELIST(-100.00)[FreeBSD.org]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: mx1.FreeBSD.org]; NEURAL_HAM_SHORT(-0.99)[-0.991,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; IP_SCORE(-3.77)[ip: (-9.91), ipnet: 2610:1c1:1::/48(-4.93), asn: 11403(-3.90), country: US(-0.09)] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2018 16:44:27 -0000 Author: oshogbo Date: Mon Nov 12 16:44:26 2018 New Revision: 340370 URL: https://svnweb.freebsd.org/changeset/base/340370 Log: head: fix style nits No functional change intended. Reviewed by: emaste MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D14498 Modified: head/usr.bin/head/head.c Modified: head/usr.bin/head/head.c ============================================================================== --- head/usr.bin/head/head.c Mon Nov 12 16:43:53 2018 (r340369) +++ head/usr.bin/head/head.c Mon Nov 12 16:44:26 2018 (r340370) @@ -75,14 +75,17 @@ static const struct option long_opts[] = int main(int argc, char *argv[]) { - int ch; FILE *fp; - int first, linecnt = -1, eval = 0; - off_t bytecnt = -1; char *ep; + off_t bytecnt; + int ch, first, linecnt, eval; + linecnt = -1; + eval = 0; + bytecnt = -1; + obsolete(argv); - while ((ch = getopt_long(argc, argv, "+n:c:", long_opts, NULL)) != -1) + while ((ch = getopt_long(argc, argv, "+n:c:", long_opts, NULL)) != -1) { switch(ch) { case 'c': bytecnt = strtoimax(optarg, &ep, 10); @@ -97,16 +100,18 @@ main(int argc, char *argv[]) case '?': default: usage(); + /* NOTREACHED */ } + } argc -= optind; argv += optind; if (linecnt != -1 && bytecnt != -1) errx(1, "can't combine line and byte counts"); - if (linecnt == -1 ) + if (linecnt == -1) linecnt = 10; - if (*argv) { - for (first = 1; *argv; ++argv) { + if (*argv != NULL) { + for (first = 1; *argv != NULL; ++argv) { if ((fp = fopen(*argv, "r")) == NULL) { warn("%s", *argv); eval = 1; @@ -137,7 +142,7 @@ head(FILE *fp, int cnt) char *cp; size_t error, readlen; - while (cnt && (cp = fgetln(fp, &readlen)) != NULL) { + while (cnt != 0 && (cp = fgetln(fp, &readlen)) != NULL) { error = fwrite(cp, sizeof(char), readlen, stdout); if (error != readlen) err(1, "stdout");