[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.16 and 1.17

version 1.16, 2002/05/27 03:14:07 version 1.17, 2003/06/10 22:20:50
Line 66 
Line 66 
 int print_rup_data(char *, statstime *host_stat);  int print_rup_data(char *, statstime *host_stat);
   
 int  int
 search_host(addr)  search_host(struct in_addr addr)
         struct in_addr addr;  
 {  {
         struct host_list *hp;          struct host_list *hp;
   
Line 82 
Line 81 
 }  }
   
 void  void
 remember_host(addr)  remember_host(struct in_addr addr)
         struct in_addr addr;  
 {  {
         struct host_list *hp;          struct host_list *hp;
   
Line 97 
Line 95 
 }  }
   
   
   
 struct rup_data {  struct rup_data {
         char *host;          char *host;
         struct statstime statstime;          struct statstime statstime;
Line 106 
Line 103 
 int rup_data_idx = 0;  int rup_data_idx = 0;
 int rup_data_max = 0;  int rup_data_max = 0;
   
 enum sort_type {  enum sort_type {
         SORT_NONE,          SORT_NONE,
         SORT_HOST,          SORT_HOST,
         SORT_LDAV,          SORT_LDAV,
Line 115 
Line 112 
 enum sort_type sort_type;  enum sort_type sort_type;
   
 int  int
 compare(d1, d2)  compare(const void *v1, const void *v2)
         struct rup_data *d1;  
         struct rup_data *d2;  
 {  {
           const struct rup_data *d1 = v1;
           const struct rup_data *d2 = v2;
   
         switch(sort_type) {          switch(sort_type) {
         case SORT_HOST:          case SORT_HOST:
                 return strcmp(d1->host, d2->host);                  return strcmp(d1->host, d2->host);
Line 126 
Line 124 
                 return d1->statstime.avenrun[0]                  return d1->statstime.avenrun[0]
                         - d2->statstime.avenrun[0];                          - d2->statstime.avenrun[0];
         case SORT_UPTIME:          case SORT_UPTIME:
                 return d1->statstime.boottime.tv_sec                  return d1->statstime.boottime.tv_sec
                         - d2->statstime.boottime.tv_sec;                          - d2->statstime.boottime.tv_sec;
         default:          default:
                 /* something's really wrong here */                  /* something's really wrong here */
Line 135 
Line 133 
 }  }
   
 void  void
 remember_rup_data(host, st)  remember_rup_data(char *host, struct statstime *st)
         char *host;  
         struct statstime *st;  
 {  {
         if (rup_data_idx >= rup_data_max) {          if (rup_data_idx >= rup_data_max) {
                 rup_data_max += 16;                  rup_data_max += 16;
                 rup_data = realloc(rup_data,                  rup_data = realloc(rup_data,
                     rup_data_max * sizeof(struct rup_data));                      rup_data_max * sizeof(struct rup_data));
                 if (rup_data == NULL) {                  if (rup_data == NULL) {
                         err(1, NULL);                          err(1, NULL);
Line 156 
Line 152 
   
   
 int  int
 rstat_reply(replyp, raddrp)  rstat_reply(char *replyp, struct sockaddr_in *raddrp)
         char *replyp;  
         struct sockaddr_in *raddrp;  
 {  {
         struct hostent *hp;          struct hostent *hp;
         char *host;          char *host;
Line 185 
Line 179 
   
   
 int  int
 print_rup_data(host, host_stat)  print_rup_data(char *host, statstime *host_stat)
         char *host;  
         statstime *host_stat;  
 {  {
         unsigned int ups = 0, upm = 0, uph = 0, upd = 0;          unsigned int ups = 0, upm = 0, uph = 0, upd = 0;
         struct tm *tmp_time, host_time;          struct tm *tmp_time, host_time;
Line 244 
Line 236 
   
   
 void  void
 onehost(host)  onehost(char *host)
         char *host;  
 {  {
         CLIENT *rstat_clnt;          CLIENT *rstat_clnt;
         statstime host_stat;          statstime host_stat;
Line 273 
Line 264 
 }  }
   
 void  void
 allhosts()  allhosts(void)
 {  {
         statstime host_stat;          statstime host_stat;
         enum clnt_stat clnt_stat;          enum clnt_stat clnt_stat;
Line 305 
Line 296 
 }  }
   
 int  int
 main(argc, argv)  main(int argc, char *argv[])
         int argc;  
         char *argv[];  
 {  {
         int ch;          int ch;
         extern int optind;          extern int optind;
Line 346 
Line 335 
   
   
 void  void
 usage()  usage(void)
 {  {
         fprintf(stderr, "Usage: rup [-dhlt] [hosts ...]\n");          fprintf(stderr, "Usage: rup [-dhlt] [hosts ...]\n");
         exit(1);          exit(1);

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17