From c77c9beb95bb6fd032ada2e1d369fc2bfcc0996e Mon Sep 17 00:00:00 2001 From: John Whitington Date: Sun, 13 Oct 2024 12:12:56 +0200 Subject: [PATCH] No args -> print version --- cpdfcommand.ml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index c7512a2..d7f602f 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -3589,15 +3589,16 @@ let print_obj pdf objspec = | [] -> simple_obj 0 | _ -> simple_obj (int_of_string objspec) +let print_version () = + flprint + ("cpdf " ^ (if agpl then "AGPL " else "") ^ "Version " ^ string_of_int major_version ^ "." ^ string_of_int minor_version ^ "." ^ string_of_int minor_minor_version ^ " " ^ version_date ^ "\n") (* Main function *) let go () = check_bookmarks_mistake (); check_clashing_output_name (); match args.op with - | Some Version -> - flprint - ("cpdf " ^ (if agpl then "AGPL " else "") ^ "Version " ^ string_of_int major_version ^ "." ^ string_of_int minor_version ^ "." ^ string_of_int minor_minor_version ^ " " ^ version_date ^ "\n") + | Some Version -> print_version () | None | Some Merge -> begin match args.out, args.inputs with | _, (_::_ as inputs) -> @@ -4742,7 +4743,8 @@ let go_withargv argv = * has exactly one file input and exactly one output and just -gs * -gs-malformed-force between. *) match argv with - [|_; inputfilename; "-gs"; gslocation; "-gs-malformed-force"; "-o"; outputfilename|] -> + | [|_|] -> print_version () + | [|_; inputfilename; "-gs"; gslocation; "-gs-malformed-force"; "-o"; outputfilename|] -> args.path_to_ghostscript <- gslocation; ignore (gs_malformed_force inputfilename outputfilename); exit 0