Bug#472511: mtr: Sub-second interval patch

2008-03-24 Thread Martin Pels
Subject: mtr: Sub-second interval patch
Package: mtr
Version: 0.72
Severity: wishlist
Tags: patch

Hi,

In the current version of mtr, intervals smaller than 1 second are only
supported when specified on the command line. The attached patch
modifies mtr to allow for specifying an interval between 0 and 1
seconds via the GUI.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (600, 'unstable'), (500, 'oldstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-4-486
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages mtr depends on:
ii  libc6 2.7-9  GNU C Library: Shared
libraries ii  libglib1.21.2.10-17  The GLib library
of C routines ii  libgtk1.2 1.2.10-18  The GIMP
Toolkit set of widgets fo ii  libncurses5   5.6+20080308-1
Shared libraries for terminal hand pn  xlibs
none (no description available)

mtr recommends no packages.
diff -Naur mtr-0.72.orig/curses.c mtr-0.72/curses.c
--- mtr-0.72.orig/curses.c	2006-09-29 21:40:09.0 +0200
+++ mtr-0.72/curses.c	2008-03-24 16:11:40.0 +0100
@@ -19,6 +19,7 @@
 
 #include config.h
 #include strings.h
+#include unistd.h
 
 #ifndef NO_CURSES
 #include ctype.h
@@ -93,6 +94,7 @@
 {
   int c = getch();
   int i=0;
+  float f = 0.0;
   char buf[MAXFLD+1];
 
   if(c == 'q')
@@ -169,10 +171,13 @@
   buf[i++] = c;   /* need more checking on 'c' */
 }
 buf[i] = '\0';
-i = atoi( buf );
 
-if ( i  1 ) return ActionNone;
-WaitTime = (float) i;
+f = atof( buf );
+
+if (f = 0.0) return ActionNone;
+if (getuid() != 0  f  1.0)
+  return ActionNone;
+WaitTime = f;
 
 return ActionNone;
   }


Bug#472511: mtr: Sub-second interval patch

2008-03-24 Thread Rogier Wolff

Applied. 

Will go out in the next version when it comes out. 


Rogier

On Mon, Mar 24, 2008 at 07:03:04PM +0100, Martin Pels wrote:
 Subject: mtr: Sub-second interval patch
 Package: mtr
 Version: 0.72
 Severity: wishlist
 Tags: patch
 
 Hi,
 
 In the current version of mtr, intervals smaller than 1 second are only
 supported when specified on the command line. The attached patch
 modifies mtr to allow for specifying an interval between 0 and 1
 seconds via the GUI.
 
 -- System Information:
 Debian Release: lenny/sid
   APT prefers unstable
   APT policy: (600, 'unstable'), (500, 'oldstable'), (500, 'stable')
 Architecture: i386 (i686)
 
 Kernel: Linux 2.6.18-4-486
 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
 Shell: /bin/sh linked to /bin/bash
 
 Versions of packages mtr depends on:
 ii  libc6 2.7-9  GNU C Library: Shared
 libraries ii  libglib1.21.2.10-17  The GLib library
 of C routines ii  libgtk1.2 1.2.10-18  The GIMP
 Toolkit set of widgets fo ii  libncurses5   5.6+20080308-1
 Shared libraries for terminal hand pn  xlibs
 none (no description available)
 
 mtr recommends no packages.

 diff -Naur mtr-0.72.orig/curses.c mtr-0.72/curses.c
 --- mtr-0.72.orig/curses.c2006-09-29 21:40:09.0 +0200
 +++ mtr-0.72/curses.c 2008-03-24 16:11:40.0 +0100
 @@ -19,6 +19,7 @@
  
  #include config.h
  #include strings.h
 +#include unistd.h
  
  #ifndef NO_CURSES
  #include ctype.h
 @@ -93,6 +94,7 @@
  {
int c = getch();
int i=0;
 +  float f = 0.0;
char buf[MAXFLD+1];
  
if(c == 'q')
 @@ -169,10 +171,13 @@
buf[i++] = c;   /* need more checking on 'c' */
  }
  buf[i] = '\0';
 -i = atoi( buf );
  
 -if ( i  1 ) return ActionNone;
 -WaitTime = (float) i;
 +f = atof( buf );
 +
 +if (f = 0.0) return ActionNone;
 +if (getuid() != 0  f  1.0)
 +  return ActionNone;
 +WaitTime = f;
  
  return ActionNone;
}


-- 
** [EMAIL PROTECTED] ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233**
*-- BitWizard writes Linux device drivers for any device you may have! --*
Q: It doesn't work. A: Look buddy, doesn't work is an ambiguous statement. 
Does it sit on the couch all day? Is it unemployed? Please be specific! 
Define 'it' and what it isn't doing. - Adapted from lxrbot FAQ



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]