include aculib in cleanup
[unix-history] / usr / src / usr.bin / ruptime / ruptime.c
index 20e11b6..a465932 100644 (file)
@@ -1,12 +1,11 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)ruptime.c  4.6 82/11/14";
+static char sccsid[] = "@(#)ruptime.c  4.12 (Berkeley) 83/05/25";
 #endif
 
 #include <sys/param.h>
 #include <stdio.h>
 #include <dir.h>
 #endif
 
 #include <sys/param.h>
 #include <stdio.h>
 #include <dir.h>
-#include <utmp.h>
-#include "rwhod.h"
+#include <rwhod.h>
 
 DIR    *etc;
 
 
 DIR    *etc;
 
@@ -20,6 +19,7 @@ struct        whod awhod;
 int    hscmp(), ucmp(), lcmp(), tcmp();
 
 #define        WHDRSIZE        (sizeof (awhod) - sizeof (awhod.wd_we))
 int    hscmp(), ucmp(), lcmp(), tcmp();
 
 #define        WHDRSIZE        (sizeof (awhod) - sizeof (awhod.wd_we))
+#define        RWHODIR         "/usr/spool/rwho"
 
 char   *interval();
 int    now;
 
 char   *interval();
 int    now;
@@ -64,8 +64,8 @@ again:
                argc--, argv++;
                goto again;
        }
                argc--, argv++;
                goto again;
        }
-       if (chdir("/etc") < 0) {
-               perror("/etc");
+       if (chdir(RWHODIR) < 0) {
+               perror(RWHODIR);
                exit(1);
        }
        etc = opendir(".");
                exit(1);
        }
        etc = opendir(".");
@@ -111,11 +111,11 @@ again:
        for (i = 0; i < nhosts; i++) {
                hsp = &hs[i];
                if (down(hsp)) {
        for (i = 0; i < nhosts; i++) {
                hsp = &hs[i];
                if (down(hsp)) {
-                       printf("%-8.8s%s\n", hsp->hs_wd->wd_hostname,
+                       printf("%-12.12s%s\n", hsp->hs_wd->wd_hostname,
                            interval(now - hsp->hs_wd->wd_recvtime, "down"));
                        continue;
                }
                            interval(now - hsp->hs_wd->wd_recvtime, "down"));
                        continue;
                }
-               printf("%-8.8s%s,  %4d user%s  load %*.2f, %*.2f, %*.2f\n",
+               printf("%-12.12s%s,  %4d user%s  load %*.2f, %*.2f, %*.2f\n",
                    hsp->hs_wd->wd_hostname,
                    interval(hsp->hs_wd->wd_sendtime -
                        hsp->hs_wd->wd_boottime, "  up"),
                    hsp->hs_wd->wd_hostname,
                    interval(hsp->hs_wd->wd_sendtime -
                        hsp->hs_wd->wd_boottime, "  up"),
@@ -151,7 +151,7 @@ interval(time, updown)
                (void) sprintf(resbuf, "%s %2d+%02d:%02d",
                    updown, days, hours, minutes);
        else
                (void) sprintf(resbuf, "%s %2d+%02d:%02d",
                    updown, days, hours, minutes);
        else
-               (void) sprintf(resbuf, "   %s %2d:%02d",
+               (void) sprintf(resbuf, "%s    %2d:%02d",
                    updown, hours, minutes);
        return (resbuf);
 }
                    updown, hours, minutes);
        return (resbuf);
 }