steffen: server/kolab-horde-framework/kolab-horde-framework/Text_Diff/docs/examples 1.txt, NONE, 1.1 2.txt, NONE, 1.1 diff.php, NONE, 1.1

cvs at intevation.de cvs at intevation.de
Fri Oct 14 16:33:15 CEST 2005


Author: steffen

Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff/docs/examples
In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Text_Diff/docs/examples

Added Files:
	1.txt 2.txt diff.php 
Log Message:
Separated Horde Framework from kolab-resource-handlers

--- NEW FILE: 1.txt ---
This line is the same.
This line is different in 1.txt
This line is the same.

--- NEW FILE: 2.txt ---
This line is the same.
This line is different in 2.txt
This line is the same.

--- NEW FILE: diff.php ---
#!/usr/local/bin/php
<?php
/**
 * Text_Diff example script.
 *
 * Take two files from the command line args and produce a unified
 * diff of them.
 *
 * @package Text_Diff
 */

include_once 'Text/Diff.php';
include_once 'Text/Diff/Renderer.php';
include_once 'Text/Diff/Renderer/unified.php';

/* Make sure we have enough arguments. */
if (count($argv) < 3) {
    echo "Usage: diff.php <file1> <file2>\n\n";
    exit;
}

/* Make sure both files exist. */
if (!is_readable($argv[1])) {
    echo "$argv[1] not found or not readable.\n\n";
}
if (!is_readable($argv[2])) {
    echo "$argv[2] not found or not readable.\n\n";
}

/* Load the lines of each file. */
$lines1 = file($argv[1]);
$lines2 = file($argv[2]);

/* Create the Diff object. */
$diff = &new Text_Diff($lines1, $lines2);

/* Output the diff in unified format. */
$renderer = &new Text_Diff_Renderer_unified();
echo $renderer->render($diff);





More information about the commits mailing list