/*****************************************************************************
- * RRDtool 1.2rc2 Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2.1 Copyright by Tobi Oetiker, 1997-2005
*****************************************************************************
* rrd_update.c RRD Update Function
*****************************************************************************
#include <sys/mman.h>
#endif
-#ifdef WIN32
+#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
#include <sys/locking.h>
#include <sys/stat.h>
#include <io.h>
#include "rrd_is_thread_safe.h"
-#ifdef WIN32
+#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
/*
* WIN32 does not have gettimeofday and struct timeval. This is a quick and dirty
* replacement.
main(int argc, char **argv){
rrd_update(argc,argv);
if (rrd_test_error()) {
- printf("RRDtool 1.2rc2 Copyright by Tobi Oetiker, 1997-2005\n\n"
+ printf("RRDtool 1.2.1 Copyright by Tobi Oetiker, 1997-2005\n\n"
"Usage: rrdupdate filename\n"
"\t\t\t[--template|-t ds-name:ds-name:...]\n"
"\t\t\ttime|N:value[:value...]\n\n"
char *template = NULL;
info_t *result = NULL;
infoval rc;
+ optind = 0; opterr = 0; /* initialize getopt */
while (1) {
static struct option long_options[] =
{
char *template = NULL;
int rc;
+ optind = 0; opterr = 0; /* initialize getopt */
while (1) {
static struct option long_options[] =
* critical except during the burning cycles. */
if (schedule_smooth)
{
-#ifndef WIN32
- rrd_file = fopen(filename,"r+");
-#else
rrd_file = fopen(filename,"rb+");
-#endif
rra_start = rra_begin;
for (i = 0; i < rrd.stat_head -> rra_cnt; ++i)
{
rrd_fd = fileno(rrdfile);
{
-#ifndef WIN32
- struct flock lock;
- lock.l_type = F_WRLCK; /* exclusive write lock */
- lock.l_len = 0; /* whole file */
- lock.l_start = 0; /* start of file */
- lock.l_whence = SEEK_SET; /* end of file */
-
- rcstat = fcntl(rrd_fd, F_SETLK, &lock);
-#else
+#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
struct _stat st;
if ( _fstat( rrd_fd, &st ) == 0 ) {
} else {
rcstat = -1;
}
+#else
+ struct flock lock;
+ lock.l_type = F_WRLCK; /* exclusive write lock */
+ lock.l_len = 0; /* whole file */
+ lock.l_start = 0; /* start of file */
+ lock.l_whence = SEEK_SET; /* end of file */
+
+ rcstat = fcntl(rrd_fd, F_SETLK, &lock);
#endif
}