Get it closes to style(9).
Staticization usage() and printit(). Fix the usage of err(3). Reviewed by: bde
This commit is contained in:
parent
0c0964844e
commit
c52bab1135
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286279
@ -33,21 +33,19 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <rpc/rpc.h>
|
#include <rpc/rpc.h>
|
||||||
#include <rpc/xdr.h>
|
#include <rpc/xdr.h>
|
||||||
#include <rpcsvc/yp.h>
|
#include <rpcsvc/yp.h>
|
||||||
#include <rpcsvc/ypclnt.h>
|
#include <rpcsvc/ypclnt.h>
|
||||||
|
|
||||||
void usage(void);
|
|
||||||
int printit(u_long, char *, int, char *, int, void *);
|
|
||||||
|
|
||||||
static const struct ypalias {
|
static const struct ypalias {
|
||||||
char *alias, *name;
|
char *alias, *name;
|
||||||
} ypaliases[] = {
|
} ypaliases[] = {
|
||||||
@ -65,16 +63,16 @@ static const struct ypalias {
|
|||||||
|
|
||||||
static int key;
|
static int key;
|
||||||
|
|
||||||
void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr, "%s\n%s\n",
|
||||||
"usage: ypcat [-kt] [-d domainname] mapname\n"
|
"usage: ypcat [-kt] [-d domainname] mapname",
|
||||||
" ypcat -x\n");
|
" ypcat -x");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
printit(u_long instatus, char *inkey, int inkeylen, char *inval, int invallen,
|
printit(u_long instatus, char *inkey, int inkeylen, char *inval, int invallen,
|
||||||
void *indata)
|
void *indata)
|
||||||
{
|
{
|
||||||
@ -91,9 +89,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
char *domain = NULL, *inmap;
|
char *domain = NULL, *inmap;
|
||||||
struct ypall_callback ypcb;
|
struct ypall_callback ypcb;
|
||||||
extern char *optarg;
|
int c, notrans, r;
|
||||||
extern int optind;
|
|
||||||
int notrans, c, r;
|
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
notrans = key = 0;
|
notrans = key = 0;
|
||||||
@ -120,7 +116,7 @@ main(int argc, char *argv[])
|
|||||||
if (optind + 1 != argc)
|
if (optind + 1 != argc)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
if (!domain)
|
if (domain == NULL)
|
||||||
yp_get_default_domain(&domain);
|
yp_get_default_domain(&domain);
|
||||||
|
|
||||||
inmap = argv[optind];
|
inmap = argv[optind];
|
||||||
@ -137,12 +133,10 @@ main(int argc, char *argv[])
|
|||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case YPERR_YPBIND:
|
case YPERR_YPBIND:
|
||||||
errx(1, "ypcat: not running ypbind\n");
|
errx(1, "not running ypbind");
|
||||||
exit(1);
|
|
||||||
default:
|
default:
|
||||||
errx(1, "No such map %s. Reason: %s\n",
|
errx(1, "no such map %s. Reason: %s",
|
||||||
inmap, yperr_string(r));
|
inmap, yperr_string(r));
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user