last: code shrink

function                                             old     new   delta
show_entry                                           319     311      -8
last_main                                            917     907     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18)             Total: -18 bytes
This commit is contained in:
Denis Vlasenko
2008-05-25 01:14:14 +00:00
parent 69dc325397
commit 30f892a0ee
2 changed files with 20 additions and 19 deletions

View File

@@ -118,9 +118,10 @@ int last_main(int argc, char **argv ATTRIBUTE_UNUSED)
printf("%-10s %-14s %-18s %-12.12s\n",
ut.ut_user, ut.ut_line, ut.ut_host, ctime(&t_tmp) + 4);
next:
if (!pos)
pos -= sizeof(ut);
if (pos <= 0)
break; /* done. */
pos = lseek(file, pos - sizeof(ut), SEEK_SET);
xlseek(file, pos, SEEK_SET);
}
fflush_stdout_and_exit(EXIT_SUCCESS);