[Top][All Lists]

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

Re: [gforth] Using Gforth with #! "shebang"

From: Bernd Paysan
Subject: Re: [gforth] Using Gforth with #! "shebang"
Date: Wed, 21 Nov 2012 15:41:23 +0100
User-agent: KMail/4.8.5 (Linux/3.4.11-2.16-desktop; KDE/4.8.5; x86_64; ; )

Am Mittwoch, 21. November 2012, 14:59:00 schrieb Anton Ertl:
> On Wed, Nov 21, 2012 at 04:44:25AM +0100, David Kuehling wrote:
> > /usr/local/bin/gforth-fast: cannot grok size specification  256M -d 4M -r
> > 4M -l 256K: invalid unit "M -d 4M -r 4M -l 256K"
> Looks to me like it passes two arguments: "-m" and "256M -d 4M -r 4M
> -l 256k".

No, getopts actually understands both -m 256M and -m256M.

> Given that, we could add another command-line option -#!
> that parses the next argument and treats it as a sequence of
> command-line arguments.  Then you could write the line as follows:

Sort-of. A special start option would have to parse its argument, like

--options=-m 256M -d 4M -r 4M -l 256k

would then parse the option string itself.  This is not all that difficult, we 
could even mandate that there may only be one space per separator, and replace 
them all with the necessary zero-terminators.

> #! /usr/local/bin/gforth-fast -#! -m 256M -d 4M -r 4M -l 256k
> However, I think that there are Unixes that ignore everything after
> the first argument, so this approach would not work there.

The hack David found with using #0 [IF] as multi-line comment for Forth IMHO 
is the right way.  We should put it into the documentation and into the 
Rosetta code page.

Bernd Paysan
"If you want it done right, you have to do it yourself"

Attachment: signature.asc
Description: This is a digitally signed message part.

reply via email to

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