2009-11-10 Marcus Brinkmann <marcus@g10code.de>
[gpgme.git] / src / posix-util.c
1 /* posix-util.c - Utility functions for Posix
2    Copyright (C) 2001 Werner Koch (dd9jn)
3    Copyright (C) 2001, 2002, 2004 g10 Code GmbH
4
5    This file is part of GPGME.
6  
7    GPGME is free software; you can redistribute it and/or modify it
8    under the terms of the GNU Lesser General Public License as
9    published by the Free Software Foundation; either version 2.1 of
10    the License, or (at your option) any later version.
11    
12    GPGME is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Lesser General Public License for more details.
16    
17    You should have received a copy of the GNU Lesser General Public
18    License along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20    02111-1307, USA.  */
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <assert.h>
29
30 #include "util.h"
31
32 const char *
33 _gpgme_get_gpg_path (void)
34 {
35 #ifdef GPG_PATH
36   return GPG_PATH;
37 #else
38   return NULL;
39 #endif
40 }
41
42 const char *
43 _gpgme_get_gpgsm_path (void)
44 {
45 #ifdef GPGSM_PATH
46   return GPGSM_PATH;
47 #else
48   return NULL;
49 #endif
50 }
51
52 const char *
53 _gpgme_get_gpgconf_path (void)
54 {
55 #ifdef GPGCONF_PATH
56   return GPGCONF_PATH;
57 #else
58   return NULL;
59 #endif
60 }
61
62 const char *
63 _gpgme_get_g13_path (void)
64 {
65 #ifdef G13_PATH
66   return G13_PATH;
67 #else
68   return NULL;
69 #endif
70 }
71
72
73 const char *
74 _gpgme_get_uiserver_socket_path (void)
75 {
76   static char *socket_path;
77   char *homedir;
78   const char name[] = "S.uiserver";
79
80   if (socket_path)
81     return socket_path;
82
83   homedir = _gpgme_get_default_homedir ();
84   if (! homedir)
85     return NULL;
86
87   socket_path = malloc (strlen (homedir) + 1 + strlen (name) + 1);
88   if (! socket_path)
89     return NULL;
90
91   strcpy (stpcpy (stpcpy (socket_path, homedir), "/"), name);
92   return socket_path;
93 }
94
95
96 /* See w32-util.c */
97 int
98 _gpgme_get_conf_int (const char *key, int *value)
99 {
100   return 0;
101 }
102
103 void 
104 _gpgme_allow_set_foreground_window (pid_t pid)
105 {
106   (void)pid;
107   /* Not needed.  */
108 }