/*======================================================================* * * * NETEDIT - Program to edit the ExpressNET! CALLOUT dataset. * * * *======================================================================*/ #version $14 #address $7000 #include runtime.h #include bbs_pro.h #define MAXBUFF 3510 #define disk2 2 #define DISK2 $20 #define C_MODEM 5 #define _ACK_ 6 #define _NAK_ 24 #define _EOT_ 4 char callfn [40]; char buffer [MAXBUFF]; /* 26 Entries, each entry is 135 bytes long ---------------------------------------- */ char p_bbs_name [16]; /* name of this BBS */ char p_number [44]; /* number of the BBS */ byte p_baud; /* baud rate */ byte p_secs_to_wait; /* seconds to wait */ card p_usernumber; /* user # on this BBS */ char p_password [16]; /* password */ byte p_lt_date [3]; /* last tried date */ byte p_lc_date [3]; /* last connected date */ byte p_lx_date [3]; /* last transfer date */ byte p_days_to_call [7]; /* 0=sunday (0=no,1=yes)*/ byte p_begin_time; /* low time we can call */ byte p_end_time; /* end time we can call */ byte p_max_retries; /* max calls to make */ byte p_num_retries; /* number times called */ char p_inbases[32]; /* base redirection */ char p_dial_mode; /* 0=tone, 1=pulse */ char p_type; /* 253=normal, 252=hispeed , 251=SmartNET */ char p_filler; /* fill out to 135 */ main() { strcpy (callfn, "Dx:>PRO>NETWORK>SMART.DAT"); callfn [2] = s_netdr; load_call_dataset(); edit_file(); save_call_dataset(); } edit_file() { char temp [5]; byte num; while (1) { main_menu(); get_string (temp, 2, 0, 0); cr_lf(); if (temp [1] == 'q' || temp [1] == 'Q') return; num = valb (temp); if (num > 0 && num < 27) edit_entry (num-1); } } main_menu() { byte x, y; echo(125); cr_lf(); echose (" __SmartNET! Call Editor__"); cr_lf(); x = 1; while (x < 27) { get_board (x-1); if (x < 10) echo (' '); echob (x); echo (' '); y = length (p_bbs_name); if (y == 0) echos ("Empty "); else { echos (p_bbs_name); while (y < 16) { echo (' '); ++y; } } if (x & 1 == 0) cr_lf(); ++x; } cr_lf(); echos (" Q to quit or entry # to edit: "); } edit_entry (byte bn) { char ch; int x, y, z, i; get_board (bn); while (1) { show_board(); ch = upcase (get_key()); echo (ch); cr_lf(); cr_lf(); case (ch) { 'Q' : break; 'T' : { p_bbs_name [0] = 0; p_number [0] = 0; break; } 'A' : { echos ("Name: "); get_string (p_bbs_name, 15, 0, 0); cr_lf(); } 'B' : { echos ("Tone dial?: "); p_dial_mode = 0; if (y_or_n() == 'N') p_dial_mode = 1; echos (" Number: "); get_string (p_number, 40, 0, 0); cr_lf(); } 'C' : { echos ("Baud (0=300, 1=1200, 2=2400, to 5=19200: "); p_baud = get_byte(); } 'D' : { echos ("New wait time: "); p_secs_to_wait = get_byte(); } 'E' : { echos (" SmartNET network?: "); p_type =251; /* same as $fc */ if (y_or_n() == 'N') p_type = 253; } /* Same a $fd */ 'F' : { echos ("Your user number: "); p_usernumber = get_card(); cr_lf(); echos (" password : "); get_string (p_password, 15, 0, 0); cr_lf(); } 'G' : { for (x=0; x < 7; ++x) p_days_to_call [x] = 0; echos ("Call this BBS on Sunday? "); if (y_or_n() == 'Y') p_days_to_call [0] = 1; echos (" Monday? "); if (y_or_n() == 'Y') p_days_to_call [1] = 1; echos (" Tuesday? "); if (y_or_n() == 'Y') p_days_to_call [2] = 1; echos (" Wednesday? "); if (y_or_n() == 'Y') p_days_to_call [3] = 1; echos (" Thursday? "); if (y_or_n() == 'Y') p_days_to_call [4] = 1; echos (" Friday? "); if (y_or_n() == 'Y') p_days_to_call [5] = 1; echos (" Saturday? "); if (y_or_n() == 'Y') p_days_to_call [6] = 1; } 'H' : { do { echos ("Call from hour (0-23): "); p_begin_time = get_byte(); cr_lf(); } while (p_begin_time > 23); do { echos (" until hour (0-24): "); p_end_time = get_byte(); cr_lf(); } while (p_end_time > 24); } 'I' : { echos ("Maximum number of retries: "); p_max_retries = get_byte(); } 'J' : { echos ("Clear these dates? "); if (y_or_n() == 'Y') { for (i=0; i < 3; ++i) { p_lt_date [i] = 0; p_lc_date [i] = 0; p_lx_date [i] = 0; } } } 'K' : { echose ("Redirect messages coming"); cr_lf(); do { echos ("from base (1-31): "); y = get_byte(); cr_lf(); } while (y < 0 || y > 31); --y; do { echos (" to base (1-31): "); z = get_byte(); cr_lf(); } while (z < 0 || z > 31); p_inbases [y] = z; } } /* case */ } put_board (bn); } show_board() { byte x; char temp [10]; echo (125); echos ("[A] BBS Name: "); echose (p_bbs_name); echos ("[B] Number : "); if (p_dial_mode == 0) echos ("(T) "); else echos ("(P) "); echose (p_number); echos ("[C] Baud: "); case (p_baud) { 0 : echos ("300 "); 1 : echos ("1200 "); 2 : echos ("2400 "); 3 : echos ("4800 "); 4 : echos ("9600 "); else : echos ("19200 "); } if (p_secs_to_wait < 15) p_secs_to_wait = 15; echos ("[D] Secs to wait: "); echob (p_secs_to_wait); cr_lf(); echos ("[E] "); if (p_type == 0) p_type = 253; if (p_type ==252) p_type = 251; if (p_type ==253) echos ("Standard "); if (p_type ==252) echos ("HiSpeed "); if (p_type ==251) echos ("SmartNET "); echos ("SmartNET Invoked!"); cr_lf(); echos ("[F] Unsernum/PW: "); echoc (p_usernumber); echo ('/'); echose(p_password); echose("[G] Days to call: S M T W T F S"); echos (" "); for (x=0; x < 7; ++x) if (p_days_to_call [x]) echos ("y "); else echos ("n "); cr_lf(); echos ("[H] Call between hours : "); echob (p_begin_time); echos (" - "); echob (p_end_time); cr_lf(); echos ("[I] Maximum # of retries: "); echob (p_max_retries); cr_lf(); echos ("[J] Last tried : "); display_date (p_lt_date); echos (" Last connected : "); display_date (p_lc_date); echos (" Last packet recv'd: "); display_date (p_lx_date); echose("[K] Incoming Message Redirection"); echose(" ----+----1----+----2----+----3-"); echos (" "); for (x=0; x < 31; ++x) { if (p_inbases [x] < 1 || p_inbases [x] > 31) /* range check */ p_inbases [x] = x + 1; strc (p_inbases [x], temp); if (length (temp) == 1) echo (' '); else echo (temp [1]); } cr_lf(); echos (" "); for (x=0; x < 31; ++x) { strc (p_inbases [x], temp); if (length (temp) == 1) echo (temp [1]); else echo (temp [2]); } cr_lf(); cr_lf(); echos ("Q)uit, T)rash, A-K): "); } display_date (char *d) { if (*d < 10) echo (' '); echob (*d++); echo ('/'); if (*d < 10) echo ('0'); echob (*d++); echo ('/'); if (*d < 10) echo ('0'); echob (*d); cr_lf(); } get_board (byte bn) { char *cp; int ofst; ofst = bn * 135; cp = buffer + ofst; moveblock (&p_bbs_name, cp, 135); /* each entry is 135 bytes */ } put_board (byte bn) { char *cp; int ofst; ofst = bn * 135; cp = buffer + ofst; moveblock (cp, &p_bbs_name, 135); /* each entry is 135 bytes */ } load_call_dataset() { int tbytes; byte x; MIOsuspend(); setblock (buffer, sizeof(buffer), 0); if (open (DISK2, callfn, 4, 0) == OK) { /* open input file? */ blockread (DISK2, buffer, sizeof(buffer)); close (DISK2); } MIOresume(); } save_call_dataset() { int tbytes; MIOsuspend(); if (open (DISK2, callfn, 8, 0) != OK) { /* open input file? */ MIOresume(); echose ("Unable to create SMART.DAT file!"); return; } if (blockwrite (DISK2, buffer, sizeof(buffer)) != sizeof(buffer)) { close (DISK2); MIOresume(); echose ("Error writing SMART.DAT file!"); return; } close (DISK2); MIOresume(); return (1); }