home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
BTMTSRC3.ZIP
/
B_WZSEND.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-17
|
8KB
|
207 lines
/*--------------------------------------------------------------------------*/
/* */
/* */
/* ------------ Bit-Bucket Software, Co. */
/* \ 10001101 / Writers and Distributors of */
/* \ 011110 / Freely Available<tm> Software. */
/* \ 1011 / */
/* ------ */
/* */
/* (C) Copyright 1987-90, Bit Bucket Software Co., a Delaware Corporation. */
/* */
/* */
/* BinkleyTerm "SendWaZOO" Processor */
/* */
/* */
/* For complete details of the licensing restrictions, please refer */
/* to the License agreement, which is published in its entirety in */
/* the MAKEFILE and BT.C, and also contained in the file LICENSE.240. */
/* */
/* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
/* BINKLEYTERM LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
/* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
/* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT BIT BUCKET */
/* SOFTWARE CO. AT ONE OF THE ADDRESSES LISTED BELOW. IN NO EVENT */
/* SHOULD YOU PROCEED TO USE THIS FILE WITHOUT HAVING ACCEPTED THE */
/* TERMS OF THE BINKLEYTERM LICENSING AGREEMENT, OR SUCH OTHER */
/* AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO. */
/* */
/* */
/* You can contact Bit Bucket Software Co. at any one of the following */
/* addresses: */
/* */
/* Bit Bucket Software Co. FidoNet 1:104/501, 1:132/491, 1:141/491 */
/* P.O. Box 460398 AlterNet 7:491/0 */
/* Aurora, CO 80046 BBS-Net 86:2030/1 */
/* Internet f491.n132.z1.fidonet.org */
/* */
/* Please feel free to contact us at any time to share your comments about */
/* our software and/or licensing policies. */
/* */
/* */
/* This module is based largely on a similar module in OPUS-CBCS V1.03b. */
/* The original work is (C) Copyright 1987, Wynn Wagner III. The original */
/* author has graciously allowed us to use his code in this work. */
/* */
/*--------------------------------------------------------------------------*/
#include <stdio.h>
#include <signal.h>
#include <ctype.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <sys\types.h>
#include <sys\stat.h>
#include <errno.h>
#define WAZOO_SECTION
#include "com.h"
#include "xfer.h"
#include "zmodem.h"
#include "keybd.h"
#include "sbuf.h"
#include "sched.h"
#include "externs.h"
#include "prototyp.h"
#include "defines.h"
#define rb_plus "r+b"
int get_ZedZap (char *, FILE *);
int send_ZedZap (char *, char *, int, int);
int get_ZedZip (char *, FILE *);
int send_ZedZip (char *, char *, int, int);
int WaZOO_callback (char *);
static int fsent;
#define NUM_FLAGS 4
/*--------------------------------------------------------------------------*/
/* SEND WaZOO (send another WaZOO-capable Opus its mail) */
/* returns TRUE (1) for good xfer, FALSE (0) for bad */
/* use instead of n_bundle and n_attach for WaZOO Opera */
/*--------------------------------------------------------------------------*/
int send_WaZOO ()
{
char fname[80];
char s[80];
char *HoldName;
int c;
int check_again;
struct stat buf;
fsent = 0;
if (flag_file (TEST_AND_SET, &called_addr, 1))
goto done_send;
HoldName = HoldAreaNameMunge(&called_addr);
check_again = 0;
just_make_sure:
/*--------------------------------------------------------------------*/
/* Send all waiting ?UT files (mail packets) */
/*--------------------------------------------------------------------*/
*ext_flags = 'O';
for (c = 0; c < NUM_FLAGS; c++)
{
#ifndef JACK_DECKER
if (caller && (ext_flags[c] == 'H'))
continue;
#endif
(void) sprintf (fname,
"%s%s.%cUT",
HoldName, Hex_Addr_Str (&called_addr), ext_flags[c]);
if (!stat (fname, &buf))
{
/*--- Build a dummy PKT file name */
invent_pkt_name (s);
/*--- Tell ZModem to handle this as a SEND AS then DELETE */
status_line (msgtxt[M_PACKET_MSG]);
if (!Send_Zmodem (fname, s, fsent++, DO_WAZOO))
{
net_problems = 1;
flag_file (CLEAR_FLAG, &called_addr, 1);
return FALSE;
}
CLEAR_IOERR ();
(void) unlink (fname);
}
} /* for */
/*--------------------------------------------------------------------*/
/* Send files listed in ?LO files (attached files) */
/*--------------------------------------------------------------------*/
*ext_flags = 'F';
if (!do_FLOfile (ext_flags, WaZOO_callback))
{
flag_file (CLEAR_FLAG, &called_addr, 1);
return FALSE;
}
if (fsent && !check_again)
{
check_again = 1;
goto just_make_sure;
}
/*--------------------------------------------------------------------*/
/* Send our File requests to other system */
/*--------------------------------------------------------------------*/
if (requests_ok)
{
(void) sprintf (fname, request_template, HoldName, Hex_Addr_Str (&called_addr));
if (!stat (fname, &buf))
{
if (!(((unsigned) remote_capabilities) & WZ_FREQ))
status_line (msgtxt[M_FREQ_DECLINED]);
else
{
status_line (msgtxt[M_OUT_REQUESTS]);
++made_request;
if (Send_Zmodem (fname, NULL, fsent++, DO_WAZOO))
(void) unlink (fname);
}
}
}
fsent = respond_to_file_requests (fsent, WaZOO_callback);
flag_file (CLEAR_FLAG, &called_addr, 1);
done_send:
if (!fsent)
status_line (msgtxt[M_NOTHING_TO_SEND], Full_Addr_Str (&called_addr));
(void) Send_Zmodem (NULL, NULL, ((fsent) ? END_BATCH : NOTHING_TO_DO), DO_WAZOO);
sent_mail = 1;
return TRUE;
} /* WaZOO */
/*
* WaZOO_callback () -- send requested file using WaZOO method.
*
*
*/
int WaZOO_callback (reqs)
char *reqs;
{
return (Send_Zmodem (reqs, NULL, fsent++, DO_WAZOO));
}