Newbie question: Command line arguments in Common Lisp?

From: David Buchan (David_at_pdbuchan.com)
Date: 12/30/04


Date: Thu, 30 Dec 2004 11:13:15 -0500

Hi guys,

In C language, you can type arguments at the command line and have your
program pick them up and use them. For example, I could write a dos2unix
program and have the name of the file to be cleaned, passed into main
via array argv.

At the command prompt I would type:

dos2unix[.exe] filename

and the file would be cleaned of carriage-returns.

The code would look something like:

int main (char *argv[])
{
FILE *fi;

fi=open(argv[[1],"r");

etc.

FORTRAN now allows this, except that you access the arguments by using
the getarg intrinsic procedure.

Perl, an interpreted language, also allows this. The arguments are in
@argv and you use shift @argv to access each one.

Can I do something similar in Common Lisp?

Thanks,
Dave



Relevant Pages

  • OT Whore Words (was Shall I use the before...) OT
    ... I will do a favor for readers, especially learners of English. ... Command of language has nothing to do with being an annoying ... and how to succeed in life by doing so. ...
    (alt.usage.english)
  • Re: delete command weirdness
    ... Thinking of a function as a command may warp your expectations. ... It does have pedants. ... market, mind you, but not because they didn't work by side-effect.) ... really proceed by analysis of the fixed constraints of the language, ...
    (comp.lang.lisp)
  • Re: effing Nader
    ... you're just hiding behind a deliberately unreadable command. ... Of course it's unreadable to anyone who doesn't know the language. ... It's loosely based on something I've done for WSFA meetings. ...
    (rec.arts.sf.fandom)
  • Re: DCL Coding Standards
    ... I also like the underscore when the label appears in a command. ... If the tab stops are off, reset them to the default of every 8 columns. ... other language processors may require spaces or TABs to delimit ...
    (comp.os.vms)
  • Re: CFO: Why C?
    ... C is /also/ a good language in which to write non-trivial ... Not even C is a silver bullet. ... prompt asking for a renaming command to be entered on standard input. ...
    (comp.os.linux.development.apps)