Ethereal-dev: Re: [Ethereal-dev] Some TVB rountines I want to add ...

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxx>
Date: Tue, 28 Nov 2000 15:05:50 -0800 (PST)
> >Should it also allow a number base to be specified?
> 
> Ummm, that would be useful as well.

Perhaps we should have

	long tvb_strtol(tvbuff_t *tvb, int offset, int *endoffsetptr,
	    int base)

	unsigned long tvb_strtoul(tvbuff_t *tvb, int offset, int *endoffsetptr,
	    int base)

which:

	start scanning at the specified offset in the tvbuff;

	set "*endoffsetptr" to the offset of the byte past the last one
	it looked at (which means that, if it didn't like the first
	character, e.g. if the string starting at that offset began with
	"q", "*endoffsetptr" will be set to "offset");

	return the value it found on success;

	return 0 or LONG_MIN or LONG_MAX on an error (and perhaps set
	"errno" as per "strtol()" and "strtoul()").

They could also take the "min" and "max" arguments.