From: Stephen Ramsay
Subject: command-line arguments (newbie)
Date: 
Message-ID: <686ff.9965$cd1.7047@bignews5.bellsouth.net>
I have a lisp program that has a main function.  You start up the REPL
(in my case, sbcl), and type something like:

(foo "this_stuff")

It outputs a bunch of data to the screen, and then exits.  The
paramater, of course, can vary depending on what the user wants to do.

I don't need to create one of those oft-requested "standale binaries."
I'd just like to wrap this up in a shell script so I can go:

foo this_stuff

where "this_stuff" is some user-specified whatever.

This implies (I think) that I need to tell sbcl (through some
combination of command-line arguments) that it needs to load up a bunch
of fasls, and then run "foo" with a particular argument.  I can get sbcl
to load lisp files, of course, and it would be easy to interpolate the
argument into some exec in the shell, but I can't seem to figure out how
to tell sbcl to run a particular function after it's loaded up the
fasls.

Is there anyway to do this?  I'd rather not require that the user start
up the REPL and type in an s-expression (or worse, start mucking around
in the source code).

Steve

-- 
Stephen Ramsay
web: http://cantor.english.uga.edu/

From: Kalle Olavi Niemitalo
Subject: Re: command-line arguments (newbie)
Date: 
Message-ID: <874q6aju3e.fsf@Astalo.kon.iki.fi>
Stephen Ramsay <·······@uga.edu> writes:

> I can get sbcl to load lisp files, of course, and it would be
> easy to interpolate the argument into some exec in the shell,
> but I can't seem to figure out how to tell sbcl to run a
> particular function after it's loaded up the fasls.

How about:

sbcl --load your.fasl \
     --eval "(apply #'foo (rest sb-ext:*posix-argv*))" \
     --end-toplevel-options ··@"

Add --userinit /dev/null --disable-debugger if needed.
From: Thomas F. Burdick
Subject: Re: command-line arguments (newbie)
Date: 
Message-ID: <xcvzmo2s037.fsf@conquest.OCF.Berkeley.EDU>
Kalle Olavi Niemitalo <···@iki.fi> writes:

> Stephen Ramsay <·······@uga.edu> writes:
> 
> > I can get sbcl to load lisp files, of course, and it would be
> > easy to interpolate the argument into some exec in the shell,
> > but I can't seem to figure out how to tell sbcl to run a
> > particular function after it's loaded up the fasls.
> 
> How about:
> 
> sbcl --load your.fasl \
>      --eval "(apply #'foo (rest sb-ext:*posix-argv*))" \
>      --end-toplevel-options ··@"
> 
> Add --userinit /dev/null --disable-debugger if needed.

and probably --eval "(sb-ext:quit)" as well

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | Free Mumia Abu-Jamal! |
     ,--'    _,'   | Abolish the racist    |
    /       /      | death penalty!        |
   (   -.  |       `-----------------------'
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Stephen Ramsay
Subject: Re: command-line arguments (newbie)
Date: 
Message-ID: <LPmff.71233$ty1.43975@bignews1.bellsouth.net>
On 2005-11-18, Thomas F. Burdick <···@conquest.OCF.Berkeley.EDU> wrote:
>> > I can get sbcl to load lisp files, of course, and it would be
>> > easy to interpolate the argument into some exec in the shell,
>> > but I can't seem to figure out how to tell sbcl to run a
>> > particular function after it's loaded up the fasls.
>> 
>> How about:
>> 
>> sbcl --load your.fasl \
>>      --eval "(apply #'foo (rest sb-ext:*posix-argv*))" \
>>      --end-toplevel-options ··@"
>> 
>> Add --userinit /dev/null --disable-debugger if needed.
>
> and probably --eval "(sb-ext:quit)" as well

Perfect!  Thanks y'all . . .

Steve


-- 
Stephen Ramsay
web: http://cantor.english.uga.edu/