diff options
author | charnier <charnier@FreeBSD.org> | 1997-10-27 12:30:30 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-10-27 12:30:30 +0000 |
commit | 4b19c8ae4e0a21475f4f17ca09f5f79ae35c27fe (patch) | |
tree | 8ac13795048d3f010004ff3d3aab0291ec1f029b /usr.sbin/yppoll | |
parent | ede47e9ab022135f97abb313d33b226ce6b5f722 (diff) | |
download | FreeBSD-src-4b19c8ae4e0a21475f4f17ca09f5f79ae35c27fe.zip FreeBSD-src-4b19c8ae4e0a21475f4f17ca09f5f79ae35c27fe.tar.gz |
Use err(3).
Diffstat (limited to 'usr.sbin/yppoll')
-rw-r--r-- | usr.sbin/yppoll/yppoll.8 | 4 | ||||
-rw-r--r-- | usr.sbin/yppoll/yppoll.c | 28 |
2 files changed, 14 insertions, 18 deletions
diff --git a/usr.sbin/yppoll/yppoll.8 b/usr.sbin/yppoll/yppoll.8 index d7128da..84219d3 100644 --- a/usr.sbin/yppoll/yppoll.8 +++ b/usr.sbin/yppoll/yppoll.8 @@ -34,7 +34,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: yppoll.8,v 1.1 1997/09/21 11:49:10 wosch Exp $ .\" .Dd October 25, 1994 .Dt YPPOLL 8 @@ -79,4 +79,4 @@ instead of the default domain as returned by .Xr ypbind 8 , .Xr ypset 8 .Sh AUTHORS -Theo De Raadt and John Brezak +.An Theo De Raadt and An John Brezak diff --git a/usr.sbin/yppoll/yppoll.c b/usr.sbin/yppoll/yppoll.c index faddc0a..3f1a305 100644 --- a/usr.sbin/yppoll/yppoll.c +++ b/usr.sbin/yppoll/yppoll.c @@ -29,24 +29,27 @@ */ #ifndef lint -static char rcsid[] = "yppoll.c,v 1.2 1993/08/02 17:57:20 mycroft Exp"; +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include <sys/param.h> #include <sys/types.h> #include <sys/socket.h> +#include <err.h> #include <stdio.h> #include <time.h> +#include <unistd.h> #include <rpc/rpc.h> #include <rpc/xdr.h> #include <rpcsvc/yp_prot.h> #include <rpcsvc/ypclnt.h> +static void usage() { - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "\typpoll [-h host] [-d domainname] mapname\n"); + fprintf(stderr, "usage: yppoll [-h host] [-d domainname] mapname\n"); exit(1); } @@ -58,8 +61,6 @@ char **argv; char *hostname = "localhost"; char *inmap, *master; int order; - extern char *optarg; - extern int optind; int c, r; yp_get_default_domain(&domainname); @@ -83,18 +84,13 @@ char **argv; inmap = argv[optind]; r = yp_order(domainname, inmap, &order); - if (r != 0) { - fprintf(stderr, "No such map %s. Reason: %s\n", - inmap, yperr_string(r)); - exit(1); - } - printf("Map %s has order number %d. %s", inmap, order, ctime((time_t *)&order)); + if (r != 0) + errx(1, "no such map %s. Reason: %s", inmap, yperr_string(r)); + printf("Map %s has order number %d. %s", inmap, order, + ctime((time_t *)&order)); r = yp_master(domainname, inmap, &master); - if (r != 0) { - fprintf(stderr, "No such map %s. Reason: %s\n", - inmap, yperr_string(r)); - exit(1); - } + if (r != 0) + errx(1, "no such map %s. Reason: %s", inmap, yperr_string(r)); printf("The master server is %s.\n", master); exit(0); |