Add optional address for mailto option - enscript - GNU Enscript
 (HTM) git clone git://thinkerwim.org/enscript.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 9cccf335aafe68d04f6b4daeeb435e5188db4acb
 (DIR) parent 3638fc4643436b27b4fd034416d77651a057fc42
 (HTM) Author: Werner Fink <werner@suse.de>
       Date:   Tue, 23 Jan 2018 15:26:48 +0100
       
       Add optional address for mailto option
       
       Signed-off-by: Werner Fink <werner@suse.de>
       Signed-off-by: James Cloos <cloos@jhcloos.com>
       
       Diffstat:
         M src/main.c                          |      15 ++++++++++++---
       
       1 file changed, 12 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/src/main.c b/src/main.c
       @@ -331,6 +331,7 @@ unsigned int lines_per_page = (unsigned int) -1;
         * Send mail notification to user after print job has been completed.
         */
        int mail = 0;
       +char *mailto;
        
        /*
         * -M, --media
       @@ -850,7 +851,7 @@ static struct option long_options[] =
          {"no-page-prefeed",                no_argument,                0, 'K'},
          {"lineprinter",                no_argument,                0, 'l'},
          {"lines-per-page",                required_argument,        0, 'L'},
       -  {"mail",                        no_argument,                0, 'm'},
       +  {"mail",                        optional_argument,        0, 'm'},
          {"media",                        required_argument,        0, 'M'},
          {"copies",                        required_argument,        0, 'n'},
          {"newline",                        required_argument,        0, 'N'},
       @@ -1849,7 +1850,11 @@ open_output_file ()
              /* Format spooler options. */
              spooler_options[0] = '\0';
              if (mail)
       -        strcat (spooler_options, "-m ");
       +        {
       +          strcat (spooler_options, "-m ");
       +          strcat (spooler_options, mailto);
       +          strcat (spooler_options, " ");
       +        }
              if (no_job_header)
                {
                  strcat (spooler_options, no_job_header_switch);
       @@ -2012,7 +2017,7 @@ handle_options (int argc, char *argv[])
              int i;
        
              c = getopt_long (argc, argv,
       -                       "#:123456789a:A:b:BcC::d:D:e::E::f:F:gGhH::i:I:jJ:kKlL:mM:n:N:o:Op:P:qrRs:S:t:T:u::U:vVw:W:X:zZ",
       +                       "#:123456789a:A:b:BcC::d:D:e::E::f:F:gGhH::i:I:jJ:kKlL:m::M:n:N:o:Op:P:qrRs:S:t:T:u::U:vVw:W:X:zZ",
                               long_options, &option_index);
        
              if (c == -1)
       @@ -2213,6 +2218,10 @@ handle_options (int argc, char *argv[])
        
                case 'm':                /* send mail upon completion */
                  mail = 1;
       +          if(optarg)
       +            mailto = (optarg);
       +          else
       +            mailto = (*passwd).pw_name;
                  break;
        
                case 'M':                /* select output media */