[27774] in Source-Commits

home help back first fref pref prev next nref lref last post

discuss commit: Make dsmail always retain default fields

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Tue Mar 4 13:55:25 2014

Date: Tue, 4 Mar 2014 13:55:18 -0500
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201403041855.s24ItI8j023573@drugstore.mit.edu>
To: source-commits@MIT.EDU

https://github.com/mit-athena/discuss/commit/02b2658cf4301e5b0b05599e5e47bd11bb233cc4
commit 02b2658cf4301e5b0b05599e5e47bd11bb233cc4
Author: Jonathan Reed <jdreed@mit.edu>
Date:   Tue Mar 4 13:11:36 2014 -0500

    Make dsmail always retain default fields
    
    - dsmail should retain the default fields, as disk is cheap
      (Trac: #1114)
    - Add -x option to _not_ retain default fields
    - Change the -A, -d, and -D options to not be toggles if
      specified multiple times.

 mclient/dsmail.1 |   19 ++++++++++++++++---
 mclient/dsmail.c |   15 ++++++++++-----
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/mclient/dsmail.1 b/mclient/dsmail.1
index 14f4577..7fb5881 100644
--- a/mclient/dsmail.1
+++ b/mclient/dsmail.1
@@ -47,10 +47,10 @@ unnecessary cruft.  If no options are specified, all of the mail
 headers are stripped.  By using the options detailed below, you can
 have fine control over which headers should be retained:
 .TP
-.B \-d
+.B \-x
 will cause
 .B dsmail
-to retain the ``default'' fields.  These are the to, from, cc, and
+to NOT retain the ``default'' fields.  These are the to, from, cc, and
 date fields, the Message-Id field, the MIME-related fields, and any
 other fields ending in ``-to'' (except for fields beginning with
 ``d'', such as Delivered-To) or ``-from''.
@@ -81,6 +81,19 @@ entered into the discuss meeting.  Instead, it is sent to standard
 output so that the formatting of the mail messages can be checked
 easily.   This option should only be used interactively.
 
+.SH "NOTE"
+Early versions of dsmail treated the
+.B \-A
+,
+.B \-d
+and
+.B \-D
+options as toggles.  (That is, specifying an option twice would
+essentially be a no-op.)  This was deemed to be confusing and
+this feature was removed in 2013.  You may still specify options as many
+times as you like, but they will have the same effect as if the option
+was specified once.
+
 .SH "IN-REPLY-TO"
 dsmail parses the ``In-reply-to'' field in the mail header for
 transaction numbers of the form ``[nnnn] in meeting name''.  If one is
@@ -93,4 +106,4 @@ chained to that transaction number.
 .SH "SEE ALSO"
 discuss(1), aliases(5)
 .SH BUGS
-Hopefully few.
+Probably lots.
diff --git a/mclient/dsmail.c b/mclient/dsmail.c
index 889d342..591a189 100644
--- a/mclient/dsmail.c
+++ b/mclient/dsmail.c
@@ -65,7 +65,8 @@ char *fromlist[] = {
 char *progname;
 char *save[LISTLEN],*reject[LISTLEN];
 char *usr_mtg = "";
-int dodefs, allfields, debug, have_host, subject_match=0;
+int dodefs=1;
+int allfields, debug, have_host, subject_match=0;
 char *optarg;
 int optind;
 extern tfile unix_tfile();
@@ -409,10 +410,14 @@ void PRS(argc,argv)
 	progname=argv[0];
 	sp=rp=0;
 	optind=1;		/* Initialize for getopt */
-	while ((c = getopt(argc,argv,"AZDs:da:r:h")) != EOF)
+	while ((c = getopt(argc,argv,"AZDs:dxa:r:h")) != EOF)
 		switch(c) {
 		case 'd':
-			dodefs=!dodefs;
+			/* no-op */
+			break;
+
+		case 'x':
+			dodefs=0;
 			break;
 
 		case 's':
@@ -420,11 +425,11 @@ void PRS(argc,argv)
 			break;
 
 		case 'D':
-			debug=!debug;
+			debug=1;
 			break;
 
 		case 'A':
-			allfields=!allfields;
+			allfields=1;
 			break;
 
 		case 'a':

home help back first fref pref prev next nref lref last post