Nmap Development mailing list archives
Re: grepable output bug
From: MadHat Unspecific <madhat () unspecific com>
Date: Tue, 20 Jan 2009 23:42:37 -0600
Fyodor wrote:
On Tue, Jan 20, 2009 at 07:48:55AM -0600, MadHat Unspecific wrote:--- nmap-4.76.orig/output.cc 2008-09-10 13:32:35.000000000 -0500 +++ nmap-4.76/output.cc 2009-01-20 07:41:27.420350073 -0600 @@ -782,6 +782,12 @@ *p = '|'; p++; } + + p = grepvers; + while((p = strchr(p, ','))) { + p++; + } + if (!current->owner) *grepown = '\0'; else { Strncpy(grepown, current->owner,It is not immediately obvious to me how this works to remove the commas. You tested it?
Strncpy(grepvers, sd.fullversion,
sizeof(grepvers) / sizeof(*grepvers));
p = grepvers;
while((p = strchr(p, '/'))) {
*p = '|';
p++;
}
Yes. I tested it. Ok, at the beginning of this section we copy the
version string that would be used on the standard and XML output to
grepvars. Then we assign the value to p, then we walk across it one
character at a time, and if it matches '/' then we replace that position
with a '|'... so doing the same thing:
p = grepvers;
while((p = strchr(p, ','))) {
p++;
}
This time, if we match a ',' we just move to the next character in p
(p++;) rather than replacing it with something else. At least that is
what I think it does. I am a perl programmer by day, php by night and I
hack C/C++ when necessary, so I could be wrong, but it does work.
--
MadHat (at) Unspecific.com
"The true man wants two things: danger and play.
For that reason he wants woman, as the most dangerous plaything."
- Friedrich Nietzsche
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org
Current thread:
- grepable output bug MadHat Unspecific (Jan 20)
- Re: grepable output bug Fyodor (Jan 20)
- Re: grepable output bug MadHat Unspecific (Jan 20)
- Re: grepable output bug Michael Pattrick (Jan 21)
- Re: grepable output bug MadHat Unspecific (Jan 21)
- Re: grepable output bug Michael Pattrick (Jan 21)
- Re: grepable output bug Michael Pattrick (Jan 21)
- Re: grepable output bug MadHat Unspecific (Jan 20)
- Re: grepable output bug Fyodor (Jan 20)
