home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************/
- /*** ***/
- /*** oMMM - The Outbound Matrix Message Masher ***/
- /*** Copyright 1989 BS Software ***/
- /*** ***/
- /*** FILENAME: OMMM.C ***/
- /*** ***/
- /*** Mainline oMMM function and help ***/
- /*** ***/
- /*** Based on the original oMMM, a portion of ***/
- /*** the Opus Computer-Based Conversation System ***/
- /*** Copyright 1986, Wynn Wagner III ***/
- /*** ***/
- /***************************************************************************/
- /*** ***/
- /*** Tabs set at every 4th column ***/
- /*** ***/
- /***************************************************************************/
-
- /*
- Polytron Version Control System Comments:
-
- The revision of this file is *** $Revision: 1.40 $ ***
-
- History of changes from 1.30 release version
-
- $Log: C:/OMMM/PROJFILE/OMMM.C_V $
- *
- * Rev 1.40 12 Feb 1989 4:55:40 Marshall Presnell
- * Public Release Version 1.40
- *
- * Rev 1.31 31 Jan 1989 0:57:48 Marshall Presnell
- * oMMM 1.35 Beta Release Version
- *
- * Rev 1.30 23 Jan 1989 17:53:52 Marshall Presnell
- * Public Source Code Release - Version 1.30
-
- */
-
- /*--------------------------------------------------------------------------*/
- /* Include files */
- /*--------------------------------------------------------------------------*/
-
- #include "ommm.h"
- #include "myaddr.h"
-
-
- #include "stat.h"
- #include <time.h>
- #include <string.h>
- #include <stdlib.h>
-
- # include <ctype.h>
-
-
- /*--------------------------------------------------------------------------*/
- /* Static function declarations */
- /*--------------------------------------------------------------------------*/
-
- static void extended_help(void);
- static void version_identifier(void);
- static void load_cfg_file(void);
-
- /*--------------------------------------------------------------------------*/
- /* Static variable definitions */
- /*--------------------------------------------------------------------------*/
-
- static char * help[] = {
- "Creates `.OUT' and `.FLO' files for outbound matrix traffic. Certain preset",
- "data can be specified in the OMMM.CFG file (indicated by \"+\'s\" below)\n",
-
- " USAGE: oMMM -iINFOPATH -mMESSAGEPATH -hHOLDPATH -pPRESCANPATH",
- " -cROUTEFILE -sCHAR -zZONE -f -n -o -a -g -j -q\n",
-
- " CHAR .......... a single character for this schedule tag",
- " + INFOPATH ...... the Ommm Infofile to use for network information",
- " + MESSAGEPATH ... the sub-directory containing outbound messages",
- " + HOLDPATH ...... the sub-directory for the OUT/FLO files",
- " + PRESCANPATH ... the file with routing information to be used",
- " before message scanning takes place",
- " + ROUTEFILE ..... the file with routing information",
- " + ZONE .......... the zone number for our zone",
- " -f tells oMMM to make all 'no-send' packets normal again",
- " + -n tells oMMM not to forward messages from other nodes",
- " + -o tells oMMM to use the old .MO? extensions and not .TU1, etc.",
- " + -a tells oMMM to use pkarc instead of arca",
- " + -g tells oMMM to gate route interzone messages",
- " + -j tells oMMM to never gate route interzone messages",
- " -q tells oMMM to run quietly (and marginally faster).\n",
-
- "EXAMPLE: oMMM -iMail:Ommm.info -mMail:NetMail -hMail:Outbound -cMail:Routefile -d -z2 -n",
- NULL
- };
-
- static char info_path[80];
- static char nowtime[25];
- static char route_file[80];
- static unsigned int normalize = 0;
- static int quiet_mode = 0;
-
- /*--------------------------------------------------------------------------*/
- /* Local Variable Definitions */
- /*--------------------------------------------------------------------------*/
-
- ADDRESS ctlnet[15]; /* See: ROUTEMSC, MISC, ARCHIVE, ROUTE, OMMMSCAN */
-
- #ifdef ZTC
- int _okbigbuf = 0;
- #endif
-
- /*--------------------------------------------------------------------------*/
- /* External variable declarations */
- /*--------------------------------------------------------------------------*/
-
- extern char idString[]; /* Version identifier */
- extern short int Version;
- extern short int Revision;
-
-
- /*--------------------------------------------------------------------------*/
- /* Local definitions */
- /*--------------------------------------------------------------------------*/
-
- #define same(a,b) (!strcmp((a),(b)))
-
- /****************************************************************************/
-
- /*--------------------------------------------------------------------------*/
- /* EXTENDED HELP LOCAL FUNCTION */
- /*--------------------------------------------------------------------------*/
-
- static void
- extended_help()
- {
- int q = 0;
-
- while (help[q] != NULL)
- puts(help[q++]);
- exit(1);
- }
-
- /*--------------------------------------------------------------------------*/
- /* VERSION IDENTIFIER LOCAL FUNCTION */
- /*--------------------------------------------------------------------------*/
-
- static void
- version_identifier()
- {
-
- /* This one module uses an include file called <myaddr.h> in the standard
- include file path. It contains one line, as follows:
-
- #define MYADDRESS "1:133/401 - StarBase Operations"
-
- (or whatever node number YOU have)
-
- Please create this file to compile this source code. - Also, please
- do NOT use someone else's node number -- it's not too nice!
- */
-
- printf("\n%s (compatible with Ms-Dos oMMM Version %s)\n",idString,VERSION);
- printf("Compiled at node %s\n",MYADDRESS);
- printf("Compile Timestamp: %s %s\n",__DATE__,__TIME__);
- exit(0);
- }
-
- /*--------------------------------------------------------------------------*/
- /* LOAD CFG FILE LOCAL FUNCTION */
- /*--------------------------------------------------------------------------*/
-
- void
- load_cfg_file()
- {
- char line[129];
- int lineno = 0;
- char * tok;
- FILE * cfg;
-
- cfg = fopen("Mail:oMMM.CFG","ra");
- if (cfg == NULL)
- return;
- printf("Reading oMMM.CFG file");
- fflush(stdout);
- while (1) {
- if (fgets(line,128,cfg) == NULL)
- break;
- putchar('.');
- lineno++;
- if (line[0] == ';' || line[0] == '\0' || line[0] == '\n')
- continue;
- tok = strtok(line," \t\n:");
- if (tok == NULL || *tok == ';')
- continue;
- strlwr(tok);
- if (same(tok,"infopath")) {
- tok = strtok(NULL," \t;\n");
- strcpy(info_path,tok);
- fancy_str(info_path);
- } else if (same(tok,"messagepath")) {
- tok = strtok(NULL," \t;\n");
- strcpy(message_path,tok);
- add_backslash(message_path);
- } else if (same(tok,"holdpath")) {
- tok = strtok(NULL," \t;\n");
- strcpy(holding_path,tok);
- add_backslash(holding_path);
- } else if (same(tok,"prescanpath")) {
- tok = strtok(NULL," \t;\n");
- strcpy(pre_route,tok);
- fancy_str(pre_route);
- } else if (same(tok,"routefile")) {
- tok = strtok(NULL," \t;\n");
- strcpy(route_file,tok);
- fancy_str(route_file);
- } else if (same(tok,"zone")) {
- tok = strtok(NULL," \t;\n");
- our_zone = atoi(tok);
- } else if (same(tok,"forward")) {
- noforward = 0;
- } else if (same(tok,"mo?")) {
- oldstyle = 1;
- } else if (same(tok,"gateroute")) {
- use_gates = 1;
- } else if (same(tok,"nevergate")) {
- never_gate = 1;
- } else if (same(tok,"arca")) {
- pkarc = 0;
- } else if (same(tok,"pkarc")) {
- pkarc = 1;
- } else {
- printf("Error (line %d)\n",lineno);
- printf("Unknown command \"%s\" in OMMM.CFG file\n",tok);
- exit(1);
- }
- }
- fclose(cfg);
- cfg = NULL;
- putchar('\n');
- }
-
- /*--------------------------------------------------------------------------*/
- /* MAIN */
- /*--------------------------------------------------------------------------*/
-
- void
- main(int argc,char * argv[])
- {
- register int i;
- register char * sptr;
- char sched1[2];
- long t1;
- struct tm * t2;
-
- fprintf(stderr,"oMMM [%s] - Copyright 1989 BS Software; All rights reserved\n",VERSION);
- fprintf(stderr,"Amiga Version %d.%d beta\n", Version, Revision);
- fprintf(stderr,"Originally ported by Roland Schwefel (2:246/3.103)\n");
- fprintf(stderr,"Bug fixes & corrections by Maximilian Hantsch (2:310/6)\n\n");
-
- # ifdef TURBO_C
- directvideo = 0;
- # endif
-
- if (argc<2)
- extended_help();
-
- dta.fib=NULL;
-
- getcwd(info_path,79);
- add_backslash(info_path);
-
- date_conv = 0;
- our_zone = 0;
- holding_path[0]=message_path[0]=sched1[0]=route_file[0]=pre_route[0] = 0;
-
- load_cfg_file();
-
- for(i=1; i<argc; i++) {
- sptr = argv[i];
- if (sptr[0]=='-') {
- switch(toupper(sptr[1])) {
-
- case '?':
- version_identifier();
- break;
-
- case 'A':
- pkarc = 1;
- break;
-
- case 'C':
- sptr+=2;
- strcpy(route_file,sptr);
- fancy_str(route_file);
- break;
-
- case 'D':
- date_conv = 0;
- break;
-
- case 'F':
- normalize = 1;
- break;
-
- case 'G':
- use_gates = 1;
- break;
-
- case 'H':
- sptr+=2;
- strcpy(holding_path,sptr);
- add_backslash(holding_path);
- break;
-
- case 'I':
- sptr+=2;
- strcpy(info_path,sptr);
- fancy_str(info_path);
- break;
-
- case 'J':
- never_gate = 1;
- break;
-
- case 'K':
- puts("-k not fully supported yet");
- keepmsgs = 1;
- break;
-
- case 'M':
- sptr+=2;
- strcpy(message_path,sptr);
- add_backslash(message_path);
- break;
-
- case 'N':
- noforward = 1;
- break;
-
- case 'O':
- oldstyle = 1;
- break;
-
- case 'P':
- sptr+=2;
- strcpy(pre_route,sptr);
- fancy_str(pre_route);
- break;
-
- case 'Q':
- printf("Quiet mode\n");
- fflush(stdout);
- quiet_mode = 1;
- break;
-
- case 'S':
- sptr+=2;
- sched1[0] = (char) toupper(*sptr);
- sched1[1] = '\0';
- break;
-
- # ifdef TURBO_C
- case 'V':
- directvideo = 1;
- break;
- # endif
-
- case 'Z':
- sptr+=2;
- our_zone = atoi(sptr);
- break;
-
- default:
- extended_help();
- }
- } else
- extended_help();
- }
-
- errno = 0;
-
- if (!info_path[0]) {
- printf("No Ommm Infofile specified.\n");
- exit(1);
- }
-
- if (!message_path[0]) {
- printf ("No MESSAGE PATH specified.\n");
- exit(1);
- }
-
- if (!holding_path[0]) {
- printf("No HOLD PATH specified.\n");
- exit(1);
- }
-
-
- if (sched1[0])
- printf("oMMM processing schedule '%c' ", sched1[0]);
-
- if (!quiet_mode) {
- printf("with\n");
- printf("Infofile: %s\n",info_path);
- printf("Message path: %s\n",message_path);
- printf("Hold path: %s\n",holding_path);
- printf("Route file: %s\n",route_file);
-
- printf("oMMM will %snormalize the holding area first\n", normalize?"":"not ");
- printf("oMMM will %sforward messages for other systems\n", noforward?"not ":"");
- printf("oMMM will %suse old style ARCmail names\n", oldstyle?"":"not ");
- printf("oMMM will %sgate route interzone messages\n", never_gate?"never ":(use_gates?"":"not "));
- printf("oMMM will use %s to pack ARCmail\n",pkarc?"pkarc":"arca");
- } else {
- printf("\n");
- }
-
- getnet(info_path);
-
- if (!quiet_mode)
- printf("Primary address is %d:%d/%d\n",our_zone,OURNET,OURNODE);
-
- fflush(stdout);
-
- cur.net = ctlnet[0].net;
- cur.node = ctlnet[0].node;
-
- /* Set up the data for the current time stamp */
-
- t1 = time(NULL);
- t2 = localtime (&t1);
- sprintf (nowtime, "%02d %3.3s %02d %02d:%02d:%02d",
- t2->tm_mday, _months[t2->tm_mon], t2->tm_year,
- t2->tm_hour, t2->tm_min, t2->tm_sec);
-
- if (normalize)
- make_normal(our_zone,"*.N*",'O',1);
- if (pre_route[0])
- do_routing (pre_route,'\0');
-
- if (scan_messages())
- make_bundle();
-
- do_routing(route_file,(unsigned char)sched1[0]);
- printf("\n");
- }
-
-
- /*-------------------------------------------------------------------------*/
- /* ID: 449.1@12710 Last Changed: 08 Apr 1990 15:53:42 by max */
-