The separation was unnecessary, and caused build problems. Let's go wild and obliterate the library. The files are moved to libshadow. Scripted change: $ find libmisc/ -type f \ | grep '\.[chy]$' \ | xargs mv -t lib; Plus updating the Makefile and other references. While at it, I've sorted the sources lists. Link: <https://github.com/shadow-maint/shadow/pull/792> Reported-by: David Seifert <soap@gentoo.org> Cc: Sam James <sam@gentoo.org> Cc: Christian Bricart <christian@bricart.de> Cc: Michael Vetter <jubalh@iodoru.org> Cc: Robert Förster <Dessa@gmake.de> [ soap tested the Gentoo package ] Tested-by: David Seifert <soap@gentoo.org> Acked-by: David Seifert <soap@gentoo.org> Acked-by: Serge Hallyn <serge@hallyn.com> Acked-by: Iker Pedrosa <ipedrosa@redhat.com> Acked-by: <lslebodn@fedoraproject.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
59 lines
1.3 KiB
C
59 lines
1.3 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh
|
|
* SPDX-FileCopyrightText: 1991 - 1994, Chip Rosenthal
|
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
|
* SPDX-FileCopyrightText: 2007 - 2010, Nicolas François
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#ifndef USE_PAM
|
|
|
|
#ident "$Id$"
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "defines.h"
|
|
#include "prototypes.h"
|
|
#include "getdef.h"
|
|
|
|
/*
|
|
* tz - return local timezone name
|
|
*
|
|
* tz() determines the name of the local timezone by reading the
|
|
* contents of the file named by ``fname''.
|
|
*/
|
|
/*@observer@*/const char *tz (const char *fname)
|
|
{
|
|
FILE *fp = NULL;
|
|
static char tzbuf[BUFSIZ];
|
|
const char *def_tz = "TZ=CST6CDT";
|
|
|
|
fp = fopen (fname, "r");
|
|
if ( (NULL == fp)
|
|
|| (fgets (tzbuf, sizeof (tzbuf), fp) == NULL)) {
|
|
def_tz = getdef_str ("ENV_TZ");
|
|
if ((NULL == def_tz) || ('/' == def_tz[0])) {
|
|
def_tz = "TZ=CST6CDT";
|
|
}
|
|
|
|
strcpy (tzbuf, def_tz);
|
|
} else {
|
|
/* Remove optional trailing '\n'. */
|
|
tzbuf[strcspn (tzbuf, "\n")] = '\0';
|
|
}
|
|
|
|
if (NULL != fp) {
|
|
(void) fclose (fp);
|
|
}
|
|
|
|
return tzbuf;
|
|
}
|
|
#else /* !USE_PAM */
|
|
extern int ISO_C_forbids_an_empty_translation_unit;
|
|
#endif /* !USE_PAM */
|
|
|