]> granicus.if.org Git - postgresql/blob - src/timezone/pgtz.c
Fix zic compiler to use pg version.
[postgresql] / src / timezone / pgtz.c
1 /*-------------------------------------------------------------------------
2  *
3  * pgtz.c
4  *    Timezone Library Integration Functions
5  *
6  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
7  *
8  * IDENTIFICATION
9  *        $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.3 2004/04/30 20:23:28 momjian Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13
14 #include "pgtz.h"
15 #include "tzfile.h"
16
17
18 static char tzdir[MAXPGPATH];
19 static int done_tzdir = 0;
20 char *pgwin32_TZDIR(void) {
21         char *p;
22         if (done_tzdir)
23                 return tzdir;
24
25 #ifndef WIN32
26         StrNCpy(tzdir, PGDATADIR, MAXPGPATH);
27 #else
28         if (GetModuleFileName(NULL,tzdir,MAXPGPATH) == 0)
29                 return NULL;
30 #endif
31         
32         canonicalize_path(tzdir);
33         if ((p = last_path_separator(tzdir)) == NULL)
34                 return NULL;
35         else
36                 *p = '\0';
37         
38         strcat(tzdir,"/timezone");
39
40         done_tzdir=1;
41         return tzdir;
42 }