Lines 191-197
Link Here
|
191 |
return; |
191 |
return; |
192 |
|
192 |
|
193 |
strncpy(uname, u->ut_user, USERSZ); /* force NUL term for printf */ |
193 |
strncpy(uname, u->ut_user, USERSZ); /* force NUL term for printf */ |
194 |
if (formtype) { |
194 |
switch(formtype) { |
|
|
195 |
case 2: |
196 |
printf("%s %s", uname, u->ut_line); |
197 |
if (from) |
198 |
print_host(u->ut_host, sizeof u->ut_host); |
199 |
print_logintime(u->ut_time, stdout); |
200 |
if (*u->ut_line == ':') /* idle unknown for xdm logins */ |
201 |
printf(" ?xdm? "); |
202 |
else |
203 |
print_time_ival7(idletime(tty), 0, stdout); |
204 |
print_time_ival7(jcpu/Hertz, (jcpu%Hertz)*(100./Hertz), stdout); |
205 |
if (best) { |
206 |
unsigned long long pcpu = best->utime + best->stime; |
207 |
print_time_ival7(pcpu/Hertz, (pcpu%Hertz)*(100./Hertz), stdout); |
208 |
} else |
209 |
printf(" ? "); |
210 |
break; |
211 |
|
212 |
case 1: |
195 |
printf("%-9.8s%-9.8s", uname, u->ut_line); |
213 |
printf("%-9.8s%-9.8s", uname, u->ut_line); |
196 |
if (from) |
214 |
if (from) |
197 |
print_host(u->ut_host, sizeof u->ut_host); |
215 |
print_host(u->ut_host, sizeof u->ut_host); |
Lines 206-212
Link Here
|
206 |
print_time_ival7(pcpu/Hertz, (pcpu%Hertz)*(100./Hertz), stdout); |
224 |
print_time_ival7(pcpu/Hertz, (pcpu%Hertz)*(100./Hertz), stdout); |
207 |
} else |
225 |
} else |
208 |
printf(" ? "); |
226 |
printf(" ? "); |
209 |
} else { |
227 |
break; |
|
|
228 |
case 0: |
210 |
printf("%-9.8s%-9.8s", u->ut_user, u->ut_line); |
229 |
printf("%-9.8s%-9.8s", u->ut_user, u->ut_line); |
211 |
if (from) |
230 |
if (from) |
212 |
print_host(u->ut_host, sizeof u->ut_host); |
231 |
print_host(u->ut_host, sizeof u->ut_host); |
Lines 214-219
Link Here
|
214 |
printf(" ?xdm? "); |
233 |
printf(" ?xdm? "); |
215 |
else |
234 |
else |
216 |
print_time_ival7(idletime(tty), 0, stdout); |
235 |
print_time_ival7(idletime(tty), 0, stdout); |
|
|
236 |
|
237 |
break; |
217 |
} |
238 |
} |
218 |
fputs(" ", stdout); |
239 |
fputs(" ", stdout); |
219 |
if (likely(best)) { |
240 |
if (likely(best)) { |
Lines 238-248
Link Here
|
238 |
#endif |
259 |
#endif |
239 |
|
260 |
|
240 |
setlocale(LC_ALL, ""); |
261 |
setlocale(LC_ALL, ""); |
241 |
for (args=0; (ch = getopt(argc, argv, "hlusfV")) != EOF; args++) |
262 |
for (args=0; (ch = getopt(argc, argv, "hlusnfV")) != EOF; args++) |
242 |
switch (ch) { |
263 |
switch (ch) { |
243 |
case 'h': header = 0; break; |
264 |
case 'h': header = 0; break; |
244 |
case 'l': longform = 1; break; |
265 |
case 'l': longform = 1; break; |
245 |
case 's': longform = 0; break; |
266 |
case 's': longform = 0; break; |
|
|
267 |
case 'n': longform = 2; header=0; break; |
246 |
case 'f': from = !from; break; |
268 |
case 'f': from = !from; break; |
247 |
case 'V': display_version(); exit(0); |
269 |
case 'V': display_version(); exit(0); |
248 |
case 'u': ignoreuser = 1; break; |
270 |
case 'u': ignoreuser = 1; break; |
Lines 251-256
Link Here
|
251 |
" -h skip header\n" |
273 |
" -h skip header\n" |
252 |
" -l long listing (default)\n" |
274 |
" -l long listing (default)\n" |
253 |
" -s short listing\n" |
275 |
" -s short listing\n" |
|
|
276 |
" -n non truncated listing (large)\n" |
254 |
" -u ignore uid of processes\n" |
277 |
" -u ignore uid of processes\n" |
255 |
" -f toggle FROM field (default %s)\n" |
278 |
" -f toggle FROM field (default %s)\n" |
256 |
" -V display version\n", FROM_STRING); |
279 |
" -V display version\n", FROM_STRING); |