[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gcl-devel] command line arguments
From: |
Jared C. Davis |
Subject: |
[Gcl-devel] command line arguments |
Date: |
Wed, 10 Jul 2013 11:49:39 -0500 |
Hi,
I'm trying to write a wrapper function that provides uniform access to
the command-line arguments of Lisp programs across many Lisps.
In CCL (and also in Allegro, CLISP, CMUCL, SBCL, mutatis mutandis), one can do:
$ cat myprog-ccl
#!/bin/sh
exec ccl -I myprog.ccl -K ISO-8858-1 -e "(myprog::main)" -- "$@"
The options that come before the special "--" argument here are "for
the Lisp", and options after it are "for my program."
This is especially nice because there is no ambiguity:
#1. If my program takes its own -I switch, that's okay: the LIsp
isn't going to get confused and think that I'm telling it to use some
other image.
#2. If my program doesn't have its own -K switch, that's fine: the
Lisp isn't going to send that option to the program, because it's an
option for the Lisp.
Does GCL have any command-line switch similar to "--"?
>From the man page, it almost sounds like I want to use -f. But that
seems to do something strange involving reading files, and so it
doesn't seem quite right.
If there is no such option, I guess I can at least write my wrapper
script along the following lines:
$ cat myprog-gcl
#!/bin/sh
exec myprog.gcl -eval "(myprog::main)" -- "$@"
Then, in my program, I could at least throw out everything before the
"--" in si::*command-args*.
This would at least give me the good behavior #2. But since GCL would
still be processing all of the arguments, it doesn't seem like it
solves #1. For instance, if my program has its own options with names
like -f, -dir, -eval, etc., then GCL will think are options for it,
and then would presumably try to do crazy things.
Thanks!
Jared
--
Jared C. Davis <address@hidden>
11410 Windermere Meadows
Austin, TX 78759
http://www.cs.utexas.edu/users/jared/
- [Gcl-devel] command line arguments,
Jared C. Davis <=