Dans un message du 25 f�v � 3:05, Phil Dibowitz �crivait :
> The patch he gave will actually cause the TTL field to go REALLY crazy.
It really looks like a side effect to me and not a bug introduced by my
patch.
Furthermore, I've found some new problems too :
- 336: c = wgetch(stdscr);
wgetch returns an int. My patch actually fixes that problem too.
- rate is not initialized at its decleration
It is modified in the getopt loop. Thus if you do not provide a rate in
the command line, you will fall there :
133: if (rate < 0 || rate > 60) {
134: rate = 1;
135: }
since at this point, rate is still uninitialized, its value is unknown
but could be >=0 and <=60. This could explain the ``TTL crazyness'' (I
suppose so, because you have not defined what it is supposed to mean).
I suggest this patch :
--- iptstate.cc.old Sun Feb 24 17:55:57 2002
+++ iptstate.cc Mon Feb 25 15:23:24 2002
@@ -80,9 +80,9 @@
// Variables
string line, src, dst, srcpt, dstpt, proto, code, type, state,
ttl, mins, secs, hrs, sorting, crap;
-char min[5], sec[5], hr[5], c;
+char min[5], sec[5], hr[5];
vector<table> stable(50);
-int seconds=0, minutes=0, hours=0, num, maxx, maxy, temp, sortby=0, rate;
+int seconds=0, minutes=0, hours=0, num, maxx, maxy, temp, sortby=0, rate=-1, c;
vector<string> fields(50);
fd_set readfd;
bool are_hours = false, single = false, gotsort=false, reverse=false;;
I've tested this patch on both big and little endian archs, it works
fine.
--
Guillaume Morin <[EMAIL PROTECTED]>
Unwisely, Santa offered a teddy bear to James, unaware that he had
been mauled by a grizzly earlier that year (T. Burton)