c/c++/php/omfgmyheadhurts
Apr. 20th, 2006 01:12 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I had forgotten how DENSE c can get
I'm looking to modify the standard ping so it has a more easily parseable output, and I'm having trouble even figuring out how they are specifying the flags for the options... I think I've got it specified right (commented as //right here), but heck if I can figure out how to associate that with -E on the command line (I think I added it right in the block below, but I can't figure out how the #defines and the optstring relate)
//start code
#define F_FLOOD 0x001
#define F_INTERVAL 0x002
#define F_NUMERIC 0x004
#define F_PINGFILLED 0x008
#define F_QUIET 0x010
#define F_RROUTE 0x020
#define F_SO_DEBUG 0x040
#define F_SO_DONTROUTE 0x080
#define F_VERBOSE 0x100
#define F_TIMESTAMP 0x200
#define F_FLOWINFO 0x200
#define F_SOURCEROUTE 0x400
#define F_TCLASS 0x400
#define F_FLOOD_POLL 0x800
#define F_LATENCY 0x1000
#define F_AUDIBLE 0x2000
#define F_ADAPTIVE 0x4000
#define F_STRICTSOURCE 0x8000
#define F_NOLOOP 0x10000
#define F_TTL 0x20000
#define F_EASYOUT 0x40000 //right here
//and how the heck do I add something to THIS mess?
//(note that 'E' is my attempt
#define COMMON_OPTIONS \
case 'a': case 'U': case 'c': case 'd': \
case 'f': case 'i': case 'w': case 'l': \
case 'S': case 'n': case 'p': case 'q': \
case 'r': case 's': case 'v': case 'L': \
case 't': case 'A': case 'W': case 'B': \
case 'E':
define COMMON_OPTSTR "h?VQ:I:M:aUc:dfi:w:l:S:np:qrs:vLt:AW:B:E"
//end code
This is why I don't code for a living.... wait.. that's what I'm asking to do... d'oh. At least I don't have to add the code for specifying an address to this :)
I'm looking to modify the standard ping so it has a more easily parseable output, and I'm having trouble even figuring out how they are specifying the flags for the options... I think I've got it specified right (commented as //right here), but heck if I can figure out how to associate that with -E on the command line (I think I added it right in the block below, but I can't figure out how the #defines and the optstring relate)
//start code
#define F_FLOOD 0x001
#define F_INTERVAL 0x002
#define F_NUMERIC 0x004
#define F_PINGFILLED 0x008
#define F_QUIET 0x010
#define F_RROUTE 0x020
#define F_SO_DEBUG 0x040
#define F_SO_DONTROUTE 0x080
#define F_VERBOSE 0x100
#define F_TIMESTAMP 0x200
#define F_FLOWINFO 0x200
#define F_SOURCEROUTE 0x400
#define F_TCLASS 0x400
#define F_FLOOD_POLL 0x800
#define F_LATENCY 0x1000
#define F_AUDIBLE 0x2000
#define F_ADAPTIVE 0x4000
#define F_STRICTSOURCE 0x8000
#define F_NOLOOP 0x10000
#define F_TTL 0x20000
#define F_EASYOUT 0x40000 //right here
//and how the heck do I add something to THIS mess?
//(note that 'E' is my attempt
#define COMMON_OPTIONS \
case 'a': case 'U': case 'c': case 'd': \
case 'f': case 'i': case 'w': case 'l': \
case 'S': case 'n': case 'p': case 'q': \
case 'r': case 's': case 'v': case 'L': \
case 't': case 'A': case 'W': case 'B': \
case 'E':
define COMMON_OPTSTR "h?VQ:I:M:aUc:dfi:w:l:S:np:qrs:vLt:AW:B:E"
//end code
This is why I don't code for a living.... wait.. that's what I'm asking to do... d'oh. At least I don't have to add the code for specifying an address to this :)