#!/usr/bin/php
<?php

# Graphviz Dispatcher by Ryan Schmidt

define('GRAPHVIZ_DIR', '@PREFIX@/bin');

$args = $_SERVER['argv'];

$prog = basename(array_shift($args));
if ('cvtgxl' == $prog) $prog = 'dot2gxl';

$cmd = escapeshellarg(GRAPHVIZ_DIR . '/' . $prog);
foreach ($args as $arg) {
	if ('-Tepdf' == $arg) {
		$arg = '-Tpdf';
		$cmd .= ' -Gmargin="0,0"';
		$cmd .= ' -Gdpi=96';
	}
	$cmd .= ' ' . escapeshellarg($arg);
}

passthru($cmd, $return_code);
exit($return_code);

?>
