home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
VP2SRC.ZIP
/
FAST_IO.C
< prev
next >
Wrap
Text File
|
1991-04-20
|
4KB
|
129 lines
/*
$Header: fast_io.c 3.3 87/12/12 00:40:58 Bob Exp $
The Conference Mail System
This module was originally written by Bob Hartman
Sysop of FidoNet node 1:132/101
Spark Software, 427-3 Amherst St, CS 2032, Suite 232, Nashua, NH 03061
The Conference Mail System is a complete Echomail processing package. It
is a superset of the original Echomail utilities created by Jeff Rush, and
also contains ideas gleaned from the ARCmail, Renum, oMMM, MGM, and Opus
programs that were created by various software authors.
This program source code is being released with the following provisions:
1. You are free to make changes to this source code for use on your own
machine, however, altered source files may not be distributed without the
consent of Spark Software.
2. You may distribute "patches" or "diff" files for any changes that you
have made, provided that the "patch" or "diff" files are also sent to Spark
Software for inclusion in future releases of the entire package. A "diff"
file for the source archives may also contain a compiled version, provided
it is clearly marked as not being created from the original source code.
No other executable versions may be distributed without the consent of
Spark Software.
3. You are free to include portions of this source code in any program you
develop, providing: a) Credit is given to Spark Software for any code that
may is used, and b) The resulting program is free to anyone wanting to use
it, including commercial and government users.
4. There is NO technical support available for dealing with this source
code, or the accompanying executable files. This source code is provided
as is, with no warranty expressed or implied (I hate legalease). In other
words, if you don't know what to do with it, don't use it, and if you are
brave enough to use it, you're on your own.
Spark Software may be contacted by modem at (603) 888-8179 (node 1:132/101)
on the public FidoNet network, or at the address given above.
To use this code you will need Microsoft C version 4.0, and also Microsoft
Macro Assembler version 4.0.
*/
/*
$Log: fast_io.c $
* Revision 3.3 87/12/12 00:40:58 Bob
* Source code release
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <io.h>
#include <dos.h>
#include <fcntl.h>
#include "fastecho.h"
#define DEBUG 0
extern WBUFFER wbuffs[];
int get_to_null (int f,char *s,int *l)
{
int done, ct;
WBUFFER *w;
*l = 0;
done = 0;
w = &wbuffs[f];
while (!done)
{
if (w->wsize > 0)
{
/* Go and see if we can find a null there */
#if DEBUG
printf ("Calling copy_n_match_null\n");
#endif
ct = copy_n_match_null (&s[*l], w->wptr, w->wsize);
#if DEBUG
printf ("Returned from copy_n_match_null\n");
#endif
if (ct > 0)
{
*l += ct - 1;
done = 2;
w->wptr += ct;
w->wsize -= ct;
break;
}
else
{
*l += w->wsize;
w->wptr = w->wbuff;
w->wsize = read (f, w->wbuff, BIGSIZE);
if (w->wsize <= 0)
{
w->wsize = 0;
done = 1;
break;
}
continue;
}
}
if (fast_read (f, &s[*l], 1) <= 0)
{
done = 1;
}
else if (s[*l] == '\0')
{
done = 2;
}
else
{
++*l;
}
}
#if DEBUG
printf ("Returned from get_to_null\n");
#endif
return (done - 2);
}