2
* Copyright 1991 - 1994, Julianne Frances Haugh and Chip Rosenthal
2
* Copyright (c) 1991 - 1994, Julianne Frances Haugh
3
* Copyright (c) 1991 - 1994, Chip Rosenthal
4
* Copyright (c) 1996 - 1998, Marek Michałkiewicz
5
* Copyright (c) 2003 - 2005, Tomasz Kłoczko
6
* Copyright (c) 2007 - 2008, Nicolas François
3
7
* All rights reserved.
5
9
* Redistribution and use in source and binary forms, with or without
10
14
* 2. Redistributions in binary form must reproduce the above copyright
11
15
* notice, this list of conditions and the following disclaimer in the
12
16
* documentation and/or other materials provided with the distribution.
13
* 3. Neither the name of Julianne F. Haugh nor the names of its contributors
14
* may be used to endorse or promote products derived from this software
15
* without specific prior written permission.
17
* 3. The name of the copyright holders or contributors may not be used to
18
* endorse or promote products derived from this software without
19
* specific prior written permission.
17
* THIS SOFTWARE IS PROVIDED BY JULIE HAUGH AND CONTRIBUTORS ``AS IS'' AND
18
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL JULIE HAUGH OR CONTRIBUTORS BE LIABLE
21
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
34
#include <config.h>
32
#ident "$Id: tz.c 1633 2008-01-05 13:23:22Z nekral-guest $"
38
#ident "$Id: tz.c 2355 2008-09-06 16:42:41Z nekral-guest $"
35
41
#include <string.h>
36
42
#include "defines.h"
37
43
#include "prototypes.h"
38
44
#include "getdef.h"
40
47
* tz - return local timezone name
49
56
const char *def_tz = "TZ=CST6CDT";
51
58
if ((fp = fopen (fname, "r")) == NULL ||
52
fgets (tzbuf, sizeof (tzbuf), fp) == NULL) {
59
fgets (tzbuf, (int) sizeof (tzbuf), fp) == NULL) {
54
60
if (!(def_tz = getdef_str ("ENV_TZ")) || def_tz[0] == '/')
55
61
def_tz = "TZ=CST6CDT";
58
63
strcpy (tzbuf, def_tz);