#! /usr/bin/php
<?php #-*-Mode: php; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/*
jjfMapper, a cartography program for PHP 4.
Copyright (C) 2004 John J Foerch
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* JJFMapper for PHP
*
* Command Line invocation script
*
* You should use the CLI binary of PHP 4.3.0 or higher
* to run this command line invocation script.
*
*/
$jjfmapper_version = 14;
define ('LF',"\n");//a small convenience
define ('TAB',"\t");
$jjfm_basedir = dirname(__FILE__);
if (DIRECTORY_SEPARATOR != '/')
{
$jjfm_basedir = str_replace (DIRECTORY_SEPARATOR, '/', $jjfm_basedir);
}
if (substr ($jjfm_basedir, -1) == '/')
{
$jjfm_basedir .= substr ($jjfm_basedir, 0, strlen ($jjfm_basedir) - 1);
}
define ('JJFM_BASEDIR',$jjfm_basedir);
define ('JJFM_LIBDIR',$jjfm_basedir.'/lib');
include_once (JJFM_BASEDIR.'/site_config.php');
include_once (JJFM_LIBDIR.'/jjfmapper.class.php');
function jjfm_print_usage_title () {
echo("JJFMapper $jjfmapper_version for PHP".LF);
echo('Running in command line mode'.LF);
}
function jjfm_print_usage () {
jjfm_print_usage_title ();
echo('Invocation example:'.LF);
echo(TAB.'php jjfmapper-cl.php instruction_document.xml'.LF);
}
if (! isset($argc)) exit();
if ($argc == 1)
{
jjfm_print_usage_title ();
echo ('View help with:'.LF);
echo (TAB.'php jjfmapper-cl.php --help'.LF);
exit();
}
if ($argc > 1 && $argv[1] == '--help')
{
jjfm_print_usage ();
exit();
}
$mapconfigfile = $argv[1];
$map = new jjfMapper($mapconfigfile);
if ($map->ok) $map->run();
elseif ($map->error !== false) echo ($map->error);
?>