bug-ncurses
[Top][All Lists]
Advanced

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

Re: Providing an alternative TERMINFO environment variable


From: Thomas Dickey
Subject: Re: Providing an alternative TERMINFO environment variable
Date: Tue, 28 Nov 2023 16:11:13 -0500

On Tue, Nov 28, 2023 at 05:14:26PM +0000, Igor Todorovski wrote:
> Hi,
> 
> I’m an IBM z/OS mainframe developer. On z/OS, we have an existing TERMINFO db 
> that is in EBCDIC format and z/OS already check for TERMINFO, but I would 
> like to provide a way to override that with a different environment variable 
> so as to instruct ncurses where to check for the ascii terminfo.
> 
> I have added the below code to enable setting ASCII_TERMINFO. I’m not sure if 
> the environment variable name is reasonable or not, but the z/OS system 
> default checks for TERMINFO so I needed a way to tell ncurses where to pick 
> up tis terminfo db.
> 
> Is there a better alternative?

I suppose you could call it NCURSES_TERMINFO

However, this is used when writing terminfo data, and that normally would
be as root (or $HOME/.terminfo), and root's environment shouldn't be
cluttered with things like $TERMINFO -- generally speaking the compiled-in
value for $TERMINFO satisfies almost all uses.
 
>   /*
>    * Record the "official" location of the terminfo directory, according to
>    * the place where we're writing to, or the normal default, if not.
>    */
>   NCURSES_EXPORT(const char *)
>   _nc_tic_dir(const char *path)
>   {
>       T(("_nc_tic_dir %s", NonNull(path)));
>       if (!KeepTicDirectory) {
>     if (path != NULL) {
>         if (path != TicDirectory)
>       update_tic_dir(strdup(path));
>         HaveTicDirectory = TRUE;
>     } else if (HaveTicDirectory == 0) {
>         if (use_terminfo_vars()) {
>       const char *envp;
> + #ifdef __MVS__
> +     if ((envp = getenv("ASCII_TERMINFO")) != 0)
> +         return _nc_tic_dir(envp);
> +     if ((envp = getenv("TERMINFO")) != 0)
> + #else
>       if ((envp = getenv("TERMINFO")) != 0)
> + #endif
>           return _nc_tic_dir(envp);
>         }
>     }
>       }
>       return TicDirectory ? TicDirectory : TERMINFO;
>   }

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]