Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
blob: 4e6966f27c1a3a25381b0cfd3c811d2f8e0c0721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env php
<?php
/**
 * Given a set of sorted zips, generates a regular expression to match only the
 * given input
 *
 * I wanted to write this in Scheme (it's a perfect recursive application), but
 * I figured that other developers may get annoyed having to find a Scheme impl
 * that works for them...so...PHP it is...
 *
 *
 * THIS SCRIPT EXPECTS THE DATA TO BE SORTED! This can be easily accomplished by
 * doing the following:
 *   sort -d zipfile | ./zipre
 */

include 'lib/zipre.php';

// grab input from stdin (must be sorted!)
$data = explode( "\n", file_get_contents( 'php://stdin' ) );

// build and output
echo gen_re_quick( $data );