23 lines
805 B
C
23 lines
805 B
C
#ifndef L_PAREN
|
|
# define L_PAREN '['
|
|
#endif
|
|
|
|
#ifndef R_PAREN
|
|
# define R_PAREN ']'
|
|
#endif
|
|
|
|
/* psops(1) arguments are flanked by { '[', '\0' } and { ']', '\0' }. Nesting
|
|
* is allowed to facilitate nesting of psops(1) programs. This checks to make
|
|
* sure grouping symbols in args are balanced.
|
|
* args is the argv that was passed to main, incremented (so args[1] is "[").
|
|
* 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);
|
|
|
|
/* arg is the location of the argument with the left grouping symbol within
|
|
* argv.
|
|
* Returns the location of the argument with the corresponding left grouping
|
|
* symbol within argv. */
|
|
char **corresponding_arg(char **arg);
|