Allow -pw=password so passwords may begin with a dash

This commit is contained in:
John Whitington 2021-01-06 13:41:14 +00:00
parent dcb8d8887a
commit 24d6f02e06
1 changed files with 6 additions and 1 deletions

View File

@ -3,7 +3,7 @@ let demo = false
let noncomp = false let noncomp = false
let major_version = 2 let major_version = 2
let minor_version = 4 let minor_version = 4
let version_date = "(devel, 21st December 2020)" let version_date = "(devel, 6th January 2020)"
open Pdfutil open Pdfutil
open Pdfio open Pdfio
@ -871,6 +871,8 @@ let anon_fun s =
| (a, _, d, e, f, g)::t -> | (a, _, d, e, f, g)::t ->
args.inputs <- (a, fixdashes s, d, e, f, g)::t args.inputs <- (a, fixdashes s, d, e, f, g)::t
(* If a password begins with a dash, we allow -pw=<password> too *)
let setdashpassword = anon_fun
(*let firstpage pdf = (*let firstpage pdf =
List.hd (Pdfpage.pages_of_pagetree pdf)*) List.hd (Pdfpage.pages_of_pagetree pdf)*)
@ -1513,6 +1515,8 @@ let whingemalformed () =
prerr_string "Command line must be of exactly the form\ncpdf <infile> -gs <path> -gs-malformed-force -o <outfile>\n"; prerr_string "Command line must be of exactly the form\ncpdf <infile> -gs <path> -gs-malformed-force -o <outfile>\n";
exit 1 exit 1
let nothing () = () let nothing () = ()
(* Parse a control file, make an argv, and then make Arg parse it. *) (* Parse a control file, make an argv, and then make Arg parse it. *)
@ -2191,6 +2195,7 @@ and specs =
("-fix-prince", Arg.Unit (setop RemoveUnusedResources), ""); ("-fix-prince", Arg.Unit (setop RemoveUnusedResources), "");
("-extract-text", Arg.Unit (setop ExtractText), ""); ("-extract-text", Arg.Unit (setop ExtractText), "");
("-extract-text-font-size", Arg.Float setextracttextfontsize, ""); ("-extract-text-font-size", Arg.Float setextracttextfontsize, "");
("-pw", Arg.String setdashpassword, "");
] ]
and usage_msg = and usage_msg =