View | Details | Raw Unified | Return to bug 65228
Collapse All | Expand All

(-)/hd3/rup/rup.1 (-3 / +9 lines)
Lines 42-47 Link Here
42
.Sh SYNOPSIS
42
.Sh SYNOPSIS
43
.Nm
43
.Nm
44
.Op Ar host ...
44
.Op Ar host ...
45
.Op Ar -f <filename> 
45
.Sh DESCRIPTION
46
.Sh DESCRIPTION
46
The
47
The
47
.Nm
48
.Nm
Lines 62-67 Link Here
62
.Nm
63
.Nm
63
utility uses an RPC protocol defined in
64
utility uses an RPC protocol defined in
64
.Pa /usr/include/rpcsvc/rstat.x .
65
.Pa /usr/include/rpcsvc/rstat.x .
66
.Pp
67
.Bl -tag -width Op
68
.It Fl f Ar <filename> 
69
This option specifies which file is read by rup to query the addresses/hostnames
70
defined within it.
65
.Sh EXAMPLES
71
.Sh EXAMPLES
66
.Bd -literal
72
.Bd -literal
67
example% rup otherhost
73
example% rup otherhost
Lines 81-92 Link Here
81
daemon has terminated on the remote host.
87
daemon has terminated on the remote host.
82
.It rup: RPC: Port mapper failure - RPC: Timed out
88
.It rup: RPC: Port mapper failure - RPC: Timed out
83
The remote host is not running the portmapper (see
89
The remote host is not running the portmapper (see
84
.Xr portmap 8 ) ,
90
.Xr rpcbind 8 ) ,
85
and cannot accommodate any RPC-based services.  The host may be down.
91
and cannot accommodate any RPC-based services.  The host may be down.
86
.El
92
.El
87
.Sh SEE ALSO
93
.Sh SEE ALSO
88
.Xr portmap 8 ,
94
.Xr rpc.rstatd 8 ,
89
.Xr rpc.rstatd 8
95
.Xr rpcbind 8
90
.Sh HISTORY
96
.Sh HISTORY
91
The
97
The
92
.Nm
98
.Nm
(-)/hd3/rup/rup.c (-18 / +50 lines)
Lines 57-62 Link Here
57
#include <unistd.h>
57
#include <unistd.h>
58
58
59
#define HOST_WIDTH 15
59
#define HOST_WIDTH 15
60
#define MAXBUF 512
60
61
61
struct host_list {
62
struct host_list {
62
	struct host_list *next;
63
	struct host_list *next;
Lines 107-113 Link Here
107
108
108
	hp = gethostbyaddr((char *)&raddrp->sin_addr.s_addr,
109
	hp = gethostbyaddr((char *)&raddrp->sin_addr.s_addr,
109
			   sizeof(struct in_addr), AF_INET);
110
			   sizeof(struct in_addr), AF_INET);
110
	if (hp)
111
	if (hp == NULL)
111
		host = hp->h_name;
112
		host = hp->h_name;
112
	else
113
	else
113
		host = inet_ntoa(raddrp->sin_addr);
114
		host = inet_ntoa(raddrp->sin_addr);
Lines 220-240 Link Here
220
int
221
int
221
main(int argc, char *argv[])
222
main(int argc, char *argv[])
222
{
223
{
223
	int ch;
224
        int             ch, f_flag = 0, i = 0;
224
225
        FILE           *fd;
225
	while ((ch = getopt(argc, argv, "?")) != -1)
226
        char            file_buf[MAXBUF], *host;
226
		switch (ch) {
227
        
227
		default:
228
        while ((ch = getopt(argc, argv, "f:")) != -1)
228
			usage();
229
                switch (ch) {
229
			/*NOTREACHED*/
230
                case 'f':
230
		}
231
                        f_flag = 1;
231
232
                        break;
232
	setlinebuf(stdout);
233
                default:
233
	if (argc == optind)
234
                        usage();
234
		allhosts();
235
                        /* NOTREACHED */
235
	else {
236
                }
236
		for (; optind < argc; optind++)
237
        
237
			(void) onehost(argv[optind]);
238
        if (!f_flag) {
238
	}
239
                setlinebuf(stdout);
239
	exit(0);
240
                if (argc == optind) {
241
                        allhosts();
242
                } else {
243
                        for (; optind < argc; optind++)
244
                                onehost(argv[optind]);
245
                }
246
        } else {
247
                if ((fd = fopen(optarg, "r")) == NULL)
248
                        err(1, "%s", optarg);
249
                                   
250
                while (!feof(fd)) {
251
                        if (fgets(file_buf, sizeof(file_buf), fd) != NULL) {
252
                                if ((host = malloc(sizeof(file_buf))) == NULL)
253
                                        err(1, NULL);
254
                                bzero(host, sizeof(file_buf));
255
                                if (!ferror(fd)) {
256
                                        for (i = 0; i < (int)sizeof(file_buf); i++) {
257
                                                if (file_buf[i] == '#' || file_buf[i] == '\n' || file_buf[i] == ' ')
258
                                                        break;
259
        
260
                                                host[i] = file_buf[i];
261
                                        }
262
                                        onehost(host);
263
                                } else {
264
                                        err(1, NULL);
265
                                }
266
                                free(host);
267
                        }
268
                }
269
                fclose(fd);
270
        }
271
        return 0;
240
}
272
}

Return to bug 65228