···331331 (Gabriel Scherer, review by Nicolás Ojeda Bär and Florian Angeletti,
332332 report by Kate Deplaix)
333333334334+- #14190: `ocaml -e` now also processes `-init` (previously it was ignored).
335335+ (Emile Trotignon, review by David Allsopp and @ygrek)
334336335337### Internal/compiler-libs changes:
336338
+5-2
man/ocaml.1
···317317318318When
319319.BR ocaml (1)
320320-is invoked, it will read phrases from an initialization file before
321321-giving control to the user. The file read is the first found of:
320320+is invoked as a toplevel, it will read phrases from an initialization file
321321+before giving control to the user. This does not happen when running a
322322+script, or when using -e.
323323+324324+The file read is the first found of:
322325.IP 1.
323326\fB.ocamlinit\fP in the current directory;
324327.IP 2.
+6-3
toplevel/toploop.ml
···109109110110let load_file = load_file false
111111112112+let load_explicit_ocamlinit ppf f =
113113+ if Sys.file_exists f then ignore (use_silently ppf (File f) )
114114+ else fprintf ppf "Init file not found: \"%s\".@." f
115115+112116(* Execute a script. If [name] is "", read the script from stdin. *)
113117114118let run_script ppf name args =
···128132 else filename)
129133 | (Stdin | String _) as x -> x
130134 in
135135+ Option.iter (load_explicit_ocamlinit ppf) !Clflags.init_file;
131136 use_silently ppf explicit_name
132137133138(* Toplevel initialization. Performed here instead of at the
···263268let load_ocamlinit ppf =
264269 if !Clflags.noinit then ()
265270 else match !Clflags.init_file with
266266- | Some f ->
267267- if Sys.file_exists f then ignore (use_silently ppf (File f) )
268268- else fprintf ppf "Init file not found: \"%s\".@." f
271271+ | Some f -> load_explicit_ocamlinit ppf f
269272 | None ->
270273 match find_ocamlinit () with
271274 | None -> ()