home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / comm / mail / smail / src / rcs / main.c,v < prev    next >
Text File  |  1993-12-21  |  30KB  |  1,484 lines

  1. head    1.23;
  2. access;
  3. symbols
  4.     C_1:1.23;
  5. locks; strict;
  6. comment    @ * @;
  7.  
  8.  
  9. 1.23
  10. date    93.11.13.22.13.10;    author Aussem;    state Exp;
  11. branches;
  12. next    1.22;
  13.  
  14. 1.22
  15. date    93.11.13.21.17.19;    author Aussem;    state Exp;
  16. branches;
  17. next    1.21;
  18.  
  19. 1.21
  20. date    93.11.09.22.41.53;    author Aussem;    state Exp;
  21. branches;
  22. next    1.20;
  23.  
  24. 1.20
  25. date    93.11.04.22.46.25;    author Aussem;    state Exp;
  26. branches;
  27. next    1.19;
  28.  
  29. 1.19
  30. date    93.11.02.19.57.08;    author Aussem;    state Exp;
  31. branches;
  32. next    1.18;
  33.  
  34. 1.18
  35. date    93.10.31.21.41.22;    author Aussem;    state Exp;
  36. branches;
  37. next    1.17;
  38.  
  39. 1.17
  40. date    93.10.31.21.13.09;    author Aussem;    state Exp;
  41. branches;
  42. next    1.16;
  43.  
  44. 1.16
  45. date    93.10.31.17.50.59;    author Aussem;    state Exp;
  46. branches;
  47. next    1.15;
  48.  
  49. 1.15
  50. date    93.10.30.23.50.40;    author Aussem;    state Exp;
  51. branches;
  52. next    1.14;
  53.  
  54. 1.14
  55. date    93.10.30.23.49.15;    author Aussem;    state Exp;
  56. branches;
  57. next    1.13;
  58.  
  59. 1.13
  60. date    93.10.23.22.47.51;    author Aussem;    state Exp;
  61. branches;
  62. next    1.12;
  63.  
  64. 1.12
  65. date    93.10.18.20.38.27;    author Aussem;    state Exp;
  66. branches;
  67. next    1.11;
  68.  
  69. 1.11
  70. date    93.10.17.21.12.27;    author Aussem;    state Exp;
  71. branches;
  72. next    1.10;
  73.  
  74. 1.10
  75. date    93.10.17.18.42.34;    author Aussem;    state Exp;
  76. branches;
  77. next    1.9;
  78.  
  79. 1.9
  80. date    93.10.16.14.56.33;    author Aussem;    state Exp;
  81. branches;
  82. next    1.8;
  83.  
  84. 1.8
  85. date    93.10.10.19.32.34;    author Aussem;    state Exp;
  86. branches;
  87. next    1.7;
  88.  
  89. 1.7
  90. date    93.09.29.13.14.46;    author Aussem;    state Exp;
  91. branches;
  92. next    1.6;
  93.  
  94. 1.6
  95. date    93.09.18.20.23.05;    author Aussem;    state Exp;
  96. branches;
  97. next    1.5;
  98.  
  99. 1.5
  100. date    93.09.18.16.47.47;    author Aussem;    state Exp;
  101. branches;
  102. next    1.4;
  103.  
  104. 1.4
  105. date    93.09.13.22.23.09;    author Aussem;    state Exp;
  106. branches;
  107. next    1.3;
  108.  
  109. 1.3
  110. date    93.09.12.14.35.49;    author Aussem;    state Exp;
  111. branches;
  112. next    1.2;
  113.  
  114. 1.2
  115. date    93.09.10.01.54.39;    author Aussem;    state Exp;
  116. branches;
  117. next    1.1;
  118.  
  119. 1.1
  120. date    93.09.08.16.27.13;    author Aussem;    state Exp;
  121. branches;
  122. next    ;
  123.  
  124.  
  125. desc
  126. @main module of smail
  127. @
  128.  
  129.  
  130. 1.23
  131. log
  132. @VERSION integrated
  133. @
  134. text
  135. @/*
  136.  *  main.c
  137.  *
  138.  *  rmail/smail - UUCP mailer with automatic routing.
  139.  *
  140.  *  Christopher Seiwald        /+\
  141.  *  chris@@cbosgd.att.com    +\
  142.  *  January, 1985        \+/
  143.  *
  144.  * This program is free software; you can redistribute it and/or
  145.  * modify it under the terms of the GNU General Public License as
  146.  * published by the Free Software Foundation; either version 2 of
  147.  * the License, or (at your option) any later version.
  148.  *
  149.  * This program is distributed in the hope that it will be useful,
  150.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  151.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  152.  * General Public License for more details.
  153.  *
  154.  * You should have received a copy of the GNU General Public License
  155.  * along with this program; if not, write to the Free Software
  156.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  157.  *
  158.  * $Log: main.c,v $
  159.  * Revision 1.22  1993/11/13  21:17:19  Aussem
  160.  * changes getversion to get_programtype()
  161.  * take rmail name from uulib:config
  162.  *
  163.  * Revision 1.21  1993/11/09  22:41:53  Aussem
  164.  * cosmetic changes
  165.  *
  166.  * Revision 1.20  1993/11/04  22:46:25  Aussem
  167.  * smail searches now only to To:/Cc:/Bcc: without a leading space
  168.  *
  169.  * Revision 1.19  1993/11/02  19:57:08  Aussem
  170.  * atexit() insert
  171.  *
  172.  * Revision 1.18  1993/10/31  21:41:22  Aussem
  173.  * cosmetic changes
  174.  *
  175.  * Revision 1.17  1993/10/31  21:13:09  Aussem
  176.  * bigger stack size
  177.  *
  178.  * Revision 1.16  1993/10/31  17:50:59  Aussem
  179.  * cosmetic changes in help text
  180.  *
  181.  * Revision 1.15  1993/10/30  23:50:40  Aussem
  182.  * Version string corrected
  183.  *
  184.  * Revision 1.14  1993/10/30  23:49:15  Aussem
  185.  * stack size via __stacksize set to 20000 bytes
  186.  * Version string updated
  187.  *
  188.  * Revision 1.13  1993/10/23  22:47:51  Aussem
  189.  * the file for bsmtp options are taken from uulib:config
  190.  *
  191.  * Revision 1.12  1993/10/18  20:38:27  Aussem
  192.  * batch option implemtended
  193.  *
  194.  * Revision 1.11  1993/10/17  21:12:27  Aussem
  195.  * compress and freeze commands are taken from uulib:config (if present)
  196.  * smail converts the smtp mail to "normal" format and
  197.  * then deliver via rmail
  198.  *
  199.  * Revision 1.10  1993/10/17  18:42:34  Aussem
  200.  * reading a file with -f works now
  201.  * uncompressing a mail, if the programs is rfsmtp or rcsmtp works
  202.  *
  203.  * Revision 1.9  1993/10/16  14:56:33  Aussem
  204.  * -M option implemented
  205.  *
  206.  * Revision 1.8  1993/10/10  19:32:34  Aussem
  207.  * Bcc: lines are now supported
  208.  *
  209.  * Revision 1.7  1993/09/29  13:14:46  Aussem
  210.  * If smail calls smail again, it uses first the uulib:config entry for Sendmail
  211.  * and if not exists sendmail
  212.  *
  213.  * Revision 1.6  1993/09/18  20:23:05  Aussem
  214.  * the cc line can now be parsed from cmdline and from file
  215.  *
  216.  * Revision 1.5  1993/09/18  16:47:47  Aussem
  217.  * insert GNU license text in the header
  218.  *
  219.  * Revision 1.4  1993/09/13  22:23:09  Aussem
  220.  * test whether MaxRMailLen exists and set the global variable
  221.  *
  222.  * Revision 1.3  1993/09/12  14:35:49  Aussem
  223.  * SMDebug != 0 will activate verbose output
  224.  *
  225.  * Revision 1.2  1993/09/10  01:54:39  Aussem
  226.  * new support for grepping the To: line from mailbody with grep_toline()
  227.  * for new support for wCNews styled logfile cmd-line options enabled
  228.  * and rmail check (only if we are not rmail grep the To: line)
  229.  * react as rmail can be enabled via -r cmd-line option
  230.  *
  231.  * Revision 1.1  1993/09/08  16:27:13  Aussem
  232.  * Initial revision
  233.  *
  234.  *
  235.  */
  236.  
  237. static char     *rcsid="$Id: main.c,v 1.22 1993/11/13 21:17:19 Aussem Exp Aussem $";
  238.  
  239. /*
  240. **
  241. **  usage:      rmail [options] address...
  242. **        smail [options] address...
  243. */
  244.  
  245. #include    <stdio.h>
  246. #include    <stdlib.h>
  247. #include    <ctype.h>
  248. #include    "defs.h"
  249.  
  250.  
  251. #define FONT_REV        "\033[7m"        /* font reverse */
  252. #define FONT_ULIN        "\033[4m"        /* font underline */
  253. #define FONT_BOLD        "\033[1m"        /* font bold */
  254. #define FONT_NORM        "\033[0m"        /* font normal */
  255.  
  256. static const char version_string[]="$VER: SMail "SMAIL_VERSION" Amiga Version ("__DATE__","__TIME__")";
  257. const char version[]="AmigaSmail"SMAIL_VERSION;
  258.  
  259. extern char return_receipt[];
  260. extern char checkuserfile[];
  261.  
  262. /* should be large enough */
  263. long __stack=80000L;
  264.  
  265. static char ** mk_argv(char * , int * );
  266. static char ** cp_argv(char ** , char ** , int , int );
  267.  
  268.  
  269. static const char *errortext="\
  270.  usage:      rmail [options] address...\n\
  271.     smail [options] address...\n\
  272.  options:\n\
  273.     -D     batch BSMTP mails for host specified -h \n\
  274.     -d     debug - verbose and don't invoke mailers.\n\
  275.     -v        verbose - just verbose.\n\
  276.     -A        print mapped addresses.  don't invoke mailers.\n\
  277.     -B        use BSMTP (batch simple mail transport protocol) for transfer.\n\
  278.     -h hostname    set hostname\n"
  279. #ifdef MYDOM
  280. "    -H hostdomain    set hostdomain (default hostname."MYDOM")\n"
  281. #else
  282. "    -H hostdomain    set hostdomain (default hostname)\n"
  283. #endif
  284. "    -p pathfile    path database filename\n\
  285.     -o        force routing of host!address\n\
  286.     -O        reroute even explicit path!user\n\
  287.     -l        user@@domain goes to local mailer\n\
  288.     -L        all mail goes local\n\
  289.     -C        Consult the paths file for the cost of the path\n\
  290.     -r        running in rmail mode\n\
  291.     -M        don't return mails, if we can't deliver them\n\
  292.     -q number    mail queueing cost threshold\n\
  293.     -m number    limit on number of uux_noqueue jobs\n\
  294.     -u string    string of flags for uux\n\
  295.     -t address    address  to send the mail\n\
  296.     -s subject    subject of the mail\n\
  297.     -R realname    realname of the user\n\
  298.     -f address    name to substitute in From: line\n\
  299.     -c address    name to substitute in cc: line \n\
  300.     -b address    name to substitute in Bcc: line \n\
  301.     -F file        mail-file to spool\n"
  302. #ifndef SENDMAIL
  303. "    -a aliasfile    aliases filename\n"
  304. #endif
  305. "    -n namelist    list of full names for simple aliases\n";
  306.  
  307. int exitstat = 0;        /* exit status, set by resolve, deliver    */
  308.  
  309. enum edebug debug     = NO;    /* set by -d or -v option        */
  310. enum ehandle handle   = HANDLE;    /* which mail we can handle, see defs.h    */
  311. enum erouting routing = ROUTING;/* to route or not to route, see defs.h */
  312.  
  313. char passwdfile[SMLBUF]   = "getty:passwd";
  314. char logfile[SMLBUF]   = LOG;
  315. char maillogfile[SMLBUF]   = MAILLOG;
  316. char sentfile[SMLBUF]   = RECORD;
  317. char hostname[SMLBUF]   = "";    /* set by -h, defaults in defs.h     */
  318. char hostdomain[SMLBUF] = "";    /* set by -H, defaults in defs.h     */
  319. char hostuucp[SMLBUF] = "";    /* built with hostname+".UUCP"         */
  320. int  cc_index    = -1;        /* index starting Cc: in the to-arguments vector */
  321. int  bcc_index    = -1;       /* index starting Bcc: in the to-arguments vector */
  322. char *subject    = NULL;       /* subject of the mail         */
  323. char *realname   = NULL;      /* realname of the user    */
  324. char *pathfile   = PATHS;       /* or set by -p             */
  325. char *uuxargs    = NULL;        /* or set by -u                */
  326. int  maxrmaillen = 0;         /* maximal rmail length */
  327. char smailname[SMLBUF] = "sendmail"; /* name of smail */
  328. char rmailname[SMLBUF] = "rmail"; /* name of rmail */
  329. char bsmtp_sites[SMLBUF]="uulib:mail/bsmtp_sites";
  330.  
  331. char *aliasfile =
  332. #ifdef ALIAS
  333.         ALIAS;        /* or set by -a                */
  334. #else
  335.         NULL;
  336. #endif
  337.  
  338. char *fnlist    =
  339. #ifdef FULLNAME
  340.         FULLNAME;    /* or set by -n                */
  341. #else
  342.         NULL;
  343. #endif
  344.  
  345. int  queuecost  = QUEUECOST;    /* or set by -q    */
  346. char *from_addr = NULL;        /* or set by -F        */
  347. int  maxnoqueue = MAXNOQUEUE;    /* or set by -m    */
  348. int  receipt = 1;
  349. int  returnmail  = 1; /* or set by -M                */
  350. int  getcost    =
  351. #ifdef GETCOST
  352.         1;    /* get cost of path even if not routing */
  353. #else
  354.         0;
  355. #endif
  356.  
  357. char *spoolfile = NULL;        /* name of the file containing letter   */
  358. FILE *spoolfp;            /* file pointer to spoolfile        */
  359. int  spoolmaster = 0;        /* indicates 'control' of spoolfile     */
  360.  
  361. void spool();
  362.  
  363. int asrmail;            /* invoked as rmail (CMK) */
  364. int bsmtp=0;         /* do BSMTP */
  365. int checkuser=0;     /* check whether a user is allowed to mail via UUCP */
  366. FILE *mystdin=stdin;
  367.  
  368. /*
  369. **
  370. **  rmail/smail: mail stdin letter to argv addresses.
  371. **
  372. **  After processing command line options and finding our host and domain
  373. **  names, we map addresses into <host,user,form,cost> sets.  Then we deliver.
  374. **
  375. */
  376. main(argc, argv)
  377. int argc;
  378. char *argv[];
  379. {
  380.     char *hostv[MAXARGS];        /* UUCP neighbor         */
  381.     char *userv[MAXARGS];        /* address given to host     */
  382.     int  costv[MAXARGS];           /* cost of resolved route    */
  383.     enum eform formv[MAXARGS];    /* invalid, local, or uucp     */
  384.     char cc[SMLBUF] = "";      /* cc-line from the command line */
  385.     char bcc[SMLBUF] = "";      /* bcc-line from the command line */
  386.     char *p;
  387.     int c;
  388.     int  printaddr  = 0;        /* or set by -A            */
  389.     int nargc;
  390.     char **nargv, **alias();
  391.    char *get_config(char *,short);
  392.    char to[BIGBUF]="";
  393.     char **to_argv=NULL,**cc_argv=NULL,**bcc_argv=NULL;
  394.     int to_argc=0;
  395.    int deliver_batch=0;
  396.    char compress[SMLBUF]="compress";
  397.    char rsmtp_cmd[SMLBUF]="rcsmtp";
  398.  
  399.     char *optstr = "BCDdvArMoOlLH:h:c:b:p:u:q:a:n:m:F:f:s:t:R:";
  400.     extern char *optarg;
  401.     extern int optind;
  402.     extern char prgtype_string[];
  403.    extern void kill_external(void);
  404.  
  405.    /* install atexit() fkt */
  406.    atexit(kill_external);
  407.  
  408.    /* get the program type */
  409.    set_programtype();
  410.  
  411. /*
  412. ** See whether we are started with -raw options
  413. */
  414. for(c=1;c<argc;c++)
  415.     if(strcmp(argv[c],"-raw")==0)
  416.         {
  417.         argv[c][0]='-';
  418.         argv[c][1]='v';
  419.         argv[c][2]='\0';
  420.       printf("%s: WARNING ! you call smail with the unsupported and ignored -raw option\n",argv[0]);
  421.         }
  422.  
  423. /*
  424. **  see if we aren't invoked as rmail
  425. */
  426.     if(stricmp(argv[0],rmailname)!=0 ) {
  427.         handle = ALL;
  428.         asrmail = 0;        /* CMK */
  429.     } else
  430.         asrmail = 1;
  431.  
  432.     if(stricmp(argv[0],"rsmtp")==0 )
  433.       {
  434.         asrmail = 1;
  435.         bsmtp=1;
  436.         }
  437.     if(stricmp(argv[0],"rfsmtp")==0 )
  438.       {
  439.         asrmail = 1;
  440.         bsmtp=1;
  441.         }
  442.     if(stricmp(argv[0],"rcsmtp")==0 )
  443.       {
  444.         asrmail = 1;
  445.         bsmtp=1;
  446.         }
  447.  
  448. /*
  449. **  Process command and config line arguments
  450. */
  451.    p=get_config("SMBsmtpSites",2);
  452.    if(p)
  453.       strcpy(bsmtp_sites,p);
  454.    p=get_config("SMBsmtpCmd",2);
  455.    if(p)
  456.       strcpy(rsmtp_cmd,p);
  457.    p=get_config("SMCompress",2);
  458.    if(p)
  459.       strcpy(compress,p);
  460.    if(get_config("SMDebug",1))
  461.        debug=VERBOSE;
  462.    p=get_config("MaxRMailLen",2);
  463.    if(p)
  464.        maxrmaillen=atoi(p);
  465.    p=get_config("SMRerouting",2);
  466.    if(p)
  467.        switch(atoi(p))
  468.        {
  469.        default:
  470.        case 0:routing=REROUTE;        /* route C, B, or A (whichever works); set by -R */
  471.                break;
  472.        case 1:routing=ALWAYS;        /* route A always; set by -r */
  473.                break;
  474.        case 2:routing=JUSTDOMAIN;    /* route A if A is a domain */
  475.                break;
  476.        }
  477.    p=get_config("SMHandle",2);
  478.    if(p)
  479.        switch(atoi(p))
  480.        {
  481.        default:
  482.        case 0:handle=ALL;
  483.                break;
  484.        case 1:handle=JUSTUUCP;
  485.                break;
  486.        case 2:handle=NONE;
  487.                break;
  488.        }
  489.    if(get_config("SMGetcost",0))
  490.        getcost=1;
  491.    else
  492.        getcost=0;
  493.    if(get_config("SMReceipt",0))
  494.        receipt=1;
  495.    else
  496.        receipt=0;
  497.    if(get_config("SMCheckuser",0))
  498.        checkuser=1;
  499.    p=get_config("SMCheckfile",2);
  500.    if(p)
  501.       strcpy(checkuserfile,p);
  502.    p=get_config("SMLogfile",2);
  503.    if(p)
  504.       strcpy(logfile,p);
  505.    p=get_config("SMMaillogfile",2);
  506.    if(p)
  507.       strcpy(maillogfile,p);
  508.    p=get_config("SMPasswd",2);
  509.    if(p)
  510.       strcpy(passwdfile,p);
  511.    p=get_config("SMSentlog",2);
  512.    if(p)
  513.       strcpy(sentfile,p);
  514.    p=get_config("SMFullname",2);
  515.    if(p)
  516.       fnlist=strdup(p);
  517.    p=get_config("SMPath",2);
  518.    if(p)
  519.       pathfile=strdup(p);
  520.    p=get_config("SMAlias",2);
  521.    if(p)
  522.       aliasfile=strdup(p);
  523.    p=get_config("Sendmail",2);
  524.    if(p)
  525.       strcpy(smailname,p);
  526.    p=get_config("Rmail",2);
  527.    if(p)
  528.       strcpy(rmailname,p);
  529.  
  530.     while ((c = getopt(argc, argv, optstr)) != EOF) {
  531.         switch ( c ) {
  532.         case 'B': bsmtp      = 1;         break;
  533.         case 'D': deliver_batch = 1;         break;
  534.         case 'd': debug      = YES;         break;
  535.         case 'v': debug      = VERBOSE;     break;
  536.         case 'A': printaddr  = 1;         break;
  537.         case 'f': from_addr  = optarg;        break;
  538.         case 'o': routing    = ALWAYS;        break;
  539.         case 'O': routing    = REROUTE;        break;
  540.         case 'l': handle     = JUSTUUCP;    break;
  541.         case 'L': handle     = NONE;        break;
  542.         case 'r': asrmail    = 1;        break;
  543.         case 'M': returnmail = 0;        break;
  544.         case 'F': spoolfile  = optarg;        break;
  545.         case 'p': pathfile   = optarg;         break;
  546.         case 'u': uuxargs    = optarg;         break;
  547.         case 'a': aliasfile  = optarg;         break;
  548.         case 'n': fnlist     = optarg;         break;
  549.         case 's': subject    = optarg;        break;
  550.         case 't': strcat(to,optarg);strcat(to," ");break;
  551.         case 'c': strcat(cc,optarg);strcat(cc," ");break;
  552.         case 'b': strcat(bcc,optarg);strcat(bcc," ");break;
  553.         case 'R': realname   = optarg;        break;
  554.         case 'H': (void) strcpy(hostdomain, optarg);    break;
  555.         case 'h': (void) strcpy(hostname, optarg);     break;
  556.         case 'm': if(isdigit(*optarg)) {
  557.                   maxnoqueue = atoi(optarg);
  558.               }
  559.               break;
  560.         case 'C': getcost     = 1;        break;
  561.         case 'q': if(isdigit(*optarg)) {
  562.                   queuecost = atoi(optarg);
  563.               }
  564.               break;
  565.         }
  566.     }
  567.  
  568.   if(asrmail && bsmtp)
  569.       {
  570.    FILE *fp;
  571.    char *cmd;
  572.  
  573.    if(spoolfile)
  574.    {
  575.           switch(tolower(argv[0][1]))
  576.           {
  577.           case 'c':
  578.        cmd=get_config("Compress",2);
  579.        if(cmd)
  580.             uncompress_file(spoolfile , cmd);
  581.       else
  582.             uncompress_file(spoolfile , "compress");
  583.         break;
  584.           case 'f':
  585.        cmd=get_config("Freeze",2);
  586.        if(cmd)
  587.             uncompress_file(spoolfile , cmd);
  588.       else
  589.             uncompress_file(spoolfile , "freeze");
  590.         break;
  591.       }
  592.    fp=fopen(spoolfile,"r");
  593.    convert_smtp(fp);
  594.     }
  595.  
  596.    if(stdin)
  597.    {
  598.           switch(tolower(argv[0][1]))
  599.           {
  600.           case 'c':
  601.        cmd=get_config("Compress",2);
  602.        if(cmd)
  603.             mystdin=uncompress_stream(stdin , cmd);
  604.         else
  605.             mystdin=uncompress_stream(stdin , "compress");
  606.             break;
  607.           case 'f':
  608.        cmd=get_config("Freeze",2);
  609.        if(cmd)
  610.             mystdin=uncompress_stream(stdin , cmd);
  611.       else
  612.             mystdin=uncompress_stream(stdin , "freeze");
  613.         break;
  614.       }
  615.    convert_smtp(mystdin);
  616.    }
  617.   if(mystdin==NULL)
  618.       {
  619.       printf("%s: failed to uncompress stdin in BSMTP mode\n",argv[0]);
  620.       exit(10);
  621.       }
  622.   exit(0);
  623.   }
  624.  
  625.   if(deliver_batch)
  626.   {
  627.   char batchname[SMLBUF]=UUBATCH;
  628.   char tmpname[SMLBUF]="T:";
  629.   char cmd[SMLBUF];
  630.   int rc;
  631.  
  632.   strcat(batchname,hostname);
  633.   strcat(tmpname,hostname);
  634.   rc=access(batchname,R_OK);
  635.   if(rc!=0)
  636.       {
  637.    ADVISE("%s: no batch-file for %s ('%s')\n",argv[0],hostname,batchname);
  638.    exit(5);
  639.    }
  640.   sprintf(cmd,"%s <%s >%s",compress,batchname,tmpname);
  641.   ADVISE("compressing: '%s'\n",cmd);
  642.   rc=system(cmd);
  643.   if(rc)
  644.       {
  645.    printf("%s: unable to compress batch-file %s ('%s')\n",argv[0],batchname,cmd);
  646.    exit(10);
  647.    }
  648.  
  649.   sprintf(cmd,"%s %s \"%s!%s\"",UUX,tmpname,hostname,rsmtp_cmd);
  650.   ADVISE("delivering: '%s'\n",cmd);
  651.   rc=system(cmd);
  652.   if(rc)
  653.       {
  654.    printf("%s: unable to deliver batch-file %s ('%s')\n",argv[0],batchname,cmd);
  655.    exit(10);
  656.    }
  657.  
  658.   remove(tmpname);
  659.   remove(batchname);
  660.   exit(0);
  661.   }
  662.  
  663.   /* only search To: lines, if we are not in
  664.      rmail mode and spoolfile!=NULL */
  665.   if(spoolfile && !asrmail)
  666.     {
  667.     char *ptr;
  668.     FILE *fp=fopen(spoolfile,"r");
  669.  
  670.    if(fp)
  671.        {
  672.         ptr=grep_toline(fp,"To:");
  673.        if(ptr)
  674.            strcat(to,ptr);
  675.         ptr=grep_toline(fp,"Cc:");
  676.        if(ptr)
  677.            strcat(cc,ptr);
  678.         ptr=grep_toline(fp,"Bcc:");
  679.        if(ptr)
  680.            strcat(bcc,ptr);
  681.        fclose(fp);
  682.        }
  683.     }
  684.  
  685.  
  686.   /* only search To: lines, if we are not in
  687.      rmail mode and mystdin!=NULL */
  688.   if(mystdin && !asrmail)
  689.     {
  690.     char *ptr;
  691.  
  692.     ptr=grep_toline(mystdin,"To:");
  693.    if(ptr)
  694.        strcat(to,ptr);
  695.     ptr=grep_toline(mystdin,"Cc:");
  696.    if(ptr)
  697.        strcat(cc,ptr);
  698.     ptr=grep_toline(mystdin,"Bcc:");
  699.    if(ptr)
  700.        strcat(bcc,ptr);
  701.     }
  702.  
  703.     if ( argc <= optind && to[0]=='\0') {
  704.             error( EX_USAGE, "No receiver found\n%s",errortext);
  705.     }
  706.  
  707.   /* Print some configs informations */
  708.   if(debug==VERBOSE || debug==YES)
  709.    {
  710.    char *text[2];
  711.    int i;
  712.  
  713.     printf(FONT_BOLD FONT_REV"SMail"FONT_NORM" (%s) © by Ralph-Thomas Außem (aussem@@mavhh.hanse.de)\nbased on Unix smail V2.5 by Christopher Seiwald\ncompiled with SAS/C Version 6.3 on "__DATE__"\n\
  714. "FONT_ULIN"Files:\n"FONT_NORM"\
  715. Passwd-file    : %s\n\
  716. Paths-file     : %s\n\
  717. Log-file       : %s\n\
  718. Sent-log       : %s\n\
  719. Alias-file     : %s\n\
  720. Fullname-file  : %s\n",
  721. prgtype_string,
  722. passwdfile,pathfile,logfile,sentfile,aliasfile,fnlist);
  723.  
  724. switch(routing)
  725. {
  726. case ALWAYS: text[0]="Always";
  727. break;
  728. case REROUTE: text[0]="Reroute";
  729. break;
  730. case JUSTDOMAIN: text[0]="Just Domain";
  731. break;
  732. }
  733.  
  734. switch(handle)
  735. {
  736. case ALL: text[1]="All";
  737. break;
  738. case JUSTUUCP: text[1]="Just UUCP";
  739. break;
  740. case NONE: text[1]="None";
  741. break;
  742. }
  743.  
  744. printf(FONT_ULIN"Options:\n"FONT_NORM"\
  745. BSMTP          : %s\n\
  746. RMail mode     : %s\n\
  747. Rerouting      : %s\n\
  748. Handle         : %s\n\
  749. Getcost        : %s\n",
  750. bsmtp?"Yes":"No",
  751. asrmail?"Yes":"No",
  752. text[0],text[1],((getcost==1)?"Yes":"No"));
  753.  
  754. printf("To             : ");
  755. for(i=optind;i<argc;i++)printf("%s ",argv[i]);
  756. if(to[0]!='\0')
  757.     printf(" '%s'",to);
  758. printf("\n");
  759.  
  760. if(cc[0]!='\0')
  761.     printf("Cc             : '%s'\n",cc);
  762.  
  763. if(bcc[0]!='\0')
  764.     printf("Bcc            : '%s'\n",bcc);
  765.     }
  766.  
  767. /*
  768. **  Add the -t, -c addresses and To: lines to argv[]
  769. */
  770. if(to[0]!='\0')
  771.     {
  772.    to_argv=mk_argv(to,&to_argc);
  773.     }
  774.  
  775. if(cc[0]!='\0')
  776.     {
  777.    cc_argv=mk_argv(cc,&cc_index);
  778.    }
  779.  
  780. if(bcc[0]!='\0')
  781.     {
  782.    bcc_argv=mk_argv(bcc,&bcc_index);
  783.    }
  784.  
  785. if(to_argv)
  786.        {
  787.       argv=cp_argv(argv,to_argv,argc,to_argc);
  788.       argc+=to_argc;
  789.        }
  790.  
  791. if(cc_argv)
  792.        {
  793.       argv=cp_argv(argv,cc_argv,argc,cc_index);
  794.       argc+=cc_index;
  795.       /* to lousy to create a new variable to store the contents of argc */
  796.       cc_index=argc-cc_index-optind;
  797.        }
  798.  
  799. if(bcc_argv)
  800.        {
  801.       argv=cp_argv(argv,bcc_argv,argc,bcc_index);
  802.       argc+=bcc_index;
  803.       /* to lousy to create a new variable to store the contents of argc */
  804.       bcc_index=argc-bcc_index-optind;
  805.        }
  806.  
  807. /*
  808. **  Get our default hostname and hostdomain.
  809. */
  810.     getmynames();
  811.  
  812. /*
  813. **  Spool the letter in a temporary file.
  814. */
  815.     nargc = argc - optind;
  816.     if(printaddr == 0) {
  817.         spool(nargc, &argv[optind]);
  818.     }
  819.  
  820. /*
  821. ** Do aliasing and fullname resolution
  822. */
  823.     nargv = alias(&nargc, &argv[optind]);
  824.  
  825. /*
  826. **  Map argv addresses to <host, user, form, cost>.
  827. */
  828.     map(nargc, nargv, hostv, userv, formv, costv);
  829. /*
  830. **  If all we want it mapped addresses, print them and exit.
  831. */
  832.     if(printaddr) {
  833.         int i;
  834.         char abuf[SMLBUF];
  835.         for(i=nargc-1; i >= 0; i--) {
  836.             if(formv[i] == ERROR) {
  837.                 (void) strcpy(abuf, nargv[i]);
  838.             } else {
  839.                 build(hostv[i], userv[i], formv[i], abuf);
  840.             }
  841.             (void) fputs(abuf, stdout);
  842.             if(i != 0) (void) putchar(' ');
  843.         }
  844.         (void) putchar('\n');
  845.         exit(0);
  846.     }
  847. /*
  848. **  Deliver.
  849. */
  850.   if((debug==VERBOSE || debug==YES) && return_receipt[0]!='\0')
  851.       {
  852.    printf("Recepient-Return-To: %s\n",return_receipt);
  853.    }
  854.  
  855.     deliver(nargc, hostv, userv, formv, costv);
  856. /*
  857. **  Exitstat was set if any resolve or deliver failed, otherwise 0.
  858. */
  859.     return( exitstat );
  860. }
  861.  
  862. /*
  863. **
  864. **  Generate an argv from an blank seperated line
  865. **
  866. **
  867. */
  868. static char **mk_argv(char *line,int *argc)
  869. {
  870. register int j;
  871. int count;
  872. char *start,
  873.      *end,**argv;
  874.  
  875. *argc = 0;
  876. if(!line)return(NULL);
  877.  
  878. for(start=line;*start==' ';start++);
  879. if(*start=='\0')return(NULL);
  880.  
  881. for(count=1;;)
  882.     {
  883.    end=strchr(start,' ');
  884.    if(!end)break;
  885.    /* skip blankes */
  886.    for(end++;*end==' ';end++);
  887.     if(*end=='\0')break;
  888.    start=end;
  889.    count++;
  890.    }
  891.  
  892. argv=(char **)malloc(count*sizeof(char *));
  893. if(!argv)return(NULL);
  894.  
  895. for(start=line,j=0;j<count;j++)
  896.     {
  897.    end=strchr(start,' ');
  898.    if(end)
  899.           *end='\0';
  900.    argv[j]=strdup(start);
  901.    if(!end)break;
  902.    /* skip blankes */
  903.    for(end++;*end==' ';end++);
  904.     if(*end=='\0')break;
  905.    start=end;
  906.    }
  907. *argc=j+1;
  908. return(argv);
  909. }
  910.  
  911. /*
  912. **
  913. ** concat two argvs
  914. **
  915. */
  916. static char **cp_argv(char **argv1,char **argv2,int argc1,int argc2)
  917. {
  918. register int i;
  919. int sum=argc1+argc2;
  920. char **argv;
  921.  
  922. argv=(char **)malloc(sum*sizeof(char *));
  923. for(i=0;i<argc1;i++)
  924.     {
  925.     argv[i]=strdup(argv1[i]);
  926.     }
  927. for(i=0;i<argc2;i++)
  928.     {
  929.     argv[i+argc1]=strdup(argv2[i]);
  930.     free(argv2[i]);
  931.     }
  932. return(argv);
  933. }
  934.  
  935. @
  936.  
  937.  
  938. 1.22
  939. log
  940. @changes getversion to get_programtype()
  941. take rmail name from uulib:config
  942. @
  943. text
  944. @d25 4
  945. d103 1
  946. a103 3
  947. static char     *rcsid="$Id: main.c,v 1.21 1993/11/09 22:41:53 Aussem Exp Aussem $";
  948.  
  949. static const char *version="$VER: SMail V1.0 Amiga Version ("__DATE__","__TIME__")";
  950. d116 1
  951. d121 3
  952. @
  953.  
  954.  
  955. 1.21
  956. log
  957. @cosmetic changes
  958. @
  959. text
  960. @d25 3
  961. d99 1
  962. a99 1
  963. static char     *rcsid="$Id: main.c,v 1.20 1993/11/04 22:46:25 Aussem Exp Aussem $";
  964. d188 1
  965. d262 1
  966. d265 1
  967. d268 3
  968. d286 1
  969. a286 1
  970.     if(stricmp(argv[0],"rmail")!=0 ) {
  971. a319 4
  972.    p=get_config("Sendmail",2);
  973.    if(p)
  974.       strcpy(smailname,p);
  975.  
  976. d383 6
  977. d581 1
  978. a581 1
  979. getversion(),
  980. @
  981.  
  982.  
  983. 1.20
  984. log
  985. @smail searches now only to To:/Cc:/Bcc: without a leading space
  986. @
  987. text
  988. @d25 3
  989. d96 1
  990. a96 1
  991. static char     *rcsid="$Id: main.c,v 1.19 1993/11/02 19:57:08 Aussem Exp Aussem $";
  992. d117 1
  993. d146 1
  994. a146 1
  995.     -C        all mail goes local\n\
  996. d221 1
  997. d352 5
  998. d562 1
  999. a562 1
  1000.     printf(FONT_BOLD FONT_REV"SMail"FONT_NORM" © by Ralph-Thomas Außem (aussem@@mavhh.hanse.de)\nbased on Unix smail V2.5 by Christopher Seiwald\ncompiled with SAS/C Version 6.3 on "__DATE__"\n\
  1001. d570 1
  1002. d594 2
  1003. d598 4
  1004. a601 1
  1005. Getcost        : %s\n",text[0],text[1],((getcost==1)?"Yes":"No"));
  1006. @
  1007.  
  1008.  
  1009. 1.19
  1010. log
  1011. @atexit() insert
  1012. @
  1013. text
  1014. @d25 3
  1015. d93 1
  1016. a93 1
  1017. static char     *rcsid="$Id: main.c,v 1.18 1993/10/31 21:41:22 Aussem Exp Aussem $";
  1018. d511 1
  1019. a511 1
  1020.         ptr=grep_toline(fp,"To: ");
  1021. d514 1
  1022. a514 1
  1023.         ptr=grep_toline(fp,"Cc: ");
  1024. d517 1
  1025. a517 1
  1026.         ptr=grep_toline(fp,"Bcc: ");
  1027. d531 1
  1028. a531 1
  1029.     ptr=grep_toline(mystdin,"To: ");
  1030. d534 1
  1031. a534 1
  1032.     ptr=grep_toline(mystdin,"Cc: ");
  1033. d537 1
  1034. a537 1
  1035.     ptr=grep_toline(mystdin,"Bcc: ");
  1036. @
  1037.  
  1038.  
  1039. 1.18
  1040. log
  1041. @cosmetic changes
  1042. @
  1043. text
  1044. @d25 3
  1045. d90 1
  1046. a90 1
  1047. static char     *rcsid="$Id: main.c,v 1.17 1993/10/31 21:13:09 Aussem Exp Aussem $";
  1048. d250 3
  1049. @
  1050.  
  1051.  
  1052. 1.17
  1053. log
  1054. @bigger stack size
  1055. @
  1056. text
  1057. @d25 3
  1058. d87 1
  1059. a87 1
  1060. static char     *rcsid="$Id: main.c,v 1.16 1993/10/31 17:50:59 Aussem Exp Aussem $";
  1061. d102 5
  1062. d543 8
  1063. a550 2
  1064.     printf("smail based on smail V2.5 by Christopher Seiwald\nAmiga Port by Ralph-Thomas Außem (aussem@@mavhh.hanse.de)\ncompiled with SAS/C 6.3 on "__DATE__"\n\
  1065. Passwd-file    : %s\t\tPaths-file    : %s\nLog-file    : %s\tSent-log    : %s\nAlias-file    : %s\t\tFullname-file    : %s\n",
  1066. d573 4
  1067. a576 2
  1068. printf("Rerouting    : %s\tHandle    : %s\tGetcost        : %s\n",text[0],text[1],
  1069.                     ((getcost==1)?"Yes":"No"));
  1070. d578 1
  1071. a578 1
  1072. printf("To: ");
  1073. d585 1
  1074. a585 1
  1075.     printf("Cc: '%s'\n",cc);
  1076. d588 1
  1077. a588 1
  1078.     printf("Bcc: '%s'\n",bcc);
  1079. @
  1080.  
  1081.  
  1082. 1.16
  1083. log
  1084. @cosmetic changes in help text
  1085. @
  1086. text
  1087. @d25 3
  1088. d84 1
  1089. a84 1
  1090. static char     *rcsid="$Id: main.c,v 1.15 1993/10/30 23:50:40 Aussem Exp Aussem $";
  1091. d102 1
  1092. a102 1
  1093. long __stack=30000L;
  1094. d565 1
  1095. a565 1
  1096.     printf(" %s",to);
  1097. d569 1
  1098. a569 1
  1099.     printf("Cc: %s\n",cc);
  1100. d572 1
  1101. a572 1
  1102.     printf("Bcc: %s\n",bcc);
  1103. @
  1104.  
  1105.  
  1106. 1.15
  1107. log
  1108. @Version string corrected
  1109. @
  1110. text
  1111. @d25 3
  1112. d81 1
  1113. a81 1
  1114. static char     *rcsid="$Id: main.c,v 1.14 1993/10/30 23:49:15 Aussem Exp Aussem $";
  1115. d126 2
  1116. a127 2
  1117.     -r    running in rmail mode\n\
  1118.     -M     don't return mails, if we can't deliver them\n\
  1119. @
  1120.  
  1121.  
  1122. 1.14
  1123. log
  1124. @stack size via __stacksize set to 20000 bytes
  1125. Version string updated
  1126. @
  1127. text
  1128. @d25 4
  1129. d78 1
  1130. a78 1
  1131. static char     *rcsid="$Id: main.c,v 1.13 1993/10/23 22:47:51 Aussem Exp Aussem $";
  1132. d80 1
  1133. a80 1
  1134. static const char *version="$VER: SMail V1.0 Amiga Version ("__DATE__,__TIME__")";
  1135. @
  1136.  
  1137.  
  1138. 1.13
  1139. log
  1140. @the file for bsmtp options are taken from uulib:config
  1141. @
  1142. text
  1143. @d25 3
  1144. d74 1
  1145. a74 1
  1146. static char     *rcsid="$Id: main.c,v 1.12 1993/10/18 20:38:27 Aussem Exp Aussem $";
  1147. d76 1
  1148. a76 1
  1149. static const char *version="$VER: SMail V2.5 Amiga Version compiled on "__DATE__;
  1150. d90 3
  1151. @
  1152.  
  1153.  
  1154. 1.12
  1155. log
  1156. @batch option implemtended
  1157. @
  1158. text
  1159. @d25 3
  1160. d71 1
  1161. a71 1
  1162. static char     *rcsid="$Id: main.c,v 1.11 1993/10/17 21:12:27 Aussem Exp Aussem $";
  1163. d151 1
  1164. d217 2
  1165. d225 12
  1166. d264 9
  1167. d446 1
  1168. a446 1
  1169.   sprintf(cmd,"%s <%s >%s","compress",batchname,tmpname);
  1170. d455 1
  1171. a455 1
  1172.   sprintf(cmd,"%s %s \"%s!%s\"",UUX,tmpname,hostname,"rcsmtp");
  1173. d519 1
  1174. a519 1
  1175.     printf("smail V2.5 Originaly by Christopher Seiwald\nAmiga Port by Ralph-Thomas Außem (aussem@@mavhh.hanse.de)\ncompiled with SAS/C 6.3 on "__DATE__"\n\
  1176. @
  1177.  
  1178.  
  1179. 1.11
  1180. log
  1181. @compress and freeze commands are taken from uulib:config (if present)
  1182. smail converts the smtp mail to "normal" format and
  1183. then deliver via rmail
  1184. @
  1185. text
  1186. @d25 5
  1187. d68 1
  1188. a68 1
  1189. static char     *rcsid="$Id: main.c,v 1.10 1993/10/17 18:42:34 Aussem Exp Aussem $";
  1190. d93 2
  1191. a94 1
  1192.     -d         debug - verbose and don't invoke mailers.\n\
  1193. d212 1
  1194. d214 1
  1195. a214 1
  1196.     char *optstr = "BCdvArMoOlLH:h:c:b:p:u:q:a:n:m:F:f:s:t:R:";
  1197. d312 1
  1198. d404 37
  1199. @
  1200.  
  1201.  
  1202. 1.10
  1203. log
  1204. @reading a file with -f works now
  1205. uncompressing a mail, if the programs is rfsmtp or rcsmtp works
  1206. @
  1207. text
  1208. @d25 4
  1209. d63 1
  1210. a63 1
  1211. static char     *rcsid="$Id: main.c,v 1.9 1993/10/16 14:56:33 Aussem Exp Aussem $";
  1212. d341 3
  1213. d349 4
  1214. d354 1
  1215. a354 1
  1216.             break;
  1217. d356 4
  1218. d361 1
  1219. a361 1
  1220.             break;
  1221. d363 2
  1222. d366 1
  1223. d372 4
  1224. d379 4
  1225. d384 1
  1226. a384 1
  1227.             break;
  1228. d386 1
  1229. d390 1
  1230. a390 1
  1231.       printf("%s: failed to uncompress stdin in bsmtp mode\n",argv[0]);
  1232. d393 1
  1233. @
  1234.  
  1235.  
  1236. 1.9
  1237. log
  1238. @-M option implemented
  1239. @
  1240. text
  1241. @d25 3
  1242. d59 1
  1243. a59 1
  1244. static char     *rcsid="$Id: main.c,v 1.8 1993/10/10 19:32:34 Aussem Exp Aussem $";
  1245. d87 1
  1246. d172 2
  1247. d203 1
  1248. a203 1
  1249.     char *optstr = "CdvArMoOlLH:h:c:b:p:u:q:a:n:m:F:f:s:t:R:";
  1250. d210 1
  1251. a210 2
  1252.     p=argv[0];
  1253.     if(*p != 'r' ) {
  1254. d216 16
  1255. d300 1
  1256. d335 34
  1257. d370 2
  1258. a371 2
  1259.      rmail mode and fnlist!=NULL */
  1260.   if(fnlist && !asrmail)
  1261. d374 1
  1262. a374 1
  1263.     FILE *fp=fopen(fnlist,"r");
  1264. d393 2
  1265. a394 2
  1266.      rmail mode and stdin!=NULL */
  1267.   if(stdin && !asrmail)
  1268. d398 1
  1269. a398 1
  1270.     ptr=grep_toline(stdin,"To: ");
  1271. d401 1
  1272. a401 1
  1273.     ptr=grep_toline(stdin,"Cc: ");
  1274. d404 1
  1275. a404 1
  1276.     ptr=grep_toline(stdin,"Bcc: ");
  1277. @
  1278.  
  1279.  
  1280. 1.8
  1281. log
  1282. @Bcc: lines are now supported
  1283. @
  1284. text
  1285. @d25 3
  1286. d56 1
  1287. a56 1
  1288. static char     *rcsid="$Id: main.c,v 1.7 1993/09/29 13:14:46 Aussem Exp Aussem $";
  1289. d97 1
  1290. d149 3
  1291. a151 3
  1292. int  queuecost  = QUEUECOST;    /* or set by -q                */
  1293. char *from_addr = NULL;        /* or set by -F                */
  1294. int  maxnoqueue = MAXNOQUEUE;    /* or set by -m                         */
  1295. d153 1
  1296. d197 1
  1297. a197 1
  1298.     char *optstr = "CdvAroOlLH:h:c:b:p:u:q:a:n:m:F:f:s:t:R:";
  1299. d288 1
  1300. @
  1301.  
  1302.  
  1303. 1.7
  1304. log
  1305. @If smail calls smail again, it uses first the uulib:config entry for Sendmail
  1306. and if not exists sendmail
  1307. @
  1308. text
  1309. @d25 4
  1310. d53 1
  1311. a53 1
  1312. static char     *rcsid="$Id: main.c,v 1.6 1993/09/18 20:23:05 Aussem Exp Aussem $";
  1313. d102 1
  1314. d122 4
  1315. a125 3
  1316. int  cc_index    = -1;         /* index starting cc: in the to-arguments */
  1317. char *subject    = NULL;          /* subject of the mail         */
  1318. char *realname   = NULL;       /* realname of the user    */
  1319. d127 1
  1320. a127 1
  1321. char *uuxargs    = NULL;           /* or set by -u                */
  1322. d181 1
  1323. d189 1
  1324. a189 1
  1325.     char **to_argv=NULL,**cc_argv=NULL;
  1326. d192 1
  1327. a192 1
  1328.     char *optstr = "CdvAroOlLH:h:c:p:u:q:a:n:m:F:f:s:t:R:";
  1329. d291 1
  1330. d322 3
  1331. d342 3
  1332. d392 3
  1333. d410 5
  1334. d427 8
  1335. @
  1336.  
  1337.  
  1338. 1.6
  1339. log
  1340. @the cc line can now be parsed from cmdline and from file
  1341. @
  1342. text
  1343. @d25 3
  1344. d49 1
  1345. a49 1
  1346. static char     *rcsid="$Id: main.c,v 1.5 1993/09/18 16:47:47 Aussem Exp Aussem $";
  1347. d123 1
  1348. d200 1
  1349. a200 1
  1350. **  Process command line arguments
  1351. d202 3
  1352. @
  1353.  
  1354.  
  1355. 1.5
  1356. log
  1357. @insert GNU license text in the header
  1358. @
  1359. text
  1360. @d25 3
  1361. d46 1
  1362. a46 1
  1363. static char     *rcsid="$Id: main.c,v 1.4 1993/09/13 22:23:09 Aussem Exp Aussem $";
  1364. d301 1
  1365. a301 1
  1366.         ptr=grep_toline(fp);
  1367. d304 3
  1368. d318 1
  1369. a318 1
  1370.     ptr=grep_toline(stdin);
  1371. d321 3
  1372. @
  1373.  
  1374.  
  1375. 1.4
  1376. log
  1377. @test whether MaxRMailLen exists and set the global variable
  1378. @
  1379. text
  1380. @d10 14
  1381. d25 3
  1382. d43 1
  1383. a43 1
  1384. static char     *rcsid="$Id: main.c,v 1.3 1993/09/12 14:35:49 Aussem Exp Aussem $";
  1385. @
  1386.  
  1387.  
  1388. 1.3
  1389. log
  1390. @SMDebug != 0 will activate verbose output
  1391. @
  1392. text
  1393. @d11 3
  1394. d26 1
  1395. a26 1
  1396. static char     *rcsid="$Id: main.c,v 1.2 1993/09/10 01:54:39 Aussem Exp Aussem $";
  1397. d94 6
  1398. a99 5
  1399. int  cc_index   = -1;         /* index starting cc: in the to-arguments */
  1400. char *subject   = NULL;          /* subject of the mail         */
  1401. char *realname  = NULL;       /* realname of the user    */
  1402. char *pathfile  = PATHS;       /* or set by -p             */
  1403. char *uuxargs   = NULL;           /* or set by -u                */
  1404. d181 3
  1405. @
  1406.  
  1407.  
  1408. 1.2
  1409. log
  1410. @new support for grepping the To: line from mailbody with grep_toline()
  1411. for new support for wCNews styled logfile cmd-line options enabled
  1412. and rmail check (only if we are not rmail grep the To: line)
  1413. react as rmail can be enabled via -r cmd-line option
  1414. @
  1415. text
  1416. @d11 6
  1417. d23 1
  1418. a23 1
  1419. static char     *rcsid="$Id: main.c,v 1.1 1993/09/08 16:27:13 Aussem Exp Aussem $";
  1420. d176 1
  1421. a176 1
  1422.        debug=YES;
  1423. @
  1424.  
  1425.  
  1426. 1.1
  1427. log
  1428. @Initial revision
  1429. @
  1430. text
  1431. @d10 3
  1432. a12 1
  1433.  * $Log$
  1434. d14 1
  1435. d17 1
  1436. a17 1
  1437. static char     *rcsid="$Id$";
  1438. d57 1
  1439. d80 1
  1440. d151 1
  1441. a151 1
  1442.     char *optstr = "CdvAoOlLH:h:c:p:u:q:a:n:m:F:f:s:t:R:";
  1443. d206 3
  1444. d235 1
  1445. d258 29
  1446. d291 1
  1447. a291 1
  1448.  
  1449. d335 1
  1450. a335 1
  1451. **  Add the -t and -c addresses to the argv
  1452. d425 1
  1453. a425 1
  1454. int count=0;
  1455. d429 1
  1456. a429 1
  1457. *argc = count = 0;
  1458. d432 2
  1459. a433 2
  1460. start=stpblk(line);
  1461. if(!start)return(NULL);
  1462. d435 1
  1463. a435 1
  1464. for(;;)
  1465. d438 5
  1466. a443 3
  1467.    if(!end)break;
  1468.    if(*(end+1)=='\0')break;
  1469.    start=end+1;
  1470. d449 1
  1471. a449 2
  1472. start=stpblk(line);
  1473. for(j=0;j<count;j++)
  1474. d453 1
  1475. a453 1
  1476.        *end='\0';
  1477. d455 5
  1478. a459 1
  1479.    start=end+1;
  1480. d461 1
  1481. a461 1
  1482. *argc=count;
  1483. @
  1484.