MHpopd 1.00a patch [1/2]
しらいです。
MH 形式のローカルメイルフォルダ用 POP3/SMTP サーバ MHpopd
1.00a の patch その 1 です。
Submitted-by: shirai@chandra2
Archive-name: MHpopd-1.00a.patch/part01
---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is MHpopd-1.00a.patch, a shell archive (produced by GNU sharutils 4.2)
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2005-05-31 00:00 JST by <shirai@chandra2>.
# Source directory was `/usr/home/shirai/tmp'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This is part 1 of a multipart archive.
# Do not concatenate these parts, unpack them in order with `/bin/sh'.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 79932 -rw-r--r-- MHpopd-1.00a.patch
#
echo=echo
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
shar_touch=touch
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh00294; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
if test -r _sh00294/seq; then
$echo 'Must unpack archives in sequence!'
$echo 'Please unpack part' '`cat _sh00294/seq`' 'next!'
exit 1
fi
# ============= MHpopd-1.00a.patch ==============
if test -f 'MHpopd-1.00a.patch' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'MHpopd-1.00a.patch' '(file already exists)'
rm -f _sh00294/new
else
> _sh00294/new
$echo 'x -' extracting 'MHpopd-1.00a.patch' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'MHpopd-1.00a.patch' &&
diff -urNP ../MHpopd-1.00/Configur ./Configur
--- ../MHpopd-1.00/Configur Thu Mar 31 00:00:00 2005
+++ ./Configur Tue May 31 00:00:00 2005
@@ -157,13 +157,14 @@
X
X cat ./config.hin
X
-for i in TARUSESPACE CPP7BIT USETERMINFO TERMCAPLIB REGEXPLIB EXTENDLIB \
+for i in TARUSESPACE CPP7BIT USETERMINFO \
+TERMCAPLIB REGEXPLIB SOCKETLIB EXTENDLIB \
X NOFILEMACRO NOFUNCMACRO NOLINEMACRO \
X FORCEDSTDC STRICTSTDC NOSTDC NOCONST NOVOID NOLONGLONG HAVELONGLONG \
X NOUID_T USEPID_T DECLSIGLIST NOSIGLIST \
X DECLERRLIST PWNEEDERROR NOERRNO NOFILEMODE NOUNISTDH NOSTDLIBH NOTZFILEH \
X USELEAPCNT USESELECTH USESYSDIRH USETIMEH USESTDARGH USEMKDEVH USEMKNODH \
-USETERMIO USETERMIOS HAVECLINE \
+USESGTTY USETERMIO USETERMIOS HAVECLINE USEDEVPTMX \
X USEDIRECT SYSVDIRENT NODNAMLEN NODRECLEN DNAMESIZE \
X HAVETIMEZONE NOTMGMTOFF \
X USESTATVFSH USESTATFSH USEVFSH USEMOUNTH USEFSDATA \
@@ -285,6 +286,26 @@
X fi
X
X lib=
+if isexist "socket(0,0,0)" "sys/types sys/socket"; then
+ :
+elif havelib inet "socket(0,0,0)" "sys/types sys/socket"; then
+ lib="$lib${lib:+ }-linet"
+elif havelib socket "socket(0,0,0)" "sys/types sys/socket"; then
+ lib="$lib${lib:+ }-lsocket"
+fi
+if isexist "inet_ntoa(0)" "sys/types sys/socket"; then
+ :
+elif havelib nsl_s "inet_ntoa(0)" "sys/types sys/socket"; then
+ lib="$lib${lib:+ }-lnsl_s"
+elif havelib nsl "inet_ntoa(0)" "sys/types sys/socket"; then
+ lib="$lib${lib:+ }-lnsl"
+fi
+if [ -n "$lib" ]; then
+ echo "#define SOCKETLIB \"$lib\""
+ LIBS="$LIBS $lib"
+fi
+
+lib=
X if noexist "getmntent(0)" "stdio mntent" \
X && havelib sun "getmntent(0)" "stdio mntent"; then
X lib="$lib -lsun"
@@ -394,8 +415,10 @@
X elif isexist "major(0)" sys/mknod; then
X echo "#define USEMKNODH"
X fi
-if noheader sgtty \
-|| inheader "TIOCFLUSH" sgtty "TIOCFLUSH"; then
+if useheader sgtty \
+&& noinheader "TIOCFLUSH" sgtty "TIOCFLUSH"; then
+ echo "#define USESGTTY"
+else
X if useheader termios; then
X echo "#define USETERMIOS"
X else
@@ -404,6 +427,9 @@
X fi
X if isexist "t.c_line" "termios" "struct termios t;"; then
X echo "#define HAVECLINE"
+fi
+if [ -c /dev/ptmx -a -d /dev/pts ]; then
+ echo "#define USEDEVPTMX"
X fi
X if useheader dirent; then
X if isexist "d.d_ino" "sys/types dirent" "struct dirent d;" \
diff -urNP ../MHpopd-1.00/HISTORY ./HISTORY
--- ../MHpopd-1.00/HISTORY Thu Mar 31 00:00:00 2005
+++ ./HISTORY Tue May 31 00:00:00 2005
@@ -1,2 +1,5 @@
+Ver. 1.00a (05/31/2005)
+ Default timeout is expanded up to 30.
+
X Ver. 1.00 (03/31/2005)
X The first edition.
diff -urNP ../MHpopd-1.00/HISTORY.jp ./HISTORY.jp
--- ../MHpopd-1.00/HISTORY.jp Thu Mar 31 00:00:00 2005
+++ ./HISTORY.jp Tue May 31 00:00:00 2005
@@ -1,2 +1,5 @@
+Ver. 1.00a (05/31/2005)
+ タイムアウト初期値を 30 に延長。
+
X Ver. 1.00 (03/31/2005)
X 初版リリース。
diff -urNP ../MHpopd-1.00/Makefile ./Makefile
--- ../MHpopd-1.00/Makefile Thu Mar 31 00:00:00 2005
+++ ./Makefile Tue May 31 00:00:00 2005
@@ -40,7 +40,7 @@
X mkmf.sed: mkmfsed
X ./mkmfsed > mkmf.sed
X
-mkmfsed: mkmfsed.c mhpopd.h machine.h config.h
+mkmfsed: mkmfsed.c mhpopd.h machine.h config.h version.h
X ($(GETVER); \
X $(HOSTCC) $(CFLAGS) $(CPPFLAGS) $(DEFCFLAGS) -o $@ mkmfsed.c)
X
diff -urNP ../MHpopd-1.00/README ./README
--- ../MHpopd-1.00/README Thu Mar 31 00:00:00 2005
+++ ./README Tue May 31 00:00:00 2005
@@ -3,7 +3,7 @@
X # About MHpopd Ver. 1.00
X #
X # Takashi SHIRAI, <shirai@unixusers.net>
-# Mar 31, 2005
+# May 31, 2005
X #
X ############################################################
X
diff -urNP ../MHpopd-1.00/README.jp ./README.jp
--- ../MHpopd-1.00/README.jp Thu Mar 31 00:00:00 2005
+++ ./README.jp Tue May 31 00:00:00 2005
@@ -3,7 +3,7 @@
X # MHpopd Ver. 1.00 に関して
X #
X # Takashi SHIRAI, <shirai@unixusers.net>
-# Mar 31, 2005
+# May 31, 2005
X #
X ############################################################
X
diff -urNP ../MHpopd-1.00/TECHKNOW ./TECHKNOW
--- ../MHpopd-1.00/TECHKNOW Thu Mar 31 00:00:00 2005
+++ ./TECHKNOW Tue May 31 00:00:00 2005
@@ -212,6 +212,10 @@
X structure sgttyb is used.
X HAVECLINE
X The structure termios has the member c_line.
+USEDEVPTMX
+ The device file /dev/ptmx and /dev/pts/? are used for
+ the pseudo terminal. If undefined, /dev/ptyXX and
+ /dev/ttyXX are used.
X USEDIRECT
X The structure direct is used instead of dirent.
X SYSVDIRENT
diff -urNP ../MHpopd-1.00/TECHKNOW.jp ./TECHKNOW.jp
--- ../MHpopd-1.00/TECHKNOW.jp Thu Mar 31 00:00:00 2005
+++ ./TECHKNOW.jp Tue May 31 00:00:00 2005
@@ -207,6 +207,10 @@
X 構造体を用います。
X HAVECLINE
X 構造体 termios がメンバ c_line を持ちます。
+USEDEVPTMX
+ 擬似端末用デバイスとして /dev/ptmx と /dev/pts/? を
+ 用います。未定義の場合は /dev/ptyXX と /dev/ttyXX を
+ 用います。
X USEDIRECT
X 構造体 dirent の代わりに direct を用います。
X SYSVDIRENT
diff -urNP ../MHpopd-1.00/argv.c ./argv.c
--- ../MHpopd-1.00/argv.c Thu Mar 31 00:00:00 2005
+++ ./argv.c Tue May 31 00:00:00 2005
@@ -15,12 +15,12 @@
X #define ARGV_WORD 5
X #define ARGV_META 6
X
-static int argv_ismeta __P_((char *, ALLOC_T, int));
-static int argv_parse __P_((char *, ALLOC_T, int *));
-static char *argv_addch __P_((char *, ALLOC_T *, int));
+static int NEAR argv_ismeta __P_((char *, ALLOC_T, int));
+static int NEAR argv_parse __P_((char *, ALLOC_T, int *));
+static char NEAR *argv_addch __P_((char *, ALLOC_T *, int));
X
X
-static int argv_ismeta(s, len, quote)
+static int NEAR argv_ismeta(s, len, quote)
X char *s;
X ALLOC_T len;
X int quote;
@@ -33,7 +33,7 @@
X return(1);
X }
X
-static int argv_parse(s, len, quotep)
+static int NEAR argv_parse(s, len, quotep)
X char *s;
X ALLOC_T len;
X int *quotep;
@@ -57,7 +57,7 @@
X return(ARGV_NORMAL);
X }
X
-static char *argv_addch(s, sizep, c)
+static char NEAR *argv_addch(s, sizep, c)
X char *s;
X ALLOC_T *sizep;
X int c;
diff -urNP ../MHpopd-1.00/auth.c ./auth.c
--- ../MHpopd-1.00/auth.c Thu Mar 31 00:00:00 2005
+++ ./auth.c Tue May 31 00:00:00 2005
@@ -10,7 +10,7 @@
X #include "pop3.h"
X #include "smtp.h"
X
-typedef int (*authfunc_t)__P_((char *, XFILE *fp));
+typedef int (NEAR *authfunc_t)__P_((char *, XFILE *fp));
X
X typedef struct _authcmd_t {
X char *ident;
@@ -24,14 +24,14 @@
X static char *auth_username = NULL;
X static authfunc_t auth_func = NULL;
X
-static int auth_senderror __P_((XFILE *));
-static int auth_send __P_((XFILE *, int, char *));
-static char *auth_gencram __P_((VOID_A));
-static int auth_login __P_((char *, XFILE *fp));
-static int auth_plain __P_((char *, XFILE *fp));
-static int auth_cram __P_((char *, XFILE *fp));
+static int NEAR auth_senderror __P_((XFILE *));
+static int NEAR auth_send __P_((XFILE *, int, char *));
+static char *NEAR auth_gencram __P_((VOID_A));
+static int NEAR auth_login __P_((char *, XFILE *fp));
+static int NEAR auth_plain __P_((char *, XFILE *fp));
+static int NEAR auth_cram __P_((char *, XFILE *fp));
X #if 0
-static int auth_digest __P_((char *, XFILE *fp));
+static int NEAR auth_digest __P_((char *, XFILE *fp));
X #endif
X
X static authcmd_t authcmdlist[] = {
@@ -42,10 +42,10 @@
X DEFCMD("DIGEST-MD5", auth_digest, 0),
X #endif
X };
-#define AUTHCMDLISTSIZ (sizeof(authcmdlist) / sizeof(authcmd_t))
+#define AUTHCMDLISTSIZ ((int)sizeof(authcmdlist) / sizeof(authcmd_t))
X
X
-static int auth_senderror(fp)
+static int NEAR auth_senderror(fp)
X XFILE *fp;
X {
X int n;
@@ -66,7 +66,7 @@
X return(n);
X }
X
-static int auth_send(fp, code, s)
+static int NEAR auth_send(fp, code, s)
X XFILE *fp;
X int code;
X char *s;
@@ -97,7 +97,7 @@
X return(n);
X }
X
-static char *auth_gencram(VOID_A)
+static char *NEAR auth_gencram(VOID_A)
X {
X u_char md5[16];
X char tmp[MAXLINEBUF + 1], buf[MAXLINEBUF + 1];
@@ -116,7 +116,7 @@
X return(Xstrdup(buf));
X }
X
-static int auth_login(arg, fp)
+static int NEAR auth_login(arg, fp)
X char *arg;
X XFILE *fp;
X {
@@ -173,7 +173,7 @@
X return(1);
X }
X
-static int auth_plain(arg, fp)
+static int NEAR auth_plain(arg, fp)
X char *arg;
X XFILE *fp;
X {
@@ -220,7 +220,7 @@
X return(1);
X }
X
-static int auth_cram(arg, fp)
+static int NEAR auth_cram(arg, fp)
X char *arg;
X XFILE *fp;
X {
@@ -302,7 +302,7 @@
X
X #if 0
X /*ARGSUSED*/
-static int auth_digest(arg, fp)
+static int NEAR auth_digest(arg, fp)
X char *arg;
X XFILE *fp;
X {
diff -urNP ../MHpopd-1.00/base64.c ./base64.c
--- ../MHpopd-1.00/base64.c Thu Mar 31 00:00:00 2005
+++ ./base64.c Tue May 31 00:00:00 2005
@@ -38,11 +38,11 @@
X 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
X };
X
-static VOID base64_encodechar __P_((char *, int, int));
-static int base64_decodechar __P_((char *, int));
+static VOID NEAR base64_encodechar __P_((char *, int, int));
+static int NEAR base64_decodechar __P_((char *, int));
X
X
-static VOID base64_encodechar(s, n, val)
+static VOID NEAR base64_encodechar(s, n, val)
X char *s;
X int n, val;
X {
@@ -87,20 +87,20 @@
X }
X }
X buf[j] = '\0';
-
X errno = 0;
+
X return(0);
X }
X
-static int base64_decodechar(s, n)
+static int NEAR base64_decodechar(s, n)
X char *s;
X int n;
X {
X n = (n >= 0) ? s[n] : -1;
X if (n < 0 || n >= 128) n = -1;
X else n = decode64table[n];
-
X errno = (n < 0) ? EINVAL : 0;
+
X return(n);
X }
X
@@ -158,7 +158,7 @@
X buf[j++] |= (n & 0x3f);
X }
X *sizep = j;
-
X errno = 0;
+
X return(0);
X }
diff -urNP ../MHpopd-1.00/config.c ./config.c
--- ../MHpopd-1.00/config.c Thu Mar 31 00:00:00 2005
+++ ./config.c Tue May 31 00:00:00 2005
@@ -110,24 +110,24 @@
X ROTCONF("hostname", '\0', hostname, NULL, CF_STRING | CF_NULLOK),
X ROTCONF("mh-profile", '\0', mhprofile, DEFMHPROFILE, CF_STRING),
X ROTCONF("mhpopdrc", '\0', mhpopdrc, DEFMHPOPDRC, CF_STRING),
- ROTCONF("timeout", 't', readtimeout, DEFTIMEOUT, CF_INT),
+ ROTCONF("timeout", 't', sockettimeout, DEFTIMEOUT, CF_INT),
X USRCONF("my-password", '\0', mypasswd, NULL, CF_STRING | CF_NULLOK),
X USRCONF("my-folders", '\0', folders, NULL, CF_STRING | CF_NULLOK),
X
X ROTCONF("debuglevel", 'd', debuglevel, 0, CF_INT | CF_PRIORARGS),
X };
-#define CONFIGLISTSIZ (sizeof(configlist) / sizeof(config_t))
+#define CONFIGLISTSIZ ((int)sizeof(configlist) / sizeof(config_t))
X
-static int conf_isvalid __P_((int));
-static int conf_canset __P_((int, int));
-static VOID conf_usage __P_((VOID_A));
-static VOID conf_version __P_((VOID_A));
-static int conf_a2i __P_((int));
-static int conf_strtoi __P_((char *, int));
-static VOID conf_setval __P_((int, char *, int));
+static int NEAR conf_isvalid __P_((int));
+static int NEAR conf_canset __P_((int, int));
+static VOID NEAR conf_usage __P_((VOID_A));
+static VOID NEAR conf_version __P_((VOID_A));
+static int NEAR conf_a2i __P_((int));
+static int NEAR conf_strtoi __P_((char *, int));
+static VOID NEAR conf_setval __P_((int, char *, int));
X
X
-static int conf_isvalid(n)
+static int NEAR conf_isvalid(n)
X int n;
X {
X switch (mh_protocol) {
@@ -144,7 +144,7 @@
X return(0);
X }
X
-static int conf_canset(n, flags)
+static int NEAR conf_canset(n, flags)
X int n, flags;
X {
X if (!(configlist[n].tmpflags & CF_ISSET)) return(1);
@@ -184,7 +184,7 @@
X }
X }
X
-static VOID conf_usage(VOID_A)
+static VOID NEAR conf_usage(VOID_A)
X {
X int i;
X
@@ -205,12 +205,12 @@
X for (cp = version; *cp; cp++) if (isblank2(*cp)) break;
X while (isblank2(*(++cp)));
X for (len = (ALLOC_T)1; cp[len]; len++) if (isblank2(cp[len])) break;
-
X if (lenp) *lenp = (int)len;
+
X return(cp);
X }
X
-static VOID conf_version(VOID_A)
+static VOID NEAR conf_version(VOID_A)
X {
X char *cp;
X int len;
@@ -219,7 +219,7 @@
X fprintf(stderr, "%s Ver. %-.*s\n", myname, len, cp);
X }
X
-static int conf_a2i(c)
+static int NEAR conf_a2i(c)
X int c;
X {
X if (c < 0) return(-1);
@@ -227,7 +227,7 @@
X else return(-1);
X }
X
-static int conf_strtoi(s, base)
+static int NEAR conf_strtoi(s, base)
X char *s;
X int base;
X {
@@ -243,7 +243,7 @@
X return(n);
X }
X
-static VOID conf_setval(n, s, flags)
+static VOID NEAR conf_setval(n, s, flags)
X int n;
X char *s;
X int flags;
@@ -296,8 +296,8 @@
X *((char **)vp) = Xstrdup(s);
X break;
X }
-
X configlist[n].tmpflags |= flags;
+
X return;
X }
X
diff -urNP ../MHpopd-1.00/dirent.c ./dirent.c
--- ../MHpopd-1.00/dirent.c Thu Mar 31 00:00:00 2005
+++ ./dirent.c Tue May 31 00:00:00 2005
@@ -9,12 +9,12 @@
X #include "printf.h"
X #include "fileio.h"
X
-static int dir_isdot __P_((char *));
-static int dir_isnumeric __P_((char *, int *));
+static int NEAR dir_isdot __P_((char *));
+static int NEAR dir_isnumeric __P_((char *, int *));
X static int dir_cmplist __P_((CONST VOID_P, CONST VOID_P));
X
X
-static int dir_isdot(s)
+static int NEAR dir_isdot(s)
X char *s;
X {
X if (!s || *s != '.') return(0);
@@ -23,7 +23,7 @@
X return(1);
X }
X
-static int dir_isnumeric(s, np)
+static int NEAR dir_isnumeric(s, np)
X char *s;
X int *np;
X {
diff -urNP ../MHpopd-1.00/expfunc.c ./expfunc.c
--- ../MHpopd-1.00/expfunc.c Thu Mar 31 00:00:00 2005
+++ ./expfunc.c Tue May 31 00:00:00 2005
@@ -45,6 +45,7 @@
X char *s;
X {
X while (*s == ' ' || *s == '\t') s++;
+
X return(s);
X }
X
@@ -58,6 +59,7 @@
X if (!(tmp = (char *)malloc(n + 1))) exit(1);
X memcpy(tmp, s, n);
X tmp[n] = '\0';
+
X return(tmp);
X }
X
@@ -86,6 +88,7 @@
X func[funcno] = strndup2(line, len);
X funclen[funcno] = len;
X funcbody[funcno] = NULL;
+
X return(++cp);
X }
X
@@ -129,6 +132,7 @@
X
X strcat(funcbody[funcno], line);
X if (!i) strcat(funcbody[funcno++], "; }");
+
X return(i);
X }
X
@@ -152,6 +156,7 @@
X cp = skipspace(&(cp[2]));
X for (len = 0; cp[len]; len++)
X if (cp[len] == ' ' || cp[len] == '\t') break;
+
X return(strndup2(cp, len));
X }
X
@@ -244,8 +249,8 @@
X break;
X }
X }
-
X *linep = cp;
+
X return(i);
X }
X
diff -urNP ../MHpopd-1.00/filesys.c ./filesys.c
--- ../MHpopd-1.00/filesys.c Thu Mar 31 00:00:00 2005
+++ ./filesys.c Tue May 31 00:00:00 2005
@@ -55,8 +55,8 @@
X char *mnt_type;
X char *mnt_opts;
X } mnt_t;
-static FILE *Xsetmntent __P_((char *, char *));
-static mnt_t *Xgetmntent __P_((FILE *, mnt_t *));
+static FILE *NEAR Xsetmntent __P_((char *, char *));
+static mnt_t *NEAR Xgetmntent __P_((FILE *, mnt_t *));
X #if defined (USEMNTINFO) || defined (USEGETMNT)
X #define Xendmntent(f)
X #else
@@ -104,12 +104,12 @@
X #define FSYS_MNTNFS "nfs"
X #define FSYS_MNTNFSLEN (sizeof(FSYS_MNTNFS) - 1)
X
-static int fsys_getmnt __P_((char *, mnt_t *));
+static int NEAR fsys_getmnt __P_((char *, mnt_t *));
X
X
X #ifdef USEMNTCTL
X /*ARGSUSED*/
-static FILE *Xsetmntent(file, mode)
+static FILE *NEAR Xsetmntent(file, mode)
X char *file, *mode;
X {
X char *buf;
@@ -122,7 +122,7 @@
X return((FILE *)buf);
X }
X
-static mnt_t *Xgetmntent(fp, mntp)
+static mnt_t *NEAR Xgetmntent(fp, mntp)
X FILE *fp;
X mnt_t *mntp;
X {
@@ -185,7 +185,7 @@
X
X #if defined (USEMNTINFOR) || defined (USEMNTINFO) || defined (USEGETFSSTAT)
X /*ARGSUSED*/
-static FILE *Xsetmntent(file, mode)
+static FILE *NEAR Xsetmntent(file, mode)
X char *file, *mode;
X {
X #ifndef USEMNTINFO
@@ -217,7 +217,7 @@
X #define MNT_RDONLY M_RDONLY
X #endif
X
-static mnt_t *Xgetmntent(fp, mntp)
+static mnt_t *NEAR Xgetmntent(fp, mntp)
X FILE *fp;
X mnt_t *mntp;
X {
@@ -289,7 +289,7 @@
X
X #ifdef USEGETMNT
X /*ARGSUSED*/
-static FILE *Xsetmntent(file, mode)
+static FILE *NEAR Xsetmntent(file, mode)
X char *file, *mode;
X {
X mnt_ptr = 0;
@@ -298,7 +298,7 @@
X }
X
X /*ARGSUSED*/
-static mnt_t *Xgetmntent(fp, mntp)
+static mnt_t *NEAR Xgetmntent(fp, mntp)
X FILE *fp;
X mnt_t *mntp;
X {
@@ -336,7 +336,7 @@
X }
X #endif /* USEGETMNT */
X
-static int fsys_getmnt(path, mntbuf)
+static int NEAR fsys_getmnt(path, mntbuf)
X char *path;
X mnt_t *mntbuf;
X {
diff -urNP ../MHpopd-1.00/func.h ./func.h
--- ../MHpopd-1.00/func.h Thu Mar 31 00:00:00 2005
+++ ./func.h Tue May 31 00:00:00 2005
@@ -127,8 +127,12 @@
X int time_getdatestr __P_((char *, ALLOC_T));
X
X /* term.c */
-extern int Xioctl __P_((int, int, char *));
-extern int term_closetty __P_((VOID_A));
+extern int Xioctl __P_((int, int, VOID_P));
+extern VOID term_safeclose __P_((int, char *));
+extern VOID term_loadtermio __P_((int, char *, char *));
+extern VOID term_savetermio __P_((int, char **, char **));
+extern VOID term_getterm __P_((char **, char **));
+extern VOID term_closetty __P_((VOID_A));
X extern int term_gettty __P_((VOID_A));
X extern int term_hastty __P_((VOID_A));
X extern int term_init __P_((VOID_A));
@@ -213,7 +217,9 @@
X extern char *pwd_gethost __P_((VOID_A));
X
X /* pty.c */
-extern p_id_t Xforkpty __P_((int *));
+extern int Xopenpty __P_((int *, char *, ALLOC_T));
+extern int Xlogin_tty __P_((char *, char *, char *));
+extern p_id_t Xforkpty __P_((int *, char *, char *));
X
X /* wild.c */
X extern u_short *wild_init __P_((char *, ALLOC_T));
diff -urNP ../MHpopd-1.00/kctype.h ./kctype.h
--- ../MHpopd-1.00/kctype.h Thu Mar 31 00:00:00 2005
+++ ./kctype.h Tue May 31 00:00:00 2005
@@ -269,6 +269,12 @@
X #define _NOKANJIFCONV
X #endif
X
+#if !defined (_NOKANJICONV) || (defined (FD) && !defined (_NODOSDRIVE))
+K_EXTERN int kanjierrno K_INIT(0);
+#endif
+#ifndef _NOKANJIFCONV
+K_EXTERN int defaultkcode K_INIT(NOCNV);
+#endif
X #ifndef _NOKANJICONV
X K_EXTERN int inputkcode K_INIT(NOCNV);
X #endif
@@ -334,4 +340,4 @@
X ((inputkcode == SJIS) ? issjis2(c) : 0))
X #endif /* !_NOKANJICONV */
X
-#endif /* __KCTYPE_H_ */
+#endif /* !__KCTYPE_H_ */
diff -urNP ../MHpopd-1.00/libc.c ./libc.c
--- ../MHpopd-1.00/libc.c Thu Mar 31 00:00:00 2005
+++ ./libc.c Tue May 31 00:00:00 2005
@@ -12,10 +12,10 @@
X #include <sys/select.h>
X #endif
X
-static int fp_flags __P_((char *, int *));
-static XFILE *fp_alloc __P_((int, int, int, char *));
-static int fp_check __P_((XFILE *, int));
-static int fp_fillbuf __P_((XFILE *));
+static int NEAR fp_flags __P_((char *, int *));
+static XFILE *NEAR fp_alloc __P_((int, int, int, char *));
+static int NEAR fp_check __P_((XFILE *, int));
+static int NEAR fp_fillbuf __P_((XFILE *));
X
X
X VOID Xfree(vp)
@@ -69,6 +69,7 @@
X }
X
X memcpy(cp, s, len);
+
X return(cp);
X }
X
@@ -90,10 +91,11 @@
X
X memcpy(cp, s, len);
X cp[len] = '\0';
+
X return(cp);
X }
X
-static int fp_flags(mode, flagsp)
+static int NEAR fp_flags(mode, flagsp)
X char *mode;
X int *flagsp;
X {
@@ -123,12 +125,12 @@
X
X if (*mode == 'b') mode++;
X if (*mode == '+') acc = O_RDWR;
-
X *flagsp = (acc | flags);
+
X return(0);
X }
X
-static XFILE *fp_alloc(fd, flags, timeout, path)
+static XFILE *NEAR fp_alloc(fd, flags, timeout, path)
X int fd, flags, timeout;
X char *path;
X {
@@ -240,7 +242,7 @@
X return(fp);
X }
X
-static int fp_check(fp, flags)
+static int NEAR fp_check(fp, flags)
X XFILE *fp;
X int flags;
X {
@@ -276,6 +278,7 @@
X XFILE *fp;
X {
X if (fp_check(fp, 0) < 0) return(-1);
+
X return(fp -> flags & XF_EOF);
X }
X
@@ -283,10 +286,11 @@
X XFILE *fp;
X {
X if (fp_check(fp, 0) < 0) return(-1);
+
X return(fp -> flags & XF_ERROR);
X }
X
-static int fp_fillbuf(fp)
+static int NEAR fp_fillbuf(fp)
X XFILE *fp;
X {
X ALLOC_T len;
@@ -441,6 +445,7 @@
X u_char uc;
X
X if (Xfread(&uc, sizeof(uc), fp) <= 0) return(EOF);
+
X return((int)uc);
X }
X
@@ -451,6 +456,7 @@
X u_char uc;
X
X uc = (u_char)c;
+
X return(Xfwrite(&uc, sizeof(uc), fp));
X }
X
@@ -491,6 +497,7 @@
X
X buf[len] = '\0';
X if (lenp) *lenp = len;
+
X return((char *)buf);
X }
X
@@ -515,6 +522,7 @@
X
X fp -> buf[--(fp -> inptr)] = c;
X fp -> flags &= ~XF_EOF;
+
X return(c);
X }
X
diff -urNP ../MHpopd-1.00/log.c ./log.c
--- ../MHpopd-1.00/log.c Thu Mar 31 00:00:00 2005
+++ ./log.c Tue May 31 00:00:00 2005
@@ -16,7 +16,7 @@
X static int log_line = -1;
X static int log_errno = -1;
X
-static XFILE *log_open __P_((VOID_A));
+static XFILE *NEAR log_open __P_((VOID_A));
X
X
X VOID log_init(VOID_A)
@@ -33,7 +33,7 @@
X closelog();
X }
X
-static XFILE *log_open(VOID_A)
+static XFILE *NEAR log_open(VOID_A)
X {
X XFILE *fp;
X char path[MAXPATHLEN], old[MAXPATHLEN];
@@ -57,6 +57,7 @@
X n = umask(022);
X fp = Xfopen(path, "a", 0, 0);
X VOID_C umask(n);
+
X return(fp);
X }
X
@@ -97,7 +98,7 @@
X va_end(args);
X
X cp = (log_errno > 0) ? Xstrerror(log_errno) : NULL;
- if (cp && n < sizeof(buf) - 1)
+ if (cp && n < (int)sizeof(buf) - 1)
X snprintf2(&(buf[n]), sizeof(buf) - n, " (%s)", cp);
X
X if (log_errno >= 0) {
diff -urNP ../MHpopd-1.00/machine.h ./machine.h
--- ../MHpopd-1.00/machine.h Thu Mar 31 00:00:00 2005
+++ ./machine.h Tue May 31 00:00:00 2005
@@ -1,7 +1,7 @@
X /*
X * machine.h
X *
- * definition of machine depended identifier
+ * definitions of machine depended identifier
X */
X
X #ifndef __MACHINE_H_
@@ -487,6 +487,7 @@
X #define USEMKTIME
X #define DEFFDSETSIZE
X #define SIGFNCINT
+#define WAITKEYPAD 36
X #endif
X
X #if defined (linux)
@@ -831,6 +832,7 @@
X /* #define USETERMIO ;use termio interface */
X /* #define USETERMIOS ;use termios interface */
X /* #define HAVECLINE ;struct termios has c_line */
+/* #define USEDEVPTMX ;use /dev/ptmx and /dev/pts/? for pseudo terminal */
X /* #define USEDIRECT ;use 'struct direct' instead of dirent */
X /* #define SYSVDIRENT ;dirent interface behaves as System V */
X /* #define NODNAMLEN ;struct dirent hasn't d_namlen */
@@ -965,6 +967,10 @@
X # endif
X #endif
X
+#ifndef BSD4
+#define USEDEVPTMX
+#endif
+
X /* */
X /* Eval configurations by Configur */
X /* */
@@ -1164,4 +1170,4 @@
X #define GETTODARGS 2
X #endif
X
-#endif /* __MACHINE_H_ */
+#endif /* !__MACHINE_H_ */
diff -urNP ../MHpopd-1.00/main.c ./main.c
--- ../MHpopd-1.00/main.c Thu Mar 31 00:00:00 2005
+++ ./main.c Tue May 31 00:00:00 2005
@@ -8,11 +8,11 @@
X #include "pop3.h"
X #include "smtp.h"
X
-static int setmyname __P_((char *));
-static int mhpopd __P_((int, int));
+static int NEAR setmyname __P_((char *));
+static int NEAR mhpopd __P_((int, int));
X
X
-static int setmyname(s)
+static int NEAR setmyname(s)
X char *s;
X {
X char *cp;
@@ -39,17 +39,17 @@
X return(-1);
X }
X
-static int mhpopd(fdin, fdout)
+static int NEAR mhpopd(fdin, fdout)
X int fdin, fdout;
X {
X int (*func)__P_((XFILE *, XFILE *));
X XFILE *fpin, *fpout;
X int n;
X
- fpin = Xfdopen(fdout, "r", readtimeout, XF_CONNECTED, pathsocket);
+ fpin = Xfdopen(fdout, "r", sockettimeout, XF_CONNECTED, pathsocket);
X if (!fpin) return(-1);
X fpout = Xfdopen(fdin, "w",
- WRITETIMEOUT, XF_NOCLOSE | XF_CONNECTED, pathsocket);
+ sockettimeout, XF_NOCLOSE | XF_CONNECTED, pathsocket);
X if (!fpout) {
X Xfclose(fpin);
X return(-1);
diff -urNP ../MHpopd-1.00/md5.c ./md5.c
--- ../MHpopd-1.00/md5.c Thu Mar 31 00:00:00 2005
+++ ./md5.c Tue May 31 00:00:00 2005
@@ -27,11 +27,11 @@
X int n, b;
X } md5_t;
X
-static VOID md5_void __P_((u_long, u_long, u_long, u_long));
-static VOID md5_calc __P_((u_long [MD5_BUFSIZ], u_long [MD5_BLOCKS]));
-static VOID md5_init __P_((md5_t *));
-static VOID md5_add __P_((md5_t *, u_char *, ALLOC_T));
-static VOID md5_end __P_((md5_t *, u_char *, ALLOC_T *));
+static VOID NEAR md5_void __P_((u_long, u_long, u_long, u_long));
+static VOID NEAR md5_calc __P_((u_long [MD5_BUFSIZ], u_long [MD5_BLOCKS]));
+static VOID NEAR md5_init __P_((md5_t *));
+static VOID NEAR md5_add __P_((md5_t *, u_char *, ALLOC_T));
+static VOID NEAR md5_end __P_((md5_t *, u_char *, ALLOC_T *));
X
X
X /*ARGSUSED*/
@@ -41,7 +41,7 @@
X /* For bugs on NEWS-OS optimizer */
X }
X
-static VOID md5_calc(sum, x)
+static VOID NEAR md5_calc(sum, x)
X u_long sum[MD5_BUFSIZ], x[MD5_BLOCKS];
X {
X u_long a, b, c, d, tmp, t[MD5_BLOCKS];
@@ -186,7 +186,7 @@
X sum[3] = (sum[3] + d) & (u_long)0xffffffff;
X }
X
-static VOID md5_init(md5p)
+static VOID NEAR md5_init(md5p)
X md5_t *md5p;
X {
X md5p -> cl = md5p -> ch = (u_long)0;
@@ -198,7 +198,7 @@
X md5p -> n = md5p -> b = 0;
X }
X
-static VOID md5_add(md5p, s, len)
+static VOID NEAR md5_add(md5p, s, len)
X md5_t *md5p;
X u_char *s;
X ALLOC_T len;
@@ -225,7 +225,7 @@
X }
X }
X
-static VOID md5_end(md5p, buf, sizep)
+static VOID NEAR md5_end(md5p, buf, sizep)
X md5_t *md5p;
X u_char *buf;
X ALLOC_T *sizep;
diff -urNP ../MHpopd-1.00/message.c ./message.c
--- ../MHpopd-1.00/message.c Thu Mar 31 00:00:00 2005
+++ ./message.c Tue May 31 00:00:00 2005
@@ -8,10 +8,10 @@
X #include "kctype.h"
X #include "printf.h"
X
-static char *msg_addline __P_((char *, ALLOC_T *, char *, ALLOC_T, int));
+static char *NEAR msg_addline __P_((char *, ALLOC_T *, char *, ALLOC_T, int));
X
X
-static char *msg_addline(buf, sizep, s, len, flags)
+static char *NEAR msg_addline(buf, sizep, s, len, flags)
X char *buf;
X ALLOC_T *sizep;
X char *s;
@@ -123,6 +123,7 @@
X
X while (isblank2(*cp)) cp++;
X if (lenp) *lenp = len;
+
X return(cp);
X }
X
diff -urNP ../MHpopd-1.00/mhcmd.c ./mhcmd.c
--- ../MHpopd-1.00/mhcmd.c Thu Mar 31 00:00:00 2005
+++ ./mhcmd.c Tue May 31 00:00:00 2005
@@ -14,16 +14,16 @@
X #define MH_PICKNOMES "no messages in "
X #define MH_PICKNOMATCH "no messages match specification"
X
-static int mh_mkfolder __P_((char *, ALLOC_T, char *));
-static int mh_getfield __P_((char *, char *, char *, ALLOC_T));
-static int mh_setfield __P_((char *, char *, char *));
-static char *mh_getfolder __P_((VOID_A));
-static int mh_setfolder __P_((char *));
-static int mh_getlast __P_((char *));
-static int mh_refile __P_((char *, int));
-static int mh_lock __P_((char *));
-static int mh_unlock __P_((char *));
-static int mh_invoke __P_((char *, char **, char *, char ***));
+static int NEAR mh_mkfolder __P_((char *, ALLOC_T, char *));
+static int NEAR mh_getfield __P_((char *, char *, char *, ALLOC_T));
+static int NEAR mh_setfield __P_((char *, char *, char *));
+static char *NEAR mh_getfolder __P_((VOID_A));
+static int NEAR mh_setfolder __P_((char *));
+static int NEAR mh_getlast __P_((char *));
+static int NEAR mh_refile __P_((char *, int));
+static int NEAR mh_lock __P_((char *));
+static int NEAR mh_unlock __P_((char *));
+static int NEAR mh_invoke __P_((char *, char **, char *, char ***));
X
X
X int mh_genpath(path, size, folder, msgno)
@@ -50,7 +50,7 @@
X return(n);
X }
X
-static int mh_mkfolder(path, size, folder)
+static int NEAR mh_mkfolder(path, size, folder)
X char *path;
X ALLOC_T size;
X char *folder;
@@ -72,7 +72,7 @@
X return(n);
X }
X
-static int mh_getfield(file, field, val, size)
+static int NEAR mh_getfield(file, field, val, size)
X char *file, *field, *val;
X ALLOC_T size;
X {
@@ -104,7 +104,7 @@
X return(1);
X }
X
-static int mh_setfield(file, field, line)
+static int NEAR mh_setfield(file, field, line)
X char *file, *field, *line;
X {
X XFILE *fpin, *fpout;
@@ -156,6 +156,7 @@
X }
X
X Xfclose(fpout);
+
X return(0);
X }
X
@@ -191,7 +192,7 @@
X return(mh_setfield(path, curstr, tmp));
X }
X
-static char *mh_getfolder(VOID_A)
+static char *NEAR mh_getfolder(VOID_A)
X {
X char tmp[MAXLINEBUF + 1], path[MAXPATHLEN];
X int n;
@@ -205,7 +206,7 @@
X return(Xstrdup((n) ? tmp : inboxdir));
X }
X
-static int mh_setfolder(folder)
+static int NEAR mh_setfolder(folder)
X char *folder;
X {
X char path[MAXPATHLEN], tmp[MAXLINEBUF + 1];
@@ -219,7 +220,7 @@
X return(mh_setfield(path, curfolderstr, tmp));
X }
X
-static int mh_getlast(folder)
+static int NEAR mh_getlast(folder)
X char *folder;
X {
X int n, *list;
@@ -233,7 +234,7 @@
X return(n);
X }
X
-static int mh_refile(folder, seq)
+static int NEAR mh_refile(folder, seq)
X char *folder;
X int seq;
X {
@@ -320,7 +321,7 @@
X return(fp);
X }
X
-static int mh_lock(s)
+static int NEAR mh_lock(s)
X char *s;
X {
X char path[MAXPATHLEN];
@@ -345,10 +346,11 @@
X }
X
X ERRORx(("%s: Cannot create", path));
+
X return(-1);
X }
X
-static int mh_unlock(s)
+static int NEAR mh_unlock(s)
X char *s;
X {
X char path[MAXPATHLEN];
@@ -356,12 +358,12 @@
X
X if ((n = mh_genpath(path, sizeof(path), NULL, -1)) < 0) return(-1);
X snprintf2(&(path[n]), sizeof(path) - n, "/.%s.lck", s);
-
X sig_pop(path);
+
X return(Xunlink(path));
X }
X
-static int mh_invoke(proc, argv, prompt, listp)
+static int NEAR mh_invoke(proc, argv, prompt, listp)
X char *proc, **argv, *prompt, ***listp;
X {
X char *cp, *prog, **args, **list, path[MAXPATHLEN], buf[MAXLINEBUF + 1];
@@ -402,7 +404,7 @@
X
X sig_blockchild();
X if ((proc != incproc && !pat && !list)
- || (pid = Xforkpty(&fd)) < (p_id_t)0) {
+ || (pid = Xforkpty(&fd, origtty, origws)) < (p_id_t)0) {
X pid = Xfork();
X fd = -1;
X }
@@ -412,7 +414,7 @@
X if (!pid) {
X log_end();
X log_init();
- if (fd < 0) VOID_C term_closetty();
+ if (fd < 0) term_closetty();
X Xfree(pat);
X list_free(list);
X Xexecve(path, args, pwd_envp);
diff -urNP ../MHpopd-1.00/mhpass_j.man ./mhpass_j.man
--- ../MHpopd-1.00/mhpass_j.man Thu Mar 31 00:00:00 2005
+++ ./mhpass_j.man Tue May 31 00:00:00 2005
@@ -2,9 +2,9 @@
X .\" Copyright (c) 2005 Takashi SHIRAI
X .\" <shirai@unixusers.net>
X .\"
-.\" @(#)mhpasswd.1 1.00 03/31/05
+.\" @(#)mhpasswd.1 1.00a 05/31/05
X .\" mhpasswd - password generator for MHpopd
-.TH MHPASSWD 1 "March 31, 2005"
+.TH MHPASSWD 1 "May 31, 2005"
X .de sh
X .br
X .PP
diff -urNP ../MHpopd-1.00/mhpasswd.man ./mhpasswd.man
--- ../MHpopd-1.00/mhpasswd.man Thu Mar 31 00:00:00 2005
+++ ./mhpasswd.man Tue May 31 00:00:00 2005
@@ -2,9 +2,9 @@
X .\" Copyright (c) 2005 Takashi SHIRAI
X .\" <shirai@unixusers.net>
X .\"
-.\" @(#)mhpasswd.1 1.00 03/31/05
+.\" @(#)mhpasswd.1 1.00a 05/31/05
X .\" mhpasswd - password generator for MHpopd
-.TH MHPASSWD 1 "March 31, 2005"
+.TH MHPASSWD 1 "May 31, 2005"
X .de sh
X .br
X .PP
diff -urNP ../MHpopd-1.00/mhpopd.cat ./mhpopd.cat
--- ../MHpopd-1.00/mhpopd.cat Thu Mar 31 00:00:00 2005
+++ ./mhpopd.cat Tue May 31 00:00:00 2005
@@ -257,8 +257,8 @@
X t^Hti^Him^Hme^Heo^Hou^Hut^Ht The timeout for the client input. In case the cli-
X ent input pauses more than seconds specified by
X this value, the server will close connection
- forcedly. The default value is 5^H5. Notice that it
- is overwritten by the option -^H-t^Ht.
+ forcedly. The default value is 3^H30^H0. Notice that
+ it is overwritten by the option -^H-t^Ht.
X
X d^Hde^Heb^Hbu^Hug^Hgl^Hle^Hev^Hve^Hel^Hl
X The debug level. It allows to output verbose logs
diff -urNP ../MHpopd-1.00/mhpopd.h ./mhpopd.h
--- ../MHpopd-1.00/mhpopd.h Thu Mar 31 00:00:00 2005
+++ ./mhpopd.h Tue May 31 00:00:00 2005
@@ -26,7 +26,6 @@
X #define MAXLONGWIDTH 20 /* log10(2^64) = 19.266 */
X #define COREDUMPSIZE (1024 * 1024) /* maximum core dump size */
X #define MAXBACKLOG 5 /* backlog of listen() */
-#define WRITETIMEOUT 5 /* timeout to write() */
X
X #define DEFSPOOLDIR "Mail" /* local spool directory */
X #define DEFINBOXDIR "inbox" /* local folder */
@@ -47,7 +46,7 @@
X #define DEFDENYFILE "/etc/users.deny" /* full path for deny file */
X #define DEFMHPROFILE ".mh_profile" /* MH profile name */
X #define DEFMHPOPDRC ".mhpopdrc" /* user run com name */
-#define DEFTIMEOUT 5 /* timeout of read() */
+#define DEFTIMEOUT 30 /* timeout of read()/write() */
X
X #include "types.h"
X #include "func.h"
diff -urNP ../MHpopd-1.00/mhpopd.man ./mhpopd.man
--- ../MHpopd-1.00/mhpopd.man Thu Mar 31 00:00:00 2005
+++ ./mhpopd.man Tue May 31 00:00:00 2005
@@ -2,9 +2,9 @@
X .\" Copyright (c) 2005 Takashi SHIRAI
X .\" <shirai@unixusers.net>
X .\"
-.\" @(#)mhpopd.8 1.00 03/31/05
+.\" @(#)mhpopd.8 1.00a 05/31/05
X .\" mhpopd - File & Directory maintenance tool
-.TH MHPOPD 8 "March 31, 2005"
+.TH MHPOPD 8 "May 31, 2005"
X .de sh
X .br
X .PP
@@ -358,7 +358,7 @@
X In case the client input pauses more than seconds specified by this value,
X the server will close connection forcedly.
X The default value is
-.BR 5 .
+.BR 30 .
X Notice that it is overwritten by the option
X .BR \-t .
X .IP "\fBdebuglevel\fP"
diff -urNP ../MHpopd-1.00/mhpopd_j.cat ./mhpopd_j.cat
--- ../MHpopd-1.00/mhpopd_j.cat Thu Mar 31 00:00:00 2005
+++ ./mhpopd_j.cat Tue May 31 00:00:00 2005
@@ -241,7 +241,7 @@
X
X t^Hti^Him^Hme^Heo^Hou^Hut^Ht クライアント入力のタイムアウト。クライアントからの
X 入力がここで指定された秒数以上途切れた場合には、サ
- ーバは一方的に接続を切断します。既定値は 5^H5 です。
+ ーバは一方的に接続を切断します。既定値は 3^H30^H0 です。
X 但し、起動オプション -^H-t^Ht により上書きされます。
X
X d^Hde^Heb^Hbu^Hug^Hgl^Hle^Hev^Hve^Hel^Hl
diff -urNP ../MHpopd-1.00/mhpopd_j.man ./mhpopd_j.man
--- ../MHpopd-1.00/mhpopd_j.man Thu Mar 31 00:00:00 2005
+++ ./mhpopd_j.man Tue May 31 00:00:00 2005
@@ -2,9 +2,9 @@
X .\" Copyright (c) 2005 Takashi SHIRAI
X .\" <shirai@unixusers.net>
X .\"
-.\" @(#)mhpopd.8 1.00 03/31/05
+.\" @(#)mhpopd.8 1.00a 05/31/05
X .\" mhpopd - File & Directory maintenance tool
-.TH MHPOPD 8 "March 31, 2005"
+.TH MHPOPD 8 "May 31, 2005"
X .de sh
X .br
X .PP
@@ -391,7 +391,7 @@
X クライアントからの入力がここで指定された秒数以上途切れた場合には、
X サーバは一方的に接続を切断します。
X 既定値は
-.B " 5"
+.B " 30"
X です。
X 但し、
X 起動オプション
diff -urNP ../MHpopd-1.00/mhpopdrc.sam ./mhpopdrc.sam
--- ../MHpopd-1.00/mhpopdrc.sam Thu Mar 31 00:00:00 2005
+++ ./mhpopdrc.sam Tue May 31 00:00:00 2005
@@ -24,5 +24,5 @@
X hostname:
X mh-profile: .mh_profile
X mhpopdrc: .mhpopdrc
-timeout: 5
+timeout: 30
X debuglevel: 0
diff -urNP ../MHpopd-1.00/mkmfsed.c ./mkmfsed.c
--- ../MHpopd-1.00/mkmfsed.c Thu Mar 31 00:00:00 2005
+++ ./mkmfsed.c Tue May 31 00:00:00 2005
@@ -63,7 +63,7 @@
X #endif
X
X printf("s:__VER__:%s:\n", VER);
- if (sizeof(DIST) > 1) printf("s:__DIST__:%s:\n", DIST);
+ if ((int)sizeof(DIST) > 1) printf("s:__DIST__:%s:\n", DIST);
X else printf("s:__DIST__:none:\n");
X printf("s:__PREFIX__:%s:\n", PREFIX);
X printf("s:__CONFDIR__:%s:\n", CONFDIR);
diff -urNP ../MHpopd-1.00/pid.c ./pid.c
--- ../MHpopd-1.00/pid.c Thu Mar 31 00:00:00 2005
+++ ./pid.c Tue May 31 00:00:00 2005
@@ -9,10 +9,10 @@
X #include "fileio.h"
X #include <signal.h>
X
-static int pid_filename __P_((char *, ALLOC_T));
+static int NEAR pid_filename __P_((char *, ALLOC_T));
X
X
-static int pid_filename(path, size)
+static int NEAR pid_filename(path, size)
X char *path;
X ALLOC_T size;
X {
@@ -57,6 +57,7 @@
X }
X
X VOID_C Xunlink(path);
+
X return(0);
X }
X
@@ -82,6 +83,7 @@
X Xfclose(fp);
X
X if (n < 0) Xunlink(path);
+
X return(n);
X }
X
diff -urNP ../MHpopd-1.00/pop3.c ./pop3.c
--- ../MHpopd-1.00/pop3.c Thu Mar 31 00:00:00 2005
+++ ./pop3.c Tue May 31 00:00:00 2005
@@ -21,14 +21,15 @@
X pop3_t *pop_msglist = NULL;
X int pop_maxmsg = 0;
X
-static pop3_t *pop_initlist __P_((VOID_A));
-static pop3_t *pop_addlist __P_((pop3_t *, int, char *, int, ALLOC_T, char *));
-static VOID pop_freelist __P_((pop3_t *));
-static int pop_getfolders __P_((VOID_A));
-static char *pop_getuidl __P_((char *, int, ALLOC_T *));
+static pop3_t *NEAR pop_initlist __P_((VOID_A));
+static pop3_t *NEAR pop_addlist __P_((pop3_t *, int,
+ char *, int, ALLOC_T, char *));
+static VOID NEAR pop_freelist __P_((pop3_t *));
+static int NEAR pop_getfolders __P_((VOID_A));
+static char *NEAR pop_getuidl __P_((char *, int, ALLOC_T *));
X
X
-static pop3_t *pop_initlist(VOID_A)
+static pop3_t *NEAR pop_initlist(VOID_A)
X {
X pop3_t *new;
X
@@ -38,7 +39,7 @@
X return(new);
X }
X
-static pop3_t *pop_addlist(list, n, folder, file, size, uidl)
+static pop3_t *NEAR pop_addlist(list, n, folder, file, size, uidl)
X pop3_t *list;
X int n;
X char *folder;
@@ -68,7 +69,7 @@
X return(new);
X }
X
-static VOID pop_freelist(list)
+static VOID NEAR pop_freelist(list)
X pop3_t *list;
X {
X int i;
@@ -88,7 +89,7 @@
X pop_folders = NULL;
X }
X
-static int pop_getfolders(VOID_A)
+static int NEAR pop_getfolders(VOID_A)
X {
X char **argv;
X
@@ -102,7 +103,7 @@
X return(0);
X }
X
-static char *pop_getuidl(folder, n, lenp)
+static char *NEAR pop_getuidl(folder, n, lenp)
X char *folder;
X int n;
X ALLOC_T *lenp;
@@ -167,6 +168,7 @@
X }
X
X if (lenp) *lenp = size;
+
X return(Xstrdup(tmp));
X }
X
@@ -229,6 +231,7 @@
X }
X
X if (sizep) *sizep = size;
+
X return(n);
X }
X
diff -urNP ../MHpopd-1.00/pop3recv.c ./pop3recv.c
--- ../MHpopd-1.00/pop3recv.c Thu Mar 31 00:00:00 2005
+++ ./pop3recv.c Tue May 31 00:00:00 2005
@@ -9,7 +9,7 @@
X #include "printf.h"
X #include "pop3.h"
X
-typedef int (*pop3func_t)__P_((char **, XFILE *fp));
+typedef int (NEAR *pop3func_t)__P_((char **, XFILE *fp));
X
X typedef struct _pop3cmd_t {
X char *ident;
@@ -29,20 +29,20 @@
X
X static int lastmsg = -1;
X
-static int pop_quit __P_((char **, XFILE *fp));
-static int pop_user __P_((char **, XFILE *fp));
-static int pop_pass __P_((char **, XFILE *fp));
-static int pop_apop __P_((char **, XFILE *fp));
-static int pop_stat __P_((char **, XFILE *fp));
-static int pop_list __P_((char **, XFILE *fp));
-static int pop_retr __P_((char **, XFILE *fp));
-static int pop_dele __P_((char **, XFILE *fp));
-static int pop_noop __P_((char **, XFILE *fp));
-static int pop_rset __P_((char **, XFILE *fp));
-static int pop_top __P_((char **, XFILE *fp));
-static int pop_uidl __P_((char **, XFILE *fp));
-static int pop_auth __P_((char **, XFILE *fp));
-static int pop_last __P_((char **, XFILE *fp));
+static int NEAR pop_quit __P_((char **, XFILE *fp));
+static int NEAR pop_user __P_((char **, XFILE *fp));
+static int NEAR pop_pass __P_((char **, XFILE *fp));
+static int NEAR pop_apop __P_((char **, XFILE *fp));
+static int NEAR pop_stat __P_((char **, XFILE *fp));
+static int NEAR pop_list __P_((char **, XFILE *fp));
+static int NEAR pop_retr __P_((char **, XFILE *fp));
+static int NEAR pop_dele __P_((char **, XFILE *fp));
+static int NEAR pop_noop __P_((char **, XFILE *fp));
+static int NEAR pop_rset __P_((char **, XFILE *fp));
+static int NEAR pop_top __P_((char **, XFILE *fp));
+static int NEAR pop_uidl __P_((char **, XFILE *fp));
+static int NEAR pop_auth __P_((char **, XFILE *fp));
+static int NEAR pop_last __P_((char **, XFILE *fp));
X
X static pop3cmd_t pop3cmdlist[] = {
X DEFCMD("QUIT", pop_quit, 0, 0, POP_AUTH | POP_USER | POP_TRANS),
@@ -60,11 +60,11 @@
X DEFCMD("AUTH", pop_auth, 1, 2, POP_AUTH),
X DEFCMD("LAST", pop_last, 0, 0, POP_TRANS),
X };
-#define POP3CMDLISTSIZ (sizeof(pop3cmdlist) / sizeof(pop3cmd_t))
+#define POP3CMDLISTSIZ ((int)sizeof(pop3cmdlist) / sizeof(pop3cmd_t))
X
X
X /*ARGSUSED*/
-static int pop_quit(argv, fp)
+static int NEAR pop_quit(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -77,7 +77,7 @@
X return(1);
X }
X
-static int pop_user(argv, fp)
+static int NEAR pop_user(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -102,7 +102,7 @@
X return(0);
X }
X
-static int pop_pass(argv, fp)
+static int NEAR pop_pass(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -137,7 +137,7 @@
X return(0);
X }
X
-static int pop_apop(argv, fp)
+static int NEAR pop_apop(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -172,7 +172,7 @@
X }
X
X /*ARGSUSED*/
-static int pop_stat(argv, fp)
+static int NEAR pop_stat(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -183,7 +183,7 @@
X return(pop_sendok(fp, "%d %lu", n, size));
X }
X
-static int pop_list(argv, fp)
+static int NEAR pop_list(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -206,7 +206,7 @@
X return(msg_sendeom(fp));
X }
X
-static int pop_retr(argv, fp)
+static int NEAR pop_retr(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -235,7 +235,7 @@
X return(0);
X }
X
-static int pop_dele(argv, fp)
+static int NEAR pop_dele(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -250,7 +250,7 @@
X }
X
X /*ARGSUSED*/
-static int pop_noop(argv, fp)
+static int NEAR pop_noop(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -258,7 +258,7 @@
X }
X
X /*ARGSUSED*/
-static int pop_rset(argv, fp)
+static int NEAR pop_rset(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -268,10 +268,11 @@
X if (pop_fetch() < 0) return(pop_senderror(fp));
X for (n = 0; n < pop_maxmsg; n++) pop_msglist[n].flags &= ~POP_DELETED;
X if ((n = pop_gettotal(&size)) < 0) return(pop_senderror(fp));
+
X return(pop_sendok(fp, "%d messages (%lu octets)", n, size));
X }
X
-static int pop_top(argv, fp)
+static int NEAR pop_top(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -311,7 +312,7 @@
X return(0);
X }
X
-static int pop_uidl(argv, fp)
+static int NEAR pop_uidl(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -334,7 +335,7 @@
X return(msg_sendeom(fp));
X }
X
-static int pop_auth(argv, fp)
+static int NEAR pop_auth(argv, fp)
X char **argv;
X XFILE *fp;
X {
@@ -342,13 +343,14 @@
X }
X
X /*ARGSUSED*/
-static int pop_last(argv, fp)
+static int NEAR pop_last(argv, fp)
X char **argv;
X XFILE *fp;
X {
X if (!pop_msglist || lastmsg >= pop_maxmsg) lastmsg = -1;
X if (lastmsg >= 0 && (pop_msglist[lastmsg].flags & POP_DELETED))
X lastmsg = -1;
+
X return(pop_sendok(fp, "%d", lastmsg + 1));
X }
X
diff -urNP ../MHpopd-1.00/pop3send.c ./pop3send.c
--- ../MHpopd-1.00/pop3send.c Thu Mar 31 00:00:00 2005
+++ ./pop3send.c Tue May 31 00:00:00 2005
@@ -16,6 +16,7 @@
X int n;
X
X n = snprintf2(buf, sizeof(buf), "%s %s\r\n", pop_errstr, log_buf);
+
X return(Xfwrite((u_char *)buf, n, fp));
X }
X
diff -urNP ../MHpopd-1.00/printf.c ./printf.c
--- ../MHpopd-1.00/printf.c Thu Mar 31 00:00:00 2005
+++ ./printf.c Tue May 31 00:00:00 2005
@@ -91,6 +91,7 @@
X }
X if (i <= *ptrp) n = -1;
X *ptrp = i;
+
X return(n);
X }
X
@@ -100,6 +101,7 @@
X {
X if (pbufp -> flags & (VF_NEW | VF_FILE)) return(0);
X if (pbufp -> ptr + n < pbufp -> size) return(0);
+
X return(-1);
X }
X
@@ -132,6 +134,7 @@
X }
X }
X pbufp -> buf[(pbufp -> ptr)++] = n;
+
X return(1);
X }
X
@@ -188,7 +191,7 @@
X if (!n) {
X if (prec) num[len++] = '0';
X }
- else while (len < sizeof(num) / sizeof(char)) {
+ else while (len < (int)sizeof(num) / sizeof(char)) {
X #ifdef MINIMUMSHELL
X if (!bit) {
X i = (n % base);
@@ -290,7 +293,7 @@
X }
X else {
X s = "(null)";
- len = sizeof("(null)") - 1;
+ len = (int)sizeof("(null)") - 1;
X #ifdef LINUX
X /* spec. of glibc */
X if (prec >= 0 && len > prec) len = 0;
@@ -491,21 +494,21 @@
X }
X
X if (base) {
- if (len == sizeof(u_long_t))
+ if (len == (int)sizeof(u_long_t))
X u = va_arg(args, u_long_t);
X #ifdef HAVELONGLONG
- else if (len == sizeof(u_long))
+ else if (len == (int)sizeof(u_long))
X u = va_arg(args, u_long);
X #endif
X else u = va_arg(args, u_int);
X
X #ifndef HAVELONGLONG
- if (len > sizeof(u_long_t)) {
+ if (len > (int)sizeof(u_long_t)) {
X u_long_t hi, tmp;
X
- while (len > sizeof(u_int)) {
+ while (len > (int)sizeof(u_int)) {
X hi = va_arg(args, u_int);
- len -= sizeof(u_int);
+ len -= (int)sizeof(u_int);
X }
X
X tmp = 0x5a;
@@ -535,7 +538,7 @@
X #endif /* !HAVELONGLONG */
X if (!(pbufp -> flags & VF_UNSIGNED)) {
X mask = (MAXUTYPE(u_long_t)
- >> ((sizeof(long_t) - len)
+ >> (((int)sizeof(long_t) - len)
X * BITSPERBYTE + 1));
X if (u & ~mask) u |= ~mask;
X }
@@ -548,6 +551,7 @@
X va_end(args);
X if (pbufp -> buf && !(pbufp -> flags & VF_FILE))
X pbufp -> buf[pbufp -> ptr] = '\0';
+
X return(total);
X }
X
@@ -563,6 +567,7 @@
X pbuf.flags = VF_NEW;
X n = commonprintf(&pbuf, fmt, args);
X *sp = pbuf.buf;
+
X return(n);
X }
X
@@ -588,6 +593,7 @@
X n = commonprintf(&pbuf, fmt, args);
X *sp = pbuf.buf;
X va_end(args);
+
X return(n);
X }
X
@@ -603,6 +609,7 @@
X pbuf.buf = s;
X pbuf.size = size;
X pbuf.flags = 0;
+
X return(commonprintf(&pbuf, fmt, args));
X }
X
@@ -630,6 +637,7 @@
X pbuf.flags = 0;
X n = commonprintf(&pbuf, fmt, args);
X va_end(args);
+
X return(n);
X }
X
@@ -654,6 +662,7 @@
X pbuf.flags = VF_FILE;
X n = commonprintf(&pbuf, fmt, args);
X va_end(args);
+
X return(n);
X }
X
diff -urNP ../MHpopd-1.00/printf.h ./printf.h
--- ../MHpopd-1.00/printf.h Thu Mar 31 00:00:00 2005
+++ ./printf.h Tue May 31 00:00:00 2005
@@ -1,7 +1,7 @@
X /*
X * printf.h
X *
- * definition for "printf.c"
+ * definitions for "printf.c"
X */
X
X #ifndef __PRINTF_H_
@@ -77,4 +77,4 @@
X #define kanjifputs fputs
X #endif
X
-#endif /* __PRINTF_H_ */
+#endif /* !__PRINTF_H_ */
diff -urNP ../MHpopd-1.00/pty.c ./pty.c
--- ../MHpopd-1.00/pty.c Thu Mar 31 00:00:00 2005
+++ ./pty.c Tue May 31 00:00:00 2005
@@ -28,21 +28,26 @@
X #define O_NOCTTY 0
X #endif
X
-#ifdef BSD4
+#ifndef USEDEVPTMX
X static char pty_char1[] = "pqrstuvwxyzPQRST";
X static char pty_char2[] = "0123456789abcdefghijklmnopqrstuv";
X #endif
X
-static VOID Xgrantpt __P_((char *));
-static VOID Xunlockpt __P_((int, char *));
-static int Xptsname __P_((int, char *, char *, ALLOC_T));
-static int Xopenpty __P_((int *, int *, char *, ALLOC_T));
-static int Xlogin_tty __P_((int, char *));
+static VOID NEAR Xgrantpt __P_((int, char *));
+static VOID NEAR Xunlockpt __P_((int, char *));
+static int NEAR Xptsname __P_((int, char *, char *, ALLOC_T));
X
X
-static VOID Xgrantpt(path)
+/*ARGSUSED*/
+static VOID NEAR Xgrantpt(fd, path)
+int fd;
X char *path;
X {
+#ifdef USEDEVPTMX
+ extern int grantpt __P_((int)); /* for Linux */
+
+ VOID_C grantpt(fd);
+#else /* !USEDEVPTMX */
X struct group *grp;
X gid_t gid;
X
@@ -50,59 +55,74 @@
X
X VOID_C chown(path, getuid(), gid);
X VOID_C chmod(path, 0620);
+#endif /* !USEDEVPTMX */
X }
X
X /*ARGSUSED*/
-static VOID Xunlockpt(fd, path)
+static VOID NEAR Xunlockpt(fd, path)
X int fd;
X char *path;
X {
-#ifdef BSD44
- VOID_C revoke(path);
-#else /* !BSD44 */
+#ifdef USEDEVPTMX
X # ifdef TIOCSPTLCK
X int n;
X
X n = 0;
- VOID_C Xioctl(fd, TIOCSPTLCK, (char *)&n);
-# else /* !TIOCSPTLCK */
+ VOID_C Xioctl(fd, TIOCSPTLCK, &n);
+# else
X VOID_C unlockpt(fd);
-# endif /* !TIOCSPTLCK */
-#endif /* !BSD44 */
+# endif
+#else /* !USEDEVPTMX */
+# ifdef BSD44
+ VOID_C revoke(path);
+# endif
+#endif /* !USEDEVPTMX */
X }
X
X /*ARGSUSED*/
-static int Xptsname(fd, path, spath, size)
+static int NEAR Xptsname(fd, path, spath, size)
X int fd;
X char *path, *spath;
X ALLOC_T size;
X {
-#ifdef BSD4
- snprintf2(spath, size, "%s", path);
- if ((path = strrchr(spath, '/'))) *(++path) = 't';
-#else /* !BSD */
+#ifdef USEDEVPTMX
X # ifdef TIOCGPTN
X int n;
X
- if (Xioctl(fd, TIOCGPTN, (char *)&n) < 0) return(-1);
+ if (Xioctl(fd, TIOCGPTN, &n) < 0) return(-1);
X snprintf2(spath, size, "%s/%d", _PATH_DEVPTS, n);
-# else /* !TIOCGPTN */
+# else
X if (!(path = ptsname(fd))) return(-1);
X snprintf2(spath, size, "%s", path);
-# endif /* !TIOCGPTN */
-#endif /* !BSD4 */
+# endif
+#else /* !USEDEVPTMX */
+ snprintf2(spath, size, "%s", path);
+ if ((path = strrchr(spath, '/'))) *(++path) = 't';
+#endif /* !USEDEVPTMX */
+
X return(0);
X }
X
-static int Xopenpty(amaster, aslave, spath, size)
-int *amaster, *aslave;
+int Xopenpty(amaster, spath, size)
+int *amaster;
X char *spath;
X ALLOC_T size;
X {
X char path[MAXPATHLEN];
X int master, slave;
X
-#ifdef BSD4
+#ifdef USEDEVPTMX
+ snprintf2(path, sizeof(path), "%s", _PATH_DEVPTMX);
+ if ((master = Xopen(path, O_RDWR, 0, XF_IGNOREERR)) < 0) return(-1);
+
+ Xgrantpt(master, path);
+ Xunlockpt(master, path);
+ if (Xptsname(master, path, spath, size) < 0
+ || (slave = Xopen(spath, O_RDWR | O_NOCTTY, 0, XF_IGNOREERR)) < 0) {
+ term_safeclose(master, pathpty);
+ return(-1);
+ }
+#else /* !USEDEVPTMX */
X char *cp1, *cp2;
X int n;
X
@@ -120,12 +140,12 @@
X }
X
X VOID_C Xptsname(master, path, spath, size);
- Xgrantpt(spath);
+ Xgrantpt(master, spath);
X Xunlockpt(master, spath);
X slave = Xopen(spath, O_RDWR, 0, XF_IGNOREERR);
X if (slave >= 0) break;
X
- Xclose(master, pathpty);
+ term_safeclose(master, pathpty);
X }
X
X if (master >= 0 && slave >= 0) break;
@@ -135,92 +155,85 @@
X errno = ENOENT;
X return(-1);
X }
-#else /* !BSD4 */
- snprintf2(path, sizeof(path), "%s", _PATH_DEVPTMX);
- if ((master = Xopen(path, O_RDWR, 0, XF_IGNOREERR)) < 0) return(-1);
-
- Xgrantpt(path);
- Xunlockpt(master, path);
- if (Xptsname(master, path, spath, size) < 0
- || (slave = Xopen(spath, O_RDWR | O_NOCTTY, 0, XF_IGNOREERR)) < 0) {
- Xclose(master, pathpty);
- return(-1);
- }
-# ifdef I_PUSH
- if (Xioctl(slave, I_PUSH, "ptem") < 0
- || Xioctl(slave, I_PUSH, "ldterm") < 0) {
- Xclose(master, pathpty);
- Xclose(slave, pathpty);
- return(-1);
- }
-# if defined (SOLARIS) || defined (NEWS_OS6)
- VOID_C Xioctl(slave, I_PUSH, "ttcompat");
-# endif
-# endif /* I_PUSH */
-#endif /* !BSD4 */
+#endif /* !USEDEVPTMX */
X
X *amaster = master;
- *aslave = slave;
+ term_safeclose(slave, pathpty);
X
X return(0);
X }
X
-/*ARGSUSED*/
-static int Xlogin_tty(fd, path)
-int fd;
-char *path;
+#if defined (IRIX) || defined (DECOSF1V2) || defined (DECOSF1V3)
+#undef I_PUSH
+#endif
+
+int Xlogin_tty(path, tty, ws)
+char *path, *tty, *ws;
X {
-#ifdef USESETSID
+ int fd;
+
X VOID_C Xsetsid();
SHAR_EOF
: || $echo 'restore of' 'MHpopd-1.00a.patch' 'failed'
fi
$echo 'End of' 'MHpopd-1.00a.patch' 'part' '1'
$echo 'File' 'MHpopd-1.00a.patch' 'is continued in part' '2'
echo 2 > _sh00294/seq
exit 0
--
しらい たかし
Fnews-brouse 1.9(20180406) -- by Mizuno, MWE <mwe@ccsf.jp>
GnuPG Key ID = ECC8A735
GnuPG Key fingerprint = 9BE6 B9E9 55A5 A499 CD51 946E 9BDC 7870 ECC8 A735