From 40170283be604eddb71b3d9966d99e7cf264d2e7 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Sun, 26 Jul 2020 16:04:59 +0100 Subject: [PATCH] Introduced post-checks on command line flags --- cpdfcommand.ml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index 53d0101..3d4882d 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -4530,10 +4530,17 @@ let go () = flush stdout; write_pdf false pdf -let parse_argv () = +(* Advise the user if a combination of command line flags makes little sense, +or error out if it make no sense at all. *) +let check_command_line () = + if args.gs_malformed && !Pdfread.error_on_malformed then + error "Setting both -gs-malformed and -error-on-malformed makes no sense" + +let parse_argv () s specs anon_fun usage_msg = if args.debug then Array.iter (Printf.eprintf "arg: %s\n") Sys.argv; - Arg.parse_argv ~current:(ref 0) + Arg.parse_argv ~current:(ref 0) s specs anon_fun usage_msg; + check_command_line () let align_specs s = Arg.align s