From owner-svn-src-head@freebsd.org Tue Aug 4 07:04:37 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8D809B3527; Tue, 4 Aug 2015 07:04:37 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8FFC03BF; Tue, 4 Aug 2015 07:04:37 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t7474bag055588; Tue, 4 Aug 2015 07:04:37 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t7474bQx055587; Tue, 4 Aug 2015 07:04:37 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201508040704.t7474bQx055587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Tue, 4 Aug 2015 07:04:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286279 - head/usr.bin/ypcat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 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: Tue, 04 Aug 2015 07:04:37 -0000 Author: araujo (ports committer) Date: Tue Aug 4 07:04:36 2015 New Revision: 286279 URL: https://svnweb.freebsd.org/changeset/base/286279 Log: Get it closes to style(9). Staticization usage() and printit(). Fix the usage of err(3). Reviewed by: bde Modified: head/usr.bin/ypcat/ypcat.c Modified: head/usr.bin/ypcat/ypcat.c ============================================================================== --- head/usr.bin/ypcat/ypcat.c Tue Aug 4 06:02:03 2015 (r286278) +++ head/usr.bin/ypcat/ypcat.c Tue Aug 4 07:04:36 2015 (r286279) @@ -33,21 +33,19 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include -#include + #include #include +#include +#include +#include +#include #include #include #include #include -void usage(void); -int printit(u_long, char *, int, char *, int, void *); - static const struct ypalias { char *alias, *name; } ypaliases[] = { @@ -65,16 +63,16 @@ static const struct ypalias { static int key; -void +static void usage(void) { - fprintf(stderr, - "usage: ypcat [-kt] [-d domainname] mapname\n" - " ypcat -x\n"); + fprintf(stderr, "%s\n%s\n", + "usage: ypcat [-kt] [-d domainname] mapname", + " ypcat -x"); exit(1); } -int +static int printit(u_long instatus, char *inkey, int inkeylen, char *inval, int invallen, void *indata) { @@ -91,9 +89,7 @@ main(int argc, char *argv[]) { char *domain = NULL, *inmap; struct ypall_callback ypcb; - extern char *optarg; - extern int optind; - int notrans, c, r; + int c, notrans, r; u_int i; notrans = key = 0; @@ -120,7 +116,7 @@ main(int argc, char *argv[]) if (optind + 1 != argc) usage(); - if (!domain) + if (domain == NULL) yp_get_default_domain(&domain); inmap = argv[optind]; @@ -137,12 +133,10 @@ main(int argc, char *argv[]) case 0: break; case YPERR_YPBIND: - errx(1, "ypcat: not running ypbind\n"); - exit(1); + errx(1, "not running ypbind"); default: - errx(1, "No such map %s. Reason: %s\n", + errx(1, "no such map %s. Reason: %s", inmap, yperr_string(r)); - exit(1); } exit(0); }