On Wed, Sep 20, 2023 at 10:30:31AM +0000, Klemens Nanni wrote:
> Except for mandoc(1) and other manuals where "utf8" is a literal keyword,
> our manuals consistently use upper-case UTF-8 for what is an abbreviation,
> so this should do as wlel.
> 
> >  .It Fl n
> >  Inhibits reading
> >  .Pa /etc/mail.rc
> 
> You forgot SYNOPSIS:
>       $ man -h mail
>       mail [-dEIinv] [-b list] [-c list] [-r from-addr] [-s subject] to-addr 
> ...
>       mail [-dEIiNnv] -f [file]
>       mail [-dEIiNnv] [-u user]
> 
> Otherwise looks sane.
> 

Thank you!


Index: extern.h
===================================================================
RCS file: /cvs/src/usr.bin/mail/extern.h,v
retrieving revision 1.29
diff -u -p -r1.29 extern.h
--- extern.h    16 Sep 2018 02:38:57 -0000      1.29
+++ extern.h    20 Sep 2023 10:44:41 -0000
@@ -261,3 +261,4 @@ int  writeback(FILE *);
 extern char *__progname;
 extern char *tmpdir;
 extern const struct cmd *com; /* command we are running */
+extern char mime; /* Add MIME headers */
Index: mail.1
===================================================================
RCS file: /cvs/src/usr.bin/mail/mail.1,v
retrieving revision 1.83
diff -u -p -r1.83 mail.1
--- mail.1      31 Mar 2022 17:27:25 -0000      1.83
+++ mail.1      20 Sep 2023 10:44:41 -0000
@@ -40,7 +40,7 @@
 .Sh SYNOPSIS
 .Nm mail
 .Bk -words
-.Op Fl dEIinv
+.Op Fl dEIimnv
 .Op Fl b Ar list
 .Op Fl c Ar list
 .Op Fl r Ar from-addr
@@ -106,6 +106,8 @@ on noisy phone lines.
 .It Fl N
 Inhibits initial display of message headers
 when reading mail or editing a mail folder.
+.It Fl m
+Add MIME headers to send UTF-8 encoded messages.
 .It Fl n
 Inhibits reading
 .Pa /etc/mail.rc
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/mail/main.c,v
retrieving revision 1.35
diff -u -p -r1.35 main.c
--- main.c      26 Jan 2021 18:21:47 -0000      1.35
+++ main.c      20 Sep 2023 10:44:41 -0000
@@ -79,6 +79,8 @@ int   realscreenheight;               /* the real scree
 int    uflag;                          /* Are we in -u mode? */
 sigset_t intset;                       /* Signal set that is just SIGINT */
 
+char mime = 0;                         /* Add MIME headers */
+
 /*
  * The pointers for the string allocation routines,
  * there are NSPACE independent areas.
@@ -136,7 +138,7 @@ main(int argc, char **argv)
        smopts = NULL;
        fromaddr = NULL;
        subject = NULL;
-       while ((i = getopt(argc, argv, "EINb:c:dfinr:s:u:v")) != -1) {
+       while ((i = getopt(argc, argv, "EINb:c:dfimnr:s:u:v")) != -1) {
                switch (i) {
                case 'u':
                        /*
@@ -171,6 +173,10 @@ main(int argc, char **argv)
                         */
                        subject = optarg;
                        break;
+               case 'm':
+                       /* Add MIME headers */
+                       mime = 1;
+                       break;
                case 'f':
                        /*
                         * User is specifying file to "edit" with Mail,
@@ -337,7 +343,7 @@ __dead void
 usage(void)
 {
 
-       fprintf(stderr, "usage: %s [-dEIinv] [-b list] [-c list] "
+       fprintf(stderr, "usage: %s [-dEIimnv] [-b list] [-c list] "
            "[-r from-addr] [-s subject] to-addr ...\n", __progname);
        fprintf(stderr, "       %s [-dEIiNnv] -f [file]\n", __progname);
        fprintf(stderr, "       %s [-dEIiNnv] [-u user]\n", __progname);
Index: send.c
===================================================================
RCS file: /cvs/src/usr.bin/mail/send.c,v
retrieving revision 1.26
diff -u -p -r1.26 send.c
--- send.c      8 Mar 2023 04:43:11 -0000       1.26
+++ send.c      20 Sep 2023 10:44:41 -0000
@@ -525,6 +525,8 @@ puthead(struct header *hp, FILE *fo, int
                fmt("To:", hp->h_to, fo, w&GCOMMA), gotcha++;
        if (hp->h_subject != NULL && w & GSUBJECT)
                fprintf(fo, "Subject: %s\n", hp->h_subject), gotcha++;
+       if (mime)
+               fprintf(fo, "MIME-Version: 1.0\nContent-Type: text/plain; 
charset=utf-8\nContent-Transfer-Encoding: 8bit\n"), gotcha++;
        if (hp->h_cc != NULL && w & GCC)
                fmt("Cc:", hp->h_cc, fo, w&GCOMMA), gotcha++;
        if (hp->h_bcc != NULL && w & GBCC)


-- 
Walter

Reply via email to