From: Karel Zak Date: Mon, 12 Aug 2013 11:42:25 +0000 (+0200) Subject: last: consolidate btmp/wtmp file paths X-Git-Tag: v2.24-rc1~390 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4c7dfea7a44805a4b40684ddd4478633a8629482;p=thirdparty%2Futil-linux.git last: consolidate btmp/wtmp file paths .. so share the paths with another utils. Signed-off-by: Karel Zak --- diff --git a/login-utils/last.c b/login-utils/last.c index 76db12aa2a..3b59bb5d2a 100644 --- a/login-utils/last.c +++ b/login-utils/last.c @@ -43,6 +43,7 @@ #include "c.h" #include "nls.h" +#include "pathnames.h" #ifndef SHUTDOWN_TIME # define SHUTDOWN_TIME 254 @@ -176,27 +177,6 @@ static int uread(FILE *fp, struct utmp *u, int *quit) return 1; } -/* - * Try to be smart about the location of the BTMP file - */ -#ifndef BTMP_FILE -#define BTMP_FILE getbtmp() -static char *getbtmp(void) -{ - static char btmp[128]; - char *p; - - strcpy(btmp, WTMP_FILE); - if ((p = strrchr(btmp, '/')) == NULL) - p = btmp; - else - p++; - *p = 0; - strcat(btmp, "btmp"); - return btmp; -} -#endif - /* * Print a short date. */ @@ -460,7 +440,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 use a specific file instead of %s\n"), WTMP_FILE); + _(" -f, --file use a specific file instead of %s\n"), _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 how many lines to show\n"), out); @@ -629,10 +609,10 @@ int main(int argc, char **argv) * Which file do we want to read? */ if (strcmp(progname, "lastb") == 0) { - ufile = BTMP_FILE; + ufile = _PATH_BTMP; lastb = 1; } else - ufile = WTMP_FILE; + ufile = _PATH_WTMP; if (altufile) ufile = altufile; time(&lastdown);