Script Support

Source code for these C functions is in the file `script.c'. section Shell Scripts for a description of script argument processing.

script_find_executable is only defined on unix systems.

Function: char *script_find_executable (const char *name)
script_find_executable returns the path name of the executable which will is invoked by the script file name; name if it is a binary executable (not a script); or 0 if name does not exist or is not executable.

Function: char **script_process_argv(int argc; char **argv)
Given an main style argument vector argv and the number of arguments, argc, script_process_argv returns a newly allocated argument vector in which the second line of the script being invoked is substituted for the corresponding meta-argument.

If the script does not have a meta-argument, or if the file named by the argument following a meta-argument cannot be opened for reading, then 0 is returned.

script_process_argv correctly processes argument vectors of nested script invocations.

Function: int script_count_argv(char **argv)
Returns the number of argument strings in argv.