* libmisc/utmp.c, src/userdel.c, src/logoutd.c: Replace #if by #ifdef

This commit is contained in:
nekral-guest 2009-04-28 20:03:23 +00:00
parent 90cc7f0f1d
commit dd85562fac
4 changed files with 26 additions and 22 deletions

View File

@ -1,3 +1,7 @@
2009-04-28 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/utmp.c, src/userdel.c, src/logoutd.c: Replace #if by #ifdef
2009-04-28 Nicolas François <nicolas.francois@centraliens.net>
* src/vipw.c: Harmonize messages.

View File

@ -37,7 +37,7 @@
#include <utmp.h>
#if USE_UTMPX
#ifdef USE_UTMPX
#include <utmpx.h>
#endif

View File

@ -54,21 +54,21 @@ char *Prog;
#endif
/* local function prototypes */
#if HAVE_UTMPX_H
#ifdef USE_UTMPX
static int check_login (const struct utmpx *ut);
#else
#else /* !USE_UTMPX */
static int check_login (const struct utmp *ut);
#endif
#endif /* !USE_UTMPX */
static void send_mesg_to_tty (int tty_fd);
/*
* check_login - check if user (struct utmpx/utmp) allowed to stay logged in
*/
#if HAVE_UTMPX_H
#ifdef USE_UTMPX
static int check_login (const struct utmpx *ut)
#else
#else /* !USE_UTMPX */
static int check_login (const struct utmp *ut)
#endif
#endif /* !USE_UTMPX */
{
char user[sizeof (ut->ut_user) + 1];
time_t now;
@ -147,11 +147,11 @@ int main (int argc, char **argv)
int status;
pid_t pid;
#if HAVE_UTMPX_H
#ifdef USE_UTMPX
struct utmpx *ut;
#else
#else /* !USE_UTMPX */
struct utmp *ut;
#endif
#endif /* !USE_UTMPX */
char user[sizeof (ut->ut_user) + 1]; /* terminating NUL */
char tty_name[sizeof (ut->ut_line) + 6]; /* /dev/ + NUL */
int tty_fd;
@ -200,22 +200,22 @@ int main (int argc, char **argv)
* Attempt to re-open the utmpx/utmp file. The file is only
* open while it is being used.
*/
#if HAVE_UTMPX_H
#ifdef USE_UTMPX
setutxent ();
#else
#else /* !USE_UTMPX */
setutent ();
#endif
#endif /* !USE_UTMPX */
/*
* Read all of the entries in the utmpx/utmp file. The entries
* for login sessions will be checked to see if the user
* is permitted to be signed on at this time.
*/
#if HAVE_UTMPX_H
#ifdef USE_UTMPX
while ((ut = getutxent ()) != NULL)
#else
#else /* !USE_UTMPX */
while ((ut = getutent ()) != NULL)
#endif
#endif /* !USE_UTMPX */
{
if (ut->ut_type != USER_PROCESS) {
continue;
@ -279,11 +279,11 @@ int main (int argc, char **argv)
exit (0);
}
#if HAVE_UTMPX_H
#ifdef USE_UTMPX
endutxent ();
#else
#else /* !USE_UTMPX */
endutent ();
#endif
#endif /* !USE_UTMPX */
#ifndef DEBUG
sleep (60);

View File

@ -590,17 +590,17 @@ static void user_busy (const char *name, uid_t uid)
* We see if the user is logged in by looking for the user name
* in the utmp file.
*/
#if HAVE_UTMPX_H
#ifdef USE_UTMPX
struct utmpx *utent;
setutxent ();
while ((utent = getutxent ()) != NULL)
#else
#else /* !USE_UTMPX */
struct utmp *utent;
setutent ();
while ((utent = getutent ()) != NULL)
#endif
#endif /* !USE_UTMPX */
{
if (utent->ut_type != USER_PROCESS)
continue;