File: patch_test.ml

package info (click to toggle)
approx 4.5-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 428 kB
  • ctags: 683
  • sloc: ml: 1,957; sh: 45; makefile: 36
file content (21 lines) | stat: -rw-r--r-- 620 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(* approx: proxy server for Debian archive files
   Copyright (C) 2008  Eric C. Cooper <ecc@cmu.edu>
   Released under the GNU General Public License *)

open Printf
open Util

let diff_file, file_to_patch =
  match Array.length Sys.argv with
  | 2 -> Sys.argv.(1), None
  | 3 -> Sys.argv.(1), Some Sys.argv.(2)
  | _ -> eprintf "Usage: %s pdiff [file]\n" Sys.argv.(0); exit 1

let cmds = with_in_channel open_file diff_file Patch.parse

let () =
  match file_to_patch with
  | Some file ->
      with_in_channel open_file file (fun chan -> Patch.apply cmds chan stdout)
  | None ->
      printf "Parsed %s\n" diff_file