1 /* Copyright (C) 1996 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@cygnus.com>
4 and Paul Janzen <pcj@primenet.com>, 1996.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
30 #include "utmp-private.h"
33 /* This is the default name. */
34 static const char default_file_name[] = _PATH_UTMP_DB;
36 /* Current file name. */
37 static const char *file_name = (const char *) default_file_name;
39 /* Descriptor for database. */
41 static char last_date[16];
44 /* Our local functions. */
45 static int setutent_db (int reset);
46 static void endutent_db (void);
47 static int utmpname_db (const char *name);
50 /* The jump table for the local functions. */
51 struct utfuncs __libc_utmp_db_functions =
64 setutent_db (int reset)
77 utmpname_db (const char *name)
79 if (strcmp (name, file_name) != 0)
81 if (strcmp (name, default_file_name) == 0)
83 if (file_name != default_file_name)
84 free ((char *) file_name);
86 file_name = default_file_name;
90 char *new_name = __strdup (name);
95 if (file_name != default_file_name)
96 free ((char *) file_name);