Re: [dev] sbase

From: Connor Lane Smith <cls_AT_lubutu.com>
Date: Tue, 24 May 2011 10:23:14 +0100

On 24 May 2011 07:00, Anselm R Garbe <garbeam_AT_gmail.com> wrote:
> Now my alarm bells ring. Why is getopt() a good idea? What's wrong
> with making no assumptions and checking flags with strcmp like we did
> in suckless tools? I understand why ARGBEGIN { } ARGEND is no option
> for the -- case, but I really can't see why getopt() would be any
> advantageous compared to our style?

The core tools are used run more frequently from the shell, and
grouping flags has its benefits. One, it means you can actually run
'make' on suckless projects without rm saying there is no -fr flag;
two, it's less verbose -- I have sbase at the front of my PATH right
now, and can tell you it would get tiresome; and three, '--'. dwm and
dmenu don't have any of these problems.

Of course, it would be *possible* to write our own 'ARGBEGIN' kinda
functionality, but then we're basically creating an ad hoc getopt.
Since it's POSIX, and we assume libc sanity -- musl's getopt is about
as simple as we'd get it[1] -- I think getopt is better for these
tools.

[1] http://git.etalabs.net/cgi-bin/gitweb.cgi?p=musl;a=blob;f=src/misc/getopt.c

Thanks,
cls
Received on Tue May 24 2011 - 11:23:14 CEST

This archive was generated by hypermail 2.2.0 : Tue May 24 2011 - 11:36:01 CEST