[Nagiosplug-checkins] CVS: nagiosplug/plugins utils.h.in,1.2,1.3

Karl DeBisschop kdebisschop at users.sourceforge.net
Tue Oct 15 21:57:02 CEST 2002


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory usw-pr-cvs1:/tmp/cvs-serv30873/plugins

Modified Files:
	utils.h.in 
Log Message:
start support for gettimeofday and tv_usec

Index: utils.h.in
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** utils.h.in	19 Jun 2002 05:11:52 -0000	1.2
--- utils.h.in	16 Oct 2002 04:56:10 -0000	1.3
***************
*** 46,49 ****
--- 46,67 ----
  int is_option (char *);
  
+ /* generalized timer that will do milliseconds if available */
+ #ifndef HAVE_GETTIMEOFDAY
+ struct timeval {
+ 	long tv_sec;        /* seconds */
+ 	long tv_usec;  /* microseconds */
+ };
+ 
+ struct timezone {
+ 	int  tz_minuteswest; /* minutes W of Greenwich */
+ 	int  tz_dsttime;     /* type of dst correction */
+ };
+ 
+ #define gettimeofday (tvp,tz) {\
+  tvp->tv_usec=0;\
+  tvp->tv_sec=(long)time();\
+ }
+ #endif
+ 
  /* Handle strings safely */
  
***************
*** 52,56 ****
  char *strscat (char *dest, char *src);
  char *strnl (char *str);
! char *ssprintf (char *str, const char *fmt, ...);
  char *strpcpy (char *dest, const char *src, const char *str);
  char *strpcat (char *dest, const char *src, const char *str);
--- 70,74 ----
  char *strscat (char *dest, char *src);
  char *strnl (char *str);
! char *ssprintf (char *str, const char *fmt, ...); /* deprecate for asprintf */
  char *strpcpy (char *dest, const char *src, const char *str);
  char *strpcat (char *dest, const char *src, const char *str);
***************
*** 62,74 ****
  
  #define usage(msg) {\
!   printf(msg);\
!   print_usage();\
! exit(STATE_UNKNOWN);\
  }
  
  #define usage2(msg,arg) {\
!   printf("%s: %s - %s\n",PROGNAME,msg,arg);\
!   print_usage();\
!   exit(STATE_UNKNOWN);\
  }
  
--- 80,92 ----
  
  #define usage(msg) {\
!  printf(msg);\
!  print_usage();\
!  exit(STATE_UNKNOWN);\
  }
  
  #define usage2(msg,arg) {\
!  printf("%s: %s - %s\n",PROGNAME,msg,arg);\
!  print_usage();\
!  exit(STATE_UNKNOWN);\
  }
  
***************
*** 95,96 ****
--- 113,115 ----
  {"hostname",required_argument,0,'H'},\
  {"file",required_argument,0,'F'}
+ 





More information about the Commits mailing list