summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorParabola <dev@list.parabolagnulinux.org>2011-06-19 02:48:26 +0000
committerParabola <dev@list.parabolagnulinux.org>2011-06-19 02:48:26 +0000
commit5457eacc747fc3f91e10a1f452230b1feac39eff (patch)
treebae3163aec825d4fc53c0ef265eac2148b31353b /testing
parentc80552b41838a5668458ebb1eb9b0f44ea6fe879 (diff)
Sun Jun 19 02:48:26 UTC 2011
Diffstat (limited to 'testing')
-rw-r--r--testing/coreutils/PKGBUILD69
-rw-r--r--testing/coreutils/coreutils-pam.patch428
-rw-r--r--testing/coreutils/coreutils-uname.patch173
-rw-r--r--testing/coreutils/coreutils.install21
-rw-r--r--testing/coreutils/su.pam9
-rw-r--r--testing/libevent/PKGBUILD33
-rw-r--r--testing/links/PKGBUILD49
-rw-r--r--testing/links/links.desktop7
-rw-r--r--testing/lirc/PKGBUILD103
-rw-r--r--testing/lirc/irexec.conf5
-rwxr-xr-xtesting/lirc/irexecd38
-rw-r--r--testing/lirc/kernel-2.6.39.patch54
-rw-r--r--testing/lirc/lirc.install16
-rw-r--r--testing/lirc/lirc.logrotate5
-rw-r--r--testing/lirc/lirc_atiusb-kfifo.patch31
-rw-r--r--testing/lirc/lirc_wpc8769l.patch88
-rwxr-xr-xtesting/lirc/lircd52
-rw-r--r--testing/lirc/lircd-handle-large-config.patch39
-rw-r--r--testing/lirc/lircd.conf8
-rwxr-xr-xtesting/lirc/lircmd36
-rw-r--r--testing/moc/PKGBUILD44
-rw-r--r--testing/moc/gcc-undefined-symbols.diff12
-rw-r--r--testing/mpd/PKGBUILD56
-rwxr-xr-xtesting/mpd/mpd36
-rw-r--r--testing/mpd/mpd.install18
-rw-r--r--testing/net-tools/PKGBUILD44
-rw-r--r--testing/net-tools/gcc340.patch46
-rw-r--r--testing/net-tools/net-tools-1.60-2.6-compilefix.patch23
-rw-r--r--testing/net-tools/net-tools-1.60-miiioctl.patch17
-rw-r--r--testing/net-tools/net-tools-1.60-nameif.patch58
-rw-r--r--testing/net-tools/net-tools-1.60-nameif_strncpy.patch13
-rw-r--r--testing/net-tools/net-tools.install12
-rw-r--r--testing/net-tools/net-tools.patch52
-rw-r--r--testing/nouveau-drm-lts/COPYING48
-rw-r--r--testing/nouveau-drm-lts/Makefile102
-rw-r--r--testing/nouveau-drm-lts/PKGBUILD47
-rw-r--r--testing/nouveau-drm-lts/dont_check_for_pthread.patch49
-rw-r--r--testing/nouveau-drm-lts/nouveau-drm.install16
-rw-r--r--testing/openssh/PKGBUILD71
-rw-r--r--testing/openssh/authfile.c.patch198
-rwxr-xr-xtesting/openssh/sshd48
-rw-r--r--testing/openssh/sshd.confd4
-rw-r--r--testing/openssh/sshd.pam11
-rw-r--r--testing/python2/PKGBUILD87
-rw-r--r--testing/python2/python-2.7-db51.patch42
-rw-r--r--testing/re-alpine/PKGBUILD38
-rw-r--r--testing/re-alpine/maildir.patch3712
47 files changed, 0 insertions, 6168 deletions
diff --git a/testing/coreutils/PKGBUILD b/testing/coreutils/PKGBUILD
deleted file mode 100644
index 6d75f0659..000000000
--- a/testing/coreutils/PKGBUILD
+++ /dev/null
@@ -1,69 +0,0 @@
-# $Id: PKGBUILD 127042 2011-06-10 00:56:53Z bisson $
-# Maintainer: Allan McRae <allan@archlinux.org>
-# Contributor: judd <jvinet@zeroflux.org>
-
-pkgname=coreutils
-pkgver=8.12
-pkgrel=3
-pkgdesc="The basic file, shell and text manipulation utilities of the GNU operating system"
-arch=('i686' 'x86_64')
-license=('GPL3')
-url="http://www.gnu.org/software/coreutils"
-groups=('base')
-depends=('glibc' 'shadow' 'pam' 'acl' 'gmp' 'libcap')
-replaces=('mktemp')
-backup=('etc/pam.d/su')
-install=${pkgname}.install
-options=('!emptydirs')
-source=(ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz
- coreutils-uname.patch
- coreutils-pam.patch
- su.pam)
-md5sums=('0f7d43c2d2e24314b43a6c6267e25b90'
- 'c4fcca138b6abf6d443d48a6f0cd8833'
- 'aad79a2aa6d566c375d7bdd1b0767278'
- 'fa85e5cce5d723275b14365ba71a8aad')
-
-build() {
- cd ${srcdir}/${pkgname}-${pkgver}
-
- # added su wheel group pam patch (from fedora git)
- patch -Np1 -i ${srcdir}/coreutils-pam.patch
-
- # linux specific uname improvement (from gentoo portage)
- patch -Np1 -i ${srcdir}/coreutils-uname.patch
-
- autoreconf -v
- ./configure --prefix=/usr \
- --enable-install-program=su \
- --enable-no-install-program=groups,hostname,kill,uptime \
- --enable-pam
- make
-}
-
-check() {
- cd ${srcdir}/${pkgname}-${pkgver}
- make RUN_EXPENSIVE_TESTS=yes check
-}
-
-package() {
- cd ${srcdir}/${pkgname}-${pkgver}
- make DESTDIR=${pkgdir} install
-
- cd ${pkgdir}/usr/bin
- install -dm755 ${pkgdir}/{bin,usr/sbin}
-
- # binaries required by FHS
- _fhs="cat chgrp chmod chown cp date dd df echo false ln ls \
- mkdir mknod mv pwd rm rmdir stty su sync true uname"
- mv ${_fhs} ${pkgdir}/bin
-
- # binaries required by various Arch scripts
- _bin="cut dir dircolors du install mkfifo readlink shred \
- sleep touch tr vdir"
- mv ${_bin} ${pkgdir}/bin
- ln -sf /bin/sleep ${pkgdir}/usr/bin/sleep
-
- mv chroot ${pkgdir}/usr/sbin
- install -Dm644 ${srcdir}/su.pam ${pkgdir}/etc/pam.d/su
-}
diff --git a/testing/coreutils/coreutils-pam.patch b/testing/coreutils/coreutils-pam.patch
deleted file mode 100644
index e61908f3f..000000000
--- a/testing/coreutils/coreutils-pam.patch
+++ /dev/null
@@ -1,428 +0,0 @@
-diff -urNp coreutils-8.4-orig/configure.ac coreutils-8.4/configure.ac
---- coreutils-8.4-orig/configure.ac 2010-01-11 18:20:42.000000000 +0100
-+++ coreutils-8.4/configure.ac 2010-02-12 10:17:46.000000000 +0100
-@@ -126,6 +126,13 @@ if test "$gl_gcc_warnings" = yes; then
- AC_SUBST([GNULIB_WARN_CFLAGS])
- fi
-
-+dnl Give the chance to enable PAM
-+AC_ARG_ENABLE(pam, dnl
-+[ --enable-pam Enable use of the PAM libraries],
-+[AC_DEFINE(USE_PAM, 1, [Define if you want to use PAM])
-+LIB_PAM="-ldl -lpam -lpam_misc"
-+AC_SUBST(LIB_PAM)])
-+
- AC_FUNC_FORK
-
- optional_bin_progs=
-diff -urNp coreutils-8.4-orig/doc/coreutils.texi coreutils-8.4/doc/coreutils.texi
---- coreutils-8.4-orig/doc/coreutils.texi 2010-01-03 18:06:20.000000000 +0100
-+++ coreutils-8.4/doc/coreutils.texi 2010-02-12 10:17:46.000000000 +0100
-@@ -15081,8 +15081,11 @@ to certain shells, etc.).
- @findex syslog
- @command{su} can optionally be compiled to use @code{syslog} to report
- failed, and optionally successful, @command{su} attempts. (If the system
--supports @code{syslog}.) However, GNU @command{su} does not check if the
--user is a member of the @code{wheel} group; see below.
-+supports @code{syslog}.)
-+
-+This version of @command{su} has support for using PAM for
-+authentication. You can edit @file{/etc/pam.d/su} to customize its
-+behaviour.
-
- The program accepts the following options. Also see @ref{Common options}.
-
-@@ -15124,6 +15127,8 @@ environment variables except @env{TERM},
- @env{PATH} to a compiled-in default value. Change to @var{user}'s home
- directory. Prepend @samp{-} to the shell's name, intended to make it
- read its login startup file(s).
-+Additionaly @env{DISPLAY} and @env{XAUTHORITY} environment variables
-+are preserved as well for PAM functionality.
-
- @item -m
- @itemx -p
-@@ -15163,33 +15168,6 @@ Exit status:
- the exit status of the subshell otherwise
- @end display
-
--@cindex wheel group, not supported
--@cindex group wheel, not supported
--@cindex fascism
--@subsection Why GNU @command{su} does not support the @samp{wheel} group
--
--(This section is by Richard Stallman.)
--
--@cindex Twenex
--@cindex MIT AI lab
--Sometimes a few of the users try to hold total power over all the
--rest. For example, in 1984, a few users at the MIT AI lab decided to
--seize power by changing the operator password on the Twenex system and
--keeping it secret from everyone else. (I was able to thwart this coup
--and give power back to the users by patching the kernel, but I
--wouldn't know how to do that in Unix.)
--
--However, occasionally the rulers do tell someone. Under the usual
--@command{su} mechanism, once someone learns the root password who
--sympathizes with the ordinary users, he or she can tell the rest. The
--``wheel group'' feature would make this impossible, and thus cement the
--power of the rulers.
--
--I'm on the side of the masses, not that of the rulers. If you are
--used to supporting the bosses and sysadmins in whatever they do, you
--might find this idea strange at first.
--
--
- @node timeout invocation
- @section @command{timeout}: Run a command with a time limit
-
-diff -urNp coreutils-8.4-orig/src/Makefile.am coreutils-8.4/src/Makefile.am
---- coreutils-8.4-orig/src/Makefile.am 2010-01-03 18:06:20.000000000 +0100
-+++ coreutils-8.4/src/Makefile.am 2010-02-12 10:17:46.000000000 +0100
-@@ -361,7 +361,7 @@ factor_LDADD += $(LIB_GMP)
- uptime_LDADD += $(GETLOADAVG_LIBS)
-
- # for crypt
--su_LDADD += $(LIB_CRYPT)
-+su_LDADD += $(LIB_CRYPT) @LIB_PAM@
-
- # for various ACL functions
- copy_LDADD += $(LIB_ACL)
-diff -urNp coreutils-8.4-orig/src/su.c coreutils-8.4/src/su.c
---- coreutils-8.4-orig/src/su.c 2010-02-12 10:15:15.000000000 +0100
-+++ coreutils-8.4/src/su.c 2010-02-12 10:24:29.000000000 +0100
-@@ -37,6 +37,16 @@
- restricts who can su to UID 0 accounts. RMS considers that to
- be fascist.
-
-+#ifdef USE_PAM
-+
-+ Actually, with PAM, su has nothing to do with whether or not a
-+ wheel group is enforced by su. RMS tries to restrict your access
-+ to a su which implements the wheel group, but PAM considers that
-+ to be fascist, and gives the user/sysadmin the opportunity to
-+ enforce a wheel group by proper editing of /etc/pam.conf
-+
-+#endif
-+
- Compile-time options:
- -DSYSLOG_SUCCESS Log successful su's (by default, to root) with syslog.
- -DSYSLOG_FAILURE Log failed su's (by default, to root) with syslog.
-@@ -53,6 +63,15 @@
- #include <pwd.h>
- #include <grp.h>
-
-+#ifdef USE_PAM
-+# include <signal.h>
-+# include <sys/wait.h>
-+# include <sys/fsuid.h>
-+# include <unistd.h>
-+# include <security/pam_appl.h>
-+# include <security/pam_misc.h>
-+#endif /* USE_PAM */
-+
- #include "system.h"
- #include "getpass.h"
-
-@@ -120,10 +139,17 @@
- /* The user to become if none is specified. */
- #define DEFAULT_USER "root"
-
-+#ifndef USE_PAM
- char *crypt (char const *key, char const *salt);
-+#endif
-
--static void run_shell (char const *, char const *, char **, size_t)
-+static void run_shell (char const *, char const *, char **, size_t,
-+ const struct passwd *)
-+#ifdef USE_PAM
-+ ;
-+#else
- ATTRIBUTE_NORETURN;
-+#endif
-
- /* If true, pass the `-f' option to the subshell. */
- static bool fast_startup;
-@@ -209,7 +235,26 @@ log_su (struct passwd const *pw, bool su
- }
- #endif
-
-+#ifdef USE_PAM
-+static pam_handle_t *pamh = NULL;
-+static int retval;
-+static struct pam_conv conv = {
-+ misc_conv,
-+ NULL
-+};
-+
-+#define PAM_BAIL_P if (retval) { \
-+ pam_end(pamh, PAM_SUCCESS); \
-+ return 0; \
-+}
-+#define PAM_BAIL_P_VOID if (retval) { \
-+ pam_end(pamh, PAM_SUCCESS); \
-+return; \
-+}
-+#endif
-+
- /* Ask the user for a password.
-+ If PAM is in use, let PAM ask for the password if necessary.
- Return true if the user gives the correct password for entry PW,
- false if not. Return true without asking for a password if run by UID 0
- or if PW has an empty password. */
-@@ -217,6 +262,44 @@ log_su (struct passwd const *pw, bool su
- static bool
- correct_password (const struct passwd *pw)
- {
-+#ifdef USE_PAM
-+ struct passwd *caller;
-+ char *tty_name, *ttyn;
-+ retval = pam_start(PROGRAM_NAME, pw->pw_name, &conv, &pamh);
-+ PAM_BAIL_P;
-+
-+ if (getuid() != 0 && !isatty(0)) {
-+ fprintf(stderr, "standard in must be a tty\n");
-+ exit(1);
-+ }
-+
-+ caller = getpwuid(getuid());
-+ if(caller != NULL && caller->pw_name != NULL) {
-+ retval = pam_set_item(pamh, PAM_RUSER, caller->pw_name);
-+ PAM_BAIL_P;
-+ }
-+
-+ ttyn = ttyname(0);
-+ if (ttyn) {
-+ if (strncmp(ttyn, "/dev/", 5) == 0)
-+ tty_name = ttyn+5;
-+ else
-+ tty_name = ttyn;
-+ retval = pam_set_item(pamh, PAM_TTY, tty_name);
-+ PAM_BAIL_P;
-+ }
-+ retval = pam_authenticate(pamh, 0);
-+ PAM_BAIL_P;
-+ retval = pam_acct_mgmt(pamh, 0);
-+ if (retval == PAM_NEW_AUTHTOK_REQD) {
-+ /* password has expired. Offer option to change it. */
-+ retval = pam_chauthtok(pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
-+ PAM_BAIL_P;
-+ }
-+ PAM_BAIL_P;
-+ /* must be authenticated if this point was reached */
-+ return 1;
-+#else /* !USE_PAM */
- char *unencrypted, *encrypted, *correct;
- #if HAVE_GETSPNAM && HAVE_STRUCT_SPWD_SP_PWDP
- /* Shadow passwd stuff for SVR3 and maybe other systems. */
-@@ -241,6 +324,7 @@ correct_password (const struct passwd *p
- encrypted = crypt (unencrypted, correct);
- memset (unencrypted, 0, strlen (unencrypted));
- return STREQ (encrypted, correct);
-+#endif /* !USE_PAM */
- }
-
- /* Update `environ' for the new shell based on PW, with SHELL being
-@@ -254,12 +338,18 @@ modify_environment (const struct passwd
- /* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH.
- Unset all other environment variables. */
- char const *term = getenv ("TERM");
-+ char const *display = getenv ("DISPLAY");
-+ char const *xauthority = getenv ("XAUTHORITY");
- if (term)
- term = xstrdup (term);
- environ = xmalloc ((6 + !!term) * sizeof (char *));
- environ[0] = NULL;
- if (term)
- xsetenv ("TERM", term);
-+ if (display)
-+ xsetenv ("DISPLAY", display);
-+ if (xauthority)
-+ xsetenv ("XAUTHORITY", xauthority);
- xsetenv ("HOME", pw->pw_dir);
- xsetenv ("SHELL", shell);
- xsetenv ("USER", pw->pw_name);
-@@ -292,8 +382,13 @@ change_identity (const struct passwd *pw
- {
- #ifdef HAVE_INITGROUPS
- errno = 0;
-- if (initgroups (pw->pw_name, pw->pw_gid) == -1)
-+ if (initgroups (pw->pw_name, pw->pw_gid) == -1) {
-+#ifdef USE_PAM
-+ pam_close_session(pamh, 0);
-+ pam_end(pamh, PAM_ABORT);
-+#endif
- error (EXIT_CANCELED, errno, _("cannot set groups"));
-+ }
- endgrent ();
- #endif
- if (setgid (pw->pw_gid))
-@@ -302,6 +397,31 @@ change_identity (const struct passwd *pw
- error (EXIT_CANCELED, errno, _("cannot set user id"));
- }
-
-+#ifdef USE_PAM
-+static int caught=0;
-+/* Signal handler for parent process later */
-+static void su_catch_sig(int sig)
-+{
-+ ++caught;
-+}
-+
-+int
-+pam_copyenv (pam_handle_t *pamh)
-+{
-+ char **env;
-+
-+ env = pam_getenvlist(pamh);
-+ if(env) {
-+ while(*env) {
-+ if (putenv (*env))
-+ xalloc_die ();
-+ env++;
-+ }
-+ }
-+ return(0);
-+}
-+#endif
-+
- /* Run SHELL, or DEFAULT_SHELL if SHELL is empty.
- If COMMAND is nonzero, pass it to the shell with the -c option.
- Pass ADDITIONAL_ARGS to the shell as more arguments; there
-@@ -309,17 +429,49 @@ change_identity (const struct passwd *pw
-
- static void
- run_shell (char const *shell, char const *command, char **additional_args,
-- size_t n_additional_args)
-+ size_t n_additional_args, const struct passwd *pw)
- {
- size_t n_args = 1 + fast_startup + 2 * !!command + n_additional_args + 1;
- char const **args = xnmalloc (n_args, sizeof *args);
- size_t argno = 1;
-+#ifdef USE_PAM
-+ int child;
-+ sigset_t ourset;
-+ int status;
-+
-+ retval = pam_open_session(pamh,0);
-+ if (retval != PAM_SUCCESS) {
-+ fprintf (stderr, "could not open session\n");
-+ exit (1);
-+ }
-+
-+/* do this at the last possible moment, because environment variables may
-+ be passed even in the session phase
-+*/
-+ if(pam_copyenv(pamh) != PAM_SUCCESS)
-+ fprintf (stderr, "error copying PAM environment\n");
-+
-+ /* Credentials should be set in the parent */
-+ if (pam_setcred(pamh, PAM_ESTABLISH_CRED) != PAM_SUCCESS) {
-+ pam_close_session(pamh, 0);
-+ fprintf(stderr, "could not set PAM credentials\n");
-+ exit(1);
-+ }
-+
-+ child = fork();
-+ if (child == 0) { /* child shell */
-+ change_identity (pw);
-+ pam_end(pamh, 0);
-+#endif
-
- if (simulate_login)
- {
- char *arg0;
- char *shell_basename;
-
-+ if(chdir(pw->pw_dir))
-+ error(0, errno, _("warning: cannot change directory to %s"), pw->pw_dir);
-+
- shell_basename = last_component (shell);
- arg0 = xmalloc (strlen (shell_basename) + 2);
- arg0[0] = '-';
-@@ -344,6 +496,67 @@ run_shell (char const *shell, char const
- error (0, errno, "%s", shell);
- exit (exit_status);
- }
-+#ifdef USE_PAM
-+ } else if (child == -1) {
-+ fprintf(stderr, "can not fork user shell: %s", strerror(errno));
-+ pam_setcred(pamh, PAM_DELETE_CRED | PAM_SILENT);
-+ pam_close_session(pamh, 0);
-+ pam_end(pamh, PAM_ABORT);
-+ exit(1);
-+ }
-+ /* parent only */
-+ sigfillset(&ourset);
-+ if (sigprocmask(SIG_BLOCK, &ourset, NULL)) {
-+ fprintf(stderr, "%s: signal malfunction\n", PROGRAM_NAME);
-+ caught = 1;
-+ }
-+ if (!caught) {
-+ struct sigaction action;
-+ action.sa_handler = su_catch_sig;
-+ sigemptyset(&action.sa_mask);
-+ action.sa_flags = 0;
-+ sigemptyset(&ourset);
-+ if (sigaddset(&ourset, SIGTERM)
-+ || sigaddset(&ourset, SIGALRM)
-+ || sigaction(SIGTERM, &action, NULL)
-+ || sigprocmask(SIG_UNBLOCK, &ourset, NULL)) {
-+ fprintf(stderr, "%s: signal masking malfunction\n", PROGRAM_NAME);
-+ caught = 1;
-+ }
-+ }
-+ if (!caught) {
-+ do {
-+ int pid;
-+
-+ pid = waitpid(-1, &status, WUNTRACED);
-+
-+ if (((pid_t)-1 != pid) && (0 != WIFSTOPPED (status))) {
-+ kill(getpid(), WSTOPSIG(status));
-+ /* once we get here, we must have resumed */
-+ kill(pid, SIGCONT);
-+ }
-+ } while (0 != WIFSTOPPED(status));
-+ }
-+
-+ if (caught) {
-+ fprintf(stderr, "\nSession terminated, killing shell...");
-+ kill (child, SIGTERM);
-+ }
-+ /* Not checking retval on this because we need to call close session */
-+ pam_setcred(pamh, PAM_DELETE_CRED | PAM_SILENT);
-+ retval = pam_close_session(pamh, 0);
-+ PAM_BAIL_P_VOID;
-+ retval = pam_end(pamh, PAM_SUCCESS);
-+ PAM_BAIL_P_VOID;
-+ if (caught) {
-+ sleep(2);
-+ kill(child, SIGKILL);
-+ fprintf(stderr, " ...killed.\n");
-+ exit(-1);
-+ }
-+ exit ((0 != WIFEXITED (status)) ? WEXITSTATUS (status)
-+ : WTERMSIG (status) + 128);
-+#endif /* USE_PAM */
- }
-
- /* Return true if SHELL is a restricted shell (one not returned by
-@@ -511,9 +724,9 @@ main (int argc, char **argv)
- shell = xstrdup (shell ? shell : pw->pw_shell);
- modify_environment (pw, shell);
-
-+#ifndef USE_PAM
- change_identity (pw);
-- if (simulate_login && chdir (pw->pw_dir) != 0)
-- error (0, errno, _("warning: cannot change directory to %s"), pw->pw_dir);
-+#endif
-
- /* error() flushes stderr, but does not check for write failure.
- Normally, we would catch this via our atexit() hook of
-@@ -523,5 +736,5 @@ main (int argc, char **argv)
- if (ferror (stderr))
- exit (EXIT_CANCELED);
-
-- run_shell (shell, command, argv + optind, MAX (0, argc - optind));
-+ run_shell (shell, command, argv + optind, MAX (0, argc - optind), pw);
- }
diff --git a/testing/coreutils/coreutils-uname.patch b/testing/coreutils/coreutils-uname.patch
deleted file mode 100644
index b458abeba..000000000
--- a/testing/coreutils/coreutils-uname.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-On linux platforms, grok /proc/cpuinfo for the CPU/vendor info.
-
-Prob not suitable for upstream seeing as how it's 100% linux-specific
-http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html
-
-Patch originally by Carlos E. Gorges <carlos@techlinux.com.br>, but
-heavily reworked to suck less.
-
-To add support for additional platforms, check out the show_cpuinfo()
-func in the linux/arch/<ARCH>/ source tree of the kernel.
-
---- coreutils/src/uname.c
-+++ coreutils/src/uname.c
-@@ -50,6 +50,11 @@
- # include <mach-o/arch.h>
- #endif
-
-+#if defined(__linux__)
-+# define USE_PROCINFO
-+# define UNAME_HARDWARE_PLATFORM
-+#endif
-+
- #include "system.h"
- #include "error.h"
- #include "quote.h"
-@@ -138,6 +143,117 @@
- exit (status);
- }
-
-+#if defined(USE_PROCINFO)
-+
-+# if defined(__s390__) || defined(__s390x__)
-+# define CPUINFO_FILE "/proc/sysinfo"
-+# define CPUINFO_FORMAT "%64[^\t :]%*[ :]%256[^\n]%c"
-+# else
-+# define CPUINFO_FILE "/proc/cpuinfo"
-+# define CPUINFO_FORMAT "%64[^\t:]\t:%256[^\n]%c"
-+# endif
-+
-+# define PROCINFO_PROCESSOR 0
-+# define PROCINFO_HARDWARE_PLATFORM 1
-+
-+static void __eat_cpuinfo_space(char *buf)
-+{
-+ /* first eat trailing space */
-+ char *tmp = buf + strlen(buf) - 1;
-+ while (tmp > buf && isspace(*tmp))
-+ *tmp-- = '\0';
-+ /* then eat leading space */
-+ tmp = buf;
-+ while (*tmp && isspace(*tmp))
-+ tmp++;
-+ if (tmp != buf)
-+ memmove(buf, tmp, strlen(tmp)+1);
-+ /* finally collapse whitespace */
-+ tmp = buf;
-+ while (tmp[0] && tmp[1]) {
-+ if (isspace(tmp[0]) && isspace(tmp[1])) {
-+ memmove(tmp, tmp+1, strlen(tmp));
-+ continue;
-+ }
-+ ++tmp;
-+ }
-+}
-+
-+static int __linux_procinfo(int x, char *fstr, size_t s)
-+{
-+ FILE *fp;
-+
-+ char *procinfo_keys[] = {
-+ /* --processor --hardware-platform */
-+ #if defined(__alpha__)
-+ "cpu model", "system type"
-+ #elif defined(__arm__)
-+ "Processor", "Hardware"
-+ #elif defined(__avr32__)
-+ "processor", "cpu family"
-+ #elif defined(__bfin__)
-+ "CPU", "BOARD Name"
-+ #elif defined(__cris__)
-+ "cpu", "cpu model"
-+ #elif defined(__frv__)
-+ "CPU-Core", "System"
-+ #elif defined(__i386__) || defined(__x86_64__)
-+ "model name", "vendor_id"
-+ #elif defined(__ia64__)
-+ "family", "vendor"
-+ #elif defined(__hppa__)
-+ "cpu", "model"
-+ #elif defined(__m68k__)
-+ "CPU", "MMU"
-+ #elif defined(__mips__)
-+ "cpu model", "system type"
-+ #elif defined(__powerpc__) || defined(__powerpc64__)
-+ "cpu", "machine"
-+ #elif defined(__s390__) || defined(__s390x__)
-+ "Type", "Manufacturer"
-+ #elif defined(__sh__)
-+ "cpu type", "machine"
-+ #elif defined(sparc) || defined(__sparc__)
-+ "type", "cpu"
-+ #elif defined(__vax__)
-+ "cpu type", "cpu"
-+ #else
-+ "unknown", "unknown"
-+ #endif
-+ };
-+
-+ if ((fp = fopen(CPUINFO_FILE, "r")) != NULL) {
-+ char key[65], value[257], eol, *ret = NULL;
-+
-+ while (fscanf(fp, CPUINFO_FORMAT, key, value, &eol) != EOF) {
-+ __eat_cpuinfo_space(key);
-+ if (!strcmp(key, procinfo_keys[x])) {
-+ __eat_cpuinfo_space(value);
-+ ret = value;
-+ break;
-+ }
-+ if (eol != '\n') {
-+ /* we need two fscanf's here in case the previous
-+ * length limit caused us to read right up to the
-+ * newline ... doing "%*[^\n]\n" wont eat the newline
-+ */
-+ fscanf(fp, "%*[^\n]");
-+ fscanf(fp, "\n");
-+ }
-+ }
-+ fclose(fp);
-+
-+ if (ret) {
-+ strncpy(fstr, ret, s);
-+ return 0;
-+ }
-+ }
-+
-+ return -1;
-+}
-+
-+#endif
-+
- /* Print ELEMENT, preceded by a space if something has already been
- printed. */
-
-@@ -250,10 +344,14 @@ main (int argc, char **argv)
- if (toprint & PRINT_PROCESSOR)
- {
- char const *element = unknown;
--#if HAVE_SYSINFO && defined SI_ARCHITECTURE
-+#if ( HAVE_SYSINFO && defined SI_ARCHITECTURE ) || defined(USE_PROCINFO)
- {
- static char processor[257];
-+#if defined(USE_PROCINFO)
-+ if (0 <= __linux_procinfo (PROCINFO_PROCESSOR, processor, sizeof processor))
-+#else
- if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
-+#endif
- element = processor;
- }
- #endif
-@@ -306,9 +404,13 @@ main (int argc, char **argv)
- if (element == unknown)
- {
- static char hardware_platform[257];
-+#if defined(USE_PROCINFO)
-+ if (0 <= __linux_procinfo (PROCINFO_HARDWARE_PLATFORM, hardware_platform, sizeof hardware_platform))
-+#else
- size_t s = sizeof hardware_platform;
- static int mib[] = { CTL_HW, UNAME_HARDWARE_PLATFORM };
- if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0)
-+#endif
- element = hardware_platform;
- }
- #endif
diff --git a/testing/coreutils/coreutils.install b/testing/coreutils/coreutils.install
deleted file mode 100644
index 8caae6686..000000000
--- a/testing/coreutils/coreutils.install
+++ /dev/null
@@ -1,21 +0,0 @@
-infodir=usr/share/info
-filelist=(coreutils.info)
-
-post_install() {
- [ -x usr/bin/install-info ] || return 0
- for file in ${filelist[@]}; do
- usr/bin/install-info $infodir/$file.gz $infodir/dir 2> /dev/null
- done
-}
-
-post_upgrade() {
- post_install $1
-}
-
-pre_remove() {
- [ -x usr/bin/install-info ] || return 0
- for file in ${filelist[@]}; do
- usr/bin/install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
- done
-}
-
diff --git a/testing/coreutils/su.pam b/testing/coreutils/su.pam
deleted file mode 100644
index cf15f40f1..000000000
--- a/testing/coreutils/su.pam
+++ /dev/null
@@ -1,9 +0,0 @@
-#%PAM-1.0
-auth sufficient pam_rootok.so
-# Uncomment the following line to implicitly trust users in the "wheel" group.
-#auth sufficient pam_wheel.so trust use_uid
-# Uncomment the following line to require a user to be in the "wheel" group.
-#auth required pam_wheel.so use_uid
-auth required pam_unix.so
-account required pam_unix.so
-session required pam_unix.so
diff --git a/testing/libevent/PKGBUILD b/testing/libevent/PKGBUILD
deleted file mode 100644
index 21f3f6722..000000000
--- a/testing/libevent/PKGBUILD
+++ /dev/null
@@ -1,33 +0,0 @@
-# $Id: PKGBUILD 127366 2011-06-13 18:59:12Z eric $
-# Maintainer:
-# Contributor: Judd <jvinet@zeroflux.org>
-
-pkgname=libevent
-pkgver=2.0.12
-pkgrel=1
-pkgdesc="An event notification library"
-arch=('i686' 'x86_64')
-url="http://www.monkey.org/~provos/libevent/"
-license=('GPL2')
-depends=('openssl')
-optdepends=('python2: to use event_rpcgen.py')
-options=('!libtool')
-source=("http://www.monkey.org/~provos/libevent-$pkgver-stable.tar.gz")
-md5sums=('42986228baf95e325778ed328a93e070')
-
-build() {
- cd "${srcdir}/${pkgname}-${pkgver}-stable"
- sed -i 's#python#python2#' event_rpcgen.py
- ./configure --prefix=/usr --sysconfdir=/etc
- make
-}
-
-check() {
- cd "${srcdir}/${pkgname}-${pkgver}-stable"
- make check
-}
-
-package() {
- cd "${srcdir}/${pkgname}-${pkgver}-stable"
- make DESTDIR="${pkgdir}" install
-}
diff --git a/testing/links/PKGBUILD b/testing/links/PKGBUILD
deleted file mode 100644
index 95a4a05cd..000000000
--- a/testing/links/PKGBUILD
+++ /dev/null
@@ -1,49 +0,0 @@
-# $Id: PKGBUILD 126520 2011-06-06 04:11:26Z eric $
-# Maintainer: Eric Bélanger <eric@archlinux.org>
-
-pkgname=links
-pkgver=2.3pre2
-pkgrel=1
-pkgdesc="A text WWW browser, similar to Lynx"
-arch=('i686' 'x86_64')
-url="http://links.twibright.com/"
-license=('GPL')
-depends=('bzip2' 'zlib' 'openssl' 'gpm')
-makedepends=('libtiff' 'libpng' 'libxt')
-optdepends=('libx11: for using xlinks' 'libtiff: for using xlinks' 'libpng: for using xlinks')
-provides=('links-g')
-conflicts=('links-g')
-replaces=('links-g')
-source=(http://links.twibright.com/download/${pkgname}-${pkgver}.tar.bz2 links.desktop)
-md5sums=('4a6970d54f4a9c64b8cf5d83a5815c45'
- '7c47b15aaef51f1de129ff3a2afb7eac')
-sha1sums=('5bc210f746559725565bec1d4748b5c56b263ee5'
- 'f600e27c2a71184444f7dd07a10230aa44463a02')
-
-build() {
- cd "${srcdir}/${pkgname}-${pkgver}"
- (cd intl; ./gen-intl; ./synclang)
- ./configure --prefix=/usr --mandir=/usr/share/man --enable-javascript \
- --enable-graphics --with-x --with-fb
- make
- mv links xlinks
-
- ./configure --prefix=/usr --mandir=/usr/share/man --enable-javascript \
- --disable-graphics --without-x --without-fb
- make
-}
-
-package() {
- cd "${srcdir}/${pkgname}-${pkgver}"
- make DESTDIR="${pkgdir}" install
-
- install -m755 xlinks "${pkgdir}/usr/bin/xlinks"
- ln -s links.1.gz "${pkgdir}/usr/share/man/man1/xlinks.1.gz"
-
- install -D -m644 "${srcdir}/links.desktop" "${pkgdir}/usr/share/applications/links.desktop"
- install -d "${pkgdir}/usr/share/pixmaps"
- install -m644 links_16x16_1.xpm links_16x16_2.xpm links_32x32.xpm "${pkgdir}/usr/share/pixmaps/"
-
- install -d "${pkgdir}/usr/share/doc/links/calibration"
- install -m644 doc/links_cal/* "${pkgdir}/usr/share/doc/links/calibration/"
-}
diff --git a/testing/links/links.desktop b/testing/links/links.desktop
deleted file mode 100644
index 9d6338a5b..000000000
--- a/testing/links/links.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Name=Links
-Exec=xlinks -g
-Icon=links_32x32.xpm
-Type=Application
-Terminal=false
-Categories=Network;WebBrowser;
diff --git a/testing/lirc/PKGBUILD b/testing/lirc/PKGBUILD
deleted file mode 100644
index e5c346ebb..000000000
--- a/testing/lirc/PKGBUILD
+++ /dev/null
@@ -1,103 +0,0 @@
-# $Id: PKGBUILD 126857 2011-06-08 09:51:14Z jgc $
-# Maintainer: Paul Mattal <paul@archlinux.org>
-
-pkgbase=lirc
-pkgname=('lirc' 'lirc-utils')
-pkgver=0.9.0
-pkgrel=3
-epoch=1
-_kernver=2.6.39-ARCH
-arch=('i686' 'x86_64')
-url="http://www.lirc.org/"
-license=('GPL')
-makedepends=('help2man' 'kernel26-headers>=2.6.39' 'kernel26-headers<2.6.40' 'alsa-lib' 'libx11' 'libftdi' 'libirman' 'python')
-options=('!makeflags' '!strip')
-source=(http://prdownloads.sourceforge.net/${pkgbase}/${pkgbase}-${pkgver}.tar.bz2
- lirc_wpc8769l.patch
- lircd-handle-large-config.patch
- lirc_atiusb-kfifo.patch
- kernel-2.6.39.patch
- lircd lircmd lirc.logrotate lircd.conf irexec.conf irexecd)
-md5sums=('b232aef26f23fe33ea8305d276637086'
- '1cce37e18e3f6f46044abab29016d18f'
- 'b70cc9640505205446ec47b7d4779f38'
- '1f8b104a2365d9f93404b143f499059b'
- '087a7d102e1c96bf1179f38db2b0b237'
- '8d0e238dc0eda95e340fe570605da492'
- '85f7fdac55e5256967241864049bf5e9'
- '3deb02604b37811d41816e9b4385fcc3'
- '5b1f8c9cd788a39a6283f93302ce5c6e'
- 'f0c0ac930326168035f0c8e24357ae55'
- '69d099e6deedfa3c1ee2b6e82d9b8bfb')
-
-build() {
- cd "${srcdir}/lirc-${pkgver}"
- patch -Np1 -i "${srcdir}/lirc_wpc8769l.patch"
- patch -Np1 -i "${srcdir}/lircd-handle-large-config.patch"
- patch -Np1 -i "${srcdir}/lirc_atiusb-kfifo.patch"
- patch -Np1 -i "${srcdir}/kernel-2.6.39.patch"
-
- sed -i '/AC_PATH_XTRA/d' configure.ac
- sed -e 's/@X_CFLAGS@//g' \
- -e 's/@X_LIBS@//g' \
- -e 's/@X_PRE_LIBS@//g' \
- -e 's/@X_EXTRA_LIBS@//g' -i Makefile.am tools/Makefile.am
- libtoolize
- autoreconf
-
- PYTHON=python2 ./configure --enable-sandboxed --prefix=/usr \
- --with-driver=all --with-kerneldir=/usr/src/linux-${_kernver}/ \
- --with-moduledir=/lib/modules/${_kernver}/kernel/drivers/misc \
- --with-transmitter
-
- # Remove drivers already in kernel
- sed -e "s:lirc_dev::" -e "s:lirc_bt829::" -e "s:lirc_igorplugusb::" \
- -e "s:lirc_imon::" -e "s:lirc_parallel::" -e "s:lirc_sasem::" \
- -e "s:lirc_serial::" -e "s:lirc_sir::" -e "s:lirc_ttusbir::" \
- -i Makefile drivers/Makefile drivers/*/Makefile tools/Makefile
- make
-}
-
-package_lirc() {
- pkgdesc="Linux Infrared Remote Control kernel modules for stock arch kernel"
- depends=('lirc-utils' 'kernel26>=2.6.39' 'kernel26<2.6.40')
- replaces=('lirc+pctv')
- install=lirc.install
-
- cd "${srcdir}/lirc-${pkgver}/drivers"
- make DESTDIR="${pkgdir}" install
-
- # set the kernel we've built for inside the install script
- sed -i -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" "${startdir}/lirc.install"
- # gzip -9 modules
- find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
-}
-
-package_lirc-utils() {
- pkgdesc="Linux Infrared Remote Control utils"
- depends=('alsa-lib' 'libx11' 'libftdi' 'libirman')
- optdepends=('python2: pronto2lirc utility')
- options=('strip' '!libtool')
- backup=('etc/conf.d/lircd.conf' 'etc/conf.d/irexec.conf')
-
- cd "${srcdir}/lirc-${pkgver}"
- make DESTDIR="${pkgdir}" install
- install -d "${pkgdir}/usr/share/lirc" "${pkgdir}/etc/rc.d"
- cp "${srcdir}"/{lircd,lircmd,irexecd} "${pkgdir}/etc/rc.d"
- cp -rp remotes "${pkgdir}/usr/share/lirc"
- chmod -R go-w "${pkgdir}/usr/share/lirc/"
-
- # install the logrotate config
- install -Dm644 "${srcdir}/lirc.logrotate" "${pkgdir}/etc/logrotate.d/lirc"
-
- # install conf.d file
- install -Dm644 "${srcdir}/lircd.conf" "${pkgdir}/etc/conf.d/lircd.conf"
-
- # install conf.d file
- install -Dm644 "${srcdir}/irexec.conf" "${pkgdir}/etc/conf.d/irexec.conf"
-
- install -d "${pkgdir}/etc/lirc"
-
- # remove built modules
- rm -r "${pkgdir}/lib/"
-}
diff --git a/testing/lirc/irexec.conf b/testing/lirc/irexec.conf
deleted file mode 100644
index f911c7515..000000000
--- a/testing/lirc/irexec.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Parameters for irexec daemon (path to lircrc)
-#
-
-IREXEC_OPTS="" \ No newline at end of file
diff --git a/testing/lirc/irexecd b/testing/lirc/irexecd
deleted file mode 100755
index a64b033a5..000000000
--- a/testing/lirc/irexecd
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-. /etc/conf.d/irexec.conf
-
-PID=`pidof -o %PPID /usr/bin/irexec`
-case "$1" in
- start)
- stat_busy "Starting IREXEC Daemon"
- [ -z "$PID" ] && /usr/bin/irexec --daemon $IREXEC_OPTS
- if [ $? -gt 0 ]; then
- stat_fail
- else
- add_daemon irexecd
- stat_done
- fi
- ;;
- stop)
- stat_busy "Stopping IREXEC Daemon"
- [ ! -z "$PID" ] && kill $PID &> /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon irexecd
- stat_done
- fi
- ;;
- restart)
- $0 stop
- sleep 1
- $0 start
- ;;
- *)
- echo "usage: $0 {start|stop|restart}"
-esac
-exit 0
-
diff --git a/testing/lirc/kernel-2.6.39.patch b/testing/lirc/kernel-2.6.39.patch
deleted file mode 100644
index 7353d61ca..000000000
--- a/testing/lirc/kernel-2.6.39.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-diff -ru lirc-0.9.0/drivers//lirc_atiusb/lirc_atiusb.c lirc-0.9.0.new/drivers//lirc_atiusb/lirc_atiusb.c
---- lirc-0.9.0/drivers//lirc_atiusb/lirc_atiusb.c 2011-03-25 23:28:18.000000000 +0100
-+++ lirc-0.9.0.new/drivers//lirc_atiusb/lirc_atiusb.c 2011-06-07 17:02:20.356580306 +0200
-@@ -48,7 +48,6 @@
- #include <linux/slab.h>
- #include <linux/module.h>
- #include <linux/kmod.h>
--#include <linux/smp_lock.h>
- #include <linux/completion.h>
- #include <linux/uaccess.h>
- #include <linux/usb.h>
-diff -ru lirc-0.9.0/drivers//lirc_i2c/lirc_i2c.c lirc-0.9.0.new/drivers//lirc_i2c/lirc_i2c.c
---- lirc-0.9.0/drivers//lirc_i2c/lirc_i2c.c 2011-03-25 23:28:18.000000000 +0100
-+++ lirc-0.9.0.new/drivers//lirc_i2c/lirc_i2c.c 2011-06-07 17:04:19.725933627 +0200
-@@ -555,8 +555,8 @@
- kfree(ir);
- return -EINVAL;
- }
-- printk(KERN_INFO "lirc_i2c: chip 0x%x found @ 0x%02x (%s)\n",
-- adap->id, addr, ir->c.name);
-+ printk(KERN_INFO "lirc_i2c: chip found @ 0x%02x (%s)\n",
-+ addr, ir->c.name);
-
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
- /* register device */
-diff -ru lirc-0.9.0/drivers//lirc_wpc8769l/lirc_wpc8769l.c lirc-0.9.0.new/drivers//lirc_wpc8769l/lirc_wpc8769l.c
---- lirc-0.9.0/drivers//lirc_wpc8769l/lirc_wpc8769l.c 2011-03-25 23:28:18.000000000 +0100
-+++ lirc-0.9.0.new/drivers//lirc_wpc8769l/lirc_wpc8769l.c 2011-06-07 17:07:23.984935411 +0200
-@@ -361,14 +361,14 @@
- size = count << 3;
-
- ldata = (unsigned long *) data_buf;
-- next_one = generic_find_next_le_bit(ldata, size, 0);
-+ next_one = find_next_zero_bit_le(ldata, size, 0);
-
- if (next_one > 0)
- put_pulse_bit(next_one
- * WPC8769L_USECS_PER_BIT);
-
- while (next_one < size) {
-- next_zero = generic_find_next_zero_le_bit(ldata,
-+ next_zero = find_next_zero_bit_le(ldata,
- size, next_one + 1);
-
- put_space_bit(
-@@ -376,7 +376,7 @@
- * WPC8769L_USECS_PER_BIT);
-
- if (next_zero < size) {
-- next_one = generic_find_next_le_bit(ldata,
-+ next_one = find_next_bit_le(ldata,
- size, next_zero + 1);
-
- put_pulse_bit(
diff --git a/testing/lirc/lirc.install b/testing/lirc/lirc.install
deleted file mode 100644
index 26fb1391e..000000000
--- a/testing/lirc/lirc.install
+++ /dev/null
@@ -1,16 +0,0 @@
-KERNEL_VERSION=2.6.39-ARCH
-
-post_install() {
- # updating module dependencies
- echo ">>> Updating module dependencies. Please wait ..."
- depmod $KERNEL_VERSION > /dev/null 2>&1
-}
-
-post_upgrade() {
- post_install
-}
-
-# arg 1: the old package version
-post_remove() {
- post_install
-}
diff --git a/testing/lirc/lirc.logrotate b/testing/lirc/lirc.logrotate
deleted file mode 100644
index 623c4f328..000000000
--- a/testing/lirc/lirc.logrotate
+++ /dev/null
@@ -1,5 +0,0 @@
-/var/log/lircd {
- missingok
- notifempty
- delaycompress
-}
diff --git a/testing/lirc/lirc_atiusb-kfifo.patch b/testing/lirc/lirc_atiusb-kfifo.patch
deleted file mode 100644
index a64984dce..000000000
--- a/testing/lirc/lirc_atiusb-kfifo.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From ec3c5660e67c122e2d5eb9cfa838c9709fccf8e0 Mon Sep 17 00:00:00 2001
-From: Jason Martin <publicmsu@gmail.com>
-Date: Fri, 3 Jun 2011 00:12:51 -0400
-Subject: [PATCH] lirc_atiusb: fix buffer alloc to work with new kfifo
-
-I came across posts with regards to lirc_atiusb and its compatibility
-with newer kernels, and their use of kfifo.I spent a little bit of time
-this evening, and was able to correct the issues with the driver, and
-now have a functioning lirc_atiusb device under the 2.6.38 kernel.
-
-Signed-off-by: Jarod Wilson <jarod@redhat.com>
----
- drivers/lirc_atiusb/lirc_atiusb.c | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/drivers/lirc_atiusb/lirc_atiusb.c b/drivers/lirc_atiusb/lirc_atiusb.c
-index 52080de..bf2b631 100644
---- a/drivers/lirc_atiusb/lirc_atiusb.c
-+++ b/drivers/lirc_atiusb/lirc_atiusb.c
-@@ -1048,7 +1048,7 @@ static struct atirf_dev *new_irctl(struct usb_interface *intf)
- goto new_irctl_failure_check;
- }
-
-- if (lirc_buffer_init(driver->rbuf, dclen, 1)) {
-+ if (lirc_buffer_init(driver->rbuf, dclen, 2)) {
- mem_failure = 4;
- goto new_irctl_failure_check;
- }
---
-1.7.0.1
-
diff --git a/testing/lirc/lirc_wpc8769l.patch b/testing/lirc/lirc_wpc8769l.patch
deleted file mode 100644
index e4e2a049b..000000000
--- a/testing/lirc/lirc_wpc8769l.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-From 413e83bf504fe9a9a177f27742220cfcb184b034 Mon Sep 17 00:00:00 2001
-From: =?utf8?q?Juan=20Jes=C3=BAs=20Garc=C3=ADa=20de=20Soria=20Lucena?= <skandalfo@gmail.com>
-Date: Wed, 30 Mar 2011 16:46:35 -0400
-Subject: [PATCH] Make lirc_wpc8769l functional again
-
-Signed-off-by: Jarod Wilson <jarod@redhat.com>
----
- drivers/lirc_wpc8769l/lirc_wpc8769l.c | 28 +++++++++++++++++-----------
- 1 files changed, 17 insertions(+), 11 deletions(-)
-
-diff --git a/drivers/lirc_wpc8769l/lirc_wpc8769l.c b/drivers/lirc_wpc8769l/lirc_wpc8769l.c
-index f820d11..4d04063 100644
---- a/drivers/lirc_wpc8769l/lirc_wpc8769l.c
-+++ b/drivers/lirc_wpc8769l/lirc_wpc8769l.c
-@@ -816,10 +816,6 @@ static int set_use_inc(void *data)
- /* Reset last timeout value. */
- lastus = 0;
-
-- /* Init the read buffer. */
-- if (lirc_buffer_init(&rbuf, sizeof(lirc_t), RBUF_LEN) < 0)
-- return -ENOMEM;
--
- /* Acquire the IRQ. */
- result = request_irq(irq, irq_handler,
- IRQF_DISABLED | IRQF_SHARED,
-@@ -863,9 +859,6 @@ static void set_use_dec(void *data)
- /* Free the IRQ. */
- free_irq(irq, THIS_MODULE);
- dprintk("Freed IRQ %d\n", irq);
--
-- /* Free the RX buffer. */
-- lirc_buffer_free(&rbuf);
- }
-
- static struct lirc_driver driver = {
-@@ -1065,19 +1058,29 @@ static int __init lirc_wpc8769l_module_init(void)
- /* Do load-time checks. */
- wpc8769l_power_up_and_check_if_we_woke_us_up();
-
-+ /* Init the read buffer. */
-+ if (lirc_buffer_init(&rbuf, sizeof(lirc_t), RBUF_LEN) < 0) {
-+ rc = -ENOMEM;
-+ goto exit_platform_exit;
-+ }
-+
- /* Configure the driver hooks. */
- driver.features = LIRC_CAN_REC_MODE2;
-+ driver.dev = &lirc_wpc8769l_platform_dev->dev;
- driver.minor = lirc_register_driver(&driver);
- if (driver.minor < 0) {
- eprintk("lirc_register_driver failed!\n");
- rc = -EIO;
-- goto exit_platform_exit;
-+ goto exit_release_buffer;
- }
-
- iprintk("Driver loaded.\n");
-
- return 0; /* Everything OK. */
-
-+exit_release_buffer:
-+ lirc_buffer_free(&rbuf);
-+
- exit_platform_exit:
- lirc_wpc8769l_platform_exit();
-
-@@ -1095,12 +1098,15 @@ module_init(lirc_wpc8769l_module_init);
-
- static void __exit lirc_wpc8769l_module_exit(void)
- {
-- /* Unregister the platform driver and device. */
-- lirc_wpc8769l_platform_exit();
--
- /* Unregister the LIRC driver. */
- lirc_unregister_driver(driver.minor);
-
-+ /* Free the buffer. */
-+ lirc_buffer_free(&rbuf);
-+
-+ /* Unregister the platform driver and device. */
-+ lirc_wpc8769l_platform_exit();
-+
- /* Release the second range. */
- if (baseport2)
- release_region(baseport2, WPC8769L_IO_REGION_2_SIZE);
---
-1.7.0.1
-
diff --git a/testing/lirc/lircd b/testing/lirc/lircd
deleted file mode 100755
index e9739b36e..000000000
--- a/testing/lirc/lircd
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-. /etc/conf.d/lircd.conf
-
-PID=$(pidof -o %PPID /usr/sbin/lircd)
-LIRCD_SYMLINKFILE=/dev/lircd
-LIRCD_SOCKET=/var/run/lirc/lircd
-case "$1" in
- start)
- stat_busy "Starting LIRC Daemon"
- [ ! -d /var/run/lirc ] && install -d /var/run/lirc &>/dev/null
- rm -f $LIRCD_SOCKET && ln -s $LIRCD_SOCKET $LIRCD_SYMLINKFILE
- if [ $? -ne 0 ]; then
- stat_fail
- exit 0
- fi
- [ -n "$LIRC_DRIVER" ] && LIRC_EXTRAOPTS="-H $LIRC_DRIVER $LIRC_EXTRAOPTS"
- [ -z "$PID" ] &&
- if [ -n "$LIRC_DEVICE" ] ; then
- eval /usr/sbin/lircd -d "$LIRC_DEVICE" $LIRC_EXTRAOPTS $LIRC_CONFIGFILE
- else
- /usr/sbin/lircd $LIRC_EXTRAOPTS $LIRC_CONFIGFILE
- fi
- if [ $? -gt 0 ]; then
- stat_fail
- else
- add_daemon lircd
- stat_done
- fi
- ;;
- stop)
- stat_busy "Stopping LIRC Daemon"
- rm -f $LIRCD_SYMLINKFILE
- [ ! -z "$PID" ] && kill $PID &> /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon lircd
- stat_done
- fi
- ;;
- restart)
- $0 stop
- sleep 1
- $0 start
- ;;
- *)
- echo "usage: $0 start|stop|restart"
-esac
-exit 0
diff --git a/testing/lirc/lircd-handle-large-config.patch b/testing/lirc/lircd-handle-large-config.patch
deleted file mode 100644
index 85bc20518..000000000
--- a/testing/lirc/lircd-handle-large-config.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 5efb56bf22a5077db564c766ba7cc37bc269231d Mon Sep 17 00:00:00 2001
-From: Jarod Wilson <jarod@redhat.com>
-Date: Wed, 6 Apr 2011 11:04:12 -0400
-Subject: [PATCH] lircd: handle larger config files in write_socket better
-
-Pointed out by Michael Zanetti on list, irsend LIST has issues with long
-config files, which didn't exist in maintainer mode, as we were using a
-do while loop to make sure we spit out everything. Just use that loop
-all the time.
-
-Signed-off-by: Jarod Wilson <jarod@redhat.com>
----
- daemons/lircd.c | 8 ++------
- 1 files changed, 2 insertions(+), 6 deletions(-)
-
-diff --git a/daemons/lircd.c b/daemons/lircd.c
-index 6c21a3a..ddcca05 100644
---- a/daemons/lircd.c
-+++ b/daemons/lircd.c
-@@ -231,14 +231,10 @@ inline int write_socket(int fd, const char *buf, int len)
- int done, todo = len;
-
- while (todo) {
--#ifdef SIM_REC
- do {
- done = write(fd, buf, todo);
-- }
-- while (done < 0 && errno == EAGAIN);
--#else
-- done = write(fd, buf, todo);
--#endif
-+ } while (done < 0 && errno == EAGAIN);
-+
- if (done <= 0)
- return (done);
- buf += done;
---
-1.7.0.1
-
diff --git a/testing/lirc/lircd.conf b/testing/lirc/lircd.conf
deleted file mode 100644
index 760dab065..000000000
--- a/testing/lirc/lircd.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Parameters for lirc daemon
-#
-
-LIRC_DEVICE="/dev/lirc0"
-LIRC_DRIVER=""
-LIRC_EXTRAOPTS=""
-LIRC_CONFIGFILE=""
diff --git a/testing/lirc/lircmd b/testing/lirc/lircmd
deleted file mode 100755
index 220c47c9c..000000000
--- a/testing/lirc/lircmd
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PID=`pidof -o %PPID /usr/sbin/lircmd`
-case "$1" in
- start)
- stat_busy "Starting lircmd Daemon"
- [ -z "$PID" ] && /usr/sbin/lircmd
- if [ $? -gt 0 ]; then
- stat_fail
- else
- add_daemon lircmd
- stat_done
- fi
- ;;
- stop)
- stat_busy "Stopping lircmd Daemon"
- [ ! -z "$PID" ] && kill $PID &> /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon lircmd
- stat_done
- fi
- ;;
- restart)
- $0 stop
- sleep 1
- $0 start
- ;;
- *)
- echo "usage: $0 {start|stop|restart}"
-esac
-exit 0
diff --git a/testing/moc/PKGBUILD b/testing/moc/PKGBUILD
deleted file mode 100644
index 535afc1a5..000000000
--- a/testing/moc/PKGBUILD
+++ /dev/null
@@ -1,44 +0,0 @@
-# $Id: PKGBUILD 126916 2011-06-08 17:30:45Z eric $
-# Maintainer: Eric Bélanger <eric@archlinux.org>
-
-pkgname=moc
-pkgver=20110528
-pkgrel=2
-pkgdesc="An ncurses console audio player with support for the mp3, ogg, and wave formats"
-arch=('i686' 'x86_64')
-url="http://moc.daper.net/"
-license=('GPL')
-depends=('libmad' 'libid3tag' 'jack' 'curl' 'libsamplerate' 'libtool' 'file')
-makedepends=('speex' 'ffmpeg' 'taglib' 'libmpcdec' 'wavpack' 'libmodplug')
-optdepends=('speex: for using the speex plugin'
- 'ffmpeg: for using the ffmpeg plugin'
- 'taglib: for using the musepack plugin'
- 'libmpcdec: for using the musepack plugin'
- 'wavpack: for using the wavpack plugin'
- 'libmodplug: for using the modplug plugin')
-options=('!libtool')
-source=(ftp://ftp.archlinux.org/other/moc/${pkgname}-${pkgver}.tar.xz \
- gcc-undefined-symbols.diff)
-md5sums=('003fd01af2165264eb666040e4f586cd'
- 'efacb8559e9145e15b0c25f8fa2a9d79')
-sha1sums=('f79049136ce6616bfd6af2f5e08246a5921441cf'
- 'a811a4ac7e049914aab528d3f06a6be6634c2720')
-
-build() {
- cd "${srcdir}/${pkgname}"
- patch -p0 -i ../gcc-undefined-symbols.diff
-
-# Disabling aac to use the external ffmpeg to play them (FS#13164)
- ./autogen.sh
- ./configure --prefix=/usr --without-rcc --without-aac \
- --with-oss --with-alsa --with-jack --with-mp3 \
- --with-musepack --with-vorbis --with-flac --with-wavpack \
- --with-sndfile --with-modplug --with-ffmpeg --with-speex \
- --with-samplerate --with-curl --disable-debug
- make
-}
-
-package() {
- cd "${srcdir}/${pkgname}"
- make DESTDIR="${pkgdir}" install
-}
diff --git a/testing/moc/gcc-undefined-symbols.diff b/testing/moc/gcc-undefined-symbols.diff
deleted file mode 100644
index 09e9b8bda..000000000
--- a/testing/moc/gcc-undefined-symbols.diff
+++ /dev/null
@@ -1,12 +0,0 @@
---- decoder.c~ 2011-05-08 09:28:28.077137883 +0200
-+++ decoder.c 2011-05-10 21:40:48.887941968 +0200
-@@ -259,6 +259,9 @@
- for (i = 0; i < plugins_num; i++)
- if (plugins[i].decoder->destroy)
- plugins[i].decoder->destroy ();
-+ for (i = 0; i < plugins_num; i++)
-+ if (plugins[i].handle)
-+ lt_dlclose(plugins[i].handle);
-
- if (lt_dlexit())
- logit ("lt_exit() failed: %s", lt_dlerror());
diff --git a/testing/mpd/PKGBUILD b/testing/mpd/PKGBUILD
deleted file mode 100644
index acdf209ef..000000000
--- a/testing/mpd/PKGBUILD
+++ /dev/null
@@ -1,56 +0,0 @@
-# $Id: PKGBUILD 127604 2011-06-16 17:50:00Z angvp $
-# Maintainer: Angel Velasquez <angvp@archlinux.org>
-# Contributor: Andrea Scarpino <andrea@archlinux.org>
-# Contributor: Damir Perisa <damir.perisa@bluewin.ch>
-# Contributor: Ben <ben@benmazer.net>
-
-pkgname=mpd
-pkgver=0.16.3
-pkgrel=1
-pkgdesc="Music daemon that plays MP3, FLAC, and Ogg Vorbis files"
-arch=('i686' 'x86_64')
-license=('GPL')
-url="http://mpd.wikia.com/wiki/Server"
-depends=('libao' 'ffmpeg' 'libmodplug' 'audiofile' 'libshout' 'libmad' 'curl' 'faad2'
- 'sqlite3' 'jack' 'libmms' 'wavpack' 'libmpcdec' 'avahi' 'libid3tag'
- 'libpulse')
-makedepends=('pkgconfig' 'doxygen')
-install=${pkgname}.install
-source=("http://downloads.sourceforge.net/musicpd/${pkgname}-${pkgver}.tar.bz2"
- 'mpd')
-md5sums=('6e708c02b0e8c288aec855eecf441a5a'
- 'e5669c2bff4031928531e52475addeb1')
-
-build() {
- cd ${srcdir}/${pkgname}-${pkgver}
- ./configure --prefix=/usr \
- --sysconfdir=/etc \
- --enable-lastfm \
- --enable-jack \
- --enable-pulse \
- --enable-documentation \
- --disable-libwrap \
- --disable-cue \
- --disable-sidplay
- make
-}
-
-package() {
- cd ${srcdir}/${pkgname}-${pkgver}
- make DESTDIR=${pkgdir} install
-
- # set ours dirs in mpd.conf file
- sed -i 's|^music_directory.*$|#music_directory "path_to_your_music_collection"|1' doc/mpdconf.example
- sed -i 's|playlist_directory.*$|playlist_directory "/var/lib/mpd/playlists"|1' doc/mpdconf.example
- sed -i 's|db_file.*$|db_file "/var/lib/mpd/mpd.db"|1' doc/mpdconf.example
- sed -i 's|log_file.*$|log_file "/var/log/mpd/mpd.log"|1' doc/mpdconf.example
- sed -i 's|error_file.*$|error_file "/var/log/mpd/mpd.error"|1' doc/mpdconf.example
- sed -i 's|#pid_file.*$|pid_file "/var/run/mpd/mpd.pid"|1' doc/mpdconf.example
- sed -i 's|#state_file.*$|state_file "/var/lib/mpd/mpdstate"|1' doc/mpdconf.example
- sed -i 's|#user.*$|user "mpd"|1' doc/mpdconf.example
-
- install -Dm644 doc/mpdconf.example ${pkgdir}/usr/share/mpd/mpd.conf.example
-
- install -Dm755 ${srcdir}/mpd ${pkgdir}/etc/rc.d/mpd
- install -d ${pkgdir}/var/{lib/mpd/playlists,log/mpd}
-}
diff --git a/testing/mpd/mpd b/testing/mpd/mpd
deleted file mode 100755
index 6134e2ed4..000000000
--- a/testing/mpd/mpd
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-case "$1" in
- start)
- stat_busy "Starting Music Player Daemon"
- [ ! -d /var/run/mpd ] && install -d -g 45 -o 45 /var/run/mpd
- /usr/bin/mpd /etc/mpd.conf &> /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
- add_daemon mpd
- stat_done
- fi
- ;;
- stop)
- stat_busy "Stopping Music Player Daemon"
- /usr/bin/mpd --kill /etc/mpd.conf &> /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon mpd
- stat_done
- fi
- ;;
- restart)
- $0 stop
- sleep 1
- $0 start
- ;;
- *)
- echo "usage: $0 {start|stop|restart}"
-esac
-exit 0
diff --git a/testing/mpd/mpd.install b/testing/mpd/mpd.install
deleted file mode 100644
index 885505a07..000000000
--- a/testing/mpd/mpd.install
+++ /dev/null
@@ -1,18 +0,0 @@
-post_install() {
- post_upgrade
- echo "==> Create a configuration file /etc/mpd.conf before using MPD (example: /usr/share/mpd/mpd.conf.example)"
-}
-
-post_upgrade() {
- getent group "mpd" &>/dev/null || groupadd -r -g 45 mpd 1>/dev/null
- getent passwd "mpd" &>/dev/null || useradd -r -u 45 -g mpd -d "/var/lib/mpd" -s "/bin/true" -G "audio" mpd 1>/dev/null
- for dir in /var/{lib,log}/mpd; do
- chown -R mpd:mpd "$dir" 1>/dev/null
- done
-}
-
-post_remove() {
- getent passwd "mpd" &>/dev/null && userdel mpd 1>/dev/null
- getent group "mpd" &>/dev/null && groupdel mpd 1>/dev/null
- [ -f etc/mpd.conf ] && mv etc/mpd.conf etc/mpd.conf.pacsave 1>/dev/null
-}
diff --git a/testing/net-tools/PKGBUILD b/testing/net-tools/PKGBUILD
deleted file mode 100644
index 6a81124ea..000000000
--- a/testing/net-tools/PKGBUILD
+++ /dev/null
@@ -1,44 +0,0 @@
-# $Id: PKGBUILD 127037 2011-06-10 00:48:19Z bisson $
-# Maintainer: judd <jvinet@zeroflux.org>
-pkgname=net-tools
-pkgver=1.60
-pkgrel=18
-pkgdesc="Configuration tools for Linux networking"
-arch=(i686 x86_64)
-license=('GPL')
-url="http://www.tazenda.demon.co.uk/phil/net-tools"
-depends=('glibc')
-source=(http://www.tazenda.demon.co.uk/phil/$pkgname/$pkgname-$pkgver.tar.bz2
- net-tools.patch gcc340.patch net-tools-1.60-2.6-compilefix.patch
- net-tools-1.60-miiioctl.patch
- net-tools-1.60-nameif.patch
- net-tools-1.60-nameif_strncpy.patch)
-options=(!makeflags)
-install=net-tools.install
-
-build() {
- cd $srcdir/$pkgname-$pkgver
- patch -Np1 -i ../net-tools.patch
- patch -Np1 -i ../net-tools-1.60-2.6-compilefix.patch
- patch -Np1 -i ../net-tools-1.60-miiioctl.patch
- patch -Np1 -i ../gcc340.patch
- patch -Np1 -i ${srcdir}/net-tools-1.60-nameif.patch
- patch -Np1 -i ${srcdir}/net-tools-1.60-nameif_strncpy.patch
- yes "" | make
-}
-
-package() {
- cd $srcdir/$pkgname-$pkgver
- make BASEDIR=$pkgdir update
-
- # the following is provided by yp-tools
- rm "${pkgdir}"/bin/{nis,yp}domainname
- rm "${pkgdir}"/usr/share/man/man1/{nis,yp}domainname.1
-}
-md5sums=('888774accab40217dde927e21979c165'
- '7ef8d0c6818faa0fdeea94970a20e3fb'
- 'b52d899cba9956bb0055150506f41ac1'
- '51de6eabe2d6d6dc860f72c41cee636b'
- 'c16109863bc63f3dad4ef35305a340bb'
- '29a32617382fab1735acba4d920f1fcd'
- 'e66466b9304dac85eb42b32f1ec3b284')
diff --git a/testing/net-tools/gcc340.patch b/testing/net-tools/gcc340.patch
deleted file mode 100644
index 8089bf217..000000000
--- a/testing/net-tools/gcc340.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-diff -Naur net-tools-1.60-orig/hostname.c net-tools-1.60/hostname.c
---- net-tools-1.60-orig/hostname.c 2001-04-08 10:04:23.000000000 -0700
-+++ net-tools-1.60/hostname.c 2004-05-07 17:22:14.000000000 -0700
-@@ -78,6 +78,7 @@
- fprintf(stderr, _("%s: name too long\n"), program_name);
- break;
- default:
-+ ;
- }
- exit(1);
- }
-@@ -98,6 +99,7 @@
- fprintf(stderr, _("%s: name too long\n"), program_name);
- break;
- default:
-+ ;
- }
- exit(1);
- };
-@@ -117,6 +119,7 @@
- fprintf(stderr, _("%s: name too long\n"), program_name);
- break;
- default:
-+ ;
- }
- exit(1);
- };
-@@ -174,6 +177,7 @@
- printf("%s\n", hp->h_name);
- break;
- default:
-+ ;
- }
- }
-
-diff -Naur net-tools-1.60-orig/lib/inet_sr.c net-tools-1.60/lib/inet_sr.c
---- net-tools-1.60-orig/lib/inet_sr.c 2000-02-20 13:46:45.000000000 -0800
-+++ net-tools-1.60/lib/inet_sr.c 2004-05-07 17:20:14.000000000 -0700
-@@ -105,6 +105,7 @@
- case 2:
- isnet = 0; break;
- default:
-+ ;
- }
-
- /* Fill in the other fields. */
diff --git a/testing/net-tools/net-tools-1.60-2.6-compilefix.patch b/testing/net-tools/net-tools-1.60-2.6-compilefix.patch
deleted file mode 100644
index 92ce90128..000000000
--- a/testing/net-tools/net-tools-1.60-2.6-compilefix.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-diff -ruN net-tools-1.60.orig/lib/x25_sr.c net-tools-1.60/lib/x25_sr.c
---- net-tools-1.60.orig/lib/x25_sr.c 2000-05-20 15:38:10.000000000 +0200
-+++ net-tools-1.60/lib/x25_sr.c 2003-10-18 20:33:31.927574928 +0200
-@@ -22,6 +22,7 @@
- #include <sys/socket.h>
- #include <sys/ioctl.h>
- #include <linux/x25.h>
-+#include <linux/version.h>
- #include <ctype.h>
- #include <errno.h>
- #include <netdb.h>
-@@ -77,7 +78,11 @@
- rt.sigdigits=sigdigits;
-
- /* x25_route_struct.address isn't type struct sockaddr_x25, Why? */
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
- memcpy(&rt.address, &sx25.sx25_addr, sizeof(x25_address));
-+#else
-+ memcpy(&rt.address, &sx25.sx25_addr, sizeof(struct x25_address));
-+#endif
-
- while (*args) {
- if (!strcmp(*args,"device") || !strcmp(*args,"dev")) {
diff --git a/testing/net-tools/net-tools-1.60-miiioctl.patch b/testing/net-tools/net-tools-1.60-miiioctl.patch
deleted file mode 100644
index 4859273ed..000000000
--- a/testing/net-tools/net-tools-1.60-miiioctl.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- net-tools-1.60/include/mii.h.bar Tue Jul 31 11:49:39 2001
-+++ net-tools-1.60/include/mii.h Tue Jul 31 11:49:33 2001
-@@ -11,11 +11,9 @@
-
- /* network interface ioctl's for MII commands */
- #ifndef SIOCGMIIPHY
--#define SIOCGMIIPHY (SIOCDEVPRIVATE) /* Read from current PHY */
--#define SIOCGMIIREG (SIOCDEVPRIVATE+1) /* Read any PHY register */
--#define SIOCSMIIREG (SIOCDEVPRIVATE+2) /* Write any PHY register */
--#define SIOCGPARAMS (SIOCDEVPRIVATE+3) /* Read operational parameters */
--#define SIOCSPARAMS (SIOCDEVPRIVATE+4) /* Set operational parameters */
-+#define SIOCGMIIPHY 0x8947 /* Read from current PHY */
-+#define SIOCGMIIREG 0x8948 /* Read any PHY register */
-+#define SIOCSMIIREG 0x8949 /* Write any PHY register */
- #endif
-
- #include <linux/types.h>
diff --git a/testing/net-tools/net-tools-1.60-nameif.patch b/testing/net-tools/net-tools-1.60-nameif.patch
deleted file mode 100644
index 54def00c2..000000000
--- a/testing/net-tools/net-tools-1.60-nameif.patch
+++ /dev/null
@@ -1,58 +0,0 @@
---- net-tools-1.60/nameif.c.nameif 2000-10-18 19:26:29.000000000 +0200
-+++ net-tools-1.60/nameif.c 2003-03-19 11:02:01.000000000 +0100
-@@ -117,7 +117,8 @@
- }
-
- struct change {
-- struct change *next,**pprev;
-+ struct change *next;
-+ int found;
- char ifname[IFNAMSIZ+1];
- unsigned char mac[6];
- };
-@@ -139,10 +140,7 @@
- ch->ifname, pos);
- if (parsemac(p,ch->mac) < 0)
- complain(_("cannot parse MAC `%s' at %s"), p, pos);
-- if (clist)
-- clist->pprev = &ch->next;
- ch->next = clist;
-- ch->pprev = &clist;
- clist = ch;
- return 0;
- }
-@@ -200,7 +198,7 @@
-
- void usage(void)
- {
-- fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}"));
-+ fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n"));
- exit(1);
- }
-
-@@ -277,21 +275,21 @@
- ch = lookupmac(mac);
- if (!ch)
- continue;
--
-- *ch->pprev = ch->next;
-+
-+ ch->found = 1;
- if (strcmp(p, ch->ifname)) {
- if (setname(p, ch->ifname) < 0)
- complain(_("cannot change name of %s to %s: %s"),
- p, ch->ifname, strerror(errno));
- }
-- free(ch);
- }
- fclose(ifh);
-
- while (clist) {
- struct change *ch = clist;
- clist = clist->next;
-- warning(_("interface '%s' not found"), ch->ifname);
-+ if (!ch->found)
-+ warning(_("interface '%s' not found"), ch->ifname);
- free(ch);
- }
-
diff --git a/testing/net-tools/net-tools-1.60-nameif_strncpy.patch b/testing/net-tools/net-tools-1.60-nameif_strncpy.patch
deleted file mode 100644
index 7568e21a2..000000000
--- a/testing/net-tools/net-tools-1.60-nameif_strncpy.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- net-tools-1.60/nameif.c.ncpy 2006-10-03 14:24:21.000000000 +0200
-+++ net-tools-1.60/nameif.c 2006-10-03 14:22:43.000000000 +0200
-@@ -100,8 +100,8 @@
- struct ifreq ifr;
- opensock();
- memset(&ifr,0,sizeof(struct ifreq));
-- strcpy(ifr.ifr_name, oldname);
-- strcpy(ifr.ifr_newname, newname);
-+ strncpy(ifr.ifr_name, oldname, IF_NAMESIZE);
-+ strncpy(ifr.ifr_newname, newname, IF_NAMESIZE);
- return ioctl(ctl_sk, SIOCSIFNAME, &ifr);
- }
-
diff --git a/testing/net-tools/net-tools.install b/testing/net-tools/net-tools.install
deleted file mode 100644
index 9eee9e51b..000000000
--- a/testing/net-tools/net-tools.install
+++ /dev/null
@@ -1,12 +0,0 @@
-post_upgrade() {
- if [ "$(vercmp $2 1.60-16)" -lt 0 ]; then
- echo "hostname and {,yp,nis}domainname has moved:"
- echo "----------"
- echo "hostname is now in coreutils"
- echo "domainname is now in yp-tools"
- echo "their functionality might have changed slightly"
- echo ""
- echo "dnsdomainname remains in net-tools"
- echo "----------"
- fi
-}
diff --git a/testing/net-tools/net-tools.patch b/testing/net-tools/net-tools.patch
deleted file mode 100644
index 87e062eb2..000000000
--- a/testing/net-tools/net-tools.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-diff -Naur net-tools-1.60-orig/config.in net-tools-1.60/config.in
---- net-tools-1.60-orig/config.in 2000-05-21 07:32:12.000000000 -0700
-+++ net-tools-1.60/config.in 2004-05-31 12:36:00.000000000 -0700
-@@ -49,7 +49,7 @@
- *
- bool 'UNIX protocol family' HAVE_AFUNIX y
- bool 'INET (TCP/IP) protocol family' HAVE_AFINET y
--bool 'INET6 (IPv6) protocol family' HAVE_AFINET6 n
-+bool 'INET6 (IPv6) protocol family' HAVE_AFINET6 y
- bool 'Novell IPX/SPX protocol family' HAVE_AFIPX y
- bool 'Appletalk DDP protocol family' HAVE_AFATALK y
- bool 'AX25 (packet radio) protocol family' HAVE_AFAX25 y
-@@ -86,6 +86,6 @@
- *
- * Other Features.
- *
--bool 'IP Masquerading support' HAVE_FW_MASQUERADE n
--bool 'Build iptunnel and ipmaddr' HAVE_IP_TOOLS n
--bool 'Build mii-tool' HAVE_MII n
-+bool 'IP Masquerading support' HAVE_FW_MASQUERADE y
-+bool 'Build iptunnel and ipmaddr' HAVE_IP_TOOLS y
-+bool 'Build mii-tool' HAVE_MII y
-diff -Naur net-tools-1.60-orig/mii-tool.c net-tools-1.60/mii-tool.c
---- net-tools-1.60-orig/mii-tool.c 2000-05-21 07:31:17.000000000 -0700
-+++ net-tools-1.60/mii-tool.c 2004-05-31 12:35:21.000000000 -0700
-@@ -379,16 +379,16 @@
- /*--------------------------------------------------------------------*/
-
- const char *usage =
--"usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...]
-- -V, --version display version information
-- -v, --verbose more verbose output
-- -R, --reset reset MII to poweron state
-- -r, --restart restart autonegotiation
-- -w, --watch monitor for link status changes
-- -l, --log with -w, write events to syslog
-- -A, --advertise=media,... advertise only specified media
-- -F, --force=media force specified media technology
--media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,
-+"usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...]\n\
-+ -V, --version display version information\n\
-+ -v, --verbose more verbose output\n\
-+ -R, --reset reset MII to poweron state\n\
-+ -r, --restart restart autonegotiation\n\
-+ -w, --watch monitor for link status changes\n\
-+ -l, --log with -w, write events to syslog\n\
-+ -A, --advertise=media,... advertise only specified media\n\
-+ -F, --force=media force specified media technology\n\
-+media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,\n\
- (to advertise both HD and FD) 100baseTx, 10baseT\n";
-
- int main(int argc, char **argv)
diff --git a/testing/nouveau-drm-lts/COPYING b/testing/nouveau-drm-lts/COPYING
deleted file mode 100644
index 6e74c337c..000000000
--- a/testing/nouveau-drm-lts/COPYING
+++ /dev/null
@@ -1,48 +0,0 @@
- Copyright 2005 Adam Jackson.
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation on the rights to use, copy, modify, merge,
- publish, distribute, sub license, and/or sell copies of the Software,
- and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
-
- The above copyright notice and this permission notice (including the
- next paragraph) shall be included in all copies or substantial
- portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NON-INFRINGEMENT. IN NO EVENT SHALL ADAM JACKSON BE LIABLE FOR ANY
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-------------------------------------------------------------------------
-
- Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- All Rights Reserved.
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice (including the
- next paragraph) shall be included in all copies or substantial
- portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS
- SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
diff --git a/testing/nouveau-drm-lts/Makefile b/testing/nouveau-drm-lts/Makefile
deleted file mode 100644
index 123bc5339..000000000
--- a/testing/nouveau-drm-lts/Makefile
+++ /dev/null
@@ -1,102 +0,0 @@
-# This Makefile is loosely based on the drm.git/linux-core/Makefile and
-# the preliminary work by Christopher James Halse Rogers.
-# Edited by Pekka Paalanen <pq@iki.fi>
-
-# By default, the build is done against the running linux kernel source.
-# To build against a different kernel source tree, set LINUXDIR:
-#
-# make LINUXDIR=/path/to/kernel/source
-
-# By default, it is assumed the Nouveau kernel tree is found in $PWD/../.
-# To use a different path to the Nouveau kernel tree, set NOUVEAUROOTDIR:
-#
-# make NOUVEAUROOTDIR=/path/to/nouveau/linux-2.6
-
-
-ifndef LINUXDIR
-RUNNING_REL := $(shell uname -r)
-
-LINUXDIR := $(shell if [ -e /lib/modules/$(RUNNING_REL)/source ]; then \
- echo /lib/modules/$(RUNNING_REL)/source; \
- else echo /lib/modules/$(RUNNING_REL)/build; fi)
-endif
-
-NOUVEAUGITREMOTE ?= origin
-NOUVEAUROOTDIR ?= $(CURDIR)/..
-override NOUVEAUROOTDIR := $(abspath $(NOUVEAUROOTDIR))
-
-TESTFILE := include/drm/nouveau_drm.h
-ifeq ($(wildcard $(NOUVEAUROOTDIR)/$(TESTFILE)),)
-$(error $(NOUVEAUROOTDIR) does not look like the right kernel tree, \
- please set NOUVEAUROOTDIR)
-endif
-
-GIT_REVISION := $(shell GIT_DIR=$(NOUVEAUROOTDIR)/.git \
- git describe --always --abbrev=17 2> /dev/null)
-
-DRMINC := -I$(NOUVEAUROOTDIR)/include/drm
-DRMDIR := $(NOUVEAUROOTDIR)/drivers/gpu/drm
-DRMCFG := \
- CONFIG_DRM=m \
- CONFIG_DRM_KMS_HELPER=m \
- CONFIG_DRM_TTM=m \
- CONFIG_DRM_NOUVEAU=m \
- CONFIG_DRM_NOUVEAU_KMS=n \
- CONFIG_DRM_NOUVEAU_BACKLIGHT=y \
- CONFIG_DRM_NOUVEAU_DEBUG=y \
- CONFIG_DRM_I2C_CH7006=m \
- CONFIG_DRM_TDFX=n \
- CONFIG_DRM_R128=n \
- CONFIG_DRM_RADEON=n \
- CONFIG_DRM_MGA=n \
- CONFIG_DRM_I810=n \
- CONFIG_DRM_I830=n \
- CONFIG_DRM_I915=n \
- CONFIG_DRM_SIS=n \
- CONFIG_DRM_SAVAGE=n \
- CONFIG_DRM_VIA=n
-
-EXTRA_CFLAGS :=
-MYEXTRA_CFLAGS :=
-MYEXTRA_CFLAGS += -DCONFIG_DRM_NOUVEAU_BACKLIGHT
-MYEXTRA_CFLAGS += -DCONFIG_DRM_NOUVEAU_DEBUG
-
-ifneq ($(GIT_REVISION),)
-MYEXTRA_CFLAGS += '-DGIT_REVISION=\"$(GIT_REVISION)\"'
-endif
-
-MYPARMS := -C $(LINUXDIR) KCPPFLAGS="$(DRMINC)" SUBDIRS="$(DRMDIR)" $(DRMCFG)
-
-MYEXTRA_CFLAGS += $(EXTRA_CFLAGS)
-ifneq ($(MYEXTRA_CFLAGS),)
-MYPARMS += EXTRA_CFLAGS="$(MYEXTRA_CFLAGS)"
-endif
-
-.PHONY: all modules install clean archive FORCE
-
-all: modules
-FORCE:
-
-modules:
- $(MAKE) $(MYPARMS) modules
-
-install:
- $(MAKE) $(MYPARMS) modules_install
-
-clean:
- $(MAKE) $(MYPARMS) clean
-
-archive: newttm-devel-compat.tar.gz newttm-devel.tar.gz master.tar.gz
-
-newttm-devel-compat.tar.gz: EXTRAS=nouveau README-nouveau
-
-%.tar: FORCE
- GIT_DIR=$(NOUVEAUROOTDIR)/.git \
- git archive --format=tar --prefix=$*/ $(NOUVEAUGITREMOTE)/$* \
- drivers/gpu/drm include/drm $(EXTRAS) > $@
-
-%.tar.gz: %.tar
- gzip -9 -c $< > $@
-
-# The commit id of the archive can be read with
-# $ zcat foo.tar.gz | git get-tar-commit-id
diff --git a/testing/nouveau-drm-lts/PKGBUILD b/testing/nouveau-drm-lts/PKGBUILD
deleted file mode 100644
index 1284563f4..000000000
--- a/testing/nouveau-drm-lts/PKGBUILD
+++ /dev/null
@@ -1,47 +0,0 @@
-# $Id: PKGBUILD 126820 2011-06-07 13:57:50Z tpowa $
-# Maintainer: Andreas Radke <andyrtr@archlinux.org>
-# Contributor: buddabrod <buddabrod@gmail.com>
-
-pkgname=nouveau-drm-lts
-_snapdate=20100313
-pkgver=0.0.16_${_snapdate} # see master/drivers/gpu/drm/nouveau/nouveau_drv.h for version
-_kernver='2.6.32-lts'
-pkgrel=6
-pkgdesc="nvidia opensource X driver"
-arch=('i686' 'x86_64')
-url="http://nouveau.freedesktop.org/"
-depends=("kernel26-lts>=2.6.32" "kernel26-lts<2.6.33")
-makedepends=("kernel26-lts-headers>=2.6.32" "kernel26-lts-headers<2.6.33")
-# http://nouveau.freedesktop.org/wiki/InstallDRM#head-771a47a133fba6a5a70253656e76c61e9bff93bd
-optdepends=('nouveau-firmware: needed for very new card (NV50 family and above) to work properly where the OSS replacement does not work well')
-#makedepends=('git' 'autoconf' 'pkgconfig')
-install=nouveau-drm.install
-license=('GPL')
-options=('!strip')
-source=(ftp://ftp.archlinux.org/other/${pkgname/-lts//}/master-${_snapdate}.tar.gz
- # http://people.freedesktop.org/~pq/nouveau-drm/master.tar.gz
- # get the Makefile from http://cgit.freedesktop.org/nouveau/linux-2.6/plain/nouveau/Makefile?h=master-compat
- Makefile)
-md5sums=('ad7ad0fb73d56bcff3d2b54a70c3d511'
- 'e7d5df80186d5c736e82b0a7d46216bc')
-
-build() {
- cd ${srcdir}/master
- mkdir nouveau
- cp $srcdir/Makefile ${srcdir}/master/nouveau/
- cd nouveau
- make LINUXDIR=/lib/modules/${_kernver}/build DRM_MODULES="nouveau"
-}
-
-package() {
- install -D -m 0644 ${srcdir}/master/drivers/gpu/drm/drm.ko ${pkgdir}/lib/modules/${_kernver}/updates/drm.ko
- install -D -m 0644 ${srcdir}/master/drivers/gpu/drm/drm_kms_helper.ko ${pkgdir}/lib/modules/${_kernver}/updates/drm_kms_helper.ko
- install -D -m 0644 ${srcdir}/master/drivers/gpu/drm/nouveau/nouveau.ko ${pkgdir}/lib/modules/${_kernver}/kernel/drivers/video/nouveau.ko
- install -D -m 0644 ${srcdir}/master/drivers/gpu/drm/ttm/ttm.ko ${pkgdir}/lib/modules/${_kernver}/updates/ttm.ko
- install -D -m 0644 ${srcdir}/master/drivers/gpu/drm/i2c/ch7006.ko ${pkgdir}/lib/modules/${_kernver}/updates/ch7006.ko
-
- # install script
- sed -i -e "s/KERNEL_VERSION='.*'/KERNEL_VERSION='${_kernver}'/" ${startdir}/nouveau-drm.install
- # gzip -9 modules
- find "$pkgdir" -name '*.ko' -exec gzip -9 {} \;
-}
diff --git a/testing/nouveau-drm-lts/dont_check_for_pthread.patch b/testing/nouveau-drm-lts/dont_check_for_pthread.patch
deleted file mode 100644
index 050f55767..000000000
--- a/testing/nouveau-drm-lts/dont_check_for_pthread.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-diff -ru libdrm-2.4.0/configure.ac libdrm-2.4.0-nostubs/configure.ac
---- libdrm-2.4.0/configure.ac 2008-10-09 21:57:09.000000000 +0200
-+++ libdrm-2.4.0-nostubs/configure.ac 2008-10-21 10:48:24.000000000 +0200
-@@ -32,10 +32,6 @@
- AC_HEADER_STDC
- AC_SYS_LARGEFILE
-
--PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
--AC_SUBST(PTHREADSTUBS_CFLAGS)
--AC_SUBST(PTHREADSTUBS_LIBS)
--
- pkgconfigdir=${libdir}/pkgconfig
- AC_SUBST(pkgconfigdir)
- AC_ARG_ENABLE(udev, AS_HELP_STRING([--enable-udev],
-diff -ru libdrm-2.4.0/libdrm/intel/Makefile.am libdrm-2.4.0-nostubs/libdrm/intel/Makefile.am
---- libdrm-2.4.0/libdrm/intel/Makefile.am 2008-10-14 01:39:32.000000000 +0200
-+++ libdrm-2.4.0-nostubs/libdrm/intel/Makefile.am 2008-10-21 10:49:00.000000000 +0200
-@@ -26,13 +26,12 @@
- $(WARN_CFLAGS) \
- -I$(top_srcdir)/libdrm \
- -I$(top_srcdir)/libdrm/intel \
-- $(PTHREADSTUBS_CFLAGS) \
- -I$(top_srcdir)/shared-core
-
- libdrm_intel_la_LTLIBRARIES = libdrm_intel.la
- libdrm_intel_ladir = $(libdir)
- libdrm_intel_la_LDFLAGS = -version-number 1:0:0 -no-undefined
--libdrm_intel_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_intel_la_LIBADD = ../libdrm.la
-
- libdrm_intel_la_SOURCES = \
- intel_bufmgr.c \
---- libdrm-2.4.5/libdrm/nouveau/Makefile.am.orig 2009-02-28 19:06:24.000000000 +0000
-+++ libdrm-2.4.5/libdrm/nouveau/Makefile.am 2009-02-28 19:06:33.000000000 +0000
-@@ -2,13 +2,12 @@
- $(WARN_CFLAGS) \
- -I$(top_srcdir)/libdrm \
- -I$(top_srcdir)/libdrm/nouveau \
-- $(PTHREADSTUBS_CFLAGS) \
- -I$(top_srcdir)/shared-core
-
- libdrm_nouveau_la_LTLIBRARIES = libdrm_nouveau.la
- libdrm_nouveau_ladir = $(libdir)
- libdrm_nouveau_la_LDFLAGS = -version-number 1:0:0 -no-undefined
--libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_nouveau_la_LIBADD = ../libdrm.la
-
- libdrm_nouveau_la_SOURCES = \
- nouveau_device.c \
diff --git a/testing/nouveau-drm-lts/nouveau-drm.install b/testing/nouveau-drm-lts/nouveau-drm.install
deleted file mode 100644
index beadaa563..000000000
--- a/testing/nouveau-drm-lts/nouveau-drm.install
+++ /dev/null
@@ -1,16 +0,0 @@
-post_install() {
- KERNEL_VERSION='2.6.32-lts'
- depmod -v $KERNEL_VERSION > /dev/null 2>&1
- echo "if you are running kms in early mode please rebuild your initrd"
-}
-
-post_upgrade() {
- post_install $1
- rmmod nouveau || echo 'In order to use the new nouveau module, exit Xserver and unload it manually.'
-}
-
-post_remove() {
- KERNEL_VERSION='2.6.32-lts'
- depmod -v $KERNEL_VERSION > /dev/null 2>&1
-}
-
diff --git a/testing/openssh/PKGBUILD b/testing/openssh/PKGBUILD
deleted file mode 100644
index 76f144bcc..000000000
--- a/testing/openssh/PKGBUILD
+++ /dev/null
@@ -1,71 +0,0 @@
-# $Id: PKGBUILD 127399 2011-06-14 16:51:03Z bisson $
-# Maintainer: Gaetan Bisson <bisson@archlinux.org>
-# Contributor: Aaron Griffin <aaron@archlinux.org>
-# Contributor: judd <jvinet@zeroflux.org>
-
-pkgname=openssh
-pkgver=5.8p2
-pkgrel=8
-pkgdesc='Free version of the SSH connectivity tools'
-arch=('i686' 'x86_64')
-license=('custom:BSD')
-url='http://www.openssh.org/portable.html'
-backup=('etc/ssh/ssh_config' 'etc/ssh/sshd_config' 'etc/pam.d/sshd' 'etc/conf.d/sshd')
-depends=('tcp_wrappers' 'krb5' 'openssl' 'libedit')
-source=("ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/${pkgname}-${pkgver}.tar.gz"
- 'authfile.c.patch'
- 'sshd.confd'
- 'sshd.pam'
- 'sshd')
-sha1sums=('64798328d310e4f06c9f01228107520adbc8b3e5'
- '3669cb5ca6149f69015df5ce8e60b82c540eb0a4'
- 'ec102deb69cad7d14f406289d2fc11fee6eddbdd'
- '07fecd5880b1c4fdd8c94ddb2e89ddce88effdc1'
- '6b7f8ebf0c1cc37137a7d9a53447ac8a0ee6a2b5')
-
-build() {
- cd "${srcdir}/${pkgname}-${pkgver}"
-
- patch -p1 -i ../authfile.c.patch # fix FS#24693 using http://anoncvs.mindrot.org/index.cgi/openssh/authfile.c?revision=1.95
-
- ./configure \
- --prefix=/usr \
- --libexecdir=/usr/lib/ssh \
- --sysconfdir=/etc/ssh \
- --with-tcp-wrappers \
- --with-privsep-user=nobody \
- --with-md5-passwords \
- --with-pam \
- --with-mantype=man \
- --mandir=/usr/share/man \
- --with-xauth=/usr/bin/xauth \
- --with-kerberos5=/usr \
- --with-ssl-engine \
- --with-libedit=/usr/lib \
- --disable-strip # stripping is done by makepkg
-
- make
-}
-
-package() {
- cd "${srcdir}/${pkgname}-${pkgver}"
- make DESTDIR="${pkgdir}" install
-
- install -Dm755 ../sshd "${pkgdir}"/etc/rc.d/sshd
- install -Dm644 ../sshd.pam "${pkgdir}"/etc/pam.d/sshd
- install -Dm644 ../sshd.confd "${pkgdir}"/etc/conf.d/sshd
- install -Dm644 LICENCE "${pkgdir}/usr/share/licenses/${pkgname}/LICENCE"
-
- rm "${pkgdir}"/usr/share/man/man1/slogin.1
- ln -sf ssh.1.gz "${pkgdir}"/usr/share/man/man1/slogin.1.gz
-
- # additional contrib scripts that we like
- install -Dm755 contrib/findssl.sh "${pkgdir}"/usr/bin/findssl.sh
- install -Dm755 contrib/ssh-copy-id "${pkgdir}"/usr/bin/ssh-copy-id
- install -Dm644 contrib/ssh-copy-id.1 "${pkgdir}"/usr/share/man/man1/ssh-copy-id.1
-
- # PAM is a common, standard feature to have
- sed -i -e '/^#ChallengeResponseAuthentication yes$/c ChallengeResponseAuthentication no' \
- -e '/^#UsePAM no$/c UsePAM yes' \
- "${pkgdir}"/etc/ssh/sshd_config
-}
diff --git a/testing/openssh/authfile.c.patch b/testing/openssh/authfile.c.patch
deleted file mode 100644
index 6c18fe807..000000000
--- a/testing/openssh/authfile.c.patch
+++ /dev/null
@@ -1,198 +0,0 @@
-diff -aur old/authfile.c new/authfile.c
---- old/authfile.c 2011-06-12 02:21:52.262338254 +0200
-+++ new/authfile.c 2011-06-12 02:13:43.051467269 +0200
-@@ -1,4 +1,4 @@
--/* $OpenBSD: authfile.c,v 1.87 2010/11/29 18:57:04 markus Exp $ */
-+/* $OpenBSD: authfile.c,v 1.95 2011/05/29 11:42:08 djm Exp $ */
- /*
- * Author: Tatu Ylonen <ylo@cs.hut.fi>
- * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
-@@ -69,6 +69,8 @@
- #include "misc.h"
- #include "atomicio.h"
-
-+#define MAX_KEY_FILE_SIZE (1024 * 1024)
-+
- /* Version identification string for SSH v1 identity files. */
- static const char authfile_id_string[] =
- "SSH PRIVATE KEY FILE FORMAT 1.1\n";
-@@ -312,12 +314,12 @@
- return pub;
- }
-
--/* Load the contents of a key file into a buffer */
--static int
-+/* Load a key from a fd into a buffer */
-+int
- key_load_file(int fd, const char *filename, Buffer *blob)
- {
-+ u_char buf[1024];
- size_t len;
-- u_char *cp;
- struct stat st;
-
- if (fstat(fd, &st) < 0) {
-@@ -325,30 +327,45 @@
- filename == NULL ? "" : filename,
- filename == NULL ? "" : " ",
- strerror(errno));
-- close(fd);
- return 0;
- }
-- if (st.st_size > 1*1024*1024) {
-+ if ((st.st_mode & (S_IFSOCK|S_IFCHR|S_IFIFO)) == 0 &&
-+ st.st_size > MAX_KEY_FILE_SIZE) {
-+ toobig:
- error("%s: key file %.200s%stoo large", __func__,
- filename == NULL ? "" : filename,
- filename == NULL ? "" : " ");
-- close(fd);
- return 0;
- }
-- len = (size_t)st.st_size; /* truncated */
--
- buffer_init(blob);
-- cp = buffer_append_space(blob, len);
--
-- if (atomicio(read, fd, cp, len) != len) {
-- debug("%s: read from key file %.200s%sfailed: %.100s", __func__,
-- filename == NULL ? "" : filename,
-- filename == NULL ? "" : " ",
-- strerror(errno));
-+ for (;;) {
-+ if ((len = atomicio(read, fd, buf, sizeof(buf))) == 0) {
-+ if (errno == EPIPE)
-+ break;
-+ debug("%s: read from key file %.200s%sfailed: %.100s",
-+ __func__, filename == NULL ? "" : filename,
-+ filename == NULL ? "" : " ", strerror(errno));
-+ buffer_clear(blob);
-+ bzero(buf, sizeof(buf));
-+ return 0;
-+ }
-+ buffer_append(blob, buf, len);
-+ if (buffer_len(blob) > MAX_KEY_FILE_SIZE) {
-+ buffer_clear(blob);
-+ bzero(buf, sizeof(buf));
-+ goto toobig;
-+ }
-+ }
-+ bzero(buf, sizeof(buf));
-+ if ((st.st_mode & (S_IFSOCK|S_IFCHR|S_IFIFO)) == 0 &&
-+ st.st_size != buffer_len(blob)) {
-+ debug("%s: key file %.200s%schanged size while reading",
-+ __func__, filename == NULL ? "" : filename,
-+ filename == NULL ? "" : " ");
- buffer_clear(blob);
-- close(fd);
- return 0;
- }
-+
- return 1;
- }
-
-@@ -606,7 +623,7 @@
- error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
- error("Permissions 0%3.3o for '%s' are too open.",
- (u_int)st.st_mode & 0777, filename);
-- error("It is recommended that your private key files are NOT accessible by others.");
-+ error("It is required that your private key files are NOT accessible by others.");
- error("This private key will be ignored.");
- return 0;
- }
-@@ -626,6 +643,7 @@
- case KEY_UNSPEC:
- return key_parse_private_pem(blob, type, passphrase, commentp);
- default:
-+ error("%s: cannot parse key type %d", __func__, type);
- break;
- }
- return NULL;
-@@ -670,11 +688,38 @@
- }
-
- Key *
-+key_parse_private(Buffer *buffer, const char *filename,
-+ const char *passphrase, char **commentp)
-+{
-+ Key *pub, *prv;
-+ Buffer pubcopy;
-+
-+ buffer_init(&pubcopy);
-+ buffer_append(&pubcopy, buffer_ptr(buffer), buffer_len(buffer));
-+ /* it's a SSH v1 key if the public key part is readable */
-+ pub = key_parse_public_rsa1(&pubcopy, commentp);
-+ buffer_free(&pubcopy);
-+ if (pub == NULL) {
-+ prv = key_parse_private_type(buffer, KEY_UNSPEC,
-+ passphrase, NULL);
-+ /* use the filename as a comment for PEM */
-+ if (commentp && prv)
-+ *commentp = xstrdup(filename);
-+ } else {
-+ key_free(pub);
-+ /* key_parse_public_rsa1() has already loaded the comment */
-+ prv = key_parse_private_type(buffer, KEY_RSA1, passphrase,
-+ NULL);
-+ }
-+ return prv;
-+}
-+
-+Key *
- key_load_private(const char *filename, const char *passphrase,
- char **commentp)
- {
-- Key *pub, *prv;
-- Buffer buffer, pubcopy;
-+ Key *prv;
-+ Buffer buffer;
- int fd;
-
- fd = open(filename, O_RDONLY);
-@@ -697,23 +742,7 @@
- }
- close(fd);
-
-- buffer_init(&pubcopy);
-- buffer_append(&pubcopy, buffer_ptr(&buffer), buffer_len(&buffer));
-- /* it's a SSH v1 key if the public key part is readable */
-- pub = key_parse_public_rsa1(&pubcopy, commentp);
-- buffer_free(&pubcopy);
-- if (pub == NULL) {
-- prv = key_parse_private_type(&buffer, KEY_UNSPEC,
-- passphrase, NULL);
-- /* use the filename as a comment for PEM */
-- if (commentp && prv)
-- *commentp = xstrdup(filename);
-- } else {
-- key_free(pub);
-- /* key_parse_public_rsa1() has already loaded the comment */
-- prv = key_parse_private_type(&buffer, KEY_RSA1, passphrase,
-- NULL);
-- }
-+ prv = key_parse_private(&buffer, filename, passphrase, commentp);
- buffer_free(&buffer);
- return prv;
- }
-@@ -737,13 +766,19 @@
- case '\0':
- continue;
- }
-+ /* Abort loading if this looks like a private key */
-+ if (strncmp(cp, "-----BEGIN", 10) == 0)
-+ break;
- /* Skip leading whitespace. */
- for (; *cp && (*cp == ' ' || *cp == '\t'); cp++)
- ;
- if (*cp) {
- if (key_read(k, &cp) == 1) {
-- if (commentp)
-- *commentp=xstrdup(filename);
-+ cp[strcspn(cp, "\r\n")] = '\0';
-+ if (commentp) {
-+ *commentp = xstrdup(*cp ?
-+ cp : filename);
-+ }
- fclose(f);
- return 1;
- }
diff --git a/testing/openssh/sshd b/testing/openssh/sshd
deleted file mode 100755
index 2ee1091f0..000000000
--- a/testing/openssh/sshd
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-. /etc/conf.d/sshd
-
-PIDFILE=/var/run/sshd.pid
-PID=$(cat $PIDFILE 2>/dev/null)
-if ! readlink -q /proc/$PID/exe | grep -q '^/usr/sbin/sshd'; then
- PID=
- rm $PIDFILE 2>/dev/null
-fi
-
-case "$1" in
- start)
- stat_busy "Starting Secure Shell Daemon"
- [ -f /etc/ssh/ssh_host_key ] || { /usr/bin/ssh-keygen -t rsa1 -N "" -f /etc/ssh/ssh_host_key >/dev/null; }
- [ -f /etc/ssh/ssh_host_rsa_key ] || { /usr/bin/ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key >/dev/null; }
- [ -f /etc/ssh/ssh_host_dsa_key ] || { /usr/bin/ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key >/dev/null; }
- [ -f /etc/ssh/ssh_host_ecdsa_key ] || { /usr/bin/ssh-keygen -t ecdsa -N "" -f /etc/ssh/ssh_host_ecdsa_key >/dev/null; }
- [ -d /var/empty ] || mkdir -p /var/empty
- [ -z "$PID" ] && /usr/sbin/sshd $SSHD_ARGS
- if [ $? -gt 0 ]; then
- stat_fail
- else
- add_daemon sshd
- stat_done
- fi
- ;;
- stop)
- stat_busy "Stopping Secure Shell Daemon"
- [ ! -z "$PID" ] && kill $PID &> /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon sshd
- stat_done
- fi
- ;;
- restart)
- $0 stop
- sleep 1
- $0 start
- ;;
- *)
- echo "usage: $0 {start|stop|restart}"
-esac
-exit 0
diff --git a/testing/openssh/sshd.confd b/testing/openssh/sshd.confd
deleted file mode 100644
index 5ce7c0079..000000000
--- a/testing/openssh/sshd.confd
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# Parameters to be passed to sshd
-#
-SSHD_ARGS=""
diff --git a/testing/openssh/sshd.pam b/testing/openssh/sshd.pam
deleted file mode 100644
index ff8829fe9..000000000
--- a/testing/openssh/sshd.pam
+++ /dev/null
@@ -1,11 +0,0 @@
-#%PAM-1.0
-#auth required pam_securetty.so #Disable remote root
-auth required pam_unix.so
-auth required pam_env.so
-account required pam_nologin.so
-account required pam_unix.so
-account required pam_time.so
-password required pam_unix.so
-session required pam_unix_session.so
-session required pam_limits.so
--session optional pam_ck_connector.so nox11
diff --git a/testing/python2/PKGBUILD b/testing/python2/PKGBUILD
deleted file mode 100644
index f1c56f85d..000000000
--- a/testing/python2/PKGBUILD
+++ /dev/null
@@ -1,87 +0,0 @@
-# $Id: PKGBUILD 127261 2011-06-12 03:23:25Z stephane $
-# Maintainer: Stéphane Gaudreault <stephane@archlinux.org>
-# Contributer: Allan McRae <allan@archlinux.org>
-# Contributer: Jason Chu <jason@archlinux.org>
-
-pkgname=python2
-pkgver=2.7.2
-pkgrel=1
-_pybasever=2.7
-pkgdesc="A high-level scripting language"
-arch=('i686' 'x86_64')
-license=('PSF')
-url="http://www.python.org/"
-depends=('db' 'bzip2' 'gdbm' 'openssl' 'zlib' 'expat' 'sqlite3' 'libffi')
-makedepends=('tk')
-optdepends=('tk: for IDLE')
-conflicts=('python<3')
-options=('!makeflags')
-source=(http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz
- python-2.7-db51.patch)
-sha1sums=('56700044141402dc35e7a0a24aa7ffda1a8c1a53'
- '9667a2a2f8594902b352793e649f78696a77bd13')
-
-build() {
- cd "${srcdir}/Python-${pkgver}"
-
- patch -Np1 -i ../python-2.7-db51.patch
-
- # Temporary workaround for FS#22322
- # See http://bugs.python.org/issue10835 for upstream report
- sed -i "/progname =/s/python/python${_pybasever}/" Python/pythonrun.c
-
- # Enable built-in SQLite3 module to load extensions (fix FS#22122)
- sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py
-
- # FS#2399
- sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python2|" Lib/cgi.py
-
- # Ensure that we are using the system copy of various libraries (expat, zlib and libffi),
- # rather than copies shipped in the tarball
- rm -r Modules/expat
- rm -r Modules/zlib
- rm -r Modules/_ctypes/{darwin,libffi}*
-
- export OPT="${CFLAGS}"
- ./configure --prefix=/usr --enable-shared --with-threads --enable-ipv6 \
- --enable-unicode=ucs4 --with-system-expat --with-system-ffi
-
- make
-}
-
-package() {
- cd "${srcdir}/Python-${pkgver}"
- make DESTDIR="${pkgdir}" altinstall maninstall
-
- ln -sf python${_pybasever} "${pkgdir}/usr/bin/python2"
- ln -sf python${_pybasever}-config "${pkgdir}/usr/bin/python2-config"
- ln -sf python${_pybasever}.1 "${pkgdir}/usr/share/man/man1/python2.1"
-
- ln -sf ../../libpython${_pybasever}.so \
- "${pkgdir}/usr/lib/python${_pybasever}/config/libpython${_pybasever}.so"
-
- mv "${pkgdir}/usr/bin/smtpd.py" "${pkgdir}/usr/lib/python${_pybasever}/"
-
- # some useful "stuff"
- install -dm755 "${pkgdir}"/usr/lib/python${_pybasever}/Tools/{i18n,scripts}
- install -m755 Tools/i18n/{msgfmt,pygettext}.py \
- "${pkgdir}/usr/lib/python${_pybasever}/Tools/i18n/"
- install -m755 Tools/scripts/{README,*py} \
- "${pkgdir}/usr/lib/python${_pybasever}/Tools/scripts/"
-
- # fix conflicts with python
- mv "${pkgdir}"/usr/bin/idle{,2}
- mv "${pkgdir}"/usr/bin/pydoc{,2}
- mv "${pkgdir}"/usr/bin/2to3{,-2.7}
-
- # clean up #!s
- find "${pkgdir}/usr/lib/python${_pybasever}/" -name '*.py' | \
- xargs sed -i "s|#[ ]*![ ]*/usr/bin/env python$|#!/usr/bin/env python2|"
-
- # clean-up reference to build directory
- sed -i "s#${srcdir}/Python-${pkgver}:##" \
- "${pkgdir}/usr/lib/python${_pybasever}/config/Makefile"
-
- # license
- install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
-}
diff --git a/testing/python2/python-2.7-db51.patch b/testing/python2/python-2.7-db51.patch
deleted file mode 100644
index 2da95c375..000000000
--- a/testing/python2/python-2.7-db51.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-diff -Naur Python-2.7-orig//Modules/_bsddb.c Python-2.7/Modules/_bsddb.c
---- Python-2.7-orig//Modules/_bsddb.c 2010-05-10 00:46:46.000000000 +1000
-+++ Python-2.7/Modules/_bsddb.c 2010-10-20 13:19:26.436669911 +1000
-@@ -9765,8 +9765,11 @@
-
- ADD_INT(d, DB_REP_PERMANENT);
-
--#if (DBVER >= 44)
-+#if (DBVER >= 44) && (DBVER <= 48)
- ADD_INT(d, DB_REP_CONF_NOAUTOINIT);
-+#endif
-+
-+#if (DBVER >= 44)
- ADD_INT(d, DB_REP_CONF_DELAYCLIENT);
- ADD_INT(d, DB_REP_CONF_BULK);
- ADD_INT(d, DB_REP_CONF_NOWAIT);
-diff -Naur Python-2.7-orig//setup.py Python-2.7/setup.py
---- Python-2.7-orig//setup.py 2010-06-27 22:36:16.000000000 +1000
-+++ Python-2.7/setup.py 2010-10-20 13:10:48.256670026 +1000
-@@ -765,7 +765,7 @@
- # a release. Most open source OSes come with one or more
- # versions of BerkeleyDB already installed.
-
-- max_db_ver = (4, 8)
-+ max_db_ver = (5, 1)
- min_db_ver = (4, 1)
- db_setup_debug = False # verbose debug prints from this script?
-
-@@ -787,8 +787,12 @@
- return True
-
- def gen_db_minor_ver_nums(major):
-- if major == 4:
-+ if major == 5:
- for x in range(max_db_ver[1]+1):
-+ if allow_db_ver((5, x)):
-+ yield x
-+ if major == 4:
-+ for x in range(9):
- if allow_db_ver((4, x)):
- yield x
- elif major == 3:
diff --git a/testing/re-alpine/PKGBUILD b/testing/re-alpine/PKGBUILD
deleted file mode 100644
index 9293744c9..000000000
--- a/testing/re-alpine/PKGBUILD
+++ /dev/null
@@ -1,38 +0,0 @@
-# $Id: PKGBUILD 125747 2011-05-29 05:24:41Z eric $
-# Maintainer: Eric Bélanger <eric@archlinux.org>
-# Contributor: Smith Dhumbumroong <zodmaner@gmail.com>
-
-pkgname=re-alpine
-pkgver=2.02
-pkgrel=3
-pkgdesc="The continuation of the Alpine email client from University of Washington"
-arch=('i686' 'x86_64')
-url="http://sourceforge.net/projects/re-alpine/"
-license=('APACHE')
-depends=('libldap' 'krb5')
-optdepends=('aspell: spell-checking support'
- 'hunspell: spell-checking support')
-provides=('pine' 'alpine')
-conflicts=('pine' 'alpine')
-replaces=('pine' 'alpine')
-options=('!makeflags')
-source=(http://downloads.sourceforge.net/project/re-alpine/${pkgname}-${pkgver}.tar.bz2
- maildir.patch)
-md5sums=('5e75826b15f05674856be8618bdefdfb'
- '8d7a0e8d940e84e978f50266405c7361')
-sha1sums=('9c2f13dbc7ca75e7a09f81df607db84694b10fa6'
- 'c09a8e42f9dba3e63a3755a9c418af95da721d8d')
-
-build() {
- cd "${srcdir}/${pkgname}-${pkgver}"
- patch -p1 < ../maildir.patch
- LIBS+=-lpam ./configure --prefix=/usr --without-passfile --without-tcl \
- --disable-shared --with-system-pinerc=/etc/alpine.d/pine.conf \
- --with-system-fixed-pinerc=/etc/alpine.d/pine.conf.fixed
- make
-}
-
-package() {
- cd "${srcdir}/${pkgname}-${pkgver}"
- make DESTDIR="${pkgdir}" install
-}
diff --git a/testing/re-alpine/maildir.patch b/testing/re-alpine/maildir.patch
deleted file mode 100644
index cff18cb3f..000000000
--- a/testing/re-alpine/maildir.patch
+++ /dev/null
@@ -1,3712 +0,0 @@
-diff -rc alpine-2.00/alpine/alpine.c alpine-2.00.maildir/alpine/alpine.c
-*** alpine-2.00/alpine/alpine.c 2008-06-03 17:31:05.000000000 -0500
---- alpine-2.00.maildir/alpine/alpine.c 2011-01-15 19:11:06.000000000 -0600
-***************
-*** 553,558 ****
---- 553,563 ----
- if(F_ON(F_MAILDROPS_PRESERVE_STATE, ps_global))
- mail_parameters(NULL, SET_SNARFPRESERVE, (void *) TRUE);
-
-+ #ifndef _WINDOWS
-+ mail_parameters(NULL,SET_COURIERSTYLE,
-+ (void *)(F_ON(F_COURIER_FOLDER_LIST, ps_global) ? 1 : 0));
-+ #endif
-+
- rvl = 0L;
- if(pine_state->VAR_NNTPRANGE){
- if(!SVAR_NNTPRANGE(pine_state, rvl, tmp_20k_buf, SIZEOF_20KBUF))
-diff -rc alpine-2.00/alpine/confscroll.c alpine-2.00.maildir/alpine/confscroll.c
-*** alpine-2.00/alpine/confscroll.c 2008-08-21 17:14:45.000000000 -0500
---- alpine-2.00.maildir/alpine/confscroll.c 2011-01-15 19:11:06.000000000 -0600
-***************
-*** 5489,5494 ****
---- 5489,5500 ----
- (void *)var->current_val.p);
- }
- #endif
-+ #ifndef _WINDOWS
-+ else if(var == &ps->vars[V_MAILDIR_LOCATION]){
-+ if(var->current_val.p && var->current_val.p[0])
-+ mail_parameters(NULL, SET_MDINBOXPATH, (void *)var->current_val.p);
-+ }
-+ #endif
- else if(revert && standard_radio_var(ps, var)){
-
- cur_rule_value(var, TRUE, FALSE);
-diff -rc alpine-2.00/imap/src/c-client/mail.c alpine-2.00.maildir/imap/src/c-client/mail.c
-*** alpine-2.00/imap/src/c-client/mail.c 2008-06-04 13:39:54.000000000 -0500
---- alpine-2.00.maildir/imap/src/c-client/mail.c 2011-01-15 19:11:07.000000000 -0600
-***************
-*** 991,997 ****
- MAILSTREAM *ts;
- char *s,*t,tmp[MAILTMPLEN];
- size_t i;
-! DRIVER *d;
- /* never allow names with newlines */
- if (s = strpbrk (mailbox,"\015\012")) {
- MM_LOG ("Can't create mailbox with such a name",ERROR);
---- 991,997 ----
- MAILSTREAM *ts;
- char *s,*t,tmp[MAILTMPLEN];
- size_t i;
-! DRIVER *d, *md;
- /* never allow names with newlines */
- if (s = strpbrk (mailbox,"\015\012")) {
- MM_LOG ("Can't create mailbox with such a name",ERROR);
-***************
-*** 1015,1020 ****
---- 1015,1022 ----
- return NIL;
- }
-
-+ /* Hack, we should do this better, but it works */
-+ for (md = maildrivers; md && strcmp (md->name, "md"); md = md->next);
- /* see if special driver hack */
- if ((mailbox[0] == '#') && ((mailbox[1] == 'd') || (mailbox[1] == 'D')) &&
- ((mailbox[2] == 'r') || (mailbox[2] == 'R')) &&
-***************
-*** 1045,1050 ****
---- 1047,1059 ----
- (((*mailbox == '{') || (*mailbox == '#')) &&
- (stream = mail_open (NIL,mailbox,OP_PROTOTYPE | OP_SILENT))))
- d = stream->dtb;
-+ else if(mailbox[0] == '#'
-+ && (mailbox[1] == 'm' || mailbox[1] == 'M')
-+ && (mailbox[2] == 'd' || mailbox[2] == 'D'
-+ || mailbox[2] == 'c' || mailbox[2] == 'C')
-+ && mailbox[3] == '/'
-+ && mailbox[4] != '\0')
-+ return (*md->create)(stream, mailbox);
- else if ((*mailbox != '{') && (ts = default_proto (NIL))) d = ts->dtb;
- else { /* failed utterly */
- sprintf (tmp,"Can't create mailbox %.80s: indeterminate format",mailbox);
-diff -rc alpine-2.00/imap/src/c-client/mail.h alpine-2.00.maildir/imap/src/c-client/mail.h
-*** alpine-2.00/imap/src/c-client/mail.h 2008-08-08 12:34:22.000000000 -0500
---- alpine-2.00.maildir/imap/src/c-client/mail.h 2011-01-15 19:11:07.000000000 -0600
-***************
-*** 353,358 ****
---- 353,362 ----
- #define SET_SCANCONTENTS (long) 573
- #define GET_MHALLOWINBOX (long) 574
- #define SET_MHALLOWINBOX (long) 575
-+ #define GET_COURIERSTYLE (long) 576
-+ #define SET_COURIERSTYLE (long) 577
-+ #define SET_MDINBOXPATH (long) 578
-+ #define GET_MDINBOXPATH (long) 579
-
- /* Driver flags */
-
-diff -rc alpine-2.00/imap/src/osdep/unix/dummy.c alpine-2.00.maildir/imap/src/osdep/unix/dummy.c
-*** alpine-2.00/imap/src/osdep/unix/dummy.c 2008-06-04 13:18:34.000000000 -0500
---- alpine-2.00.maildir/imap/src/osdep/unix/dummy.c 2011-01-15 20:01:59.000000000 -0600
-***************
-*** 106,118 ****
- * Accepts: mailbox name
- * Returns: our driver if name is valid, NIL otherwise
- */
-!
- DRIVER *dummy_valid (char *name)
- {
-! char *s,tmp[MAILTMPLEN];
- struct stat sbuf;
- /* must be valid local mailbox */
-! if (name && *name && (*name != '{') && (s = mailboxfile (tmp,name))) {
- /* indeterminate clearbox INBOX */
- if (!*s) return &dummydriver;
- else if (!stat (s,&sbuf)) switch (sbuf.st_mode & S_IFMT) {
---- 106,124 ----
- * Accepts: mailbox name
- * Returns: our driver if name is valid, NIL otherwise
- */
-! char * maildir_remove_root(char *);
- DRIVER *dummy_valid (char *name)
- {
-! char *s,tmp[MAILTMPLEN], *rname;
- struct stat sbuf;
-+
-+ if(strlen(name) > MAILTMPLEN)
-+ name[MAILTMPLEN] = '\0';
-+
-+ strcpy(tmp, name);
-+ rname = maildir_remove_root(tmp);
- /* must be valid local mailbox */
-! if (rname && *rname && (*rname != '{') && (s = mailboxfile (tmp,rname))) {
- /* indeterminate clearbox INBOX */
- if (!*s) return &dummydriver;
- else if (!stat (s,&sbuf)) switch (sbuf.st_mode & S_IFMT) {
-***************
-*** 121,128 ****
- return &dummydriver;
- }
- /* blackbox INBOX does not exist yet */
-! else if (!compare_cstring (name,"INBOX")) return &dummydriver;
- }
- return NIL;
- }
-
---- 127,135 ----
- return &dummydriver;
- }
- /* blackbox INBOX does not exist yet */
-! else if (!compare_cstring (rname,"INBOX")) return &dummydriver;
- }
-+ if(rname) fs_give((void **)&rname);
- return NIL;
- }
-
-***************
-*** 454,459 ****
---- 461,468 ----
- {
- char *s,tmp[MAILTMPLEN];
- long ret = NIL;
-+ if(!strncmp(mailbox,"#md/",4) || !strncmp(mailbox,"#mc/", 4))
-+ return maildir_create(stream, mailbox);
- /* validate name */
- if (!(compare_cstring (mailbox,"INBOX") && (s = dummy_file (tmp,mailbox)))) {
- sprintf (tmp,"Can't create %.80s: invalid name",mailbox);
-***************
-*** 519,524 ****
---- 528,541 ----
- {
- struct stat sbuf;
- char *s,tmp[MAILTMPLEN];
-+ if (!strncmp(mailbox,"#md/",4) || !strncmp(mailbox,"#mc/", 4)
-+ || is_valid_maildir(&mailbox)){
-+ char tmp[MAILTMPLEN] = {'\0'};
-+ strcpy(tmp, mailbox);
-+ if(tmp[strlen(tmp) - 1] != '/')
-+ tmp[strlen(tmp)] = '/';
-+ return maildir_delete(stream, tmp);
-+ }
- if (!(s = dummy_file (tmp,mailbox))) {
- sprintf (tmp,"Can't delete - invalid name: %.80s",s);
- MM_LOG (tmp,ERROR);
-***************
-*** 544,555 ****
- long dummy_rename (MAILSTREAM *stream,char *old,char *newname)
- {
- struct stat sbuf;
-! char c,*s,tmp[MAILTMPLEN],mbx[MAILTMPLEN],oldname[MAILTMPLEN];
- /* no trailing / allowed */
-! if (!dummy_file (oldname,old) || !(s = dummy_file (mbx,newname)) ||
- stat (oldname,&sbuf) || ((s = strrchr (s,'/')) && !s[1] &&
- ((sbuf.st_mode & S_IFMT) != S_IFDIR))) {
-! sprintf (mbx,"Can't rename %.80s to %.80s: invalid name",old,newname);
- MM_LOG (mbx,ERROR);
- return NIL;
- }
---- 561,583 ----
- long dummy_rename (MAILSTREAM *stream,char *old,char *newname)
- {
- struct stat sbuf;
-! char c,*s,tmp[MAILTMPLEN],mbx[MAILTMPLEN],oldname[MAILTMPLEN], *rold, *rnewname;
-!
-! if(strlen(old) > MAILTMPLEN)
-! old[MAILTMPLEN] = '\0';
-!
-! if(strlen(newname) > MAILTMPLEN)
-! newname[MAILTMPLEN] = '\0';
-!
-! strcpy(tmp, old);
-! rold = maildir_remove_root(tmp);
-! strcpy(tmp, newname);
-! rnewname = maildir_remove_root(tmp);
- /* no trailing / allowed */
-! if (!dummy_file (oldname,rold) || !(s = dummy_file (mbx,rnewname)) ||
- stat (oldname,&sbuf) || ((s = strrchr (s,'/')) && !s[1] &&
- ((sbuf.st_mode & S_IFMT) != S_IFDIR))) {
-! sprintf (mbx,"Can't rename %.80s to %.80s: invalid name",rold,rnewname);
- MM_LOG (mbx,ERROR);
- return NIL;
- }
-***************
-*** 565,578 ****
- }
- }
- /* rename of non-ex INBOX creates dest */
-! if (!compare_cstring (old,"INBOX") && stat (oldname,&sbuf))
- return dummy_create (NIL,mbx);
- if (rename (oldname,mbx)) {
-! sprintf (tmp,"Can't rename mailbox %.80s to %.80s: %.80s",old,newname,
- strerror (errno));
- MM_LOG (tmp,ERROR);
- return NIL;
- }
- return T; /* return success */
- }
-
---- 593,608 ----
- }
- }
- /* rename of non-ex INBOX creates dest */
-! if (!compare_cstring (rold,"INBOX") && stat (oldname,&sbuf))
- return dummy_create (NIL,mbx);
- if (rename (oldname,mbx)) {
-! sprintf (tmp,"Can't rename mailbox %.80s to %.80s: %.80s",rold,rnewname,
- strerror (errno));
- MM_LOG (tmp,ERROR);
- return NIL;
- }
-+ if(rold) fs_give((void **)&rold);
-+ if(rnewname) fs_give((void **)&rnewname);
- return T; /* return success */
- }
-
-diff -rc alpine-2.00/imap/src/osdep/unix/maildir.c alpine-2.00.maildir/imap/src/osdep/unix/maildir.c
-*** alpine-2.00/imap/src/osdep/unix/maildir.c 2011-01-24 19:38:50.000000000 -0600
---- alpine-2.00.maildir/imap/src/osdep/unix/maildir.c 2011-01-15 19:38:50.000000000 -0600
-***************
-*** 0 ****
---- 1,2584 ----
-+ /*
-+ * Maildir driver for Alpine 2.00
-+ *
-+ * Written by Eduardo Chappa <chappa@washington.edu>
-+ * Last Update: November 6, 2010.
-+ *
-+ */
-+
-+ #include <stdio.h>
-+ #include <ctype.h>
-+ #include <errno.h>
-+ extern int errno; /* just in case */
-+ #include "mail.h"
-+ #include <pwd.h>
-+ #include <sys/stat.h>
-+ #include <sys/time.h>
-+ #include "osdep.h"
-+ #include "rfc822.h"
-+ #include "fdstring.h"
-+ #include "misc.h"
-+ #include "dummy.h"
-+ #include "maildir.h"
-+
-+ /* Driver dispatch used by MAIL */
-+ DRIVER maildirdriver = {
-+ "md", /* driver name, yes it's md, not maildir */
-+ /* driver flags */
-+ DR_MAIL|DR_LOCAL|DR_NAMESPACE|DR_DIRFMT,
-+ (DRIVER *) NIL, /* next driver */
-+ maildir_valid, /* mailbox is valid for us */
-+ maildir_parameters, /* manipulate parameters */
-+ NIL, /* scan mailboxes */
-+ maildir_list, /* find mailboxes */
-+ maildir_lsub, /* find subscribed mailboxes */
-+ maildir_sub, /* subscribe to mailbox */
-+ maildir_unsub, /* unsubscribe from mailbox */
-+ maildir_create, /* create mailbox */
-+ maildir_delete, /* delete mailbox */
-+ maildir_rename, /* rename mailbox */
-+ mail_status_default, /* status of mailbox */
-+ maildir_open, /* open mailbox */
-+ maildir_close, /* close mailbox */
-+ maildir_fast, /* fetch message "fast" attributes */
-+ NIL, /* fetch message flags */
-+ NIL, /* fetch overview */
-+ NIL, /* fetch message structure */
-+ maildir_header, /* fetch message header */
-+ maildir_text, /* fetch message body */
-+ NIL, /* fetch partial message text */
-+ NIL, /* unique identifier */
-+ NIL, /* message number */
-+ NIL, /* modify flags */
-+ maildir_flagmsg, /* per-message modify flags */
-+ NIL, /* search for message based on criteria */
-+ NIL, /* sort messages */
-+ NIL, /* thread messages */
-+ maildir_ping, /* ping mailbox to see if still alive */
-+ maildir_check, /* check for new messages */
-+ maildir_expunge, /* expunge deleted messages */
-+ maildir_copy, /* copy messages to another mailbox */
-+ maildir_append, /* append string message to mailbox */
-+ NIL /* garbage collect stream */
-+ };
-+
-+
-+ DRIVER courierdriver = {
-+ "mc", /* Why a separate driver? So that
-+ createproto will work */
-+ /* driver flags */
-+ DR_MAIL|DR_LOCAL|DR_NAMESPACE|DR_DIRFMT,
-+ (DRIVER *) NIL, /* next driver */
-+ maildir_valid, /* mailbox is valid for us */
-+ maildir_parameters, /* manipulate parameters */
-+ NIL, /* scan mailboxes */
-+ courier_list, /* find mailboxes */
-+ maildir_lsub, /* find subscribed mailboxes */
-+ maildir_sub, /* subscribe to mailbox */
-+ maildir_unsub, /* unsubscribe from mailbox */
-+ maildir_create, /* create mailbox */
-+ maildir_delete, /* delete mailbox */
-+ maildir_rename, /* rename mailbox */
-+ mail_status_default, /* status of mailbox */
-+ maildir_open, /* open mailbox */
-+ maildir_close, /* close mailbox */
-+ maildir_fast, /* fetch message "fast" attributes */
-+ NIL, /* fetch message flags */
-+ NIL, /* fetch overview */
-+ NIL, /* fetch message structure */
-+ maildir_header, /* fetch message header */
-+ maildir_text, /* fetch message body */
-+ NIL, /* fetch partial message text */
-+ NIL, /* unique identifier */
-+ NIL, /* message number */
-+ NIL, /* modify flags */
-+ maildir_flagmsg, /* per-message modify flags */
-+ NIL, /* search for message based on criteria */
-+ NIL, /* sort messages */
-+ NIL, /* thread messages */
-+ maildir_ping, /* ping mailbox to see if still alive */
-+ maildir_check, /* check for new messages */
-+ maildir_expunge, /* expunge deleted messages */
-+ maildir_copy, /* copy messages to another mailbox */
-+ maildir_append, /* append string message to mailbox */
-+ NIL /* garbage collect stream */
-+ };
-+
-+ MAILSTREAM maildirproto = {&maildirdriver}; /* prototype stream */
-+ MAILSTREAM courierproto = {&courierdriver}; /* prototype stream */
-+
-+ long maildir_dirfmttest (char *name)
-+ {
-+ int i;
-+ for (i = 0; mdstruct[i] && strcmp(name, mdstruct[i]); i++);
-+ return (i < EndDir) || !strcmp(name, MDDIR)
-+ || !strncmp(name, MDUIDLAST, strlen(MDUIDLAST))
-+ || !strncmp(name, MDUIDTEMP, strlen(MDUIDTEMP)) ? LONGT : NIL;
-+ }
-+
-+ void
-+ md_domain_name(void)
-+ {
-+ int i;
-+
-+ strcpy(mdlocaldomain,mylocalhost ());
-+ for (i = 0; mdlocaldomain[i] ; i++)
-+ if(mdlocaldomain[i] == '/')
-+ mdlocaldomain[i] = '\057';
-+ else if (mdlocaldomain[i] == ':')
-+ mdlocaldomain[i] = '\072';
-+ }
-+
-+ char *
-+ myrootdir(char *name)
-+ {
-+ return myhomedir();
-+ }
-+
-+ char *
-+ mdirpath(void)
-+ {
-+ char *path = maildir_parameters(GET_MDINBOXPATH,NIL);
-+ return path ? (path[0] ? path : ".") : "Maildir";
-+ }
-+
-+ /* remove the "#md/" or "#mc/" part from a folder name */
-+ char *
-+ maildir_remove_root (char *name)
-+ {
-+ int courier = IS_COURIER(name), offset;
-+ char realname[MAILTMPLEN];
-+
-+ offset = maildir_valid_name(name) ? (name[3] == '/' ? 4 : 3) : 0;
-+ if(courier)
-+ courier_realname(name+offset, realname);
-+ else
-+ strcpy(realname, name+offset);
-+ return cpystr(realname);
-+ }
-+
-+
-+ /* Check validity of the name, we accept:
-+ * a) #md/directory/folder
-+ * b) #md/inbox
-+ * A few considerations: We can only accept as valid
-+ * a) names that start with #md/ and the directory exists or
-+ * b) names that do not start with #md/ but are maildir directories (have
-+ * the /cur, /tmp and /new structure)
-+ */
-+ int maildir_valid_name (char *name)
-+ {
-+ char tmpname[MAILTMPLEN] = {'\0'};
-+
-+ if (mdfpath)
-+ fs_give((void **)&mdfpath);
-+ if (name && (name[0] != '#'))
-+ sprintf(tmpname,"%s%s",MDPREFIX(CCLIENT), name);
-+ mdfpath = cpystr(tmpname[0] ? tmpname : name);
-+
-+ return IS_CCLIENT(name) || IS_COURIER(name);
-+ }
-+
-+ /* Check if the directory whose path is given by name is a valid maildir
-+ * directory (contains /cur, /tmp and /new)
-+ */
-+ int maildir_valid_dir (char *name)
-+ {
-+ int len;
-+ DirNamesType i;
-+ struct stat sbuf;
-+ char tmp[MAILTMPLEN];
-+
-+ if(name[strlen(name) - 1] == '/')
-+ name[strlen(name) - 1] = '\0';
-+ len = strlen(name);
-+ for (i = Cur; i != EndDir; i++){
-+ MDFLD(tmp, name, i);
-+ if (stat(tmp, &sbuf) < 0 || !S_ISDIR(sbuf.st_mode))
-+ break;
-+ }
-+ name[len] = '\0';
-+ return (i == EndDir) ? T : NIL;
-+ }
-+
-+ void courier_realname(char *name, char *realname)
-+ {
-+ int i,j;
-+
-+ if(!name)
-+ return;
-+
-+ for (i = 0, j = 0; i < MAILTMPLEN && j < strlen(name); j++, i++){
-+ realname[i] = name[j];
-+ if(name[j] == '/' && name[j+1] != '.' && name[j+1] != '%'
-+ && name[j+1] != '*')
-+ realname[++i] = '.';
-+ }
-+ if(realname[i-1] == '.')
-+ i--;
-+ realname[i] = '\0';
-+ }
-+
-+
-+ /* given a maildir folder, return its path. Memory freed by caller. Directory
-+ * does not contain the trailing slash "/". On error NULL is returned.
-+ */
-+ int maildir_file_path (char *name, char *tmp)
-+ {
-+ char *maildirpath = mdirpath(), *rname;
-+ int courier = IS_COURIER(name);
-+
-+ /* There are several ways in which the path can come, so we will handle
-+ them here. First we deal with #mc/ or #md/ prefix by removing the
-+ prefix, if any */
-+
-+ if(strlen(name) >= MAILTMPLEN)
-+ name[MAILTMPLEN] = '\0';
-+ strcpy(tmp, name);
-+ rname = maildir_remove_root(tmp);
-+ tmp[0] = '\0'; /* just in case something fails */
-+
-+ if (strlen(myrootdir(rname)) +
-+ max(strlen(rname), strlen(maildirpath)) > MAILTMPLEN){
-+ errno = ENAMETOOLONG;
-+ sprintf(tmp,"Error opening \"%s\": %s", rname, strerror (errno));
-+ mm_log(tmp,ERROR);
-+ return NIL;
-+ }
-+
-+ /* There are two ways in which the name can come here, either as a
-+ full path or not. If it is not a full path it can come in two ways,
-+ either as a file system path (Maildir/.Drafts) or as a maildir path
-+ (INBOX.Drafts)
-+ */
-+
-+ if(*rname == '/') /* full path */
-+ strcpy(tmp, rname); /* do nothing */
-+ else{
-+ sprintf (tmp,"%s/%s%s%s", myrootdir (rname),
-+ strncmp (ucase (strcpy (tmp, rname)), "INBOX", 5)
-+ ? rname : maildirpath,
-+ strncmp (ucase (strcpy (tmp, rname)), "INBOX", 5)
-+ ? "" : (courier ? "/" : ""),
-+ strncmp (ucase (strcpy (tmp, rname)), "INBOX", 5)
-+ ? "" : (*(rname+5) == MDSEPARATOR(courier) ? rname+5 : ""));
-+ }
-+ if(rname) fs_give((void **)&rname);
-+ return tmp[0] ? T : NIL;
-+ }
-+
-+ /* This function is given a full path for a mailbox and returns
-+ * if it is a valid maildir transformed to canonical notation
-+ */
-+ int
-+ is_valid_maildir (char **name)
-+ {
-+ if (!strncmp(*name, myrootdir (*name), strlen(myrootdir(*name)))){
-+ (*name) += strlen(myrootdir(*name));
-+ if (**name == '/') (*name)++;
-+ }
-+ return maildir_valid(*name) ? T : NIL;
-+ }
-+
-+ /* Check validity of mailbox. This routine does not send errors to log, other
-+ * routines calling this one may do so, though
-+ */
-+
-+ DRIVER *maildir_valid (char *name)
-+ {
-+ char tmpname[MAILTMPLEN];
-+
-+ maildir_file_path(name, tmpname);
-+
-+ return maildir_valid_dir(tmpname)
-+ ? (IS_COURIER(name) ? &courierdriver : &maildirdriver) : NIL;
-+ }
-+
-+ void maildir_fast (MAILSTREAM *stream,char *sequence,long flags)
-+ {
-+ unsigned long i;
-+ MESSAGECACHE *elt;
-+ /* get sequence */
-+ if (stream && LOCAL && ((flags & FT_UID) ?
-+ mail_uid_sequence (stream,sequence) :
-+ mail_sequence (stream,sequence)))
-+ for (i = 1L; i <= stream->nmsgs; i++) {
-+ if ((elt = mail_elt (stream,i))->sequence && (elt->valid = T) &&
-+ !(elt->day && elt->rfc822_size)) {
-+ ENVELOPE **env = NIL;
-+ ENVELOPE *e = NIL;
-+ if (!stream->scache) env = &elt->private.msg.env;
-+ else if (stream->msgno == i) env = &stream->env;
-+ else env = &e;
-+ if (!*env || !elt->rfc822_size) {
-+ STRING bs;
-+ unsigned long hs;
-+ char *ht = (*stream->dtb->header) (stream,i,&hs,NIL);
-+
-+ if (!*env) rfc822_parse_msg (env,NIL,ht,hs,NIL,BADHOST,
-+ stream->dtb->flags);
-+ if (!elt->rfc822_size) {
-+ (*stream->dtb->text) (stream,i,&bs,FT_PEEK);
-+ elt->rfc822_size = hs + SIZE (&bs) - GETPOS (&bs);
-+ }
-+ }
-+
-+ if (!elt->day && *env && (*env)->date)
-+ mail_parse_date (elt,(*env)->date);
-+
-+ if (!elt->day) elt->day = elt->month = 1;
-+ mail_free_envelope (&e);
-+ }
-+ }
-+ }
-+
-+ int
-+ maildir_eliminate_duplicate (char *name, struct direct ***flist, unsigned long *nfiles)
-+ {
-+ int i, j, k, error = 0, scanr;
-+ char new[MAILTMPLEN], old[MAILTMPLEN], tmp[MAILTMPLEN], *str;
-+ struct direct **names = NIL;
-+
-+ if((scanr = maildir_doscandir(name, &names, CCLIENT)) < 0)
-+ return -1;
-+
-+ if(nfiles) *nfiles = scanr;
-+ for(i = 0, j = 1, k = 0; j < scanr; i++, j++){
-+ if(k)
-+ names[i] = names[i+k];
-+ if(same_maildir_file(names[i]->d_name, names[j]->d_name)){
-+ int d, f, r, s;
-+ maildir_getflag(names[i]->d_name, &d, &f, &r, &s, NIL);
-+ sprintf(old,"%s/%s", name, names[i]->d_name);
-+ sprintf(new,"%s/.%s", name, names[i]->d_name);
-+ if(rename(old, new) < 0 && errno != EEXIST)
-+ error++;
-+ if(!error){
-+ for(; j < scanr
-+ && same_maildir_file(names[i]->d_name, names[j]->d_name)
-+ ; j++, k++){
-+ maildir_getflag(names[j]->d_name, (d ? NIL : &d),
-+ (f ? NIL : &f), (r ? NIL : &r), (s ? NIL : &s), NIL);
-+ sprintf(tmp,"%s/%s", name, names[j]->d_name);
-+ if(unlink(tmp) < 0){ /* Hmmm... a problem, let's see */
-+ struct stat sbuf;
-+ if (stat(tmp, &sbuf) == 0 && (sbuf.st_mode & S_IFMT) == S_IFREG)
-+ error++;
-+ }
-+ }
-+ if((str = strrchr(names[i]->d_name,FLAGSEP)) != NULL) *str = '\0';
-+ sprintf (old,"%s/%s%s%s%s%s%s", name, names[i]->d_name, MDSEP(2),
-+ MDFLAG(Draft, d), MDFLAG(Flagged, f), MDFLAG(Replied, r),
-+ MDFLAG(Seen, s));
-+ if(rename(new, old) < 0)
-+ error++;
-+ }
-+ }
-+
-+ }
-+ if(k > 0)
-+ fs_give((void **)&names);
-+ else
-+ *flist = names;
-+ return error ? -1 : k;
-+ }
-+
-+ int
-+ maildir_doscandir(char *name, struct direct ***flist, int flag)
-+ {
-+ return scandir(name, flist,
-+ flag == CCLIENT ? maildir_select : courier_dir_select,
-+ flag == CCLIENT ? maildir_namesort : courier_dir_sort);
-+ }
-+
-+ /*
-+ * return all files in a given directory. This is a separate call
-+ * so that if there are warnings during compilation this only appears once.
-+ */
-+ unsigned long
-+ maildir_scandir (char *name, struct direct ***flist,
-+ unsigned long *nfiles, int *scand, int flag)
-+ {
-+ struct stat sbuf;
-+ int rv = -2; /* impossible value */
-+
-+ if (scand)
-+ *scand = -1; /* assume error for safety */
-+ *nfiles = 0;
-+ if((stat(name,&sbuf) < 0)
-+ || (flag == CCLIENT
-+ && ((rv = maildir_eliminate_duplicate(name, flist, nfiles)) < 0)))
-+ return 0L;
-+
-+ if (scand && (rv > 0 || rv == -2))
-+ *nfiles = maildir_doscandir(name, flist, flag);
-+
-+ if(scand) *scand = *nfiles;
-+
-+ return (unsigned long) sbuf.st_ctime;
-+ }
-+
-+ /* Does a message with given name exists (or was it removed)?
-+ * Returns: 1 - yes, such message exist,
-+ * 0 - No, that message does not exist anymore
-+ *
-+ * Parameters: stream, name of mailbox, new name if his message does not
-+ * exist.
-+ */
-+
-+ int maildir_message_exists(MAILSTREAM *stream, char *name, char *newfile)
-+ {
-+ char tmp[MAILTMPLEN];
-+ int gotit = NIL;
-+ DIR *dir;
-+ struct direct *d;
-+ struct stat sbuf;
-+
-+ /* First check directly if it exists, if not there, look for it */
-+ sprintf(tmp,"%s/%s", LOCAL->curdir, name);
-+ if ((stat(tmp, &sbuf) == 0) && ((sbuf.st_mode & S_IFMT) == S_IFREG))
-+ return T;
-+
-+ if (!(dir = opendir (LOCAL->curdir)))
-+ return NIL;
-+
-+ while ((d = readdir(dir)) && gotit == NIL){
-+ if (d->d_name[0] == '.')
-+ continue;
-+ if (same_maildir_file(d->d_name, name)){
-+ gotit = T;
-+ strcpy(newfile, d->d_name);
-+ }
-+ }
-+ closedir(dir);
-+ return gotit;
-+ }
-+
-+ /* Maildir open */
-+
-+ MAILSTREAM *maildir_open (MAILSTREAM *stream)
-+ {
-+ char tmp[MAILTMPLEN];
-+ struct stat sbuf;
-+
-+ if (!stream) return &maildirproto;
-+ if (stream->local) fatal ("maildir recycle stream");
-+ md_domain_name(); /* get domain name for maildir files in mdlocaldomain */
-+ if(mypid == (pid_t) 0)
-+ mypid = getpid();
-+ if (!stream->rdonly){
-+ stream->perm_seen = stream->perm_deleted = stream->perm_flagged =
-+ stream->perm_answered = stream->perm_draft = T;
-+ }
-+ stream->local = (MAILDIRLOCAL *) fs_get (sizeof (MAILDIRLOCAL));
-+ memset(LOCAL, 0, sizeof(MAILDIRLOCAL));
-+ LOCAL->fd = -1;
-+
-+ LOCAL->courier = IS_COURIER(stream->mailbox);
-+ strcpy(tmp, stream->mailbox);
-+ if (maildir_file_path (stream->mailbox, tmp))
-+ LOCAL->dir = cpystr (tmp);
-+ LOCAL->candouid = maildir_can_assign_uid(stream);
-+ maildir_read_uid(stream, &stream->uid_last, &stream->uid_validity);
-+ if (LOCAL->dir){
-+ MDFLD(tmp, LOCAL->dir, Cur);
-+ LOCAL->curdir = cpystr (tmp);
-+ if (stat (LOCAL->curdir,&sbuf) < 0) {
-+ sprintf (tmp,"Can't open folder %s: %s",
-+ stream->mailbox,strerror (errno));
-+ mm_log (tmp,ERROR);
-+ maildir_close(stream, 0);
-+ return NIL;
-+ }
-+ }
-+
-+ if(maildir_file_path (stream->mailbox, tmp)){
-+ fs_give ((void **) &stream->mailbox);
-+ stream->mailbox = cpystr(tmp);
-+ }
-+
-+ LOCAL->buf = (char *) fs_get ((LOCAL->buflen = SENDBUFLEN) + 1);
-+ stream->sequence++;
-+ stream->nmsgs = stream->recent = 0L;
-+
-+ maildir_parse_folder(stream, 1);
-+
-+ return stream;
-+ }
-+
-+ /* Maildir initial parsing of the folder */
-+ void
-+ maildir_parse_folder (MAILSTREAM *stream, int full)
-+ {
-+ char tmp[MAILTMPLEN], tmp2[MAILTMPLEN];
-+ struct direct **namescur = NIL, **namesnew = NIL;
-+ unsigned long i, nfilescur = 0L, nfilesnew = 0L, oldpos, newpos, total;
-+ int scan_err, rescan, loop = 0;
-+
-+ if (!stream) /* what??? */
-+ return;
-+
-+ MM_CRITICAL(stream);
-+
-+ MDFLD(tmp, LOCAL->dir, New);
-+ maildir_scandir (tmp, &namesnew, &nfilesnew, &scan_err, CCLIENT);
-+ if (scan_err < 0)
-+ maildir_abort(stream);
-+
-+ /* Scan old messages first, escoba! */
-+ if(stream->rdonly ||
-+ (LOCAL && ((maildir_initial_check(stream, Cur) == 0)
-+ || nfilesnew > 0L))){
-+ MDFLD(tmp, LOCAL->dir, Cur);
-+ LOCAL->scantime = maildir_scandir (tmp, &namescur, &nfilescur,
-+ &scan_err, CCLIENT);
-+ if (scan_err < 0){
-+ if(namesnew){
-+ for(i = 0L; i < nfilesnew; i++)
-+ fs_give((void **)&namesnew[i]);
-+ fs_give((void **) &namesnew);
-+ }
-+ maildir_abort(stream);
-+ }
-+ }
-+ if(LOCAL && (maildir_initial_check(stream, New) == 0)
-+ && (nfilescur > 0L)){
-+ MDFLD(tmp, LOCAL->dir, New);
-+ while(LOCAL && loop < 10){
-+ if(nfilesnew == 0L)
-+ maildir_scandir (tmp, &namesnew, &nfilesnew, &scan_err, CCLIENT);
-+ if (scan_err < 0){
-+ if(namesnew){
-+ for(i = 0L; i < nfilesnew; i++)
-+ fs_give((void **)&namesnew[i]);
-+ fs_give((void **) &namesnew);
-+ }
-+ maildir_abort(stream);
-+ break;
-+ }
-+ for(i = 0L, rescan = 0, newpos = oldpos = 0L;
-+ newpos < nfilescur && i < nfilesnew; i++){
-+ if(maildir_message_in_list(namesnew[i]->d_name, namescur, oldpos,
-+ nfilescur - 1L, &newpos)){
-+ oldpos = newpos;
-+ sprintf(tmp2,"%s/%s",tmp,namesnew[i]->d_name);
-+ if(unlink(tmp2) < 0)
-+ scan_err = -1;
-+ rescan++;
-+ }
-+ else
-+ newpos = oldpos;
-+ }
-+ if(scan_err < 0)
-+ maildir_abort(stream);
-+ if(rescan == 0)
-+ break;
-+ else{ /* restart */
-+ if(namesnew){
-+ for(i = 0L; i < nfilesnew; i++)
-+ fs_give((void **)&namesnew[i]);
-+ fs_give((void **) &namesnew);
-+ }
-+ nfilesnew = 0L;
-+ loop++;
-+ }
-+ }
-+ }
-+ if(loop == 10)
-+ maildir_abort(stream);
-+ if(LOCAL){
-+ if(stream->rdonly)
-+ stream->recent = 0L;
-+ total = namescur || stream->rdonly
-+ ? maildir_parse_dir(stream, 0L, Cur, namescur,
-+ nfilescur, full) : stream->nmsgs;
-+ stream->nmsgs = maildir_parse_dir(stream, total, New, namesnew,
-+ nfilesnew, full);
-+ }
-+ if(namesnew){
-+ for(i = 0L; i < nfilesnew; i++)
-+ fs_give((void **)&namesnew[i]);
-+ fs_give((void **) &namesnew);
-+ }
-+ if(namescur){
-+ for(i = 0L; i < nfilescur; i++)
-+ fs_give((void **)&namescur[i]);
-+ fs_give((void **) &namescur);
-+ }
-+ MM_NOCRITICAL(stream);
-+ }
-+
-+ int
-+ maildir_initial_check (MAILSTREAM *stream, DirNamesType dirtype)
-+ {
-+ char tmp[MAILTMPLEN];
-+ struct stat sbuf;
-+
-+ MDFLD(tmp, LOCAL->dir, dirtype);
-+ if (access (tmp, R_OK|W_OK|X_OK) != 0){
-+ maildir_abort(stream);
-+ return -1;
-+ }
-+
-+ MDFLD(tmp, LOCAL->dir, Cur);
-+ if (dirtype != New &&
-+ (stat(tmp, &sbuf) < 0 || sbuf.st_ctime == LOCAL->scantime))
-+ return -1;
-+ return 0;
-+ }
-+
-+
-+ /* Return the number of messages in the directory, while filling the
-+ * elt structure.
-+ */
-+
-+ unsigned long
-+ maildir_parse_dir(MAILSTREAM *stream, unsigned long nmsgs,
-+ DirNamesType dirtype, struct direct **names,
-+ unsigned long nfiles, int full)
-+ {
-+ char tmp[MAILTMPLEN], tmp2[MAILTMPLEN], file[MAILTMPLEN],
-+ newfile[MAILTMPLEN], *mdstr;
-+ struct stat sbuf;
-+ unsigned long i, new = 0L, l, uid_last;
-+ unsigned long recent = stream ? stream->recent : 0L;
-+ int d = 0, f = 0, r = 0, s = 0, t = 0;
-+ int we_compute, in_list;
-+ int silent = stream ? stream->silent : NIL;
-+ MESSAGECACHE *elt;
-+
-+ MDFLD(tmp, LOCAL->dir, dirtype);
-+ if (dirtype == Cur && !stream->rdonly)
-+ for (i = 1L; i <= stream->nmsgs;){
-+ elt = mail_elt(stream, i);
-+ in_list = elt && elt->private.spare.ptr && nfiles > 0L
-+ ? (MDPOS(elt) < nfiles
-+ ? same_maildir_file(MDFILE(elt), names[MDPOS(elt)]->d_name)
-+ : NIL)
-+ || maildir_message_in_list(MDFILE(elt), names, 0L,
-+ nfiles - 1L, &MDPOS(elt))
-+ : NIL;
-+ if (!in_list){
-+ if (elt->private.spare.ptr)
-+ maildir_free_file ((void **) &elt->private.spare.ptr);
-+
-+ if (elt->recent) --recent;
-+ mail_expunged(stream,i);
-+ }
-+ else i++;
-+ }
-+
-+ stream->silent = T;
-+ uid_last = 0L;
-+ for (we_compute = 0, i = l = 1L; l <= nfiles; l++){
-+ unsigned long pos, uid;
-+ if (dirtype == New && !stream->rdonly){ /* move new messages to cur */
-+ pos = l - 1L;
-+ sprintf (file,"%s/%s", tmp, names[pos]->d_name);
-+ if(lstat(file,&sbuf) == 0)
-+ switch(sbuf.st_mode & S_IFMT){
-+ case S_IFREG:
-+ strcpy(tmp2, names[pos]->d_name);
-+ if((mdstr = strstr(tmp2,MDSEP(3)))
-+ || (mdstr = strstr(tmp2,MDSEP(2))))
-+ *(mdstr+1) = '2';
-+ else
-+ strcat(tmp2, MDSEP(2));
-+ sprintf(newfile, "%s/%s",LOCAL->curdir, tmp2);
-+ if(rename (file, newfile) != 0){
-+ mm_log("Unable to read new mail!", WARN);
-+ continue;
-+ }
-+ unlink (file);
-+ new++;
-+ break;
-+ case S_IFLNK: /* clean up, clean up, everybody, everywhere */
-+ if(unlink(file) < 0){
-+ if(LOCAL->link == NIL){
-+ mm_log("Unable to remove symbolic link", WARN);
-+ LOCAL->link = T;
-+ }
-+ }
-+ continue;
-+ break;
-+ default:
-+ if(LOCAL && LOCAL->link == NIL){
-+ mm_log("Unrecognized file or link in folder", WARN);
-+ LOCAL->link = T;
-+ }
-+ continue;
-+ break;
-+ }
-+ }
-+ mail_exists(stream, i + nmsgs);
-+ elt = mail_elt(stream, i + nmsgs);
-+ pos = (elt && elt->private.spare.ptr) ? MDPOS(elt) : l - 1L;
-+ if (dirtype == New) elt->recent = T;
-+ maildir_getflag(names[pos]->d_name, &d, &f, &r ,&s, &t);
-+ if (elt->private.spare.ptr)
-+ maildir_free_file_only ((void **)&elt->private.spare.ptr);
-+ else{
-+ maildir_get_file((MAILDIRFILE **)&elt->private.spare.ptr);
-+ we_compute++;
-+ }
-+ MDFILE(elt) = cpystr(names[pos]->d_name);
-+ MDPOS(elt) = pos;
-+ MDLOC(elt) = dirtype;
-+ if (dirtype == Cur){ /* deal with UIDs */
-+ if(elt->private.uid == 0L)
-+ elt->private.uid = maildir_get_uid(MDFILE(elt));
-+ if(elt->private.uid <= uid_last){
-+ uid = (we_compute ? uid_last : stream->uid_last) + 1L;
-+ if(LOCAL->candouid)
-+ maildir_assign_uid(stream, i + nmsgs, uid);
-+ else
-+ elt->private.uid = uid;
-+ }
-+ else
-+ uid = elt->private.uid;
-+ uid_last = uid;
-+ if(uid_last > stream->uid_last)
-+ stream->uid_last = uid_last;
-+ }
-+ if(dirtype == New && !stream->rdonly){
-+ maildir_free_file_only((void **)&elt->private.spare.ptr);
-+ MDFILE(elt) = cpystr(tmp2);
-+ MDSIZE(elt) = sbuf.st_size;
-+ MDMTIME(elt) = sbuf.st_mtime;
-+ MDLOC(elt) = Cur;
-+ }
-+ if (elt->draft != d || elt->flagged != f ||
-+ elt->answered != r || elt->seen != s || elt->deleted != t){
-+ elt->draft = d; elt->flagged = f; elt->answered = r;
-+ elt->seen = s; elt->deleted = t;
-+ if (!we_compute && !stream->rdonly)
-+ MM_FLAGS(stream, i+nmsgs);
-+ }
-+ maildir_get_date(stream, i+nmsgs);
-+ elt->valid = T;
-+ i++;
-+ }
-+ stream->silent = silent;
-+ if(LOCAL->candouid && dirtype == Cur)
-+ maildir_read_uid(stream, NULL, &stream->uid_validity);
-+ if (dirtype == New && stream->rdonly)
-+ new = nfiles;
-+ mail_exists(stream, nmsgs + ((dirtype == New) ? new : nfiles));
-+ mail_recent(stream, recent + ((dirtype == New) ? new : 0L));
-+
-+ return (nmsgs + (dirtype == New ? new : nfiles));
-+ }
-+
-+ long maildir_ping (MAILSTREAM *stream)
-+ {
-+ maildir_parse_folder(stream, 0);
-+ if(stream && LOCAL){
-+ if(LOCAL->candouid)
-+ maildir_uid_renew_tempfile(stream);
-+ else /* try again to get uids */
-+ LOCAL->candouid = maildir_can_assign_uid(stream);
-+ }
-+ return stream && LOCAL ? LONGT : NIL;
-+ }
-+
-+ int maildir_select (const struct direct *name)
-+ {
-+ return (name->d_name[0] != '.');
-+ }
-+
-+ /*
-+ * Unfortunately, there is no way to sort by arrival in this driver, this
-+ * means that opening a folder in this driver using the scandir function
-+ * will always make this driver slower than any driver that has a natural
-+ * way of sorting by arrival (like a flat file format, "mbox", "mbx", etc).
-+ */
-+ int maildir_namesort (const void *d1, const void *d2)
-+ {
-+ const struct direct *e1 = *(const struct direct **) d1;
-+ const struct direct *e2 = *(const struct direct **) d2;
-+
-+ return comp_maildir_file((char *) e1->d_name, (char *) e2->d_name);
-+ }
-+
-+ /* Maildir close */
-+
-+ void maildir_close (MAILSTREAM *stream, long options)
-+ {
-+ MESSAGECACHE *elt;
-+ unsigned long i;
-+ int silent = stream ? stream->silent : 0;
-+ mailcache_t mc = (mailcache_t) mail_parameters (NIL,GET_CACHE,NIL);
-+
-+ if (!stream) return;
-+
-+ for (i = 1L; i <= stream->nmsgs; i++)
-+ if((elt = (MESSAGECACHE *) (*mc)(stream,i,CH_ELT)) && elt->private.spare.ptr)
-+ maildir_free_file ((void **) &elt->private.spare.ptr);
-+ stream->silent = T;
-+ if (options & CL_EXPUNGE) maildir_expunge (stream, NIL, NIL);
-+ maildir_abort(stream);
-+ if (mdfpath) fs_give((void **)&mdfpath);
-+ if (mypid) mypid = (pid_t) 0;
-+ stream->silent = silent;
-+ }
-+
-+ void maildir_check (MAILSTREAM *stream)
-+ {
-+ if (maildir_ping (stream)) mm_log ("Check completed",(long) NIL);
-+ }
-+
-+ long maildir_text (MAILSTREAM *stream,unsigned long msgno,STRING *bs, long flags)
-+ {
-+ char tmp[MAILTMPLEN];
-+ unsigned long i;
-+ MESSAGECACHE *elt;
-+ char *s;
-+ /* UID call "impossible" */
-+ if (flags & FT_UID || !LOCAL) return NIL;
-+ elt = mail_elt (stream, msgno);
-+
-+ if (!(flags & FT_PEEK) && !elt->seen){
-+ elt->seen = T;
-+ maildir_flagmsg (stream, elt);
-+ MM_FLAGS(stream, elt->msgno);
-+ }
-+
-+ MSGPATH(tmp, LOCAL->dir, MDFILE(elt), MDLOC(elt));
-+ if (LOCAL->fd < 0) /* if file closed ? */
-+ LOCAL->fd = open(tmp,O_RDONLY,NIL);
-+
-+ if (LOCAL->fd < 0 && (errno == EACCES || errno == ENOENT)){
-+ INIT (bs, mail_string, "", 0);
-+ elt->rfc822_size = 0L;
-+ return NIL;
-+ }
-+
-+ s = maildir_text_work(stream, elt, &i, flags);
-+ INIT (bs, mail_string, s, i);
-+ return LONGT;
-+ }
-+
-+ char *maildir_text_work (MAILSTREAM *stream,MESSAGECACHE *elt,
-+ unsigned long *length,long flags)
-+ {
-+ FDDATA d;
-+ STRING bs;
-+ char *s,tmp[CHUNK];
-+ unsigned long msgno = elt->msgno;
-+ static int try = 0;
-+
-+ if (length)
-+ *length = 0L;
-+ LOCAL->buf[0] = '\0';
-+
-+ MSGPATH(tmp, LOCAL->dir, MDFILE(elt), MDLOC(elt));
-+ if (LOCAL->fd < 0) /* if file closed ? */
-+ LOCAL->fd = open(tmp,O_RDONLY,NIL);
-+
-+ if (LOCAL->fd < 0){ /* flag change? */
-+ if (try < 5){
-+ try++;
-+ if (maildir_update_elt_maildirp(stream, msgno) > 0)
-+ try = 0;
-+ return maildir_text_work(stream, mail_elt(stream, msgno),length, flags);
-+ }
-+ try = 0;
-+ return NULL;
-+ }
-+
-+ lseek (LOCAL->fd, elt->private.msg.text.offset,L_SET);
-+
-+ if (flags & FT_INTERNAL) { /* initial data OK? */
-+ if (elt->private.msg.text.text.size > LOCAL->buflen) {
-+ fs_give ((void **) &LOCAL->buf);
-+ LOCAL->buf = (char *) fs_get ((LOCAL->buflen =
-+ elt->private.msg.text.text.size) + 1);
-+ }
-+ read (LOCAL->fd,LOCAL->buf,elt->private.msg.text.text.size);
-+ LOCAL->buf[*length = elt->private.msg.text.text.size] = '\0';
-+ }
-+ else {
-+ if (elt->rfc822_size > LOCAL->buflen) {
-+ fs_give ((void **) &LOCAL->buf);
-+ LOCAL->buf = (char *) fs_get ((LOCAL->buflen = elt->rfc822_size) + 1);
-+ }
-+ d.fd = LOCAL->fd; /* yes, set up file descriptor */
-+ d.pos = elt->private.msg.text.offset;
-+ d.chunk = tmp; /* initial buffer chunk */
-+ d.chunksize = CHUNK;
-+ INIT (&bs,fd_string,&d,elt->private.msg.text.text.size);
-+ for (s = LOCAL->buf; SIZE (&bs);) switch (CHR (&bs)) {
-+ case '\r': /* carriage return seen */
-+ *s++ = SNX (&bs); /* copy it and any succeeding LF */
-+ if (SIZE (&bs) && (CHR (&bs) == '\n')) *s++ = SNX (&bs);
-+ break;
-+ case '\n':
-+ *s++ = '\r'; /* insert a CR */
-+ default:
-+ *s++ = SNX (&bs); /* copy characters */
-+ }
-+ *s = '\0'; /* tie off buffer */
-+ *length = s - (char *) LOCAL->buf; /* calculate length */
-+ }
-+ close(LOCAL->fd); LOCAL->fd = -1;
-+ return LOCAL->buf;
-+ }
-+
-+ /* maildir parse, fill the elt structure... well not all of it... */
-+ unsigned long maildir_parse_message(MAILSTREAM *stream, unsigned long msgno,
-+ DirNamesType dirtype)
-+ {
-+ char *b, *s, *t, c;
-+ char tmp[MAILTMPLEN];
-+ struct stat sbuf;
-+ unsigned long i, len;
-+ int d, f, r, se, dt;
-+ MESSAGECACHE *elt;
-+
-+ elt = mail_elt (stream,msgno);
-+ MSGPATH(tmp, LOCAL->dir, MDFILE(elt), dirtype);
-+ if(stat(tmp, &sbuf) == 0)
-+ MDSIZE(elt) = sbuf.st_size;
-+
-+ maildir_get_date(stream, msgno);
-+ maildir_getflag(MDFILE(elt), &d, &f, &r ,&se, &dt);
-+ elt->draft = d; elt->flagged = f; elt->answered = r; elt->seen = se;
-+ elt->deleted = dt; elt->valid = T;
-+ if (LOCAL->fd < 0) /* if file closed ? */
-+ LOCAL->fd = open(tmp,O_RDONLY,NIL);
-+
-+ if (LOCAL->fd >= 0){
-+ s = (char *) fs_get (MDSIZE(elt) + 1);
-+ read (LOCAL->fd,s,MDSIZE(elt));
-+ s[MDSIZE(elt)] = '\0';
-+ t = s + strlen(s); /* make t point to the end of s */
-+ for (i = 0L, b = s; b < t && !(i && (*b == '\n')); i = (*b++ == '\n'));
-+ len = (*b ? ++b : b) - s;
-+ elt->private.msg.header.text.size =
-+ elt->private.msg.text.offset = len;
-+ elt->private.msg.text.text.size = MDSIZE(elt) - len;
-+ for (i = 0L, b = s, c = *b; b &&
-+ ((c < '\016' && ((c == '\012' && ++i)
-+ ||(c == '\015' && *(b+1) == '\012' && ++b && (i +=2))))
-+ || b < t); i++, c= *++b);
-+ elt->rfc822_size = i;
-+ fs_give ((void **) &s);
-+ close(LOCAL->fd); LOCAL->fd = -1;
-+ }
-+ return elt->rfc822_size;
-+ }
-+
-+ int
-+ maildir_update_elt_maildirp(MAILSTREAM *stream, unsigned long msgno)
-+ {
-+ char tmp[MAILTMPLEN];
-+ struct direct **names = NIL;
-+ unsigned long i, nfiles, pos;
-+ int d = 0, f = 0 , r = 0, s = 0, t = 0, in_list, scan_err;
-+ MESSAGECACHE *elt;
-+
-+ MDFLD(tmp, LOCAL->dir, Cur);
-+
-+ maildir_scandir (tmp, &names, &nfiles, &scan_err, CCLIENT);
-+
-+ elt = mail_elt (stream,msgno);
-+
-+ in_list = nfiles > 0L
-+ ? maildir_message_in_list(MDFILE(elt), names, 0L, nfiles - 1L, &pos)
-+ : NIL;
-+
-+ if (in_list && pos >= 0L && pos < nfiles
-+ && !strcmp(MDFILE(elt), names[pos]->d_name)){
-+ in_list = NIL;
-+ maildir_abort(stream);
-+ }
-+
-+ if (in_list && pos >= 0L && pos < nfiles){
-+ maildir_free_file_only((void **)&elt->private.spare.ptr);
-+ MDFILE(elt) = cpystr(names[pos]->d_name);
-+ maildir_getflag(MDFILE(elt), &d, &f, &r ,&s, &t);
-+ if (elt->draft != d || elt->flagged != f ||
-+ elt->answered != r || elt->seen != s || elt->deleted != t){
-+ elt->draft = d; elt->flagged = f; elt->answered = r;
-+ elt->seen = s; elt->deleted = t;
-+ MM_FLAGS(stream, msgno);
-+ }
-+ }
-+ for (i = 0L; i < nfiles; i++)
-+ fs_give((void **) &names[i]);
-+ if (names)
-+ fs_give((void **) &names);
-+ return in_list ? 1 : -1;
-+ }
-+
-+ /* Maildir fetch message header */
-+
-+ char *maildir_header (MAILSTREAM *stream,unsigned long msgno,
-+ unsigned long *length, long flags)
-+ {
-+ char tmp[MAILTMPLEN], *s;
-+ MESSAGECACHE *elt;
-+ static int try = 0;
-+
-+ if (length) *length = 0;
-+ if (flags & FT_UID || !LOCAL) return ""; /* UID call "impossible" */
-+ elt = mail_elt (stream,msgno);
-+ if(elt->private.msg.header.text.size == 0)
-+ maildir_parse_message(stream, msgno, MDLOC(elt));
-+
-+ MSGPATH(tmp, LOCAL->dir, MDFILE(elt), MDLOC(elt));
-+ if (LOCAL->fd < 0)
-+ LOCAL->fd = open (tmp,O_RDONLY,NIL);
-+
-+ if (LOCAL->fd < 0 && errno == EACCES){
-+ mm_log ("Message exists but can not be read. Envelope and body lost!",ERROR);
-+ return NULL;
-+ }
-+
-+ if (LOCAL->fd < 0){ /* flag change? */
-+ if (try < 5){
-+ try++;
-+ if (maildir_update_elt_maildirp(stream, msgno) > 0)
-+ try = 0;
-+ return maildir_header(stream, msgno, length, flags);
-+ }
-+ try = 0;
-+ return NULL;
-+ }
-+
-+ if (flags & FT_INTERNAL){
-+ if(elt->private.msg.header.text.size > LOCAL->buflen){
-+ fs_give ((void **) &LOCAL->buf);
-+ LOCAL->buf = (char *) fs_get ((LOCAL->buflen =
-+ elt->private.msg.header.text.size) + 1);
-+ }
-+ read (LOCAL->fd, (void *)LOCAL->buf, elt->private.msg.header.text.size);
-+ LOCAL->buf[*length = elt->private.msg.header.text.size] = '\0';
-+ }
-+ else{
-+ s = (char *) fs_get(elt->private.msg.header.text.size+1);
-+ read (LOCAL->fd, (void *)s, elt->private.msg.header.text.size);
-+ s[elt->private.msg.header.text.size] = '\0';
-+ *length = strcrlfcpy (&LOCAL->buf,&LOCAL->buflen,s,
-+ elt->private.msg.header.text.size);
-+ fs_give ((void **) &s);
-+ }
-+ elt->private.msg.text.offset = elt->private.msg.header.text.size;
-+ elt->private.msg.text.text.size = MDSIZE(elt) - elt->private.msg.text.offset;
-+ close(LOCAL->fd); LOCAL->fd = -1;
-+ return LOCAL->buf;
-+ }
-+
-+ /* Maildir find list of subscribed mailboxes
-+ * Accepts: mail stream
-+ * pattern to search
-+ */
-+
-+ void maildir_list (MAILSTREAM *stream,char *ref, char *pat)
-+ {
-+ char *s,test[MAILTMPLEN],file[MAILTMPLEN];
-+ long i = 0L;
-+
-+ if((!pat || !*pat) && maildir_canonicalize (test,ref,"*")
-+ && maildir_valid_name(test)){ /* there is a #md/ leading here */
-+ for (i = 3L; test[i] && test[i] != '/'; i++);
-+ if ((s = strchr (test+i+1,'/')) != NULL) *++s = '\0';
-+ else test[0] = '\0';
-+ mm_list (stream,'/',test, LATT_NOSELECT);
-+ }
-+ else if (maildir_canonicalize (test,ref,pat)) {
-+ if (test[3] == '/') { /* looking down levels? */
-+ /* yes, found any wildcards? */
-+ if ((s = strpbrk (test,"%*")) != NULL){
-+ /* yes, copy name up to that point */
-+ strncpy (file,test+4,i = s - (test+4));
-+ file[i] = '\0'; /* tie off */
-+ }
-+ else strcpy (file,test+4);/* use just that name then */
-+ /* find directory name */
-+ if ((s = strrchr (file, '/')) != NULL){
-+ *s = '\0'; /* found, tie off at that point */
-+ s = file;
-+ }
-+ /* do the work */
-+ if(IS_COURIER(test))
-+ courier_list_work (stream,s,test,0);
-+ else
-+ maildir_list_work (stream,s,test,0);
-+ }
-+ /* always an INBOX */
-+ if (!compare_cstring (test,"#MD/INBOX"))
-+ mm_list (stream,NIL,"#MD/INBOX",LATT_NOINFERIORS);
-+ if (!compare_cstring (test,"#MC/INBOX"))
-+ mm_list (stream,NIL,"#MC/INBOX",LATT_NOINFERIORS);
-+ }
-+ }
-+
-+ void courier_list (MAILSTREAM *stream,char *ref, char *pat)
-+ {
-+ /* I am too lazy to do anything. Do you care to ask maildir list, please?
-+ The real reason why this is a dummy function is because we do not want to
-+ see the same folder listed twice.
-+ */
-+ }
-+
-+ /* For those that want to hide things, we give them a chance to do so */
-+ void *maildir_parameters (long function, void *value)
-+ {
-+ void *ret = NIL;
-+ switch ((int) function) {
-+ case SET_MDINBOXPATH:
-+ if(strlen((char *) value ) > 49)
-+ strcpy(myMdInboxDir, "Maildir");
-+ else
-+ strcpy(myMdInboxDir, (char *) value);
-+ case GET_MDINBOXPATH:
-+ if (myMdInboxDir[0] == '\0') strcpy(myMdInboxDir,"Maildir");
-+ ret = (void *) myMdInboxDir;
-+ break;
-+ case SET_COURIERSTYLE:
-+ CourierStyle = (long) value;
-+ case GET_COURIERSTYLE:
-+ ret = (void *) CourierStyle;
-+ break;
-+ case GET_DIRFMTTEST:
-+ ret = (void *) maildir_dirfmttest;
-+ break;
-+ default:
-+ break;
-+ }
-+ return ret;
-+ }
-+
-+ int maildir_create_folder(char *mailbox)
-+ {
-+ char tmp[MAILTMPLEN], err[MAILTMPLEN];
-+ int i;
-+
-+ for (i = Cur; i != EndDir; i++){
-+ MDFLD(tmp, mailbox, i);
-+ if (mkdir(tmp, 0700) && errno != EEXIST){ /* try to make new dir */
-+ sprintf (err, "Can't create %s: %s", tmp, strerror(errno));
-+ mm_log (err,ERROR);
-+ return NIL;
-+ }
-+ }
-+ return T;
-+ }
-+
-+ int maildir_create_work(char *mailbox, int loop)
-+ {
-+ char *s, c, err[MAILTMPLEN], tmp[MAILTMPLEN], tmp2[MAILTMPLEN], mbx[MAILTMPLEN];
-+ int fnlen, create_dir = 0, courier, mv;
-+ struct stat sbuf;
-+ long style = (long) maildir_parameters(GET_COURIERSTYLE, NIL);
-+
-+ courier = IS_COURIER(mailbox);
-+ strcpy(mbx, mailbox);
-+ mv = maildir_valid(mbx) ? 1 : 0;
-+ maildir_file_path(mailbox, tmp);
-+ if (mailbox[strlen(mailbox) - 1] == MDSEPARATOR(courier)){
-+ create_dir++;
-+ mailbox[strlen(mailbox) - 1] = '\0';
-+ }
-+
-+ if(!loop && courier){
-+ if(mv){
-+ if(create_dir){
-+ if(style == CCLIENT)
-+ strcpy (err,"Can not create directory: folder exists. Create subfolder");
-+ else
-+ strcpy(err,"Folder and Directory already exist");
-+ }
-+ else
-+ strcpy (err, "Can't create mailbox: mailbox already exists");
-+ }
-+ else{
-+ if(create_dir)
-+ strcpy(err, "Can not create directory. Cread folder instead");
-+ else
-+ err[0] = '\0';
-+ }
-+ if(err[0]){
-+ mm_log (err,ERROR);
-+ return NIL;
-+ }
-+ }
-+
-+ fnlen = strlen(tmp);
-+ if ((s = strrchr(mailbox,MDSEPARATOR(courier))) != NULL){
-+ c = *++s;
-+ *s = '\0';
-+ if ((stat(tmp,&sbuf) || ((sbuf.st_mode & S_IFMT) != S_IFDIR)) &&
-+ !maildir_create_work (mailbox, ++loop))
-+ return NIL;
-+ *s = c;
-+ }
-+ tmp[fnlen] = '\0';
-+
-+ if (mkdir(tmp,0700) && errno != EEXIST)
-+ return NIL;
-+
-+ if (create_dir)
-+ mailbox[fnlen] = '/';
-+
-+ if (create_dir){
-+ if(style == CCLIENT){
-+ if(!courier){
-+ FILE *fp = NULL;
-+ sprintf(tmp2,"%s%s", tmp, MDDIR);
-+ if ((fp = fopen(tmp2,"w")) == NULL){
-+ sprintf (err,"Problem creating %s: %s", tmp2, strerror(errno));
-+ mm_log (err,ERROR);
-+ return NIL;
-+ }
-+ fclose(fp);
-+ }
-+ }
-+ return T;
-+ }
-+ else
-+ return maildir_create_folder(tmp);
-+ }
-+
-+ long maildir_create (MAILSTREAM *stream,char *mailbox)
-+ {
-+ char tmp[MAILTMPLEN], err[MAILTMPLEN];
-+ int rv, create_dir;
-+
-+ create_dir = mailbox ?
-+ (mailbox[strlen(mailbox) - 1] ==
-+ MDSEPARATOR(IS_COURIER(mailbox))) : 0;
-+ maildir_file_path(mailbox, tmp);
-+ strcpy(tmp, mailbox);
-+ rv = maildir_create_work(mailbox, 0);
-+ strcpy(mailbox, tmp);
-+ if (rv == 0){
-+ sprintf (err,"Can't create %s %s",
-+ (create_dir ? "directory" : "mailbox"), mailbox);
-+ mm_log (err,ERROR);
-+ }
-+ return rv ? LONGT : NIL;
-+ }
-+
-+ #define MAXTRY 10000
-+ void maildir_flagmsg (MAILSTREAM *stream,MESSAGECACHE *elt)
-+ {
-+ char oldfile[MAILTMPLEN],newfile[MAILTMPLEN],fn[MAILTMPLEN];
-+ char *s;
-+ int ren, try = 0;
-+
-+ if (elt->valid){
-+ for (try = 1; try > 0 && try < MAXTRY; try++){
-+ /* build the new filename */
-+ sprintf (oldfile,"%s/%s",LOCAL->curdir, MDFILE(elt));
-+ fn[0] = '\0';
-+ if ((ren = maildir_message_exists(stream, MDFILE(elt), fn)) == 0){
-+ errno = ENOENT;
-+ try = MAXTRY;
-+ }
-+ if (*fn) /* new oldfile! */
-+ sprintf (oldfile,"%s/%s",LOCAL->curdir,fn);
-+ if ((s = strrchr (MDFILE(elt), FLAGSEP))) *s = '\0';
-+ sprintf (fn,"%s%s%s%s%s%s%s", MDFILE(elt), MDSEP(2),
-+ MDFLAG(Draft, elt->draft), MDFLAG(Flagged, elt->flagged),
-+ MDFLAG(Replied, elt->answered), MDFLAG(Seen, elt->seen),
-+ MDFLAG(Trashed, elt->deleted));
-+ sprintf (newfile,"%s/%s",LOCAL->curdir,fn);
-+ if (ren != 0 && rename (oldfile,newfile) >= 0)
-+ try = -1;
-+ }
-+
-+ if (try > 0){
-+ sprintf(oldfile,"Unable to write flags to disk: %s",
-+ (errno == ENOENT) ? "message is gone!" : strerror (errno));
-+ mm_log(oldfile,ERROR);
-+ return;
-+ }
-+ #ifdef __CYGWIN__
-+ utime(LOCAL->curdir, NIL); /* make sure next scan will catch the change */
-+ #endif
-+ maildir_free_file_only ((void **) &elt->private.spare.ptr);
-+ MDFILE(elt) = cpystr (fn);
-+ }
-+ }
-+
-+ long maildir_expunge (MAILSTREAM *stream, char *sequence, long options)
-+ {
-+ long ret;
-+ MESSAGECACHE *elt;
-+ unsigned long i, n = 0L;
-+ unsigned long recent = stream->recent;
-+ char tmp[MAILTMPLEN];
-+
-+ mm_critical (stream); /* go critical */
-+ ret = sequence ? ((options & EX_UID) ?
-+ mail_uid_sequence (stream,sequence) :
-+ mail_sequence (stream,sequence)) : LONGT;
-+ if(ret == 0L)
-+ return 0L;
-+ for (i = 1L; i <= stream->nmsgs;){
-+ elt = mail_elt (stream,i);
-+ if (elt->deleted && (sequence ? elt->sequence : T)){
-+ sprintf (tmp,"%s/%s",LOCAL->curdir, MDFILE(elt));
-+ if (unlink (tmp) < 0) {/* try to delete the message */
-+ sprintf (tmp,"Expunge of message %ld failed, aborted: %s",i,
-+ strerror (errno));
-+ if (!stream->silent)
-+ mm_log (tmp,WARN);
-+ break;
-+ }
-+ if (elt->private.spare.ptr)
-+ maildir_free_file ((void **) &elt->private.spare.ptr);
-+ if (elt->recent) --recent;/* if recent, note one less recent message */
-+ mail_expunged (stream,i); /* notify upper levels */
-+ n++; /* count up one more expunged message */
-+ }
-+ else i++;
-+ }
-+ if(n){ /* output the news if any expunged */
-+ sprintf (tmp,"Expunged %ld messages",n);
-+ if (!stream->silent)
-+ mm_log (tmp,(long) NIL);
-+ }
-+ else
-+ if (!stream->silent)
-+ mm_log ("No messages deleted, so no update needed",(long) NIL);
-+ mm_nocritical (stream); /* release critical */
-+ /* notify upper level of new mailbox size */
-+ mail_exists (stream,stream->nmsgs);
-+ mail_recent (stream,recent);
-+ return ret;
-+ }
-+
-+ long maildir_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options)
-+ {
-+ STRING st;
-+ MESSAGECACHE *elt;
-+ unsigned long len;
-+ int fd;
-+ unsigned long i;
-+ struct stat sbuf;
-+ char tmp[MAILTMPLEN], flags[MAILTMPLEN], path[MAILTMPLEN], *s;
-+ /* copy the messages */
-+ if ((options & CP_UID) ? mail_uid_sequence (stream, sequence) :
-+ mail_sequence (stream,sequence))
-+ for (i = 1L; i <= stream->nmsgs; i++)
-+ if ((elt = mail_elt (stream,i))->sequence){
-+ MSGPATH(path, LOCAL->dir, MDFILE(elt), MDLOC(elt));
-+ if (((fd = open (path,O_RDONLY,NIL)) < 0)
-+ ||((!elt->rfc822_size &&
-+ ((stat(path, &sbuf) < 0) || !S_ISREG (sbuf.st_mode)))))
-+ return NIL;
-+ if(!elt->rfc822_size)
-+ MDSIZE(elt) = sbuf.st_size;
-+ s = (char *) fs_get(MDSIZE(elt) + 1);
-+ read (fd,s,MDSIZE(elt));
-+ s[MDSIZE(elt)] = '\0';
-+ close (fd);
-+ len = strcrlfcpy (&LOCAL->buf,&LOCAL->buflen, s, MDSIZE(elt));
-+ INIT (&st,mail_string, LOCAL->buf, len);
-+ elt->rfc822_size = len;
-+ fs_give ((void **)&s);
-+
-+ flags[0] = flags[1] = '\0';
-+ if (elt->seen) strcat (flags," \\Seen");
-+ if (elt->draft) strcat (flags," \\Draft");
-+ if (elt->deleted) strcat (flags," \\Deleted");
-+ if (elt->flagged) strcat (flags," \\Flagged");
-+ if (elt->answered) strcat (flags," \\Answered");
-+ flags[0] = '('; /* open list */
-+ strcat (flags,")"); /* close list */
-+ mail_date (tmp,elt); /* generate internal date */
-+ if (!mail_append_full (NIL,mailbox,flags,tmp,&st))
-+ return NIL;
-+ if (options & CP_MOVE) elt->deleted = T;
-+ }
-+ return LONGT; /* return success */
-+ }
-+
-+ long maildir_append (MAILSTREAM *stream,char *mailbox,append_t af,void *data)
-+ {
-+ int fd, k;
-+ STRING *message;
-+ char c,*s, *flags, *date;
-+ char tmp[MAILTMPLEN],file[MAILTMPLEN],path1[MAILTMPLEN],path2[MAILTMPLEN];
-+ MESSAGECACHE elt;
-+ long i, size = 0L, ret = LONGT, f;
-+ unsigned long uf, ti;
-+ static unsigned int transact = 0;
-+
-+ if (!maildir_valid(mailbox)) {
-+ sprintf (tmp,"Not a valid Maildir mailbox: %s",mailbox);
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+
-+ if (!*mdlocaldomain)
-+ md_domain_name(); /* get domain name for maildir files in mdlocaldomain now! */
-+
-+ if (mypid == (pid_t) 0)
-+ mypid = getpid();
-+
-+ if (!stream){
-+ stream = &maildirproto;
-+
-+ for (k = 0; k < NUSERFLAGS && stream->user_flags[k]; ++k)
-+ fs_give ((void **) &stream->user_flags[k]);
-+ }
-+
-+ if (!(*af) (stream,data,&flags,&date,&message)) return NIL;
-+
-+ mm_critical (stream); /* go critical */
-+ /* call time(0) only once, use transact to distinguish instead */
-+ ti = time(0);
-+ do {
-+ if (!SIZE (message)) { /* guard against zero-length */
-+ mm_log ("Append of zero-length message",ERROR);
-+ ret = NIL;
-+ break;
-+ }
-+ if (date && !mail_parse_date(&elt,date)){
-+ sprintf (tmp,"Bad date in append: %.80s",date);
-+ mm_log (tmp,ERROR);
-+ ret = NIL;
-+ break;
-+ }
-+ f = mail_parse_flags (stream,flags,&uf);
-+ /* build file name we will use */
-+ sprintf (file,"%lu.%d_%09u.%s%s%s%s%s%s",
-+ ti, mypid, transact++, mdlocaldomain, (f ? MDSEP(2) : ""),
-+ MDFLAG(Draft, f&fDRAFT), MDFLAG(Flagged, f&fFLAGGED),
-+ MDFLAG(Replied, f&fANSWERED), MDFLAG(Seen, f&fSEEN));
-+ /* build tmp file name */
-+ if (maildir_file_path(mailbox, tmp))
-+ MSGPATH(path1, tmp, file, Tmp);
-+
-+ if ((fd = open (path1,O_WRONLY|O_CREAT|O_EXCL,S_IREAD|S_IWRITE)) < 0) {
-+ sprintf (tmp, "Can't open append mailbox: %s", strerror (errno));
-+ mm_log (tmp, ERROR);
-+ return NIL;
-+ }
-+ for (size = 0,i = SIZE (message),s = (char *) fs_get (i + 1); i; --i)
-+ if ((c = SNX (message)) != '\015') s[size++] = c;
-+ if ((write (fd, s, size) < 0) || fsync (fd)) {
-+ unlink (path1); /* delete message */
-+ sprintf (tmp, "Message append failed: %s", strerror (errno));
-+ mm_log (tmp, ERROR);
-+ ret = NIL;
-+ }
-+ fs_give ((void **) &s); /* flush the buffer */
-+ close (fd); /* close the file */
-+ /* build final filename to use */
-+ if (maildir_file_path(mailbox, tmp))
-+ MSGPATH(path2, tmp, file, New);
-+ if (rename (path1,path2) < 0) {
-+ sprintf (tmp, "Message append failed: %s", strerror (errno));
-+ mm_log (tmp, ERROR);
-+ ret = NIL;
-+ }
-+ unlink (path1);
-+
-+ if (ret)
-+ if (!(*af) (stream,data,&flags,&date,&message)) ret = NIL;
-+
-+ } while (ret && message); /* write the data */
-+ mm_nocritical (stream); /* release critical */
-+ return ret;
-+ }
-+
-+ long maildir_delete (MAILSTREAM *stream,char *mailbox)
-+ {
-+ DIR *dirp;
-+ struct direct *d;
-+ int i, remove_dir = 0, mddir = 0, rv, error = 0;
-+ char tmp[MAILTMPLEN],tmp2[MAILTMPLEN], realname[MAILTMPLEN];
-+ struct stat sbuf;
-+ int courier = IS_COURIER(mailbox);
-+
-+ if (mailbox[strlen(mailbox) - 1] == MDSEPARATOR(courier)){
-+ remove_dir++;
-+ mailbox[strlen(mailbox) -1] = '\0';
-+ }
-+
-+ if (!maildir_valid(mailbox)){
-+ maildir_file_path(mailbox, tmp);
-+ if (stat(tmp, &sbuf) < 0 || !S_ISDIR(sbuf.st_mode)){
-+ sprintf(tmp,"Can not remove %s", mailbox);
-+ error++;
-+ }
-+ }
-+
-+ if (!error && remove_dir && !maildir_dir_is_empty(mailbox)){
-+ sprintf(tmp,"Can not remove directory %s/: directory not empty", mailbox);
-+ error++;
-+ }
-+
-+ if(error){
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+
-+ maildir_close(stream,0); /* even if stream was NULL */
-+
-+ maildir_file_path(mailbox, realname);
-+
-+ if (remove_dir){
-+ sprintf(tmp,"%s/%s", realname, MDDIR);
-+ if ((rv = stat (tmp,&sbuf)) == 0 && S_ISREG(sbuf.st_mode))
-+ rv = unlink(tmp);
-+ else if (errno == ENOENT)
-+ rv = 0;
-+ if (rv != 0){
-+ sprintf(tmp,"Can not remove %s/%s: %s", tmp2, MDDIR, strerror(errno));
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+ if (!maildir_valid(realname) && rmdir(realname) != 0){
-+ sprintf(tmp,"Can not remove %s/: %s", mailbox, strerror(errno));
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+ return LONGT;
-+ }
-+ /* else remove just the folder. Remove all hidden files, except MDDIR */
-+ for (i = Cur; i != EndDir; i++){
-+ MDFLD(tmp, realname, i);
-+
-+ if (!(dirp = opendir (tmp))){
-+ sprintf(tmp,"Can not read %s/: %s", mailbox, strerror(errno));
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+
-+ while ((d = readdir(dirp)) != NULL){
-+ if (strcmp(d->d_name, ".") && strcmp(d->d_name,"..")){
-+ sprintf(tmp2,"%s/%s", tmp, d->d_name);
-+ if (unlink(tmp2) != 0){
-+ sprintf(tmp2,"Can not remove %s: %s", mailbox, strerror(errno));
-+ mm_log (tmp2,ERROR);
-+ return NIL;
-+ }
-+ }
-+ }
-+ closedir(dirp);
-+ if (rmdir(tmp) != 0){
-+ sprintf(tmp,"Can not remove %s: %s", mailbox, strerror(errno));
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+ }
-+ /*
-+ * ok we have removed all subdirectories of the folder mailbox, Remove the
-+ * hidden files.
-+ */
-+
-+ if(!(dirp = opendir (realname))){
-+ sprintf(tmp,"Can not read %s/: %s", realname, strerror(errno));
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+
-+ while ((d = readdir(dirp)) != NULL){
-+ if (strcmp(d->d_name, ".") && strcmp(d->d_name,"..")
-+ && (!strcmp(d->d_name, MDDIR)
-+ || !strncmp(d->d_name, MDUIDLAST, strlen(MDUIDLAST))
-+ || !strncmp(d->d_name, MDUIDTEMP, strlen(MDUIDTEMP)))){
-+ if(strcmp(d->d_name, MDDIR) == 0)
-+ mddir++;
-+ sprintf(tmp,"%s/%s", realname, d->d_name);
-+ if (unlink(tmp) != 0)
-+ error++;
-+ }
-+ }
-+ closedir(dirp);
-+ if (error ||
-+ (maildir_dir_is_empty(mailbox) && mddir == 0 && rmdir(realname) < 0)){
-+ sprintf(tmp,"Can not remove folder %s: %s", mailbox, strerror(errno));
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+ return LONGT;
-+ }
-+
-+ long maildir_rename (MAILSTREAM *stream, char *old, char *new)
-+ {
-+ char tmp[MAILTMPLEN],tmpnew[MAILTMPLEN], realold[MAILTMPLEN];
-+ char realnew[MAILTMPLEN];
-+ int courier = IS_COURIER(old) && IS_COURIER(new);
-+ int i;
-+ long rv = LONGT;
-+ COURIER_S *cdir;
-+
-+ if((IS_COURIER(old) || IS_COURIER(new)) && !courier){
-+ sprintf (tmp,"Can't rename mailbox %s to %s",old, new);
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+
-+ if (!maildir_valid(old)){
-+ sprintf (tmp,"Can't rename mailbox %s: folder not in maildir format",old);
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+ maildir_file_path(old, realold);
-+ if (!maildir_valid_name(new) && new[0] == '#'){
-+ sprintf (tmp,"Can't rename mailbox %s: folder not in maildir format",new);
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+ maildir_file_path(new, realnew);
-+ if (access(tmpnew,F_OK) == 0){ /* new mailbox name must not exist */
-+ sprintf (tmp,"Can't rename to mailbox %s: destination already exists",new);
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+
-+ if(!courier){
-+ if (rename (realold,realnew)){ /* try to rename the directory */
-+ sprintf (tmp,"Can't rename mailbox %s to %s: %s",old, new,
-+ strerror(errno));
-+ mm_log (tmp,ERROR);
-+ return NIL;
-+ }
-+ return LONGT; /* return success */
-+ }
-+
-+ cdir = courier_list_dir(old);
-+ for (i = 0; cdir && i < cdir->total; i++){
-+ if(strstr(cdir->data[i]->name, old)){
-+ sprintf(tmp,"%s%s", new, cdir->data[i]->name+strlen(old));
-+ maildir_file_path(cdir->data[i]->name, realold);
-+ maildir_file_path(tmp, realnew);
-+ if (rename (realold,realnew)){
-+ sprintf (tmp,"Can't rename mailbox %s to %s: %s",old, new,
-+ strerror(errno));
-+ mm_log (tmp,ERROR);
-+ rv = NIL;
-+ }
-+ }
-+ }
-+ courier_free_cdir(&cdir);
-+ return rv;
-+ }
-+
-+ long maildir_sub (MAILSTREAM *stream,char *mailbox)
-+ {
-+ return sm_subscribe (mailbox);
-+ }
-+
-+ long maildir_unsub (MAILSTREAM *stream,char *mailbox)
-+ {
-+ return sm_unsubscribe (mailbox);
-+ }
-+
-+ void maildir_lsub (MAILSTREAM *stream,char *ref,char *pat)
-+ {
-+ void *sdb = NIL;
-+ char *s, test[MAILTMPLEN];
-+ /* get canonical form of name */
-+ if (maildir_canonicalize (test,ref,pat) && (s = sm_read (&sdb))) {
-+ do if (pmatch_full (s,test,'/')) mm_lsub (stream,'/',s,NIL);
-+ while ((s = sm_read (&sdb)) != NULL); /* until no more subscriptions */
-+ }
-+ }
-+
-+ long maildir_canonicalize (char *pattern,char *ref,char *pat)
-+ {
-+ if (ref && *ref) { /* have a reference */
-+ strcpy (pattern,ref); /* copy reference to pattern */
-+ /* # overrides mailbox field in reference */
-+ if (*pat == '#') strcpy (pattern,pat);
-+ /* pattern starts, reference ends, with / */
-+ else if ((*pat == '/') && (pattern[strlen (pattern) - 1] == '/'))
-+ strcat (pattern,pat + 1); /* append, omitting one of the period */
-+
-+ else strcat (pattern,pat); /* anything else is just appended */
-+ }
-+ else strcpy (pattern,pat); /* just have basic name */
-+ return maildir_valid_name(pattern) ? LONGT : NIL;
-+ }
-+
-+ void maildir_list_work (MAILSTREAM *stream,char *dir,char *pat,long level)
-+ {
-+ DIR *dp;
-+ struct direct *d;
-+ struct stat sbuf;
-+ char curdir[MAILTMPLEN],name[MAILTMPLEN], tmp[MAILTMPLEN];
-+ char realpat[MAILTMPLEN];
-+ long i;
-+ char *maildirpath = mdirpath();
-+
-+ sprintf(curdir,"%s/%s/", myrootdir(pat), dir ? dir : maildirpath);
-+ if ((dp = opendir (curdir)) != NULL){
-+ if (dir) sprintf (name,"%s%s/",MDPREFIX(CCLIENT),dir);
-+ else strcpy (name, pat);
-+
-+ if (level == 0 && !strpbrk(pat,"%*")){
-+ if(maildir_valid(pat)){
-+ i = maildir_contains_folder(pat, NULL)
-+ ? LATT_HASCHILDREN
-+ : (maildir_is_dir(pat, NULL)
-+ ? LATT_HASNOCHILDREN : LATT_NOINFERIORS);
-+ maildir_file_path(pat, realpat);
-+ i += maildir_any_new_msgs(realpat)
-+ ? LATT_MARKED : LATT_UNMARKED;
-+ mm_list (stream,'/', pat, i);
-+ }
-+ else
-+ if(pat[strlen(pat) - 1] == '/')
-+ mm_list (stream,'/', pat, LATT_NOSELECT);
-+ }
-+
-+ while ((d = readdir (dp)) != NULL)
-+ if(strcmp(d->d_name, ".") && strcmp(d->d_name,"..")
-+ && strcmp(d->d_name, MDNAME(Cur))
-+ && strcmp(d->d_name, MDNAME(Tmp))
-+ && strcmp(d->d_name, MDNAME(New))){
-+
-+ if (dir) sprintf (tmp,"%s%s", name,d->d_name);
-+ else strcpy(tmp, d->d_name);
-+
-+ if(pmatch_full (tmp, pat,'/')){
-+ sprintf(tmp,"%s/%s/%s", myrootdir(d->d_name),
-+ (dir ? dir : maildirpath), d->d_name);
-+ if(stat (tmp,&sbuf) == 0
-+ && ((sbuf.st_mode & S_IFMT) == S_IFDIR)){
-+ if (dir) sprintf (tmp,"%s%s", name,d->d_name);
-+ else strcpy(tmp, d->d_name);
-+ i = maildir_valid(tmp)
-+ ? (maildir_contains_folder(dir, d->d_name)
-+ ? LATT_HASCHILDREN
-+ : (maildir_is_dir(dir, d->d_name)
-+ ? LATT_HASNOCHILDREN : LATT_NOINFERIORS))
-+ : LATT_NOSELECT;
-+ i += maildir_any_new_msgs(tmp)
-+ ? LATT_MARKED : LATT_UNMARKED;
-+ mm_list (stream,'/',tmp, i);
-+ strcat (tmp, "/");
-+ if(dmatch (tmp, pat,'/') &&
-+ (level < (long) mail_parameters (NIL,GET_LISTMAXLEVEL,NIL))){
-+ sprintf(tmp,"%s/%s",dir,d->d_name);
-+ maildir_list_work (stream,tmp,pat,level+1);
-+ }
-+ }
-+ }
-+ }
-+ closedir (dp);
-+ }
-+ }
-+
-+ void courier_list_work (MAILSTREAM *stream, char *dir, char *pat, long level)
-+ {
-+ char c, curdir[MAILTMPLEN], tmp[MAILTMPLEN];
-+ char realname[MAILTMPLEN], realpat[MAILTMPLEN] = {'\0'};
-+ int i, found;
-+ long style = (long) maildir_parameters(GET_COURIERSTYLE, NIL), j;
-+ char *maildirpath = mdirpath();
-+ COURIER_S *cdir;
-+
-+ if(!strpbrk(pat,"%*")){ /* a mailbox */
-+ maildir_file_path(pat, curdir);
-+ i = strlen(curdir) - 1;
-+ if(curdir[i] == '/')
-+ curdir[i] = '\0';
-+ cdir = courier_list_dir(curdir);
-+ if(cdir){
-+ found = 0; j = 0L;
-+ if(maildir_valid_name(pat)){
-+ for(i = 0; !found && i < cdir->total; i++)
-+ if(strstr(curdir, cdir->data[i]->name)){
-+ if(strlen(curdir) < strlen(cdir->data[i]->name))
-+ found += 2;
-+ else if(strlen(curdir) == strlen(cdir->data[i]->name))
-+ found -= 1;
-+ }
-+ if(found > 0)
-+ j = LATT_HASCHILDREN;
-+ else if(found == 0)
-+ j = (style == COURIER) ? LATT_HASNOCHILDREN : LATT_NOINFERIORS;
-+ }
-+ else
-+ j = LATT_NOSELECT;
-+ j += maildir_any_new_msgs(curdir) ? LATT_MARKED : LATT_UNMARKED;
-+ if (found)
-+ mm_list (stream, '.', pat, j);
-+ courier_free_cdir(&cdir);
-+ }
-+ return;
-+ }
-+
-+ strcpy(tmp,pat + 4); /* a directory */
-+ j = strlen(pat) - 1;
-+ maildir_file_path(pat, realpat);
-+ c = pat[j];
-+ pat[j] = '\0';
-+ realname[0] = '\0';
-+ if(dir)
-+ maildir_file_path(dir, realname);
-+ sprintf(curdir,"%s%s%s/%s", (dir ? "" : myrootdir(pat)), (dir ? "" : "/"),
-+ (dir ? realname : maildirpath), (dir ? "" : "."));
-+ sprintf(tmp, "%s%s/.", MDPREFIX(COURIER), dir ? dir : maildirpath);
-+ if (level == 0 && tmp && pmatch_full (tmp, realpat, '.'))
-+ mm_list (stream,'.', tmp, LATT_NOSELECT);
-+
-+ cdir = courier_list_dir(pat);
-+ pat[j] = c;
-+ for (i = 0; cdir && i < cdir->total; i++)
-+ if(pmatch_full (cdir->data[i]->name, pat, '.')){
-+ sprintf(tmp, "%s.", cdir->data[i]->name);
-+ courier_list_info(&cdir, tmp, i);
-+ mm_list (stream,'.',cdir->data[i]->name, cdir->data[i]->attribute);
-+ }
-+ courier_free_cdir(&cdir);
-+ }
-+
-+ int
-+ same_maildir_file(char *name1, char *name2)
-+ {
-+ char tmp1[MAILTMPLEN], tmp2[MAILTMPLEN];
-+ char *s;
-+
-+ strcpy(tmp1, name1 ? name1 : "");
-+ strcpy(tmp2, name2 ? name2 : "");
-+ if ((s = strrchr(tmp1, FLAGSEP)) != NULL)
-+ *s = '\0';
-+ if (((s = strrchr(tmp1, SIZESEP)) != NULL) && (strchr(s,'.') == NULL))
-+ *s = '\0';
-+ if ((s = strrchr(tmp2, FLAGSEP)) != NULL)
-+ *s = '\0';
-+ if (((s = strrchr(tmp2, SIZESEP)) != NULL) && (strchr(s,'.') == NULL))
-+ *s = '\0';
-+
-+ return !strcmp(tmp1, tmp2);
-+ }
-+
-+ unsigned long antoul(char *seed)
-+ {
-+ int i, error = 0;
-+ unsigned long val = 0L, rv1 = 0L, t;
-+ char c, *p;
-+ if(!seed)
-+ return 0L;
-+ t = strtoul(seed, &p, 10);
-+ if(p && (*p == '.' || *p == '_'))
-+ return t;
-+ /* else */
-+ if((p = strchr(seed,'.')) != NULL)
-+ *p = '\0';
-+ error = (strlen(seed) > 6); /* too long */
-+ for(i= strlen(seed)-1; error == 0 && i >= 0; i--){
-+ c = seed[i];
-+ if (c >= 'A' && c <= 'Z') val = c - 'A';
-+ else if (c >= 'a' && c <= 'z') val = c - 'a' + 26;
-+ else if (c >= '0' && c <= '9') val = c - '0' + 26 + 26;
-+ else if (c == '-') val = c - '-' + 26 + 26 + 10;
-+ else if (c == '_') val = c - '_' + 26 + 26 + 10 + 1;
-+ else error++;
-+ rv1 = val + (rv1 << 6);
-+ }
-+ if(p)
-+ *p = '.';
-+ return error ? 0L : rv1;
-+ }
-+
-+ unsigned long mdfntoul (char *name)
-+ {
-+ unsigned long t;
-+ char *r, last;
-+
-+ if((*name == '_') && ((r = strpbrk(name,".,%+")) != NULL)){ /* Grrr!!! */
-+ last = *r;
-+ *r = '\0';
-+ t = antoul(r+1);
-+ *r = last;
-+ }
-+ else
-+ t = antoul(name);
-+ return t;
-+ }
-+
-+ int comp_maildir_file(char *name1, char *name2)
-+ {
-+ int uset1 = 1, uset2 = 1, i, j, cmp;
-+ unsigned long t1, t2;
-+ char *s1, *s2;
-+
-+ if (!(name1 && *name1))
-+ return (name2 && *name2) ? (*name2 == FLAGSEP ? 0 : -1) : 0;
-+
-+ if (!(name2 && *name2))
-+ return (name1 && *name1) ? (*name1 == FLAGSEP ? 0 : 1) : 0;
-+
-+ if((cmp = strcmp(name1,name2)) == 0)
-+ return 0;
-+
-+ t1 = strtoul(name1, &s1, 10);
-+ t2 = strtoul(name2, &s2, 10);
-+
-+ if(!s1 || *s1 != '.')
-+ uset1 = 0;
-+
-+ if(!s2 || *s2 != '.')
-+ uset2 = 0;
-+
-+ if(uset1 && uset2) /* normal sort order */
-+ return (t1 < t2) ? -1 : (t1 > t2 ? 1 : (cmp < 0 ? -1 : 1));
-+
-+ /* If we make it here we say Grrrr.... first, then we try to figure out
-+ * how to sort this mess.
-+ * These are the rules.
-+ * If there is a number at the beginning it is bigger than anything else.
-+ * If there are digits, then the number of digits decides which one is bigger.
-+ */
-+
-+ for(i = 0; isdigit(name1[i]); i++);
-+ for(j = 0; isdigit(name2[j]); j++);
-+
-+ return(uset1 ? 1
-+ : (uset2 ? -1
-+ : (i < j ? -1 : (i > j ? 1 : (cmp < 0 ? -1 : 1)))));
-+ }
-+
-+ void
-+ maildir_getflag(char *name, int *d, int *f, int *r ,int *s, int *t)
-+ {
-+ char tmp[MAILTMPLEN], *b;
-+ int offset = 0;
-+ int tmpd, tmpf, tmpr, tmps, tmpt;
-+
-+ if(d) *d = 0;
-+ if(f) *f = 0;
-+ if(r) *r = 0;
-+ if(s) *s = 0;
-+ if(t) *t = 0;
-+
-+ tmpd = tmpf = tmpr = tmps = tmpt = NIL; /* no flags set by default */
-+ strcpy(tmp,name);
-+ while ((b = strrchr(tmp+offset, FLAGSEP)) != NULL){
-+ char flag,last;
-+ int k;
-+ if (!++b) break;
-+ switch (*b){
-+ case '1':
-+ case '2':
-+ case '3': flag = *b; b += 2;
-+ for (k = 0; b[k] && b[k] != FLAGSEP && b[k] != ','; k++);
-+ last = b[k];
-+ b[k] = '\0';
-+ if (flag == '2' || flag == '3'){
-+ tmpd = strchr (b, MDFLAGC(Draft)) ? T : NIL;
-+ tmpf = strchr (b, MDFLAGC(Flagged)) ? T : NIL;
-+ tmpr = strchr (b, MDFLAGC(Replied)) ? T : NIL;
-+ tmps = strchr (b, MDFLAGC(Seen)) ? T : NIL;
-+ tmpt = strchr (b, MDFLAGC(Trashed)) ? T : NIL;
-+ }
-+ b[k] = last;
-+ b += k;
-+ for (; tmp[offset] && tmp[offset] != FLAGSEP; offset++);
-+ offset++;
-+ break;
-+ default: break; /* Should we crash?... Nahhh */
-+ }
-+ }
-+ if(d) *d = tmpd;
-+ if(f) *f = tmpf;
-+ if(r) *r = tmpr;
-+ if(s) *s = tmps;
-+ if(t) *t = tmpt;
-+ }
-+
-+ int
-+ maildir_message_in_list(char *msgname, struct direct **names,
-+ unsigned long bottom, unsigned long top, unsigned long *pos)
-+ {
-+ unsigned long middle = (bottom + top)/2;
-+ int test;
-+
-+ if (!msgname)
-+ return NIL;
-+
-+ if (pos) *pos = middle;
-+
-+ if (same_maildir_file(msgname, names[middle]->d_name))
-+ return T;
-+
-+ if (middle == bottom){ /* 0 <= 0 < 1 */
-+ int rv = NIL;
-+ if (same_maildir_file(msgname, names[middle]->d_name)){
-+ rv = T;
-+ if (pos) *pos = middle;
-+ }
-+ else
-+ if (same_maildir_file(msgname, names[top]->d_name)){
-+ rv = T;
-+ if (pos) *pos = top;
-+ }
-+ return rv;
-+ }
-+
-+ test = comp_maildir_file(msgname, names[middle]->d_name);
-+
-+ if (top <= bottom)
-+ return test ? NIL : T;
-+
-+ if (test < 0 ) /* bottom < msgname < middle */
-+ return maildir_message_in_list(msgname, names, bottom, middle, pos);
-+ else if (test > 0) /* middle < msgname < top */
-+ return maildir_message_in_list(msgname, names, middle, top, pos);
-+ else return T;
-+ }
-+
-+ void
-+ maildir_abort(MAILSTREAM *stream)
-+ {
-+ if (LOCAL){
-+ if(LOCAL->candouid)
-+ maildir_read_uid(stream, NULL, &stream->uid_validity);
-+ if (LOCAL->dir) fs_give ((void **) &LOCAL->dir);
-+ if (LOCAL->curdir) fs_give ((void **) &LOCAL->curdir);
-+ if (LOCAL->buf) fs_give ((void **) &LOCAL->buf);
-+ if(LOCAL->uidtempfile){
-+ unlink(LOCAL->uidtempfile);
-+ fs_give ((void **) &LOCAL->uidtempfile);
-+ }
-+ fs_give ((void **) &stream->local);
-+ }
-+ if (mdfpath) fs_give((void **)&mdfpath);
-+ stream->dtb = NIL;
-+ }
-+
-+ int
-+ maildir_contains_folder(char *dirname, char *name)
-+ {
-+ char tmp[MAILTMPLEN], tmp2[MAILTMPLEN];
-+ int rv = 0;
-+ DIR *dir;
-+ struct direct *d;
-+
-+ maildir_file_path(dirname, tmp2);
-+ if(name){
-+ strcat(tmp2,"/");
-+ strcat(tmp2, name);
-+ }
-+
-+ if (!(dir = opendir (tmp2)))
-+ return NIL;
-+
-+ while ((d = readdir(dir)) != NULL){
-+ if (strcmp(d->d_name, ".") && strcmp(d->d_name,"..")
-+ && strcmp(d->d_name, MDNAME(Cur))
-+ && strcmp(d->d_name, MDNAME(Tmp))
-+ && strcmp(d->d_name, MDNAME(New))){
-+
-+ sprintf(tmp,"%s/%s", tmp2, d->d_name);
-+ if(maildir_valid(tmp)){
-+ rv++;
-+ break;
-+ }
-+ }
-+ }
-+ closedir(dir);
-+ return rv;
-+ }
-+
-+ int
-+ maildir_is_dir(char *dirname, char *name)
-+ {
-+ char tmp[MAILTMPLEN];
-+ struct stat sbuf;
-+
-+ maildir_file_path(dirname, tmp);
-+ if(name){
-+ strcat(tmp,"/");
-+ strcat(tmp,name);
-+ }
-+ strcat(tmp,"/");
-+ strcat(tmp,MDDIR);
-+
-+ return ((stat(tmp, &sbuf) == 0) && S_ISREG (sbuf.st_mode)) ? 1 : 0;
-+ }
-+
-+ int
-+ maildir_dir_is_empty(char *mailbox)
-+ {
-+ char tmp[MAILTMPLEN], tmp2[MAILTMPLEN], tmp3[MAILTMPLEN],*s;
-+ int rv = 1, courier = IS_COURIER(mailbox);
-+ DIR *dir;
-+ struct direct *d;
-+ struct stat sbuf;
-+
-+ maildir_file_path(mailbox, tmp2);
-+
-+ if(courier){
-+ strcpy(tmp3, tmp2);
-+ if(s = strrchr(tmp2, '/'))
-+ *s = '\0';
-+ }
-+
-+ if (!(dir = opendir (tmp2)))
-+ return rv;
-+
-+ if(courier){
-+ while((d = readdir(dir)) != NULL){
-+ sprintf(tmp,"%s/%s", tmp2, d->d_name);
-+ if(!strncmp(tmp, tmp3, strlen(tmp3))
-+ && tmp[strlen(tmp3)] == '.'){
-+ rv = 0;
-+ break;
-+ }
-+ }
-+ }
-+ else
-+ while ((d = readdir(dir)) != NULL){
-+ sprintf(tmp,"%s/%s", tmp2, d->d_name);
-+ if (strcmp(d->d_name, ".")
-+ && strcmp(d->d_name,"..")
-+ && strcmp(d->d_name, MDNAME(Cur))
-+ && strcmp(d->d_name, MDNAME(Tmp))
-+ && strcmp(d->d_name, MDNAME(New))
-+ && strcmp(d->d_name, MDDIR)
-+ && strcmp(d->d_name, MDUIDVALIDITY)
-+ && !(d->d_name[0] == '.'
-+ && stat (tmp,&sbuf) == 0
-+ && S_ISREG(sbuf.st_mode))){
-+ rv = 0;
-+ break;
-+ }
-+ }
-+ closedir(dir);
-+ return rv;
-+ }
-+
-+ void
-+ maildir_get_file (MAILDIRFILE **mdfile)
-+ {
-+ MAILDIRFILE *md;
-+
-+ md = (MAILDIRFILE *) fs_get(sizeof(MAILDIRFILE));
-+ memset(md, 0, sizeof(MAILDIRFILE));
-+ *mdfile = md;
-+ }
-+
-+ void
-+ maildir_free_file (void **mdfile)
-+ {
-+ MAILDIRFILE *md = (mdfile && *mdfile) ? (MAILDIRFILE *) *mdfile : NULL;
-+
-+ if (md){
-+ if (md->name) fs_give((void **)&md->name);
-+ fs_give((void **)&md);
-+ }
-+ }
-+
-+ void
-+ maildir_free_file_only (void **mdfile)
-+ {
-+ MAILDIRFILE *md = (mdfile && *mdfile) ? (MAILDIRFILE *) *mdfile : NULL;
-+
-+ if (md && md->name)
-+ fs_give((void **)&md->name);
-+ }
-+
-+ int
-+ maildir_any_new_msgs(char *mailbox)
-+ {
-+ char tmp[MAILTMPLEN];
-+ int rv = NIL;
-+ DIR *dir;
-+ struct direct *d;
-+
-+ MDFLD(tmp, mailbox, New);
-+
-+ if (!(dir = opendir (tmp)))
-+ return rv;
-+
-+ while ((d = readdir(dir)) != NULL){
-+ if (d->d_name[0] == '.')
-+ continue;
-+ rv = T;
-+ break;
-+ }
-+ closedir(dir);
-+ return rv;
-+ }
-+
-+
-+ void
-+ maildir_get_date(MAILSTREAM *stream, unsigned long msgno)
-+ {
-+ MESSAGECACHE *elt;
-+ struct tm *t;
-+ time_t ti;
-+ int i,k;
-+
-+ elt = mail_elt (stream,msgno);
-+ if(elt && elt->year != 0)
-+ return;
-+ if ((ti = mdfntoul(MDFILE(elt))) > 0L && (t = gmtime(&ti))){
-+ i = t->tm_hour * 60 + t->tm_min;
-+ k = t->tm_yday;
-+ t = localtime(&ti);
-+ i = t->tm_hour * 60 + t->tm_min - i;
-+ if((k = t->tm_yday - k) != 0)
-+ i += ((k < 0) == (abs (k) == 1)) ? -24*60 : 24*60;
-+ k = abs (i);
-+ elt->hours = t->tm_hour;
-+ elt->minutes = t->tm_min;
-+ elt->seconds = t->tm_sec;
-+ elt->day = t->tm_mday; elt->month = t->tm_mon + 1;
-+ elt->year = t->tm_year - (BASEYEAR - 1900);
-+ elt->zoccident = (k == i) ? 0 : 1;
-+ elt->zhours = k/60;
-+ elt->zminutes = k % 60;
-+ }
-+ }
-+
-+ /* Support for Courier Style directories
-+ When this code is complete there will be two types of support, which
-+ will be configurable. The problem is the following: In Courier style
-+ folder structure, a "folder" may have a subfolder called
-+ "folder.subfolder", which is not natural in the file system in the
-+ sense that I can not stat for "folder.subfolder" wihtout knowing what
-+ "subfolder" is. It needs to be guessed. Because of this I need to look
-+ in the list of folders if there is a folder with a name
-+ "folder.subfolder", before I can say if the folder is dual or not. One
-+ can avoid this annoyance if one ignores the problem by declaring that
-+ every folder is dual. I will however code as the default the more
-+ complicated idea of scaning the containing directory each time it is
-+ modified and search for subfolders, and list the entries it found.
-+ */
-+
-+ int courier_dir_select (const struct direct *name)
-+ {
-+ return name->d_name[0] == '.' && (strlen(name->d_name) > 2
-+ || (strlen(name->d_name) == 2 && name->d_name[1] != '.'));
-+ }
-+
-+ int courier_dir_sort (const void *d1, const void *d2)
-+ {
-+ const struct direct *e1 = *(const struct direct **) d1;
-+ const struct direct *e2 = *(const struct direct **) d2;
-+
-+ return strcmp((char *) e1->d_name, (char *) e2->d_name);
-+ }
-+
-+ void courier_free_cdir (COURIER_S **cdir)
-+ {
-+ int i;
-+
-+ if (!*cdir)
-+ return;
-+
-+ if ((*cdir)->path) fs_give((void **)&((*cdir)->path));
-+ for (i = 0; i < (*cdir)->total; i++)
-+ if((*cdir)->data[i]->name) fs_give((void **)&((*cdir)->data[i]->name));
-+ fs_give((void **)&((*cdir)->data));
-+ fs_give((void **)&(*cdir));
-+ }
-+
-+ COURIER_S *courier_get_cdir (int total)
-+ {
-+ COURIER_S *cdir;
-+
-+ cdir = (COURIER_S *)fs_get(sizeof(COURIER_S));
-+ memset(cdir, 0, sizeof(COURIER_S));
-+ cdir->data = (COURIERLOCAL **) fs_get(total*sizeof(COURIERLOCAL *));
-+ memset(cdir->data, 0, sizeof(COURIERLOCAL *));
-+ cdir->total = total;
-+ return cdir;
-+ }
-+
-+ int courier_search_list(COURIERLOCAL **data, char *name, int first, int last)
-+ {
-+ int try = (first + last)/2;
-+
-+ if(!strstr(data[try]->name, name)){
-+ if(first == try) /* first == last || first + 1 == last */
-+ return strstr(data[last]->name, name) ? 1 : 0;
-+ if(strcmp(data[try]->name, name) < 0) /*data[try] < name < data[end] */
-+ return courier_search_list(data, name, try, last);
-+ else /* data[begin] < name < data[try] */
-+ return courier_search_list(data, name, first, try);
-+ }
-+ return 1;
-+ }
-+
-+ /* Lists all directories that are subdirectories of a given directory */
-+
-+ COURIER_S *courier_list_dir(char *curdir)
-+ {
-+ struct direct **names = NIL;
-+ struct stat sbuf;
-+ unsigned long ndir;
-+ COURIER_S *cdir = NULL;
-+ char tmp[MAILTMPLEN], tmp2[MAILTMPLEN], pathname[MAILTMPLEN],
-+ realname[MAILTMPLEN];
-+ int i, j, scand, td;
-+
-+ /* There are two cases, either curdir is
-+ #mc/INBOX. #mc/INBOX.foo
-+ or
-+ #mc/Maildir/. #mc/Maildir/.foo
-+ */
-+ strcpy(tmp,curdir + 4);
-+ if(!strncmp(ucase(tmp), "INBOX", 5))
-+ strcpy(tmp, "#mc/INBOX.");
-+ else{
-+ strcpy(tmp, curdir);
-+ for (i = strlen(tmp) - 1; tmp[i] && tmp[i] != '/'; i--);
-+ tmp[i+2] = '\0'; /* keep the last "." intact */
-+ }
-+ maildir_file_path(tmp, realname);
-+ maildir_scandir (realname, &names, &ndir, &scand, COURIER);
-+
-+ if (scand > 0){
-+ cdir = courier_get_cdir(ndir);
-+ cdir->path = cpystr(realname);
-+ for(i = 0, j = 0; i < ndir; i++){
-+ td = realname[strlen(realname) - 1] == '.'
-+ && *names[i]->d_name == '.';
-+ sprintf(tmp2,"%s%s", tmp, names[i]->d_name+1);
-+ sprintf(pathname,"%s%s", realname, names[i]->d_name + td);
-+ if(stat(pathname, &sbuf) == 0 && S_ISDIR(sbuf.st_mode)){
-+ cdir->data[j] = (COURIERLOCAL *) fs_get(sizeof(COURIERLOCAL));
-+ cdir->data[j++]->name = cpystr(tmp2);
-+ }
-+ fs_give((void **)&names[i]);
-+ }
-+ cdir->total = j;
-+ if(cdir->total == 0)
-+ courier_free_cdir(&cdir);
-+ }
-+ if(names)
-+ fs_give((void **) &names);
-+ return cdir;
-+ }
-+
-+ void
-+ courier_list_info(COURIER_S **cdirp, char *data, int i)
-+ {
-+ long style = (long) maildir_parameters(GET_COURIERSTYLE, NIL);
-+ COURIER_S *cdir = *cdirp;
-+
-+ if(maildir_valid(cdir->data[i]->name)){
-+ if(courier_search_list(cdir->data, data, 0, cdir->total - 1))
-+ cdir->data[i]->attribute = LATT_HASCHILDREN;
-+ else
-+ cdir->data[i]->attribute = (style == COURIER)
-+ ? LATT_HASNOCHILDREN : LATT_NOINFERIORS;
-+ }
-+ else
-+ cdir->data[i]->attribute = LATT_NOSELECT;
-+ cdir->data[i]->attribute += maildir_any_new_msgs(cdir->data[i]->name)
-+ ? LATT_MARKED : LATT_UNMARKED;
-+ }
-+
-+ /* UID Support */
-+ /* Yes, I know I procastinated a lot about this, but here it is finally */
-+
-+ unsigned int
-+ maildir_can_assign_uid (MAILSTREAM *stream)
-+ {
-+ unsigned int rv = 0;
-+ int createtemp;
-+ unsigned long t;
-+ char tmp[MAILTMPLEN], *s;
-+ DIR *dir;
-+ struct direct *d;
-+
-+ if(!stream || stream->rdonly
-+ || !LOCAL || !LOCAL->dir || !(dir = opendir(LOCAL->dir)))
-+ return rv;
-+
-+ sprintf(tmp, "%s.%d", MDUIDTEMP, mypid);
-+ while ((d = readdir(dir)) != NULL){
-+ if(!strncmp(d->d_name, tmp, strlen(tmp))
-+ || !strncmp(d->d_name, MDUIDTEMP, strlen(MDUIDTEMP)))
-+ break;
-+ }
-+ rv = d ? !strncmp(d->d_name, tmp, strlen(tmp)) : 1;
-+ createtemp = d ? 0 : 1;
-+ if (d && rv == 0){ /* is there a temp file that is not ours? */
-+ s = strrchr(d->d_name, '.');
-+ t = strtoul(s+1, &s, 10);
-+ if(s != NULL && *s != '\0')
-+ createtemp++;
-+ if(time(0) > t + MAXTEMPUID){
-+ createtemp++;
-+ sprintf(tmp,"%s/%s", LOCAL->dir, d->d_name);
-+ unlink(tmp);
-+ }
-+ }
-+ closedir(dir);
-+ if(createtemp){
-+ FILE *fp;
-+ sprintf(tmp,"%s/%s.%d.%lu", LOCAL->dir, MDUIDTEMP, mypid, time(0));
-+ if(fp = fopen(tmp, "w")){
-+ fclose(fp);
-+ if(LOCAL->uidtempfile)
-+ fs_give((void **)&LOCAL->uidtempfile);
-+ LOCAL->uidtempfile = cpystr(tmp);
-+ rv++;
-+ }
-+ }
-+ return rv;
-+ }
-+
-+ void
-+ maildir_read_uid(MAILSTREAM *stream, unsigned long *uid_last,
-+ unsigned long *uid_validity)
-+ {
-+ int createuid, deleteuid = 0;
-+ char tmp[MAILTMPLEN], *s = NULL;
-+ DIR *dir;
-+ struct direct *d;
-+
-+ if(uid_last) *uid_last = 0L;
-+ if(uid_last && uid_validity) *uid_validity = time(0);
-+ if(!stream || !LOCAL || !LOCAL->dir || !(dir = opendir(LOCAL->dir)))
-+ return;
-+
-+ while ((d = readdir(dir)) != NULL){
-+ if(!strncmp(d->d_name, MDUIDLAST, strlen(MDUIDLAST)))
-+ break;
-+ }
-+ createuid = d == NULL ? 1 : 0;
-+ if(uid_last == NULL)
-+ deleteuid++;
-+ if(d){
-+ if(uid_last){
-+ s = d->d_name + strlen(MDUIDLAST) + 1;
-+ *uid_last = strtoul(s, &s, 10);
-+ if(!s || *s != '.'){
-+ deleteuid++;
-+ createuid++;
-+ *uid_last = 0L;
-+ }
-+ }
-+ if(s && *s == '.'){
-+ if(uid_validity){
-+ s++;
-+ *uid_validity = strtoul(s, &s, 10);
-+ if(s && *s != '\0'){
-+ *uid_validity = time(0);
-+ deleteuid++;
-+ createuid++;
-+ }
-+ }
-+ }
-+ else{
-+ deleteuid++;
-+ createuid++;
-+ }
-+ }
-+ if(deleteuid){
-+ sprintf(tmp,"%s/%s", LOCAL->dir, d->d_name);
-+ unlink(tmp);
-+ }
-+ if(createuid)
-+ maildir_write_uid(stream, (uid_last ? *uid_last : stream->uid_last),
-+ uid_validity ? *uid_validity : time(0));
-+ closedir(dir);
-+ }
-+
-+ void
-+ maildir_write_uid(MAILSTREAM *stream, unsigned long uid_last,
-+ unsigned long uid_validity)
-+ {
-+ char tmp[MAILTMPLEN];
-+ FILE *fp;
-+
-+ if(!stream || stream->rdonly || !LOCAL || !LOCAL->dir)
-+ return;
-+
-+ sprintf(tmp,"%s/%s.%010lu.%010lu", LOCAL->dir, MDUIDLAST,
-+ uid_last, uid_validity);
-+ if(fp = fopen(tmp, "w"))
-+ fclose(fp);
-+ }
-+
-+ unsigned long
-+ maildir_get_uid(char *name)
-+ {
-+ char *s;
-+ unsigned long rv = 0L;
-+
-+ if(!name || (s = strstr(name,MDUIDSEP)) == NULL)
-+ return rv;
-+
-+ s += strlen(MDUIDSEP);
-+ rv = strtoul(s, NULL, 10);
-+ return rv;
-+ }
-+
-+
-+ void
-+ maildir_delete_uid(MAILSTREAM *stream, unsigned long msgno)
-+ {
-+ char old[MAILTMPLEN], new[MAILTMPLEN], *s, *t;
-+ MESSAGECACHE *elt;
-+
-+ elt = mail_elt(stream, msgno);
-+ if(!stream || !elt || !elt->private.spare.ptr || !LOCAL || !LOCAL->dir)
-+ return;
-+
-+ sprintf(old, "%s/%s/%s", LOCAL->dir, MDNAME(Cur), MDFILE(elt));
-+ t = MDFILE(elt);
-+ if(s = strstr(MDFILE(elt), MDUIDSEP)){
-+ *s = '\0';
-+ s += strlen(MDUIDSEP);
-+ strtoul(s, &s, 10);
-+ sprintf(new, "%s/%s/%s%s", LOCAL->dir, MDNAME(Cur), t, s);
-+ if(rename(old, new) == 0){
-+ maildir_free_file_only ((void **)&elt->private.spare.ptr);
-+ s = strrchr(new, '/');
-+ MDFILE(elt) = cpystr(s+1);
-+ }
-+ elt->private.uid = 0L;
-+ }
-+ }
-+
-+ void
-+ maildir_assign_uid(MAILSTREAM *stream, unsigned long msgno, unsigned long uid)
-+ {
-+ int createuid, deleteuid = 0;
-+ char old[MAILTMPLEN], new[MAILTMPLEN], *s, *t;
-+ MESSAGECACHE *elt;
-+
-+ elt = mail_elt(stream, msgno);
-+ if(!stream || !elt || !elt->private.spare.ptr || !LOCAL || !LOCAL->dir)
-+ return;
-+
-+ maildir_delete_uid(stream, msgno);
-+ sprintf(old, "%s/%s/%s", LOCAL->dir, MDNAME(Cur), MDFILE(elt));
-+ t = MDFILE(elt);
-+ if((s = strrchr(MDFILE(elt),FLAGSEP)) != NULL){
-+ *s++ = '\0';
-+ sprintf(new, "%s/%s/%s%s%lu%c%s",
-+ LOCAL->dir, MDNAME(Cur), t, MDUIDSEP, uid, FLAGSEP, s);
-+ if(rename(old, new) == 0){
-+ maildir_free_file_only ((void **)&elt->private.spare.ptr);
-+ s = strrchr(new, '/');
-+ MDFILE(elt) = cpystr(s+1);
-+ stream->uid_validity = time(0);
-+ }
-+ elt->private.uid = uid;
-+ }
-+ }
-+
-+ void
-+ maildir_uid_renew_tempfile(MAILSTREAM *stream)
-+ {
-+ char tmp[MAILTMPLEN];
-+
-+ if(!stream || stream->rdonly
-+ || !LOCAL || !LOCAL->candouid || !LOCAL->dir || !LOCAL->uidtempfile)
-+ return;
-+
-+ sprintf(tmp,"%s/%s.%d.%lu", LOCAL->dir, MDUIDTEMP, mypid, time(0));
-+ if(rename(LOCAL->uidtempfile, tmp) == 0){
-+ fs_give((void **)&LOCAL->uidtempfile);
-+ LOCAL->uidtempfile = cpystr(tmp);
-+ }
-+ }
-diff -rc alpine-2.00/imap/src/osdep/unix/maildir.h alpine-2.00.maildir/imap/src/osdep/unix/maildir.h
-*** alpine-2.00/imap/src/osdep/unix/maildir.h 2011-01-24 19:38:50.000000000 -0600
---- alpine-2.00.maildir/imap/src/osdep/unix/maildir.h 2011-01-15 19:11:36.000000000 -0600
-***************
-*** 0 ****
---- 1,226 ----
-+ /*
-+ * A few definitions that try to make this module portable to other
-+ * platforms (e.g. Cygwin). This module is based on the information from
-+ * http://cr.yp.to/proto/maildir.html
-+ */
-+
-+ /* First we deal with the separator character */
-+ #ifndef FLAGSEP
-+ #define FLAGSEP ':'
-+ #endif
-+ #define SIZESEP ','
-+
-+ const char sep1[] = {FLAGSEP, '1', ',', '\0'}; /* experimental semantics*/
-+ const char sep2[] = {FLAGSEP, '2', ',', '\0'}; /* Flags Information */
-+ const char sep3[] = {FLAGSEP, '3', ',', '\0'}; /* Grrrr.... */
-+
-+ const char *sep[] = { sep1, sep2, sep3, NULL};
-+
-+ #define MDSEP(i) sep[((i) - 1)]
-+
-+ /* Now we deal with flags. Woohoo! */
-+ typedef enum {Draft, Flagged, Passed, Replied, Seen, Trashed,
-+ EmptyFlag, EndFlags} MdFlagNamesType;
-+ const int mdimapflags[] = {Draft, Flagged, Replied, Seen, Trashed, EmptyFlag, EndFlags};
-+ const int mdkwdflags[] = {Passed, EmptyFlag, EndFlags};
-+
-+ /* this array lists the codes for mdflgnms (maildir flag names) above */
-+ const char *mdflags[] = { "D", "F", "P", "R", "S", "T", "", NULL};
-+ /* and as characters too */
-+ const char cmdflags[] = { 'D', 'F', 'P', 'R', 'S', 'T', '0', '\0'};
-+
-+ /* MDFLAG(Seen, elt->seen) */
-+ #define MDFLAG(i,j) mdflags[j ? (i) : EmptyFlag]
-+ /* MDFLAGC(Seen) */
-+ #define MDFLAGC(i) cmdflags[(i)]
-+
-+ /* Now we deal with the directory structure */
-+ typedef enum {Cur, Tmp, New, EndDir} DirNamesType;
-+ char *mdstruct[] = {"cur", "tmp", "new", NULL};
-+ #define MDNAME(i) mdstruct[(i)]
-+ #define MDFLD(tmp, dir, i) sprintf((tmp),"%s/%s", (dir), mdstruct[(i)])
-+ #define MSGPATH(tmp, dir, msg,i) sprintf((tmp),"%s/%s/%s", (dir), mdstruct[(i)],(msg))
-+
-+ /* Files associated to a maildir directory */
-+
-+ #define MDUIDVALIDITY ".uidvalidity" /* support for old maildirs */
-+ #define MDDIR ".mdir" /* this folder is a directory */
-+ #define MDUIDLAST ".uidlast" /* last assigned uid */
-+ #define MDUIDTEMP ".uidtemp" /* We assign uid's no one else */
-+
-+
-+
-+ /* Support of Courier Structure */
-+ #define CCLIENT 0
-+ #define COURIER 1
-+ #define IS_CCLIENT(t) \
-+ (((t) && (t)[0] == '#' && ((t)[1] == 'm' || (t)[1] == 'M')\
-+ && ((t)[2] == 'd' || (t)[2] == 'D')\
-+ && (t)[3] == '/' && (t)[4] != '\0') ? 1 : 0)
-+
-+ #define IS_COURIER(t) \
-+ (((t) && (t)[0] == '#' && ((t)[1] == 'm' || (t)[1] == 'M')\
-+ && ((t)[2] == 'c' || (t)[2] == 'C')\
-+ && (t)[3] == '/' && (t)[4] != '\0') ? 1 : 0)
-+ #define MDPREFIX(s) ((s) ? "#mc/" : "#md/")
-+ #define MDSEPARATOR(s) ((s) ? '.' : '/')
-+
-+ /* UID Support */
-+
-+ #define MAXTEMPUID (unsigned long) 180L
-+ const char mduid[] = {',','u','=','\0'};
-+ #define MDUIDSEP mduid
-+
-+
-+ /* Now we deal with messages filenames */
-+ char mdlocaldomain[MAILTMPLEN+1] = {'\0'};
-+ pid_t mypid = (pid_t) 0;
-+ static char *mdfpath = NULL;
-+ static char myMdInboxDir[50] = { '\0' };/* Location of the Maildir INBOX */
-+ static long CourierStyle = CCLIENT;
-+
-+ #define CHUNK 16384 /* from unix.h */
-+
-+ typedef struct courier_local {
-+ char *name; /* name of directory/folder */
-+ int attribute; /* attributes (children/marked/etc) */
-+ } COURIERLOCAL;
-+
-+ typedef struct courier {
-+ char *path; /* Path to collection */
-+ time_t scantime; /* time at which information was generated */
-+ int total; /* total number of elements in data */
-+ COURIERLOCAL **data;
-+ } COURIER_S;
-+
-+ /* In gdb this is the *(struct maildir_local *)stream->local structure */
-+ typedef struct maildir_local {
-+ unsigned int dirty : 1; /* diskcopy needs updating */
-+ unsigned int courier : 1; /* It is Courier style file system */
-+ unsigned int link : 1; /* There is a symbolic link */
-+ unsigned int candouid; /* we can assign uids and no one else */
-+ char *uidtempfile; /* path to uid temp file */
-+ int fd; /* fd of open message */
-+ char *dir; /* mail directory name */
-+ char *curdir; /* mail directory name/cur */
-+ unsigned char *buf; /* temporary buffer */
-+ unsigned long buflen; /* current size of temporary buffer */
-+ time_t scantime; /* last time directory scanned */
-+ } MAILDIRLOCAL;
-+
-+ /* Convenient access to local data */
-+ #define LOCAL ((MAILDIRLOCAL *) stream->local)
-+
-+ typedef struct maildir_file_info {
-+ char *name; /* name of the file */
-+ DirNamesType loc; /* location of this file */
-+ unsigned long pos; /* place in list where this file is listed */
-+ off_t size; /* size in bytes, on disk */
-+ time_t atime; /* last access time */
-+ time_t mtime; /* last modified time */
-+ time_t ctime; /* last changed time */
-+ } MAILDIRFILE;
-+
-+ #define MDFILE(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->name)
-+ #define MDLOC(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->loc)
-+ #define MDPOS(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->pos)
-+ #define MDSIZE(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->size)
-+ #define MDATIME(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->atime)
-+ #define MDMTIME(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->mtime)
-+ #define MDCTIME(F) (((MAILDIRFILE *)((F)->private.spare.ptr))->ctime)
-+
-+ /* Function prototypes */
-+
-+ DRIVER *maildir_valid (char *name);
-+ MAILSTREAM *maildir_open (MAILSTREAM *stream);
-+ void maildir_close (MAILSTREAM *stream, long options);
-+ long maildir_ping (MAILSTREAM *stream);
-+ void maildir_check (MAILSTREAM *stream);
-+ long maildir_text (MAILSTREAM *stream,unsigned long msgno,STRING *bs,long flags);
-+ char *maildir_header (MAILSTREAM *stream,unsigned long msgno,
-+ unsigned long *length, long flags);
-+ void maildir_list (MAILSTREAM *stream,char *ref,char *pat);
-+ void *maildir_parameters (long function,void *value);
-+ int maildir_create_folder (char *mailbox);
-+ long maildir_create (MAILSTREAM *stream,char *mailbox);
-+ void maildir_flagmsg (MAILSTREAM *stream,MESSAGECACHE *elt); /*check */
-+ long maildir_expunge (MAILSTREAM *stream, char *sequence, long options);
-+ long maildir_copy (MAILSTREAM *stream,char *sequence,char *mailbox,long options);
-+ long maildir_append (MAILSTREAM *stream,char *mailbox, append_t af, void *data);
-+ long maildir_delete (MAILSTREAM *stream,char *mailbox);
-+ long maildir_rename (MAILSTREAM *stream,char *old,char *new);
-+ long maildir_sub (MAILSTREAM *stream,char *mailbox);
-+ long maildir_unsub (MAILSTREAM *stream,char *mailbox);
-+ void maildir_lsub (MAILSTREAM *stream,char *ref,char *pat);
-+ void courier_list (MAILSTREAM *stream,char *ref, char *pat);
-+
-+ /* utility functions */
-+ void courier_realname (char *name, char *realname);
-+ long maildir_dirfmttest (char *name);
-+ char *maildir_file (char *dst,char *name);
-+ int maildir_select (const struct direct *name);
-+ int maildir_namesort (const void *d1, const void *d2);
-+ unsigned long antoul (char *seed);
-+ unsigned long mdfntoul (char *name);
-+ int courier_dir_select (const struct direct *name);
-+ int courier_dir_sort (const void *d1, const void *d2);
-+ long maildir_canonicalize (char *pattern,char *ref,char *pat);
-+ void maildir_list_work (MAILSTREAM *stream,char *subdir,char *pat,long level);
-+ void courier_list_work (MAILSTREAM *stream,char *subdir,char *pat,long level);
-+ int maildir_file_path(char *name, char *tmp);
-+ int maildir_valid_name (char *name);
-+ int maildir_valid_dir (char *name);
-+ int is_valid_maildir (char **name);
-+ int maildir_message_exists(MAILSTREAM *stream,char *name, char *tmp);
-+ char *maildir_remove_root(char *name);
-+ char *maildir_text_work (MAILSTREAM *stream,MESSAGECACHE *elt, unsigned long *length,long flags);
-+ unsigned long maildir_parse_message(MAILSTREAM *stream, unsigned long msgno,
-+ DirNamesType dirtype);
-+ int maildir_eliminate_duplicate (char *name, struct direct ***flist,
-+ unsigned long *nfiles);
-+ int maildir_doscandir (char *name, struct direct ***flist, int flag);
-+ unsigned long maildir_scandir (char *name, struct direct ***flist,
-+ unsigned long *nfiles, int *scand, int flag);
-+ void maildir_parse_folder (MAILSTREAM *stream, int full);
-+ void md_domain_name (void);
-+ char *myrootdir (char *name);
-+ char *mdirpath (void);
-+ int maildir_initial_check (MAILSTREAM *stream, DirNamesType dirtype);
-+ unsigned long maildir_parse_dir(MAILSTREAM *stream, unsigned long nmsgs,
-+ DirNamesType dirtype, struct direct **names, unsigned long nfiles, int full);
-+ int same_maildir_file(char *name1, char *name2);
-+ int comp_maildir_file(char *name1, char *name2);
-+ int maildir_message_in_list(char *msgname, struct direct **names,
-+ unsigned long bottom, unsigned long top, unsigned long *pos);
-+ void maildir_getflag(char *name, int *d, int *f, int *r ,int *s, int *t);
-+ int maildir_update_elt_maildirp(MAILSTREAM *stream, unsigned long msgno);
-+ void maildir_abort (MAILSTREAM *stream);
-+ int maildir_contains_folder(char *dirname, char *name);
-+ int maildir_is_dir(char *dirname, char *name);
-+ int maildir_dir_is_empty(char *mailbox);
-+ int maildir_create_work (char *mailbox, int loop);
-+ void maildir_get_file (MAILDIRFILE **mdfile);
-+ void maildir_free_file (void **mdfile);
-+ void maildir_free_file_only (void **mdfile);
-+ int maildir_any_new_msgs(char *mailbox);
-+ void maildir_get_date(MAILSTREAM *stream, unsigned long msgno);
-+ void maildir_fast (MAILSTREAM *stream,char *sequence,long flags);
-+
-+ /* Courier server support */
-+ void courier_free_cdir (COURIER_S **cdir);
-+ COURIER_S *courier_get_cdir (int total);
-+ int courier_search_list(COURIERLOCAL **data, char *name, int first, int last);
-+ COURIER_S *courier_list_dir(char *curdir);
-+ void courier_list_info(COURIER_S **cdirp, char *data, int i);
-+
-+ /* UID Support */
-+ unsigned int maildir_can_assign_uid (MAILSTREAM *stream);
-+ void maildir_read_uid(MAILSTREAM *stream, unsigned long *uid_last,
-+ unsigned long *uid_validity);
-+ void maildir_write_uid(MAILSTREAM *stream, unsigned long uid_last,
-+ unsigned long uid_validity);
-+ unsigned long maildir_get_uid(char *name);
-+ void maildir_delete_uid(MAILSTREAM *stream, unsigned long msgno);
-+ void maildir_assign_uid(MAILSTREAM *stream, unsigned long msgno, unsigned long uid);
-+ void maildir_uid_renew_tempfile(MAILSTREAM *stream);
-+
-diff -rc alpine-2.00/imap/src/osdep/unix/Makefile alpine-2.00.maildir/imap/src/osdep/unix/Makefile
-*** alpine-2.00/imap/src/osdep/unix/Makefile 2008-06-04 13:18:34.000000000 -0500
---- alpine-2.00.maildir/imap/src/osdep/unix/Makefile 2011-01-15 19:11:07.000000000 -0600
-***************
-*** 144,150 ****
- # However, mh needs to be before any sysinbox formats (such as mmdf or unix)
- # since otherwise INBOX won't work correctly when mh_allow_inbox is set.
- #
-! DEFAULTDRIVERS=imap nntp pop3 mix mx mbx tenex mtx mh mmdf unix news phile
- CHUNKSIZE=65536
-
- # Normally no need to change any of these
---- 144,150 ----
- # However, mh needs to be before any sysinbox formats (such as mmdf or unix)
- # since otherwise INBOX won't work correctly when mh_allow_inbox is set.
- #
-! DEFAULTDRIVERS=maildir courier imap nntp pop3 mix mx mbx tenex mtx mh mmdf unix news phile
- CHUNKSIZE=65536
-
- # Normally no need to change any of these
-***************
-*** 153,159 ****
- BINARIES=osdep.o mail.o misc.o newsrc.o smanager.o utf8.o utf8aux.o siglocal.o \
- dummy.o pseudo.o netmsg.o flstring.o fdstring.o \
- rfc822.o nntp.o smtp.o imap4r1.o pop3.o \
-! unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o
- CFLAGS=-g
-
- CAT=cat
---- 153,159 ----
- BINARIES=osdep.o mail.o misc.o newsrc.o smanager.o utf8.o utf8aux.o siglocal.o \
- dummy.o pseudo.o netmsg.o flstring.o fdstring.o \
- rfc822.o nntp.o smtp.o imap4r1.o pop3.o \
-! unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o maildir.o
- CFLAGS=-g
-
- CAT=cat
-***************
-*** 282,288 ****
-
- cyg: # Cygwin - note that most local file drivers don't work!!
- $(BUILD) `$(CAT) SPECIALS` OS=$@ \
-! DEFAULTDRIVERS="imap nntp pop3 mbx unix phile" \
- SIGTYPE=psx CHECKPW=cyg LOGINPW=cyg CRXTYPE=std \
- SPOOLDIR=/var \
- ACTIVEFILE=/usr/local/news/lib/active \
---- 282,288 ----
-
- cyg: # Cygwin - note that most local file drivers don't work!!
- $(BUILD) `$(CAT) SPECIALS` OS=$@ \
-! DEFAULTDRIVERS="imap nntp pop3 mbx unix maildir phile" \
- SIGTYPE=psx CHECKPW=cyg LOGINPW=cyg CRXTYPE=std \
- SPOOLDIR=/var \
- ACTIVEFILE=/usr/local/news/lib/active \
-***************
-*** 892,898 ****
- unix.o: mail.h misc.h osdep.h unix.h pseudo.h dummy.h
- utf8.o: mail.h misc.h osdep.h utf8.h tmap.c widths.c
- utf8aux.o: mail.h misc.h osdep.h utf8.h
-!
-
- # OS-dependent
-
---- 892,898 ----
- unix.o: mail.h misc.h osdep.h unix.h pseudo.h dummy.h
- utf8.o: mail.h misc.h osdep.h utf8.h tmap.c widths.c
- utf8aux.o: mail.h misc.h osdep.h utf8.h
-! maildir.o: mail.h misc.h osdep.h maildir.h dummy.h
-
- # OS-dependent
-
-diff -rc alpine-2.00/imap/src/osdep/unix/os_cyg.h alpine-2.00.maildir/imap/src/osdep/unix/os_cyg.h
-*** alpine-2.00/imap/src/osdep/unix/os_cyg.h 2008-06-04 13:18:34.000000000 -0500
---- alpine-2.00.maildir/imap/src/osdep/unix/os_cyg.h 2011-01-15 19:11:07.000000000 -0600
-***************
-*** 47,52 ****
---- 47,53 ----
- #define setpgrp setpgid
-
- #define SYSTEMUID 18 /* Cygwin returns this for SYSTEM */
-+ #define FLAGSEP ';'
- #define geteuid Geteuid
- uid_t Geteuid (void);
-
-diff -rc alpine-2.00/pith/conf.c alpine-2.00.maildir/pith/conf.c
-*** alpine-2.00/pith/conf.c 2008-08-22 19:07:05.000000000 -0500
---- alpine-2.00.maildir/pith/conf.c 2011-01-15 19:11:07.000000000 -0600
-***************
-*** 427,432 ****
---- 427,435 ----
-
- CONF_TXT_T cf_text_newsrc_path[] = "Full path and name of NEWSRC file";
-
-+ #ifndef _WINDOWS
-+ CONF_TXT_T cf_text_maildir_location[] = "Location relative to your HOME directory of the directory where your INBOX\n# for the maildir format is located. Default value is \"Maildir\". If your\n# inbox is located at \"~/Maildir\" you do not need to change this value.\n# A common value is also \".maildir\"";
-+ #endif
-
- /*----------------------------------------------------------------------
- These are the variables that control a number of pine functions. They
-***************
-*** 627,632 ****
---- 630,639 ----
- NULL, cf_text_news_active},
- {"news-spool-directory", 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0,
- NULL, cf_text_news_spooldir},
-+ #ifndef _WINDOWS
-+ {"maildir-location", 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0,
-+ "Maildir Location", cf_text_maildir_location},
-+ #endif
- {"upload-command", 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0,
- NULL, cf_text_upload_cmd},
- {"upload-command-prefix", 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0,
-***************
-*** 2216,2221 ****
---- 2223,2234 ----
- mail_parameters(NULL, SET_NEWSSPOOL,
- (void *)VAR_NEWS_SPOOL_DIR);
-
-+ #ifndef _WINDOWS
-+ set_current_val(&vars[V_MAILDIR_LOCATION], TRUE, TRUE);
-+ if(VAR_MAILDIR_LOCATION && VAR_MAILDIR_LOCATION[0])
-+ mail_parameters(NULL, SET_MDINBOXPATH, (void *)VAR_MAILDIR_LOCATION);
-+ #endif
-+
- /* guarantee a save default */
- set_current_val(&vars[V_DEFAULT_SAVE_FOLDER], TRUE, TRUE);
- if(!VAR_DEFAULT_SAVE_FOLDER || !VAR_DEFAULT_SAVE_FOLDER[0])
-***************
-*** 2832,2837 ****
---- 2845,2854 ----
- F_SORT_DEFAULT_SAVE_ALPHA, h_config_sort_save_alpha, PREF_FLDR, 0},
- {"vertical-folder-list", "Use Vertical Folder List",
- F_VERTICAL_FOLDER_LIST, h_config_vertical_list, PREF_FLDR, 0},
-+ #ifndef _WINDOWS
-+ {"use-courier-folder-list", "Courier Style Folder List",
-+ F_COURIER_FOLDER_LIST, h_config_courier_list, PREF_FLDR, 0},
-+ #endif
-
- /* Addr book */
- {"combined-addrbook-display", "Combined Address Book Display",
-***************
-*** 6895,6900 ****
---- 6912,6923 ----
-
- break;
-
-+ #ifndef _WINDOWS
-+ case F_COURIER_FOLDER_LIST:
-+ mail_parameters(NULL,SET_COURIERSTYLE,(void *)(F_ON(f->id ,ps)? 1 : 0));
-+ break; /* COURIER == 1, CCLIENT == 0, see maildir.h */
-+ #endif
-+
- case F_COLOR_LINE_IMPORTANT :
- case F_DATES_TO_LOCAL :
- clear_index_cache(ps->mail_stream, 0);
-***************
-*** 7676,7681 ****
---- 7699,7708 ----
- return(h_config_newmailwidth);
- case V_NEWSRC_PATH :
- return(h_config_newsrc_path);
-+ #ifndef _WINDOWS
-+ case V_MAILDIR_LOCATION :
-+ return(h_config_maildir_location);
-+ #endif
- case V_BROWSER :
- return(h_config_browser);
- #if defined(DOS) || defined(OS2)
-diff -rc alpine-2.00/pith/conf.h alpine-2.00.maildir/pith/conf.h
-*** alpine-2.00/pith/conf.h 2008-08-19 19:27:11.000000000 -0500
---- alpine-2.00.maildir/pith/conf.h 2011-01-15 19:11:07.000000000 -0600
-***************
-*** 249,254 ****
---- 249,258 ----
- #define GLO_NEWS_ACTIVE_PATH vars[V_NEWS_ACTIVE_PATH].global_val.p
- #define VAR_NEWS_SPOOL_DIR vars[V_NEWS_SPOOL_DIR].current_val.p
- #define GLO_NEWS_SPOOL_DIR vars[V_NEWS_SPOOL_DIR].global_val.p
-+ #ifndef _WINDOWS
-+ #define VAR_MAILDIR_LOCATION vars[V_MAILDIR_LOCATION].current_val.p
-+ #define GLO_MAILDIR_LOCATION vars[V_MAILDIR_LOCATION].global_val.p
-+ #endif
- #define VAR_DISABLE_DRIVERS vars[V_DISABLE_DRIVERS].current_val.l
- #define VAR_DISABLE_AUTHS vars[V_DISABLE_AUTHS].current_val.l
- #define VAR_REMOTE_ABOOK_METADATA vars[V_REMOTE_ABOOK_METADATA].current_val.p
-diff -rc alpine-2.00/pith/conftype.h alpine-2.00.maildir/pith/conftype.h
-*** alpine-2.00/pith/conftype.h 2008-08-19 19:27:11.000000000 -0500
---- alpine-2.00.maildir/pith/conftype.h 2011-01-15 19:11:07.000000000 -0600
-***************
-*** 114,119 ****
---- 114,122 ----
- , V_NEWSRC_PATH
- , V_NEWS_ACTIVE_PATH
- , V_NEWS_SPOOL_DIR
-+ #ifndef _WINDOWS
-+ , V_MAILDIR_LOCATION
-+ #endif
- , V_UPLOAD_CMD
- , V_UPLOAD_CMD_PREFIX
- , V_DOWNLOAD_CMD
-***************
-*** 380,385 ****
---- 383,391 ----
- F_PASS_C1_CONTROL_CHARS,
- F_SINGLE_FOLDER_LIST,
- F_VERTICAL_FOLDER_LIST,
-+ #ifndef _WINDOWS
-+ F_COURIER_FOLDER_LIST,
-+ #endif
- F_TAB_CHK_RECENT,
- F_AUTO_REPLY_TO,
- F_VERBOSE_POST,
-diff -rc alpine-2.00/pith/init.c alpine-2.00.maildir/pith/init.c
-*** alpine-2.00/pith/init.c 2007-08-16 17:25:10.000000000 -0500
---- alpine-2.00.maildir/pith/init.c 2011-01-15 19:11:07.000000000 -0600
-***************
-*** 407,412 ****
---- 407,415 ----
- && stricmp(filename, folder_base)){
- #else
- if(strncmp(filename, folder_base, folder_base_len) == 0
-+ #ifndef _WINDOWS
-+ && filename[folder_base_len] != list_cntxt->dir->delim
-+ #endif
- && strcmp(filename, folder_base)){
- #endif
- #endif
-diff -rc alpine-2.00/pith/pattern.c alpine-2.00.maildir/pith/pattern.c
-*** alpine-2.00/pith/pattern.c 2008-07-14 13:01:54.000000000 -0500
---- alpine-2.00.maildir/pith/pattern.c 2011-01-24 19:38:41.000000000 -0600
-***************
-*** 5482,5487 ****
---- 5482,5496 ----
- break;
-
- case '#':
-+ #ifndef _WINDOWS
-+ if(!struncmp(patfolder, "#md/", 4)
-+ || !struncmp(patfolder, "#mc/", 4)){
-+ maildir_file_path(patfolder, tmp1);
-+ if(!strcmp(patfolder, stream->mailbox))
-+ match++;
-+ break;
-+ }
-+ #endif
- if(!strcmp(patfolder, stream->mailbox))
- match++;
-
-***************
-*** 7894,7900 ****
- int we_cancel = 0, width;
- CONTEXT_S *save_context = NULL;
- char buf[MAX_SCREEN_COLS+1], sbuf[MAX_SCREEN_COLS+1];
-! char *save_ref = NULL;
- #define FILTMSG_MAX 30
-
- if(!stream)
---- 7903,7909 ----
- int we_cancel = 0, width;
- CONTEXT_S *save_context = NULL;
- char buf[MAX_SCREEN_COLS+1], sbuf[MAX_SCREEN_COLS+1];
-! char *save_ref = NULL, *save_dstfldr = NULL, *save_dstfldr2 = NULL;
- #define FILTMSG_MAX 30
-
- if(!stream)
-***************
-*** 7928,7933 ****
---- 7937,7952 ----
- if(F_OFF(F_QUELL_FILTER_MSGS, ps_global))
- we_cancel = busy_cue(buf, NULL, 0);
-
-+ #ifndef _WINDOWS
-+ if(!struncmp(dstfldr, "#md/", 4) || !struncmp(dstfldr, "#mc/", 4)){
-+ char tmp1[MAILTMPLEN];
-+ maildir_file_path(dstfldr, tmp1);
-+ save_dstfldr2 = dstfldr;
-+ save_dstfldr = cpystr(tmp1);
-+ dstfldr = save_dstfldr;
-+ }
-+ #endif
-+
- if(!is_absolute_path(dstfldr)
- && !(save_context = default_save_context(ps_global->context_list)))
- save_context = ps_global->context_list;
-***************
-*** 7991,7996 ****
---- 8010,8020 ----
- if(we_cancel)
- cancel_busy_cue(buf[0] ? 0 : -1);
-
-+ if(save_dstfldr){
-+ fs_give((void **)&save_dstfldr);
-+ dstfldr = save_dstfldr2;
-+ }
-+
- return(buf[0] != '\0');
- }
-
-diff -rc alpine-2.00/pith/pine.hlp alpine-2.00.maildir/pith/pine.hlp
-*** alpine-2.00/pith/pine.hlp 2008-08-22 19:07:05.000000000 -0500
---- alpine-2.00.maildir/pith/pine.hlp 2011-01-15 19:11:07.000000000 -0600
-***************
-*** 21253,21258 ****
---- 21253,21354 ----
- &lt;End of help on this topic&gt;
- </BODY>
- </HTML>
-+ ====== h_config_maildir_location ======
-+ <HTML>
-+ <HEAD>
-+ <TITLE>OPTION: <!--#echo var="VAR_maildir-location"--></TITLE>
-+ </HEAD>
-+ <BODY>
-+ <H1>OPTION: <!--#echo var="VAR_maildir-location"--></H1>
-+
-+ <P>
-+ This option should be used only if you have a Maildir folder which you
-+ want to use as your INBOX. If this is not your case (or don't know what
-+ this is), you can safely ignore this option.
-+
-+ <P>
-+ This option overrides the default directory Pine uses to find the location of
-+ your INBOX, in case this is in Maildir format. The default value of this
-+ option is "Maildir", but in some systems, this directory could have been
-+ renamed (e.g. to ".maildir"). If this is your case use this option to change
-+ the default.
-+
-+ <P>
-+ The value of this option is prefixed with the "~/" string to determine the
-+ full path to your INBOX.
-+
-+ <P>
-+ You should probably <A HREF="h_config_maildir">read</A> a few tips that
-+ teach you how to configure your maildir for optimal performance. This
-+ version also has <A HREF="h_config_courier_list">support</A> for the
-+ Courier style file system when a maildir collection is accessed locally.
-+
-+ <P><UL>
-+ <LI><A HREF="h_finding_help">Finding more information and requesting help</A>
-+ </UL>
-+ <P>
-+ &lt;End of help on this topic&gt;
-+ </BODY>
-+ </HTML>
-+ ====== h_config_maildir =====
-+ <HTML>
-+ <HEAD>
-+ <TITLE>Maildir Support</TITLE>
-+ </HEAD>
-+ <BODY>
-+ <H1>Maildir Support</H1>
-+
-+ This version of Alpine has been enhanced with Maildir support. This text is
-+ intended to be a reference on its support.
-+ <P>
-+
-+ A Maildir folder is a directory that contains three directories called
-+ cur, tmp and new. A program that delivers mail (e.g. postfix) will put new
-+ mail in the new directory. A program that reads mail will look for for old
-+ messages in the cur directory, while it will look for new mail in the new
-+ directory.
-+ <P>
-+
-+ In order to use maildir support it is better to set your inbox-path to the
-+ value &quot;#md/inbox&quot; (without quotes). This assumes that your mail
-+ delivery agent is delivering new mail to ~/Maildir/new. If the directory
-+ where new mail is being delivered is not called "Maildir", you can set the
-+ name of the subdirectory of home where it is being delivered in the <A
-+ HREF="h_config_maildir_location"><!--#echo var="VAR_maildir-location"--></A> configuration
-+ variable. Most of the time you will not have to worry about the
-+ <!--#echo var="VAR_maildirlocation"--> variable, because it will probably be set by your
-+ administrator in the pine.conf configuration file.
-+ <P>
-+
-+ One of the advantages of the Maildir support of this version of Alpine is
-+ that you do not have to stop using folders in another styles (mbox, mbx,
-+ etc.). This is desirable since the usage of a specific mail storage system
-+ is a personal decision. Folders in the maildir format that are part of the
-+ Mail collection will be recognized without any extra configuration of your
-+ part. If your mail/ collection is located under the mail/ directory, then
-+ creating a new maildir folder in this collection is done by pressing "A"
-+ and entering the string "#driver.md/mail/newfolder". Observe that adding a
-+ new folder as "newfolder" may not create such folder in maildir format.
-+
-+ <P>
-+ If you would like to have all folders created in the maildir format by
-+ default, you do so by adding a Maildir Collection. In order to convert
-+ your current mail/ collection into a maildir collection, edit the
-+ collection and change the path variable from &quot;mail/&quot; to
-+ &quot;#md/mail&quot;. In a maildir collection folders of any other format
-+ are ignored.
-+
-+ <P> Finally, This version also has
-+ <A HREF="h_config_courier_list">support</A> for the Courier style file system
-+ when a maildir collection is accessed locally.
-+
-+ <P>
-+ <UL>
-+ <LI><A HREF="h_finding_help">Finding more information and requesting help</A>
-+ </UL><P>
-+ &lt;End of help on this topic&gt;
-+ </BODY>
-+ </HTML>
- ====== h_config_literal_sig =====
- <HTML>
- <HEAD>
-***************
-*** 29126,29131 ****
---- 29222,29270 ----
- <P>
- &lt;End of help on this topic&gt;
- </BODY>
-+ </HTML>
-+ ====== h_config_courier_list =====
-+ <HTML>
-+ <HEAD>
-+ <TITLE>FEATURE: <!--#echo var="FEAT_courier-folder-list"--></TITLE>
-+ </HEAD>
-+ <BODY>
-+ <H1>FEATURE: <!--#echo var="FEAT_courier-folder-list"--></H1>
-+
-+ In a maildir collection, a folder could be used as a directory to store
-+ folders. In the Courier server if you create a folder, then a directory
-+ with the same name is created. If you use this patch to access a
-+ collection created by the Courier server, then the display of such
-+ collection will look confusing. The best way to access a maildir
-+ collection created by the Courier server is by using the &quot;#mc/&quot;
-+ prefix instead of the &quot;#md/&quot; prefix. If you use this alternate
-+ prefix, then this feature applies to you, otherwise you can safely ignore
-+ the text that follows.
-+ <P>
-+ Depending on if you have enabled the option
-+ <a href="h_config_separate_fold_dir_view"><!--#echo var="FEAT_separate-folder-and-directory-entries"--></a>
-+ a folder may be listed as &quot;folder[.]&quot;, or as two entries in the
-+ list by &quot;folder&quot; and &quot;folder.&quot;.
-+ <P>
-+ If this option is disabled, Pine will list local folders that are in Courier
-+ style format, as &quot;folder&quot;, and those that are also directories as
-+ &quot;folder[.]&quot;. This makes the default display cleaner.
-+ <P>
-+ If this feature is enabled then creating folders in a maildir collection
-+ will create a directory with the same name. If this feature is disabled, then
-+ a folder is considered a directory only if it contains subfolders, so you can
-+ not create a directory with the same name as an exisiting folder unless
-+ you create a subfolder of that folder first (e.g. if you have a folder
-+ called &quot;foo&quot; simply add &quot;foo.bar&quot; directly. This will
-+ create the directory &quot;foo&quot; and the subfolder &quot;bar&quot; of it).
-+ <P>
-+ Observe that this feature works only for maildir collections that are accessed
-+ locally. If a collection is accessed remotely then this feature has no value,
-+ as the report is created in a server, and Pine only reports what received
-+ from the server in this case.
-+ <P>
-+ &lt;End of help on this topic&gt;
-+ </BODY>
- </HTML>
- ====== h_config_verbose_post =====
- <HTML>
-diff -rc alpine-2.00/pith/send.c alpine-2.00.maildir/pith/send.c
-*** alpine-2.00/pith/send.c 2008-08-06 13:25:58.000000000 -0500
---- alpine-2.00.maildir/pith/send.c 2011-01-15 19:11:07.000000000 -0600
-***************
-*** 256,261 ****
---- 256,268 ----
-
- if(exists & FEX_ISFILE){
- context_apply(tmp, p_cntxt, mbox, sizeof(tmp));
-+ #ifndef _WINDOWS
-+ if (!struncmp(tmp, "#md/",4) || !struncmp(tmp, "#mc/", 4)){
-+ char tmp2[MAILTMPLEN];
-+ maildir_file_path(tmp, tmp2);
-+ strcpy(tmp, tmp2);
-+ }
-+ #endif
- if(!(IS_REMOTE(tmp) || is_absolute_path(tmp))){
- /*
- * The mbox is relative to the home directory.
-diff -rc alpine-2.00/README.maildir alpine-2.00.maildir/README.maildir
-*** alpine-2.00/README.maildir 2011-01-24 19:38:50.000000000 -0600
---- alpine-2.00.maildir/README.maildir 2011-01-15 19:11:07.000000000 -0600
-***************
-*** 0 ****
---- 1,153 ----
-+ ---------------------------------------
-+
-+ Maildir Driver for Alpine 1.0
-+ By Eduardo Chappa <chappa@washington.edu>
-+ http://staff.washington.edu/chappa/alpine/
-+
-+ ---------------------------------------
-+ 1. General Information About This Patch
-+ ---------------------------------------
-+
-+ This patch adds support for the maildir format to Alpine. We take the
-+ approach that this patch is one more driver among the number of formats
-+ supported by Alpine (more generally c-client). This approach differs from
-+ older versions of similar patches, in that once a maildir patch was
-+ applied, it was assumed that all your folders would be created in the
-+ maildir format.
-+
-+ This patch does not assume that maildir is a preferred format, instead
-+ puts maildir in equal footing with other formats (mbox, mbx, mix, etc),
-+ and so a maildir folder in the mail/ collection is treated in the same way
-+ as any other folder in any other format. In other words, just by reading
-+ the name of a folder, or opening it, or doing any operation with it, you
-+ can not know in which format the folder is.
-+
-+ This implies that if you want to add a folder in the maildir format to the
-+ mail/ collection, then you must add by pressing "A" in the folder list
-+ collection and enter "#driver.md/mail/name_maildir_folder".
-+
-+ If you only want to use maildir, however, you can do so too. In this case,
-+ you must create a maildir collection. In that collection, only maildir
-+ folders will be listed. If there is any folder in any other format, that
-+ folder will be ignored. In another words, any folder listed there is in
-+ maildir format and can be accessed through that collection, conversely,
-+ any folder not listed there is not in maildir format and there is no way
-+ to access it using this collection.
-+
-+ In order to create a maildir collection, you could press M S L, and "A" to
-+ add a collection. Fill in the required fields as follows:
-+
-+ Nickname : Anything
-+ Server :
-+ Path : #md/relative/path/to/maildir/collection/
-+ View :
-+
-+ For example, if "path" is set to "#md/mail/", then Alpine will look for your
-+ maildir folders that are in ~/mail/.
-+
-+ The code in this patch is mostly based in code for the unix driver plus
-+ some combinations of the mh, mbx and nntp drivers for the c-client
-+ library. Those drivers were designed by Mark Crispin, and bugs in this
-+ code are not his bugs, but my own.
-+
-+ I got all the specification for this patch from
-+ http://cr.yp.to/proto/maildir.html. If you know of a place with a better
-+ specification for maildir format please let me know. The method this patch
-+ uses to create a unique filename for a message is one of the "old
-+ fashioned" methods. I realize that this is old fashioned, but it is
-+ portable, and portability is the main reason why I decided to use an old
-+ fashioned method (most methods are not portable. See the word
-+ "Unfortunately" in that document).
-+
-+ --------------
-+ 2. Other Goals
-+ --------------
-+
-+ It is intended that this code will work well with any application
-+ written using the c-client library. Of paramount importance is to make the
-+ associated imap server work well when the server accesses a folder in
-+ Maildir format. The program mailutil should also work flawlessly with this
-+ implemetation of the driver.
-+
-+ It is intended that this driver be fast and stable. We intend not to
-+ patch Alpine to make this driver do its work, unless such patching is for
-+ fixing bugs in Alpine or to pass parameters to the driver.
-+
-+ ------------------------------------------------------------------------
-+ 3. What are the known bugs of this implementation of the Maildir driver?
-+ ------------------------------------------------------------------------
-+
-+ I don't know any at this time. There have been bugs before, though, but
-+ I try to fix bugs as soon as they are reported. A complete list of updates
-+ for this patch, which includes bug fixes, improvements and addition of new
-+ features can be found at
-+
-+ http://staff.washington.edu/chappa/alpine/updates/maildir.html
-+
-+ ----------
-+ 4. On UIDs
-+ ----------
-+
-+ This patch keeps uids in the name of the file that contains the message,
-+ by adding a ",u=" string to the file name to save the uid of a message. A
-+ file is kept between sessions to save information on the last uid assigned
-+ and its time of validity. Only one session with writing access can write
-+ uids, all others must wait for the other session to assign them. The
-+ session assigning uids creates a ".uidtemp" file which other sessions must
-+ not disturb.
-+
-+ Uid support appeared in Alpine 1.00 (snapshot 925), and is experimental,
-+ please report any problems.
-+
-+ --------------------------------------------
-+ 5. Configuring Alpine and Setting up a Maildir
-+ --------------------------------------------
-+
-+ Once this approach was chosen, it implied the following:
-+
-+ * This patch assumes that your INBOX is located at "$HOME/Maildir".
-+ This is a directory which should have three subdirectories "cur",
-+ "tmp" and "new". Mail is delivered to 'new' and read from 'cur'. I
-+ have added a configuration option "maildir-location" which can be
-+ used to tell Alpine where your Maildir inbox is, in case your system
-+ do not use the above directory (e.g. your system may use
-+ "~/.maildir"). In this case define that variable to be the name of
-+ the directory where your e-mail is being delivered (e.g.
-+ ".maildir").
-+
-+ * If you want to use the above configuration as your inbox, you must
-+ define your inbox-path as "#md/inbox" (no quotes). You can define
-+ the inbox-path like above even if you have changed the
-+ maildir-location variable. That's the whole point of that variable.
-+
-+ -----------------------------------
-+ 6. What about Courier file systems?
-+ -----------------------------------
-+
-+ In a courier file system all folders are subfolders of a root folder
-+ called INBOX. Normally INBOX is located at ~/Maildir and subfolders are
-+ "dot" directories in ~/Maildir. For example ~/Maildir/.Trash is a
-+ subfolder of INBOX and is accessed with the nickname "INBOX.Trash".
-+
-+ You can not access folders in this way unless you preceed them with the
-+ string "#mc/". The purpose of the string "#mc/" is to warn Alpine that a
-+ collection in the Courier format is going to be accessed, so you can
-+ SELECT a folder like "#mc/INBOX.Trash", but not "INBOX.Trash"
-+
-+ You can access a collection through a server, but if you want to access a
-+ collection of folders created using the Courier server, you MUST edit your
-+ ".pinerc" file and enter the definition of the collection as follows:
-+
-+ folder-collections="Anything you want" #mc/INBOX.[]
-+
-+ You can replace the string "#mc/INBOX." by something different, for example
-+ "#mc/Courier/." will make Alpine search for your collection in ~/Courier.
-+
-+ You can not add this directly into Alpine because Alpine fails to accept this
-+ value from its input, but it takes it correctly when it is added through
-+ the ".pinerc" file.
-+
-+ You can access your inbox as "#mc/INBOX" or "#md/INBOX". Both definitions
-+ point to the same place.
-+
-+ Last Updated February 9, 2008