[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] \V[envvar]: is/was there a "does-exist" concruent to 'getenv
From: |
Werner LEMBERG |
Subject: |
Re: [Groff] \V[envvar]: is/was there a "does-exist" concruent to 'getenv(VAR) != NULL'? |
Date: |
Wed, 14 Jan 2015 08:22:53 +0100 (CET) |
> i really wonder because all i can do is
>
> .if !'\V[GROFF_NO_MDOCMX]'' ...
>
> but what i really would like to do is rather
>
> .if !d \V[GROFF_NO_MDOCMX]
>
> so to be synchronous with $GROFF_NO_SGR. Well i am, but only on
> grotty(1) level, not in the macros, which is odd.
> Wouldn't it be, even more, natural to be able to use "d" for that?
\V always returns a string. If the environment variable is not
defined, it returns an empty string.
If `GROFF_NO_MDOCMX' is not set, your code
.if !d \V[GROFF_NO_MDOCMX]
expands to
.if !d ""
which is meaningless.
It might be possible to create another interface to environment
variables, but I strongly doubt that it is worth the trouble.
Werner