No args -> print version

This commit is contained in:
John Whitington 2024-10-13 12:12:56 +02:00
parent 06c3ee0204
commit c77c9beb95
1 changed files with 6 additions and 4 deletions

View File

@ -3589,15 +3589,16 @@ let print_obj pdf objspec =
| [] -> simple_obj 0 | [] -> simple_obj 0
| _ -> simple_obj (int_of_string objspec) | _ -> 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 *) (* Main function *)
let go () = let go () =
check_bookmarks_mistake (); check_bookmarks_mistake ();
check_clashing_output_name (); check_clashing_output_name ();
match args.op with match args.op with
| Some Version -> | Some Version -> 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")
| None | Some Merge -> | None | Some Merge ->
begin match args.out, args.inputs with begin match args.out, args.inputs with
| _, (_::_ as inputs) -> | _, (_::_ as inputs) ->
@ -4742,7 +4743,8 @@ let go_withargv argv =
* has exactly one file input and exactly one output and just -gs <gs> * has exactly one file input and exactly one output and just -gs <gs>
* -gs-malformed-force between. *) * -gs-malformed-force between. *)
match argv with 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; args.path_to_ghostscript <- gslocation;
ignore (gs_malformed_force inputfilename outputfilename); ignore (gs_malformed_force inputfilename outputfilename);
exit 0 exit 0