*** w.c.old Thu Feb 12 14:22:03 1998 --- w.c Thu Feb 12 14:26:41 1998 *************** *** 109,128 **** } /* This routine is careful since some programs leave utmp strings ! * unprintable. Always outputs at least 16 chars padded with spaces ! * on the right if necessary. */ void print_host(char* host, int len) { char *last; int width = 0; last = host + len - 1; ! for ( ; host <= last ; host++) ! if (isprint(*host) && *host != ' ') { fputc(*host, stdout); ! ++width; ! } else ! break; /* if *any* unprintables(or blanks), replace rest of line with spaces */ while (width < 16) { fputc(' ', stdout); --- 109,126 ---- } /* This routine is careful since some programs leave utmp strings ! * unprintable. Always outputs 16 chars padded with spaces on the right ! * if necessary. */ void print_host(char* host, int len) { char *last; int width = 0; last = host + len - 1; ! for ( ; host <= last && width<16 && isprint(*host) && !isspace(*host) ; ! host++, width++) fputc(*host, stdout); ! /* if *any* unprintables(or blanks), replace rest of line with spaces */ while (width < 16) { fputc(' ', stdout); *************** *** 192,204 **** print_host(u->ut_host, sizeof u->ut_host + 1); } fputs(" ", stdout); ! if (best) ! if (best->cmdline) print_strlist(stdout, best->cmdline, " ", maxcmd); ! else printf("%*.*s", maxcmd, maxcmd, best->cmd); ! else printf("-"); fputc('\n', stdout); } --- 190,206 ---- print_host(u->ut_host, sizeof u->ut_host + 1); } fputs(" ", stdout); ! if (best) { ! if (best->cmdline) { print_strlist(stdout, best->cmdline, " ", maxcmd); ! } ! else { printf("%*.*s", maxcmd, maxcmd, best->cmd); ! } ! } ! else { printf("-"); + } fputc('\n', stdout); } *************** *** 222,235 **** merid = (hour < 12) ? "am" : "pm"; if (hour >= 12) hour -= 12; if (hour == 0) hour = 12; ! if (curt - logt > 12*60*60 && logtm->tm_yday != today) ! if (curt - logt > 6*24*60*60) fprintf(fout, "%2d%3s%2d", logtm->tm_mday, month[logtm->tm_mon], logtm->tm_year % 100); ! else fprintf(fout, "%3s%2d%s", weekday[logtm->tm_wday], hour, merid); ! else fprintf(fout, "%2d:%02d%s", hour, logtm->tm_min, merid); } /* This function scans the process table accumulating total cpu times for --- 224,241 ---- merid = (hour < 12) ? "am" : "pm"; if (hour >= 12) hour -= 12; if (hour == 0) hour = 12; ! if (curt - logt > 12*60*60 && logtm->tm_yday != today) { ! if (curt - logt > 6*24*60*60) { fprintf(fout, "%2d%3s%2d", logtm->tm_mday, month[logtm->tm_mon], logtm->tm_year % 100); ! } ! else { fprintf(fout, "%3s%2d%s", weekday[logtm->tm_wday], hour, merid); ! } ! } ! else { fprintf(fout, "%2d:%02d%s", hour, logtm->tm_min, merid); + } } /* This function scans the process table accumulating total cpu times for