gnome-nettool r816 - in trunk: . src
- From: gpoo svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-nettool r816 - in trunk: . src
- Date: Tue, 9 Dec 2008 21:01:57 +0000 (UTC)
Author: gpoo
Date: Tue Dec 9 21:01:56 2008
New Revision: 816
URL: http://svn.gnome.org/viewvc/gnome-nettool?rev=816&view=rev
Log:
2008-12-09 German Poo-Caamano <gpoo gnome org>
* src/nettool.[ch] (netinfo_get_count):
* src/ping.[ch] (ping_do): Fixed #522934. Fixed support for
unlimited pings (now it really means unlimited pings, not a
threshold 999 :-)
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/TODO
trunk/src/nettool.c
trunk/src/nettool.h
trunk/src/ping.c
trunk/src/ping.h
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Tue Dec 9 21:01:56 2008
@@ -2,6 +2,7 @@
---------------------------------
- Removed warnings from the Glade UI (Diego Escalante)
+ - #522934: Fixed support for unlimited pings (GermÃn PÃo-CaamaÃo)
- #554733: Gnome Nettool now is 1024x600 friendly (GermÃn PÃo-CaamaÃo)
- #563044: Added basic NetBSD support (Thomas Klausner)
- #394648: Added menu for the documentation (GermÃn PÃo-CaamaÃo)
Modified: trunk/TODO
==============================================================================
--- trunk/TODO (original)
+++ trunk/TODO Tue Dec 9 21:01:56 2008
@@ -32,4 +32,4 @@
[-] Multiplataform support (may be with a ping/traceroute helper to
process de same output)
[X] Detection of network devices
-[ ] Add *BSD support in ping command/output
+[X] Add *BSD support in ping command/output
Modified: trunk/src/nettool.c
==============================================================================
--- trunk/src/nettool.c (original)
+++ trunk/src/nettool.c Tue Dec 9 21:01:56 2008
@@ -36,7 +36,7 @@
guint progress_timeout_id = 0;
-gushort
+gint
netinfo_get_count (Netinfo * netinfo)
{
@@ -50,7 +50,7 @@
(netinfo->count));
} else {
- return 999;
+ return -1;
}
}
Modified: trunk/src/nettool.h
==============================================================================
--- trunk/src/nettool.h (original)
+++ trunk/src/nettool.h Tue Dec 9 21:01:56 2008
@@ -133,7 +133,7 @@
void netinfo_stop_process_command (Netinfo * netinfo);
void netinfo_text_buffer_insert (Netinfo * netinfo);
-gushort netinfo_get_count (Netinfo * netinfo);
+gint netinfo_get_count (Netinfo * netinfo);
const gchar * netinfo_get_host (Netinfo * netinfo);
const gchar * netinfo_get_user (Netinfo * netinfo);
void netinfo_set_host (Netinfo * netinfo, const gchar *host);
Modified: trunk/src/ping.c
==============================================================================
--- trunk/src/ping.c (original)
+++ trunk/src/ping.c Tue Dec 9 21:01:56 2008
@@ -224,7 +224,7 @@
void
ping_do (Netinfo * netinfo)
{
- gushort count;
+ gint count;
const gchar *host = NULL;
gchar *command = NULL;
GtkTreeModel *model;
@@ -232,6 +232,7 @@
*pkt_success;
gchar stmp[128];
gchar *program = NULL;
+ gchar *count_string = NULL;
GtkWidget *parent;
gint ip_version;
@@ -284,13 +285,6 @@
draw_ping_graph (netinfo);
-/*
- buffer =
- gtk_text_view_get_buffer (GTK_TEXT_VIEW (netinfo->output));
-
- gtk_text_buffer_get_bounds (buffer, &start, &end);
- gtk_text_buffer_delete (buffer, &start, &end);
-*/
parent = gtk_widget_get_toplevel (netinfo->output);
ip_version = netinfo_get_ip_version (netinfo);
@@ -310,33 +304,37 @@
}
if (program != NULL) {
+ /* unlimited or limited ping? */
+ if (count == -1) {
+ count_string = g_strdup_printf(" ");
+ } else {
#if defined(__sun__) || defined(__hpux__)
- if (ip_version == IPV4)
- command =
- g_strdup_printf (PING_PROGRAM_FORMAT, program, host,
- // g_strdup_printf (PING_PROGRAM_FORMAT, PING_PROGRAM, host,
- count);
- else
- command =
- g_strdup_printf (PING_PROGRAM_FORMAT_6, program, host,
- count);
+ count_string = g_strdup_printf("%d", count);
#else
- if (ip_version == IPV4)
+ count_string = g_strdup_printf(" -c %d ", count);
+#endif
+ }
+
+ if (ip_version == IPV4) {
command =
- g_strdup_printf (PING_PROGRAM_FORMAT, program, count,
- // g_strdup_printf (PING_PROGRAM_FORMAT, PING_PROGRAM, count,
- host);
- #if defined(PING_PROGRAM_FORMAT_6)
- else
+#if defined(__sun__) || defined(__hpux__)
+ g_strdup_printf (PING_PROGRAM_FORMAT, program,
+ host, count_string);
+#else
+ g_strdup_printf (PING_PROGRAM_FORMAT, program,
+ count_string, host);
+#endif
+ } else {
command =
- g_strdup_printf (PING_PROGRAM_FORMAT_6, program, count,
- host);
- #endif
+#if defined(__sun__) || defined(__hpux__)
+ g_strdup_printf (PING_PROGRAM_FORMAT_6, program,
+ host, count_string);
+#else
+ g_strdup_printf (PING_PROGRAM_FORMAT_6, program,
+ count_string, host);
#endif
-
-/* command =
- g_strdup_printf ("%s ping -c %d %s", PING_PROGRAM, count,
- host);*/
+ }
+ g_print("command: %s\n", command);
netinfo->command_line = g_strsplit (command, " ", -1);
@@ -345,6 +343,7 @@
g_strfreev (netinfo->command_line);
}
+ g_free (count_string);
g_free (command);
g_free (program);
}
Modified: trunk/src/ping.h
==============================================================================
--- trunk/src/ping.h (original)
+++ trunk/src/ping.h Tue Dec 9 21:01:56 2008
@@ -24,29 +24,32 @@
#include "nettool.h"
/* The ping usage and output is different between Unix flavours */
-/* FIXME: Add BSD support */
#if defined(__linux__)
-# define PING_PROGRAM_FORMAT "%s ping -b -c %d -n %s"
-# define PING_PROGRAM_FORMAT_6 "%s ping6 -c %d -n %s"
+ /* <path to program> ping -b [-c <count>] -n <host> */
+# define PING_PROGRAM_FORMAT "%s ping -b%s-n %s"
+# define PING_PROGRAM_FORMAT_6 "%s ping6%s-n %s"
# define PING_FORMAT "%d bytes from %s icmp_seq=%d ttl=%d time=%s %s"
# define PING_PARAMS_6
#elif defined(__OSF__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
-# define PING_PROGRAM_FORMAT "%s ping -c %d -n %s"
-# define PING_PROGRAM_FORMAT_6 "%s ping6 -c %d -n %s"
+ /* <path to program> ping [-c <count>] -n <host> */
+# define PING_PROGRAM_FORMAT "%s ping%s-n %s"
+# define PING_PROGRAM_FORMAT_6 "%s ping6%s-n %s"
# define PING_FORMAT "%d bytes from %s icmp_seq=%d ttl=%d time=%s %s"
# define PING_PARAMS_6
#elif defined(__sun__)
-# define PING_PROGRAM_FORMAT "%s ping -s -n %s 56 %d"
-# define PING_PROGRAM_FORMAT_6 "%s ping -s -A inet6 -a -n %s 56 %d"
+ /* <path to program> ping -s -n <host> [<count>] */
+# define PING_PROGRAM_FORMAT "%s ping -s -n %s 56%s"
+# define PING_PROGRAM_FORMAT_6 "%s ping -s -A inet6 -a -n %s 56%s"
# define PING_FORMAT "%d bytes from %s icmp_seq=%d. time=%f %s"
# define PING_PARAMS_5
#elif defined(__hpux__)
-# define PING_PROGRAM_FORMAT "%s ping %s -n %d"
-# define PING_PROGRAM_FORMAT_6 "%s ping %s -f inet6 -n %d"
+# define PING_PROGRAM_FORMAT "%s ping %s -n%s"
+# define PING_PROGRAM_FORMAT_6 "%s ping %s -f inet6 -n%s"
# define PING_FORMAT "%d bytes from %s icmp_seq=%d. time=%f %s"
# define PING_PARAMS_5
#else
-# define PING_PROGRAM_FORMAT "%s ping -c %d -n %s"
+# define PING_PROGRAM_FORMAT "%s ping %s -n %s"
+# define PING_PROGRAM_FORMAT_6 "%s ping6 %s -n %s"
# define PING_FORMAT "%d bytes from %s icmp_seq=%d. time=%f %s"
# define PING_PARAMS_5
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]