tech-userlevel archive

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

Re: Improvement for bmake: boolean values



> To solve these problems I propose to implement new function for
> bmake, say "yesno", treating 1 and [Yy][Ee][Ss] as logical true, and
> 0 and [Nn][Oo] as logical false.

In case anyone feels like paying attention to my reactions: I don't
like this design; it feels too special-cased.  I'd much prefer adding
some kind of function definition syntax so that bsd.$WHATEVER.mk can
define yesno() itself.  As a strawman,

.function yesno(s) ((s ==i "yes") || (s == "1") || \
        ((s !=i "no") && (s != "0") && error("invalid yesno() argument"))

(I don't know whether ==i / !=i exist at present, though I think those
spellings of them don't; I mean case-insensitive == / !=.)

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML                mouse%rodents-montreal.org@localhost
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index