I will take a look tomorrow before noon. Too little focus to do it thoroughly right now.
Judging just from your post it seems its what we agreed at the Math meeting (discussion around a helper function).
EDIT:
Quick comment not on the general design: I would prefer not using getenv
. In this case I would prefer ifdefing and just assigning a default value when the define is not present. That way you also dont need to do the lexical parse as this becomes a compile time error.