-/* $Id: drv_generic_parport.c,v 1.3 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: drv_generic_parport.c,v 1.4 2004/03/03 04:44:16 reinelt Exp $
*
* generic driver helper for serial and parport access
*
*
*
* $Log: drv_generic_parport.c,v $
+ * Revision 1.4 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.3 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
#endif
#include "debug.h"
+#include "qprintf.h"
#include "cfg.h"
#include "udelay.h"
#include "drv_generic_parport.h"
-#include "qprintf.h"
static char *Driver="";
-/* $Id: drv_generic_serial.c,v 1.7 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: drv_generic_serial.c,v 1.8 2004/03/03 04:44:16 reinelt Exp $
*
* generic driver helper for serial and usbserial displays
*
*
*
* $Log: drv_generic_serial.c,v $
+ * Revision 1.8 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.7 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
#include <sys/stat.h>
#include "debug.h"
+#include "qprintf.h"
#include "cfg.h"
#include "drv_generic_serial.h"
-#include "qprintf.h"
static char *Driver;
-/* $Id: hash.c,v 1.14 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: hash.c,v 1.15 2004/03/03 04:44:16 reinelt Exp $
*
* hashes (associative arrays)
*
*
*
* $Log: hash.c,v $
+ * Revision 1.15 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.14 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
#define DELTA_SLOTS 64
-static timeval __my_time_of_day;
-
-int gettimeofday_ex(timeval *tv, struct timezone *tz) {
- if (tv==NULL) return -1;
-
- if (__my_time_of_day.tv_usec == 0 && __my_time_of_day.tv_sec==0) {
- gettimeofday_update();
- }
-
- tv->tv_sec = __my_time_of_day.tv_sec;
- tv->tv_usec= __my_time_of_day.tv_usec;
- return 0;
-}
-
-void gettimeofday_update(){
- gettimeofday(&__my_time_of_day, NULL);
-}
-
// bsearch compare function for hash entries
static int hash_lookup_f (const void *a, const void *b)
hash_got_string:
// set timestamps
- gettimeofday_ex(&Hash->time, NULL);
+ gettimeofday(&Hash->time, NULL);
Item->time=Hash->time;
return Item;
if (--Item->root < 0) Item->root = DELTA_SLOTS-1;
// set first entry
- gettimeofday_ex(&(Item->Slot[Item->root].time), NULL);
+ gettimeofday(&(Item->Slot[Item->root].time), NULL);
Item->Slot[Item->root].val=number;
}
timeval now, *stamp;
int age;
- gettimeofday_update();
-
if (key!=NULL) {
Item=hash_lookup(Hash, key, 1);
if (value) *value=Item?Item->val:NULL;
stamp=&Hash->time;
}
- gettimeofday_ex(&now, NULL);
+ gettimeofday(&now, NULL);
age = (now.tv_sec - stamp->tv_sec)*1000 + (now.tv_usec - stamp->tv_usec)/1000;
-/* $Id: hash.h,v 1.9 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: hash.h,v 1.10 2004/03/03 04:44:16 reinelt Exp $
*
* hashes (associative arrays)
*
*
*
* $Log: hash.h,v $
+ * Revision 1.10 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.9 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
double hash_get_delta (HASH *Hash, char *key, int delay);
double hash_get_regex (HASH *Hash, char *key, int delay);
void hash_destroy (HASH *Hash);
-
-int gettimeofday_ex(struct timeval *tv, struct timezone *tz);
-void gettimeofday_update();
-
#endif
-/* $Id: lcd4linux.c,v 1.65 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: lcd4linux.c,v 1.66 2004/03/03 04:44:16 reinelt Exp $
*
* LCD4Linux
*
*
*
* $Log: lcd4linux.c,v $
+ * Revision 1.66 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.65 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
#include "cfg.h"
#include "debug.h"
+#include "qprintf.h"
#include "pid.h"
#include "udelay.h"
#include "drv.h"
#include "layout.h"
#include "plugin.h"
-#include "qprintf.h"
#ifdef WITH_DMALLOC
#include <dmalloc.h>
-/* $Id: pid.c,v 1.4 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: pid.c,v 1.5 2004/03/03 04:44:16 reinelt Exp $
*
* PID file handling
*
*
*
* $Log: pid.c,v $
+ * Revision 1.5 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.4 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
#include "pid.h"
#include "qprintf.h"
+
int pid_init (const char *pidfile)
{
char tmpfile[256];
-/* $Id: plugin_imon.c,v 1.3 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: plugin_imon.c,v 1.4 2004/03/03 04:44:16 reinelt Exp $
*
* imond/telmond data processing
*
*
*
* $Log: plugin_imon.c,v $
+ * Revision 1.4 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.3 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
#include "config.h"
#include "debug.h"
#include "plugin.h"
+#include "qprintf.h"
#include "cfg.h"
#include "hash.h"
-#include "qprintf.h"
#include <stdio.h>
#include <string.h>
if (telmon=='\1') AddFunction ("telmon", 1, my_telmon);
if (imon=='\1'){
- AddFunction ("imon", 1, my_imon);
- AddFunction ("version", 0, my_imon_version);
- AddFunction ("rates", 2, my_imon_rates);
+ AddFunction ("imon", 1, my_imon);
+ AddFunction ("version", 0, my_imon_version);
+ AddFunction ("rates", 2, my_imon_rates);
}
return 0;
void plugin_exit_imon(void)
{
- hash_destroy(&TELMON);
- hash_destroy(&IMON);
+ hash_destroy(&TELMON);
+ hash_destroy(&IMON);
}
-/* $Id: plugin_netdev.c,v 1.5 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: plugin_netdev.c,v 1.6 2004/03/03 04:44:16 reinelt Exp $
*
* plugin for /proc/net/dev parsing
*
*
*
* $Log: plugin_netdev.c,v $
+ * Revision 1.6 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.5 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
#include "debug.h"
#include "plugin.h"
-
-#include "hash.h"
#include "qprintf.h"
+#include "hash.h"
static HASH NetDev = { 0, };
-/* $Id: plugin_ppp.c,v 1.3 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: plugin_ppp.c,v 1.4 2004/03/03 04:44:16 reinelt Exp $
*
* plugin for ppp throughput
*
*
*
* $Log: plugin_ppp.c,v $
+ * Revision 1.4 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.3 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
#include "debug.h"
#include "plugin.h"
-#include "hash.h"
#include "qprintf.h"
+#include "hash.h"
#ifdef HAVE_NET_IF_PPP_H
-/* $Id: plugin_proc_stat.c,v 1.16 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: plugin_proc_stat.c,v 1.17 2004/03/03 04:44:16 reinelt Exp $
*
* plugin for /proc/stat parsing
*
*
*
* $Log: plugin_proc_stat.c,v $
+ * Revision 1.17 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.16 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
#include "debug.h"
#include "plugin.h"
-#include "hash.h"
#include "qprintf.h"
+#include "hash.h"
static HASH Stat = { 0, };
while (strchr(delim, *beg)) beg++;
if ((end=strpbrk(beg, delim))) *end='\0';
if (i==0)
- strncpy(num,"sum",sizeof(num));
+ strcpy(num, "sum");
else
qprintf(num, sizeof(num), "%d", i-1);
hash_set2 ("intr", num, beg);
void plugin_exit_proc_stat(void)
{
- hash_destroy(&Stat);
+ hash_destroy(&Stat);
}
-/* $Id: qprintf.h,v 1.1 2004/02/27 07:06:26 reinelt Exp $
+/* $Id: qprintf.h,v 1.2 2004/03/03 04:44:16 reinelt Exp $
*
* simple but quick snprintf() replacement
*
*
*
* $Log: qprintf.h,v $
+ * Revision 1.2 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.1 2004/02/27 07:06:26 reinelt
* new function 'qprintf()' (simple but quick snprintf() replacement)
*
#ifndef _QPRINTF_H_
#define _QPRINTF_H_
+// size_t
+#include <stdio.h>
+
int qprintf(char *str, size_t size, const char *format, ...);
#endif
-/* $Id: timer.c,v 1.5 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: timer.c,v 1.6 2004/03/03 04:44:16 reinelt Exp $
*
* generic timer handling
*
*
*
* $Log: timer.c,v $
+ * Revision 1.6 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.5 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
}
-void timer_exit() {
- if (nTimers>0) {
- nTimers=0;
+
+void timer_exit(void) {
+
+ nTimers=0;
+
+ if (Timers>0) {
free(Timers);;
+ Timers=NULL;
}
}
-/* $Id: widget_icon.c,v 1.8 2004/03/03 03:47:04 reinelt Exp $
+/* $Id: widget_icon.c,v 1.9 2004/03/03 04:44:16 reinelt Exp $
*
* icon widget handling
*
*
*
* $Log: widget_icon.c,v $
+ * Revision 1.9 2004/03/03 04:44:16 reinelt
+ * changes (cosmetics?) to the big patch from Martin
+ * hash patch un-applied
+ *
* Revision 1.8 2004/03/03 03:47:04 reinelt
* big patch from Martin Hejl:
* - use qprintf() where appropriate
#include "debug.h"
#include "cfg.h"
+#include "qprintf.h"
#include "evaluator.h"
#include "timer.h"
#include "widget.h"
#include "widget_icon.h"
-#include "qprintf.h"
#ifdef WITH_DMALLOC
#include <dmalloc.h>
int widget_icon_quit (WIDGET *Self)
{
- WIDGET_ICON *Icon;
-
if (Self) {
- Icon = Self->data;
- if (Icon) {
+ if (Self->data) {
+ WIDGET_ICON *Icon = Self->data;
if (Icon->bitmap) free (Icon->bitmap);
free(Self->data);
Self->data=NULL;