Fix outstanding bugs
[pkg-ocaml-ocsigen.git] / myocamlfind.ml
blob4dfd2dbc5a1c754851d345c37a91d9a5b9501987
1 (* Ocsigen
2 * http://www.ocsigen.org
3 * ocamlfind/ocamlducefind wrapper
4 * Copyright (C) 2009 Stéphane Glondu
5 * Laboratoire PPS - CNRS Université Paris Diderot
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation, with linking
10 * exception; either version 2.1 of the License, or (at your option)
11 * any later version.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 * 02111-1307, USA.
24 let rec argv_pick_duce res accu i =
25 if i <= 0 then
26 (res, accu)
27 else if Sys.argv.(i) = "-duce" then
28 argv_pick_duce true accu (i-1)
29 else
30 argv_pick_duce res (Sys.argv.(i)::accu) (i-1)
32 let _ =
33 let (duce, argv) = argv_pick_duce false [] (Array.length Sys.argv-1) in
34 let command = if duce then "ocamlducefind" else "ocamlfind" in
35 let argv = Array.of_list (command::argv) in
36 Unix.execvp command argv