source: trunk/bin/phpdc.phpr

Last change on this file was 1285, checked in by moo, 9 months ago

phpdc: exit on decompile error

  • Property svn:eol-style set to native
File size: 727 bytes
Line 
1#! /usr/bin/php -dopen_basedir=
2<?php
3
4$srcdir = dirname(__FILE__);
5require_once("$srcdir/../lib/Decompiler.class.php");
6if (file_exists("$srcdir/phpdc.debug.php")) {
7    include("$srcdir/phpdc.debug.php");
8}
9
10if (!isset($argv)) {
11    $argv = $_SERVER['argv'];
12    $argc = $_SERVER['argc'];
13}
14
15$dc = new Decompiler();
16if (isset($argv[2])) {
17    eval('$dc->decompileDasm(' . file_get_contents($argv[2]) . ');');
18}
19else if (isset($argv[1])) {
20    if ($dc->decompileFile($argv[1]) === false) {
21        exit(2);
22    }
23}
24else {
25    $phpcode = '';
26    if (!defined('stdin')) {
27        define('stdin', fopen('php://stdin', 'rb'));
28    }
29    while (!feof(stdin)) {
30        $phpcode .= fgets(stdin);
31    }
32    if ($dc->decompileString($phpcode) === false) {
33        exit(2);
34    }
35}
36$dc->output();
37
Note: See TracBrowser for help on using the repository browser.