static char* doDir_assert(char* pzArg, char* pzScan) { switch (*pzArg) { case '`': { char* pzS = pzArg+1; char* pzR; pzR = strrchr(pzS, '`'); if (pzR == NULL) break; /* not a valid script */ *pzR = NUL; pzS = runShell((char const*)pzS); check_assert_str(pzS, pzArg); free(pzS); break; } case '(': { SCM res = ag_scm_c_eval_string_from_file_line( pzArg, pCurCtx->pzCtxFname, pCurCtx->lineNo ); check_assert_str(resolveSCM(res), pzArg); break; } default: break; } return pzScan; }
/** * This directive @i{is} processed, but only if the expression begins with * either a back quote (@code{`}) or an open parenthesis (@code{(}). * Text within the back quotes are handed off to the shell for processing * and parenthesized text is handed off to Guile. Multiple line expressions * must be joined with backslashes. * * If the @code{shell-script} or @code{scheme-expr} do not yield @code{true} * valued results, autogen will be aborted. If @code{<anything else>} or * nothing at all is provided, then this directive is ignored. * * The result is @code{false} (and fails) if the result is empty, the * number zero, or a string that starts with the letters 'n' or 'f' ("no" * or "false"). */ char * doDir_assert(directive_enum_t id, char const * dir, char * scan_next) { (void)id; dir = SPN_WHITESPACE_CHARS(dir); switch (*dir) { case '`': { char * pzS = (char *)dir+1; char * pzR = SPN_WHITESPACE_BACK(pzS, NULL); if (*(--pzR) != '`') break; /* not a valid script */ *pzR = NUL; pzS = shell_cmd((char const *)pzS); check_assert_str(pzS, dir); AGFREE(pzS); break; } case '(': { SCM res = ag_scm_c_eval_string_from_file_line( dir, cctx->scx_fname, cctx->scx_line); check_assert_str(scm2display(res), dir); break; } default: break; } return scan_next; }