|
parses a user argument in order to extract some useful values for a grid_type structure. argv[iarg] must match the regular expression ^([^[@/]+)(\[([0-9]+)\])?(/[^@]+)?@(.*)$ which means in clear one of the four alternatives :
- input_dataset@input_file
- input_dataset[ichannel]@input_file
- input_dataset/output_dataset@input_file
- input_dataset[ichannel]/output_dataset@input_file
(with : ichannel an integer, input_dataset a char *, output_dataset a char *, and input_file a char *)
- Parameters:
-
| iarg | the index of the argument to parse (between 1 and argc - 1) |
| argv | the list of the command arguments, from ::main |
| grid | a pointer to a grid_type structure to update with infos found in the i-th argument |
- Returns:
- 0 on success, -1 on failure; the current implementation actually exits in a brutal way when a invalid argument is found, simply sending an error message on the standard error as a side effect. Indeed, an invalid argument was seen as a fatal error in the application context (no processing can be done), so it was judged useless to continue.
The fields of grid_type updated by parse_argument include:
- See also:
- tokenize (called by parse_argument)
|