summaryrefslogtreecommitdiff
path: root/lib/readutmp.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-08-02 20:54:45 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-08-02 20:54:45 +0000
commit6517d85e0593fb8db6896a366c8e759909867b28 (patch)
tree51f29d16cf8b10924a340216639f27399244a2c4 /lib/readutmp.h
parente71e29e309ed0b3282a5ff56f759cd243dc2b712 (diff)
downloadcoreutils-6517d85e0593fb8db6896a366c8e759909867b28.tar.xz
(UT_USER): Parenthesize properly.
(UT_USER_SIZE): New constant. (read_utmp): Don't assume that the number of users is less than INT_MAX.
Diffstat (limited to 'lib/readutmp.h')
-rw-r--r--lib/readutmp.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/readutmp.h b/lib/readutmp.h
index be59fe994..100db19c5 100644
--- a/lib/readutmp.h
+++ b/lib/readutmp.h
@@ -1,7 +1,7 @@
/* Declarations for GNU's read utmp module.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -116,11 +116,11 @@
# else
# if HAVE_STRUCT_UTMP_UT_USER
-# define UT_USER(Utmp) Utmp->ut_user
+# define UT_USER(Utmp) ((Utmp)->ut_user)
# endif
# if HAVE_STRUCT_UTMP_UT_NAME
# undef UT_USER
-# define UT_USER(Utmp) Utmp->ut_name
+# define UT_USER(Utmp) ((Utmp)->ut_name)
# endif
# endif
@@ -143,6 +143,8 @@
typedef struct UTMP_STRUCT_NAME STRUCT_UTMP;
+enum { UT_USER_SIZE = sizeof UT_USER ((STRUCT_UTMP *) 0) };
+
# include <time.h>
# ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
@@ -180,6 +182,6 @@ extern int errno;
# endif
char *extract_trimmed_name (const STRUCT_UTMP *ut);
-int read_utmp (const char *filename, int *n_entries, STRUCT_UTMP **utmp_buf);
+int read_utmp (const char *filename, size_t *n_entries, STRUCT_UTMP **utmp_buf);
#endif /* __READUTMP_H__ */