Commit 5fcb1fa8 authored by German Poo-Caamano's avatar German Poo-Caamano Committed by Germán Poó Caamaño

Fixed #522934. Fixed support for unlimited pings (now it really means

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 :-)

svn path=/trunk/; revision=816
parent eb9e8441
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 :-)
2008-12-09 German Poo-Caamano <gpoo@gnome.org>
* src/gnome-nettool.glade: Fixed #554733. Gnome Nettool now
......
......@@ -2,6 +2,7 @@ gnome-nettool 2.26.0,
---------------------------------
- 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)
......
......@@ -32,4 +32,4 @@ Portability:
[-] 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
......@@ -36,7 +36,7 @@
guint progress_timeout_id = 0;
gushort
gint
netinfo_get_count (Netinfo * netinfo)
{
......@@ -50,7 +50,7 @@ netinfo_get_count (Netinfo * netinfo)
(netinfo->count));
} else {
return 999;
return -1;
}
}
......
......@@ -133,7 +133,7 @@ void netinfo_process_command (Netinfo * netinfo);
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);
......
......@@ -224,7 +224,7 @@ ping_stop (Netinfo * netinfo)
void
ping_do (Netinfo * netinfo)
{
gushort count;
gint count;
const gchar *host = NULL;
gchar *command = NULL;
GtkTreeModel *model;
......@@ -232,6 +232,7 @@ ping_do (Netinfo * netinfo)
*pkt_success;
gchar stmp[128];
gchar *program = NULL;
gchar *count_string = NULL;
GtkWidget *parent;
gint ip_version;
......@@ -284,13 +285,6 @@ ping_do (Netinfo * netinfo)
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 @@ ping_do (Netinfo * netinfo)
}
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 @@ ping_do (Netinfo * netinfo)
g_strfreev (netinfo->command_line);
}
g_free (count_string);
g_free (command);
g_free (program);
}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment