From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id CAA29411 for caml-redistribution; Fri, 2 Jul 1999 02:08:05 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA30211 for ; Thu, 1 Jul 1999 19:32:26 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id TAA13999; Thu, 1 Jul 1999 19:32:23 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA14299; Thu, 1 Jul 1999 19:32:22 +0200 (MET DST) Message-ID: <19990701193222.56286@pauillac.inria.fr> Date: Thu, 1 Jul 1999 19:32:22 +0200 From: Xavier Leroy To: Markus Mottl , OCAML Subject: Re: Sys.argv with interpreter and compiler References: <199906271102.NAA22537@miss.wu-wien.ac.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1 In-Reply-To: <199906271102.NAA22537@miss.wu-wien.ac.at>; from Markus Mottl on Sun, Jun 27, 1999 at 01:02:45PM +0100 Sender: weis > E.g. I want to emit an error message that includes the name of the > executable or, if the interpreter is used, the name of the script. > > Wouldn't it be logically more consistent to pass the truncated array > of arguments to the script under the interpreter so that the program > always gets its name on index 0 - no matter whether it is compiled > or interpreted? Yes, it would be more consistent, but that's exactly what it does currently. At least, that's what a quick test under Linux shows. > - With the current version it gets the name of the > interpreter on this position. That's surprising. On which operating system do you see this behavior? The treatment of argv[0] in C w.r.t. #! scripts differs between various versions of Unix, but we tried to compensate for this in the OCaml bytecode interpreter. - Xavier Leroy