|
|
1.1 root 1: /***************************************************************************
2: * WHMDM.C - Witchaven modem & serial module *
3: * *
4: * - Les Bird 08/09/95 *
5: ***************************************************************************/
6:
7: #include "stdio.h"
8: #include "conio.h"
9: #include "dos.h"
10: #include "graph.h"
11: #include "stdarg.h"
12: #include "string.h"
13: #include "serial.h"
14: #include <memcheck.h>
15:
16: #define SCNSLINKED
17:
18: #define CLKIPS 18
19:
20: #define SCRSIZE 4000
21:
22: #define NUMSETOPTS 6
23:
24: #ifdef SCNSLINKED
25: extern
26: char scntbl[][SCRSIZE];
27: #endif
28:
29: enum {
30: SETSER,
31: SETCOM,
32: SETBPS,
33: SETINITS,
34: SETDIALO,
35: SETANSS,
36: SETDIALS,
37: SETDIALN,
38: DIALMDM
39: };
40:
41: char *setopts[]={
42: "COM PORT:",
43: "BAUD RATE:",
44: "INIT STRING:",
45: "ANSWER STRING:",
46: "DIAL COMMAND:",
47: "PHONE NUMBER:"
48: };
49:
50: #define ANSSLEN 48
51: #define DIALSLEN 48
52: #define DIALNLEN 48
53: #define INITSLEN 48
54:
55: char answerstring[ANSSLEN],
56: dialstring[DIALSLEN],
57: initstring[INITSLEN],
58: mdmresp[1024],
59: dialnumber[DIALNLEN],
60: sbuf[SCRSIZE],
61: *vmem;
62:
63: short connected,
64: oldvmode,
65: quitprog;
66:
67: long bps,
68: comport,
69: comtype=0,
70: dialopt=0;
71:
72: volatile
73: long totalclock;
74:
75: struct serialData sd;
76:
77: void (__interrupt __far *oldtimer)(void);
78:
79: void __interrupt __far
80: newtimer(void)
81: {
82: totalclock++;
83: _chain_intr(oldtimer);
84: }
85:
86: int
87: getBIOSvmode(void)
88: {
89: union REGPACK regs;
90:
91: memset(®s,0,sizeof(union REGPACK));
92: regs.h.ah=0x0F;
93: regs.h.al=0x00;
94: intr(0x10,®s);
95: return(regs.h.al);
96: }
97:
98: void
99: setBIOSvmode(int m)
100: {
101: union REGPACK regs;
102:
103: memset(®s,0,sizeof(union REGPACK));
104: regs.h.ah=0x00;
105: regs.h.al=m;
106: intr(0x10,®s);
107: }
108:
109: void
110: writesettings(void)
111: {
112: FILE *fp;
113:
114: fp=fopen("modem.dat","w");
115: if (fp != NULL) {
116: fprintf(fp,"COM PORT: %d\n",comport);
117: fprintf(fp,"BAUD RATE: %ld\n",bps);
118: fprintf(fp,"INIT STRING: %s\n",initstring);
119: fprintf(fp,"ANSWER STRING: %s\n",answerstring);
120: fprintf(fp,"DIAL COMMAND: %s\n",dialstring);
121: fprintf(fp,"PHONE NUMBER: %s\n",dialnumber);
122: fclose(fp);
123: }
124: }
125:
126: void
127: stripblanks(char *stg)
128: {
129: short i;
130: char buf[80];
131:
132: strcpy(buf,stg);
133: for (i=0 ; i < strlen(buf) ; i++) {
134: if (buf[i] == ' ') {
135: continue;
136: }
137: *stg++=buf[i];
138: }
139: *stg=0;
140: }
141:
142: void
143: readsettings(void)
144: {
145: short i,n;
146: long l;
147: char buf[80],*ptr;
148: FILE *fp;
149:
150: fp=fopen("modem.dat","r");
151: if (fp == NULL) {
152: return;
153: }
154: while (fgets(buf,80,fp) != NULL) {
155: for (i=0 ; i < NUMSETOPTS ; i++) {
156: if ((ptr=strstr(buf,setopts[i])) != NULL) {
157: ptr+=strlen(setopts[i]);
158: switch (i) {
159: case 0: // com port
160: sscanf(ptr,"%d",&n);
161: if (n < 1 || n > 4) {
162: break;
163: }
164: comport=n;
165: break;
166: case 1: // baud rate
167: sscanf(ptr,"%ld",&l);
168: if (l < 2400L || l > 115200L) {
169: break;
170: }
171: bps=l;
172: break;
173: case 2: // init string
174: strcpy(initstring,ptr);
175: initstring[strlen(initstring)-1]=0;
176: stripblanks(initstring);
177: break;
178: case 3: // answer command
179: strcpy(answerstring,ptr);
180: answerstring[strlen(answerstring)-1]=0;
181: stripblanks(answerstring);
182: break;
183: case 4: // dial command
184: strcpy(dialstring,ptr);
185: dialstring[strlen(dialstring)-1]=0;
186: stripblanks(dialstring);
187: break;
188: case 5: // phone number
189: strcpy(dialnumber,ptr);
190: dialnumber[strlen(dialnumber)-1]=0;
191: stripblanks(dialnumber);
192: break;
193: }
194: }
195: }
196: }
197: fclose(fp);
198: }
199:
200: void
201: showscn(char *sname)
202: {
203: #ifndef SCNSLINKED
204: FILE *fp;
205:
206: fp=fopen(sname,"rb");
207: if (fp != NULL) {
208: fread(sbuf,1,SCRSIZE,fp);
209: fclose(fp);
210: movedata(FP_SEG(sbuf),FP_OFF(sbuf),FP_SEG(vmem),FP_OFF(vmem),SCRSIZE);
211: }
212: #else
213: movedata(FP_SEG(scntbl),FP_OFF(scntbl),FP_SEG(vmem),FP_OFF(vmem),SCRSIZE);
214: #endif
215: }
216:
217: void
218: gprintf(FILE *fp,char *fmt,...)
219: {
220: char buf[80];
221: va_list argptr;
222:
223: va_start(argptr,fmt);
224: vsprintf(buf,fmt,argptr);
225: va_end(argptr);
226: _outtext(buf);
227: }
228:
229: void
230: waitsecs(long secs)
231: {
232: long delayclock;
233:
234: delayclock=totalclock+(secs*CLKIPS);
235: while (totalclock < delayclock && !kbhit());
236: }
237:
238: void
239: mdmsendstr(char *stg)
240: {
241: short i;
242:
243: for (i=0 ; i < strlen(stg) ; i++) {
244: writeSer(&sd,stg[i]);
245: }
246: writeSer(&sd,'\r');
247: }
248:
249: void
250: mdmreset(void)
251: {
252: _settextcolor(0);
253: gprintf(stdout,"\nResetting com port..");
254: setDTR(&sd,0);
255: waitsecs(1);
256: setDTR(&sd,1);
257: }
258:
259: void
260: showinstructions(char *stg)
261: {
262: int ctrx;
263:
264: _setbkcolor(1);
265: _settextcolor(14);
266: _settextposition(25,1);
267: gprintf(stdout,"�������������������������������������������������������������������������������");
268: if (strlen(stg) == 0) {
269: return;
270: }
271: ctrx=strlen(stg)/2;
272: _settextposition(25,40-ctrx-1);
273: gprintf(stdout," %s ",stg);
274: }
275:
276: void
277: mdmdial(void)
278: {
279: long c,delayclock,mdmsendcmd,mdmstate=0,more=1,stat,x=0;
280: char cmdstg[80];
281:
282: showinstructions("PRESS ANY KEY TO ABORT");
283: _settextwindow(14,1,24,80);
284: _settextposition(14,1);
285: stat=initSerial(&sd,comport-1,USE_16550,256L,256L);
286: if (stat == SER_OK) {
287: setBPS(&sd,bps);
288: mdmreset();
289: mdmsendcmd=1;
290: _settextcolor(0);
291: gprintf(stdout,"\nInitializing...");
292: do {
293: if (mdmsendcmd) {
294: switch (mdmstate) {
295: case 0:
296: _settextcolor(11);
297: gprintf(stdout,"\nSETUP: %s",initstring);
298: mdmsendstr(initstring);
299: delayclock=totalclock+(CLKIPS*2);
300: break;
301: case 1:
302: _settextcolor(11);
303: if (dialopt) {
304: sprintf(cmdstg,"%s%s",dialstring,dialnumber);
305: }
306: else {
307: sprintf(cmdstg,"%s",answerstring);
308: }
309: gprintf(stdout,"\nSETUP: %s",cmdstg);
310: mdmsendstr(cmdstg);
311: delayclock=totalclock+(CLKIPS*45);
312: break;
313: }
314: mdmsendcmd=0;
315: }
316: if (rxBuffEmpty(&sd) == 0) {
317: if (x == 0) {
318: _settextcolor(14);
319: gprintf(stdout,"\nMODEM: ");
320: }
321: c=readSer(&sd);
322: if (c == 0) {
323: continue;
324: }
325: mdmresp[x++]=c;
326: if (c == '\n' || c == '\r') {
327: switch (mdmstate) {
328: case 0:
329: strupr(mdmresp);
330: if (strstr(mdmresp,"OK") != 0) {
331: mdmstate++;
332: }
333: else if (strstr(mdmresp,"ERROR") != 0) {
334: mdmsendcmd=1;
335: }
336: break;
337: case 1:
338: strupr(mdmresp);
339: if (dialopt == 0) {
340: if (strstr(mdmresp,"OK") != 0) {
341: mdmstate++;
342: delayclock=totalclock+CLKIPS;
343: }
344: break;
345: }
346: if (strstr(mdmresp,"CONNECT") != 0) {
347: connected=1;
348: more=0;
349: }
350: else if (strstr(mdmresp,"BUSY") != 0
351: || strstr(mdmresp,"NO") != 0) {
352: mdmsendcmd=1;
353: }
354: break;
355: case 2:
356: strupr(mdmresp);
357: if (strstr(mdmresp,"CONNECT") != 0) {
358: connected=1;
359: more=0;
360: }
361: break;
362: }
363: memset(mdmresp,0,sizeof(mdmresp));
364: x=0;
365: }
366: else {
367: gprintf(stdout,"%c",c);
368: }
369: }
370: switch (mdmstate) {
371: case 0:
372: if (totalclock >= delayclock) {
373: mdmreset();
374: mdmsendcmd=1;
375: }
376: break;
377: case 1:
378: if (totalclock >= delayclock) {
379: mdmreset();
380: mdmsendcmd=1;
381: }
382: break;
383: case 2:
384: if (totalclock >= delayclock) {
385: _settextcolor(0);
386: gprintf(stdout,"\nWaiting for call...");
387: delayclock=totalclock+(CLKIPS*15);
388: }
389: break;
390: }
391: if (kbhit()) {
392: getch();
393: gprintf(stdout,"\nAborting...");
394: more=0;
395: mdmreset();
396: }
397: } while (more);
398: if (!connected) {
399: setRTS(&sd,0);
400: setDTR(&sd,0);
401: }
402: }
403: _settextwindow(1,1,25,80);
404: _settextcolor(14);
405: }
406:
407: void
408: mdmterm(void)
409: {
410: int c,hexmode=0,more;
411: struct rccoord pos;
412:
413: showinstructions("CONNECTED");
414: _settextwindow(14,1,24,80);
415: _settextposition(14,1);
416: _settextcolor(0);
417: _displaycursor(_GCURSORON);
418: do {
419: if (kbhit()) {
420: c=getch();
421: switch (c) {
422: case 0x00:
423: switch(getch()) {
424: case 0x44:
425: quitprog=2;
426: more=0;
427: break;
428: case 0x23: // ALT-H (hex mode)
429: hexmode^=1;
430: break;
431: }
432: break;
433: }
434: if (hexmode) {
435: gprintf(stdout,"(%02X)",c);
436: }
437: else if (isascii(c)) {
438: switch (c) {
439: case 0x08:
440: writeSer(&sd,c);
441: if (dialopt == 0) {
442: pos=_gettextposition();
443: if (pos.col > 1) {
444: pos.col--;
445: _settextposition(pos.row,pos.col);
446: gprintf(stdout," ");
447: _settextposition(pos.row,pos.col);
448: }
449: }
450: break;
451: case 0x0A:
452: case 0x0D:
453: writeSer(&sd,c);
454: if (dialopt == 0) {
455: gprintf(stdout,"\n");
456: }
457: break;
458: case 0x1B:
459: _settextcolor(0);
460: gprintf(stdout,"\n(DISCONNECTING)\n");
461: setRTS(&sd,0);
462: setDTR(&sd,0);
463: connected=0;
464: more=0;
465: break;
466: default:
467: writeSer(&sd,c);
468: if (dialopt == 0) {
469: gprintf(stdout,"%c",c);
470: }
471: break;
472: }
473: }
474: }
475: else if (rxBuffEmpty(&sd) == 0) {
476: c=readSer(&sd);
477: if (hexmode) {
478: gprintf(stdout,"(%02X)",c);
479: }
480: else if (isascii(c)) {
481: switch (c) {
482: case 0x08:
483: pos=_gettextposition();
484: if (pos.col > 1) {
485: pos.col--;
486: _settextposition(pos.row,pos.col);
487: gprintf(stdout," ");
488: _settextposition(pos.row,pos.col);
489: }
490: break;
491: case 0x0A:
492: case 0x0D:
493: gprintf(stdout,"\n");
494: break;
495: default:
496: _settextcolor(10);
497: gprintf(stdout,"%c",c);
498: if (dialopt == 0) {
499: writeSer(&sd,c);
500: }
501: break;
502: }
503: }
504: }
505: } while (more);
506: _displaycursor(_GCURSOROFF);
507: deInitSerial(&sd);
508: }
509:
510: void
511: showvalues(int m)
512: {
513: int i;
514:
515: _settextwindow(1,1,25,80);
516: for (i=0 ; i < DIALMDM ; i++) {
517: if (i == m) {
518: _settextcolor(0);
519: _setbkcolor(7);
520: }
521: else {
522: if (i > SETBPS) {
523: if (comtype) {
524: switch (i) {
525: case SETINITS:
526: case SETDIALO:
527: _settextcolor(14);
528: break;
529: case SETANSS:
530: if (dialopt) {
531: _settextcolor(8);
532: }
533: else {
534: _settextcolor(14);
535: }
536: break;
537: case SETDIALS:
538: case SETDIALN:
539: if (dialopt) {
540: _settextcolor(14);
541: }
542: else {
543: _settextcolor(8);
544: }
545: break;
546: }
547: }
548: else {
549: _settextcolor(8);
550: }
551: }
552: else {
553: _settextcolor(14);
554: }
555: _setbkcolor(1);
556: }
557: switch (i) {
558: case SETSER:
559: _settextposition(5,24);
560: gprintf(stdout,"%s",comtype ? "MODEM " : "SERIAL");
561: break;
562: case SETCOM:
563: _settextposition(6,24);
564: gprintf(stdout,"%d",comport);
565: break;
566: case SETBPS:
567: _settextposition(7,24);
568: gprintf(stdout,"%5d",bps);
569: break;
570: case SETINITS:
571: _settextposition(8,24);
572: gprintf(stdout,"%-48.48s",initstring);
573: break;
574: case SETDIALO:
575: _settextposition(9,24);
576: gprintf(stdout,"%s",dialopt ? "DIAL " : "ANSWER");
577: break;
578: case SETANSS:
579: _settextposition(10,24);
580: gprintf(stdout,"%-48.48s",answerstring);
581: break;
582: case SETDIALS:
583: _settextposition(11,24);
584: gprintf(stdout,"%-48.48s",dialstring);
585: break;
586: case SETDIALN:
587: _settextposition(12,24);
588: gprintf(stdout,"%-48.48s",dialnumber);
589: break;
590: }
591: }
592: }
593:
594: void main(void)
595: {
596: long c,lastbps,menustate=0,more,oldcomport,oldbps;
597: char oldinit[60];
598:
599: oldtimer=_dos_getvect(0x08);
600: _dos_setvect(0x08,newtimer);
601: oldvmode=getBIOSvmode();
602: _setvideomode(_TEXTC80);
603: vmem=0xB800<<4;
604: showscn("mdmscrn.bin");
605: _settextwindow(1,1,25,80);
606: _setbkcolor(1);
607: _settextcolor(14);
608: bps=9600L;
609: comport=1;
610: strcpy(initstring,"AT&F&C1&D2");
611: strcpy(dialstring,"ATDT");
612: readsettings();
613: _displaycursor(_GCURSOROFF);
614: do {
615: switch (menustate) {
616: case SETCOM:
617: oldcomport=comport;
618: more=1;
619: showvalues(menustate);
620: showinstructions("Press the spacebar to toggle between COM port options");
621: do {
622: switch (getch()) {
623: case 0:
624: switch (getch()) {
625: case 0x48: // up arrow
626: menustate--;
627: if (menustate < 0) {
628: menustate=0;
629: }
630: more=0;
631: break;
632: case 0x50: // down arrow
633: more=0;
634: break;
635: case 0x44: // F10
636: more=0;
637: if (comtype) {
638: menustate=DIALMDM;
639: }
640: else {
641: quitprog=2;
642: }
643: break;
644: }
645: break;
646: case 0x20:
647: comport++;
648: if (comport > 4) {
649: comport=1;
650: }
651: showvalues(menustate);
652: break;
653: case 0x0D:
654: more=0;
655: break;
656: case 0x1B:
657: quitprog=1;
658: comport=oldcomport;
659: more=0;
660: break;
661: }
662: } while (more);
663: if (menustate == SETCOM) {
664: menustate++;
665: }
666: break;
667: case SETSER:
668: more=1;
669: showvalues(menustate);
670: showinstructions("Press the spacebar to toggle between SERIAL & MODEM");
671: do {
672: switch (getch()) {
673: case 0:
674: switch (getch()) {
675: case 0x48: // up arrow
676: menustate--;
677: if (menustate < 0) {
678: menustate=0;
679: }
680: more=0;
681: break;
682: case 0x50: // down arrow
683: more=0;
684: break;
685: case 0x44: // F10
686: more=0;
687: if (comtype) {
688: menustate=DIALMDM;
689: }
690: else {
691: quitprog=2;
692: }
693: break;
694: }
695: break;
696: case 0x20:
697: comtype^=1;
698: break;
699: case 0x0D:
700: more=0;
701: break;
702: case 0x1B:
703: quitprog=1;
704: more=0;
705: break;
706: }
707: showvalues(menustate);
708: } while (more);
709: if (menustate == SETSER) {
710: menustate++;
711: }
712: break;
713: case SETBPS:
714: oldbps=bps;
715: more=1;
716: showvalues(menustate);
717: showinstructions("Press the spacebar to toggle between baud rate selections");
718: do {
719: c=getch();
720: if (c == 0) {
721: switch (getch()) {
722: case 0x48:
723: menustate--;
724: if (menustate < 0) {
725: menustate=0;
726: }
727: more=0;
728: break;
729: case 0x50:
730: more=0;
731: break;
732: case 0x44: // F10
733: more=0;
734: if (comtype) {
735: menustate=DIALMDM;
736: }
737: else {
738: quitprog=2;
739: }
740: break;
741: }
742: }
743: else if (c == 0x20) {
744: switch (bps) {
745: case 9600:
746: bps=14400;
747: break;
748: case 14400:
749: bps=19200;
750: break;
751: case 19200:
752: bps=28800;
753: break;
754: case 28800:
755: bps=9600;
756: break;
757: }
758: }
759: else if (c == 0x0D) {
760: more=0;
761: }
762: else if (c == 0x1B) {
763: bps=oldbps;
764: quitprog=1;
765: more=0;
766: }
767: showvalues(menustate);
768: } while (more);
769: if (menustate == SETBPS) {
770: if (comtype) {
771: menustate++;
772: }
773: else {
774: menustate=SETSER;
775: }
776: }
777: break;
778: case SETINITS:
779: strcpy(oldinit,initstring);
780: more=1;
781: showvalues(menustate);
782: showinstructions("Type in an initialization string for your modem");
783: do {
784: c=getch();
785: c=toupper(c);
786: if (c == 0) {
787: switch (getch()) {
788: case 0x48:
789: menustate--;
790: if (menustate < 0) {
791: menustate=0;
792: }
793: more=0;
794: break;
795: case 0x50:
796: more=0;
797: break;
798: case 0x44: // F10
799: more=0;
800: if (comtype) {
801: menustate=DIALMDM;
802: }
803: else {
804: quitprog=2;
805: }
806: break;
807: }
808: }
809: if (c == 0x08) {
810: initstring[strlen(initstring)-1]=0;
811: }
812: else if (c == 0x0D) {
813: more=0;
814: }
815: else if (c == 0x1B) {
816: strcpy(initstring,oldinit);
817: quitprog=1;
818: more=0;
819: }
820: else if (strlen(initstring) < INITSLEN) {
821: initstring[strlen(initstring)]=c;
822: }
823: showvalues(menustate);
824: } while (more);
825: if (menustate == SETINITS) {
826: menustate++;
827: }
828: break;
829: case SETANSS:
830: strcpy(oldinit,answerstring);
831: more=1;
832: showvalues(menustate);
833: showinstructions("Type in your modem's answer command string or use \"ATS0=1\"");
834: do {
835: c=getch();
836: c=toupper(c);
837: if (c == 0) {
838: switch (getch()) {
839: case 0x48:
840: menustate--;
841: if (menustate < 0) {
842: menustate=0;
843: }
844: more=0;
845: break;
846: case 0x50:
847: more=0;
848: break;
849: case 0x44: // F10
850: more=0;
851: if (comtype) {
852: menustate=DIALMDM;
853: }
854: else {
855: quitprog=2;
856: }
857: break;
858: }
859: }
860: if (c == 0x08) {
861: answerstring[strlen(answerstring)-1]=0;
862: }
863: else if (c == 0x0D) {
864: more=0;
865: }
866: else if (c == 0x1B) {
867: strcpy(answerstring,oldinit);
868: quitprog=1;
869: more=0;
870: }
871: else if (strlen(answerstring) < ANSSLEN) {
872: answerstring[strlen(answerstring)]=c;
873: }
874: showvalues(menustate);
875: } while (more);
876: if (menustate == SETANSS) {
877: menustate=DIALMDM;
878: }
879: break;
880: case SETDIALS:
881: strcpy(oldinit,dialstring);
882: more=1;
883: showvalues(menustate);
884: showinstructions("Type in your modem's dial command string or use \"ATDT\"");
885: do {
886: c=getch();
887: c=toupper(c);
888: if (c == 0) {
889: switch (getch()) {
890: case 0x48:
891: menustate=SETDIALO;
892: more=0;
893: break;
894: case 0x50:
895: more=0;
896: break;
897: case 0x44: // F10
898: more=0;
899: if (comtype) {
900: menustate=DIALMDM;
901: }
902: else {
903: quitprog=2;
904: }
905: break;
906: }
907: }
908: if (c == 0x08) {
909: dialstring[strlen(dialstring)-1]=0;
910: }
911: else if (c == 0x0D) {
912: more=0;
913: }
914: else if (c == 0x1B) {
915: strcpy(dialstring,oldinit);
916: quitprog=1;
917: more=0;
918: }
919: else if (strlen(dialstring) < DIALSLEN) {
920: dialstring[strlen(dialstring)]=c;
921: }
922: showvalues(menustate);
923: } while (more);
924: if (menustate == SETDIALS) {
925: menustate++;
926: }
927: break;
928: case SETDIALO:
929: more=1;
930: showvalues(menustate);
931: showinstructions("Press the spacebar to toggle between ANSWER and DIAL");
932: do {
933: switch (getch()) {
934: case 0:
935: switch (getch()) {
936: case 0x48:
937: menustate--;
938: if (menustate < 0) {
939: menustate=0;
940: }
941: more=0;
942: break;
943: case 0x50:
944: more=0;
945: break;
946: case 0x44: // F10
947: more=0;
948: if (comtype) {
949: menustate=DIALMDM;
950: }
951: else {
952: quitprog=2;
953: }
954: break;
955: }
956: break;
957: case 0x20:
958: dialopt^=1;
959: break;
960: case 0x0D:
961: more=0;
962: break;
963: case 0x1B:
964: quitprog=1;
965: more=0;
966: break;
967: }
968: showvalues(menustate);
969: } while (more);
970: if (menustate == SETDIALO) {
971: if (dialopt) {
972: menustate=SETDIALS;
973: }
974: else {
975: menustate=SETANSS;
976: }
977: }
978: break;
979: case SETDIALN:
980: strcpy(oldinit,dialnumber);
981: more=1;
982: showvalues(menustate);
983: showinstructions("Type in the phone number to dial");
984: do {
985: c=toupper(getch());
986: switch (c) {
987: case 0x00:
988: switch (getch()) {
989: case 0x48:
990: menustate--;
991: if (menustate < 0) {
992: menustate=0;
993: }
994: more=0;
995: break;
996: case 0x50:
997: more=0;
998: break;
999: case 0x44: // F10
1000: more=0;
1001: if (comtype) {
1002: menustate=DIALMDM;
1003: }
1004: else {
1005: quitprog=2;
1006: }
1007: break;
1008: }
1009: break;
1010: case 0x08:
1011: dialnumber[strlen(dialnumber)-1]=0;
1012: break;
1013: case 0x0D:
1014: more=0;
1015: break;
1016: case 0x1B:
1017: strcpy(dialnumber,oldinit);
1018: quitprog=1;
1019: more=0;
1020: break;
1021: default:
1022: if (strlen(dialnumber) < DIALNLEN) {
1023: dialnumber[strlen(dialnumber)]=c;
1024: }
1025: break;
1026: }
1027: showvalues(menustate);
1028: } while (more);
1029: if (menustate == SETDIALN) {
1030: menustate++;
1031: }
1032: break;
1033: case DIALMDM:
1034: mdmdial();
1035: if (connected) {
1036: mdmterm();
1037: }
1038: menustate=0;
1039: break;
1040: }
1041: showvalues(menustate);
1042: } while ((!connected) && (!quitprog));
1043: setBIOSvmode(oldvmode);
1044: fprintf(stdout,"\n");
1045: _dos_setvect(0x08,oldtimer);
1046: writesettings();
1047: if (quitprog == 2) {
1048: if (comtype == 0) {
1049: exit(2);
1050: }
1051: else if (connected) {
1052: exit(1);
1053: }
1054: }
1055: exit(0);
1056: }
1057:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.