Deleted Added
full compact
yppoll.c (89572) yppoll.c (90297)
1/*
2 * Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>
3 * Copyright (c) 1992/3 John Brezak
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 16 unchanged lines hidden (view full) ---

25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#ifndef lint
32static const char rcsid[] =
1/*
2 * Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>
3 * Copyright (c) 1992/3 John Brezak
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 16 unchanged lines hidden (view full) ---

25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#ifndef lint
32static const char rcsid[] =
33 "$FreeBSD: head/usr.sbin/yppoll/yppoll.c 89572 2002-01-19 23:20:02Z dillon $";
33 "$FreeBSD: head/usr.sbin/yppoll/yppoll.c 90297 2002-02-06 13:30:31Z des $";
34#endif /* not lint */
35
36#include <sys/param.h>
37#include <sys/types.h>
38#include <sys/socket.h>
39#include <err.h>
40#include <stdio.h>
41#include <stdlib.h>

--- 20 unchanged lines hidden (view full) ---

62 char *hostname = "localhost";
63 char *inmap, *master;
64 int order;
65 int c, r;
66 time_t t;
67
68 yp_get_default_domain(&domainname);
69
34#endif /* not lint */
35
36#include <sys/param.h>
37#include <sys/types.h>
38#include <sys/socket.h>
39#include <err.h>
40#include <stdio.h>
41#include <stdlib.h>

--- 20 unchanged lines hidden (view full) ---

62 char *hostname = "localhost";
63 char *inmap, *master;
64 int order;
65 int c, r;
66 time_t t;
67
68 yp_get_default_domain(&domainname);
69
70 while( (c=getopt(argc, argv, "h:d:")) != -1)
71 switch(c) {
70 while ((c = getopt(argc, argv, "h:d:")) != -1)
71 switch (c) {
72 case 'd':
73 domainname = optarg;
74 break;
75 case 'h':
76 hostname = optarg;
77 break;
78 case '?':
79 usage();
80 /*NOTREACHED*/
81 }
82
72 case 'd':
73 domainname = optarg;
74 break;
75 case 'h':
76 hostname = optarg;
77 break;
78 case '?':
79 usage();
80 /*NOTREACHED*/
81 }
82
83 if(optind + 1 != argc )
83 if (optind + 1 != argc)
84 usage();
85
86 inmap = argv[optind];
87
88 r = yp_order(domainname, inmap, &order);
89 if (r != 0)
90 errx(1, "no such map %s. Reason: %s", inmap, yperr_string(r));
91 t = _int_to_time(order);
92 printf("Map %s has order number %d. %s", inmap, order, ctime(&t));
93 r = yp_master(domainname, inmap, &master);
94 if (r != 0)
95 errx(1, "no such map %s. Reason: %s", inmap, yperr_string(r));
96 printf("The master server is %s.\n", master);
97
98 exit(0);
99}
84 usage();
85
86 inmap = argv[optind];
87
88 r = yp_order(domainname, inmap, &order);
89 if (r != 0)
90 errx(1, "no such map %s. Reason: %s", inmap, yperr_string(r));
91 t = _int_to_time(order);
92 printf("Map %s has order number %d. %s", inmap, order, ctime(&t));
93 r = yp_master(domainname, inmap, &master);
94 if (r != 0)
95 errx(1, "no such map %s. Reason: %s", inmap, yperr_string(r));
96 printf("The master server is %s.\n", master);
97
98 exit(0);
99}