[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

doc scm_set_program_arguments

From: Kevin Ryde
Subject: doc scm_set_program_arguments
Date: Sun, 14 Jan 2007 09:29:35 +1100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

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

            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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]