download b_initva.cpp
Language: C++
Copyright: Copyright 1987-96, Bit Bucket Software Co.
LOC: 517
Project Info
BinkleyTerm XE(btxe)
Server: SourceForge
Type: cvs
...e\b\btxe\btxe\btnt\sources\
   Addr.cpp
   Addr.h
   aglcrc.cpp
   aglcrc.h
   asyn_lnx.cpp
   asyn_os2.cpp
   asyn_w32.cpp
   async.h
   asyos2v1.h
   b_banner.cpp
   b_bbs.cpp
   b_faxrcv.cpp
   b_flofil.cpp
   b_frproc.cpp
   b_help.cpp
   b_initva.cpp
   b_logs.cpp
   b_passwo.cpp
   b_proto.cpp
   b_rspfil.cpp
   b_sbinit.cpp
   b_script.cpp
   b_search.cpp
   b_sessio.cpp
   b_spawn.cpp
   b_term.cpp
   b_termov.cpp
   b_today.cpp
   b_wazoo.cpp
   b_whack.cpp
   b_wzsend.cpp
   banner.cpp
   banner.h
   BasicString.h
   bbs_ctra.cpp
   bbs_data.cpp
   bbs_incl.h
   bbs_io.cpp
   bink.h
   bink_asm.cpp
   binkdlg.cpp
   binkpipe.h
   box.h
   brec.cpp
   bsend.cpp
   bt.cpp
   btconfig.cpp
   btutil.cpp
   buffer.h
   cache.cpp
   cache.h
   callback.cpp
   callerid.cpp
   callwin.cpp
   callwin.h
   capi.cpp
   cfosline.cpp
   chat.cpp
   com.h
   com_dos.h
   com_lnx.h
   com_os2.h
   com_w32.h
   common.cpp
   cpuload.cpp
   css.cpp
   css.h
   data.cpp
   debug.cpp
   debug.h
   defines.h
   dosfuncs.cpp
   emsi.cpp
   emxmxcom.cpp
   evtparse.cpp
   evtsetup.cpp
   exceptio.cpp
   exceptio.h
   Exceptions.cpp
   Exceptions.h
   externs.h
   faxproto.h
   fcfgread.cpp
   fidomail.h
   file_all.cpp
   file_dos.cpp
   file_io.h
   file_lnx.cpp
   file_os2.cpp
   file_w32.cpp
   foffsets.h
   fossil.cpp
   freepoll.cpp
   ftsc.cpp
   gethcomm.h
   heap.cpp
   history.cpp
   history.h
   hydra.cpp
   hydra.h
   includes.cpp
   includes.h
   janus.cpp
   janus.h
   keybd.h
   keyfncs.h
   keymap.cpp
   langload.cpp
   language.h
   lngmagic.h
   m7rec.cpp
   m7send.cpp
   mailer.cpp
   mailovly.cpp
   mailroot.cpp
   maxcomm.h
   maxmcp.cpp
   maxmcp.h
   maxprm.cpp
   mdm_proc.cpp
   misc.cpp
   msgs.h
   Node.cpp
   Node.h
   NodeList.cpp
   NodeList.h
   nodeproc.cpp
   os2_pm.cpp
   outbound.cpp
   pipe.cpp
   pktmsgs.cpp
   pktmsgs.h
   protcomm.cpp
   prototyp.h
   recvbark.cpp
   recvsync.cpp
   sbuf.cpp
   sbuf.h
   sched.cpp
   sched.h
   script2.cpp
   SelfTest.cpp
   SelfTest.h
   sendbark.cpp
   sendsync.cpp
   squish.cpp
   squish.h
   srif.cpp
   statetbl.cpp
   stats.cpp
   stdafx.cpp
   stdafx.h
   timer.cpp
   timer.h
   times.cpp
   types.h
   v7debug.cpp
   version.cpp
   version7.cpp
   version7.h
   vfos_dos.cpp
   vfos_lnx.cpp
   vfos_os2.cpp
   vfos_qnx.cpp
   vfos_w32.cpp
   vfossil.h
   video.h
   vt100.cpp
   vt100.h
   xfer.h
   xmrec.cpp
   xmsend.cpp
   xstring.h
   yoohoo.cpp
   zmodem.cpp
   zmodem.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
/*---------------------------------------------------------------------------*
 *
 *                               BinkleyTerm
 *
 *              (C) Copyright 1987-96, Bit Bucket Software Co.
 *     For license and contact information see /doc/orig_260/license.260.
 *
 *           This version was modified by the BinkleyTerm XE Team.
 *        For contact information see /doc/team.lst and /doc/join.us.
 *  For a complete list of changes see /doc/xe_user.doc and /doc/xe_hist.doc.
 *
 * Filename    : $Source: /cvsroot/btxe/btnt/sources/b_initva.cpp,v $
 * Revision    : $Revision: 1.2 $
 * Tagname     : $Name:  $
 * Last updated: $Date: 2005/01/03 03:27:00 $
 * State       : $State: Exp $
 * Orig. Author: Vince Perriello
 *
 * Description : BinkleyTerm Variable Initialization
 *
 *---------------------------------------------------------------------------*/

/* Include this file before any other includes or defines! */

#include "includes.h"

static void compile_externs (void);
static void fillin_defaults (struct secure *, struct secure *);

/**
 ** b_initvars -- called before parse_config. Sets defaults that we want
 ** to have set FIRST.
 **/

void
b_initvars ()
{
    int k;

    /* VRP 990830 start */
    ONLINE_TIME *online_time;
    HIDDEN *hidden;
    HIDDEN_LINE *hidden_line;

    /* VRP 990830 end */

    /*  struct modem_after_call *paftercall; */  /*** VRP 20000616 ***/

    TZ = store_TZ ();             /* AW 980209 get timezone (cfg_get_nodetimezone needs it */

    e_input = (char *) calloc (1, E_INPUT_LEN);  /* status_line only */
    if (!e_input)
    {
        printf (MSG_TXT (M_MEM_ERROR));
        exit (252);
    }

    e_ptrs = (BINK_EVENT *) malloc (256 * sizeof (BINK_EVENT));
    if (e_ptrs == (BINK_EVENT *) NULL)
    {
        printf (MSG_TXT (M_BAD_EVENT_ALLOC));
        exit (252);
    }

    SendHoldIfCaller = 0;         /* VRP 990824 */
    RestorePoll = 0;              /* VRP 990826 */

    /* VRP 990820 start */

    while (online_time1 != NULL)
    {
        online_time = online_time1;
        online_time1 = online_time1->next;

        if (online_time->Domain != NULL)
            free (online_time->Domain);
        free (online_time);
    };

    while (hidden1 != NULL)
    {
        hidden = hidden1;
        hidden1 = hidden1->next;

        while (hidden->hidden_line1 != NULL)
        {
            hidden_line = hidden->hidden_line1;
            hidden->hidden_line1 = hidden->hidden_line1->next;

            if (hidden_line->num != NULL)
                free (hidden_line->num);
            free (hidden_line);
        };

        if (hidden->Domain != NULL)
            free (hidden->Domain);
        free (hidden);
    };

    /* VRP 990820 end */

    memset ((char *) e_ptrs, 0, 256 * sizeof (BINK_EVENT));
    memset ((char *) &DEFAULT, 0, sizeof (DEFAULT));

    KNOWN = DEFAULT;              /* Does some of the work      */
    KNOWN.rq_Limit = -1;
    KNOWN.byte_Limit = -1L;
    KNOWN.time_Limit = -1;
    KNOWN.rq_Cum_Limit = -1;
    KNOWN.byte_Cum_Limit = -1L;
    KNOWN.time_Cum_Limit = -1L;

    PROT = KNOWN;                 /* Initially the same default */
    SPECIAL = KNOWN;              /* Initially the same default */

    memset (&errlvlshell, 0, 255);
    memset (&modem, 0, sizeof (struct modem_commands));

    for (k = 0; k < 10; k++)      /* Zero the phone scan list   */
        scan_list[k] = NULL;

    for (k = 0; k < MAX_EXTERN; k++)  /* And the external protocols */
        protocols[k] = NULL;

    addrMyAddr = (AKA *) calloc (1, sizeof (AKA));
    if (addrMyAddr == NULL)
    {
        printf (MSG_TXT (M_MEM_ERROR));
        exit (2);
    }

    addrMyAddr->Zone = 1;              /* Make sure we have a adress */
    addrMyAddr->Net = addrMyAddr->Node = (unsigned short) -1;  /* Default Fido address */
    addrMyAddr->Point = 0;
    addrMyAddr->Domain = NULL;
    addrMyAddr->next = NULL;

#if 0
    for (k = 0; k < FPADDR_CNT + 1; k++)  /* And the fpaddrs list         */
    {
        fpaddr[k].addr.Zone = fpaddr[k].addr.Net =
                                  fpaddr[k].addr.Node = fpaddr[k].addr.Point = 0;  /* TJW 960505 */
        fpaddr[k].addr.Domain = NULL;
        fpaddr[k].Size = 0L;
        fpaddr[k].Delta_T = (time_t) 300;  /* Default is 5 minutes */
        fpaddr[k].and_op = 0;       /* Default is OR operation for accepting calls */
    }
#endif

#ifdef  DOS16                   /*  TS 961215   */
    cshape = get_cshape ();
#endif

    b_init ();

    baud = 2;
    cur_baud = pbtypes[baud];

    memset (&dta_str, 0, sizeof (dta_str));

#ifdef SET_CONMODE
    setmode (fileno (stdin), O_BINARY);
    setmode (fileno (stdout), O_BINARY);
#endif

    noBBS = MSG_TXT (M_NO_BBS);   /* TJW 961028 */
    BBSesc = MSG_TXT (M_PRESS_ESCAPE);  /* TJW 961028 */

#ifdef SMP_API
    if (!smp)
        smp = smp_init ();
#endif
}


/**
 ** b_defaultvars -- called after all parse_config passes complete.
 ** sets anything not handled by parse_config to default if we know it.
 **/

void b_defaultvars ()
{
    int i;
    char *p;

    /* VRP 990820 start */

    ONLINE_TIME *online_time;
    short deltaTZ;
    HIDDEN *hidden;
    HIDDEN_LINE *hidden_line;

    /* VRP 990820 end */

    TZ = store_TZ ();             /* AW 980209 Timezone settings after config */
    tzutc_timer = 0;

    unix_time (&etm);             /* r.hoerner: set etm NOW */

    if (addrMyAddr == NULL)
        addrMyAddr = (AKA *) calloc (1, sizeof (AKA));
    if (addrMyAddr == NULL)
        exit (4);

    if (location == NULL)
        location = "Somewhere";
    if (myphone == NULL)
        myphone = "-Unpublished-";
    if (myflags == NULL)
        myflags = "";
    if (mymaxbaud == NULL)
        mymaxbaud = "";
    if (download_path == NULL)
        download_path = "";

	nodelist_name = "nodelist";

#ifdef BBS_SPAWN
    if (BBSopt == OPT_NONE)
        BBSopt = OPT_SPAWN;
#endif

    if (modem.init_cnt == 0)
        modem.init[modem.init_cnt++] = ctl_string ("|AT|");  /* MR 970310 */
    if (modem.busy == NULL)
        modem.busy = ctl_string ("v");
    if (modem.hangup == NULL)     /* MR 970325 */
        modem.hangup = ctl_string ("|`v~~^````` |");
    if (modem.init_setup == NULL) /* MR 970310 moved from mdm_proc.c */
        modem.init_setup = ctl_string ("~^````` |");
    if (modem.dial_setup == NULL) /* MR 970310 moved from mdm_proc.c */
        modem.dial_setup = ctl_string ("~^`````");

    if (net_info == NULL)
        net_info = ctl_string ("." DIR_SEPS);

    /* Initialize the modem response strings if user didn't */

    if (mdm_resps == NULL)
    {
        mdm_resps = def_mdm_resps;
        resp_count = max_resp_count = def_resp_count;
    }

    /* Initialize session-level no-WaZOO and no-EMSI flags */

    no_WaZOO_Session = no_WaZOO;
    no_EMSI_Session = no_EMSI;

    /* Set up "boss" and "point" addresses correctly if we can */

    if (boss_addr.Zone == 0)
        boss_addr.Zone = addrMyAddr->Zone;

    if (boss_addr.Net == 0)
    {
        memcpy (&boss_addr, addrMyAddr, sizeof (ADDR));
        boss_addr.Point = 0;
    }

    if (task_dir)
        strcpy (HistoryFileName, task_dir);
    else
        strcpy (HistoryFileName, BINKpath);
    if (HistoryFileName[strlen (HistoryFileName) - 1] != DIR_SEPC)
        strcat (HistoryFileName, DIR_SEPS);
    strcat (HistoryFileName, "callhist.all");

    if ((pvtnet >= 0) && (addrMyAddr->Point != 0))
    {
        my_addr = boss_addr;
        my_addr.Point = addrMyAddr->Point;
        addrMyAddr->Net = (word) pvtnet;
        addrMyAddr->Node = addrMyAddr->Point;
        addrMyAddr->Point = 0;
    }
    else
        my_addr = *(ADDR *) addrMyAddr;

    /* If we have the minimum information to do netmail, set the flag */

    if ((addrMyAddr->Zone != 0)
            && (addrMyAddr->Net != 0)
            && (system_name != NULL)
            && (sysop != NULL)
            && (hold_area != NULL)
            && (DEFAULT.sc_Inbound != NULL))
    {
        net_params = 1;
        flag_file (INITIALIZE, (ADDR *) addrMyAddr, 0);
    }

    if (system_name == NULL)
        system_name = "";

    if (hold_area == NULL)
        hold_area = ctl_string ("." DIR_SEPS);

    if (flag_dir == NULL)
        flag_dir = ctl_string ("." DIR_SEPS);

    if (DEFAULT.sc_Inbound == NULL)
        DEFAULT.sc_Inbound = ctl_string ("." DIR_SEPS);

    if (DEFAULT.userclass == NULL)
        DEFAULT.userclass = "0";

    /* Make the "higher class" requests at least as well off as the
     * "lowest class"... */

    fillin_defaults (&KNOWN, &DEFAULT);
    fillin_defaults (&PROT, &KNOWN);
    fillin_defaults (&SPECIAL, &KNOWN);

    /* AW 980220 get Maximus priviledge levels into .security and .xkeys */
    get_PrivKey ((word *) & DEFAULT.security, &DEFAULT.xkeys, DEFAULT.userclass);
    get_PrivKey ((word *) & KNOWN.security, &KNOWN.xkeys, KNOWN.userclass);
    get_PrivKey ((word *) & PROT.security, &PROT.xkeys, PROT.userclass);
    get_PrivKey ((word *) & SPECIAL.security, &SPECIAL.xkeys, SPECIAL.userclass);

    if (extern_index)
        compile_externs ();         /* generate extern_protocols  */

    if (!colors.calling && colors.hold)
        colors.calling = (unsigned char) (((colors.hold & 0x70) >> 4) |
                                          ((colors.hold & 0x7) << 4) |
                                          (colors.hold & 0x8));

    if ((!colors.popup) && colors.call)
        colors.popup = colors.call;

    first_block = 0;

    /* Make our domain first in the list */

    if (my_addr.Domain != NULL)
    {
        for (i = 0; i < DOMAINS; i++)
        {
            if (domain_name[i] == my_addr.Domain)
                break;
        }

        if ((i > 0) && (i < DOMAINS) && (domain_name[i] == my_addr.Domain))
        {
            p = domain_name[0];
            domain_name[0] = domain_name[i];
            domain_name[i] = p;
            p = domain_nodelist[0];
            domain_nodelist[0] = domain_nodelist[i];
            domain_nodelist[i] = p;
            p = domain_abbrev[0];
            domain_abbrev[0] = domain_abbrev[i];
            domain_abbrev[i] = p;
        }
    }

    /* VRP 990820 start */

    /*
     * Convert overrided online times to UTC
     */

    deltaTZ = (short) (TIMEZONE / 60L);
    for (online_time = online_time1; online_time; online_time = online_time->next)
    {
        if ((online_time->end - online_time->start) == 1440 ||
                (online_time->start - online_time->end) == 1440)
        {
            online_time->start = 0;
            online_time->end = 1440;
        }
        else
        {
            online_time->start += deltaTZ;
            online_time->end += deltaTZ;

            if (online_time->start < 0)
                online_time->start += 1440;
            else if (online_time->start > 1440)
                online_time->start -= 1440;

            if (online_time->end < 0)
                online_time->end += 1440;
            else if (online_time->end > 1440)
                online_time->end -= 1440;
        }
    }

    for (hidden = hidden1; hidden; hidden = hidden->next)
    {
        for (hidden_line = hidden->hidden_line1;
                hidden_line;
                hidden_line = hidden_line->next)
        {
            if ((hidden_line->end - hidden_line->start) == 1440 ||
                    (hidden_line->start - hidden_line->end) == 1440)
            {
                hidden_line->start = 0;
                hidden_line->end = 1440;
            }
            else
            {
                hidden_line->start += deltaTZ;
                hidden_line->end += deltaTZ;

                if (hidden_line->start < 0)
                    hidden_line->start += 1440;
                else if (hidden_line->start > 1440)
                    hidden_line->start -= 1440;

                if (hidden_line->end < 0)
                    hidden_line->end += 1440;
                else if (hidden_line->end > 1440)
                    hidden_line->end -= 1440;
            }
        }
    }

    /* VRP 990820 end */

    set_prior (PRIO_MODEM);

    if (Cominit (port_ptr, buftmo) != 0x1954)
    {
#ifdef DOS16
        printf (MSG_TXT (M_DRIVER_DEAD_1), "COM", 1 + port_ptr);
#else
printf (MSG_TXT (M_DRIVER_DEAD_1), port_device, 1 + port_ptr);
#endif
        printf (MSG_TXT (M_DRIVER_DEAD_2));
        printf (MSG_TXT (M_DRIVER_DEAD_3));

        set_prior (PRIO_NORMAL);
        exit (1);
    }

    i = un_attended;
    un_attended = 0;

    set_baud (max_baud.rate_value, 0);
    un_attended = i;

    MDM_ENABLE (lock_baud && (pbtypes[baud].rate_value >= lock_baud) ?
                max_baud.rate_mask : pbtypes[baud].rate_mask);
    RAISE_DTR ();
    XON_ENABLE ();

    set_prior (PRIO_REGULAR);

    InUseBBSBanner = BBSbanner;
    bufp = (BUF *) calloc (1, sizeof (BUF));  /* TJW 960416 */

    if (!bufp)
    {
        status_line (MSG_TXT (M_MEM_ERROR));
        set_prior (PRIO_NORMAL);
        exit (2);
    }

    Txbuf = bufp->_Txbuf;

    /* TJW960522 Init Hydra CRC tables once here */
#ifdef HAVE_HYDRA
    hydracrcinit ();
#endif

    /* Do a couple of system-related things.
     * Maybe they shouldn't be here -- but better here than in BT.C.
     *
     * Because of some config verbs that affect its behavior, mtask_find
     * MUST follow parse_config! */

#ifdef DOS16
    fossil_ver ();
#endif
    mtask_find ();

#ifdef OS_2
    LoadOS2DLLs ();               /* load OS/2 related DLLs now       */
    atexit (UnLoadOS2DLLs);

    snoop_open ((PSZ) pipename);  /* open the snoop pipe after readcfg */
    atexit (snoop_close);         /* 'cause we need the final name    */
    {
        char junk[32];

        SendToDlg ((PSZ) ANNOUNCE, 0, 0, BINK_INTRO);  /* need the TaskNumber for this! */
        sprintf (junk, "Task = %d", TaskNumber);
        SendToDlg ((PSZ) junk, 0, 0, BINK_START);
    }
#endif

#ifdef _WIN32
    // HJK 970205 - Now Windows also uses snoop
    snoop_open ((PSZ) pipename);  /* open the snoop pipe after readcfg */
    atexit (snoop_close);         /* 'cause we need the final name    */
#endif

    IPC_Open ();
    IPC_SetStatus (MSG_TXT (M_MCP_INIT));
    IPC_Ping ();

    LoadScanList (0, 0);          /* Get default scan list */

    if (local_inbound == NULL)
        local_inbound = PROT.sc_Inbound;
}

static void LOCALFUNC
compile_externs ()
{
    register char *c;
    register int i;
    char rgchT[100];
    int j, k, l;
    char *p;
    char x;

    i = l = 0;                    /* start at beginning     */
    rgchT[0] = '\0';

    for (k = 0; protocols[k] != NULL; k++)  /* Total no. of protos    */
    {
        c = protocols[k];           /* Point at filename      */
        if (!dexists (c))           /* Is it there?           */
        {
            printf ("%s %s\n", MSG_TXT (M_NO_PROTOCOL), c);
            continue;
        }

        p = NULL;
        while (*c)                  /* Until end of string    */
        {
            if ((*c == DIR_SEPC) || (*c == ':'))  /* Look for last path */
                p = c;                  /* Delimiter              */
            c++;
        }

        if (strlen (p) < 3)         /* If no name,            */
            continue;                 /* No protocol...         */

        p++;                        /* Point to the           */
        x = (char) toupper (*p);    /* First character        */
        if (strchr (rgchT, x) != NULL)
        {
            printf ("%s %s\n", MSG_TXT (M_DUP_PROTOCOL), c);
            continue;
        }

        protos[l].first_char = x;   /* Makes lookup fast      */
        protos[l++].entry = (short) k;  /* Now we know where      */

        rgchT[i++] = x;             /* Store first char       */
        rgchT[i++] = ')';           /* Then a ')'             */
        c = ++p;                    /* Point to 2nd char      */

        for (j = 0; j < 9; j++)     /* Up to 9 chars more     */
        {
            if (*c != '.')            /* If no comma yet,       */
            {
                rgchT[i++] = (char) tolower (*c);  /* store the char and    */
                ++c;                    /* bump the pointer       */
            }
            else
                rgchT[i++] = ' ';       /* otherwise pad it       */
        }

        rgchT[i++] = ' ';           /* And one more space     */
        rgchT[i] = '\0';            /* Need for testing       */
    }

    if (!i)                       /* If we got none,        */
        return;                     /* Return now.            */

    i += 2;                       /* Total for malloc       */
    if ((extern_protocols = (char*)calloc (1, (unsigned) i)) == NULL)
        return;                     /* Return on failure      */

    strcpy (extern_protocols, rgchT);  /* Copy the string        */
    return;                       /* Back to caller         */
}

static void LOCALFUNC
fillin_defaults (struct secure *higher, struct secure *lower)
{
    if (higher->time_Limit == -1)
        higher->time_Limit = lower->time_Limit;
    if (higher->byte_Limit == -1L)
        higher->byte_Limit = lower->byte_Limit;
    if (higher->rq_Limit == -1)
        higher->rq_Limit = lower->rq_Limit;

    if (higher->time_Cum_Limit == -1)
        higher->time_Cum_Limit = lower->time_Cum_Limit;
    if (higher->byte_Cum_Limit == -1L)
        higher->byte_Cum_Limit = lower->byte_Cum_Limit;
    if (higher->rq_Cum_Limit == -1)
        higher->rq_Cum_Limit = lower->rq_Cum_Limit;
    if (higher->userclass == NULL)
        higher->userclass = lower->userclass;

    if (higher->rq_OKFile == NULL)
        higher->rq_OKFile = lower->rq_OKFile;
    if (higher->rq_Template == NULL)
        higher->rq_Template = lower->rq_Template;
    if (higher->sc_Inbound == NULL)
        higher->sc_Inbound = lower->sc_Inbound;
#ifdef SPECIALMAGICS
    if (higher->rq_FILES == NULL)
        higher->rq_FILES = lower->rq_FILES;
    if (higher->rq_About == NULL)
        higher->rq_About = lower->rq_About;
#endif
}

/**
 ** b_exitproc -- called by mainline to do exit processing.
 **/
void
b_exitproc ()
{
    struct modem_after_call *paftercall;  /*** VRP 20000616 ***/

    /* VRP 990820 start */

    ONLINE_TIME *online_time;
    HIDDEN *hidden;
    HIDDEN_LINE *hidden_line;

    while (online_time1 != NULL)
    {
        online_time = online_time1;
        online_time1 = online_time1->next;

        if (online_time->Domain != NULL)
            free (online_time->Domain);
        free (online_time);
    };

    while (hidden1 != NULL)
    {
        hidden = hidden1;
        hidden1 = hidden1->next;

        while (hidden->hidden_line1 != NULL)
        {
            hidden_line = hidden->hidden_line1;
            hidden->hidden_line1 = hidden->hidden_line1->next;

            if (hidden_line->num != NULL)
                free (hidden_line->num);
            free (hidden_line);
        };

        if (hidden->Domain != NULL)
            free (hidden->Domain);
        free (hidden);
    };

    /* VRP 990820 end */

    /*** VRP 20000616 start ***/

    while (modem.paftercall != NULL)
    {
        paftercall = modem.paftercall;
        modem.paftercall = modem.paftercall->pnext;

        if (paftercall->command != NULL)
            free (paftercall->command);

        if (paftercall->filter != NULL)
            free (paftercall->filter);

        free (paftercall);
    };

    /*** VRP 20000616 end ***/

    if (command_line_un)
        modem_busy ();

    no_longer_alive ();
    vfossil_cursor (1);

    while (KEYPRESS ())
        FOSSIL_CHAR ();

    gotoxy (0, SB_ROWS - 1);      /* TJW 960517 */
    cputs ("\n\n");               /* TJW 960517 */
    clear_eol ();
    printf (MSG_TXT (M_THANKS), ANNOUNCE);
    clear_eol ();
    printf (MSG_TXT (M_ANOTHER_FINE_PRODUCT));

    if (vfossil_installed)
        vfossil_close ();

#ifdef SET_CONMODE
    setmode (fileno (stdin), O_TEXT);
    setmode (fileno (stdout), O_TEXT);
#endif

    if (!share)
    {
        set_prior (PRIO_MODEM);
        MDM_DISABLE ();
        set_prior (PRIO_REGULAR);
    }

    IPC_SetStatus (MSG_TXT (M_MCP_EXITING));
    IPC_Close ();
}

#ifdef _WIN32
// HJK 98/06/13 - set application title
void
SetWindowTitle (char *status)
{
    if (title_format)
        sprintf (ntwin, title_format, TaskNumber, status);
    else
        sprintf (ntwin, "%s - TASK %i", PRDCT_PRTY " " PRDCT_VRSN, TaskNumber);

    SetConsoleTitle (ntwin);
    // Bring the active window to top, useful when other program
    // has been started - HJK 98/06/13
    BringWindowToTop (GetForegroundWindow ());
}
#endif

/* $Id: b_initva.cpp,v 1.2 2005/01/03 03:27:00 vildanov Exp $ */

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us