Difference between revisions of "C.php"
From Organic Design wiki
(need to send err to stdout) |
(write article to source.c) |
||
Line 1: | Line 1: | ||
<? | <? | ||
− | # C | + | # C compiler for XmlWiki Environment |
− | |||
$server = $_SERVER['HTTP_HOST']; | $server = $_SERVER['HTTP_HOST']; | ||
$htdocs = $_SERVER['DOCUMENT_ROOT']; | $htdocs = $_SERVER['DOCUMENT_ROOT']; | ||
if ( !ereg( "\\/$", $htdocs ) ) $htdocs .= '/'; | if ( !ereg( "\\/$", $htdocs ) ) $htdocs .= '/'; | ||
+ | |||
+ | // Write the source to tmp file source.c | ||
+ | if ($handle = fopen("$htdocs/source.c, 'w+')) { | ||
+ | fwrite($handle, $article); | ||
+ | fclose($handle); | ||
+ | } | ||
$gcc = $htdocs.'wiki/gcc'; | $gcc = $htdocs.'wiki/gcc'; | ||
− | $article = " | + | $article = "Compiling using $gcc:\n"; |
$article .= shell_exec("$gcc 2>&1"); | $article .= shell_exec("$gcc 2>&1"); | ||
− | |||
− | |||
?> | ?> |
Revision as of 05:43, 23 June 2006
<?
- C compiler for XmlWiki Environment
$server = $_SERVER['HTTP_HOST']; $htdocs = $_SERVER['DOCUMENT_ROOT']; if ( !ereg( "\\/$", $htdocs ) ) $htdocs .= '/';
// Write the source to tmp file source.c if ($handle = fopen("$htdocs/source.c, 'w+')) {
fwrite($handle, $article); fclose($handle); }
$gcc = $htdocs.'wiki/gcc'; $article = "Compiling using $gcc:\n"; $article .= shell_exec("$gcc 2>&1"); ?>