Cosmetics in yp_error() and usage().

This commit is contained in:
Philippe Charnier 1997-11-03 07:53:44 +00:00
parent 9737357a95
commit 73aabc1f3c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=30911
2 changed files with 41 additions and 43 deletions

View File

@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" $Id$ .\" $Id: yppush.8,v 1.6 1997/02/22 16:15:00 peter Exp $
.\" .\"
.Dd February 5, 1995 .Dd February 5, 1995
.Dt YPPUSH 8 .Dt YPPUSH 8
@ -47,7 +47,7 @@
.Op Fl v .Op Fl v
.Ar mapname .Ar mapname
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm yppush .Nm Yppush
distributes updated NIS databases (or distributes updated NIS databases (or
.Pa maps ) .Pa maps )
from an NIS master server to NIS slave servers within an NIS from an NIS master server to NIS slave servers within an NIS
@ -56,17 +56,19 @@ domain. It is normally only run on the NIS master by
whenever any of the NIS maps are updated. Note that whenever any of the NIS maps are updated. Note that
.Pa /var/yp/Makefile .Pa /var/yp/Makefile
does not invoke does not invoke
.Nm yppush .Nm
by default: the by default: the
.Nm NOPUSH=True .Nm NOPUSH=True
entry in the Makefile must first be commented out entry in the Makefile must first be commented out
(the default FreeBSD configuration assumes a small network with only (the default
.Bx Free
configuration assumes a small network with only
a single NIS server; in such a configuration, a single NIS server; in such a configuration,
.Nm yppush .Nm
is not needed). is not needed).
.Pp .Pp
By default, By default,
.Nm yppush .Nm
determines the names of the slave servers for a domain by searching the determines the names of the slave servers for a domain by searching the
.Pa ypservers .Pa ypservers
map. A destination host (or a list of hosts) can also be manually map. A destination host (or a list of hosts) can also be manually
@ -79,31 +81,28 @@ Included within each request is the name of the map to be copied
and some special information required by and some special information required by
.Xr ypxfr 8 .Xr ypxfr 8
to successfully 'callback' to to successfully 'callback' to
.Nm yppush .Nm
and carry out the transfer. Any error messages and carry out the transfer. Any error messages
.Nm yppush .Nm
receives from receives from
.Xr ypxfr 8 .Xr ypxfr 8
via callback will be printed to stderr. via callback will be printed to stderr.
.Pp .Pp
.Sh OPTIONS .Sh OPTIONS
The following options are supported by The following options are available:
.Nm yppush : .Bl -tag -width indent
.Bl -tag -width flag
.It Fl d Ar domain .It Fl d Ar domain
Specify a particular domain. The NIS domain of Specify a particular domain. The NIS domain of
the local host system is used by default. If the local host's domain the local host system is used by default. If the local host's domain
name is not set, the domain name must be specified with this flag. name is not set, the domain name must be specified with this flag.
.It Fl t Ar timeout .It Fl t Ar timeout
The Specify a timeout value in seconds. This timeout
.Fl t
flag is used to specify a timeout value in seconds. This timeout
controls how long controls how long
.Nm yppush .Nm
will wait for a response from a slave server before sending a will wait for a response from a slave server before sending a
map transfer request to the next slave server in its list. map transfer request to the next slave server in its list.
.It Fl j Ar #parallel jobs .It Fl j Ar #parallel jobs
.Nm yppush .Nm Yppush
normally performs transfers serially, meaning that it will normally performs transfers serially, meaning that it will
send a map transfer request to one slave server and then wait for send a map transfer request to one slave server and then wait for
it to respond before moving on to the next slave server. In environments it to respond before moving on to the next slave server. In environments
@ -111,25 +110,23 @@ with many slaves, it is more efficient to initiate several map transfers
at once so that the transfers can take place in parallel. The at once so that the transfers can take place in parallel. The
.Fl j .Fl j
flag is used to specify the desired number of parallel jobs: flag is used to specify the desired number of parallel jobs:
.Nm yppush .Nm
will initiate the specified number of transfers immediately and will initiate the specified number of transfers immediately and
listen for responses. If the number of specified parallel jobs is listen for responses. If the number of specified parallel jobs is
less than the number of slave servers, less than the number of slave servers,
.Nm yppush .Nm
will initiate only the number of specified jobs and then wait will initiate only the number of specified jobs and then wait
for some of them to finish before starting any more. for some of them to finish before starting any more.
.Pp .Pp
Note that Note that
.Nm yppush .Nm
handles callbacks asynchronously, which means that it will collect handles callbacks asynchronously, which means that it will collect
and display the callback information received from and display the callback information received from
.Xr ypxfr 8 .Xr ypxfr 8
as soon as it arrives, even it arrives before all of the map as soon as it arrives, even it arrives before all of the map
transfer requests have been sent. transfer requests have been sent.
.It Fl h Ar host .It Fl h Ar host
The Can be used to transfer a map to a user-specified machine or
.Fl h
flag can be used to transfer a map to a user-specified machine or
group of machines instead of the list of servers contained in group of machines instead of the list of servers contained in
the the
.Pa ypservers .Pa ypservers
@ -139,7 +136,7 @@ instances of the
flag. flag.
.It Fl p Ar path .It Fl p Ar path
By default, By default,
.Nm yppush .Nm
expects all the local NIS maps to be stored under expects all the local NIS maps to be stored under
.Pa /var/yp . .Pa /var/yp .
The The
@ -148,10 +145,10 @@ flag can be used to specify an alternate path in the event that
the system administrator decides to store the NIS maps somewhere else. the system administrator decides to store the NIS maps somewhere else.
.It Fl v .It Fl v
Verbose mode: causes Verbose mode: causes
.Nm yppush .Nm
to print debugging messages as it runs. Specifying this flag twice to print debugging messages as it runs. Specifying this flag twice
makes makes
.Nm yppush .Nm
even more verbose. even more verbose.
.Sh FILES .Sh FILES
.Bl -tag -width Pa -compact .Bl -tag -width Pa -compact
@ -166,7 +163,7 @@ a particular NIS domain.
.Sh BUGS .Sh BUGS
The mechanism for transferring NIS maps in NIS v1 is different The mechanism for transferring NIS maps in NIS v1 is different
than that in NIS version 2. This version of than that in NIS version 2. This version of
.Nm yppush .Nm
has support for transferring maps to NIS v2 systems only. has support for transferring maps to NIS v2 systems only.
.Sh AUTHOR .Sh AUTHOR
Bill Paul <wpaul@ctr.columbia.edu> .An Bill Paul Aq wpaul@ctr.columbia.edu

View File

@ -28,17 +28,20 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*
* $Id: yppush_main.c,v 1.7 1997/02/22 16:15:02 peter Exp $
*/ */
#ifndef lint
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <errno.h>
#include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <string.h> #include <string.h>
#include <signal.h>
#include <time.h> #include <time.h>
#include <errno.h> #include <unistd.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <sys/wait.h> #include <sys/wait.h>
@ -52,10 +55,6 @@ struct dom_binding {};
#include "ypxfr_extern.h" #include "ypxfr_extern.h"
#include "yppush_extern.h" #include "yppush_extern.h"
#ifndef lint
static const char rcsid[] = "$Id: yppush_main.c,v 1.7 1997/02/22 16:15:02 peter Exp $";
#endif
char *progname = "yppush"; char *progname = "yppush";
int debug = 1; int debug = 1;
int _rpcpmstart = 0; int _rpcpmstart = 0;
@ -123,10 +122,10 @@ static int yppush_show_status(status, tid)
} }
if (verbose > 1) if (verbose > 1)
yp_error("Checking return status: Transaction ID: %lu", yp_error("checking return status: transaction ID: %lu",
job->tid); job->tid);
if (status != YPPUSH_SUCC || verbose) { if (status != YPPUSH_SUCC || verbose) {
yp_error("Transfer of map %s to server %s %s.", yp_error("transfer of map %s to server %s %s",
job->map, job->server, status == YPPUSH_SUCC ? job->map, job->server, status == YPPUSH_SUCC ?
"succeeded" : "failed"); "succeeded" : "failed");
yp_error("status returned by ypxfr: %s", status > YPPUSH_AGE ? yp_error("status returned by ypxfr: %s", status > YPPUSH_AGE ?
@ -192,7 +191,7 @@ static void yppush_exit(now)
while(jptr) { while(jptr) {
if (!jptr->polled) if (!jptr->polled)
yp_error("warning: exiting with transfer \ yp_error("warning: exiting with transfer \
to %s (transid = %lu) still pending.", jptr->server, jptr->tid); to %s (transid = %lu) still pending", jptr->server, jptr->tid);
svc_unregister(jptr->prognum, 1); svc_unregister(jptr->prognum, 1);
jptr = jptr->next; jptr = jptr->next;
} }
@ -408,7 +407,7 @@ int yp_push(server, map, tid)
/* Register the job in our linked list of jobs. */ /* Register the job in our linked list of jobs. */
if ((job = (struct jobs *)malloc(sizeof (struct jobs))) == NULL) { if ((job = (struct jobs *)malloc(sizeof (struct jobs))) == NULL) {
yp_error("malloc failed: %s", strerror(errno)); yp_error("malloc failed");
yppush_exit(1); yppush_exit(1);
} }
@ -521,14 +520,16 @@ int yppush_foreach(status, key, keylen, val, vallen, data)
static void usage() static void usage()
{ {
fprintf (stderr, "%s: [-d domain] [-t timeout] [-j #parallel jobs] \ fprintf (stderr, "%s\n%s\n",
[-h host] [-p path] mapname\n", progname); "usage: yppush [-d domain] [-t timeout] [-j #parallel jobs] [-h host]",
" [-p path] mapname");
exit(1); exit(1);
} }
/* /*
* Entry point. (About time!) * Entry point. (About time!)
*/ */
int
main(argc,argv) main(argc,argv)
int argc; int argc;
char *argv[]; char *argv[];
@ -559,7 +560,7 @@ main(argc,argv)
break; break;
case 'h': /* we can handle multiple hosts */ case 'h': /* we can handle multiple hosts */
if ((tmp = (struct hostlist *)malloc(sizeof(struct hostlist))) == NULL) { if ((tmp = (struct hostlist *)malloc(sizeof(struct hostlist))) == NULL) {
yp_error("malloc() failed: %s", strerror(errno)); yp_error("malloc failed");
yppush_exit(1); yppush_exit(1);
} }
tmp->name = strdup(optarg); tmp->name = strdup(optarg);