Difference between revisions of "C.php"

From Organic Design wiki
m
(compiler working :-))
Line 1: Line 1:
 
<?
 
<?
 
# C compiler for XmlWiki Environment
 
# C compiler for XmlWiki Environment
 +
xwSetProperty('language','TEXT');
 
$server = $_SERVER['HTTP_HOST'];
 
$server = $_SERVER['HTTP_HOST'];
 
$htdocs = $_SERVER['DOCUMENT_ROOT'];
 
$htdocs = $_SERVER['DOCUMENT_ROOT'];
Line 11: Line 12:
 
     }
 
     }
  
 +
// Compile and output
 
$gcc = $htdocs.'wiki/gcc';
 
$gcc = $htdocs.'wiki/gcc';
 
$article = "Compiling using $gcc:\n";
 
$article = "Compiling using $gcc:\n";
 
$article .= shell_exec("$gcc 2>&1");
 
$article .= shell_exec("$gcc 2>&1");
 
?>
 
?>

Revision as of 05:48, 23 June 2006

<?

  1. C compiler for XmlWiki Environment

xwSetProperty('language','TEXT'); $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);
   }

// Compile and output $gcc = $htdocs.'wiki/gcc'; $article = "Compiling using $gcc:\n"; $article .= shell_exec("$gcc 2>&1"); ?>