[BACK]Return to rup.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rup

Diff for /src/usr.bin/rup/rup.c between version 1.21 and 1.22

version 1.21, 2005/11/17 19:31:54 version 1.22, 2005/11/17 19:55:05
Line 64 
Line 64 
 search_host(struct in_addr addr)  search_host(struct in_addr addr)
 {  {
         struct host_list *hp;          struct host_list *hp;
   
         if (!hosts)          if (!hosts)
                 return(0);                  return(0);
   
Line 143 
Line 143 
                 rup_data = newrup;                  rup_data = newrup;
                 rup_data_max = newsize;                  rup_data_max = newsize;
         }          }
   
         if ((rup_data[rup_data_idx].host = strdup(host)) == NULL)          if ((rup_data[rup_data_idx].host = strdup(host)) == NULL)
                 err(1, NULL);                  err(1, NULL);
         rup_data[rup_data_idx].statstime = *st;          rup_data[rup_data_idx].statstime = *st;
Line 196 
Line 196 
         host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec;          host_stat->curtime.tv_sec -= host_stat->boottime.tv_sec;
   
         if (host_stat->curtime.tv_sec > 0)          if (host_stat->curtime.tv_sec > 0)
                 ups=host_stat->curtime.tv_sec;                  ups = host_stat->curtime.tv_sec;
         upd=ups/(3600*24);          upd = ups / (3600 * 24);
         ups-=upd*3600*24;          ups -= upd * 3600 * 24;
         uph=ups/3600;          uph = ups / 3600;
         ups-=uph*3600;          ups -= uph * 3600;
         upm=ups/60;          upm = ups / 60;
   
         if (upd != 0)          if (upd != 0)
                 snprintf(days_buf, sizeof days_buf, "%3u day%s, ", upd,                  snprintf(days_buf, sizeof days_buf, "%3u day%s, ", upd,
Line 227 
Line 227 
   
         printf(" up %9.9s%9.9s load average: %.2f %.2f %.2f\n",          printf(" up %9.9s%9.9s load average: %.2f %.2f %.2f\n",
             days_buf, hours_buf,              days_buf, hours_buf,
             (double)host_stat->avenrun[0]/FSCALE,              (double)host_stat->avenrun[0] / FSCALE,
             (double)host_stat->avenrun[1]/FSCALE,              (double)host_stat->avenrun[1] / FSCALE,
             (double)host_stat->avenrun[2]/FSCALE);              (double)host_stat->avenrun[2] / FSCALE);
   
         return(0);          return(0);
 }  }
Line 242 
Line 242 
         statstime host_stat;          statstime host_stat;
         static struct timeval timeout = {25, 0};          static struct timeval timeout = {25, 0};
         extern char *__progname;          extern char *__progname;
   
         rstat_clnt = clnt_create(host, RSTATPROG, RSTATVERS_TIME, "udp");          rstat_clnt = clnt_create(host, RSTATPROG, RSTATVERS_TIME, "udp");
         if (rstat_clnt == NULL) {          if (rstat_clnt == NULL) {
                 fprintf(stderr, "%s: %s", __progname,                  fprintf(stderr, "%s: %s", __progname,
Line 313 
Line 313 
                         usage();                          usage();
                         /*NOTREACHED*/                          /*NOTREACHED*/
                 }                  }
   
         setlinebuf(stdout);          setlinebuf(stdout);
   
         if (argc == optind)          if (argc == optind)

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22