From: David Levine Date: Sat, 7 Jan 2012 14:22:24 +0000 (-0600) Subject: Merge branch 'fileproc_mhlproc_to_post' X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/03fe41ba1d68108808c966c6d7ff74bd8c1d648c?hp=0d56141609e3b3f3834bce689e093ae4a8413944 Merge branch 'fileproc_mhlproc_to_post' --- diff --git a/INSTALL b/INSTALL index 8d317e0a..79f8f6f0 100644 --- a/INSTALL +++ b/INSTALL @@ -90,13 +90,7 @@ need an ANSI C compiler such as gcc. Check the `mh-tailor' man page for a list of all the available options for this file ("masquerade" may be of particular interest). -6) If you have enabled POP support, make sure that `pop3' (or more - precisely the value of the define POPSERVICE in config.h) is defined - in the /etc/services file (or its NIS/NIS+ equivalent) on the client - machine. It should be something equivalent to "110/tcp". This might - have already been done when the POP daemon was installed. - -7) Edit the file `mhn.defaults' (installed in the nmh `etc' directory). +6) Edit the file `mhn.defaults' (installed in the nmh `etc' directory). This file contains the default profile entries for the nmh command `mhn' and is created by the script `mhn.defaults.sh'. This script will search a generic path (essentially your $PATH) for programs to @@ -117,7 +111,7 @@ need an ANSI C compiler such as gcc. "MH & xmh: Email for Users and Programmers", 3rd edition, by Jerry Peek, on the Internet at . -9) Add an optional global mh.profile, if desired. This profile should be +7) Add an optional global mh.profile, if desired. This profile should be placed in the nmh `etc' directory with the name `mh.profile'. This file will be used to construct the initial .mh_profile of a new nmh user, but will not be consulted after that. @@ -198,9 +192,6 @@ Options for configure See the mh-tailor(5) man page for full documentation of "masquerade:". ---enable-mhe (DEFAULT) - Add support for the Emacs front-end `mhe'. - --enable-pop Enable client-side support for pop. diff --git a/Makefile.in b/Makefile.in index 39e027b3..d83cff3a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -10,6 +10,7 @@ SHELL = /bin/sh srcdir = @srcdir@ abs_srcdir = @abs_srcdir@ +datarootdir = @datarootdir@ VPATH = @srcdir@ # ========== USER CONFIGURATION SECTION ========== diff --git a/acconfig.h b/acconfig.h index 3649bf33..a99e5448 100644 --- a/acconfig.h +++ b/acconfig.h @@ -11,21 +11,6 @@ * wish to change the features that are compiled into nmh. */ -/* - * If you have defined DOT_LOCKING, then the default is to - * place the lock files in the same directory as the file that - * is to be locked. Alternately, if you define LOCKDIR, you - * can specify that all lock files go in a specific directory. - * Don't define this unless you know you need it. - */ -/* #define LOCKDIR "/usr/spool/locks" */ - -/* - * Define this if your passwords are stored in some type of - * distributed name service, such as NIS, or NIS+. - */ -#define DBMPWD 1 - /* * Directs nmh not to try and rewrite addresses * to their official form. You probably don't @@ -40,75 +25,5 @@ */ /* #define REALLYDUMB 1 */ -/* - * Starting on January 1, 2000, some MUAs like ELM and Ultrix's DXmail started - * generated bad dates ("00" or "100" for the year). If this #define is active, - * we use windowing to correct those dates to what we presume to be the intended - * values. About the only time this could get us into trouble would be if a MUA - * was generating a year of "00" in 2001 or later, due to an unrelated bug. In - * this case we would "correct" the year to 2000, which could result in - * inaccurate bug reports against the offending MUA. A much more esoteric case - * in which you might not want to #define this would be if you were OCR'ing in - * old written correspondence and saving it in email format, and you had dates - * of 1899 or earlier. - */ -#define FIX_NON_Y2K_COMPLIANT_MUA_DATES 1 - -/* - * Directs inc/slocal to extract the envelope sender from "From " - * line. If inc/slocal is saving message to folder, then this - * sender information is then used to create a Return-Path - * header which is then added to the message. - */ -#define RPATHS 1 - -/* - * If defined, slocal will use `mbox' format when saving to - * your standard mail spool. If not defined, it will use - * mmdf format. - */ -#define SLOCAL_MBOX 1 - -/* - * If this is defined, nmh will recognize the ~ construct. - */ -#define MHRC 1 - -/* - * Compile simple ftp client into mhn. This will be used by mhn - * for ftp access unless you have specified another access method - * in your .mh_profile or mhn.defaults. Use the "mhn-access-ftp" - * profile entry to override this. Check mhn(1) man page for - * details. - */ -#define BUILTIN_FTP 1 - -/* - * If you enable POP support, this is the the port name that nmh will use. Make - * sure this is defined in your /etc/services file (or its NIS/NIS+ equivalent). - * If you are using KPOP, you will need to change this to "kpop" unless you want - * to be able to use both POP3 _and_ Kerberized POP and plan to use inc and - * msgchk's -kpop switch every time in the latter case. - */ -#define POPSERVICE "pop3" - -/* - * Define the default creation modes for folders and messages. - */ -#define DEFAULT_FOLDER_MODE "700" -#define DEFAULT_MESSAGE_MODE "600" - -/* - * Name of link to file to which you are replying. - */ -#define LINK "@" - -/* - * Define to 1 if your vi has ATT bug, such that it returns - * non-zero exit codes on `pseudo-errors'. - */ -#undef ATTVIBUG - - /***** END USER CONFIGURATION SECTION *****/ @TOP@ diff --git a/config/config.c b/config/config.c index b08b3e23..82d20b18 100644 --- a/config/config.c +++ b/config/config.c @@ -9,10 +9,7 @@ #include #include - -#ifdef MHRC -# include -#endif +#include #define nmhbindir(file) NMHBINDIR#file #define nmhetcdir(file) NMHETCDIR#file @@ -35,21 +32,16 @@ etcpath (char *file) { static char epath[PATH_MAX]; char *cp; -#ifdef MHRC char *pp; struct passwd *pw; -#endif -#ifdef MHRC context_read(); -#endif switch (*file) { case '/': /* If already absolute pathname, return it */ return file; -#ifdef MHRC case '~': /* Expand ~username */ if ((cp = strchr(pp = file + 1, '/'))) @@ -73,7 +65,6 @@ etcpath (char *file) if (access (epath, R_OK) != NOTOK) return epath; /* else fall */ try_it: -#endif /* MHRC */ default: /* Check nmh Mail directory */ @@ -355,7 +346,7 @@ char *AliasFile = nmhetcdir (/MailAliases); * Folders (directories) are created with this protection (mode) */ -char *foldprot = DEFAULT_FOLDER_MODE; +char *foldprot = "700"; /* * Every NEW message will be created with this protection. When a @@ -363,5 +354,5 @@ char *foldprot = DEFAULT_FOLDER_MODE; * to messages coming in through inc. */ -char *msgprot = DEFAULT_MESSAGE_MODE; +char *msgprot = "600"; diff --git a/configure.in b/configure.in index 9cb18fc7..4657b505 100644 --- a/configure.in +++ b/configure.in @@ -56,17 +56,6 @@ AC_ARG_ENABLE(masquerade, fi], [masquerade="draft_from mmailid username_extension"]) AC_SUBST(masquerade)dnl -dnl Do you want mhe support? -AC_ARG_ENABLE(mhe, - AS_HELP_STRING([--disable-mhe],[disable mhe support])) - -dnl mhe support is on by default, so define it unless --disable-mhe or the -dnl deprecated, undocumented --disable-nmh-mhe are specified. -if test x"$enable_mhe" != x"no" -a x"$enable_nmh_mhe" != x"no"; then - AC_DEFINE(MHE, 1, - [Define to compile in support for the Emacs front-end mh-e.])dnl -fi - dnl Do you want client-side support for pop? AC_ARG_ENABLE(pop, AS_HELP_STRING([--enable-pop], [enable client-side support for plain POP3])) @@ -164,6 +153,17 @@ else AC_DEFINE(DOT_LOCKING)dnl fi +dnl Should we use a locking directory? +AC_ARG_ENABLE([lockdir], [ + AS_HELP_STRING([--enable-lockdir=dir], [Store dot-lock files in "dir"])], [ + AS_IF([test "x$enableval" = xyes],[ + AC_MSG_ERROR([--enable-lockdir requires an argument])]) + AS_IF([test "x$LOCKTYPE" != xdot],[ + AC_MSG_ERROR([Can only use --enable-lockdir with dot locking])]) + AC_DEFINE_UNQUOTED([LOCKDIR], ["$enableval"], + [Directory to store dot-locking lock files]) +]) + dnl What method of posting should post use? AC_ARG_WITH(mts, AS_HELP_STRING([--with-mts=@<:@smtp|sendmail@:>@], @@ -779,7 +779,6 @@ fi dnl ---------------- dnl CHECK STRUCTURES dnl ---------------- -AC_CHECK_MEMBERS(struct stat.st_blksize) AC_CHECK_MEMBERS(struct tm.tm_gmtoff,,, [#ifdef TIME_WITH_SYS_TIME diff --git a/docs/Makefile.in b/docs/Makefile.in index c9c03463..5fb13411 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -7,6 +7,7 @@ SHELL = /bin/sh top_srcdir = @top_srcdir@ srcdir = @srcdir@ docdir = @docdir@ +datarootdir = @datarootdir@ VPATH = @srcdir@ # files included in distribution diff --git a/docs/pending-release-notes b/docs/pending-release-notes index dbc26080..83c39ee5 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -2,3 +2,13 @@ Things to add to the release notes for the next full release: - Switched to buffered output when performing TLS encryption in the SMTP MTA to increase performance. +- mh-e support has been changed so that it is always compiled into nmh; + old features that were previously enabled by the MHE option have been + garbage collected. +- Old code enabled by the UCI preprocessor definition has been + garbage-collected. +- LOCKDIR is now configurable via --enable-lockdir +- All configuration options that were formerly only adjustable via editing + config.h have been removed. +- Support for the built-in ftp client (used when dealing with external body + message parts in MIME messages) has been removed. diff --git a/h/arpa_ftp.h b/h/arpa_ftp.h deleted file mode 100644 index 64532b9e..00000000 --- a/h/arpa_ftp.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 1983, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ftp.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _FTP_H_ -#define _FTP_H_ - -/* Definitions for FTP; see RFC-765. */ - -/* - * Reply codes. - */ -#define PRELIM 1 /* positive preliminary */ -#define COMPLETE 2 /* positive completion */ -#define CONTINUE 3 /* positive intermediate */ -#define TRANSIENT 4 /* transient negative completion */ -#define ERROR 5 /* permanent negative completion */ - -/* - * Type codes - */ -#define TYPE_A 1 /* ASCII */ -#define TYPE_E 2 /* EBCDIC */ -#define TYPE_I 3 /* image */ -#define TYPE_L 4 /* local byte size */ - -#ifdef FTP_NAMES -char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; -#endif - -/* - * Form codes - */ -#define FORM_N 1 /* non-print */ -#define FORM_T 2 /* telnet format effectors */ -#define FORM_C 3 /* carriage control (ASA) */ -#ifdef FTP_NAMES -char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; -#endif - -/* - * Structure codes - */ -#define STRU_F 1 /* file (no record structure) */ -#define STRU_R 2 /* record structure */ -#define STRU_P 3 /* page structure */ -#ifdef FTP_NAMES -char *strunames[] = {"0", "File", "Record", "Page" }; -#endif - -/* - * Mode types - */ -#define MODE_S 1 /* stream */ -#define MODE_B 2 /* block */ -#define MODE_C 3 /* compressed */ -#ifdef FTP_NAMES -char *modenames[] = {"0", "Stream", "Block", "Compressed" }; -#endif - -/* - * Record Tokens - */ -#define REC_ESC '\377' /* Record-mode Escape */ -#define REC_EOR '\001' /* Record-mode End-of-Record */ -#define REC_EOF '\002' /* Record-mode End-of-File */ - -/* - * Block Header - */ -#define BLK_EOR 0x80 /* Block is End-of-Record */ -#define BLK_EOF 0x40 /* Block is End-of-File */ -#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ -#define BLK_RESTART 0x10 /* Block is Restart Marker */ - -#define BLK_BYTECOUNT 2 /* Bytes in this block */ - -#endif /* !_FTP_H_ */ diff --git a/h/mh.h b/h/mh.h index abcf4451..e3a382a3 100644 --- a/h/mh.h +++ b/h/mh.h @@ -261,6 +261,9 @@ extern char *msg_delim; /* .. */ #define OUTPUTLINELEN 72 /* default line length for headers */ +#define LINK "@" /* Name of link to file to which you are */ + /* replying. */ + /* * miscellaneous macros */ diff --git a/h/prototypes.h b/h/prototypes.h index 1c55136d..fcc8f0c9 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -125,10 +125,6 @@ int uprf (char *, char *); int vfgets (FILE *, char **); char *write_charset_8bit (void); -#ifdef RPATHS -int get_returnpath (char *, int, char *, int); -#endif - int mh_strcasecmp (const char *s1, const char *s2); int strncasecmp (const char *s1, const char *s2, size_t n); diff --git a/man/Makefile.in b/man/Makefile.in index 75eb9c1c..c489f5fe 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -15,6 +15,7 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ +datarootdir = @datarootdir@ etcdir = @sysconfdir@ mandir = @mandir@ manext1 = 1 diff --git a/man/forw.man b/man/forw.man index 877b49bb..5b7dc6de 100644 --- a/man/forw.man +++ b/man/forw.man @@ -265,18 +265,13 @@ will prevent any edit from occurring.) The .B \-build switch is intended to be used by the Emacs mh-e interface to -.BR nmh , -and is only present if -.B nmh -was compiled with support for mh-e. It implies +.BR nmh . +It implies .BR \-nowhatnowproc . It causes a file /draft to be created, containing the draft message that would normally be presented to the user for editing. -No mail is actually sent. Note that this switch is not guaranteed to -be present or to have the same effects in future versions of -.BR nmh : -it is documented here only for completeness. +No mail is actually sent. .PP The .B \-file diff --git a/man/mh-profile.man b/man/mh-profile.man index 40b56c77..2cd02ebd 100644 --- a/man/mh-profile.man +++ b/man/mh-profile.man @@ -154,17 +154,17 @@ composition draft before it is sent. .RE .PP .BR Msg\-Protect : -644 +600 .RS 5 An octal number which defines the permission bits for new message files. See .BR chmod (1) for an explanation of the octal number. -(profile, default: 0644) +(profile, default: 0600) .RE .PP .BR Folder\-Protect : -750 +700 .RS 5 An octal number which defines the permission bits for new folder directories. See @@ -223,21 +223,6 @@ command. (context, no default) .RE .PP -.BR mhe : -.RS 5 -If present, tells -.B inc -to compose an -.I MHE -auditfile in addition to its other tasks. -.I MHE -is Brian Reid's -.B emacs -front-end for -.BR nmh . -(profile, no default) -.RE -.PP .BR Alternate\-Mailboxes : mh@uci\-750a, bug-mh* .RS 5 @@ -332,11 +317,8 @@ environment variable If .B $SIGNATURE is not set and this profile entry is not present, the \*(lqgcos\*(rq field of -the \fI/etc/passwd\fP file will be used; otherwise, on hosts where -.B nmh -was configured with the UCI option, the file -.I $HOME/.signature -is consulted. Your signature will be added to the address +the \fI/etc/passwd\fP file will be used. +Your signature will be added to the address .B send puts in the \*(lqFrom:\*(rq header; do not include an address in the signature text. (profile, no default) diff --git a/man/mh-tailor.man b/man/mh-tailor.man index 15704eee..4a30db1d 100644 --- a/man/mh-tailor.man +++ b/man/mh-tailor.man @@ -387,12 +387,11 @@ specifies that a file should be created whose existence means \*(lqlocked\*(rq and whose non-existence means \*(lqunlocked\*(rq. The name of this file is constructed by appending \*(lq.lock\*(rq to the name of the file being -locked. If -.B LOCKDIR -is not specified, lock files will be created +locked. If \*(lq--enable-lockdir=directory\*(rq +is not specified at build time, lock files will be created in the directory where the file being locked resides. Otherwise, lock files will be created in the directory specified by -.BR LOCKDIR . +\*(lq--enable-lockdir\*(rq. .PP Prior to installing .BR nmh , diff --git a/man/repl.man b/man/repl.man index 9f2f4893..acc1c76c 100644 --- a/man/repl.man +++ b/man/repl.man @@ -425,20 +425,14 @@ The .B \-build switch is intended to be used by the Emacs mh-e interface to -.BR nmh , -and is only present if -.B nmh -was compiled with support -for mh-e. It implies +.BR nmh . +It implies .BR \-nowhatnowproc . It causes a file .I /reply to be created, containing the draft message that would normally be presented to the user for editing. -No mail is actually sent. Note that this switch is not guaranteed to -be present or to have the same effects in future versions of -.BR nmh : -it is documented here only for completeness. +No mail is actually sent. .PP The .B \-file diff --git a/sbr/addrsbr.c b/sbr/addrsbr.c index 484ec5ef..227b40bc 100644 --- a/sbr/addrsbr.c +++ b/sbr/addrsbr.c @@ -280,12 +280,10 @@ auxformat (struct mailname *mp, int extras) else #endif /* DUMB */ -#ifndef BANG if (mp->m_type != UUCPHOST) snprintf (addr, sizeof(addr), mp->m_host ? "%s%s@%s" : "%s%s", empty(mp->m_path), empty(mp->m_mbox), mp->m_host); else -#endif /* not BANG */ snprintf (addr, sizeof(addr), "%s!%s", mp->m_host, mp->m_mbox); if (!extras) @@ -354,11 +352,7 @@ adrsprintf (char *username, char *domain) if (domain == NULL) domain = LocalName(); -#ifndef BANG snprintf_return = snprintf (addr, sizeof(addr), "%s@%s", username, domain); -#else /* BANG */ - snprintf_return = snprintf (addr, sizeof(addr), "%s!%s", domain, username); -#endif /* BANG */ if (snprintf_return < 0 || snprintf_return >= sizeof(addr)) adios(NULL, "snprintf() error writing username (%d chars), domain (%d" diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index 97a0b4a3..8d038360 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -126,10 +126,11 @@ cpnumber(char **dest, int num, unsigned int wid, char fill, size_t n) { static void cptrimmed(char **dest, char *str, unsigned int wid, char fill, size_t n) { int remaining; /* remaining output width available */ - int c, ljust, w; + int c, ljust; int end; /* number of input bytes remaining in str */ #ifdef MULTIBYTE_SUPPORT int char_len; /* bytes in current character */ + int w; wchar_t wide_char; #endif char *sp; /* current position in source string */ diff --git a/sbr/folder_read.c b/sbr/folder_read.c index bb886598..29204484 100644 --- a/sbr/folder_read.c +++ b/sbr/folder_read.c @@ -99,9 +99,6 @@ folder_read (char *name) switch (dp->d_name[0]) { case '.': case ',': -#ifdef MHE - case '+': -#endif /* MHE */ continue; default: diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index be871c4e..f31b9c43 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -582,10 +582,6 @@ finish: } -#ifdef RPATHS -static char unixbuf[BUFSIZ] = ""; -#endif /* RPATHS */ - void m_unknown(FILE *iob) { @@ -615,15 +611,8 @@ m_unknown(FILE *iob) && strncmp (text, "From ", 5) == 0) { msg_style = MS_MBOX; delimstr = "\nFrom "; -#ifndef RPATHS while ((c = getc (iob)) != '\n' && c >= 0) ; -#else /* RPATHS */ - cp = unixbuf; - while ((c = getc (iob)) != '\n' && cp - unixbuf < BUFSIZ - 1) - *cp++ = c; - *cp = 0; -#endif /* RPATHS */ } else { /* not a Unix style maildrop */ fseek (iob, pos, SEEK_SET); @@ -692,9 +681,6 @@ m_Eom (int c, FILE *iob) register long pos = 0L; register int i; char text[10]; -#ifdef RPATHS - register char *cp; -#endif /* RPATHS */ pos = ftell (iob); if ((i = fread (text, sizeof *text, edelimlen, iob)) != edelimlen @@ -715,83 +701,15 @@ m_Eom (int c, FILE *iob) } if (msg_style == MS_MBOX) { -#ifndef RPATHS while ((c = getc (iob)) != '\n') if (c < 0) break; -#else /* RPATHS */ - cp = unixbuf; - while ((c = getc (iob)) != '\n' && c >= 0 && cp - unixbuf < BUFSIZ - 1) - *cp++ = c; - *cp = 0; -#endif /* RPATHS */ } return 1; } -#ifdef RPATHS -/* - * Return the Return-Path and Delivery-Date - * header information. - * - * Currently, I'm assuming that the "From " line - * takes one of the following forms. - * - * From sender date remote from host (for UUCP delivery) - * From sender@host date (for sendmail delivery) - */ - -int -get_returnpath (char *rp, int rplen, char *dd, int ddlen) -{ - char *ap, *bp, *cp, *dp; - - ap = unixbuf; - if (!(bp = cp = strchr(ap, ' '))) - return 0; - - /* - * Check for "remote from" in envelope to see - * if this message uses UUCP style addressing - */ - while ((cp = strchr(++cp, 'r'))) { - if (strncmp (cp, "remote from", 11) == 0) { - cp = strrchr (cp, ' '); - break; - } - } - - /* - * Get the Return-Path information from - * the "From " envelope. - */ - if (cp) { - /* return path for UUCP style addressing */ - dp = strchr (++cp, '\n'); - snprintf (rp, rplen, "%.*s!%.*s\n", (int)(dp - cp), cp, (int)(bp - ap), ap); - } else { - /* return path for standard domain addressing */ - snprintf (rp, rplen, "%.*s\n", (int)(bp - ap), ap); - } - - /* - * advance over the spaces to get to - * delivery date on envelope - */ - while (*bp == ' ') - bp++; - - /* Now get delivery date from envelope */ - snprintf (dd, ddlen, "%.*s\n", 24, bp); - - unixbuf[0] = 0; - return 1; -} -#endif /* RPATHS */ - - static unsigned char * matchc(int patln, char *pat, int strln, char *str) { diff --git a/sbr/pidwait.c b/sbr/pidwait.c index f454161d..5ea87c54 100644 --- a/sbr/pidwait.c +++ b/sbr/pidwait.c @@ -11,6 +11,7 @@ #include #include #include +#include int pidwait (pid_t id, int sigsok) diff --git a/uip/Makefile.in b/uip/Makefile.in index 5b5ed022..d676db02 100644 --- a/uip/Makefile.in +++ b/uip/Makefile.in @@ -68,7 +68,7 @@ SCMDS = inc # source files SRCS = ali.c aliasbr.c anno.c annosbr.c ap.c burst.c comp.c \ conflict.c dist.c distsbr.c dp.c dropsbr.c flist.c fmtdump.c \ - folder.c forw.c ftpsbr.c inc.c install-mh.c mark.c md5.c mhbuild.c \ + folder.c forw.c inc.c install-mh.c mark.c md5.c mhbuild.c \ mhbuildsbr.c mhcachesbr.c mhfree.c mhl.c mhlist.c mhlistsbr.c \ mhlsbr.c mhmail.c mhmisc.c mhn.c mhoutsbr.c mhparam.c mhparse.c \ mhpath.c mhshow.c mhshowsbr.c mhstore.c mhstoresbr.c mhtest.c \ @@ -135,20 +135,20 @@ install-mh: install-mh.o $(LOCALLIBS) mark: mark.o $(LOCALLIBS) $(LINK) mark.o $(LINKLIBS) -mhbuild: mhbuild.o mhbuildsbr.o mhcachesbr.o mhlistsbr.o mhoutsbr.o mhmisc.o mhfree.o mhparse.o ftpsbr.o termsbr.o md5.o $(LOCALLIBS) - $(LINK) mhbuild.o mhbuildsbr.o mhcachesbr.o mhlistsbr.o mhoutsbr.o mhmisc.o mhfree.o mhparse.o ftpsbr.o md5.o $(LINKLIBS) $(TERMLIB) +mhbuild: mhbuild.o mhbuildsbr.o mhcachesbr.o mhlistsbr.o mhoutsbr.o mhmisc.o mhfree.o mhparse.o termsbr.o md5.o $(LOCALLIBS) + $(LINK) mhbuild.o mhbuildsbr.o mhcachesbr.o mhlistsbr.o mhoutsbr.o mhmisc.o mhfree.o mhparse.o md5.o $(LINKLIBS) $(TERMLIB) mhl: mhl.o mhlsbr.o termsbr.o $(LOCALLIBS) $(LINK) mhl.o mhlsbr.o termsbr.o $(LINKLIBS) $(TERMLIB) -mhlist: mhlist.o mhparse.o mhcachesbr.o mhlistsbr.o mhmisc.o mhfree.o ftpsbr.o termsbr.o md5.o $(LOCALLIBS) - $(LINK) mhlist.o mhparse.o mhcachesbr.o mhlistsbr.o mhmisc.o mhfree.o ftpsbr.o termsbr.o md5.o $(LINKLIBS) $(TERMLIB) +mhlist: mhlist.o mhparse.o mhcachesbr.o mhlistsbr.o mhmisc.o mhfree.o termsbr.o md5.o $(LOCALLIBS) + $(LINK) mhlist.o mhparse.o mhcachesbr.o mhlistsbr.o mhmisc.o mhfree.o termsbr.o md5.o $(LINKLIBS) $(TERMLIB) mhmail: mhmail.o $(LOCALLIBS) $(LINK) mhmail.o $(LINKLIBS) -mhn: mhn.o mhparse.o mhcachesbr.o mhshowsbr.o mhlistsbr.o mhstoresbr.o mhmisc.o mhfree.o ftpsbr.o termsbr.o md5.o $(LOCALLIBS) - $(LINK) mhn.o mhparse.o mhcachesbr.o mhshowsbr.o mhlistsbr.o mhstoresbr.o mhmisc.o mhfree.o ftpsbr.o termsbr.o md5.o $(LINKLIBS) $(TERMLIB) +mhn: mhn.o mhparse.o mhcachesbr.o mhshowsbr.o mhlistsbr.o mhstoresbr.o mhmisc.o mhfree.o termsbr.o md5.o $(LOCALLIBS) + $(LINK) mhn.o mhparse.o mhcachesbr.o mhshowsbr.o mhlistsbr.o mhstoresbr.o mhmisc.o mhfree.o termsbr.o md5.o $(LINKLIBS) $(TERMLIB) mhparam: mhparam.o $(LOCALLIBS) $(LINK) mhparam.o $(LINKLIBS) @@ -156,14 +156,14 @@ mhparam: mhparam.o $(LOCALLIBS) mhpath: mhpath.o $(LOCALLIBS) $(LINK) mhpath.o $(LINKLIBS) -mhshow: mhshow.o mhparse.o mhcachesbr.o mhshowsbr.o mhlistsbr.o mhmisc.o mhfree.o ftpsbr.o termsbr.o md5.o $(LOCALLIBS) - $(LINK) mhshow.o mhparse.o mhcachesbr.o mhshowsbr.o mhlistsbr.o mhmisc.o mhfree.o ftpsbr.o termsbr.o md5.o $(LINKLIBS) $(TERMLIB) +mhshow: mhshow.o mhparse.o mhcachesbr.o mhshowsbr.o mhlistsbr.o mhmisc.o mhfree.o termsbr.o md5.o $(LOCALLIBS) + $(LINK) mhshow.o mhparse.o mhcachesbr.o mhshowsbr.o mhlistsbr.o mhmisc.o mhfree.o termsbr.o md5.o $(LINKLIBS) $(TERMLIB) -mhstore: mhstore.o mhparse.o mhcachesbr.o mhshowsbr.o mhlistsbr.o mhstoresbr.o mhmisc.o mhfree.o ftpsbr.o termsbr.o md5.o $(LOCALLIBS) - $(LINK) mhstore.o mhparse.o mhcachesbr.o mhshowsbr.o mhlistsbr.o mhstoresbr.o mhmisc.o mhfree.o ftpsbr.o termsbr.o md5.o $(LINKLIBS) $(TERMLIB) +mhstore: mhstore.o mhparse.o mhcachesbr.o mhshowsbr.o mhlistsbr.o mhstoresbr.o mhmisc.o mhfree.o termsbr.o md5.o $(LOCALLIBS) + $(LINK) mhstore.o mhparse.o mhcachesbr.o mhshowsbr.o mhlistsbr.o mhstoresbr.o mhmisc.o mhfree.o termsbr.o md5.o $(LINKLIBS) $(TERMLIB) -mhtest: mhtest.o mhparse.o mhcachesbr.o mhoutsbr.o mhmisc.o mhfree.o ftpsbr.o termsbr.o md5.o $(LOCALLIBS) - $(LINK) mhtest.o mhparse.o mhcachesbr.o mhoutsbr.o mhmisc.o mhfree.o ftpsbr.o termsbr.o md5.o $(LINKLIBS) $(TERMLIB) +mhtest: mhtest.o mhparse.o mhcachesbr.o mhoutsbr.o mhmisc.o mhfree.o termsbr.o md5.o $(LOCALLIBS) + $(LINK) mhtest.o mhparse.o mhcachesbr.o mhoutsbr.o mhmisc.o mhfree.o termsbr.o md5.o $(LINKLIBS) $(TERMLIB) msgchk: msgchk.o $(POPLIB) $(LOCALLIBS) $(LINK) msgchk.o $(POPLIB) $(LINKLIBS) diff --git a/uip/aliasbr.c b/uip/aliasbr.c index b1a7e619..50a2cd5d 100644 --- a/uip/aliasbr.c +++ b/uip/aliasbr.c @@ -350,29 +350,20 @@ addgroup (struct aka *ak, char *grp) return 0; } -#ifndef DBMPWD - if (homehead == NULL) - init_pw (); -#endif /* DBMPWD */ - while ((gp = *gr->gr_mem++)) -#ifdef DBMPWD { struct passwd *pw; -#endif /* DBMPWD */ for (hm = homehead; hm; hm = hm->h_next) if (!strcmp (hm->h_name, gp)) { add_aka (ak, hm->h_name); break; } -#ifdef DBMPWD if ((pw = getpwnam(gp))) { hmalloc(pw); add_aka (ak, gp); } } -#endif /* DBMPWD */ return 1; } @@ -396,10 +387,7 @@ addmember (struct aka *ak, char *grp) return 0; } -#ifndef DBMPWD - if (homehead == NULL) -#endif /* DBMPWD */ - init_pw (); + init_pw (); for (hm = homehead; hm; hm = hm->h_next) if (hm->h_gid == gid) @@ -415,10 +403,8 @@ addall (struct aka *ak) int noshell = NoShell == NULL || *NoShell == 0; register struct home *hm; -#ifndef DBMPWD - if (homehead == NULL) -#endif /* DBMPWD */ - init_pw (); + init_pw (); + if (Everyone < 0) Everyone = EVERYONE; @@ -487,28 +473,24 @@ void init_pw (void) { register struct passwd *pw; -#ifdef DBMPWD static int init; if (!init) { - /* if the list has yet to be initialized */ - /* zap the list, and rebuild from scratch */ - homehead=NULL; - hometail=NULL; - init++; -#endif /* DBMPWD */ + /* if the list has yet to be initialized */ + /* zap the list, and rebuild from scratch */ + homehead=NULL; + hometail=NULL; + init++; - setpwent (); + setpwent (); - while ((pw = getpwent ())) - if (!hmalloc (pw)) - break; + while ((pw = getpwent ())) + if (!hmalloc (pw)) + break; - endpwent (); -#ifdef DBMPWD + endpwent (); } -#endif /* DBMPWD */ } @@ -561,22 +543,15 @@ struct home * seek_home (char *name) { register struct home *hp; -#ifdef DBMPWD struct passwd *pw; char lname[32]; unsigned char *c; char *c1; -#else /* DBMPWD */ - - if (homehead == NULL) - init_pw (); -#endif /* DBMPWD */ for (hp = homehead; hp; hp = hp->h_next) if (!mh_strcasecmp (name, hp->h_name)) return hp; -#ifdef DBMPWD /* * The only place where there might be problems. * This assumes that ALL usernames are kept in lowercase. @@ -590,7 +565,6 @@ seek_home (char *name) *c1 = '\0'; if ((pw = getpwnam(lname))) return(hmalloc(pw)); -#endif /* DBMPWD */ - + return NULL; } diff --git a/uip/anno.c b/uip/anno.c index 41716f7c..ab15a4a0 100644 --- a/uip/anno.c +++ b/uip/anno.c @@ -238,11 +238,6 @@ main (int argc, char **argv) return 1; } -#ifdef UCI - if (strcmp(invo_name, "fanno") == 0) /* ugh! */ - datesw = 0; -#endif /* UCI */ - if (!context_find ("path")) free (path ("./", TFOLDER)); if (!msgs.size) diff --git a/uip/conflict.c b/uip/conflict.c index 07e77fc9..a3bd1d7b 100644 --- a/uip/conflict.c +++ b/uip/conflict.c @@ -131,10 +131,6 @@ main (int argc, char **argv) grp_names (); grp_members (); grp_ids (); -#ifdef UCI - ldr_names (); - ldr_ship (); -#endif /* UCI */ maildrops (); done (0); @@ -379,169 +375,3 @@ setup (void) } } } - -#ifdef UCI -/* - * UCI specific stuff for conflict - */ - -/* taken from */ - -#define GLDRS "/admin/etc/GroupLeaders" - -struct grpldr { - char *gl_name; - char **gl_ldr; -}; - -int setglent (), endglent (); -struct grpldr *getglent (), *getglnam (); - - -/* taken from the getglent() routines */ - -#define MAXGLS 100 - -static FILE *glp = NULL; -static char line[BUFSIZ+1]; -static struct grpldr grpldr; -static char *gl_ldr[MAXGLS + 1]; - - -setglent() { - if (glp == NULL) - glp = fopen (GLDRS, "r"); - else - rewind (glp); - - return (glp != NULL); -} - - -endglent() { - if (glp != NULL) { - fclose (glp); - glp = NULL; - } - - return 1; -} - -struct grpldr *getglent () { - register char *cp, - **q; - - if (glp == NULL && !setglent ()) - return NULL; - if ((cp = fgets (line, BUFSIZ, glp)) == NULL) - return NULL; - - grpldr.gl_name = cp; - grpldr.gl_ldr = q = gl_ldr; - - while (*cp) { - while (*cp && !isspace (*cp)) - cp++; - while (*cp && isspace (*cp)) - *cp++ = '\0'; - if (*cp == '\0') - break; - if (q < gl_ldr + MAXGLS) - *q++ = cp; - else - break; - } - *q = NULL; - - return (&grpldr); -} - -struct grpldr *getglnam (name) -char *name; -{ - register struct grpldr *gl = NULL; - - setglent (); - while (gl = getglent ()) - if (strcmp (name, gl->gl_name) == 0) - break; - endglent (); - - return gl; -} - -ldr_names () { - register int gp, - hit = 0; - char *gldrs[NGRPS]; - register struct grpldr *gl; - - gldrs[0] = NULL; - setglent (); - while (gl = getglent ()) { - if (getgrnam (gl->gl_name) == NULL) { - setup (); - fprintf (out, "unknown group %s in group leaders file\n", - gl->gl_name); - hit++; - } - for (gp = 0; gldrs[gp]; gp++) - if (strcmp (gldrs[gp], gl->gl_name) == 0) { - setup (); - fprintf (out, "duplicate group %s in group leaders file\n", - gl->gl_name); - hit++; - break; - } - if (gldrs[gp] == NULL) - if (gp < NGRPS) { - gldrs[gp++] = getcpy (gl->gl_name); - gldrs[gp] = NULL; - } - else { - setup (); - fprintf (out, "more than %d groups in group leaders file%s\n", - " (time to recompile)", NGRPS - 1); - hit++; - } - } - endglent (); - - for (gp = 0; gldrs[gp]; gp++) - free (gldrs[gp]); - - if (!hit && out && !mail) - fprintf (out, "all groups in group leaders file accounted for\n"); -} - - -ldr_ship () { - register int hit = 0; - register char **cp, - **dp; - register struct grpldr *gl; - - setglent (); - while (gl = getglent ()) - for (cp = gl->gl_ldr; *cp; cp++) { - if (!check (*cp)) { - setup (); - fprintf (out, "group %s has unknown leader %s\n", - gl->gl_name, *cp); - hit++; - } - - for (dp = cp + 1; *dp; dp++) - if (strcmp (*cp, *dp) == 0) { - setup (); - fprintf (out, "group %s had duplicate leader %s\n", - gl->gl_name, *cp); - hit++; - } - } - endglent (); - - if (!hit && out && !mail) - fprintf (out, "all group leaders accounted for\n"); -} -#endif /* UCI */ diff --git a/uip/forw.c b/uip/forw.c index ac0c4c53..8b5e008d 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -68,11 +68,8 @@ static struct swit switches[] = { { "help", 0 }, #define FILESW 24 { "file file", 4 }, /* interface from msh */ - -#ifdef MHE #define BILDSW 25 { "build", 5 }, /* interface from mhe */ -#endif /* MHE */ { NULL, 0 } }; @@ -132,9 +129,7 @@ main (int argc, char **argv) char **argp, **arguments, *msgs[MAXARGS]; struct stat st; -#ifdef MHE int buildsw = 0; -#endif /* MHE */ #ifdef LOCALE setlocale(LC_ALL, ""); @@ -186,10 +181,8 @@ main (int argc, char **argv) adios (NULL, "missing argument to %s", argp[-2]); nwhat = 0; continue; -#ifdef MHE case BILDSW: buildsw++; /* fall... */ -#endif /* MHE */ case NWHATSW: nwhat++; continue; @@ -298,18 +291,11 @@ main (int argc, char **argv) try_it_again: -#ifdef MHE strncpy (drft, buildsw ? m_maildir ("draft") : m_draft (dfolder, NULL, NOUSE, &isdf), sizeof(drft)); /* Check if a draft already exists */ if (!buildsw && stat (drft, &st) != NOTOK) { -#else - strncpy (drft, m_draft (dfolder, dmsg, NOUSE, &isdf), sizeof(drft)); - - /* Check if a draft already exists */ - if (stat (drft, &st) != NOTOK) { -#endif /* MHE */ printf ("Draft \"%s\" exists (%ld bytes).", drft, (long) st.st_size); for (i = LISTDSW; i != YESW;) { if (!(argp = getans ("\nDisposition? ", isdf ? aqrnl : aqrl))) diff --git a/uip/ftpsbr.c b/uip/ftpsbr.c deleted file mode 100644 index 0ffca352..00000000 --- a/uip/ftpsbr.c +++ /dev/null @@ -1,515 +0,0 @@ -/* - * ftpsbr.c -- simple FTP client library - * - * This code is Copyright (c) 2002, by the authors of nmh. See the - * COPYRIGHT file in the root directory of the nmh distribution for - * complete copyright information. - */ - -#include -#include - -#include "h/arpa_ftp.h" - -#define v_debug debugsw -#define v_verbose verbosw - -static int ftp_fd = NOTOK; -static int data_fd = NOTOK; - -static int v_noise; - -extern int v_debug; -extern int v_verbose; - -#include -#include -#include -#include -#include - -#define start_tcp_client(res) \ - socket (res->ai_family, res->ai_socktype, res->ai_protocol) - -#define join_tcp_server(fd, sock, len) \ - connect ((fd), (struct sockaddr *) (sock), len) - -/* - * prototypes - */ -int ftp_get (char *, char *, char *, char *, char *, char *, int, int); -int ftp_trans (char *, char *, char *, char *, char *, char *, char *, int, int); - -/* - * static prototypes - */ -static int start_tcp_server (struct sockaddr_in *, int, int, int); -static void _asnprintf (char *, int, char *, va_list); -static int ftp_quit (void); -static int ftp_read (char *, char *, char *, int); -static int initconn (void); -static int dataconn (void); -static int command (int arg1, ...); -static int vcommand (int, va_list); -static int getreply (int, int); - - -static int -start_tcp_server (struct sockaddr_in *sock, int backlog, int opt1, int opt2) -{ - int eindex, sd; - - if ((sd = socket (AF_INET, SOCK_STREAM, 0)) == NOTOK) - return NOTOK; - - if (bind (sd, (struct sockaddr *) sock, sizeof *sock) == NOTOK) { - eindex = errno; - close (sd); - errno = eindex; - } else { - listen (sd, backlog); - } - - return sd; -} - - -static int __len__; - -#define join_tcp_client(fd,sock) \ - accept ((fd), (struct sockaddr *) (sock), \ - (__len__ = sizeof *(sock), &__len__)) - -#define read_tcp_socket read -#define write_tcp_socket write -#define close_tcp_socket close - -static void -_asnprintf (char *bp, int len_bp, char *what, va_list ap) -{ - int eindex, len; - char *fmt; - - eindex = errno; - - *bp = '\0'; - fmt = va_arg (ap, char *); - - if (fmt) { - vsnprintf(bp, len_bp, fmt, ap); - len = strlen(bp); - bp += len; - len_bp -= len; - } - - if (what) { - char *s; - - if (*what) { - snprintf (bp, len_bp, " %s: ", what); - len = strlen (bp); - bp += len; - len_bp -= len; - } - if ((s = strerror(eindex))) - strncpy (bp, s, len_bp); - else - snprintf (bp, len_bp, "Error %d", eindex); - bp += strlen (bp); - } - - errno = eindex; -} - - -int -ftp_get (char *host, char *user, char *password, char *cwd, - char *remote, char *local, int ascii, int stayopen) -{ - return ftp_trans (host, user, password, cwd, remote, local, - "RETR", ascii, stayopen); -} - - -int -ftp_trans (char *host, char *user, char *password, char *cwd, char *remote, - char *local, char *cmd, int ascii, int stayopen) -{ - int result; - - if (stayopen <= 0) { - result = ftp_quit (); - if (host == NULL) - return result; - } - - if (ftp_fd == NOTOK) { - struct addrinfo hints, *res; - - memset(&hints, 0, sizeof(hints)); -#ifdef AI_ADDRCONFIG - hints.ai_flags = AI_ADDRCONFIG; -#endif - hints.ai_family = PF_INET; - hints.ai_socktype = SOCK_STREAM; - - result = getaddrinfo(host, "ftp", &hints, &res); - - if (result) { - fprintf(stderr, "%s/ftp: %s\n", host, gai_strerror(result)); - return NOTOK; - } - - if ((ftp_fd = start_tcp_client (res)) == NOTOK) { - perror (host); - freeaddrinfo(res); - return NOTOK; - } - if (join_tcp_server (ftp_fd, res->ai_addr, res->ai_addrlen) == NOTOK) { - perror (host); - freeaddrinfo(res); - close_tcp_socket (ftp_fd), ftp_fd = NOTOK; - return NOTOK; - } - freeaddrinfo(res); - getreply (1, 0); - - if (v_verbose) { - fprintf (stdout, "Connected to %s\n", host); - fflush (stdout); - } - - if (user) { - if ((result = command (0, "USER %s", user)) == CONTINUE) - result = command (1, "PASS %s", password); - if (result != COMPLETE) { - result = NOTOK; - goto out; - } - } - - if (remote == NULL) - return OK; - } - - if (cwd && ((result = command (0, "CWD %s", cwd)) != COMPLETE - && result != CONTINUE)) { - result = NOTOK; - goto out; - } - - if (command (1, ascii ? "TYPE A" : "TYPE I") != COMPLETE) { - result = NOTOK; - goto out; - } - - result = ftp_read (remote, local, cmd, ascii); - -out: ; - if (result != OK || !stayopen) - ftp_quit (); - - return result; -} - - -static int -ftp_quit (void) -{ - int n; - - if (ftp_fd == NOTOK) - return OK; - - n = command (1, "QUIT"); - close_tcp_socket (ftp_fd), ftp_fd = NOTOK; - return (n == 0 || n == COMPLETE ? OK : NOTOK); -} - -static int -ftp_read (char *remote, char *local, char *cmd, int ascii) -{ - int istdio = 0, istore; - register int cc; - int expectingreply = 0; - char buffer[BUFSIZ]; - FILE *fp = NULL; - - if (initconn () == NOTOK) - goto bad; - - v_noise = v_verbose; - if (command (-1, *remote ? "%s %s" : "%s", cmd, remote) != PRELIM) - goto bad; - - expectingreply++; - if (dataconn () == NOTOK) { -bad: ; - if (fp && !istdio) - fclose (fp); - if (data_fd != NOTOK) - close_tcp_socket (data_fd), data_fd = NOTOK; - if (expectingreply) - getreply (-2, 0); - - return NOTOK; - } - - istore = !strcmp (cmd, "STOR"); - - if ((istdio = !strcmp (local, "-"))) - fp = istore ? stdin : stdout; - else - if ((fp = fopen (local, istore ? "r" : "w")) == NULL) { - perror (local); - goto bad; - } - - if (istore) { - if (ascii) { - int c; - FILE *out; - - if (!(out = fdopen (data_fd, "w"))) { - perror ("fdopen"); - goto bad; - } - - while ((c = getc (fp)) != EOF) { - if (c == '\n') - putc ('\r', out); - if (putc (c, out) == EOF) { - perror ("putc"); - fclose (out); - data_fd = NOTOK; - goto bad; - } - } - - fclose (out); - data_fd = NOTOK; - } - else { - while ((cc = fread (buffer, sizeof *buffer, sizeof buffer, fp)) > 0) - if (write_tcp_socket (data_fd, buffer, cc) != cc) { - perror ("write_tcp_socket"); - goto bad; - } - - close_tcp_socket (data_fd), data_fd = NOTOK; - } - } - else { - if (ascii) { - int c; - FILE *in; - - if (!(in = fdopen (data_fd, "r"))) { - perror ("fdopen"); - goto bad; - } - - while ((c = getc (in)) != EOF) { - if (c == '\r') - switch (c = getc (in)) { - case EOF: - case '\0': - c = '\r'; - break; - - case '\n': - break; - - default: - putc ('\r', fp); - break; - } - - if (putc (c, fp) == EOF) { - perror ("putc"); - fclose (in); - data_fd = NOTOK; - goto bad; - } - } - - fclose (in); - data_fd = NOTOK; - } - else { - while ((cc = read_tcp_socket (data_fd, buffer, sizeof buffer)) > 0) - if (fwrite (buffer, sizeof *buffer, cc, fp) == 0) { - perror ("fwrite"); - goto bad; - } - if (cc < 0) { - perror ("read_tcp_socket"); - goto bad; - } - - close_tcp_socket (data_fd), data_fd = NOTOK; - } - } - - if (!istdio) - fclose (fp); - - v_noise = v_verbose; - return (getreply (1, 0) == COMPLETE ? OK : NOTOK); -} - - -#define UC(b) (((int) b) & 0xff) - -static int -initconn (void) -{ - int len; - register char *a, *p; - struct sockaddr_in in_socket; - - if (getsockname (ftp_fd, (struct sockaddr *) &in_socket, - (len = sizeof(in_socket), &len)) == NOTOK) { - perror ("getsockname"); - return NOTOK; - } - in_socket.sin_port = 0; - if ((data_fd = start_tcp_server (&in_socket, 1, 0, 0)) == NOTOK) { - perror ("start_tcp_server"); - return NOTOK; - } - - if (getsockname (data_fd, (struct sockaddr *) &in_socket, - (len = sizeof in_socket, &len)) == NOTOK) { - perror ("getsockname"); - return NOTOK; - } - - a = (char *) &in_socket.sin_addr; - p = (char *) &in_socket.sin_port; - - if (command (1, "PORT %d,%d,%d,%d,%d,%d", - UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]), - UC(p[0]), UC(p[1])) == COMPLETE) - return OK; - - return NOTOK; -} - -static int -dataconn (void) -{ - int fd; - struct sockaddr_in in_socket; - - if ((fd = join_tcp_client (data_fd, &in_socket)) == NOTOK) { - perror ("join_tcp_client"); - return NOTOK; - } - close_tcp_socket (data_fd); - data_fd = fd; - - return OK; -} - - -static int -command (int arg1, ...) -{ - int val; - va_list ap; - - va_start (ap, arg1); - val = vcommand (arg1, ap); - va_end (ap); - - return val; -} - -static int -vcommand (int complete, va_list ap) -{ - int len; - char buffer[BUFSIZ]; - - if (ftp_fd == NOTOK) - return NOTOK; - - _asnprintf (buffer, sizeof(buffer), NULL, ap); - if (v_debug) - fprintf (stderr, "<--- %s\n", buffer); - - strcat (buffer, "\r\n"); - len = strlen (buffer); - - if (write_tcp_socket (ftp_fd, buffer, len) != len) { - perror ("write_tcp_socket"); - return NOTOK; - } - - return (getreply (complete, !strcmp (buffer, "QUIT"))); -} - - -static int -getreply (int complete, int expecteof) -{ - for (;;) { - register int code, dig, n; - int continuation; - register char *bp; - char buffer[BUFSIZ]; - - code = dig = n = continuation = 0; - bp = buffer; - - for (;;) { - unsigned char c; - - if (read_tcp_socket (ftp_fd, &c, 1) < 1) { - if (expecteof) - return OK; - - perror ("read_tcp_socket"); - return DONE; - } - if (c == '\n') - break; - *bp++ = c != '\r' ? c : '\0'; - - dig++; - if (dig < 4) { - if (isdigit(c)) - code = code * 10 + (c - '0'); - else /* XXX: naughty FTP... */ - if (isspace (c)) - continuation++; - } - else - if (dig == 4 && c == '-') - continuation++; - if (n == 0) - n = c; - } - - if (v_debug) - fprintf (stderr, "---> %s\n", buffer); - if (continuation) - continue; - - n -= '0'; - - if (v_noise) { - fprintf (stdout, "%s\n", buffer); - fflush (stdout); - v_noise = 0; - } - else - if ((complete == -1 && n != PRELIM) - || (complete == 0 && n != CONTINUE && n != COMPLETE) - || (complete == 1 && n != COMPLETE)) - fprintf (stderr, "%s\n", buffer); - - return n; - } -} diff --git a/uip/inc.c b/uip/inc.c index 3dd1872f..1dcba6a5 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -236,10 +236,6 @@ main (int argc, char **argv) char *MAILHOST_env_variable; #endif -#ifdef MHE - FILE *mhe = NULL; -#endif - done=inc_done; /* absolutely the first thing we do is save our privileges, @@ -632,20 +628,6 @@ go_to_it: #endif /* POP */ } -#ifdef MHE - if (context_find ("mhe")) { - int i; - cp = concat (maildir, "/++", NULL); - i = stat (cp, &st); - if ((mhe = fopen (cp, "a")) == NULL) - admonish (cp, "unable to append to"); - else - if (i == NOTOK) - chmod (cp, m_gmprot ()); - free (cp); - } -#endif /* MHE */ - /* Get new format string */ nfs = new_fs (form, format, FORMAT); @@ -741,10 +723,6 @@ go_to_it: default: if (aud) fputs (scanl, aud); -# ifdef MHE - if (mhe) - fputs (scanl, mhe); -# endif /* MHE */ if (noisy) fflush (stdout); if (!packfile) { @@ -852,10 +830,6 @@ go_to_it: if (aud) fputs (scanl, aud); -#ifdef MHE - if (mhe) - fputs (scanl, mhe); -#endif /* MHE */ if (noisy) fflush (stdout); @@ -951,10 +925,6 @@ go_to_it: if (aud) fputs (scanl, aud); -# ifdef MHE - if (mhe) - fputs (scanl, mhe); -# endif /* MHE */ if (noisy) fflush (stdout); if (!packfile) { @@ -995,11 +965,6 @@ go_to_it: if (aud) fclose (aud); -#ifdef MHE - if (mhe) - fclose (mhe); -#endif /* MHE */ - if (noisy) fflush (stdout); diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index a36941f3..ea2bcd68 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -71,9 +71,6 @@ void content_error (char *, CT, char *, ...); /* mhcachesbr.c */ int find_cache (CT, int, int *, char *, char *, int); -/* ftpsbr.c */ -int ftp_get (char *, char *, char *, char *, char *, char *, int, int); - /* mhfree.c */ void free_content (CT); void free_ctinfo (CT); diff --git a/uip/mhparse.c b/uip/mhparse.c index 14322ab2..4959dfec 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -2485,10 +2485,8 @@ openFTP (CT ct, char **file) if ((ftp = context_find (nmhaccessftp)) && !*ftp) ftp = NULL; -#ifndef BUILTIN_FTP if (!ftp) return NOTOK; -#endif switch (openExternal (e->eb_parent, e->eb_content, ce, file, &fd)) { case NOTOK: @@ -2587,9 +2585,6 @@ openFTP (CT ct, char **file) return NOTOK; } -#ifdef BUILTIN_FTP - if (ftp) -#endif { int child_id, i, vecp; char *vec[9]; @@ -2625,9 +2620,6 @@ openFTP (CT ct, char **file) default: if (pidXwait (child_id, NULL)) { -#ifdef BUILTIN_FTP -losing_ftp: -#endif username = password = NULL; ce->ce_unlink = 1; return NOTOK; @@ -2635,14 +2627,6 @@ losing_ftp: break; } } -#ifdef BUILTIN_FTP - else - if (ftp_get (e->eb_site, user, pass, e->eb_dir, e->eb_name, - ce->ce_file, - e->eb_mode && !mh_strcasecmp (e->eb_mode, "ascii"), 0) - == NOTOK) - goto losing_ftp; -#endif if (cachefile[0]) { if (caching) diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index efa9ad3c..8e095910 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -19,6 +19,7 @@ #include #include #include +#include extern int debugsw; diff --git a/uip/repl.c b/uip/repl.c index d2b75df9..ab8042fe 100644 --- a/uip/repl.c +++ b/uip/repl.c @@ -68,11 +68,8 @@ static struct swit switches[] = { { "help", 0 }, #define FILESW 27 { "file file", 4 }, /* interface from msh */ - -#ifdef MHE #define BILDSW 28 { "build", 5 }, /* interface from mhe */ -#endif { NULL, 0 } }; @@ -145,9 +142,7 @@ main (int argc, char **argv) struct stat st; FILE *in; -#ifdef MHE int buildsw = 0; -#endif /* MHE */ #ifdef LOCALE setlocale(LC_ALL, ""); @@ -217,10 +212,8 @@ main (int argc, char **argv) adios (NULL, "missing argument to %s", argp[-2]); nwhat = 0; continue; -#ifdef MHE case BILDSW: buildsw++; /* fall... */ -#endif /* MHE */ case NWHATSW: nwhat++; continue; @@ -342,18 +335,11 @@ main (int argc, char **argv) try_it_again: -#ifdef MHE strncpy (drft, buildsw ? m_maildir ("reply") : m_draft (dfolder, NULL, NOUSE, &isdf), sizeof(drft)); /* Check if a draft exists */ if (!buildsw && stat (drft, &st) != NOTOK) { -#else - strncpy (drft, m_draft (dfolder, dmsg, NOUSE, &isdf), sizeof(drft)); - - /* Check if a draft exists */ - if (stat (drft, &st) != NOTOK) { -#endif /* MHE */ printf ("Draft \"%s\" exists (%ld bytes).", drft, (long) st.st_size); for (i = LISTDSW; i != YESW;) { if (!(argp = getans ("\nDisposition? ", isdf ? aqrnl : aqrl))) diff --git a/uip/rmf.c b/uip/rmf.c index a49ba4cf..5631f785 100644 --- a/uip/rmf.c +++ b/uip/rmf.c @@ -169,13 +169,6 @@ rmf (char *folder) continue; /* else fall */ case ',': -#ifdef MHE - case '+': -#endif /* MHE */ -#ifdef UCI - case '_': - case '#': -#endif /* UCI */ break; default: diff --git a/uip/scansbr.c b/uip/scansbr.c index 04dc2152..0d12c344 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -87,11 +87,6 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, char name[NAMESZ]; static int rlwidth, slwidth; -#ifdef RPATHS - char returnpath[BUFSIZ]; - char deliverydate[BUFSIZ]; -#endif - /* first-time only initialization */ if (!scanl) { if (width == 0) { @@ -173,19 +168,6 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, } if ((scnout = fopen (scnmsg, "w")) == NULL) adios (scnmsg, "unable to write"); -#ifdef RPATHS - /* - * Add the Return-Path and Delivery-Date - * header fields to message. - */ - if (get_returnpath (returnpath, sizeof(returnpath), - deliverydate, sizeof(deliverydate))) { - FPUTS ("Return-Path: "); - FPUTS (returnpath); - FPUTS ("Delivery-Date: "); - FPUTS (deliverydate); - } -#endif /* RPATHS */ } /* scan - main loop */ diff --git a/uip/send.c b/uip/send.c index 9d634ed1..39d425f5 100644 --- a/uip/send.c +++ b/uip/send.c @@ -153,9 +153,6 @@ main (int argc, char **argv) struct stat st; char *attach = (char *)0; /* header field name for attachments */ int attachformat = 0; /* mhbuild format specifier for attachments */ -#ifdef UCI - FILE *fp; -#endif /* UCI */ #ifdef LOCALE setlocale(LC_ALL, ""); @@ -411,18 +408,6 @@ go_to_it: if ((cp = getenv ("SIGNATURE")) == NULL || *cp == 0) if ((cp = context_find ("signature")) && *cp) m_putenv ("SIGNATURE", cp); -#ifdef UCI - else { - snprintf (buf, sizeof(buf), "%s/.signature", mypath); - if ((fp = fopen (buf, "r")) != NULL - && fgets (buf, sizeof buf, fp) != NULL) { - fclose (fp); - if (cp = strchr (buf, '\n')) - *cp = 0; - m_putenv ("SIGNATURE", buf); - } - } -#endif /* UCI */ for (msgnum = 0; msgnum < msgp; msgnum++) if (stat (msgs[msgnum], &st) == NOTOK) diff --git a/uip/slocal.c b/uip/slocal.c index cf91737d..f10c76de 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -439,11 +439,7 @@ localmail (int fd, char *mdlvr) verbose_printf ("(delivering to standard mail spool)\n"); /* last resort - deliver to standard mail spool */ -#ifdef SLOCAL_MBOX return usr_file (fd, mbox, MBOX_FORMAT); -#else - return usr_file (fd, mbox, MMDF_FORMAT); -#endif } @@ -1335,9 +1331,6 @@ you_lose: if (first) { first = 0; if (!strncmp (buffer, "From ", i)) { -#ifdef RPATHS - char *fp, *cp, *hp, *ep; -#endif /* get copy of envelope information ("From " line) */ envelope = getcpy (buffer); @@ -1348,33 +1341,6 @@ you_lose: goto fputs_error; #endif -#ifdef RPATHS - /* - * Now create a "Return-Path:" line - * from the "From " line. - */ - hp = cp = strchr(fp = envelope + i, ' '); - while ((hp = strchr(++hp, 'r'))) - if (uprf (hp, "remote from")) { - hp = strrchr(hp, ' '); - break; - } - if (hp) { - /* return path for UUCP style addressing */ - ep = strchr(++hp, '\n'); - snprintf (buffer, sizeof(buffer), "Return-Path: %.*s!%.*s\n", - (int)(ep - hp), hp, (int)(cp - fp), fp); - } else { - /* return path for standard domain addressing */ - snprintf (buffer, sizeof(buffer), "Return-Path: %.*s\n", - (int)(cp - fp), fp); - } - - /* Add Return-Path header to message */ - fputs (buffer, ffp); - if (ferror (ffp)) - goto fputs_error; -#endif /* Put the delivery date in message */ fputs (ddate, ffp); if (ferror (ffp)) diff --git a/uip/termsbr.c b/uip/termsbr.c index 93e6dd62..f30a0585 100644 --- a/uip/termsbr.c +++ b/uip/termsbr.c @@ -54,7 +54,7 @@ short ospeed; char PC; # endif -#endif notdef_lyndon_posix +#endif /* notdef_lyndon_posix */ static long speedcode; diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index ad7570a5..7db5c588 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -726,13 +726,6 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp, default: if ((status = pidwait (pid, NOTOK))) { -#ifdef ATTVIBUG - if ((cp = r1bindex (*ed, '/')) - && strcmp (cp, "vi") == 0 - && (status & 0x00ff) == 0) - status = 0; - else { -#endif if (((status & 0xff00) != 0xff00) && (!reedit || (status & 0x00ff))) { if (!use && (status & 0xff00) && @@ -744,9 +737,6 @@ editfile (char **ed, char **arg, char *file, int use, struct msgs *mp, } status = -2; /* maybe "reedit ? -2 : -1"? */ break; -#ifdef ATTVIBUG - } -#endif } reedit++; @@ -1107,9 +1097,6 @@ sendit (char *sp, char **arg, char *file, int pushed) #ifndef lint int distsw = 0; #endif -#ifdef UCI - FILE *fp; -#endif /* * Make sure these are defined. In particular, we need @@ -1310,18 +1297,6 @@ sendit (char *sp, char **arg, char *file, int pushed) if ((cp = getenv ("SIGNATURE")) == NULL || *cp == 0) if ((cp = context_find ("signature")) && *cp) m_putenv ("SIGNATURE", cp); -#ifdef UCI - else { - snprintf (buf, sizeof(buf), "%s/.signature", mypath); - if ((fp = fopen (buf, "r")) != NULL - && fgets (buf, sizeof(buf), fp) != NULL) { - fclose (fp); - if (cp = strchr (buf, '\n')) - *cp = 0; - m_putenv ("SIGNATURE", buf); - } - } -#endif /* UCI */ if ((annotext = getenv ("mhannotate")) == NULL || *annotext == 0) annotext = NULL;