From doug@dt051n37.san.rr.com  Tue Sep 26 15:00:34 2000
Return-Path: <doug@dt051n37.san.rr.com>
Received: from dt051n37.san.rr.com (dt051n37.san.rr.com [204.210.32.55])
	by hub.freebsd.org (Postfix) with ESMTP id 0791337B424
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 26 Sep 2000 15:00:34 -0700 (PDT)
Received: (from doug@localhost)
	by dt051n37.san.rr.com (8.9.3/8.9.3) id PAA19004;
	Tue, 26 Sep 2000 15:00:28 -0700 (PDT)
	(envelope-from doug)
Message-Id: <200009262200.PAA19004@dt051n37.san.rr.com>
Date: Tue, 26 Sep 2000 15:00:28 -0700 (PDT)
From: DougB@gorean.org
Sender: doug@dt051n37.san.rr.com
Reply-To: DougB@gorean.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] Add -r option to /usr/bin/mail, quiet compiler warnings
X-Send-Pr-Version: 3.2

>Number:         21570
>Category:       bin
>Synopsis:       [PATCH] Add -r option to /usr/bin/mail, quiet compiler warnings
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 26 15:10:01 PDT 2000
>Closed-Date:    Sat Dec 30 21:22:45 GMT 2006
>Last-Modified:  Sat Dec 30 21:22:45 GMT 2006
>Originator:     Doug
>Release:        FreeBSD 3.5.1-STABLE-0903 i386
>Organization:
AAAG
>Environment:

	Any freebsd system

>Description:

	Unlike most /usr/bin/mail options, the reply-to header option lacks
	the ability to be set on the command line. In addition to convenience
	this also functions as a type of compatability option with SysV's mailx
	command.  (Adding this option has the additional benefit of 
	silencing some complaints from my sun-centric co-workers. :)

	The solaris version of the -r command actually sets the "From:" header,
	but that is very un-BSD-like. This seems to be an acceptable
	and useful alternative.

	While I'm here, silence a few compiler warnings about mktemp(). The
	resulting binary compiles, runs, and passes a cursory functionality
	test. mkstemp() is probably safer in this context anyway. 

>How-To-Repeat:

	DNA

>Fix:
	
	Apply the following patch. It applies cleanly to RELENG_5 and 
	RELENG_4, and runs on both. 


Index: mail.1
===================================================================
RCS file: /usr/ncvs/src/usr.bin/mail/mail.1,v
retrieving revision 1.19
diff -u -r1.19 mail.1
--- mail.1	2000/08/13 18:38:57	1.19
+++ mail.1	2000/09/26 21:08:04
@@ -44,6 +44,7 @@
 .Op Fl s Ar subject
 .Op Fl c Ar cc-addr
 .Op Fl b Ar bcc-addr
+.Op Fl r Ar reply-to
 .Ar to-addr ...
 .Op \&- Ar sendmail-option ...
 .Nm mail
@@ -99,6 +100,8 @@
 Send blind carbon copies to
 .Ar list .
 List should be a comma-separated list of names.
+.It Fl r
+Specify the Reply-To field on the command line.
 .It Fl f
 Read in the contents of your
 .Ar mbox
Index: main.c
===================================================================
RCS file: /usr/ncvs/src/usr.bin/mail/main.c,v
retrieving revision 1.6
diff -u -r1.6 main.c
--- main.c	1999/05/20 22:23:04	1.6
+++ main.c	2000/09/26 21:31:23
@@ -91,7 +91,7 @@
 	smopts = NIL;
 	subject = NOSTR;
 	replyto = NOSTR;
-	while ((i = getopt(argc, argv, "INT:b:c:dfins:u:v")) != -1) {
+	while ((i = getopt(argc, argv, "INT:b:c:dfinr:s:u:v")) != -1) {
 		switch (i) {
 		case 'T':
 			/*
@@ -122,6 +122,9 @@
 		case 'd':
 			debug++;
 			break;
+		case 'r':
+			replyto = optarg;
+			break;
 		case 's':
 			/*
 			 * Give a subject field for sending from
@@ -182,8 +185,8 @@
 			break;
 		case '?':
 			fputs("\
-Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
-            [- sendmail-options ...]\n\
+Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] [-r reply-to]\n\
+            to-addr ... [- sendmail-options ...]\n\
        mail [-iInNv] -f [name]\n\
        mail [-iInNv] [-u user]\n",
 				stderr);
Index: quit.c
===================================================================
RCS file: /usr/ncvs/src/usr.bin/mail/quit.c,v
retrieving revision 1.2
diff -u -r1.2 quit.c
--- quit.c	1998/10/10 09:58:20	1.2
+++ quit.c	2000/09/26 21:21:36
@@ -390,7 +390,7 @@
 	FILE *obuf, *ibuf, *readstat;
 	struct stat statb;
 	char tempname[30];
-	char *mktemp();
+	int mkstemp();
 
 	if (readonly)
 		return;
@@ -421,7 +421,7 @@
 	if (stat(mailname, &statb) >= 0 && statb.st_size > mailsize) {
 		strcpy(tempname, tmpdir);
 		strcat(tempname, "mboxXXXXXX");
-		mktemp(tempname);
+		mkstemp(tempname);
 		if ((obuf = Fopen(tempname, "w")) == NULL) {
 			perror(tempname);
 			relsesigs();
Index: temp.c
===================================================================
RCS file: /usr/ncvs/src/usr.bin/mail/temp.c,v
retrieving revision 1.6
diff -u -r1.6 temp.c
--- temp.c	1999/08/28 01:03:23	1.6
+++ temp.c	2000/09/26 21:23:39
@@ -77,23 +77,23 @@
 	if ((tempMail = malloc(len + sizeof("RsXXXXXX"))) == NULL)
 		panic("Out of memory");
 	strcpy(tempMail, tmpdir);
-	mktemp(strcat(tempMail, "RsXXXXXX"));
+	mkstemp(strcat(tempMail, "RsXXXXXX"));
 	if ((tempResid = malloc(len + sizeof("RqXXXXXX"))) == NULL)
 		panic("Out of memory");
 	strcpy(tempResid, tmpdir);
-	mktemp(strcat(tempResid, "RqXXXXXX"));
+	mkstemp(strcat(tempResid, "RqXXXXXX"));
 	if ((tempQuit = malloc(len + sizeof("RmXXXXXX"))) == NULL)
 		panic("Out of memory");
 	strcpy(tempQuit, tmpdir);
-	mktemp(strcat(tempQuit, "RmXXXXXX"));
+	mkstemp(strcat(tempQuit, "RmXXXXXX"));
 	if ((tempEdit = malloc(len + sizeof("ReXXXXXX"))) == NULL)
 		panic("Out of memory");
 	strcpy(tempEdit, tmpdir);
-	mktemp(strcat(tempEdit, "ReXXXXXX"));
+	mkstemp(strcat(tempEdit, "ReXXXXXX"));
 	if ((tempMesg = malloc(len + sizeof("RxXXXXXX"))) == NULL)
 		panic("Out of memory");
 	strcpy(tempMesg, tmpdir);
-	mktemp(strcat(tempMesg, "RxXXXXXX"));
+	mkstemp(strcat(tempMesg, "RxXXXXXX"));
 
 	/*
 	 * It's okay to call savestr in here because main will


>Release-Note:
>Audit-Trail:

From: Lyndon Nerenberg <lyndon@orthanc.ab.ca>
To: DougB@gorean.org
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/21570: [PATCH] Add -r option to /usr/bin/mail, quiet compiler warnings 
Date: Tue, 26 Sep 2000 16:25:25 -0600

 >>>>> "DougB" == DougB  <DougB@gorean.org> writes:
 
     DougB> 	The solaris version of the -r command actually sets
     DougB> the "From:" header, but that is very un-BSD-like. This
     DougB> seems to be an acceptable and useful alternative.
 
 Setting reply-to: instead of changing from: breaks group reply semantics.
 If you want to change from:, change from:. mail(1) already gives you a
 way to insert a reply-to: header if that's what you really need. (See
 the drums mailing list archives for months of agonizing discussion on
 this very topic.)
 
 Why is changing from: un-BSD like? The behaviour is sanctioned by RFC822, 
 and many MUAs allow it.
 
 --lyndon
 
State-Changed-From-To: open->feedback 
State-Changed-By: dougb 
State-Changed-When: Fri Oct 27 03:28:23 PDT 2000 
State-Changed-Why:  
The only response I've had so far has been mildly negative. I plan to solicit 
more commentary when I have time to revisit this. 


Responsible-Changed-From-To: freebsd-bugs->dougb 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Fri Oct 27 03:28:23 PDT 2000 
Responsible-Changed-Why:  
Take charge of my own PR 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21570 
State-Changed-From-To: feedback->closed 
State-Changed-By: dougb 
State-Changed-When: Sat Dec 30 21:20:24 UTC 2006 
State-Changed-Why:  

Close a prehistoric PR that I opened before I became a 
committer, which is no longer relevant. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21570 
>Unformatted:
