Default depends on whether the executable is called 'lastb' or something else. Signed-off-by: Sami Kerola <kerolasa@xxxxxx> --- login-utils/last.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/login-utils/last.c b/login-utils/last.c index 8d82c10..dbfa8ae 100644 --- a/login-utils/last.c +++ b/login-utils/last.c @@ -543,7 +543,7 @@ static int list(const struct last_control *ctl, struct utmp *p, time_t logout_ti } -static void __attribute__((__noreturn__)) usage(FILE *out) +static void __attribute__((__noreturn__)) usage(const struct last_control *ctl, FILE *out) { fputs(USAGE_HEADER, out); fprintf(out, _( @@ -557,7 +557,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out) fputs(_(" -a, --hostlast display hostnames in the last column\n"), out); fputs(_(" -d, --dns translate the IP number back into a hostname\n"), out); fprintf(out, - _(" -f, --file <file> use a specific file instead of %s\n"), _PATH_WTMP); + _(" -f, --file <file> use a specific file instead of %s\n"), ctl->lastb ? _PATH_BTMP : _PATH_WTMP); fputs(_(" -F, --fulltimes print full login and logout times and dates\n"), out); fputs(_(" -i, --ip display IP numbers in numbers-and-dots notation\n"), out); fputs(_(" -n, --limit <number> how many lines to show\n"), out); @@ -911,7 +911,10 @@ int main(int argc, char **argv) bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); atexit(close_stdout); - + /* + * Which file do we want to read? + */ + ctl.lastb = strcmp(program_invocation_short_name, "lastb") == 0 ? 1 : 0; while ((c = getopt_long(argc, argv, "hVf:n:RxadFit:p:s:0123456789w", long_opts, NULL)) != -1) { @@ -919,7 +922,7 @@ int main(int argc, char **argv) switch(c) { case 'h': - usage(stdout); + usage(&ctl, stdout); break; case 'V': printf(UTIL_LINUX_VERSION); @@ -979,7 +982,7 @@ int main(int argc, char **argv) ctl.time_fmt = which_time_format(optarg); break; default: - usage(stderr); + usage(&ctl, stderr); break; } } @@ -987,10 +990,6 @@ int main(int argc, char **argv) if (optind < argc) ctl.show = argv + optind; - /* - * Which file do we want to read? - */ - ctl.lastb = strcmp(program_invocation_short_name, "lastb") == 0 ? 1 : 0; if (!files) { files = xmalloc(sizeof(char *)); files[nfiles++] = xstrdup(ctl.lastb ? _PATH_BTMP : _PATH_WTMP); -- 2.6.1 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html