Nmap Development mailing list archives
Re: grepable output bug
From: MadHat Unspecific <madhat () unspecific com>
Date: Wed, 21 Jan 2009 10:44:33 -0600
Michael Pattrick wrote:
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.
Just for my own clarification, if I move the pointer ahead by one and
don't put anything in it's place, wouldn't it be effectively the same
thing? basically skipping the character.
--
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)
