mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* gpg-agent.c (main): Use default_homedir().
* protect-tool.c (main): Ditto. * signal.c (got_fatal_signal, got_usr_signal) (got_fatal_signal) [DOSISH]: Don't build. * simple-gettext.c: Include sysutils.h * homedir.c: New. * Makefile.am (libcommon_a_SOURCES): Add it. (EXTRA_DIST): Removed mkerror and mkerrtok. * gpgv.c, g10.c (main): Use default_hoemdir (). * scdaemon.c (main): Use default_homedir(). * gpgsm.c (main): Use default_homedir().
This commit is contained in:
parent
581f5ddb17
commit
878cf20766
18 changed files with 102 additions and 66 deletions
|
@ -1,3 +1,13 @@
|
|||
2004-12-21 Werner Koch <wk@g10code.com>
|
||||
|
||||
* signal.c (got_fatal_signal, got_usr_signal)
|
||||
(got_fatal_signal) [DOSISH]: Don't build.
|
||||
* simple-gettext.c: Include sysutils.h
|
||||
|
||||
* homedir.c: New.
|
||||
* Makefile.am (libcommon_a_SOURCES): Add it.
|
||||
(EXTRA_DIST): Removed mkerror and mkerrtok.
|
||||
|
||||
2004-12-20 Werner Koch <wk@g10code.com>
|
||||
|
||||
* sysutils.h [W32]: Define sleep.
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
EXTRA_DIST = mkerrors mkerrtok
|
||||
|
||||
noinst_LIBRARIES = libcommon.a libsimple-pwquery.a
|
||||
|
||||
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(KSBA_CFLAGS)
|
||||
|
@ -31,6 +29,7 @@ libcommon_a_SOURCES = \
|
|||
sexp-parse.h \
|
||||
maperror.c \
|
||||
sysutils.c sysutils.h \
|
||||
homedir.c \
|
||||
gettime.c \
|
||||
yesno.c \
|
||||
b64enc.c \
|
||||
|
|
44
common/homedir.c
Normal file
44
common/homedir.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* homedir.c - Setup the home directory.
|
||||
* Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
* GnuPG is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GnuPG is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "sysutils.h"
|
||||
|
||||
/* Set up the default home directory. The usual --homedir option
|
||||
should be parsed later. */
|
||||
const char *
|
||||
default_homedir (void)
|
||||
{
|
||||
const char *dir;
|
||||
|
||||
dir = getenv("GNUPGHOME");
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
if (!dir || !*dir)
|
||||
dir = read_w32_registry_string (NULL, "Software\\GNU\\GnuPG", "HomeDir");
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
if (!dir || !*dir)
|
||||
dir = GNUPG_DEFAULT_HOMEDIR;
|
||||
|
||||
return dir;
|
||||
}
|
|
@ -30,15 +30,17 @@
|
|||
#include "util.h"
|
||||
|
||||
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
static volatile int caught_fatal_sig;
|
||||
static volatile int caught_sigusr1;
|
||||
#endif
|
||||
static void (*cleanup_fnc)(void);
|
||||
|
||||
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
static void
|
||||
init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
|
||||
{
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
# ifdef HAVE_SIGACTION
|
||||
struct sigaction oact, nact;
|
||||
|
||||
|
@ -64,9 +66,10 @@ init_one_signal (int sig, RETSIGTYPE (*handler)(int), int check_ign )
|
|||
signal (sig, SIG_IGN);
|
||||
}
|
||||
# endif
|
||||
#endif /*!HAVE_DOSISH_SYSTEM*/
|
||||
}
|
||||
#endif /*!HAVE_DOSISH_SYSTEM*/
|
||||
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
static const char *
|
||||
get_signal_name( int signum )
|
||||
{
|
||||
|
@ -76,7 +79,9 @@ get_signal_name( int signum )
|
|||
return "some signal";
|
||||
#endif
|
||||
}
|
||||
#endif /*!HAVE_DOSISH_SYSTEM*/
|
||||
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
static RETSIGTYPE
|
||||
got_fatal_signal (int sig)
|
||||
{
|
||||
|
@ -106,14 +111,15 @@ got_fatal_signal (int sig)
|
|||
#endif /* __riscos__ */
|
||||
raise( sig );
|
||||
}
|
||||
#endif /*!HAVE_DOSISH_SYSTEM*/
|
||||
|
||||
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
static RETSIGTYPE
|
||||
got_usr_signal (int sig)
|
||||
{
|
||||
caught_sigusr1 = 1;
|
||||
}
|
||||
|
||||
#endif /*!HAVE_DOSISH_SYSTEM*/
|
||||
|
||||
void
|
||||
gnupg_init_signals (int mode, void (*fast_cleanup)(void))
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <sys/stat.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include "sysutils.h"
|
||||
|
||||
/* The magic number of the GNU message catalog format. */
|
||||
#define MAGIC 0x950412de
|
||||
|
|
|
@ -121,6 +121,10 @@ gpg_error_t b64enc_write (struct b64state *state,
|
|||
gpg_error_t b64enc_finish (struct b64state *state);
|
||||
|
||||
|
||||
/*-- homedir. c --*/
|
||||
const char *default_homedir (void);
|
||||
|
||||
|
||||
/*-- miscellaneous.c --*/
|
||||
|
||||
/* Same as asprintf but return an allocated buffer suitable to be
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue