Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #3665

Re: getopt.ps

Newsgroups comp.lang.postscript
Date 2021-08-06 22:15 -0700
References <1627849972.bystand@zzo38computer.org> <0ac2aeb1-c2b3-4253-a90c-04c299ecb13fn@googlegroups.com>
Message-ID <961a28df-ed55-4d49-a876-9d297bc2d1fcn@googlegroups.com> (permalink)
Subject Re: getopt.ps
From luser droog <luser.droog@gmail.com>

Show all headers | View raw


On Thursday, August 5, 2021 at 1:17:44 AM UTC-5, luser droog wrote:
> On Sunday, August 1, 2021 at 4:03:18 PM UTC-5, ne...@zzo38computer.org.invalid wrote: 
> > I wrote a PostScript program for parsing command-line switches similar to 
> > how the getopt function of UNIX is doing. I might use it myself in some of 
> > my own programs, but it might be useful for other programmers to use, too. 
> > You can also tell me if you have a suggestion for improvement, too. 
> > 
> > Long option parameters without = are not implemented, and it will always 
> > use the POSIXLY_CORRECT kind of parsing. 
> > 
> > ***BEGIN*** 
> > 
> > % PostScript code for parsing command-line arguments 
> > % (public domain)
> I think this is interesting code (and it's great to see people writing PS!). 
> But I'm not sure if it's actually very useful. If you're using ghostscript, 
> you can combine the ARGUMENTS form with -D definitions, so you 
> don't really need to parse any option style syntax from the ARGUMENTS 
> list. Just define those with -D and use ARGUMENTS for strings 
> or filenames or whatever. 
> 
> I started a thread recently listing every way I could think of to pass 
> arguments into a PS program. Lots of them can be combined. 
> You can even define parameters with regular PS code and concatenate 
> the files before processing.

Another way which could be cool is use -c "(some)(options)" and just
leave stuff on the stack. The program can then use 

    count 0 ne {
        ...
    } if

to check for and process optional parameters.

Back to comp.lang.postscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

getopt.ps news@zzo38computer.org.invalid - 2021-08-01 14:05 -0700
  Re: getopt.ps luser droog <luser.droog@gmail.com> - 2021-08-04 23:17 -0700
    Re: getopt.ps luser droog <luser.droog@gmail.com> - 2021-08-06 22:15 -0700
    Re: getopt.ps news@zzo38computer.org.invalid - 2021-08-20 13:14 -0700
      Re: getopt.ps ken <ken@spamcop.net> - 2021-08-21 08:31 +0100

csiph-web