Add 2 missing files and other changes

This commit is contained in:
Werner Koch 2000-12-29 10:34:34 +00:00
parent b08b3dd7e6
commit c74adbc096
14 changed files with 325 additions and 6 deletions

View File

@ -1,5 +1,5 @@
EXTRA_DIST = README-alpha build-w32
EXTRA_DIST = README-alpha autogen.sh
if BUILD_BONOBO
bonobo = bonobo

3
README
View File

@ -12,6 +12,9 @@ ftp.gnupg.org/pub/gcrypt/alpha/gnupg/gnupg-1.1.2.tar.gz) and install
the agent from the agent subdirectory or use the new
gpgme_set_passphrase_cb()
To build the W32 version, use
./autogen.sh --build-w32
Please subscribe to the gnupg-devel@gnupg.org mailing list if you want
to do serious work.

132
autogen.sh Executable file
View File

@ -0,0 +1,132 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
# It is only needed for the CVS version.
PGM=GPGME
DIE=no
#
# Use --build-w32 to prepare the cross compiling build for Windoze
#
if test "$1" = "--build-w32"; then
shift
target=i386--mingw32
host=`./config.guess`
CC="${target}-gcc"
CPP="${target}-gcc -E"
RANLIB="${target}-ranlib"
cc_version=`$CC --version`
if ! echo "$cc_version" | egrep '[0-9]+wk[0-9]+' ; then
echo "gcc version $cc_version is not supported" >&2
echo "see doc/README.W32 for instructions" >&2
exit 1
fi
if [ -f config.h ]; then
if grep HAVE_DOSISH_SYSTEM config.h | grep undef >/dev/null; then
echo "Pease run a 'make distclean' first" >&2
exit 1
fi
fi
export CC CPP RANLIB
./configure --host=${host} --target=${target} $*
exit $?
fi
autoconf_vers=2.13
automake_vers=1.4
aclocal_vers=1.4
libtool_vers=1.3
if (autoconf --version) < /dev/null > /dev/null 2>&1 ; then
if (autoconf --version | awk 'NR==1 { if( $3 >= '$autoconf_vers') \
exit 1; exit 0; }');
then
echo "**Error**: "\`autoconf\'" is too old."
echo ' (version ' $autoconf_vers ' or newer is required)'
DIE="yes"
fi
else
echo
echo "**Error**: You must have "\`autoconf\'" installed to compile $PGM."
echo ' (version ' $autoconf_vers ' or newer is required)'
DIE="yes"
fi
if (automake --version) < /dev/null > /dev/null 2>&1 ; then
if (automake --version | awk 'NR==1 { if( $4 >= '$automake_vers') \
exit 1; exit 0; }');
then
echo "**Error**: "\`automake\'" is too old."
echo ' (version ' $automake_vers ' or newer is required)'
DIE="yes"
fi
if (aclocal --version) < /dev/null > /dev/null 2>&1; then
if (aclocal --version | awk 'NR==1 { if( $4 >= '$aclocal_vers' ) \
exit 1; exit 0; }' );
then
echo "**Error**: "\`aclocal\'" is too old."
echo ' (version ' $aclocal_vers ' or newer is required)'
DIE="yes"
fi
else
echo
echo "**Error**: Missing "\`aclocal\'". The version of "\`automake\'
echo " installed doesn't appear recent enough."
DIE="yes"
fi
else
echo
echo "**Error**: You must have "\`automake\'" installed to compile $PGM."
echo ' (version ' $automake_vers ' or newer is required)'
DIE="yes"
fi
if (libtool --version) < /dev/null > /dev/null 2>&1 ; then
if (libtool --version | awk 'NR==1 { if( $4 >= '$libtool_vers') \
exit 1; exit 0; }');
then
echo "**Error**: "\`libtool\'" is too old."
echo ' (version ' $libtool_vers ' or newer is required)'
DIE="yes"
fi
else
echo
echo "**Error**: You must have "\`libtool\'" installed to compile $PGM."
echo ' (version ' $libtool_vers ' or newer is required)'
DIE="yes"
fi
if test "$DIE" = "yes"; then
exit 1
fi
echo "Running libtoolize... Ignore non-fatal messages."
echo "no" | libtoolize
echo "Running aclocal..."
aclocal
echo "Running autoheader..."
autoheader
echo "Running automake --gnu ..."
automake --gnu;
echo "Running autoconf..."
autoconf
if test "$*" = ""; then
conf_options="--enable-maintainer-mode"
else
conf_options=$*
fi
echo "Running ./configure $conf_options"
./configure $conf_options

View File

@ -13,7 +13,7 @@ AM_MAINTAINER_MODE
# AGE, set REVISION to 0.
# 3. Interfaces removed (BAD, breaks upward compatibility): Increment
# CURRENT, set AGE and REVISION to 0.
AM_INIT_AUTOMAKE(gpgme,0.1.3)
AM_INIT_AUTOMAKE(gpgme,0.1.3a)
LIBGPGME_LT_CURRENT=1
LIBGPGME_LT_AGE=1
LIBGPGME_LT_REVISION=0

View File

@ -49,6 +49,8 @@ struct gpgme_context_s {
* able to handle a malloc problem at that point, so we set this
* flag to indicate this condition */
int out_of_core;
int cancel; /* cancel operation request */
GpgObject gpg; /* the running gpg process */

View File

@ -217,6 +217,77 @@ gpgme_data_new_from_file ( GpgmeData *r_dh, const char *fname, int copy )
}
GpgmeError
gpgme_data_new_from_filepart ( GpgmeData *r_dh, const char *fname, FILE *fp,
off_t offset, off_t length )
{
GpgmeData dh;
GpgmeError err;
if (!r_dh)
return mk_error (Invalid_Value);
*r_dh = NULL;
if ( fname && fp ) /* these are mutual exclusive */
return mk_error (Invalid_Value);
if (!fname && !fp)
return mk_error (Invalid_Value);
if (!length)
return mk_error (Invalid_Value);
err = gpgme_data_new ( &dh );
if (err)
return err;
if (!fp) {
fp = fopen (fname, "rb");
if (!fp) {
int save_errno = errno;
gpgme_data_release (dh);
errno = save_errno;
return mk_error (File_Error);
}
}
if ( fseek ( fp, (long)offset, SEEK_SET) ) {
int save_errno = errno;
if (fname)
fclose (fp);
gpgme_data_release (dh);
errno = save_errno;
return mk_error (File_Error);
}
dh->private_buffer = xtrymalloc ( length );
if ( !dh->private_buffer ) {
if (fname)
fclose (fp);
gpgme_data_release (dh);
return mk_error (Out_Of_Core);
}
dh->private_len = length;
if ( fread ( dh->private_buffer, dh->private_len, 1, fp ) != 1 ) {
int save_errno = errno;
if (fname)
fclose (fp);
gpgme_data_release (dh);
errno = save_errno;
return mk_error (File_Error);
}
if (fname)
fclose (fp);
dh->len = dh->private_len;
dh->data = dh->private_buffer;
dh->writepos = dh->len;
dh->type = GPGME_DATA_TYPE_MEM;
*r_dh = dh;
return 0;
}
/**
* gpgme_data_release:
@ -455,6 +526,26 @@ _gpgme_data_get_as_string ( GpgmeData dh )
}
/**
* gpgme_data_write:
* @dh: the context
* @buffer: data to be written to the data object
* @length: length o this data
*
* Write the content of @buffer to the data object @dh at the current write
* position.
*
* Return value: 0 on succress or an errorcode
**/
GpgmeError
gpgme_data_write ( GpgmeData dh, const char *buffer, size_t length )
{
if (!dh || !buffer)
return mk_error (Invalid_Value);
return _gpgme_data_append (dh, buffer, length );
}
GpgmeError
_gpgme_data_append ( GpgmeData dh, const char *buffer, size_t length )

View File

@ -41,6 +41,7 @@ gpgme_strerror (GpgmeError err)
case GPGME_File_Error: s="File Error"; break;
case GPGME_Decryption_Failed: s="Decryption Failed"; break;
case GPGME_No_Passphrase: s="No Passphrase"; break;
case GPGME_Canceled: s="Canceled"; break;
default: sprintf (buf, "ec=%d", err ); s=buf; break;
}

View File

@ -99,6 +99,21 @@ _gpgme_release_result ( GpgmeCtx c )
}
/**
* gpgme_cancel:
* @c: the context
*
* Cancel the current operation. It is not guaranteed that it will work for
* all kinds of operations. It is especially useful in a passphrase callback
* to stop the system from asking another time for the passphrase.
**/
void
gpgme_cancel (GpgmeCtx c)
{
c->cancel = 1;
}
/**
* gpgme_get_notation:
* @c: the context

View File

@ -20,6 +20,13 @@
#ifndef GPGME_H
#define GPGME_H
#ifdef _MSC_VER
typedef long off_t
#else
# include <sys/types.h>
#endif
#ifdef __cplusplus
extern "C" {
#if 0 /* just to make Emacs auto-indent happy */
@ -27,6 +34,7 @@ extern "C" {
#endif
#endif
/*
* The version of this header should match the one of the library
* It should not be used by a program because gpgme_check_version(NULL)
@ -34,7 +42,7 @@ extern "C" {
* let autoconf (using the AM_PATH_GPGME macro) check that this
* header matches the installed library.
* Warning: Do not edit the next line. configure will do that for you! */
#define GPGME_VERSION "0.1.3"
#define GPGME_VERSION "0.1.3a"
@ -73,6 +81,7 @@ typedef enum {
GPGME_File_Error = 17, /* errno is set in this case */
GPGME_Decryption_Failed = 18,
GPGME_No_Passphrase = 19,
GPGME_Canceled = 20,
} GpgmeError;
typedef enum {
@ -109,6 +118,7 @@ typedef void (*GpgmeProgressCb)(void *opaque,
/* Context management */
GpgmeError gpgme_new (GpgmeCtx *r_ctx);
void gpgme_release (GpgmeCtx c);
void gpgme_cancel (GpgmeCtx c);
GpgmeCtx gpgme_wait (GpgmeCtx c, int hang);
char *gpgme_get_notation (GpgmeCtx c);
@ -143,12 +153,18 @@ GpgmeError gpgme_data_new_with_read_cb ( GpgmeData *r_dh,
GpgmeError gpgme_data_new_from_file ( GpgmeData *r_dh,
const char *fname,
int copy );
GpgmeError gpgme_data_new_from_filepart ( GpgmeData *r_dh,
const char *fname, FILE *fp,
off_t offset, off_t length );
void gpgme_data_release ( GpgmeData dh );
char * gpgme_data_release_and_get_mem ( GpgmeData dh, size_t *r_len );
GpgmeDataType gpgme_data_get_type ( GpgmeData dh );
GpgmeError gpgme_data_rewind ( GpgmeData dh );
GpgmeError gpgme_data_read ( GpgmeData dh,
char *buffer, size_t length, size_t *nread );
GpgmeError gpgme_data_write ( GpgmeData dh,
const char *buffer, size_t length );
/* Key functions */
char *gpgme_key_get_as_xml ( GpgmeKey key );

View File

@ -29,7 +29,7 @@ dnl
AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
min_gpgme_version=ifelse([$1], ,1.0.0,$1)
AC_MSG_CHECKING(for gpgme - version >= $min_gpgme_version)
AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
no_gpgme=""
if test "$GPGME_CONFIG" = "no" ; then
no_gpgme=yes

39
gpgme/syshdr.h Normal file
View File

@ -0,0 +1,39 @@
/* syshdr.h - System specfic header files
* Copyright (C) 2000 Werner Koch (dd9jn)
*
* This file is part of GPGME.
*
* GPGME 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.
*
* GPGME 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
*/
#ifndef SYSHDR_H
#define SYSHDR_H
#include <config.h>
#ifdef HAVE_DOSISH_SYSTEM
#include <io.h>
#else
#include <sys/time.h>
#include <unistd.h>
#endif
#endif /* SYSHDR_H */

View File

@ -36,7 +36,7 @@
#include "util.h"
#include "io.h"
#define DEBUG_SELECT_ENABLED 0
#define DEBUG_SELECT_ENABLED 1
#if DEBUG_SELECT_ENABLED
# define DEBUG_SELECT(a) fprintf a

19
jnlib/Makefile.am Normal file
View File

@ -0,0 +1,19 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = README
INCLUDES = -I$(top_srcdir)/intl
noinst_LIBRARIES = libjnlib.a
#libjnlib_a_LDFLAGS =
libjnlib_a_SOURCES = libjnlib-config.h \
xmalloc.c xmalloc.h \
stringhelp.c stringhelp.h \
argparse.c argparse.h \
logging.c logging.h \
types.h mischelp.h

View File

@ -76,10 +76,11 @@ main (int argc, char **argv )
err = gpgme_new (&ctx);
fail_if_err (err);
do {
fprintf (stderr, "** pattern=`%s'\n", pattern );
doit ( ctx, pattern );
} while ( loop );
gpgme_release (ctx);
return 0;
}