aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2000-12-29 10:34:34 +0000
committerWerner Koch <[email protected]>2000-12-29 10:34:34 +0000
commitc74adbc096171ceac522a6f8383194d70cc76865 (patch)
treeb5067eab2ddedadf0e60f9ff7ec3de1b6a1accc0
parentAdd missing jnlib directory (diff)
downloadgpgme-c74adbc096171ceac522a6f8383194d70cc76865.tar.gz
gpgme-c74adbc096171ceac522a6f8383194d70cc76865.zip
Add 2 missing files and other changes
-rw-r--r--Makefile.am2
-rw-r--r--README3
-rwxr-xr-xautogen.sh132
-rw-r--r--configure.in2
-rw-r--r--gpgme/context.h2
-rw-r--r--gpgme/data.c91
-rw-r--r--gpgme/errors.c1
-rw-r--r--gpgme/gpgme.c15
-rw-r--r--gpgme/gpgme.h18
-rw-r--r--gpgme/gpgme.m42
-rw-r--r--gpgme/syshdr.h39
-rw-r--r--gpgme/w32-io.c2
-rw-r--r--jnlib/Makefile.am19
-rw-r--r--tests/t-keylist.c3
14 files changed, 325 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index 13cb7973..e733d27d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
-EXTRA_DIST = README-alpha build-w32
+EXTRA_DIST = README-alpha autogen.sh
if BUILD_BONOBO
bonobo = bonobo
diff --git a/README b/README
index b244fc55..75b10f28 100644
--- a/README
+++ b/README
@@ -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 [email protected] mailing list if you want
to do serious work.
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 00000000..11b27612
--- /dev/null
+++ b/autogen.sh
@@ -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
+
+
+
+
diff --git a/configure.in b/configure.in
index 710b0434..369d0f19 100644
--- a/configure.in
+++ b/configure.in
@@ -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
diff --git a/gpgme/context.h b/gpgme/context.h
index 86554e04..e1ff31f0 100644
--- a/gpgme/context.h
+++ b/gpgme/context.h
@@ -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 */
diff --git a/gpgme/data.c b/gpgme/data.c
index e63fd520..73408f9f 100644
--- a/gpgme/data.c
+++ b/gpgme/data.c
@@ -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 )
diff --git a/gpgme/errors.c b/gpgme/errors.c
index 4445d179..e25db3ec 100644
--- a/gpgme/errors.c
+++ b/gpgme/errors.c
@@ -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;
}
diff --git a/gpgme/gpgme.c b/gpgme/gpgme.c
index 97c82504..0c814bd2 100644
--- a/gpgme/gpgme.c
+++ b/gpgme/gpgme.c
@@ -100,6 +100,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
*
diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h
index 7c0e4c47..7190af09 100644
--- a/gpgme/gpgme.h
+++ b/gpgme/gpgme.h
@@ -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 );
diff --git a/gpgme/gpgme.m4 b/gpgme/gpgme.m4
index c00071a2..1fb02605 100644
--- a/gpgme/gpgme.m4
+++ b/gpgme/gpgme.m4
@@ -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
diff --git a/gpgme/syshdr.h b/gpgme/syshdr.h
new file mode 100644
index 00000000..166e874f
--- /dev/null
+++ b/gpgme/syshdr.h
@@ -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 */
+
+
+
+
+
diff --git a/gpgme/w32-io.c b/gpgme/w32-io.c
index 237c0386..9df6c981 100644
--- a/gpgme/w32-io.c
+++ b/gpgme/w32-io.c
@@ -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
diff --git a/jnlib/Makefile.am b/jnlib/Makefile.am
new file mode 100644
index 00000000..5d609691
--- /dev/null
+++ b/jnlib/Makefile.am
@@ -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
+
+
+
diff --git a/tests/t-keylist.c b/tests/t-keylist.c
index a67d1ee2..e07da463 100644
--- a/tests/t-keylist.c
+++ b/tests/t-keylist.c
@@ -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;
}