From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA26263; Tue, 21 Jan 2003 21:26:01 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA26565 for ; Tue, 21 Jan 2003 21:26:00 +0100 (MET) Received: from pop9.ucdavis.edu (pop9.ucdavis.edu [169.237.105.19]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h0LKPwv08101 for ; Tue, 21 Jan 2003 21:25:59 +0100 (MET) Received: from beech ([128.120.141.217]) by pop9.ucdavis.edu (8.11.6/8.11.0/IT4.6.2) with ESMTP id h0LKPua11709 for ; Tue, 21 Jan 2003 12:25:56 -0800 (PST) Received: from ijtrotts by beech with local (Exim 3.36 #1 (Debian)) id 18b51v-0001bu-00 for ; Tue, 21 Jan 2003 12:29:55 -0800 Date: Tue, 21 Jan 2003 12:29:55 -0800 To: OCaml Mailing List Subject: Re: [Caml-list] uname for Ocaml Message-ID: <20030121202955.GA5938@beech> References: <15917.26071.995917.528195@hector.lesours> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15917.26071.995917.528195@hector.lesours> User-Agent: Mutt/1.4i From: Issac Trotts Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk An alternative would be to use #load "unix.cma" let uname() = let (inc, outc) = Unix.open_process "uname" in let name = input_line inc in close_in inc; close_out outc; name;; Here's a more general way to capture the stdout of a Unix call: let syscall cmd = let (inc, outc) = Unix.open_process cmd in let buf = Buffer.create 16 in (try while true do Buffer.add_channel buf inc 1 done with _ -> ()); close_in inc; close_out outc; Buffer.contents buf;; Issac On Tue, Jan 21, 2003 at 04:23:03PM +0100, Basile STARYNKEVITCH wrote: > Dear All, > > If you need to call uname(2) from some Ocaml program you can steal my > tiny code in util.ml util.mli util_ml.c on > > http://www2.poesia-filter.org:8000/cgi-bin/cvsweb.cgi/PoesiaSoft/PoesiaMonIcap/ > > I actually wish that uname(2) will be incorporated in the Unix module. > > regards > -- > > Basile STARYNKEVITCH http://starynkevitch.net/Basile/ > email: basilestarynkevitchnet > alias: basiletunesorg > 8, rue de la Fa?encerie, 92340 Bourg La Reine, France > ------------------- > To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr > Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners -- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners