Index: head/usr.sbin/yp_mkdb/yp_mkdb.c =================================================================== --- head/usr.sbin/yp_mkdb/yp_mkdb.c (revision 238532) +++ head/usr.sbin/yp_mkdb/yp_mkdb.c (working copy) @@ -57,11 +57,12 @@ static void usage(void) { - fprintf(stderr, "%s\n%s\n%s\n%s\n", - "usage: yp_mkdb -c", + fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", + "usage: yp_mkdb [-c | -C hostname]", " yp_mkdb -u dbname", - " yp_mkdb [-c] [-b] [-s] [-f] [-i inputfile] [-o outputfile]", - " [-d domainname ] [-m mastername] inputfile dbname"); + " yp_mkdb [-c | -C hostname] [-b] [-s] [-f] [-i inputfile]", + " [-o outputfile] [-d domainname ] [-m mastername]", + " inputfile dbname"); exit(1); } @@ -105,6 +106,7 @@ char *infile = NULL; char *map = NULL; char *domain = NULL; + char *clearhost = "localhost"; char *infilename = NULL; char *outfilename = NULL; char *mastername = NULL; @@ -117,7 +119,7 @@ FILE *ifp; char hname[MAXHOSTNAMELEN + 2]; - while ((ch = getopt(argc, argv, "uhcbsfd:i:o:m:")) != -1) { + while ((ch = getopt(argc, argv, "uhcC:bsfd:i:o:m:")) != -1) { switch (ch) { case 'f': filter_plusminus++; @@ -128,6 +130,10 @@ case 'c': clear++; break; + case 'C': + clear++; + clearhost = optarg; + break; case 'b': interdom++; break; @@ -156,6 +162,9 @@ argc -= optind; argv += optind; + if (clear > 1) + usage(); + if (un) { map = argv[0]; if (map == NULL) @@ -332,7 +341,7 @@ char in = 0; char *out = NULL; int stat; - if ((stat = callrpc("localhost", YPPROG,YPVERS, YPPROC_CLEAR, + if ((stat = callrpc(clearhost, YPPROG,YPVERS, YPPROC_CLEAR, (xdrproc_t)xdr_void, &in, (xdrproc_t)xdr_void, out)) != RPC_SUCCESS) { warnx("failed to send 'clear' to local ypserv: %s", Index: head/usr.sbin/yp_mkdb/yp_mkdb.8 =================================================================== --- head/usr.sbin/yp_mkdb/yp_mkdb.8 (revision 238532) +++ head/usr.sbin/yp_mkdb/yp_mkdb.8 (working copy) @@ -42,7 +42,7 @@ .Nm .Fl u Ar dbname .Nm -.Op Fl c +.Op Fl c | Fl C Ar hostname .Op Fl b .Op Fl s .Op Fl f @@ -111,6 +111,12 @@ .Nm will send the signal only after the new database has been successfully created. +.It Fl C +As +.Fl c +but send the YPPROC_CLEAR to the specified +.Ar hostname +instead. .It Fl b Cause .Nm