home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------------------*/
- /* */
- /* Module Name: AMAX.C */
- /* Program Name: AMAX */
- /* Revision: 2.xx */
- /* Purpose: Primary Program Module */
- /* Programmer: Alan D. Bryant */
- /* */
- /* Copyright (C) 1988, 89, 90, 92 Alan D. Bryant, All Rights Reserved. */
- /* */
- /* NOTICE: This source code is copyrighted material. You are granted a */
- /* limited license to use and distribute the code. The complete text of */
- /* the license can be found in the document LICENSE.DOC which accompanies */
- /* this source code, or can be obtained directly from the author. */
- /* */
- /* Inquiries regarding this package should be directed to: */
- /* */
- /* AMAX */
- /* Alan D. Bryant */
- /* P. O. Box 101612 */
- /* Denver, CO 80250 */
- /* USA */
- /* */
- /*---------------------------------------------------------------------------*/
-
- #include <stdio.h>
- #include <dos.h>
- #include <dir.h>
- #include <sys\stat.h>
- #include <alloc.h>
- #include <time.h>
- #include "amax.h"
-
- void display_header(char *, int);
- void display_warning(void);
- int keycomp(int *, int, int *, int);
-
-
- Cbtree *sysopindex; // pointer to sysop index
- Cbtree *nodexindex; // pointer to node index
- FILE *nodexdata; // pointer to nodex data
-
- Item item; // btree stuff
- int status;
-
-
-
- unsigned char outbound[80];
- unsigned char orig_outbound[80];
- unsigned char nodelist[80];
- unsigned char series[80];
- unsigned char sysname[100];
- unsigned int entries;
- char direct = 0;
- int zone_num = 0;
- int our_zone = 0;
- char tearline = 1;
- int net = -1;
- int node = -1;
- char disptime = 0;
- char unarctype = 0; /* 0 = arce, 1 = pkxarc, 2 = pak */
- char displzero = 0;
- char usenl = 1;
- char usecolor = 1;
- char extkey = 0;
- char series_pos = 0;
- unsigned char nlflags = 3;
-
- main(int argc, char *argv[])
- {
-
- /* ----------------------------------------------- */
- /* declarations */
- /* ----------------------------------------------- */
-
- FILE *stream;
-
- int offset;
- unsigned int i;
- unsigned int x;
- int y;
- int done;
- int file_status;
- int alias_zone = 0; /* used to id zone for alias addresses only */
-
- int a = 0;
- int b = 0;
- int c = 0;
- int d = 0;
- int arcnet = -1;
- int arcnode = -1;
-
- struct stat f;
- struct ffblk ffblk;
- time_t foobarn;
-
- struct binfile {
- char ident[35];
- char binkvar[50];
- char direct;
- char bypass;
- char packer[100];
- char courtesy;
- char tearline;
- char sortmode;
- char selection[5];
- char unarctype;
- char displzero;
- char usenl;
- char ARCmail;
- char noselect;
- char usecolor;
- char extkey;
- } w;
-
- unsigned char ch;
- char bypass = 0;
- char noselect = 0;
- char courtesy = 0;
- char *binkley;
-
- char sortmode = 'A';
- char addr = 0;
- unsigned char point[15] = "";
- unsigned char *prompt_pointer;
- unsigned char prompt[250] = "";
- unsigned char *comspec_pointer;
- unsigned char comspec[100] = "";
- unsigned char binkvar[50] = "";
- unsigned char packer[100] = "";
- unsigned char string[100] = "";
- unsigned char out[100] = "";
- unsigned char item[255] = "";
- unsigned char eolarea[3] = "";
- unsigned char zone[3] = "";
- unsigned char boss[15] = "";
- unsigned char address[25] = "";
- unsigned char privatenet[10] = "";
- unsigned char sysop[80] = "";
- unsigned char zone_name[6] = "";
- unsigned char selection[5] = "";
- unsigned char hexname[15] = "";
- unsigned char ARCmail = 1;
- unsigned char statbox = 0;
- unsigned char alt_address[9][25];
- unsigned char dummyprompt[3] = "C>";
- char writechange = 0;
-
- int value;
- int addr_count = 0;
-
- char fileopen[60];
-
- /* ----------------------------------------------- */
- /* binary config file loading */
- /* ----------------------------------------------- */
-
- strcpy(w.ident, "AMAX Binary Config File Ver. 1.2\r\n\x1A");
-
- /* binary file version stored in previous line, and below!!! */
-
- stream = fopen("amax.cfg", "rb");
- if (stream) {
- fread(&w, sizeof(struct binfile), 1, stream);
- if (! strstr(w.ident, "1.2")) {
- output("AMAX: Incompatible version of AMAX.CFG! Delete and resave!\r\n\r\n");
- fclose(stream);
- exit(1);
- }
- strcpy(binkvar, w.binkvar);
- direct = w.direct;
- bypass = w.bypass;
- strcpy(packer, w.packer);
- courtesy = w.courtesy;
- tearline = w.tearline;
- sortmode = w.sortmode;
- strcpy(selection, w.selection);
- unarctype = w.unarctype;
- displzero = w.displzero;
- usenl = w.usenl;
- ARCmail = w.ARCmail;
- noselect = w.noselect;
- usecolor = w.usecolor;
- extkey = w.extkey;
- fclose(stream);
- }
-
- /* ----------------------------------------------- */
- /* general junk */
- /* ----------------------------------------------- */
-
- /* build value for prompt for exit to DOS */
-
- prompt_pointer = (char *) getenv("PROMPT");
- strcpy(prompt, "PROMPT=");
- strcat(prompt, "Enter \"EXIT\" to return to AMAX.$_");
- if (prompt_pointer) strcat(prompt, (char *) prompt_pointer);
- else {
- dummyprompt[0] = getdisk() + 65;
- strcat(prompt, dummyprompt);
- }
- if (! strstr(prompt_pointer, "AMAX")) putenv(prompt);
-
- /* get and store comspec */
-
- comspec_pointer = (char *) getenv("COMSPEC");
- if (comspec_pointer) strcpy (comspec, comspec_pointer);
- else strcpy(comspec, "COMMAND");
-
- /* read in version for display */
-
- sprintf(string, "$1AMAX $4Version %s $0", VERSION);
-
- /* get environment variable; if there use it, otherwise, curr dir */
-
- binkley = (char *) getenv("BINKLEY");
- strcpy(binkvar, binkley);
- if (strlen(binkvar) != 0) {
- if (binkvar[strlen(binkvar) - 1] != 0x5C) strcat(binkvar, "\\");
- }
- strcat(binkvar, "binkley.cfg");
-
-
- /* ----------------------------------------------- */
- /* command line argument parser */
- /* ----------------------------------------------- */
-
- if (argc > 1) {
- for (y = 1; y < argc; y++) {
- if (argv[y][1] == 'c' || argv[y][1] == 'C') {
- for (x = 0; x < strlen(argv[y]); x++) {
- binkvar[x] = argv[y][x + 2];
- }
- binkvar[x] = NULL;
- }
- if (argv[y][1] == 'g' || argv[y][1] == 'G') {
- for (x = 0; x < strlen(argv[y]); x++) {
- series[x] = argv[y][x + 2];
- }
- series[x] = NULL;
- strupr(series);
- }
- if (argv[y][1] == 'p' || argv[y][1] == 'P') {
- for (x = 0; x < strlen(argv[y]); x++) {
- packer[x] = argv[y][x + 2];
- }
- packer[x] = NULL;
- }
- if (argv[y][1] == 'd' || argv[y][1] == 'D') {
- direct = 1;
- }
- if (argv[y][1] == 'k' || argv[y][1] == 'K') {
- selection[0] = argv[y][2];
- selection[1] = 0x00;
- }
- if (argv[y][1] == 'f' || argv[y][1] == 'F') {
- strcpy(out, &argv[y][2]);
- nlflags = atoi(out);
- if (nlflags == 0) nlflags = 3;
- }
- if (argv[y][1] == 'u' || argv[y][1] == 'U') {
- unarctype = argv[y][2];
- unarctype = unarctype - 48;
- if (unarctype < 0 || unarctype > 3) unarctype = 0;
- }
- if (argv[y][1] == 's' || argv[y][1] == 'S') {
- sortmode = toupper(argv[y][2]);
- }
- if (argv[y][1] == 'b' || argv[y][1] == 'B') {
- bypass = 1;
- }
- if (argv[y][1] == 't' || argv[y][1] == 'T') {
- tearline = 0;
- }
- if (argv[y][1] == 'i' || argv[y][1] == 'I') {
- noselect = 1;
- }
- if (argv[y][1] == 'e' || argv[y][1] == 'E') {
- extkey = 1;
- }
- if (argv[y][1] == 'l' || argv[y][1] == 'L') {
- usecolor = 0;
- }
- if (argv[y][1] == 'z' || argv[y][1] == 'Z') {
- displzero = 1;
- }
- if (argv[y][1] == 'm' || argv[y][1] == 'M') {
- courtesy = 1;
- }
- if (argv[y][1] == 'a' || argv[y][1] == 'A') {
- ARCmail = 0;
- }
- if (argv[y][1] == 'n' || argv[y][1] == 'N') {
- usenl = 0;
- }
- if (argv[y][1] == '?') {
- usecolor = 0;
- output("\r\n\r\n\r\n\r\n");
- output(string);
- output("\r\nCopyright (C) 1988, 89, 90, 92 Alan D. Bryant, All Rights Reserved\r\n\r\n");
- output("Optional command line parameters:\r\n\r\n");
- output(" $2-a $0Exclude compressed mail from outbound listing.\r\n");
- output(" $2-b $0Bypass initial start-up; use default address.\r\n");
- output(" $2-c $0Designate alternate configuration filespec.\r\n");
- output(" $2-d $0Use direct hardware screen writes. \r\n");
- output(" $2-e $0Use extended keyboard calls.\r\n");
- output(" $2-f $0Designate nodelist parts to use.\r\n");
- output(" $2-g $0Specify grouping for batch command processing.\r\n");
- output(" $2-i $0Ignore address selection (use primary).\r\n");
- output(" $2-k $0Select 'Address' statement default.\r\n");
- output(" $2-l $0Do not change color attributes (color off).\r\n");
- output(" $2-m $0Create courtesy message for file requests.\r\n");
- output(" $2-n $0Operate in 'nodelist-less' mode.\r\n");
- output(" $2-p $0Designate packer filespec.\r\n");
- output(" $2-s $0Outbound examine sort mode.\r\n");
- output(" $2-t $0Omit tearline from messages.\r\n");
- output(" $2-u $0Select ARCmail unpacking program.\r\n");
- output(" $2-z $0Display zero-length compressed mail.\r\n");
- output("\r\nTo continue, ");
- pressanykey();
- output("\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n");
- output(string);
- output("\r\n\r\nCommand line example:\r\n\r\n");
- output(" amax -cc:\\opus\\mybink.cfg -d -b -ppack.bat -m -t -sa -a -k1 -u0 -z -n \r\n\r\n");
- output("NOTE: All parameters can be used alone, in any combination, or not at all.\r\n\r\n");
- output("NOTE: Direct screen writes require 100% IBM-PC compatible hardware.\r\n\r\n");
- output("\"IBM-PC\" is a trademark of Int'l. Business Machines Corp.\r\n\r\n\r\n\r\n");
- exit(0);
- }
- }
- }
-
- /* This should remain out of line until a command line switch is present
- for remote operation or something....
-
- if (! direct) {
- printf("\x1B[6n");
- if (! kbhit()) {
- output("\r\nAMAX: ANSI.SYS must be loaded. See DOS manual for details.\r\n\r\n");
- exit(1);
- }
- while (kbhit()) agetch();
- }
-
- */
-
-
-
-
- /* we require DOS level 3 */
-
- if (_osmajor < 3) {
- output("\r\nAMAX: DOS 3.x or higher required.\r\n\r\n");
- exit(1);
- }
-
- /* start screen display */
-
- cls();
- output(string);
- output("\r\nCopyright (C) 1988, 89, 90, 92 Alan D. Bryant, All Rights Reserved\r\n\r\n");
- output("Refer to program documentation for complete licensing information.\r\n\r\n");
- if (! bypass) {
- output(" --------------------------------------------------------\r\n");
- output(" $1WARNING! YOU USE AMAX ENTIRELY AT YOUR OWN RISK!$0\r\n");
- output(" --------------------------------------------------------\r\n");
- output(" The author will NOT be responsible for any loss of data, \r\n");
- output(" loss of business, loss of monies, or any other damages \r\n");
- output(" resulting from the use of, or inability to use AMAX. By \r\n");
- output(" operating this program, you accept and acknowledge \r\n");
- output(" responsibility IN FULL for all occurances related to \r\n");
- output(" your use of this program. In any jurisdiction where \r\n");
- output(" such limitation of liability is restricted or forbidden, \r\n");
- output(" this program IS NOT licensed for legal use.\r\n\r\n");
- output("Press any key to continue... ");
- agetch();
- }
- else {
- output("One moment please...\r\n\r\n");
- sleep(1);
- }
-
- if (courtesy) display_warning();
-
-
- bottomcls(2);
- cursor(3, 0);
-
-
-
- /* ----------------------------------------------- */
- /* configuration file handler */
- /* ----------------------------------------------- */
-
- if (! bypass) output("AMAX: Finding configuration file...\r\n");
-
- /* config file stuff */
-
- stream = fopen(binkvar, "rb");
- if (stream == NULL) {
- output("\r\nCannot find configuration file...refer to the docs for information!");
- exit(1);
- }
- if (! bypass) output("AMAX: Reading configuration file...\r\n");
-
- /* read config file */
-
- while(! feof(stream)) {
- fscanf(stream, "%s", item);
- strupr(item);
- if (! strncmp(item, ";", 1)) {
- fgetln(item, sizeof(item), eolarea, stream);
- continue;
- }
- if (! strcmp(item, "ADDRESS") || ! strcmp(item, "NODE")) {
- if (! addr) fscanf(stream, "%s", address);
- else {
- if (addr_count < 9) {
- fscanf(stream, "%s", alt_address[addr_count]);
- ++addr_count;
- }
- }
- addr = 1;
- continue;
- }
- if (! strcmp(item, "PRIVATENET")) {
- fscanf(stream, "%s", privatenet);
- continue;
- }
- if (! strcmp(item, "HOLD") || ! strcmp(item, "OUTBOUND")) {
- fscanf(stream, "%s", outbound);
- if (! check_backslash(outbound)) {
- strcat(outbound, "\\");
- }
- strcpy(orig_outbound, outbound);
- continue;
- }
- if (! strcmp(item, "NODELIST")) {
- fscanf(stream, "%s", nodelist);
- if (! check_backslash(nodelist)) {
- strcat(nodelist, "\\");
- }
- continue;
- }
- if (! strcmp(item, "ZONE")) {
- fscanf(stream, "%s", zone);
- continue;
- }
- if (! strcmp(item, "POINT")) {
- if (! addr) fscanf(stream, "%s", point);
- continue;
- }
- if (! strcmp(item, "BOSS")) {
- if (! addr) fscanf(stream, "%s", boss);
- continue;
- }
- if (! strcmp(item, "SYSOP") || ! strcmp(item, "ADMIN")) {
- ch = 0x20;
- while (ch == 0x20) {
- ch = getc(stream);
- }
- ungetc(ch, stream);
- fgetln(sysop, sizeof(sysop), eolarea, stream);
- continue;
- }
- if (! strcmp(item, "SYSTEM")) {
- ch = 0x20;
- while (ch == 0x20) {
- ch = getc(stream);
- }
- ungetc(ch, stream);
- fgetln(sysname, sizeof(sysname), eolarea, stream);
- continue;
- }
-
-
- fgetln(item, sizeof(item), eolarea, stream);
- }
-
- fclose(stream);
-
-
- /* ---------------------------------------- */
- /* check for nodelist */
- /* ---------------------------------------- */
-
- output("AMAX: Checking for nodelist files...\r\n");
- strcpy(out, nodelist);
- strcat(out, "NODEX.DAT");
- done = findfirst(out, &ffblk, 0);
- if (done) {
- output("AMAX: Version 7 nodelist not found; operating in \"nodelistless\" mode\r\n");
- usenl = 0;
- }
- else {
- output("AMAX: Located what looks like a Version 7 nodelist...\r\n");
-
- if (cbinit(DEFAULT_BUFCNT, DEFAULT_BUFSIZE) != OK) {
- output("AMAX: Btree system init failure\r\n");
- exit(0);
- }
-
-
- nodexdata = fopen(out, "rb");
- if (nodexdata == NULL) {
- output("AMAX: Nodelist data file init failure\r\n");
- exit(0);
- }
- strcpy(out, nodelist);
- strcat(out, "NODEX.NDX");
- nodexindex = cbopen(out, keycomp);
- if (nodexindex == NULL) {
- output("AMAX: Btree node index init failure\r\n");
- exit(0);
- }
- strcpy(out, nodelist);
- strcat(out, "SYSOP.NDX");
- sysopindex = cbopen(out, DEFAULT_COMPARE);
-
- }
-
-
-
-
-
-
-
-
- /* ----------------------------------------------- */
- /* address parsing */
- /* ----------------------------------------------- */
-
- /* The general concept of the address parser is as follows. */
- /* boss holds our network address (string form) with zone */
- /* designator. point holds our fake address, if any, with */
- /* zone designation. Neither boss nor point come out of the */
- /* config file with a zone, so we add one later. net is an */
- /* int with our net number, node has our node number, and */
- /* our_zone has out zone number. If we come out the config */
- /* file without boss or point, we use address and privatenet */
- /* to construct them. */
-
- /* if we are using the 'address' verb */
-
- if (addr) {
- if (privatenet[0]) {
-
- /* we're here with 'address' AND 'privatenet' */
- /* copy privatenet to point, and add the point */
- /* node (fake) from address */
-
- strcpy(point, privatenet);
- strcat(point, "/");
-
- /* !!!!! this code is suspect !!!!! */
-
- strcat(point, strchr(address, '.') + sizeof(char));
-
- /* if no point address, then make point null */
-
- if (strlen(point) == strlen(privatenet) + 1) point[0] = 0x00;
-
- /* if point node number begins with 0, make point null */
-
- if (point[strlen(privatenet) + 1] == '0') point[0] = 0x00;
- }
-
- /* we're here with 'address' and with or without 'privatenet' */
-
- add_parse(address, &a, &b, &c, &d);
-
- if (a) sprintf(zone, "%d", a);
- sprintf(boss, "%d/%d", b, c);
-
- arcnet = b;
- arcnode = c;
-
- if (! privatenet[0]) strcpy(point, boss);
-
- }
-
- /* we must have a zone from someplace */
-
- if (! zone[0]) {
- output("AMAX: Zone not specified by 'Zone' or 'Address' statements. Aborting...\r\n\r\n");
- exit(1);
- }
-
- /* if we do have a point, then put the zone into it */
-
- if (strlen(point) > 0) {
- strcpy(out, point);
- strcpy(point, zone);
- strcat(point, ":");
- strcat(point, out);
- }
-
- /* set value for our_zone to our zone number */
-
- our_zone = atoi(zone);
-
- /* set current zone number to our zone number */
-
- zone_num = our_zone;
-
- /* place objects into system_name variable */
-
- /* find, extract, set values for node and net numbers */
-
- if (strlen(point) > 0) {
- strcpy(hexname, parseaddress(point));
- node = extractnode(hexname);
- net = extractnet(hexname);
- }
-
- else {
- strcpy(hexname, parseaddress(boss));
- node = extractnode(hexname);
- net = extractnet(hexname);
- }
-
-
-
-
-
-
-
-
-
-
- /* ----------------------------------------------- */
- /* alternate address handler */
- /* ----------------------------------------------- */
-
- alias_zone = our_zone;
-
- if (addr_count > 0) {
- if (! selection[0] && ! noselect) {
- output("AMAX: Alternate addresses found...\r\n\r\n");
- if (point[0]) {
- sprintf(out, " 1 - %s\r\n", point);
- output(out);
- }
- else {
- sprintf(out, " 1 - %d:%s\r\n", our_zone, boss);
- output(out);
- }
- for (x = 0; x < addr_count; x++) {
- sprintf(out, " %d - %s\r\n", x + 2, alt_address[x]);
- output(out);
- }
- output("\r\n Which address to use? Select by line number... ");
- vpanel(2);
- getln(selection, 2);
- }
- if (noselect) strcpy(selection, "1");
- if (strlen(selection) == 0) x = 0;
- x = atoi(selection);
- if (x > 1 && x < addr_count + 2) {
- add_parse(alt_address[x - 2], &a, &b, &c, &d);
- net = b;
- node = c;
- alias_zone = a;
- if (alias_zone == 0) alias_zone = our_zone;
- newzone(alias_zone);
- }
- }
-
- /* ----------------------------------------------- */
- /* menu handler */
- /* ----------------------------------------------- */
-
- ch = ' ';
-
- offset = 0;
-
- /* add address to sysname for origin line */
-
- sprintf(out, " (%d:%d/%d)", alias_zone, net, node);
- strcat(sysname, out);
-
-
- while (ch != 'q' && ch != 'Q') {
- cls();
- display_header(string, alias_zone);
- cursor(offset + 2, 0);
- if (statbox == 0) {
- output("Main Menu $3Dir: ");
- strupr(outbound);
- output(outbound);
- cursor(2, 53);
- output("$0Press \"-\" to Restart AMAX\r\n\r\n");
- sprintf(out, " $1V$0)iew $0View/Edit Outbound Area for Zone %d\r\n", zone_num);
- outputi(out);
- outputi(" $1R$0)equest $0Request Files from a System\r\n");
- outputi(" $1S$0)end $0Send a File to a System\r\n");
- outputi(" $1E$0)nter $0Enter a Message Directly to Outbound Area\r\n");
- outputi(" $1L$0)ist Send $0Send Message or File to Mailing List Members\r\n");
- outputi(" $1P$0)oll $0Build Attach to Poll a System\r\n");
- outputi(" $1U$0)ndialable $0Maintain Undialable Systems List\r\n");
- if (usenl) outputi(" $1D$0)isplay $0Display Nodelist Record\r\n");
- outputi(" $1Z$0)one $0Change Current Zone\r\n");
- outputi(" $1J$0)ump $0Jump to DOS Temporarily\r\n");
- outputi(" $1A$0)lternate $0Display Alternate Menu\r\n");
- outputi(" $1O$0)ptions $0Display Options Menu\r\n");
- outputi(" $1Q$0)uit $0Quit AMAX\r\n\r\n");
- }
- if (statbox == 1) {
- outputi("Alternate Menu\r\n\r\n");
- if (packer[0]) outputi(" $1P$0)acker $0Invoke Packer Designated on Command Line\r\n");
- outputi(" $1N$0)otes $0Notes on AMAX\r\n");
-
- outputi(" $1W$0)rite $0Change to ");
- if (direct) outputi("DOS Screen Writes (Currently BIOS)");
- else outputi("BIOS Screen Writes (Currently DOS) !!! DANGER !!!");
- outputi("\r\n");
-
- outputi(" $1C$0)ourtesy $0Turn File Request Courtesy Message ");
- if (courtesy) outputi("OFF (Currently ON)");
- else outputi("ON (Currently OFF)");
- outputi("\r\n");
-
-
- outputi(" $1T$0)earline $0Turn Message Entry Tearline ");
- if (tearline) outputi("OFF (Currently ON)");
- else outputi("ON (Currently OFF)");
- outputi("\r\n");
-
- outputi(" $1B$0)inary $0Save Settings to Binary Config File \r\n");
-
- outputi(" $1R$0)eturn $0Return to Main Menu\r\n\r\n");
- }
-
- if (statbox == 2) {
- outputi("Options Menu\r\n\r\n");
-
- outputi(" $1S$0)ort $0Change Outbound Sort to ");
- if (sortmode == 'A') outputi("TYPE (Currently ADDRESS)");
- if (sortmode == 'T') outputi("FLAVOR (Currently TYPE)");
- if (sortmode == 'F') outputi("NONE (Currently FLAVOR)");
- if (sortmode == 1) outputi("ADDRESS (Currently NONE)");
- outputi("\r\n");
-
-
- outputi(" $1M$0)ail $0Turn Compressed Mail Display ");
- if (ARCmail) outputi("OFF (Currently ON)");
- else outputi("ON (Currently OFF)");
- outputi("\r\n");
-
- outputi(" $1Z$0)ero $0 ");
- if (displzero) outputi("$0DO NOT");
- else outputi("$0DO");
- outputi(" Display Zero-Length Compressed Mail ");
- if (displzero) outputi("(Currently DO)\r\n");
- else outputi("(Currently DO NOT)\r\n");
-
-
- outputi(" $1R$0)eturn $0Return to Main Menu\r\n\r\n");
-
- }
-
- outputi("Make a selection from the menu. Your choice... ");
-
- disptime = 1;
-
- if (statbox == 0 && ! usenl) ch = menu_select("VRSELPUZJAOQ\x1B\r-");
- if (statbox == 0 && usenl) ch = menu_select("VRSELPUDZJAOQ\x1B\r-");
- if (statbox == 1 && packer[0]) ch = menu_select("PNWCTRB\x1B\r");
- if (statbox == 1 && ! packer[0]) ch = menu_select("NWCTRB\x1B\r");
- if (statbox == 2) ch = menu_select("SMRZ\x1B\r");
-
- disptime = 0;
- cursor(19, 0);
-
- switch (ch) {
- case '\r':
- case 0x1B:
- if (statbox == 0) ch = 'Q';
- else statbox = 0;
- break;
- case '-':
- execl(argv[0], argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]);
- output("Error reinvoking AMAX. ");
- output(reterror());
- output(" Press any key... ");
- agetch();
- break;
- case 'J':
- clearline();
- output("Jumping to DOS. Type \"EXIT\" at the DOS prompt to return to AMAX.\r\n\r\n");
- system(comspec);
- break;
- case 'R':
- if (statbox == 0) {
- freq(courtesy, net, node, sysop);
- break;
- }
- else {
- statbox = 0;
- break;
- }
- case 'V':
- ch = 0x01;
- while (ch) {
- ch = chek(arcnet, arcnode, ARCmail, outbound, sortmode, ch);
- }
- break;
- case 'U':
- clr();
- break;
- case 'C':
- if (courtesy == 0) courtesy = 1;
- else courtesy = 0;
- if (courtesy) display_warning();
- break;
- case 'D':
- display_nl_info();
- break;
- case 'A':
- statbox = 1;
- break;
- case 'O':
- statbox = 2;
- break;
- case 'S':
- if (statbox == 0) {
- file(NULL, NULL);
- break;
- }
- if (statbox == 2) {
- switch (sortmode) {
- case 1:
- sortmode = 'A';
- break;
- case 'A':
- sortmode = 'T';
- break;
- case 'T':
- sortmode = 'F';
- break;
- case 'F':
- sortmode = 1;
- break;
- }
- }
- break;
- case 'T':
- if (tearline == 0) tearline = 1;
- else tearline = 0;
- break;
- case 'W':
- if (direct == 0) direct = 1;
- else direct = 0;
- writechange = 1;
- break;
- case 'M':
- if (ARCmail == 0) ARCmail = 1;
- else ARCmail = 0;
- break;
- case 'Z':
- if (statbox == 0) {
- clearline();
- output("Input new zone number: ");
- zone_name[0] = 0x00;
- vpanel(4);
- getln(zone_name, 4);
- if (strlen(zone_name) == 0) break;
- newzone(atoi(zone_name));
- break;
- }
- if (statbox == 2) {
- if (displzero == 0) displzero = 1;
- else displzero = 0;
- break;
- }
- case 'E':
- qmsg(net, node, sysop, 0, NULL, NULL);
- break;
- case 'B':
- stream = fopen("amax.cfg", "wb");
- if (stream) {
- strcpy(w.binkvar, binkvar);
- w.direct = direct;
- w.bypass = bypass;
- strcpy(w.packer, packer);
- w.courtesy = courtesy;
- w.tearline = tearline;
- w.sortmode = sortmode;
- strcpy(w.selection, selection);
- w.unarctype = unarctype;
- w.displzero = displzero;
- w.usenl = usenl;
- w.ARCmail = ARCmail;
- w.noselect = noselect;
- w.usecolor = usecolor;
- w.extkey = extkey;
- fwrite(&w, sizeof(struct binfile), 1, stream);
- fclose(stream);
- }
- break;
- case 'L':
- bomb(net, node, sysop);
- break;
- case 'P':
- if (! statbox) {
- poll();
- break;
- }
- else {
- clearline();
- if (strlen(packer) == 0) {
- output("No packer specified on command line...");
- pressanykey();
- }
- else {
- sprintf(out, "Spawning to %s...", packer);
- output(out);
- system(packer);
- output("\r\n\r\nPacker has returned to AMAX...one moment, please...");
- sleep(2);
- cls();
- output(string);
- cursor(offset + 2, 0);
- }
- break;
- }
- case 'N':
- cursor(0, 50);
- output(" ");
-
- minicls();
- cursor(2, 0);
-
- /* output("AMAX has the distinction of being the first program to directly support\r\n");
- output("BinkleyTerm by way of its control file. AMAX endeavors to continue that\r\n");
- output("tradition with periodic updating reflecting the current trends, technology\r\n");
- output("and features of BinkleyTerm itself.\r\n\r\n"); */
-
-
- output("AMAX is a copyrighted computer software program. You are licensed to use the\r\n");
- output("program under certain conditions. These conditions are contained in the\r\n");
- output("documentation that accompanies the program; please refer to the documentation\r\n");
- output("for this licensing information, as well as complete operating instructions.\r\n\r\n");
- output("AMAX, Copyright (C) 1988, 89, 90, 92 Alan D. Bryant, All Rights Reserved.\r\n\r\n");
- output("\"AMAX\" and \"PacketView\" are trademarks of Alan D. Bryant.\r\n\r\n");
- output("PLEASE REFER TO THE DOCUMENTATION FOR IMPORTANT PRODUCT SUPPORT INFORMATION!");
- agetch();
- minicls();
- cursor(2, 0);
- output("Send inquiries, comments and suggestions regarding the AMAX program\r\n");
- output("to:\r\n\r\n");
- output(" AMAX\r\n");
- output(" c/o Alan D. Bryant \r\n");
- output(" P. O. Box 101612\r\n");
- output(" Denver, CO 80250\r\n\r\n");
- output("You may also direct them to FidoNet 1:104/36.0 if you prefer.\r\n\r\n");
- output("Refer to the documentation for policies and procedures regarding your\r\n");
- output("inquiries, comments and suggestions.\r\n");
- agetch();
- break;
- }
- /* minicls(); */
- }
- if (! direct || writechange) printf("\x1B[0m\x1B[0H\x1B[2J");
- if (direct || writechange) {
- if (usecolor) textattr(7);
- clrscr();
- }
- output("\r\nThanks for using AMAX!\r\n\r\n");
- output("If you enjoy and have obtained benefit from using AMAX, please consider\r\n");
- output("sending a donation to your local Humane Society chapter.\r\n\r\n");
- output("If you're considering the addition of a pet to your family, please\r\n");
- output("contact your local Humane Society chapter first, and help prevent\r\n");
- output("the daily destruction of thousands of unwanted animals.\r\n\r\n");
- output("PLEASE! Have your pet spayed or neutered.\r\n\r\n");
- output("Thank you for your support!\r\n\r\n");
- return 0;
- }
-
-
- void display_header(char *string, int alias)
- {
- char displ[100];
-
- sprintf(displ, "$1%s $3Using %d:%d/%d $0", string, alias, net, node);
- output(displ);
- }
-
-
-
- void display_warning(void)
- {
- minicls();
- cursor(3, 0);
-
- output("$1WARNING!!! $0You have enabled the courtesy message function which will\r\n");
- output("force the sending of a message for every file request you generate.\r\n");
- output("some Sysops feel that this message is a$2 courtesy$0, letting them know\r\n");
- output("which files are being requested and how often. Others are $2extremely\r\n");
- output("annoyed$0 by such messages, and feel that they unnecessarily \"trash up\"\r\n");
- output("their NetMail message area.\r\n\r\n");
- output("$1USE THIS FEATURE AT YOUR OWN RISK, AND WITH THE UNDERSTANDING THAT SOME\r\n");
- output("PEOPLE MAY BECOME ANNOYED BY YOUR USE OF IT.$0\r\n\r\n");
- output("Press any key to continue...");
- agetch();
- }
-
-
- int keycomp(int *a, int lena, int *b, int lenb)
- {
- if (a[0] < b[0]) return LESS;
- if (a[0] > b[0]) return GREATER;
-
- if (a[1] < b[1]) return LESS;
- if (a[1] > b[1]) return GREATER;
-
- if (a[2] < b[2]) return LESS;
- if (a[2] > b[2]) return GREATER;
-
- return EQUAL;
-
- }
-
-