From: Loic Prylli <Loic.Prylli@graville.fdn.fr>
Date: Mon, 29 Jun 1998 20:15:00 -0400
Subject: 02 Base fixes 1

Fixes from  Debian patch 1:8.1.1-10
---
 USD.doc/mail1.nr |  2 +-
 USD.doc/mail5.nr |  2 +-
 collect.c        |  2 ++
 head.c           |  3 +++
 mail.1           |  6 +++---
 main.c           |  2 +-
 misc/mail.rc     |  4 ++--
 names.c          |  3 ++-
 pathnames.h      | 39 +++++++++++++++++++++++++++++++++++----
 9 files changed, 50 insertions(+), 13 deletions(-)

diff --git a/USD.doc/mail1.nr b/USD.doc/mail1.nr
index 1d21d52..414fc2b 100644
--- a/USD.doc/mail1.nr
+++ b/USD.doc/mail1.nr
@@ -90,7 +90,7 @@ When you log in, the system notifies you if there are any messages
 waiting in your system mailbox.  If you are a
 .i csh
 user, you will be notified when new mail arrives if you inform
-the shell of the location of your mailbox.  On OpenBSD,
+the shell of the location of your mailbox.  On Debian,
 your system mailbox is located in the directory /var/mail
 in a file with your login name.  If your login name is
 .q sam,
diff --git a/USD.doc/mail5.nr b/USD.doc/mail5.nr
index aecaf61..3e352af 100644
--- a/USD.doc/mail5.nr
+++ b/USD.doc/mail5.nr
@@ -489,7 +489,7 @@ commands.
 .. The
 .. .b local
 .. command is usually not used be general users since it is designed for
-.. local configuration; it is usually found in the file /usr/lib/Mail.rc.
+.. local configuration; it is usually found in the file /etc/mail.rc.
 .ip "\fBmail\fP\ \ "
 Send mail to one or more people.  If you have the
 .i ask
diff --git a/collect.c b/collect.c
index 930d9a1..a63693f 100644
--- a/collect.c
+++ b/collect.c
@@ -402,6 +402,8 @@ exwrite(char *name, FILE *fp, int f)
 		fputs("File exists\n", stderr);
 		return(-1);
 	}
+        /* FIXME: Fopen with "w" will currently prevent writing to an existig file
+           (/dev/null), for now I am not sure this would even marginally useful to allow */
 	if ((of = Fopen(name, "w")) == NULL) {
 		warn(NULL);
 		return(-1);
diff --git a/head.c b/head.c
index 3043e5c..e89e92f 100644
--- a/head.c
+++ b/head.c
@@ -60,10 +60,13 @@ ishead(char *linebuf)
 		fail(linebuf, "No from or date field");
 		return(0);
 	}
+        /* be very tolerant about the date */
+#ifndef DEBIAN
 	if (!isdate(hl.l_date)) {
 		fail(linebuf, "Date field not legal date");
 		return(0);
 	}
+#endif
 	/*
 	 * I guess we got it!
 	 */
diff --git a/mail.1 b/mail.1
index d712811..aece9c1 100644
--- a/mail.1
+++ b/mail.1
@@ -298,7 +298,7 @@ The current list of such aliases can be displayed with the
 command in
 .Nm mail .
 System wide distribution lists can be created by editing
-.Pa /etc/mail/aliases
+.Pa /etc/aliases ,
 (see
 .Xr aliases 5 ) ;
 these are kept in a different syntax.
diff --git a/main.c b/main.c
index f802c07..b8c80fd 100644
--- a/main.c
+++ b/main.c
@@ -316,7 +316,7 @@ setscreensize(void)
 	if (ioctl(1, TIOCGWINSZ, (char *) &ws) == -1)
 		ws.ws_col = ws.ws_row = 0;
 	if (tcgetattr(1, &tbuf) == -1)
-		ospeed = 9600;
+		ospeed = B9600;
 	else
 		ospeed = cfgetospeed(&tbuf);
 	if (ospeed < B1200)
diff --git a/misc/mail.rc b/misc/mail.rc
index 95717f3..3fcc98d 100644
--- a/misc/mail.rc
+++ b/misc/mail.rc
@@ -1,2 +1,2 @@
-set append dot save asksub
-ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via
+set ask askcc append dot save crt
+ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via Delivered-To
diff --git a/names.c b/names.c
index d08cbde..8f35e6d 100644
--- a/names.c
+++ b/names.c
@@ -238,8 +238,9 @@ outof(struct name *names, FILE *fo, struct header *hp)
 
 			(void)snprintf(tempname, sizeof(tempname),
 			    "%s/mail.ReXXXXXXXXXX", tmpdir);
+                  /* hopefully we always create the file, so I change the "a" to "w"  the line below */
 			if ((fd = mkstemp(tempname)) == -1 ||
-			    (fout = Fdopen(fd, "a")) == NULL) {
+			    (fout = Fdopen(fd, "w")) == NULL) {
 				warn("%s", tempname);
 				senderr++;
 				goto cant;
diff --git a/pathnames.h b/pathnames.h
index f1f5100..aa639d2 100644
--- a/pathnames.h
+++ b/pathnames.h
@@ -36,14 +36,45 @@
 #include <paths.h>
 
 /* executables */
+#ifndef _PATH_SHELL
+#define _PATH_SHELL	"/bin/sh"
+#endif
+#ifndef _PATH_PAGER
+#define _PATH_PAGER	"/usr/bin/pager"
+#endif
+#ifndef _PATH_EX
+#define _PATH_EX	"/usr/bin/editor"
+#endif
+#ifndef _PATH_VI
+#define _PATH_VI	"/usr/bin/vi"
+#endif
+#ifndef _PATH_SENDMAIL
+#define _PATH_SENDMAIL	"/usr/sbin/sendmail"
+#endif
+
+/* directories */
+#ifndef _PATH_TMP
+#define _PATH_TMP	"/tmp/"
+#endif
+
+/* executables */
+#ifndef _PATH_LS
+#define _PATH_LS	"/bin/ls"
+#endif
+
+#ifndef DEBIAN
 #define _PATH_EX	"/usr/bin/ex"
 #define _PATH_MORE	"/usr/bin/more"
-#define _PATH_LS	"/bin/ls"
 #define _PATH_LOCKSPOOL	"/usr/libexec/lockspool"
+#endif
 
-/* directories & files */
+/* mail runtime files */
+#ifndef _PATH_MAILDIR
 #define _PATH_MAILDIR	"/var/mail"
-#define _PATH_HELP	"/usr/share/misc/mail.help"
-#define _PATH_TILDE	"/usr/share/misc/mail.tildehelp"
+#endif
+
+/* directories & files */
+#define _PATH_HELP	"/usr/share/misc/mail.help"
+#define _PATH_TILDE	"/usr/share/misc/mail.tildehelp"
 #define _PATH_MASTER_RC	"/etc/mail.rc"
 #define _PATH_LOCTMP	"/tmp/local.XXXXXXXXXX"
