Annotation of sbbs/sbbs2/dcdwatch/dcdwatch.c, revision 1.1.1.1

1.1       root        1: /* DCDWATCH.C */
                      2: 
                      3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
                      4: 
                      5: /* Program to execute another program, but terminate if carrier detect is      */
                      6: /* lost */
                      7: 
                      8: /* Compile small memory model */
                      9: 
                     10: #include <stdio.h>
                     11: #include <stdlib.h>
                     12: #include <process.h>
                     13: #include <dos.h>
                     14: #include <io.h>
                     15: #include <alloc.h>
                     16: 
                     17: extern unsigned _heaplen=2048;
                     18: 
                     19: #define uint unsigned int
                     20: 
                     21: #pragma warn -par
                     22: 
                     23: char hungup=0;
                     24: uint far *msr;
                     25: 
                     26: void interrupt (*old_int21)(void);
                     27: 
                     28: struct REGPACK r;
                     29: 
                     30: void interrupt new_int21(uint bp, uint di, uint si, uint ds, uint es,
                     31:        uint dx, uint cx, uint bx, uint ax, uint ip, uint cs, uint flags)
                     32: {
                     33: 
                     34: r.r_ax=ax;
                     35: r.r_bx=bx;
                     36: r.r_cx=cx;
                     37: r.r_dx=dx;
                     38: r.r_bp=bp;
                     39: r.r_si=si;
                     40: r.r_di=di;
                     41: r.r_flags=flags;
                     42: r.r_ds=ds;
                     43: r.r_es=es;
                     44: 
                     45: intr(0xaa,&r);
                     46: 
                     47: ax=r.r_ax;
                     48: bx=r.r_bx;
                     49: cx=r.r_cx;
                     50: dx=r.r_dx;
                     51: bp=r.r_bp;
                     52: si=r.r_si;
                     53: di=r.r_di;
                     54: flags=r.r_flags;
                     55: ds=r.r_ds;
                     56: es=r.r_es;
                     57: 
                     58: if(!(*(msr)&0x8000) && !hungup) {
                     59:     hungup=1;
                     60:        r.r_ax=0x4c00;
                     61:        intr(0xaa,&r); }                                         /* so exit */
                     62: }
                     63: 
                     64: #pragma warn +par
                     65: 
                     66: 
                     67: int main(int argc, char **argv)
                     68: {
                     69:        char str[256],*arg[30],*comspec;
                     70:        int i;
                     71:        FILE *stream;
                     72: 
                     73: if(argc<3) {
                     74:        printf("usage: %%!dcdwatch %%& <program> <arguments>\n");
                     75:        exit(1) ;}
                     76: 
                     77: msr=(uint far *)atol(argv[1]);
                     78: 
                     79: if((stream=fopen("INTRSBBS.DAT","r"))!=NULL) {
                     80:        fgets(str,81,stream);
                     81:        msr=(uint far *)atol(str);
                     82:        fclose(stream);
                     83:        remove("INTRSBBS.DAT"); }
                     84: 
                     85: if(msr) {
                     86:        old_int21=getvect(0x21);
                     87:        setvect(0xAA,old_int21);
                     88:        setvect(0x21,new_int21); }
                     89: 
                     90: comspec=getenv("COMSPEC");
                     91: 
                     92: arg[0]=comspec;
                     93: arg[1]="/c";
                     94: for(i=2;i<30;i++)
                     95:        arg[i]=argv[i];
                     96: 
                     97: i=spawnvp(P_WAIT,arg[0],arg);
                     98: 
                     99: if(msr)
                    100:        setvect(0x21,old_int21);
                    101: return(i);
                    102: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.