Date: Tue, 26 Sep 2000 15:00:28 -0700 (PDT) From: DougB@gorean.org To: FreeBSD-gnats-submit@freebsd.org Subject: bin/21570: [PATCH] Add -r option to /usr/bin/mail, quiet compiler warnings Message-ID: <200009262200.PAA19004@dt051n37.san.rr.com>
next in thread | raw e-mail | index | archive | help
>Number: 21570
>Category: bin
>Synopsis: [PATCH] Add -r option to /usr/bin/mail, quiet compiler warnings
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Tue Sep 26 15:10:01 PDT 2000
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009262200.PAA19004>
