From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: doc scm_set_program_arguments Date: Sun, 14 Jan 2007 09:29:35 +1100 Message-ID: <87d55iimr4.fsf@zip.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1168727400 6801 80.91.229.12 (13 Jan 2007 22:30:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 13 Jan 2007 22:30:00 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jan 13 23:29:56 2007 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H5rNp-0002Ux-L8 for guile-devel@m.gmane.org; Sat, 13 Jan 2007 23:29:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H5rNp-0008SD-JL for guile-devel@m.gmane.org; Sat, 13 Jan 2007 17:29:53 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H5rNk-0008Pi-Qm for guile-devel@gnu.org; Sat, 13 Jan 2007 17:29:48 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H5rNj-0008Mv-EO for guile-devel@gnu.org; Sat, 13 Jan 2007 17:29:48 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H5rNj-0008MY-2i for guile-devel@gnu.org; Sat, 13 Jan 2007 17:29:47 -0500 Original-Received: from [61.8.2.231] (helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H5rNi-0004XQ-E8 for guile-devel@gnu.org; Sat, 13 Jan 2007 17:29:46 -0500 Original-Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.2.162]) by mailout2.pacific.net.au (Postfix) with ESMTP id 7CFFA6E10B for ; Sun, 14 Jan 2007 09:29:43 +1100 (EST) Original-Received: from localhost (ppp27B1.dyn.pacific.net.au [61.8.39.177]) by mailproxy1.pacific.net.au (Postfix) with ESMTP id E51928C07 for ; Sun, 14 Jan 2007 09:29:44 +1100 (EST) Original-Received: from gg by localhost with local (Exim 4.63) (envelope-from ) id 1H5rNX-0001na-Nz for guile-devel@gnu.org; Sun, 14 Jan 2007 09:29:35 +1100 Original-To: guile-devel@gnu.org Mail-Copies-To: never User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:6422 Archived-At: I wrote a few words for scm_set_program_arguments, which is mentioned under scm_boot_guile but not otherwise described. -- C Function: void scm_set_program_arguments (int argc, char **argv, char *first) Set the list of command line arguments to be returned by `program-arguments' and `command-line' above. ARGV is an array of null-terminated strings, as in a C `main' function. ARGC is the number of strings in ARGV, or if it's negative then a `NULL' entry in ARGV marks the end. FIRST is an extra string put at the start of the arguments, or `NULL' for no such extra. This is a convenient way to pass the program name after advancing ARGV to strip option arguments or similar. { char *progname = argv[0]; int i; for (i = 1; i < argc && argv[i][0] == '-'; i++) { /* munch option ... */ } /* remaining args for scheme level use */ scm_set_program_arguments (-1, argv+i, progname); } This sort of thing is often done at startup under `scm_boot_guile' and similar. The given strings are all copied, so the C data is not accessed again once `scm_set_program_arguments' returns. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel