diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /net-mail/ezmlm-idx | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'net-mail/ezmlm-idx')
-rw-r--r-- | net-mail/ezmlm-idx/Manifest | 3 | ||||
-rw-r--r-- | net-mail/ezmlm-idx/ezmlm-idx-6.0.0.ebuild | 77 | ||||
-rw-r--r-- | net-mail/ezmlm-idx/ezmlm-idx-7.0.0-r1.ebuild | 62 | ||||
-rw-r--r-- | net-mail/ezmlm-idx/ezmlm-idx-7.0.0-r2.ebuild | 62 | ||||
-rw-r--r-- | net-mail/ezmlm-idx/ezmlm-idx-7.0.0.ebuild | 62 | ||||
-rw-r--r-- | net-mail/ezmlm-idx/files/ezmlm-0.53-errno.patch | 9 | ||||
-rw-r--r-- | net-mail/ezmlm-idx/files/from-header.patch | 209 | ||||
-rw-r--r-- | net-mail/ezmlm-idx/files/get_header.c | 113 | ||||
-rw-r--r-- | net-mail/ezmlm-idx/files/get_header.h | 7 | ||||
-rw-r--r-- | net-mail/ezmlm-idx/metadata.xml | 5 |
10 files changed, 609 insertions, 0 deletions
diff --git a/net-mail/ezmlm-idx/Manifest b/net-mail/ezmlm-idx/Manifest new file mode 100644 index 000000000000..da0a50ca84e7 --- /dev/null +++ b/net-mail/ezmlm-idx/Manifest @@ -0,0 +1,3 @@ +DIST ezmlm-0.53.tar.gz 62693 SHA256 9639c3a5cc49d417f30e6cd7d8c5e2c6945262953c143134035889d8aa1004b9 SHA512 0dc1c64168428c531dbf78ca99582de4d4193d10bb38e87d3ee8f33f78083dc696bfd0681e3f2f690d7aa78b55b1b91c4ea6900c109406063445104826ff6d94 WHIRLPOOL ae48ec86a66c99debebd0a7b1beafe2deeeb48061ae729ecc315f8e4f7d226be4d34cce93db122bb0210a35335fe5d89aa28f02df866d75580ad02a5619492ef +DIST ezmlm-idx-6.0.0.tar.gz 659996 SHA256 625b2e54818e694c04a4c8d32bd0e382867df29a147067073a8cdb9b252aa54e +DIST ezmlm-idx-7.0.0.tar.gz 689019 SHA256 4d2c93e6102c72be39912e4e5a783931e1593a8793af72f2cc884702e1edbc6c diff --git a/net-mail/ezmlm-idx/ezmlm-idx-6.0.0.ebuild b/net-mail/ezmlm-idx/ezmlm-idx-6.0.0.ebuild new file mode 100644 index 000000000000..e888d55e64ea --- /dev/null +++ b/net-mail/ezmlm-idx/ezmlm-idx-6.0.0.ebuild @@ -0,0 +1,77 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EZMLM_P=ezmlm-0.53 + +inherit eutils fixheadtails + +DESCRIPTION="Simple yet powerful mailing list manager for qmail" +HOMEPAGE="http://www.ezmlm.org" +SRC_URI="http://cr.yp.to/software/${EZMLM_P}.tar.gz + http://www.ezmlm.org/archive/${PV}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="alpha amd64 hppa ~mips ppc sparc x86" +IUSE="mysql postgres" + +DEPEND=" + mysql? ( virtual/mysql ) + postgres? ( dev-db/postgresql ) +" +RDEPEND="${DEPEND} + virtual/qmail" + +S="${WORKDIR}"/${EZMLM_P} + +pkg_setup() { + if use mysql && use postgres; then + die "cannot build mysql and pgsql support at the same time" + fi +} + +src_unpack() { + unpack ${A} + mv "${WORKDIR}"/${P}/* "${S}" || die + cd "${S}" + + epatch "${S}"/idx.patch + + ht_fix_file Makefile + + echo /usr/bin > conf-bin + echo /usr/lib/ezmlm > conf-lib + echo /etc/ezmlm > conf-etc + echo /usr/share/man > conf-man + echo /var/qmail > conf-qmail + + echo $(tc-getCC) ${CFLAGS} -I/usr/include/{my,postgre}sql > conf-cc + echo $(tc-getCC) ${CFLAGS} > conf-ld + + # fix DESTDIR and skip cat man-pages + sed -e "s:\(/install\) \(\"\`head\):\1 ${D}\2:" \ + -e "s:\(./install.*\) < MAN$:grep -v \:/cat MAN | \1:" \ + -e "s:\(\"\`head -n 1 conf-etc\`\"/default\):${D}\1:" \ + -i Makefile + + # ezmlm-mktab-{my|pg}sql may or may not be made + sed -i -e "s/\(^.*mktab\)/?\1/" BIN +} + +src_compile() { + emake it man || die "make failed" + + if use mysql; then + emake mysql || die "make mysql failed" + elif use postgres; then + emake pgsql || die "make pgsql failed" + fi +} + +src_install () { + dodir /usr/bin /usr/lib/ezmlm /etc/ezmlm /usr/share/man + dobin ezmlm-cgi + + make DESTDIR="${D}" setup || die "make setup failed" +} diff --git a/net-mail/ezmlm-idx/ezmlm-idx-7.0.0-r1.ebuild b/net-mail/ezmlm-idx/ezmlm-idx-7.0.0-r1.ebuild new file mode 100644 index 000000000000..8302bb95acda --- /dev/null +++ b/net-mail/ezmlm-idx/ezmlm-idx-7.0.0-r1.ebuild @@ -0,0 +1,62 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +inherit qmail multilib + +DESCRIPTION="Simple yet powerful mailing list manager for qmail" +HOMEPAGE="http://www.ezmlm.org" +SRC_URI="http://www.ezmlm.org/archive/${PV}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~sparc ~x86" +IUSE="mysql postgres" + +DEPEND="mysql? ( virtual/mysql ) + postgres? ( dev-db/postgresql )" +RDEPEND="${DEPEND} + virtual/qmail" + +pkg_setup() { + if use mysql && use postgres; then + die "cannot build mysql and pgsql support at the same time" + fi +} + +src_unpack() { + unpack ${A} + cd "${S}" || die + + echo /usr/bin > conf-bin + echo /usr/$(get_libdir)/ezmlm > conf-lib + echo /etc/ezmlm > conf-etc + echo /usr/share/man > conf-man + echo ${QMAIL_HOME} > conf-qmail + + echo $(tc-getCC) ${CFLAGS} -I/usr/include/{my,postgre}sql > conf-cc + echo $(tc-getCC) ${CFLAGS} -Wl,-E > conf-ld + + # fix DESTDIR and skip cat man-pages + sed -e "s:\(/install\) \(\"\`head\):\1 ${D}\2:" \ + -e "s:\(./install.*\) < MAN$:grep -v \:/cat MAN | \1:" \ + -e "s:\(\"\`head -n 1 conf-etc\`\"/default\):${D}\1:" \ + -i Makefile +} + +src_compile() { + emake it man || die "make failed" + + if use mysql; then + emake mysql || die "make mysql failed" + elif use postgres; then + emake pgsql || die "make pgsql failed" + fi +} + +src_install () { + dodir /usr/bin /usr/$(get_libdir)/ezmlm /etc/ezmlm /usr/share/man + dobin ezmlm-{cgi,checksub} + + make DESTDIR="${D}" setup || die "make setup failed" +} diff --git a/net-mail/ezmlm-idx/ezmlm-idx-7.0.0-r2.ebuild b/net-mail/ezmlm-idx/ezmlm-idx-7.0.0-r2.ebuild new file mode 100644 index 000000000000..c19c5d28d9ae --- /dev/null +++ b/net-mail/ezmlm-idx/ezmlm-idx-7.0.0-r2.ebuild @@ -0,0 +1,62 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +inherit qmail multilib + +DESCRIPTION="Simple yet powerful mailing list manager for qmail" +HOMEPAGE="http://www.ezmlm.org" +SRC_URI="http://www.ezmlm.org/archive/${PV}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~sparc ~x86" +IUSE="mysql postgres" + +DEPEND="mysql? ( virtual/mysql ) + postgres? ( dev-db/postgresql )" +RDEPEND="${DEPEND} + virtual/qmail" + +pkg_setup() { + if use mysql && use postgres; then + die "cannot build mysql and pgsql support at the same time" + fi +} + +src_unpack() { + unpack ${A} + cd "${S}" || die + + echo /usr/bin > conf-bin + echo /usr/$(get_libdir)/ezmlm > conf-lib + echo /etc/ezmlm > conf-etc + echo /usr/share/man > conf-man + echo ${QMAIL_HOME} > conf-qmail + + echo $(tc-getCC) ${CFLAGS} -I/usr/include/{my,postgre}sql > conf-cc + echo $(tc-getCC) ${CFLAGS} -Wl,-E > conf-ld + + # fix DESTDIR and skip cat man-pages + sed -e "s:\(/install\) \(\"\`head\):\1 ${D}\2:" \ + -e "s:\(./install.*\) < MAN$:grep -v \:/cat MAN | \1:" \ + -e "s:\(\"\`head -n 1 conf-etc\`\"/default\):${D}\1:" \ + -i Makefile +} + +src_compile() { + emake it man || die "make failed" + + if use mysql; then + emake mysql || die "make mysql failed" + elif use postgres; then + emake pgsql || die "make pgsql failed" + fi +} + +src_install () { + dodir /usr/bin /usr/$(get_libdir)/ezmlm /etc/ezmlm /usr/share/man + dobin ezmlm-{cgi,checksub,import,rmtab} + + make DESTDIR="${D}" setup || die "make setup failed" +} diff --git a/net-mail/ezmlm-idx/ezmlm-idx-7.0.0.ebuild b/net-mail/ezmlm-idx/ezmlm-idx-7.0.0.ebuild new file mode 100644 index 000000000000..1e27cbf5f78d --- /dev/null +++ b/net-mail/ezmlm-idx/ezmlm-idx-7.0.0.ebuild @@ -0,0 +1,62 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +inherit qmail + +DESCRIPTION="Simple yet powerful mailing list manager for qmail" +HOMEPAGE="http://www.ezmlm.org" +SRC_URI="http://www.ezmlm.org/archive/${PV}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~sparc ~x86" +IUSE="mysql postgres" + +DEPEND="mysql? ( virtual/mysql ) + postgres? ( dev-db/postgresql )" +RDEPEND="${DEPEND} + virtual/qmail" + +pkg_setup() { + if use mysql && use postgres; then + die "cannot build mysql and pgsql support at the same time" + fi +} + +src_unpack() { + unpack ${A} + cd "${S}" || die + + echo /usr/bin > conf-bin + echo /usr/lib/ezmlm > conf-lib + echo /etc/ezmlm > conf-etc + echo /usr/share/man > conf-man + echo ${QMAIL_HOME} > conf-qmail + + echo $(tc-getCC) ${CFLAGS} -I/usr/include/{my,postgre}sql > conf-cc + echo $(tc-getCC) ${CFLAGS} -Wl,-E > conf-ld + + # fix DESTDIR and skip cat man-pages + sed -e "s:\(/install\) \(\"\`head\):\1 ${D}\2:" \ + -e "s:\(./install.*\) < MAN$:grep -v \:/cat MAN | \1:" \ + -e "s:\(\"\`head -n 1 conf-etc\`\"/default\):${D}\1:" \ + -i Makefile +} + +src_compile() { + emake it man || die "make failed" + + if use mysql; then + emake mysql || die "make mysql failed" + elif use postgres; then + emake pgsql || die "make pgsql failed" + fi +} + +src_install () { + dodir /usr/bin /usr/lib/ezmlm /etc/ezmlm /usr/share/man + dobin ezmlm-{cgi,checksub} + + make DESTDIR="${D}" setup || die "make setup failed" +} diff --git a/net-mail/ezmlm-idx/files/ezmlm-0.53-errno.patch b/net-mail/ezmlm-idx/files/ezmlm-0.53-errno.patch new file mode 100644 index 000000000000..3028e5630f60 --- /dev/null +++ b/net-mail/ezmlm-idx/files/ezmlm-0.53-errno.patch @@ -0,0 +1,9 @@ +diff -urN ezmlm-0.53/error.h ezmlm-0.53-new/error.h +--- ezmlm-0.53/error.h 2003-04-06 07:59:49.000000000 +0200 ++++ ezmlm-0.53-new/error.h 2003-04-06 08:09:25.000000000 +0200 +@@ -1,5 +1,6 @@ + #ifndef ERROR_H + #define ERROR_H ++#include <errno.h> + + extern int errno; diff --git a/net-mail/ezmlm-idx/files/from-header.patch b/net-mail/ezmlm-idx/files/from-header.patch new file mode 100644 index 000000000000..c5a306a5ab28 --- /dev/null +++ b/net-mail/ezmlm-idx/files/from-header.patch @@ -0,0 +1,209 @@ +--- Makefile.orig Mon Nov 27 19:20:43 2000 ++++ Makefile Mon Nov 27 18:41:29 2000 +@@ -350,9 +350,9 @@ + ezmlm-gate: \ + load ezmlm-gate.o subdb.a auto_bin.o getopt.a getln.a env.a sig.a strerr.a \ + stralloc.a alloc.a error.a str.a case.a wait.a substdio.a open.a lock.a \ +-fs.a getconf.o slurpclose.o slurp.o seek.a conf-sqlld ++fs.a getconf.o slurpclose.o slurp.o seek.a conf-sqlld get_header.a + ./load ezmlm-gate subdb.a getconf.o slurpclose.o slurp.o \ +- getopt.a getln.a auto_bin.o env.a sig.a fs.a \ ++ getopt.a getln.a auto_bin.o env.a sig.a fs.a get_header.a \ + strerr.a substdio.a stralloc.a alloc.a error.a str.a case.a wait.a \ + open.a lock.a seek.a ${SQLLD} + +@@ -362,7 +362,7 @@ + + ezmlm-gate.o: \ + compile ezmlm-gate.c idx.h errtxt.h subscribe.h auto_bin.h \ +-sgetopt.h subgetopt.h substdio.h getconf.h \ ++sgetopt.h subgetopt.h substdio.h getconf.h get_header.h substdio.h \ + env.h sig.h strerr.h stralloc.h alloc.h error.h str.h case.h \ + fork.h wait.h exit.h getln.h open.h + ./compile ezmlm-gate.c +@@ -469,19 +469,20 @@ + + ezmlm-issubn: \ + load ezmlm-issubn.o subdb.a getconf.o slurpclose.o slurp.o \ +-env.a fs.a strerr.a getln.a getopt.a conf-sqlld \ +-substdio.a stralloc.a alloc.a error.a str.a case.a open.a lock.a ++env.a fs.a strerr.a getln.a getopt.a conf-sqlld get_header.a \ ++substdio.a stralloc.a alloc.a error.a str.a case.a open.a lock.a get_header.a + ./load ezmlm-issubn subdb.a getconf.o slurpclose.o slurp.o \ +- getopt.a env.a fs.a strerr.a \ ++ getopt.a env.a fs.a strerr.a get_header.a substdio.a \ + getln.a substdio.a stralloc.a alloc.a error.a str.a case.a \ +- open.a lock.a ${SQLLD} ++ open.a lock.a get_header.a ${SQLLD} + + ezmlm-issubn.0: \ + ezmlm-issubn.1 + nroff -man ezmlm-issubn.1 > ezmlm-issubn.0 + + ezmlm-issubn.o: \ +-compile ezmlm-issubn.c strerr.h subscribe.h env.h errtxt.h sgetopt.h idx.h ++compile ezmlm-issubn.c strerr.h subscribe.h env.h errtxt.h sgetopt.h idx.h \ ++substdio.h readwrite.h + ./compile ezmlm-issubn.c + + ezmlm-limit: \ +@@ -1280,6 +1281,14 @@ + stralloc.0: \ + stralloc.3 + nroff -man stralloc.3 > stralloc.0 ++ ++get_header.o: \ ++compile get_header.c get_header.h substdio.h seek.h stralloc.h strerr.h \ ++ ./compile get_header.c ++ ++get_header.a: \ ++makelib get_header.o ++ ./makelib get_header.a get_header.o stralloc.a seek_set.o strerr.a + + stralloc.a: \ + makelib stralloc_eady.o stralloc_pend.o stralloc_copy.o \ +--- ezmlm-gate.c.orig Mon Nov 27 19:20:49 2000 ++++ ezmlm-gate.c Mon Nov 27 19:04:57 2000 +@@ -17,12 +17,18 @@ + #include "errtxt.h" + #include "idx.h" + #include "subscribe.h" ++#include "get_header.h" ++#include "substdio.h" ++#include "readwrite.h" + + #define FATAL "ezmlm-gate: fatal: " + ++char buf0[256]; ++substdio ssin = SUBSTDIO_FDBUF(read,0,buf0,(int) sizeof(buf0)); ++ + void die_usage() + { +- strerr_die1x(100,"ezmlm-gate: usage: ezmlm-gate [-cCmMpPqrRsSvV] " ++ strerr_die1x(100,"ezmlm-gate: usage: ezmlm-gate [-fFcCmMpPqrRsSvV] " + "dir [moddir [...]]"); + } + void die_nomem() { strerr_die2x(111,FATAL,ERR_NOMEM); } +@@ -89,6 +95,9 @@ + int opt; + int ret = 0; + unsigned int i,j,k; ++ int usefrom = 0; ++ ++ char *from_addr = (char *)0; + + umask(022); + sig_pipeignore(); +@@ -98,7 +107,7 @@ + if (!stralloc_copys(&storeopt," -")) die_nomem(); + + while ((opt = getopt(argc,argv, +- "cCmMpPq:Q:sSrRt:T:vV")) != opteof) ++ "fFcCmMpPq:Q:sSrRt:T:vV")) != opteof) + switch(opt) { /* pass on unrecognized options */ + case 'c': /* ezmlm-send flags */ + case 'C': +@@ -116,6 +125,8 @@ + szchar[0] = opt; + if (!stralloc_append(&storeopt,szchar)) die_nomem(); + break; ++ case 'f': usefrom = 1; break; ++ case 'F': usefrom = 0; break; + case 'q': /* allow both qQ to be nice */ + case 'Q': if (optarg) queryext = optarg; break; + case 'v': +@@ -124,6 +135,10 @@ + die_usage(); + } + ++ if (usefrom) { ++ from_addr = get_from(&ssin); ++ } ++ + dir = argv[optind++]; + if (!dir) die_usage(); + if (chdir(dir) == -1) +@@ -155,8 +170,12 @@ + moddir = argv[optind++]; + if (moddir && !ret) { /* if exit 0 and moddir, add issub */ + pmod = (char *) 0; +- while (moddir && !pmod && sender) { +- pmod = issub(moddir,sender,(char *) 0,FATAL); ++ while (moddir && !pmod && (sender || from_addr)) { ++ if (sender) ++ pmod = issub(moddir,sender,(char *) 0,FATAL); ++ if (!pmod && from_addr) ++ pmod = issub(moddir,from_addr,(char *) 0,FATAL); ++ + closesql(); + moddir = argv[optind++]; + } +--- ezmlm-issubn.c.orig Mon Nov 27 19:20:54 2000 ++++ ezmlm-issubn.c Mon Nov 27 19:05:59 2000 +@@ -6,14 +6,21 @@ + #include "sgetopt.h" + #include "errtxt.h" + #include "idx.h" ++#include "get_header.h" ++#include "substdio.h" ++#include "readwrite.h" + + #define FATAL "ezmlm-issubn: fatal: " + ++char buf0[256]; ++substdio ssin = SUBSTDIO_FDBUF(read,0,buf0,(int) sizeof(buf0)); ++ + void *psql = (void *) 0; + + void die_usage() + { +- strerr_die1x(100,"ezmlm-issubn: usage: ezmlm-issubn [-nN] dir [dir1 ...]"); ++ strerr_die1x(100, ++ "ezmlm-issubn: usage: ezmlm-issubn [-fF] [-nN] dir [dir1 ...]"); + } + + void die_sender() +@@ -28,15 +35,19 @@ + char *dir; + char *addr; + int flagsub = 0; ++ int usefrom = 0; + int opt; ++ char *from_addr = (char *)0; + + addr = env_get("SENDER"); + if (!addr) die_sender(); /* REQUIRE sender */ + +- while ((opt = getopt(argc,argv,"nNvV")) != opteof) ++ while ((opt = getopt(argc,argv,"fFnNvV")) != opteof) + switch(opt) { + case 'n': flagsub = 99; break; + case 'N': flagsub = 0; break; ++ case 'f': usefrom = 1; break; ++ case 'F': usefrom = 0; break; + case 'v': + case 'V': strerr_die2x(0, + "ezmlm-issubn version: ezmlm-0.53+",EZIDX_VERSION); +@@ -44,6 +55,11 @@ + die_usage(); + } + ++ ++ if (usefrom) { ++ from_addr = get_from(&ssin); ++ } ++ + dir = argv[optind]; + if (chdir(dir) == -1) + strerr_die4sys(111,FATAL,ERR_SWITCH,dir,": "); +@@ -54,6 +70,9 @@ + if (issub(dir,addr,(char *) 0,FATAL)) { + closesql(); + _exit(flagsub); /* subscriber */ ++ } else if (from_addr && issub(dir, from_addr, (char *) 0, FATAL)) { ++ closesql(); ++ _exit(flagsub); + } + } + closesql(); + diff --git a/net-mail/ezmlm-idx/files/get_header.c b/net-mail/ezmlm-idx/files/get_header.c new file mode 100644 index 000000000000..38b0bf3fd427 --- /dev/null +++ b/net-mail/ezmlm-idx/files/get_header.c @@ -0,0 +1,113 @@ +#include "substdio.h" +#include "seek.h" +#include "get_header.h" +#include "stralloc.h" +#include "errtxt.h" +#include "strerr.h" + +#define FATAL "get_header: fatal: " + +static stralloc line = {0}; + +static void die_nomem() +{ + strerr_die2x(111,FATAL,ERR_NOMEM); +} + +/** + * This function assumes that input is at the begining of the file; + * and it returns input to that state when the function has completed. + * The return is 0 if the header was not found, and 1 otherwise. If + * found, the header will be stored in the value stralloc struct. + */ +int get_header(input, name, value) +substdio *input; +char *name; +stralloc *value; +{ + int match = 0; + int found_start = 0; + unsigned int len; + char *cp; + + for (;;) { + if (getln(input, &line, &match, '\n') == -1) + strerr_die2sys(111, FATAL,ERR_READ_INPUT); + if (!match) break; + if (line.len == 1) break; + cp = line.s ; len = line.len; + if (found_start) { + if ((*cp == ' ' || *cp == '\t')) { + if (!stralloc_catb(value, cp, len - 1)) die_nomem(); + } else { + break; + } + } else { + if (case_startb(cp,len,"from:")) { + if (!stralloc_copyb(value, cp, len - 1)) die_nomem(); + found_start = 1; + } + } + } + + if (seek_begin(input->fd) == -1) + strerr_die2sys(111,FATAL,ERR_SEEK_INPUT); + + return found_start; +} + +/** + * This function makes the same assumptions about input as get_header : + * it should be at the begining of the file, and once done, seek will + * be used to return it there. The return value is an e-mail address if + * one can be found, or null otherwise. No attempt is made to validate + * the email address, and the work done for parsing it is relatively + * simplistic; it will handle the following forms as shown: + * + * username@domain => username@domain + * "Name <username@domain>" => username@domain + * username1@domain, username2@domain => username1@domain + * username1@domain, "Name <username2@domain>" => username2@domain + * + * If junk is present in the From: header, this will return that. This + * function may not be appropriate if a valid e-mail address is required. + */ +char *get_from(input) +substdio *input; +{ + stralloc from_header = {0}; + int from_complete = 0, i; + char *from_addr = (char *) 0; + + if (!get_header(input, "from:", &from_header)) + return (char *) 0; + + /* issub uses a char *, and stralloc structures aren't null + * terminated -- they're ... 'Z' terminated ... + * but the stuff in from_header is a copy anyway ... we'll modify it so + * we don't have to do strcpy or somesuch. + */ + for (i = strlen("from:") ; i < from_header.len ; ++i) { + if (*(from_header.s + i) == '<') { + from_addr = from_header.s + (i + 1); + } else if (from_addr && *(from_header.s + i) == '>') { + from_complete = 1; + *(from_header.s+i) = '\0'; /* null terminate so from_addr is valid */ + break; + } + } + if (!from_complete) { /* <...> not found ... assume a simpler format */ + for(i = strlen("from:") ; i < from_header.len ; ++i) { + if (!from_addr && *(from_header.s + i) != ' ') { + from_addr = from_header.s + i; + } else if (from_addr && isspace(*(from_header.s + i)) || + *(from_header.s + i) == ',') { + break; + } + } + *(from_header.s + i) = '\0'; /* this is safe even if i == from_header.len */ + /* because strallocs have an extra char */ + } + return from_addr; +} + diff --git a/net-mail/ezmlm-idx/files/get_header.h b/net-mail/ezmlm-idx/files/get_header.h new file mode 100644 index 000000000000..9af1d4fffdf8 --- /dev/null +++ b/net-mail/ezmlm-idx/files/get_header.h @@ -0,0 +1,7 @@ +#ifndef GET_HEADER_H +#define GET_HEADER_H + +extern int get_header(); +extern char *get_from(); + +#endif diff --git a/net-mail/ezmlm-idx/metadata.xml b/net-mail/ezmlm-idx/metadata.xml new file mode 100644 index 000000000000..210ce3ffc25e --- /dev/null +++ b/net-mail/ezmlm-idx/metadata.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>qmail</herd> +</pkgmetadata> |