Nmap Development mailing list archives
Re: grepable output bug
From: Michael Pattrick <mpattrick () rhinovirus org>
Date: Wed, 21 Jan 2009 09:22:32 -0500
On Wed, Jan 21, 2009 at 12:42 AM, MadHat Unspecific <madhat () unspecific com> wrote:
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.
Hey MadHat, That is exactly, what you are doing, but that wont change the state of the string. You are simply moving where the pointer is pointing too. If you want to erase all commas without replacing them with anything you would have to do something like this: p = grepvers; { char * p2 = grepvers; while(*p != NULL){ if ( *p != ',' ){ *p2 = *p; p2++; } p++; } } Although this is just an ugly spaghetti string hack. -- Michael Pattrick http://www.rhinovirus.org/math _______________________________________________ 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)