From: Karel Zak Date: Tue, 20 Feb 2024 09:28:06 +0000 (+0100) Subject: lastlog: cleanup function definitions X-Git-Tag: v2.42-start~520^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c71f38287c81cb06433e3949dadba8bc74dc8588;p=thirdparty%2Futil-linux.git lastlog: cleanup function definitions - let's make it more compatible with the rest of util-linux - don't initialize global static variables (it's unnecessary) Signed-off-by: Karel Zak --- diff --git a/misc-utils/lastlog2.c b/misc-utils/lastlog2.c index 6aacd0319..91bb98caf 100644 --- a/misc-utils/lastlog2.c +++ b/misc-utils/lastlog2.c @@ -41,16 +41,15 @@ static char *lastlog2_path = LL2_DEFAULT_DATABASE; -static int bflg = 0; -static time_t b_days = 0; -static int tflg = 0; -static time_t t_days = 0; -static int sflg = 0; - -static int -print_entry(const char *user, int64_t ll_time, - const char *tty, const char *rhost, - const char *pam_service, const char *error) +static int bflg; +static time_t b_days; +static int tflg; +static time_t t_days; +static int sflg; + +static int print_entry(const char *user, int64_t ll_time, + const char *tty, const char *rhost, + const char *pam_service, const char *error) { static int once = 0; char *datep; @@ -75,7 +74,7 @@ print_entry(const char *user, int64_t ll_time, if (tm == NULL) datep = "(unknown)"; else { - strftime (datetime, sizeof(datetime), "%a %b %e %H:%M:%S %z %Y", tm); + strftime(datetime, sizeof(datetime), "%a %b %e %H:%M:%S %z %Y", tm); datep = datetime; } @@ -101,8 +100,7 @@ print_entry(const char *user, int64_t ll_time, return 0; } -static void -usage(void) +static void __attribute__((__noreturn__)) usage(void) { FILE *output = stdout; @@ -129,16 +127,14 @@ usage(void) /* Check if an user exists on the system. If yes, return 0, else return -1. */ -static int -check_user(const char *name) +static int check_user(const char *name) { if (getpwnam(name) == NULL) return -1; return 0; } -int -main(int argc, char **argv) +int main(int argc, char **argv) { static const struct option longopts[] = { {"before", required_argument, NULL, 'b'},