struct passwd *pw;
struct group *gr;
time_t btime;
+ char commbuf[sizeof(as->ac_comm)];
if (raw) {
printf("%10lu ",(unsigned long)as->ac_btime);
} else {
btime= as->ac_btime;
tm= localtime(&btime);
- strftime(buf,sizeof(buf),"%Y-%m-%d %H:%M:%S",tm); buf[sizeof(buf)-1]= 0;
+ if (tm) {
+ strftime(buf,sizeof(buf),"%Y-%m-%d %H:%M:%S",tm); buf[sizeof(buf)-1]= 0;
+ } else {
+ snprintf(buf,sizeof(buf),"@%lu",(unsigned long)btime);
+ }
printf("%19s ",buf);
}
-
- printf("%-16.16s ", as->ac_comm);
+
+ for (i=0; i<sizeof(as->ac_comm); i++) {
+ int c=as->ac_comm[i];
+ commbuf[i]= ((c!=0 && c<=32) || c>=127) ? '?' : c;
+ }
+ printf("%-*.*s ", (int)sizeof(commbuf),(int)sizeof(commbuf), commbuf);
pw= raw ? 0 : getpwuid(as->ac_uid);
if (pw) printf("%-8s ",pw->pw_name);