BENV_GetSizes

Return an array of integers from the argument list

Synopsis

int *BENV_GetSizes(int argc, char *argv[], const char *argname, int *nsizes)

Input Parameters

argc
argument count
argname
argument name

Input/Output Parameter

argv
argument vector on input. If argname is found, the values of argv for that argument and the following argument are set to null.

Output Parameter

nsizes
number of values returned

Return value

Pointer to an array, allocated with malloc, containing the integers On error, nsizes == -1 and the return value is NULL. The user should free(ptr) where ptr is the value returned by this routine.

Notes

This routine looks for a pair of arguments of the form
      ... --argname list
where list may be either a comma-separated list of values or a range with an optional stride. Specifically,
   a,b,...,c (comma separated list)
   a:b or a:b:c (range with additive stride)
   a:b*c (range with multiplicative stride)
Here, a and b may have postfix k or K for times 1024 and m or M for time 1024*1024.

This routine sets found arguments to null to permit other routines to process other arguments; this requires all routines to permit a NULL argument for a value in argv.