]> granicus.if.org Git - neomutt/commitdiff
Include C version of pgpewrap, by Wessel Dankers <wsl@fruit.eu.org>.
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 11 Oct 2001 08:41:57 +0000 (08:41 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 11 Oct 2001 08:41:57 +0000 (08:41 +0000)
Makefile.am
configure.in
pgpewrap [deleted file]
pgpewrap.c [new file with mode: 0644]

index 42af40ffa086144c2138bc7da4046af1376da6fb..16c6ee345bda7913d12587fb943609c02ea1a69e 100644 (file)
@@ -11,11 +11,7 @@ endif
 
 SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR)
 
-if NEEDS_PGPEWRAP
-bin_SCRIPTS = pgpewrap muttbug flea
-else
 bin_SCRIPTS = muttbug flea
-endif
 
 BUILT_SOURCES = keymap_defs.h
 
@@ -63,7 +59,7 @@ CPPFLAGS=@CPPFLAGS@ -I$(includedir)
 non_us_sources = pgp.c pgpinvoke.c pgpkey.c pgplib.c sha1.c \
        pgpmicalg.c gnupgparse.c sha1.h \
        doc/language.txt doc/language50.txt OPS.PGP doc/PGP-Notes.txt \
-       OPS.MIX remailer.c remailer.h pgpewrap  \
+       OPS.MIX remailer.c remailer.h pgpewrap.c        \
        contrib/pgp2.rc contrib/pgp5.rc contrib/gpg.rc \
        mutt_ssl.c mutt_ssl.h README.SSL mutt_ssl_nss.c \
        pgppacket.c pgppacket.h
@@ -81,7 +77,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP TODO configure acconfig.h account.h \
        mx.h pager.h pgp.h pop.h protos.h reldate.h rfc1524.h rfc2047.h \
        rfc2231.h rfc822.h sha1.h sort.h mime.types VERSION prepare \
        _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \
-       mbyte.h lib.h extlib.c pgpewrap pgplib.h Muttrc.head Muttrc \
+       mbyte.h lib.h extlib.c pgpewrap.c pgplib.h Muttrc.head Muttrc \
        makedoc.c stamp-doc-rc README.SSL \
        muttbug pgppacket.h depcomp ascii.h BEWARE
 
index 8ca897fad61ba8f2759760815261157fab760411..4bd59e5a9c707932904e0b5b19790fbc51c25ccc 100644 (file)
@@ -72,8 +72,7 @@ else
 
         if test x$HAVE_PGP != xno ; then
                 AC_DEFINE(HAVE_PGP)
-                PGPAUX_TARGET=pgpring
-                AM_CONDITIONAL(NEEDS_PGPEWRAP, true)
+                PGPAUX_TARGET="pgpring pgpewrap"
                 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS pgp.o pgpinvoke.o pgpkey.o pgplib.o gnupgparse.o pgpmicalg.o pgppacket.o"
                 OPS="$OPS \$(srcdir)/OPS.PGP"
         fi
diff --git a/pgpewrap b/pgpewrap
deleted file mode 100755 (executable)
index 37f9fac..0000000
--- a/pgpewrap
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh --
-
-cmd=$1
-pfx=""
-
-die() {
-       echo "Command line usage: $0 [flags] -- prefix [recipients]" >& 2
-       exit 1
-}
-
-while test $# -gt 0 && shift && test -n "$1" ; do
-       if test "$1" = "--" ; then
-               shift || die
-               pfx="$1"
-               shift || die
-       fi
-       cmd="$cmd $pfx $1"
-done
-
-exec $cmd
diff --git a/pgpewrap.c b/pgpewrap.c
new file mode 100644 (file)
index 0000000..0d5a1c2
--- /dev/null
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+int main(int argc, char **argv) {
+       char **opts, **opt, *pfx;
+       int i;
+
+       opts = malloc((2 * argc + 1) * sizeof (* opts));
+       if(!opts) {
+               perror(argv[0]);
+               exit(2);
+       }
+
+       opt = opts;
+       *opt++ = argv[1];
+       pfx = NULL;
+
+       for(i = 2; i < argc; ) {
+               if(!strcmp(argv[i], "--")) {
+                       i += 2;
+                       if(i > argc) {
+                               fprintf(stderr, "Command line usage: %s [flags] -- prefix [recipients]\n", argv[0]);
+                               return 1;
+                       }
+                       pfx = argv[i-1];
+               }
+               if(pfx)
+                       *opt++ = pfx;
+               *opt++ = argv[i++];
+       }
+       *opt = NULL;
+
+       execvp(opts[0], opts);
+       perror(argv[0]);
+       return 2;
+}