[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gnulib] readutmp changes imported from coreutils
From: |
Paul Eggert |
Subject: |
[bug-gnulib] readutmp changes imported from coreutils |
Date: |
Tue, 30 Nov 2004 23:29:56 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
I installed this into gnulib from coreutils:
2004-11-30 Paul Eggert <address@hidden>
* lib/readutmp.c: Include readutmp.h first.
Include <errno.h>, since readutmp.h no longer does that.
* lib/readutmp.h: Don't include <errno.h>,
<sys/param.h>, <time.h>; not needed to establish interface.
(errno): Remove decl.
(HAVE_STRUCT_XTMP_UT_TYPE): Remove; no longer needed.
(UT_TYPE_EQ, UT_TYPE_NOT_DEFINED, UT_TYPE_BOOT_TIME,
UT_TYPE_USER_PROCESS, IS_USER_PROCESS): New macros.
* m4/readutmp.m4 (gl_READUTMP): Don't check for sys/param.h.
Index: lib/readutmp.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/readutmp.c,v
retrieving revision 1.18
diff -p -u -r1.18 readutmp.c
--- lib/readutmp.c 4 Oct 2004 20:17:39 -0000 1.18
+++ lib/readutmp.c 1 Dec 2004 07:29:05 -0000
@@ -19,6 +19,9 @@
#include <config.h>
+#include "readutmp.h"
+
+#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
@@ -26,7 +29,6 @@
#include <string.h>
#include <stdlib.h>
-#include "readutmp.h"
#include "xalloc.h"
#if USE_UNLOCKED_IO
Index: lib/readutmp.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/readutmp.h,v
retrieving revision 1.15
diff -p -u -r1.15 readutmp.h
--- lib/readutmp.h 7 Aug 2004 00:09:39 -0000 1.15
+++ lib/readutmp.h 1 Dec 2004 07:29:05 -0000
@@ -137,24 +137,10 @@
(HAVE_STRUCT_UTMP_UT_PID \
|| HAVE_STRUCT_UTMPX_UT_PID)
-# define HAVE_STRUCT_XTMP_UT_TYPE \
- (HAVE_STRUCT_UTMP_UT_TYPE \
- || HAVE_STRUCT_UTMPX_UT_TYPE)
-
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>
-# endif
-
-# include <errno.h>
-# ifndef errno
-extern int errno;
-# endif
-
# if !defined (UTMP_FILE) && defined (_PATH_UTMP)
# define UTMP_FILE _PATH_UTMP
# endif
@@ -181,6 +167,31 @@ extern int errno;
# define WTMP_FILE "/etc/wtmp"
# endif
+# if HAVE_STRUCT_UTMP_UT_TYPE || HAVE_STRUCT_UTMPX_UT_TYPE
+# define UT_TYPE_EQ(U, V) ((U)->ut_type == (V))
+# define UT_TYPE_NOT_DEFINED 0
+# else
+# define UT_TYPE_EQ(U, V) 0
+# define UT_TYPE_NOT_DEFINED 1
+# endif
+
+# ifdef BOOT_TIME
+# define UT_TYPE_BOOT_TIME(U) UT_TYPE_EQ (U, BOOT_TIME)
+# else
+# define UT_TYPE_BOOT_TIME(U) 0
+# endif
+
+# ifdef USER_PROCESS
+# define UT_TYPE_USER_PROCESS(U) UT_TYPE_EQ (U, USER_PROCESS)
+# else
+# define UT_TYPE_USER_PROCESS(U) 0
+# endif
+
+# define IS_USER_PROCESS(U) \
+ (UT_USER (U)[0] \
+ && (UT_TYPE_USER_PROCESS (U) \
+ || (UT_TYPE_NOT_DEFINED && UT_TIME_MEMBER (U) != 0)))
+
char *extract_trimmed_name (const STRUCT_UTMP *ut);
int read_utmp (const char *filename, size_t *n_entries, STRUCT_UTMP
**utmp_buf);
Index: m4/readutmp.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/readutmp.m4,v
retrieving revision 1.5
diff -p -u -r1.5 readutmp.m4
--- m4/readutmp.m4 1 Jun 2004 20:27:23 -0000 1.5
+++ m4/readutmp.m4 1 Dec 2004 07:29:05 -0000
@@ -1,4 +1,4 @@
-# readutmp.m4 serial 4
+# readutmp.m4 serial 5
dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
@@ -9,7 +9,6 @@ dnl the same distribution terms as the r
AC_DEFUN([gl_READUTMP],
[
dnl Prerequisites of lib/readutmp.h.
- AC_CHECK_HEADERS_ONCE(sys/param.h)
AC_CHECK_HEADERS(utmp.h utmpx.h)
AC_CHECK_FUNCS(utmpname utmpxname)
AC_CHECK_DECLS(getutent,,,[
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-gnulib] readutmp changes imported from coreutils,
Paul Eggert <=