From 36d6553c2d1a80b38e961b95ebbfe0290dd5b002 Mon Sep 17 00:00:00 2001 From: ak1 Date: Fri, 18 Mar 2005 23:24:49 +0000 Subject: [PATCH] Andreas Krennmair: moved most of the POP-specific code to a pop subdirectory, similar to the IMAP code. git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@202 e385b8ad-14ed-0310-8656-cc95a2468c6d --- Makefile.am | 17 +++++++++++------ configure.in | 7 ++++++- pop/Makefile.am | 12 ++++++++++++ pop.c => pop/pop.c | 2 +- pop.h => pop/pop.h | 0 pop_auth.c => pop/pop_auth.c | 10 +++++----- pop_lib.c => pop/pop_lib.c | 8 ++++---- regex.c | 16 ++++++++++------ 8 files changed, 49 insertions(+), 23 deletions(-) create mode 100644 pop/Makefile.am rename pop.c => pop/pop.c (99%) rename pop.h => pop/pop.h (100%) rename pop_auth.c => pop/pop_auth.c (97%) rename pop_lib.c => pop/pop_lib.c (97%) diff --git a/Makefile.am b/Makefile.am index 50d6bad..e04208c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,7 +9,12 @@ IMAP_SUBDIR = imap IMAP_INCLUDES = -I$(top_srcdir)/imap endif -SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR) +if BUILD_POP +POP_SUBDIR = pop +POP_INCLUDES = -I$(top_srcdir)/pop +endif + +SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR) $(POP_SUBDIR) bin_SCRIPTS = muttngbug fleang @@ -30,10 +35,10 @@ muttng_SOURCES = $(BUILT_SOURCES) \ muttlib.c editmsg.c utf8.c mbyte.c wcwidth.c md5c.c \ url.c ascii.c mutt_idna.c sidebar.c hcache.c crypt-mod.c crypt-mod.h -muttng_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \ +muttng_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(LIBPOP) $(MUTTLIBS) \ $(INTLLIBS) $(LIBICONV) -muttng_DEPENDENCIES = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAPDEPS) \ +muttng_DEPENDENCIES = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAPDEPS) $(LIBPOPDEPS) \ $(INTLDEPS) makedoc_SOURCES = makedoc.c @@ -53,13 +58,13 @@ DEFS=-DPKGDATADIR=\"$(pkgdatadir)\" -DSYSCONFDIR=\"$(sysconfdir)\" \ -DBINDIR=\"$(bindir)\" -DMUTTLOCALEDIR=\"$(datadir)/locale\" \ -DHAVE_CONFIG_H=1 -INCLUDES=-I. -I$(top_srcdir) $(IMAP_INCLUDES) $(LIBGPGME_CFLAGS) -Iintl +INCLUDES=-I. -I$(top_srcdir) $(IMAP_INCLUDES) $(POP_INCLUDES) $(LIBGPGME_CFLAGS) -Iintl CPPFLAGS=@CPPFLAGS@ -I$(includedir) EXTRA_muttng_SOURCES = account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c \ - mutt_tunnel.c pop.c pop_auth.c pop_lib.c smime.c pgp.c pgpinvoke.c pgpkey.c \ + mutt_tunnel.c smime.c pgp.c pgpinvoke.c pgpkey.c \ pgplib.c sha1.c pgpmicalg.c gnupgparse.c resize.c dotlock.c remailer.c \ browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c \ pgppacket.c mutt_idna.h nntp.c newsrc.c mutt_libesmtp.c \ @@ -72,7 +77,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \ globals.h hash.h history.h init.h keymap.h mutt_crypt.h \ mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \ mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \ - mx.h pager.h pgp.h pop.h protos.h reldate.h rfc1524.h rfc2047.h \ + mx.h pager.h pgp.h protos.h reldate.h rfc1524.h rfc2047.h \ rfc2231.h rfc822.h sha1.h sort.h mime.types VERSION prepare \ nntp.h ChangeLog.nntp \ _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \ diff --git a/configure.in b/configure.in index ab4ad9c..ac5ccf1 100644 --- a/configure.in +++ b/configure.in @@ -494,12 +494,14 @@ dnl -- socket dependencies -- AC_ARG_ENABLE(pop, AC_HELP_STRING([--enable-pop], [Enable POP3 support]), [ if test x$enableval = xyes ; then AC_DEFINE(USE_POP,1,[ Define if you want support for the POP3 protocol. ]) - MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS pop.o pop_lib.o pop_auth.o" + LIBPOP="-Lpop -lpop" + LIBPOPDEPS="\$(top_srcdir)/pop/pop.h pop/libpop.a" need_socket="yes" need_pop="yes" need_md5="yes" fi ]) +AM_CONDITIONAL(BUILD_POP, test x$need_pop = xyes) AC_ARG_ENABLE(imap, AC_HELP_STRING([--enable-imap], [Enable IMAP support]), [ if test x$enableval = xyes ; then @@ -909,6 +911,8 @@ AC_SUBST(MUTTLIBS) AC_SUBST(MUTT_LIB_OBJECTS) AC_SUBST(LIBIMAP) AC_SUBST(LIBIMAPDEPS) +AC_SUBST(LIBPOP) +AC_SUBST(LIBPOPDEPS) dnl -- iconv/gettext -- @@ -1151,5 +1155,6 @@ AC_OUTPUT(Makefile intl/Makefile m4/Makefile po/Makefile.in doc/Makefile contrib/Makefile muttbug.sh imap/Makefile + pop/Makefile Muttngrc.head doc/instdoc.sh) diff --git a/pop/Makefile.am b/pop/Makefile.am new file mode 100644 index 0000000..dee7dab --- /dev/null +++ b/pop/Makefile.am @@ -0,0 +1,12 @@ +## Process this file with automake to produce Makefile.in + +AR=@AR@ + +AUTOMAKE_OPTIONS = foreign + +INCLUDES = -I$(top_srcdir) -I../intl + +noinst_LIBRARIES = libpop.a +noinst_HEADERS = pop.h + +libpop_a_SOURCES = pop.c pop_auth.c pop_lib.c pop.h diff --git a/pop.c b/pop/pop.c similarity index 99% rename from pop.c rename to pop/pop.c index f23fa2f..f39f023 100644 --- a/pop.c +++ b/pop/pop.c @@ -509,7 +509,7 @@ void pop_fetch_mail (void) return; } - url = p = safe_calloc (mutt_strlen (PopHost) + 7, sizeof (char)); + url = p = safe_calloc (strlen (PopHost) + 7, sizeof (char)); if (url_check_scheme (PopHost) == U_UNKNOWN) { strcpy (url, "pop://"); /* __STRCPY_CHECKED__ */ p = strchr (url, '\0'); diff --git a/pop.h b/pop/pop.h similarity index 100% rename from pop.h rename to pop/pop.h diff --git a/pop_auth.c b/pop/pop_auth.c similarity index 97% rename from pop_auth.c rename to pop/pop_auth.c index 785e1a9..2583e18 100644 --- a/pop_auth.c +++ b/pop/pop_auth.c @@ -87,7 +87,7 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA * pop_data, const char *method) mutt_message _("Authenticating (SASL)..."); snprintf (buf, sizeof (buf), "AUTH %s", mech); - olen = mutt_strlen (buf); + olen = strlen (buf); /* looping protocol */ FOREVER { @@ -104,11 +104,11 @@ static pop_auth_res_t pop_auth_sasl (POP_DATA * pop_data, const char *method) #ifdef USE_SASL2 if (!mutt_strncmp (inbuf, "+ ", 2) - && sasl_decode64 (inbuf, mutt_strlen (inbuf), buf, LONG_STRING - 1, + && sasl_decode64 (inbuf, strlen (inbuf), buf, LONG_STRING - 1, &len) != SASL_OK) #else if (!mutt_strncmp (inbuf, "+ ", 2) - && sasl_decode64 (inbuf, mutt_strlen (inbuf), buf, &len) != SASL_OK) + && sasl_decode64 (inbuf, strlen (inbuf), buf, &len) != SASL_OK) #endif { dprint (1, @@ -203,9 +203,9 @@ static pop_auth_res_t pop_auth_apop (POP_DATA * pop_data, const char *method) /* Compute the authentication hash to send to the server */ MD5Init (&mdContext); MD5Update (&mdContext, (unsigned char *) pop_data->timestamp, - mutt_strlen (pop_data->timestamp)); + strlen (pop_data->timestamp)); MD5Update (&mdContext, (unsigned char *) pop_data->conn->account.pass, - mutt_strlen (pop_data->conn->account.pass)); + strlen (pop_data->conn->account.pass)); MD5Final (digest, &mdContext); for (i = 0; i < sizeof (digest); i++) diff --git a/pop_lib.c b/pop/pop_lib.c similarity index 97% rename from pop_lib.c rename to pop/pop_lib.c index c5ec1d0..6b814fa 100644 --- a/pop_lib.c +++ b/pop/pop_lib.c @@ -68,7 +68,7 @@ void pop_error (POP_DATA * pop_data, char *msg) c = c2; } - strfcpy (t, c, sizeof (pop_data->err_msg) - mutt_strlen (pop_data->err_msg)); + strfcpy (t, c, sizeof (pop_data->err_msg) - strlen (pop_data->err_msg)); mutt_remove_trailing_ws (pop_data->err_msg); } @@ -106,12 +106,12 @@ static int fetch_auth (char *line, void *data) POP_DATA *pop_data = (POP_DATA *) data; if (!pop_data->auth_list) { - pop_data->auth_list = safe_malloc (mutt_strlen (line) + 1); + pop_data->auth_list = safe_malloc (strlen (line) + 1); *pop_data->auth_list = '\0'; } else { safe_realloc (&pop_data->auth_list, - mutt_strlen (pop_data->auth_list) + mutt_strlen (line) + 2); + strlen (pop_data->auth_list) + strlen (line) + 2); strcat (pop_data->auth_list, " "); /* __STRCAT_CHECKED__ */ } strcat (pop_data->auth_list, line); /* __STRCAT_CHECKED__ */ @@ -446,7 +446,7 @@ int pop_fetch_data (POP_DATA * pop_data, char *query, char *msg, strfcpy (inbuf + lenbuf, p, sizeof (buf)); if (chunk >= sizeof (buf)) { - lenbuf += mutt_strlen (p); + lenbuf += strlen (p); } else { line++; diff --git a/regex.c b/regex.c index 9db19c5..f15550c 100644 --- a/regex.c +++ b/regex.c @@ -2426,11 +2426,13 @@ static reg_errcode_t regex_compile (pattern, size, syntax, bufp) if (syntax & RE_NO_BK_PARENS) goto normal_backslash; - if (COMPILE_STACK_EMPTY) - if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) + if (COMPILE_STACK_EMPTY) { + if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) { goto normal_backslash; - else + } else { FREE_STACK_RETURN (REG_ERPAREN); + } + } handle_close: if (fixup_alt_jump) { /* Push a dummy failure point at the end of the @@ -2445,11 +2447,13 @@ static reg_errcode_t regex_compile (pattern, size, syntax, bufp) } /* See similar code for backslashed left paren above. */ - if (COMPILE_STACK_EMPTY) - if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) + if (COMPILE_STACK_EMPTY) { + if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) { goto normal_char; - else + } else { FREE_STACK_RETURN (REG_ERPAREN); + } + } /* Since we just checked for an empty stack above, this ``can't happen''. */ -- 2.20.1