summaryrefslogtreecommitdiffstats
path: root/usr.bin/ypcat/ypcat.c
diff options
context:
space:
mode:
authoraraujo <araujo@FreeBSD.org>2015-08-04 07:04:36 +0000
committeraraujo <araujo@FreeBSD.org>2015-08-04 07:04:36 +0000
commit619540b67821634862a271013362400021b8470c (patch)
tree4873abf930a6163f27e5454dd31c70f2d2bc02e4 /usr.bin/ypcat/ypcat.c
parent8facb2dcc9bc3c8a9a16a8c93e877a402eee5a47 (diff)
downloadFreeBSD-src-619540b67821634862a271013362400021b8470c.zip
FreeBSD-src-619540b67821634862a271013362400021b8470c.tar.gz
Get it closes to style(9).
Staticization usage() and printit(). Fix the usage of err(3). Reviewed by: bde
Diffstat (limited to 'usr.bin/ypcat/ypcat.c')
-rw-r--r--usr.bin/ypcat/ypcat.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/usr.bin/ypcat/ypcat.c b/usr.bin/ypcat/ypcat.c
index 60acca0..aad07cc 100644
--- a/usr.bin/ypcat/ypcat.c
+++ b/usr.bin/ypcat/ypcat.c
@@ -33,21 +33,19 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
+
#include <ctype.h>
#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include <rpc/rpc.h>
#include <rpc/xdr.h>
#include <rpcsvc/yp.h>
#include <rpcsvc/ypclnt.h>
-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);
}
OpenPOWER on IntegriCloud