ajout Filename.quote

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2625 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Damien Doligez 1999-11-29 19:04:04 +00:00
parent 21b2a58674
commit 532cc5ee4a
6 changed files with 40 additions and 18 deletions

View File

@ -24,12 +24,12 @@ OPTCOMPFLAGS=
CAMLDEP=../boot/ocamlrun ../tools/ocamldep
OBJS=pervasives.cmo list.cmo char.cmo string.cmo array.cmo sys.cmo \
hashtbl.cmo sort.cmo filename.cmo marshal.cmo obj.cmo \
hashtbl.cmo sort.cmo marshal.cmo obj.cmo \
lexing.cmo parsing.cmo \
set.cmo map.cmo stack.cmo queue.cmo stream.cmo \
buffer.cmo printf.cmo format.cmo arg.cmo printexc.cmo gc.cmo \
digest.cmo random.cmo oo.cmo genlex.cmo callback.cmo weak.cmo \
lazy.cmo
lazy.cmo filename.cmo
all: stdlib.cma std_exit.cmo camlheader camlheader_ur

View File

@ -18,29 +18,31 @@ CAMLC = {RUNTIME} {COMPILER}
CAMLDEP = ::boot:ocamlrun ::tools:ocamldep
OBJS = pervasives.cmo list.cmo char.cmo string.cmo array.cmo sys.cmo ¶
hashtbl.cmo sort.cmo filename.cmo marshal.cmo obj.cmo ¶
hashtbl.cmo sort.cmo marshal.cmo obj.cmo ¶
lexing.cmo parsing.cmo ¶
set.cmo map.cmo stack.cmo queue.cmo stream.cmo ¶
buffer.cmo printf.cmo format.cmo arg.cmo printexc.cmo gc.cmo ¶
digest.cmo random.cmo oo.cmo genlex.cmo callback.cmo weak.cmo ¶
lazy.cmo
lazy.cmo filename.cmo
all Ä stdlib.cma std_exit.cmo camlheader camlheader_ur
install Ä
duplicate -y stdlib.cma std_exit.cmo Å.cmi Å.mli camlheader camlheader_ur ¶
"{LIBDIR}"
"{LIBDIR}"
stdlib.cma Ä {OBJS}
{CAMLC} -a -o stdlib.cma {OBJS}
camlheader Ä
(quote -n "{BINDIR}ocamlrun";
echo ' "{command}" {"Parameters"}; exit {status}')
> camlheader
begin
quote -n "{BINDIR}ocamlrun"; echo ' "{command}" {"Parameters"}'
echo 'exit {status}'
echo
end > camlheader
camlheader_ur Ä
echo -n ' ' >camlheader_ur
echo -n ' ' > camlheader_ur
clean ÄÄ
delete -i camlheader camlheader_ur
@ -53,7 +55,7 @@ pervasives.cmo
# oo.cmi must be compiled with -nopervasives for applets
oo.cmi Ä oo.mli
{CAMLC} {COMPFLAGS} -nopervasives -c oo.mli
{CAMLC} {COMPFLAGS} -nopervasives -c oo.mli
.cmi Ä .mli
{CAMLC} {COMPFLAGS} -c {default}.mli

View File

@ -14,8 +14,8 @@ char.cmo
char.cmxÄ char.cmi
digest.cmoÄ string.cmi digest.cmi
digest.cmxÄ string.cmx digest.cmi
filename.cmoÄ pervasives.cmi string.cmi sys.cmi filename.cmi
filename.cmxÄ pervasives.cmx string.cmx sys.cmx filename.cmi
filename.cmoÄ buffer.cmi pervasives.cmi string.cmi sys.cmi filename.cmi
filename.cmxÄ buffer.cmx pervasives.cmx string.cmx sys.cmx filename.cmi
format.cmoÄ buffer.cmi obj.cmi string.cmi format.cmi
format.cmxÄ buffer.cmx obj.cmx string.cmx format.cmi
gc.cmoÄ printf.cmi gc.cmi
@ -50,8 +50,8 @@ printf.cmo
printf.cmxÄ buffer.cmx obj.cmx string.cmx printf.cmi
queue.cmoÄ queue.cmi
queue.cmxÄ queue.cmi
random.cmoÄ array.cmi char.cmi digest.cmi string.cmi sys.cmi random.cmi
random.cmxÄ array.cmx char.cmx digest.cmx string.cmx sys.cmx random.cmi
random.cmoÄ array.cmi char.cmi digest.cmi string.cmi random.cmi
random.cmxÄ array.cmx char.cmx digest.cmx string.cmx random.cmi
set.cmoÄ set.cmi
set.cmxÄ set.cmi
sort.cmoÄ array.cmi sort.cmi

View File

@ -22,12 +22,12 @@ CAMLOPT=$(RUNTIME) $(OPTCOMPILER)
CAMLDEP=..\boot\ocamlrun ..\tools\ocamldep
OBJS=pervasives.cmo list.cmo char.cmo string.cmo array.cmo sys.cmo \
hashtbl.cmo sort.cmo filename.cmo marshal.cmo obj.cmo \
hashtbl.cmo sort.cmo marshal.cmo obj.cmo \
lexing.cmo parsing.cmo \
set.cmo map.cmo stack.cmo queue.cmo stream.cmo \
buffer.cmo printf.cmo format.cmo arg.cmo printexc.cmo gc.cmo \
digest.cmo random.cmo oo.cmo genlex.cmo callback.cmo weak.cmo \
lazy.cmo
lazy.cmo filename.cmo
all: stdlib.cma std_exit.cmo camlheader camlheader_ur

View File

@ -66,8 +66,7 @@ let wnt_is_implicit n =
&& (String.length n < 3 || String.sub n 0 3 <> "..\\")
;;
let contains_colon n = String.contains n ':'
;;
let contains_colon n = String.contains n ':' ;;
let mac_is_relative n =
(String.length n >= 1 && n.[0] = ':')
@ -201,3 +200,20 @@ let temp_file prefix suffix =
end
in try_name 0
let quote s =
let quotechar = match Sys.os_type with "MacOS" -> '\182' | _ -> '\\' in
if Sys.os_type = "Win32" then s else (* XXX *)
let l = String.length s in
let b = Buffer.create (l + 20) in
Buffer.add_char b '\'';
for i = 0 to l - 1 do
Buffer.add_char b s.[i];
if s.[i] = '\'' then begin
Buffer.add_char b s.[i];
Buffer.add_char b quotechar;
Buffer.add_char b s.[i];
end;
done;
Buffer.add_char b '\'';
Buffer.contents b
;;

View File

@ -62,3 +62,7 @@ val temp_file: string -> string -> string
Under MacOS, the name of the temporary directory is given
by the environment variable [TempFolder]; if not set,
temporary files are created in the current directory. *)
val quote: string -> string;;
(* Return a quoted version of a file name, suitable for use as
one argument in a shell command line, escaping any shell
meta-characters. *)