summaryrefslogtreecommitdiffstats
path: root/login-utils/last.c
diff options
context:
space:
mode:
authorSami Kerola2013-08-17 20:15:15 +0200
committerKarel Zak2013-08-23 10:58:59 +0200
commite843d047535b6523c16db8c37479f6fe29a50b72 (patch)
tree579e672ef6ff378c8a7821e1605411e68b313fdd /login-utils/last.c
parentlast: make switch cases complete, and inform if impossible occurs (diff)
downloadkernel-qcow2-util-linux-e843d047535b6523c16db8c37479f6fe29a50b72.tar.gz
kernel-qcow2-util-linux-e843d047535b6523c16db8c37479f6fe29a50b72.tar.xz
kernel-qcow2-util-linux-e843d047535b6523c16db8c37479f6fe29a50b72.zip
last: prefer enum rather than #definition list
Incremental number lists are more hard to get wrong with enum, and they are nicer to debug as for example gdb is aware of these symbolic names. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'login-utils/last.c')
-rw-r--r--login-utils/last.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/login-utils/last.c b/login-utils/last.c
index 276d13abd..d561e962e 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -64,13 +64,15 @@ struct utmplist {
struct utmplist *utmplist = NULL;
/* Types of listing */
-#define R_CRASH 1 /* No logout record, system boot in between */
-#define R_DOWN 2 /* System brought down in decent way */
-#define R_NORMAL 3 /* Normal */
-#define R_NOW 4 /* Still logged in */
-#define R_REBOOT 5 /* Reboot record. */
-#define R_PHANTOM 6 /* No logout record but session is stale. */
-#define R_TIMECHANGE 7 /* NEW_TIME or OLD_TIME */
+enum {
+ R_CRASH = 1, /* No logout record, system boot in between */
+ R_DOWN, /* System brought down in decent way */
+ R_NORMAL, /* Normal */
+ R_NOW, /* Still logged in */
+ R_REBOOT, /* Reboot record. */
+ R_PHANTOM, /* No logout record but session is stale. */
+ R_TIMECHANGE /* NEW_TIME or OLD_TIME */
+};
/* Global variables */
static unsigned int maxrecs = 0; /* Maximum number of records to list. */