1
0
src/libpsargs/libpsargs.h

18 lines
938 B
C
Raw Normal View History

2022-11-21 01:23:39 +00:00
/* pscat(1) and pspipe(1) arguments are flanked by { '[', '\0' } and
* { ']', '\0' }. Nesting is allowed to facilitate nesting of pscat(1) and
* pspipe(1). This checks to make sure grouping symbols in args are balanced.
* args is the argv that was passed to main, incremented. l is the left
* grouping character (usually '[') and r is the right grouping character
* (usually ']').
* Returns 0 in the events of a syntax error or there being no arguments.
* Otherwise, returns the number of top-level right grouping arguments
* (i.e. the number of terms). */
int check_arg(char **args, char l, char r);
/* arg is the location of the argument with the left grouping symbol within
* argv, l is the left grouping character itself, r is the right grouping
* character itself.
* Returns the location of the argument with the corresponding left grouping
* symbol within argv. */
char **corresponding_arg(char **arg, char l, char r);