From: oetiker Date: Mon, 2 May 2005 20:27:13 +0000 (+0000) Subject: files that help getting that native windows port going -- Philippe.Simonet with swiss... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=87f4cbe5dbe9d13dba476998511d2651b2910044;p=rrdtool-all.git files that help getting that native windows port going -- Philippe.Simonet with swisscom.com git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@478 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/confignt/config.h b/program/confignt/config.h index 3a7336b0..d4d8be76 100644 --- a/program/confignt/config.h +++ b/program/confignt/config.h @@ -1,28 +1,54 @@ -/* config.h.nt: what configure _would_ say, if it ran on NT */ +/* config.h.in. Generated from configure.ac by autoheader. */ +#ifndef CONFIG_H +#define CONFIG_H -#define STDC_HEADERS 1 +#include +#include -/* Define if you have the strftime function. */ -#define HAVE_STRFTIME 1 +/* realloc does not support NULL as argument */ -/* Define if you have the header file. */ +#define HAVE_STRFTIME 1 +#define HAVE_TIME_H 1 +#define HAVE_LOCALE_H 1 +#define HAVE_TZSET 1 +#define HAVE_SETLOCALE 1 #define HAVE_MATH_H 1 - +#define HAVE_FLOAT_H 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MKTIME 1 +#define HAVE_STRFTIME 1 +#define HAVE_STRING_H 1 +#define HAVE_VPRINTF 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 -#define rrd_realloc(a,b) realloc((a), (b)) +//#define PACKAGE "rrdtool" +//#define PACKAGE_NAME "rrdtool" +//#define PACKAGE_STRING "rrdtool 1.2rc6" +//#define PACKAGE_VERSION "1.2rc6" +//#define VERSION "1.2rc6" + +#define STDC_HEADERS 1 +#define RRD_DEFAULT_FONT "arial.ttf" #define snprintf _snprintf +#define strftime strftime_ -/* Code in rrd_graph.c:rrd_graph_init() uses the %windir% environment - * variable to find the actual location of this relative font path to avoid - * the recompile problem if the system directory is c:/windows vs. d:/winnt. - */ +#define NO_NULL_REALLOC 1 +#if NO_NULL_REALLOC +# define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) )) +#else +# define rrd_realloc(a,b) realloc((a), (b)) +#endif -#define RRD_DEFAULT_FONT "cour.ttf" +//#define DEBUG 1 +/* Vertical label angle: 90.0 (default) or 270.0 */ #define RRDGRAPH_YLEGEND_ANGLE 90.0 -#define HAVE_STRING_H 1 +/* Define to 1 if you have the ANSI C header files. */ + + +#endif /* CONFIG_H */ diff --git a/program/src/win32comp.c b/program/src/win32comp.c new file mode 100644 index 00000000..590e4787 --- /dev/null +++ b/program/src/win32comp.c @@ -0,0 +1,67 @@ +// compatibility routines, non reentrant .... + +#include +#include + +struct tm* localtime_r(const time_t* t, struct tm* r) { + struct tm * temp; + temp = localtime(t); + memcpy(r,temp,sizeof(struct tm)); + return(r); +} + +struct tm* gmtime_r(const time_t* t, struct tm* r) { + struct tm * temp; + temp = gmtime(t); + memcpy(r,temp,sizeof(struct tm)); + return r; +} + +char* ctime_r (const time_t* t, char* buf) { + char * temp; + temp = asctime(localtime(t)); + strcpy(buf,temp); + return(buf); +} + +/* + s + Points to the string from which to extract tokens. + + delim + Points to a null-terminated set of delimiter characters. + + save_ptr + Is a value-return parameter used by strtok_r() to record its progress through s1. +*/ + + +char * strtok_r (char *s, const char *delim, char **save_ptr) { + char *token; + + if (s == NULL) s = *save_ptr; + + /* Scan leading delimiters. */ + s += strspn(s, delim); + if (*s == '\0') + { + *save_ptr = s; + return NULL; + } + + /* Find the end of the token. */ + token = s; + s = strpbrk (token, delim); + if (s == NULL) { + /* This token finishes the string. */ + *save_ptr = token; + while (**save_ptr != '\0') (*save_ptr)++; + } else + { + /* Terminate the token and make *SAVE_PTR point past it. */ + *s = '\0'; + *save_ptr = s + 1; + } + return token; +} +