Deleted Added
sdiff udiff text old ( 146466 ) new ( 153090 )
full compact
1/*-
2 * Copyright (c) 1993, John Brezak
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35
36__FBSDID("$FreeBSD: head/usr.bin/rup/rup.c 146466 2005-05-21 09:55:10Z ru $");
37
38#include <sys/param.h>
39#include <sys/socket.h>
40
41#include <rpc/rpc.h>
42#include <rpc/pmap_clnt.h>
43
44#undef FSHIFT /* Use protocol's shift and scale values */

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

96 struct tm *tmp_time;
97 struct tm host_time;
98 struct tm host_uptime;
99 char days_buf[16];
100 char hours_buf[16];
101 struct hostent *hp;
102 char *host;
103 statstime *host_stat = (statstime *)replyp;
104
105 if (search_host(raddrp->sin_addr))
106 return(0);
107
108 hp = gethostbyaddr((char *)&raddrp->sin_addr.s_addr,
109 sizeof(struct in_addr), AF_INET);
110 if (hp)
111 host = hp->h_name;
112 else
113 host = inet_ntoa(raddrp->sin_addr);
114
115 /* truncate hostname to fit nicely into field */
116 if (strlen(host) > HOST_WIDTH)
117 host[HOST_WIDTH] = '\0';
118
119 printf("%-*s\t", HOST_WIDTH, host);
120
121 tmp_time = localtime((time_t *)&host_stat->curtime.tv_sec);
122 host_time = *tmp_time;
123
124 host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec;
125
126 tmp_time = gmtime((time_t *)&host_stat->curtime.tv_sec);
127 host_uptime = *tmp_time;
128
129 #define updays (host_stat->curtime.tv_sec / 86400)
130 if (host_uptime.tm_yday != 0)
131 sprintf(days_buf, "%3d day%s, ", updays,
132 (updays > 1) ? "s" : "");
133 else
134 days_buf[0] = '\0';
135
136 if (host_uptime.tm_hour != 0)

--- 104 unchanged lines hidden ---