diff --git a/tools/rdbg4sasa/sasa-rdbg-cmds.ml b/tools/rdbg4sasa/sasa-rdbg-cmds.ml index 8bc28af85fd164e49b09edabf9e217308d51d365..b5492e032de596f428b84ab753352a3e562f9d7c 100644 --- a/tools/rdbg4sasa/sasa-rdbg-cmds.ml +++ b/tools/rdbg4sasa/sasa-rdbg-cmds.ml @@ -239,7 +239,7 @@ let _ = (* split the vars into returns (the enab vars, the activated vars, the other vars) nb: in the "Enab" prefix is removed from enab vars names; ie we leave only the pid and the action name *) -type s = (string * string * Data.v) +type s = (string string * Data.v) let split_data (l:Data.subst list) : s list * s list * s list = let l = List.map (fun (x,v) -> Str.split (Str.regexp "_") x, v) l in let rec sortv (enab, other) (x,v) = @@ -438,14 +438,20 @@ let l () = (**********************************************************************) (* ok, let's start the debugging session! *) -let pdf_viewer = - if Sys.command "which zathura" = 0 then "zathura" else +let pdf_viewer = (* try hard to find a working pdf viewer! *) + try + let res = Unix.getenv "PDF_VIEWER" in (* may raise Not_found *) + if Sys.command (Printf.sprintf "which %s" res) = 0 then res else raise Not_found + with Not_found -> + if Sys.command "which see" = 0 then "see" else + if Sys.command "which zathura" = 0 then "zathura" else + if Sys.command "which okular" = 0 then "okular" else if Sys.command "which xpdf" = 0 then "xpdf" else - if Sys.command "which acroread" = 0 then "acroread" else - if Sys.command "which evince" = 0 then "evince" else ( - Printf.printf "Warning: no pdf viewer is found to visualize %s\n%!" dotfile; - "ls" - ) + if Sys.command "which evince" = 0 then "evince" else + if Sys.command "which acroread" = 0 then "acroread" else ( + Printf.printf "Warning: no pdf viewer found to visualize %s\n%!" dotfile; + "ls" + ) let graph_view () = !dot_view ();