execline
Software
www.skarnet.org

The execline library interface

The execline library has been designed to help programmers write applications suitable for use in execline scripts.

Compiling

Linking

Programming

Check the /package/admin/execline/include/execline.h header for the exact prototypes of the described functions.

Block unquoting

int argc1 ;
const char **argv ;

argc1 = el_semicolon(argv) ;
If a scanned argument is not quoted, the argv is not well-formed. In particular, it is vulnerable to the security hole that plagued execline-0.x: if a substitution occurs in a block that is not well-formed, it could affect the execution flow by creating an unexpected unquoted semicolon. Well-formed argvs are immune to this problem.
The execlineb launcher always produces well-formed argvs (by automatically quoting every argument in a block) if braces have been placed properly. The execline launcher has no block support - which is why you should use it only if you know exactly what you are doing.

Sequencing

const char *const *argv1 ;
const char *const *argv2 ;
el_execsequence(argv1, argv2) ;

Variable substitution

int nc ;
elsubst *substs ;
unsigned int ns ;
stralloc to = GEN_ALLOC_ZERO ;
stralloc from ;

nc = el_substitute(&to, &from, substs, ns) ;

Value splitting

int n0 ;
stralloc sa ;
unsigned int offset ;
elsplitinfo si ;

n0 = (int)el_splitc (&sa, offset, delim) ;
n0 = (int)el_splitnc (&sa, offset, delim) ;
n0 = el_splitnetstring(&sa, offset) ;
n0 = el_split (&sa, offset, &si) ;
n0 = el_split0 (&sa, offset, &si) ;

Environment pushing/popping

int r ;
stralloc sa = GEN_ALLOC_ZERO ;
char const *const *envp ;
unsigned int envlen ;
char const *const *list ;
unsigned int listlen ;

r = el_pushenv(&sa, envp, envlen, list, listlen) ;
r = el_popenv(&sa, envp, envlen, list, listlen) ;