1 /* misc.c - Miscellaneous fucntions
2 * Copyright (C) 2004 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * GnuPG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
37 /* Setup the environment so that the pinentry is able to get all
38 required information. This is used prior to an exec of the
41 setup_pinentry_env (void)
43 #ifndef HAVE_W32_SYSTEM
47 setenv ("DISPLAY", opt
.display
, 1);
49 /* Try to make sure that GPG_TTY has been set. This is needed if we
50 call for example the protect-tools with redirected stdin and thus
51 it won't be able to ge a default by itself. Try to do it here
52 but print a warning. */
54 setenv ("GPG_TTY", opt
.ttyname
, 1);
55 else if (!(lc
=getenv ("GPG_TTY")) || !*lc
)
57 log_error (_("GPG_TTY has not been set - "
58 "using maybe bogus default\n"));
62 setenv ("GPG_TTY", lc
, 1);
66 setenv ("TERM", opt
.ttytype
, 1);
69 setenv ("LC_CTYPE", opt
.lc_ctype
, 1);
70 #if defined(HAVE_SETLOCALE) && defined(LC_CTYPE)
71 else if ( (lc
= setlocale (LC_CTYPE
, "")) )
72 setenv ("LC_CTYPE", lc
, 1);
76 setenv ("LC_MESSAGES", opt
.lc_messages
, 1);
77 #if defined(HAVE_SETLOCALE) && defined(LC_MESSAGES)
78 else if ( (lc
= setlocale (LC_MESSAGES
, "")) )
79 setenv ("LC_MESSAGES", lc
, 1);
81 #endif /*!HAVE_W32_SYSTEM*/