download b_proto.cpp
Language: C++
Copyright: Copyright 1987-96, Bit Bucket Software Co.
LOC: 70
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

/*---------------------------------------------------------------------------*
 *
 *                               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_proto.cpp,v $
 * Revision    : $Revision: 1.1 $
 * Tagname     : $Name:  $
 * Last updated: $Date: 2005/01/01 15:18:11 $
 * State       : $State: Exp $
 * Orig. Author: Vince Perriello
 *
 * Description : BinkleyTerm External Protocol Handler Module
 *
 *---------------------------------------------------------------------------*/

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

#include "includes.h"

void
do_extern (char *cmd, int prot, char *name)
{
    int j;
    struct baud_str *i;
    char rgchT[100];
    char *c, *p, *m;
    FILE *ctlfile;

    memset (rgchT, 0, sizeof (rgchT));

    for (j = 0; j < 5; j++)
    {
        char ch;                    /* AW 980521 don't "optimize" here   */

        ch = protos[j].first_char;  /* otherwise Watcom compiler crashes */
        if (ch == (char) prot)
            break;
    }

    j = protos[j].entry;
    c = m = protocols[j];
    p = NULL;
    while (*m)                    /* Until end of string  */
    {
        if ((*m == DIR_SEPC) || (*m == ':'))  /* Look for last path */
            p = m;                    /* Delimiter            */
        m++;
    }
    m = &rgchT[0];

    /* It doesn't pay to be too smart here. Dots can appear in dir names */

    while (c != p)                /* Copy to last '\'     */
        *m++ = *c++;
    while (*c != '.')             /* Then to the dot      */
        *m++ = *c++;
    strcat (&rgchT[0], ".ctl");   /* Then add extension   */

    /*
     * At this point we have the Control File name in (rgchT), Now let's open
     * the file and put our good stuff in there.
     */

    unlink (rgchT);               /* Delete old copies    */
    if ((ctlfile = fopen (rgchT, append_ascii)) == NULL)  /* Try to open it  */
    {
        status_line (MSG_TXT (M_NO_CTL_FILE), rgchT);
        return;
    }

    fprintf (ctlfile, "Port %d\n", (port_ptr + 1));  /* Port n       */
    if (lock_baud && (cur_baud.rate_value >= lock_baud))
        i = &max_baud;
    else
        i = &pbtypes[baud];

#ifndef __unix__
    fprintf (ctlfile, "Modem %lx %lx %x %x %lx\n",  /* All modem params */
             hfComHandle, i->rate_value, handshake_mask,
             carrier_mask, i->rate_mask);  /*  TS/TJW 960622 */
#else
    fprintf (ctlfile, "Modem %s %lx %x %x %lx\n",  /* All modem params */
             port_device, i->rate_value, handshake_mask,
             carrier_mask, i->rate_mask);  /*  TS/TJW 960622 */
#endif

    fprintf (ctlfile, "Baud %lu\n", i->rate_value);  /* Baud Rate    */
    fprintf (ctlfile, "%s %s\n", cmd, name);  /* Actual command   */
    fclose (ctlfile);

    /* The file is now written. Turn off everything. */

    close_up (share);

    /* We're all set. Build the command and execute it. */

    c = protocols[j];

#ifndef __unix__
    sprintf (e_input, "%s %s -p%lu -b%lu %s",
             c, c, hfComHandle,
             i->rate_value, rgchT);  /*  TS/TJW 960622 */
#else
sprintf (e_input, "%s %s -p%s -b%lu %s",
    c, c, port_device,
    i->rate_value, rgchT);  /*  TS/TJW 960622 */
#endif

    b_spawn (e_input);            /* Execute command  */

    /* Back from external protocol. Turn it all back on. */

    come_back ();
    XON_ENABLE ();                /* and reenable XON */
}

/* $Id: b_proto.cpp,v 1.1 2005/01/01 15:18:11 vildanov Exp $ */

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