From 1c39f1bc3288a8fe8ab72955af630c7e3c5026b1 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Mon, 24 Nov 2014 14:31:38 +0000 Subject: [PATCH] Code freeze for 2.1 builds --- cpdf.ml | 8 +++++--- cpdf.mli | 2 ++ cpdfcommand.ml | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cpdf.ml b/cpdf.ml index f1187d3..dd7faa0 100755 --- a/cpdf.ml +++ b/cpdf.ml @@ -2,6 +2,8 @@ open Pdfutil open Pdfio +let debug = ref false + (* Prefer a) the one given with -cpdflin b) a local cpdflin, c) otherwise assume installed at a system place *) let find_cpdflin provided = @@ -25,14 +27,14 @@ let call_cpdflin cpdflin temp output best_password = match Sys.os_type with "Win32" -> (* On windows, don't use LD_LIBRARY_PATH - it will happen automatically *) - print_endline command; + if !debug then prerr_endline command; Sys.command command | _ -> (* On other platforms, if -cpdflin was provided, or cpdflin was in the current folder, set up LD_LIBRARY_PATH: *) match cpdflin with "cpdflin" -> - print_endline command; + if !debug then prerr_endline command; Sys.command command | _ -> let command = @@ -40,7 +42,7 @@ let call_cpdflin cpdflin temp output best_password = "LD_LIBRARY_PATH=" ^ Filename.dirname cpdflin ^ " " ^ command in - print_endline command; + if !debug then prerr_endline command; Sys.command command (* Recompress anything which isn't compressed, unless it's metadata. *) diff --git a/cpdf.mli b/cpdf.mli index ea329f8..0b2eecc 100644 --- a/cpdf.mli +++ b/cpdf.mli @@ -476,3 +476,5 @@ val find_cpdflin : string option -> string val call_cpdflin : string -> string -> string -> string -> int +val debug : bool ref + diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 3c8db9e..051e2fb 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -1099,6 +1099,7 @@ let setdebug () = set Pdfread.read_debug; set Pdfwrite.write_debug; set Pdfcrypt.crypt_debug; + set Cpdf.debug; args.debug <- true let setdebugcrypt () =