home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------------------*/
- /* */
- /* Module Name: AMAXCLR.C */
- /* Program Name: AMAX */
- /* Revision: 2.xx */
- /* Purpose: Maintain Undialable Systems List */
- /* 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 <dir.h>
- #include "amax.h"
-
- void clr();
- void add_undialable();
-
- void clr()
- {
- FILE *stream;
-
- int done;
- int tempnet;
- int tempnode;
- int x;
- int count = 0;
-
- unsigned char search[65];
- unsigned char filename[65];
- unsigned char stuff[15];
- unsigned char out[100];
- unsigned char info[70];
-
- unsigned char ch = 0x00;
-
- struct ffblk ffblk;
-
-
- cls();
- output("$1AMAX $4Maintain Undialable Systems List$0");
- cursor(2, 0);
- output("$1C$0)lear Undialables, or $1A$0)dd Undialable? ");
-
- ch = menu_select("CA\x1B");
- aputch(ch);
- if (ch == 0x1B) return;
- if (ch == 'A') {
- add_undialable();
- return;
- }
- bottomcls(2);
- cursor(2, 0);
-
- ch = 0x00;
-
- strcpy(search, outbound);
- strcat(search, "*.$$?");
- done = findfirst(search, &ffblk, 0);
- if (done) {
- output("I can't find any call progress entries to clear...press any key...");
- agetch();
- return;
- }
- while (! done) {
- ch = NULL;
- strcpy(filename, outbound);
- strcat(filename, ffblk.ff_name);
- strncpy(stuff, ffblk.ff_name, 8);
- stuff[8] = 0x00;
- tempnet = extractnet(stuff);
- tempnode = extractnode(stuff);
- strcpy(info, lookinfo(tempnet, tempnode), 0);
- stream = fopen(filename, "rb");
- if (stream != NULL) {
- x = getw(stream);
- fclose(stream);
- }
- else x = 0;
-
- if (count == 7) {
- bottomcls(2);
- cursor(2, 0);
- count = 0;
- }
- sprintf(out, "%u/%u %s\r\n Has %u No Answer(s), %c Bad Connects...Clear? ", tempnet, tempnode, info, x, filename[strlen(filename) - 1]);
- output(out);
- ++count;
- ch = menu_select("NY\x1B");
- if (ch == 0x1B) return;
- if (ch == 'Y') {
- if (! unlink(filename)) output(" Cleared Successfully\r\n\r\n");
- else output(" Cleared Unsuccessfully\r\n\r\n");
- }
- else output(" Not Cleared\r\n\r\n");
- done = findnext(&ffblk);
- }
- output("Press any key to continue...");
- agetch();
- return;
- }
-
- void add_undialable()
- {
- FILE *stream;
-
- char input[50] = "";
- char system[50] = "";
- char hexname[20] = "";
- char info[70] = "";
- char pass[100] = "";
- char out[100] = "";
-
- char ch;
-
- int to_net;
- int to_node;
- int done;
-
- struct ffblk ffblk;
-
- bottomcls(2);
- cursor(2, 0);
-
- output("System to Mark <net/node> ");
- vpanel(45);
- getln(input, 45);
-
- strcpy(system, input);
-
- if (strlen(system) == 0) return;
-
- if (strchr(system, '/') == NULL) {
- strcpy(system, findaddress(input));
- if (strlen(system) == 0) {
- output("\r\nExpected a Sysop name or node address in the form NET/NODE...press a key...");
- agetch();
- return;
- }
- }
-
- strcpy(hexname, parseaddress(system));
-
- to_net = extractnet(hexname);
- to_node = extractnode(hexname);
-
- strcpy(info, lookinfo(to_net, to_node, 0));
- sprintf(out, " Looks Like: %s\r\n\r\n", info);
- if (usenl) output(out);
-
- strcpy(pass, outbound);
- strcat(pass, hexname);
- strcat(pass, ".$$?");
-
- output("Create an undialable for this system? ");
- ch = menu_select("YN\x1B");
- aputch(ch);
- if (ch == 0x1B || ch == 'N') return;
-
- done = findfirst(pass, &ffblk, 0);
-
- if (! done) {
- output("\r\n\r\nUndialable entry already exists. Overwrite? ");
- ch = menu_select("YN\x1B");
- aputch(ch);
- if (ch != 'Y') return;
- strcpy(pass, outbound);
- strcpy(pass, ffblk.ff_name);
- unlink(pass);
- }
-
- strcpy(pass, outbound);
- strcat(pass, hexname);
- strcat(pass, ".$$9");
-
- stream = fopen(pass, "wb");
- if (! stream) return;
- putw(0, stream);
- fclose(stream);
- return;
-
- }
-
-