* Fixed error output if not in debug mode (#4707)

* Increased version number to 0.3.3.


(Old svn revision: 756)
master
Bernhard Walle 2005-07-31 22:54:22 +00:00
parent 611bb7ab59
commit 22959322fb
9 changed files with 110 additions and 72 deletions

View File

@ -1,3 +1,7 @@
2005-08-01 Bernhard Walle
* Fixed error output if not in debug mode (#4707)
* Increased version number to 0.3.3.
2005-05-17 Bernhard Walle 2005-05-17 Bernhard Walle
* Fixed memory leak (#971). * Fixed memory leak (#971).

View File

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Wrapper for compilers which do not understand `-c -o'. # Wrapper for compilers which do not understand `-c -o'.
scriptversion=2004-10-12.08 scriptversion=2005-02-03.08
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>. # Written by Tom Tromey <tromey@cygnus.com>.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -47,11 +47,11 @@ right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>. Report bugs to <bug-automake@gnu.org>.
EOF EOF
exit 0 exit $?
;; ;;
-v | --v*) -v | --v*)
echo "compile $scriptversion" echo "compile $scriptversion"
exit 0 exit $?
;; ;;
esac esac

View File

@ -9,7 +9,7 @@ AC_INIT([panel-plugin/netload.c])
AM_CONFIG_HEADER([config.h]) AM_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([xfce4-netload-plugin], [0.3.2]) AM_INIT_AUTOMAKE([xfce4-netload-plugin], [0.3.3])
AM_MAINTAINER_MODE AM_MAINTAINER_MODE

53
depcomp
View File

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# depcomp - compile a program generating dependencies as side-effects # depcomp - compile a program generating dependencies as side-effects
scriptversion=2004-05-31.23 scriptversion=2005-02-09.22
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -50,11 +50,11 @@ Environment variables:
Report bugs to <bug-automake@gnu.org>. Report bugs to <bug-automake@gnu.org>.
EOF EOF
exit 0 exit $?
;; ;;
-v | --v*) -v | --v*)
echo "depcomp $scriptversion" echo "depcomp $scriptversion"
exit 0 exit $?
;; ;;
esac esac
@ -287,36 +287,43 @@ tru64)
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then if test "$libtool" = yes; then
# Dependencies are output in .lo.d with libtool 1.4. # With Tru64 cc, shared objects can also be used to make a
# With libtool 1.5 they are output both in $dir.libs/$base.o.d # static library. This mecanism is used in libtool 1.4 series to
# and in $dir.libs/$base.o.d and $dir$base.o.d. We process the # handle both shared and static libraries in a single compilation.
# latter, because the former will be cleaned when $dir.libs is # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
# erased. #
tmpdepfile1="$dir.libs/$base.lo.d" # With libtool 1.5 this exception was removed, and libtool now
tmpdepfile2="$dir$base.o.d" # generates 2 separate objects for the 2 libraries. These two
tmpdepfile3="$dir.libs/$base.d" # compilations output dependencies in in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD "$@" -Wc,-MD
else else
tmpdepfile1="$dir$base.o.d" tmpdepfile1=$dir$base.o.d
tmpdepfile2="$dir$base.d" tmpdepfile2=$dir$base.d
tmpdepfile3="$dir$base.d" tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD "$@" -MD
fi fi
stat=$? stat=$?
if test $stat -eq 0; then : if test $stat -eq 0; then :
else else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat exit $stat
fi fi
if test -f "$tmpdepfile1"; then for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
tmpdepfile="$tmpdepfile1" do
elif test -f "$tmpdepfile2"; then test -f "$tmpdepfile" && break
tmpdepfile="$tmpdepfile2" done
else
tmpdepfile="$tmpdepfile3"
fi
if test -f "$tmpdepfile"; then if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the []. # That's a tab and a space in the [].

16
missing
View File

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Common stub for a few missing GNU programs while installing. # Common stub for a few missing GNU programs while installing.
scriptversion=2004-09-07.08 scriptversion=2005-02-08.22
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
@ -87,12 +87,12 @@ Supported PROGRAM values:
yacc create \`y.tab.[ch]', if possible, from existing .[ch] yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>." Send bug reports to <bug-automake@gnu.org>."
exit 0 exit $?
;; ;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version) -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)" echo "missing $scriptversion (GNU Automake)"
exit 0 exit $?
;; ;;
-*) -*)
@ -288,10 +288,14 @@ WARNING: \`$1' is $msg. You should only need it if
call might also be the consequence of using a buggy \`make' (AIX, call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site." the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` # ... or it is the one specified with @setfilename ...
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi fi
touch $file touch $file
;; ;;

View File

@ -20,6 +20,7 @@ libnetload_la_SOURCES = \
net.c \ net.c \
os.h \ os.h \
wormulon.h \ wormulon.h \
global.h \
slurm.h slurm.h
libnetload_la_CFLAGS = \ libnetload_la_CFLAGS = \

39
panel-plugin/global.h Normal file
View File

@ -0,0 +1,39 @@
/*
* Id: $Id$
* -------------------------------------------------------------------------------------------------
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; You may only use
* version 2 of the License, you have no option to use any other version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program; if
* not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* -------------------------------------------------------------------------------------------------
*/
#ifndef GLOBAL_H
#define GLOBAL_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef DEBUG
# define PRINT_DBG(fmt, ...) \
{ \
fprintf(stderr, "DEBUG[%s:%d]: "fmt, __FILE__, __LINE__, \
## __VA_ARGS__); \
}
#else
# define PRINT_DBG(fmt, ...) { do {} while(0); }
#endif
#endif /* GLOBAL_H */

View File

@ -1,5 +1,5 @@
/* /*
* Id: $Id: net.c,v 1.8 2005/02/04 18:14:41 bwalle Exp $ * Id: $Id$
* ------------------------------------------------------------------------------------------------- * -------------------------------------------------------------------------------------------------
* *
* This program is free software; you can redistribute it and/or modify it under the terms of the * This program is free software; you can redistribute it and/or modify it under the terms of the
@ -36,7 +36,9 @@
#include "slurm.h" /* slurm structs */ #include "slurm.h" /* slurm structs */
#include <sys/types.h> #include <sys/types.h>
#include <errno.h>
#include "global.h"
#ifdef __HPUX__ #ifdef __HPUX__
# include "wormulon/hpux.h" # include "wormulon/hpux.h"
@ -96,9 +98,7 @@ int init_netload(netdata* data, const char* device)
data->correct_interface = TRUE; data->correct_interface = TRUE;
#ifdef DEBUG PRINT_DBG("The netload plugin was initialized for '%s'.", device);
fprintf( stderr, "The netload plugin was initialized for '%s'.\n", device );
#endif /* DEBUG */
return TRUE; return TRUE;
} }
@ -184,7 +184,7 @@ char* get_ip_address(netdata* data)
/* get the value from the operating system */ /* get the value from the operating system */
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{ {
perror("Error in socket"); PRINT_DBG("Error in socket: %s", strerror(errno));
return NULL; return NULL;
} }
@ -192,7 +192,7 @@ char* get_ip_address(netdata* data)
if (ioctl(sockfd, SIOCGIFADDR, &ifr) != 0) if (ioctl(sockfd, SIOCGIFADDR, &ifr) != 0)
{ {
close(sockfd); close(sockfd);
perror("Error in ictl(sockfd)"); PRINT_DBG("Error in ictl(sockfd): %s", strerror(errno));
return NULL; return NULL;
} }
close(sockfd); close(sockfd);
@ -201,7 +201,7 @@ char* get_ip_address(netdata* data)
if (!inet_ntop(AF_INET, &p_sa->sin_addr, data->ip_address, IP_ADDRESS_LENGTH)) if (!inet_ntop(AF_INET, &p_sa->sin_addr, data->ip_address, IP_ADDRESS_LENGTH))
{ {
perror("Error in inet_ntop"); PRINT_DBG("Error in inet_ntop: %s", strerror(errno));
return NULL; return NULL;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Id: $Id: netload.c,v 1.12 2005/02/04 18:12:01 bwalle Exp $ * Id: $Id$
* ------------------------------------------------------------------------------------------------- * -------------------------------------------------------------------------------------------------
* *
* This program is free software; you can redistribute it and/or modify it under the terms of the * This program is free software; you can redistribute it and/or modify it under the terms of the
@ -21,6 +21,7 @@
#include "net.h" #include "net.h"
#include "utils.h" #include "utils.h"
#include "global.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -188,15 +189,15 @@ static gboolean update_monitors(t_global_monitor *global)
switch (i) switch (i)
{ {
case IN: case IN:
fprintf(stderr, "input: Max = %lu\n", global->monitor->net_max[i]); PRINT_DBG("input: Max = %lu", global->monitor->net_max[i]);
break; break;
case OUT: case OUT:
fprintf(stderr, "output: Max = %lu\n", global->monitor->net_max[i]); PRINT_DBG("output: Max = %lu", global->monitor->net_max[i]);
break; break;
case TOT: case TOT:
fprintf(stderr, "total: Max = %lu\n", global->monitor->net_max[i]); PRINT_DBG("total: Max = %lu", global->monitor->net_max[i]);
break; break;
} }
#endif /* DEBUG */ #endif /* DEBUG */
@ -627,9 +628,7 @@ static void monitor_read_config(Control *ctrl, xmlNodePtr node)
break; break;
} }
} }
#ifdef DEBUG PRINT_DBG("monitor_read_config");
printf("monitor_read_config\n");
#endif
setup_monitor(global, TRUE); setup_monitor(global, TRUE);
} }
@ -722,9 +721,7 @@ static void monitor_set_size(Control *ctrl, int size)
} }
gtk_widget_queue_resize(GTK_WIDGET(global->monitor->status[i])); gtk_widget_queue_resize(GTK_WIDGET(global->monitor->status[i]));
} }
#ifdef DEBUG PRINT_DBG("monitor_set_size");
printf("monitor_set_size\n");
#endif
setup_monitor(global, TRUE); setup_monitor(global, TRUE);
} }
@ -764,9 +761,7 @@ static void monitor_apply_options_cb(GtkWidget *button, t_global_monitor *global
GTK_SPIN_BUTTON(global->monitor->update_spinner) ) * 1000 + 0.5); GTK_SPIN_BUTTON(global->monitor->update_spinner) ) * 1000 + 0.5);
setup_monitor(global, FALSE); setup_monitor(global, FALSE);
#ifdef DEBUG PRINT_DBG("monitor_apply_options_cb");
printf("monitor_apply_options_cb\n");
#endif
} }
@ -782,9 +777,7 @@ static void label_changed(GtkWidget *button, t_global_monitor *global)
g_strdup(gtk_entry_get_text(GTK_ENTRY(global->monitor->opt_entry))); g_strdup(gtk_entry_get_text(GTK_ENTRY(global->monitor->opt_entry)));
setup_monitor(global, FALSE); setup_monitor(global, FALSE);
#ifdef DEBUG PRINT_DBG("label_changed");
printf("label_changed\n");
#endif
} }
@ -800,9 +793,7 @@ static void max_label_changed(GtkWidget *button, t_global_monitor *global)
} }
setup_monitor(global, FALSE); setup_monitor(global, FALSE);
#ifdef DEBUG PRINT_DBG("max_label_changed");
printf("max_label_changed\n");
#endif
} }
@ -818,9 +809,7 @@ static void network_changed(GtkWidget *button, t_global_monitor *global)
g_strdup(gtk_entry_get_text(GTK_ENTRY(global->monitor->net_entry))); g_strdup(gtk_entry_get_text(GTK_ENTRY(global->monitor->net_entry)));
setup_monitor(global, FALSE); setup_monitor(global, FALSE);
#ifdef DEBUG PRINT_DBG("network_changed");
printf("network_changed\n");
#endif
} }
@ -835,9 +824,7 @@ static void label_toggled(GtkWidget *check_button, t_global_monitor *global)
global->monitor->options.use_label); global->monitor->options.use_label);
setup_monitor(global, FALSE); setup_monitor(global, FALSE);
#ifdef DEBUG PRINT_DBG("label_toggled");
printf("label_toggled\n");
#endif
} }
@ -860,9 +847,7 @@ static void max_label_toggled(GtkWidget *check_button, t_global_monitor *global)
} }
} }
setup_monitor(global, FALSE); setup_monitor(global, FALSE);
#ifdef DEBUG PRINT_DBG("max_label_toggled");
printf("max_label_toggled\n");
#endif
} }
@ -915,9 +900,7 @@ static void change_color(GtkWidget *button, t_global_monitor *global, gint type)
&global->monitor->options.color[type]); &global->monitor->options.color[type]);
setup_monitor(global, FALSE); setup_monitor(global, FALSE);
} }
#ifdef DEBUG PRINT_DBG("change_color");
printf("change_color\n");
#endif
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
} }