home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1993-12-21 | 29.5 KB | 1,484 lines
head 1.23; access; symbols C_1:1.23; locks; strict; comment @ * @; 1.23 date 93.11.13.22.13.10; author Aussem; state Exp; branches; next 1.22; 1.22 date 93.11.13.21.17.19; author Aussem; state Exp; branches; next 1.21; 1.21 date 93.11.09.22.41.53; author Aussem; state Exp; branches; next 1.20; 1.20 date 93.11.04.22.46.25; author Aussem; state Exp; branches; next 1.19; 1.19 date 93.11.02.19.57.08; author Aussem; state Exp; branches; next 1.18; 1.18 date 93.10.31.21.41.22; author Aussem; state Exp; branches; next 1.17; 1.17 date 93.10.31.21.13.09; author Aussem; state Exp; branches; next 1.16; 1.16 date 93.10.31.17.50.59; author Aussem; state Exp; branches; next 1.15; 1.15 date 93.10.30.23.50.40; author Aussem; state Exp; branches; next 1.14; 1.14 date 93.10.30.23.49.15; author Aussem; state Exp; branches; next 1.13; 1.13 date 93.10.23.22.47.51; author Aussem; state Exp; branches; next 1.12; 1.12 date 93.10.18.20.38.27; author Aussem; state Exp; branches; next 1.11; 1.11 date 93.10.17.21.12.27; author Aussem; state Exp; branches; next 1.10; 1.10 date 93.10.17.18.42.34; author Aussem; state Exp; branches; next 1.9; 1.9 date 93.10.16.14.56.33; author Aussem; state Exp; branches; next 1.8; 1.8 date 93.10.10.19.32.34; author Aussem; state Exp; branches; next 1.7; 1.7 date 93.09.29.13.14.46; author Aussem; state Exp; branches; next 1.6; 1.6 date 93.09.18.20.23.05; author Aussem; state Exp; branches; next 1.5; 1.5 date 93.09.18.16.47.47; author Aussem; state Exp; branches; next 1.4; 1.4 date 93.09.13.22.23.09; author Aussem; state Exp; branches; next 1.3; 1.3 date 93.09.12.14.35.49; author Aussem; state Exp; branches; next 1.2; 1.2 date 93.09.10.01.54.39; author Aussem; state Exp; branches; next 1.1; 1.1 date 93.09.08.16.27.13; author Aussem; state Exp; branches; next ; desc @main module of smail @ 1.23 log @VERSION integrated @ text @/* * main.c * * rmail/smail - UUCP mailer with automatic routing. * * Christopher Seiwald /+\ * chris@@cbosgd.att.com +\ * January, 1985 \+/ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: main.c,v $ * Revision 1.22 1993/11/13 21:17:19 Aussem * changes getversion to get_programtype() * take rmail name from uulib:config * * Revision 1.21 1993/11/09 22:41:53 Aussem * cosmetic changes * * Revision 1.20 1993/11/04 22:46:25 Aussem * smail searches now only to To:/Cc:/Bcc: without a leading space * * Revision 1.19 1993/11/02 19:57:08 Aussem * atexit() insert * * Revision 1.18 1993/10/31 21:41:22 Aussem * cosmetic changes * * Revision 1.17 1993/10/31 21:13:09 Aussem * bigger stack size * * Revision 1.16 1993/10/31 17:50:59 Aussem * cosmetic changes in help text * * Revision 1.15 1993/10/30 23:50:40 Aussem * Version string corrected * * Revision 1.14 1993/10/30 23:49:15 Aussem * stack size via __stacksize set to 20000 bytes * Version string updated * * Revision 1.13 1993/10/23 22:47:51 Aussem * the file for bsmtp options are taken from uulib:config * * Revision 1.12 1993/10/18 20:38:27 Aussem * batch option implemtended * * Revision 1.11 1993/10/17 21:12:27 Aussem * compress and freeze commands are taken from uulib:config (if present) * smail converts the smtp mail to "normal" format and * then deliver via rmail * * Revision 1.10 1993/10/17 18:42:34 Aussem * reading a file with -f works now * uncompressing a mail, if the programs is rfsmtp or rcsmtp works * * Revision 1.9 1993/10/16 14:56:33 Aussem * -M option implemented * * Revision 1.8 1993/10/10 19:32:34 Aussem * Bcc: lines are now supported * * Revision 1.7 1993/09/29 13:14:46 Aussem * If smail calls smail again, it uses first the uulib:config entry for Sendmail * and if not exists sendmail * * Revision 1.6 1993/09/18 20:23:05 Aussem * the cc line can now be parsed from cmdline and from file * * Revision 1.5 1993/09/18 16:47:47 Aussem * insert GNU license text in the header * * Revision 1.4 1993/09/13 22:23:09 Aussem * test whether MaxRMailLen exists and set the global variable * * Revision 1.3 1993/09/12 14:35:49 Aussem * SMDebug != 0 will activate verbose output * * Revision 1.2 1993/09/10 01:54:39 Aussem * new support for grepping the To: line from mailbody with grep_toline() * for new support for wCNews styled logfile cmd-line options enabled * and rmail check (only if we are not rmail grep the To: line) * react as rmail can be enabled via -r cmd-line option * * Revision 1.1 1993/09/08 16:27:13 Aussem * Initial revision * * */ static char *rcsid="$Id: main.c,v 1.22 1993/11/13 21:17:19 Aussem Exp Aussem $"; /* ** ** usage: rmail [options] address... ** smail [options] address... */ #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include "defs.h" #define FONT_REV "\033[7m" /* font reverse */ #define FONT_ULIN "\033[4m" /* font underline */ #define FONT_BOLD "\033[1m" /* font bold */ #define FONT_NORM "\033[0m" /* font normal */ static const char version_string[]="$VER: SMail "SMAIL_VERSION" Amiga Version ("__DATE__","__TIME__")"; const char version[]="AmigaSmail"SMAIL_VERSION; extern char return_receipt[]; extern char checkuserfile[]; /* should be large enough */ long __stack=80000L; static char ** mk_argv(char * , int * ); static char ** cp_argv(char ** , char ** , int , int ); static const char *errortext="\ usage: rmail [options] address...\n\ smail [options] address...\n\ options:\n\ -D batch BSMTP mails for host specified -h \n\ -d debug - verbose and don't invoke mailers.\n\ -v verbose - just verbose.\n\ -A print mapped addresses. don't invoke mailers.\n\ -B use BSMTP (batch simple mail transport protocol) for transfer.\n\ -h hostname set hostname\n" #ifdef MYDOM " -H hostdomain set hostdomain (default hostname."MYDOM")\n" #else " -H hostdomain set hostdomain (default hostname)\n" #endif " -p pathfile path database filename\n\ -o force routing of host!address\n\ -O reroute even explicit path!user\n\ -l user@@domain goes to local mailer\n\ -L all mail goes local\n\ -C Consult the paths file for the cost of the path\n\ -r running in rmail mode\n\ -M don't return mails, if we can't deliver them\n\ -q number mail queueing cost threshold\n\ -m number limit on number of uux_noqueue jobs\n\ -u string string of flags for uux\n\ -t address address to send the mail\n\ -s subject subject of the mail\n\ -R realname realname of the user\n\ -f address name to substitute in From: line\n\ -c address name to substitute in cc: line \n\ -b address name to substitute in Bcc: line \n\ -F file mail-file to spool\n" #ifndef SENDMAIL " -a aliasfile aliases filename\n" #endif " -n namelist list of full names for simple aliases\n"; int exitstat = 0; /* exit status, set by resolve, deliver */ enum edebug debug = NO; /* set by -d or -v option */ enum ehandle handle = HANDLE; /* which mail we can handle, see defs.h */ enum erouting routing = ROUTING;/* to route or not to route, see defs.h */ char passwdfile[SMLBUF] = "getty:passwd"; char logfile[SMLBUF] = LOG; char maillogfile[SMLBUF] = MAILLOG; char sentfile[SMLBUF] = RECORD; char hostname[SMLBUF] = ""; /* set by -h, defaults in defs.h */ char hostdomain[SMLBUF] = ""; /* set by -H, defaults in defs.h */ char hostuucp[SMLBUF] = ""; /* built with hostname+".UUCP" */ int cc_index = -1; /* index starting Cc: in the to-arguments vector */ int bcc_index = -1; /* index starting Bcc: in the to-arguments vector */ char *subject = NULL; /* subject of the mail */ char *realname = NULL; /* realname of the user */ char *pathfile = PATHS; /* or set by -p */ char *uuxargs = NULL; /* or set by -u */ int maxrmaillen = 0; /* maximal rmail length */ char smailname[SMLBUF] = "sendmail"; /* name of smail */ char rmailname[SMLBUF] = "rmail"; /* name of rmail */ char bsmtp_sites[SMLBUF]="uulib:mail/bsmtp_sites"; char *aliasfile = #ifdef ALIAS ALIAS; /* or set by -a */ #else NULL; #endif char *fnlist = #ifdef FULLNAME FULLNAME; /* or set by -n */ #else NULL; #endif int queuecost = QUEUECOST; /* or set by -q */ char *from_addr = NULL; /* or set by -F */ int maxnoqueue = MAXNOQUEUE; /* or set by -m */ int receipt = 1; int returnmail = 1; /* or set by -M */ int getcost = #ifdef GETCOST 1; /* get cost of path even if not routing */ #else 0; #endif char *spoolfile = NULL; /* name of the file containing letter */ FILE *spoolfp; /* file pointer to spoolfile */ int spoolmaster = 0; /* indicates 'control' of spoolfile */ void spool(); int asrmail; /* invoked as rmail (CMK) */ int bsmtp=0; /* do BSMTP */ int checkuser=0; /* check whether a user is allowed to mail via UUCP */ FILE *mystdin=stdin; /* ** ** rmail/smail: mail stdin letter to argv addresses. ** ** After processing command line options and finding our host and domain ** names, we map addresses into <host,user,form,cost> sets. Then we deliver. ** */ main(argc, argv) int argc; char *argv[]; { char *hostv[MAXARGS]; /* UUCP neighbor */ char *userv[MAXARGS]; /* address given to host */ int costv[MAXARGS]; /* cost of resolved route */ enum eform formv[MAXARGS]; /* invalid, local, or uucp */ char cc[SMLBUF] = ""; /* cc-line from the command line */ char bcc[SMLBUF] = ""; /* bcc-line from the command line */ char *p; int c; int printaddr = 0; /* or set by -A */ int nargc; char **nargv, **alias(); char *get_config(char *,short); char to[BIGBUF]=""; char **to_argv=NULL,**cc_argv=NULL,**bcc_argv=NULL; int to_argc=0; int deliver_batch=0; char compress[SMLBUF]="compress"; char rsmtp_cmd[SMLBUF]="rcsmtp"; char *optstr = "BCDdvArMoOlLH:h:c:b:p:u:q:a:n:m:F:f:s:t:R:"; extern char *optarg; extern int optind; extern char prgtype_string[]; extern void kill_external(void); /* install atexit() fkt */ atexit(kill_external); /* get the program type */ set_programtype(); /* ** See whether we are started with -raw options */ for(c=1;c<argc;c++) if(strcmp(argv[c],"-raw")==0) { argv[c][0]='-'; argv[c][1]='v'; argv[c][2]='\0'; printf("%s: WARNING ! you call smail with the unsupported and ignored -raw option\n",argv[0]); } /* ** see if we aren't invoked as rmail */ if(stricmp(argv[0],rmailname)!=0 ) { handle = ALL; asrmail = 0; /* CMK */ } else asrmail = 1; if(stricmp(argv[0],"rsmtp")==0 ) { asrmail = 1; bsmtp=1; } if(stricmp(argv[0],"rfsmtp")==0 ) { asrmail = 1; bsmtp=1; } if(stricmp(argv[0],"rcsmtp")==0 ) { asrmail = 1; bsmtp=1; } /* ** Process command and config line arguments */ p=get_config("SMBsmtpSites",2); if(p) strcpy(bsmtp_sites,p); p=get_config("SMBsmtpCmd",2); if(p) strcpy(rsmtp_cmd,p); p=get_config("SMCompress",2); if(p) strcpy(compress,p); if(get_config("SMDebug",1)) debug=VERBOSE; p=get_config("MaxRMailLen",2); if(p) maxrmaillen=atoi(p); p=get_config("SMRerouting",2); if(p) switch(atoi(p)) { default: case 0:routing=REROUTE; /* route C, B, or A (whichever works); set by -R */ break; case 1:routing=ALWAYS; /* route A always; set by -r */ break; case 2:routing=JUSTDOMAIN; /* route A if A is a domain */ break; } p=get_config("SMHandle",2); if(p) switch(atoi(p)) { default: case 0:handle=ALL; break; case 1:handle=JUSTUUCP; break; case 2:handle=NONE; break; } if(get_config("SMGetcost",0)) getcost=1; else getcost=0; if(get_config("SMReceipt",0)) receipt=1; else receipt=0; if(get_config("SMCheckuser",0)) checkuser=1; p=get_config("SMCheckfile",2); if(p) strcpy(checkuserfile,p); p=get_config("SMLogfile",2); if(p) strcpy(logfile,p); p=get_config("SMMaillogfile",2); if(p) strcpy(maillogfile,p); p=get_config("SMPasswd",2); if(p) strcpy(passwdfile,p); p=get_config("SMSentlog",2); if(p) strcpy(sentfile,p); p=get_config("SMFullname",2); if(p) fnlist=strdup(p); p=get_config("SMPath",2); if(p) pathfile=strdup(p); p=get_config("SMAlias",2); if(p) aliasfile=strdup(p); p=get_config("Sendmail",2); if(p) strcpy(smailname,p); p=get_config("Rmail",2); if(p) strcpy(rmailname,p); while ((c = getopt(argc, argv, optstr)) != EOF) { switch ( c ) { case 'B': bsmtp = 1; break; case 'D': deliver_batch = 1; break; case 'd': debug = YES; break; case 'v': debug = VERBOSE; break; case 'A': printaddr = 1; break; case 'f': from_addr = optarg; break; case 'o': routing = ALWAYS; break; case 'O': routing = REROUTE; break; case 'l': handle = JUSTUUCP; break; case 'L': handle = NONE; break; case 'r': asrmail = 1; break; case 'M': returnmail = 0; break; case 'F': spoolfile = optarg; break; case 'p': pathfile = optarg; break; case 'u': uuxargs = optarg; break; case 'a': aliasfile = optarg; break; case 'n': fnlist = optarg; break; case 's': subject = optarg; break; case 't': strcat(to,optarg);strcat(to," ");break; case 'c': strcat(cc,optarg);strcat(cc," ");break; case 'b': strcat(bcc,optarg);strcat(bcc," ");break; case 'R': realname = optarg; break; case 'H': (void) strcpy(hostdomain, optarg); break; case 'h': (void) strcpy(hostname, optarg); break; case 'm': if(isdigit(*optarg)) { maxnoqueue = atoi(optarg); } break; case 'C': getcost = 1; break; case 'q': if(isdigit(*optarg)) { queuecost = atoi(optarg); } break; } } if(asrmail && bsmtp) { FILE *fp; char *cmd; if(spoolfile) { switch(tolower(argv[0][1])) { case 'c': cmd=get_config("Compress",2); if(cmd) uncompress_file(spoolfile , cmd); else uncompress_file(spoolfile , "compress"); break; case 'f': cmd=get_config("Freeze",2); if(cmd) uncompress_file(spoolfile , cmd); else uncompress_file(spoolfile , "freeze"); break; } fp=fopen(spoolfile,"r"); convert_smtp(fp); } if(stdin) { switch(tolower(argv[0][1])) { case 'c': cmd=get_config("Compress",2); if(cmd) mystdin=uncompress_stream(stdin , cmd); else mystdin=uncompress_stream(stdin , "compress"); break; case 'f': cmd=get_config("Freeze",2); if(cmd) mystdin=uncompress_stream(stdin , cmd); else mystdin=uncompress_stream(stdin , "freeze"); break; } convert_smtp(mystdin); } if(mystdin==NULL) { printf("%s: failed to uncompress stdin in BSMTP mode\n",argv[0]); exit(10); } exit(0); } if(deliver_batch) { char batchname[SMLBUF]=UUBATCH; char tmpname[SMLBUF]="T:"; char cmd[SMLBUF]; int rc; strcat(batchname,hostname); strcat(tmpname,hostname); rc=access(batchname,R_OK); if(rc!=0) { ADVISE("%s: no batch-file for %s ('%s')\n",argv[0],hostname,batchname); exit(5); } sprintf(cmd,"%s <%s >%s",compress,batchname,tmpname); ADVISE("compressing: '%s'\n",cmd); rc=system(cmd); if(rc) { printf("%s: unable to compress batch-file %s ('%s')\n",argv[0],batchname,cmd); exit(10); } sprintf(cmd,"%s %s \"%s!%s\"",UUX,tmpname,hostname,rsmtp_cmd); ADVISE("delivering: '%s'\n",cmd); rc=system(cmd); if(rc) { printf("%s: unable to deliver batch-file %s ('%s')\n",argv[0],batchname,cmd); exit(10); } remove(tmpname); remove(batchname); exit(0); } /* only search To: lines, if we are not in rmail mode and spoolfile!=NULL */ if(spoolfile && !asrmail) { char *ptr; FILE *fp=fopen(spoolfile,"r"); if(fp) { ptr=grep_toline(fp,"To:"); if(ptr) strcat(to,ptr); ptr=grep_toline(fp,"Cc:"); if(ptr) strcat(cc,ptr); ptr=grep_toline(fp,"Bcc:"); if(ptr) strcat(bcc,ptr); fclose(fp); } } /* only search To: lines, if we are not in rmail mode and mystdin!=NULL */ if(mystdin && !asrmail) { char *ptr; ptr=grep_toline(mystdin,"To:"); if(ptr) strcat(to,ptr); ptr=grep_toline(mystdin,"Cc:"); if(ptr) strcat(cc,ptr); ptr=grep_toline(mystdin,"Bcc:"); if(ptr) strcat(bcc,ptr); } if ( argc <= optind && to[0]=='\0') { error( EX_USAGE, "No receiver found\n%s",errortext); } /* Print some configs informations */ if(debug==VERBOSE || debug==YES) { char *text[2]; int i; 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\ "FONT_ULIN"Files:\n"FONT_NORM"\ Passwd-file : %s\n\ Paths-file : %s\n\ Log-file : %s\n\ Sent-log : %s\n\ Alias-file : %s\n\ Fullname-file : %s\n", prgtype_string, passwdfile,pathfile,logfile,sentfile,aliasfile,fnlist); switch(routing) { case ALWAYS: text[0]="Always"; break; case REROUTE: text[0]="Reroute"; break; case JUSTDOMAIN: text[0]="Just Domain"; break; } switch(handle) { case ALL: text[1]="All"; break; case JUSTUUCP: text[1]="Just UUCP"; break; case NONE: text[1]="None"; break; } printf(FONT_ULIN"Options:\n"FONT_NORM"\ BSMTP : %s\n\ RMail mode : %s\n\ Rerouting : %s\n\ Handle : %s\n\ Getcost : %s\n", bsmtp?"Yes":"No", asrmail?"Yes":"No", text[0],text[1],((getcost==1)?"Yes":"No")); printf("To : "); for(i=optind;i<argc;i++)printf("%s ",argv[i]); if(to[0]!='\0') printf(" '%s'",to); printf("\n"); if(cc[0]!='\0') printf("Cc : '%s'\n",cc); if(bcc[0]!='\0') printf("Bcc : '%s'\n",bcc); } /* ** Add the -t, -c addresses and To: lines to argv[] */ if(to[0]!='\0') { to_argv=mk_argv(to,&to_argc); } if(cc[0]!='\0') { cc_argv=mk_argv(cc,&cc_index); } if(bcc[0]!='\0') { bcc_argv=mk_argv(bcc,&bcc_index); } if(to_argv) { argv=cp_argv(argv,to_argv,argc,to_argc); argc+=to_argc; } if(cc_argv) { argv=cp_argv(argv,cc_argv,argc,cc_index); argc+=cc_index; /* to lousy to create a new variable to store the contents of argc */ cc_index=argc-cc_index-optind; } if(bcc_argv) { argv=cp_argv(argv,bcc_argv,argc,bcc_index); argc+=bcc_index; /* to lousy to create a new variable to store the contents of argc */ bcc_index=argc-bcc_index-optind; } /* ** Get our default hostname and hostdomain. */ getmynames(); /* ** Spool the letter in a temporary file. */ nargc = argc - optind; if(printaddr == 0) { spool(nargc, &argv[optind]); } /* ** Do aliasing and fullname resolution */ nargv = alias(&nargc, &argv[optind]); /* ** Map argv addresses to <host, user, form, cost>. */ map(nargc, nargv, hostv, userv, formv, costv); /* ** If all we want it mapped addresses, print them and exit. */ if(printaddr) { int i; char abuf[SMLBUF]; for(i=nargc-1; i >= 0; i--) { if(formv[i] == ERROR) { (void) strcpy(abuf, nargv[i]); } else { build(hostv[i], userv[i], formv[i], abuf); } (void) fputs(abuf, stdout); if(i != 0) (void) putchar(' '); } (void) putchar('\n'); exit(0); } /* ** Deliver. */ if((debug==VERBOSE || debug==YES) && return_receipt[0]!='\0') { printf("Recepient-Return-To: %s\n",return_receipt); } deliver(nargc, hostv, userv, formv, costv); /* ** Exitstat was set if any resolve or deliver failed, otherwise 0. */ return( exitstat ); } /* ** ** Generate an argv from an blank seperated line ** ** */ static char **mk_argv(char *line,int *argc) { register int j; int count; char *start, *end,**argv; *argc = 0; if(!line)return(NULL); for(start=line;*start==' ';start++); if(*start=='\0')return(NULL); for(count=1;;) { end=strchr(start,' '); if(!end)break; /* skip blankes */ for(end++;*end==' ';end++); if(*end=='\0')break; start=end; count++; } argv=(char **)malloc(count*sizeof(char *)); if(!argv)return(NULL); for(start=line,j=0;j<count;j++) { end=strchr(start,' '); if(end) *end='\0'; argv[j]=strdup(start); if(!end)break; /* skip blankes */ for(end++;*end==' ';end++); if(*end=='\0')break; start=end; } *argc=j+1; return(argv); } /* ** ** concat two argvs ** */ static char **cp_argv(char **argv1,char **argv2,int argc1,int argc2) { register int i; int sum=argc1+argc2; char **argv; argv=(char **)malloc(sum*sizeof(char *)); for(i=0;i<argc1;i++) { argv[i]=strdup(argv1[i]); } for(i=0;i<argc2;i++) { argv[i+argc1]=strdup(argv2[i]); free(argv2[i]); } return(argv); } @ 1.22 log @changes getversion to get_programtype() take rmail name from uulib:config @ text @d25 4 d103 1 a103 3 static char *rcsid="$Id: main.c,v 1.21 1993/11/09 22:41:53 Aussem Exp Aussem $"; static const char *version="$VER: SMail V1.0 Amiga Version ("__DATE__","__TIME__")"; d116 1 d121 3 @ 1.21 log @cosmetic changes @ text @d25 3 d99 1 a99 1 static char *rcsid="$Id: main.c,v 1.20 1993/11/04 22:46:25 Aussem Exp Aussem $"; d188 1 d262 1 d265 1 d268 3 d286 1 a286 1 if(stricmp(argv[0],"rmail")!=0 ) { a319 4 p=get_config("Sendmail",2); if(p) strcpy(smailname,p); d383 6 d581 1 a581 1 getversion(), @ 1.20 log @smail searches now only to To:/Cc:/Bcc: without a leading space @ text @d25 3 d96 1 a96 1 static char *rcsid="$Id: main.c,v 1.19 1993/11/02 19:57:08 Aussem Exp Aussem $"; d117 1 d146 1 a146 1 -C all mail goes local\n\ d221 1 d352 5 d562 1 a562 1 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\ d570 1 d594 2 d598 4 a601 1 Getcost : %s\n",text[0],text[1],((getcost==1)?"Yes":"No")); @ 1.19 log @atexit() insert @ text @d25 3 d93 1 a93 1 static char *rcsid="$Id: main.c,v 1.18 1993/10/31 21:41:22 Aussem Exp Aussem $"; d511 1 a511 1 ptr=grep_toline(fp,"To: "); d514 1 a514 1 ptr=grep_toline(fp,"Cc: "); d517 1 a517 1 ptr=grep_toline(fp,"Bcc: "); d531 1 a531 1 ptr=grep_toline(mystdin,"To: "); d534 1 a534 1 ptr=grep_toline(mystdin,"Cc: "); d537 1 a537 1 ptr=grep_toline(mystdin,"Bcc: "); @ 1.18 log @cosmetic changes @ text @d25 3 d90 1 a90 1 static char *rcsid="$Id: main.c,v 1.17 1993/10/31 21:13:09 Aussem Exp Aussem $"; d250 3 @ 1.17 log @bigger stack size @ text @d25 3 d87 1 a87 1 static char *rcsid="$Id: main.c,v 1.16 1993/10/31 17:50:59 Aussem Exp Aussem $"; d102 5 d543 8 a550 2 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\ Passwd-file : %s\t\tPaths-file : %s\nLog-file : %s\tSent-log : %s\nAlias-file : %s\t\tFullname-file : %s\n", d573 4 a576 2 printf("Rerouting : %s\tHandle : %s\tGetcost : %s\n",text[0],text[1], ((getcost==1)?"Yes":"No")); d578 1 a578 1 printf("To: "); d585 1 a585 1 printf("Cc: '%s'\n",cc); d588 1 a588 1 printf("Bcc: '%s'\n",bcc); @ 1.16 log @cosmetic changes in help text @ text @d25 3 d84 1 a84 1 static char *rcsid="$Id: main.c,v 1.15 1993/10/30 23:50:40 Aussem Exp Aussem $"; d102 1 a102 1 long __stack=30000L; d565 1 a565 1 printf(" %s",to); d569 1 a569 1 printf("Cc: %s\n",cc); d572 1 a572 1 printf("Bcc: %s\n",bcc); @ 1.15 log @Version string corrected @ text @d25 3 d81 1 a81 1 static char *rcsid="$Id: main.c,v 1.14 1993/10/30 23:49:15 Aussem Exp Aussem $"; d126 2 a127 2 -r running in rmail mode\n\ -M don't return mails, if we can't deliver them\n\ @ 1.14 log @stack size via __stacksize set to 20000 bytes Version string updated @ text @d25 4 d78 1 a78 1 static char *rcsid="$Id: main.c,v 1.13 1993/10/23 22:47:51 Aussem Exp Aussem $"; d80 1 a80 1 static const char *version="$VER: SMail V1.0 Amiga Version ("__DATE__,__TIME__")"; @ 1.13 log @the file for bsmtp options are taken from uulib:config @ text @d25 3 d74 1 a74 1 static char *rcsid="$Id: main.c,v 1.12 1993/10/18 20:38:27 Aussem Exp Aussem $"; d76 1 a76 1 static const char *version="$VER: SMail V2.5 Amiga Version compiled on "__DATE__; d90 3 @ 1.12 log @batch option implemtended @ text @d25 3 d71 1 a71 1 static char *rcsid="$Id: main.c,v 1.11 1993/10/17 21:12:27 Aussem Exp Aussem $"; d151 1 d217 2 d225 12 d264 9 d446 1 a446 1 sprintf(cmd,"%s <%s >%s","compress",batchname,tmpname); d455 1 a455 1 sprintf(cmd,"%s %s \"%s!%s\"",UUX,tmpname,hostname,"rcsmtp"); d519 1 a519 1 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\ @ 1.11 log @compress and freeze commands are taken from uulib:config (if present) smail converts the smtp mail to "normal" format and then deliver via rmail @ text @d25 5 d68 1 a68 1 static char *rcsid="$Id: main.c,v 1.10 1993/10/17 18:42:34 Aussem Exp Aussem $"; d93 2 a94 1 -d debug - verbose and don't invoke mailers.\n\ d212 1 d214 1 a214 1 char *optstr = "BCdvArMoOlLH:h:c:b:p:u:q:a:n:m:F:f:s:t:R:"; d312 1 d404 37 @ 1.10 log @reading a file with -f works now uncompressing a mail, if the programs is rfsmtp or rcsmtp works @ text @d25 4 d63 1 a63 1 static char *rcsid="$Id: main.c,v 1.9 1993/10/16 14:56:33 Aussem Exp Aussem $"; d341 3 d349 4 d354 1 a354 1 break; d356 4 d361 1 a361 1 break; d363 2 d366 1 d372 4 d379 4 d384 1 a384 1 break; d386 1 d390 1 a390 1 printf("%s: failed to uncompress stdin in bsmtp mode\n",argv[0]); d393 1 @ 1.9 log @-M option implemented @ text @d25 3 d59 1 a59 1 static char *rcsid="$Id: main.c,v 1.8 1993/10/10 19:32:34 Aussem Exp Aussem $"; d87 1 d172 2 d203 1 a203 1 char *optstr = "CdvArMoOlLH:h:c:b:p:u:q:a:n:m:F:f:s:t:R:"; d210 1 a210 2 p=argv[0]; if(*p != 'r' ) { d216 16 d300 1 d335 34 d370 2 a371 2 rmail mode and fnlist!=NULL */ if(fnlist && !asrmail) d374 1 a374 1 FILE *fp=fopen(fnlist,"r"); d393 2 a394 2 rmail mode and stdin!=NULL */ if(stdin && !asrmail) d398 1 a398 1 ptr=grep_toline(stdin,"To: "); d401 1 a401 1 ptr=grep_toline(stdin,"Cc: "); d404 1 a404 1 ptr=grep_toline(stdin,"Bcc: "); @ 1.8 log @Bcc: lines are now supported @ text @d25 3 d56 1 a56 1 static char *rcsid="$Id: main.c,v 1.7 1993/09/29 13:14:46 Aussem Exp Aussem $"; d97 1 d149 3 a151 3 int queuecost = QUEUECOST; /* or set by -q */ char *from_addr = NULL; /* or set by -F */ int maxnoqueue = MAXNOQUEUE; /* or set by -m */ d153 1 d197 1 a197 1 char *optstr = "CdvAroOlLH:h:c:b:p:u:q:a:n:m:F:f:s:t:R:"; d288 1 @ 1.7 log @If smail calls smail again, it uses first the uulib:config entry for Sendmail and if not exists sendmail @ text @d25 4 d53 1 a53 1 static char *rcsid="$Id: main.c,v 1.6 1993/09/18 20:23:05 Aussem Exp Aussem $"; d102 1 d122 4 a125 3 int cc_index = -1; /* index starting cc: in the to-arguments */ char *subject = NULL; /* subject of the mail */ char *realname = NULL; /* realname of the user */ d127 1 a127 1 char *uuxargs = NULL; /* or set by -u */ d181 1 d189 1 a189 1 char **to_argv=NULL,**cc_argv=NULL; d192 1 a192 1 char *optstr = "CdvAroOlLH:h:c:p:u:q:a:n:m:F:f:s:t:R:"; d291 1 d322 3 d342 3 d392 3 d410 5 d427 8 @ 1.6 log @the cc line can now be parsed from cmdline and from file @ text @d25 3 d49 1 a49 1 static char *rcsid="$Id: main.c,v 1.5 1993/09/18 16:47:47 Aussem Exp Aussem $"; d123 1 d200 1 a200 1 ** Process command line arguments d202 3 @ 1.5 log @insert GNU license text in the header @ text @d25 3 d46 1 a46 1 static char *rcsid="$Id: main.c,v 1.4 1993/09/13 22:23:09 Aussem Exp Aussem $"; d301 1 a301 1 ptr=grep_toline(fp); d304 3 d318 1 a318 1 ptr=grep_toline(stdin); d321 3 @ 1.4 log @test whether MaxRMailLen exists and set the global variable @ text @d10 14 d25 3 d43 1 a43 1 static char *rcsid="$Id: main.c,v 1.3 1993/09/12 14:35:49 Aussem Exp Aussem $"; @ 1.3 log @SMDebug != 0 will activate verbose output @ text @d11 3 d26 1 a26 1 static char *rcsid="$Id: main.c,v 1.2 1993/09/10 01:54:39 Aussem Exp Aussem $"; d94 6 a99 5 int cc_index = -1; /* index starting cc: in the to-arguments */ char *subject = NULL; /* subject of the mail */ char *realname = NULL; /* realname of the user */ char *pathfile = PATHS; /* or set by -p */ char *uuxargs = NULL; /* or set by -u */ d181 3 @ 1.2 log @new support for grepping the To: line from mailbody with grep_toline() for new support for wCNews styled logfile cmd-line options enabled and rmail check (only if we are not rmail grep the To: line) react as rmail can be enabled via -r cmd-line option @ text @d11 6 d23 1 a23 1 static char *rcsid="$Id: main.c,v 1.1 1993/09/08 16:27:13 Aussem Exp Aussem $"; d176 1 a176 1 debug=YES; @ 1.1 log @Initial revision @ text @d10 3 a12 1 * $Log$ d14 1 d17 1 a17 1 static char *rcsid="$Id$"; d57 1 d80 1 d151 1 a151 1 char *optstr = "CdvAoOlLH:h:c:p:u:q:a:n:m:F:f:s:t:R:"; d206 3 d235 1 d258 29 d291 1 a291 1 d335 1 a335 1 ** Add the -t and -c addresses to the argv d425 1 a425 1 int count=0; d429 1 a429 1 *argc = count = 0; d432 2 a433 2 start=stpblk(line); if(!start)return(NULL); d435 1 a435 1 for(;;) d438 5 a443 3 if(!end)break; if(*(end+1)=='\0')break; start=end+1; d449 1 a449 2 start=stpblk(line); for(j=0;j<count;j++) d453 1 a453 1 *end='\0'; d455 5 a459 1 start=end+1; d461 1 a461 1 *argc=count; @