Category : Files from Magazines
Archive   : PJ91.ZIP
Filename : BUFSET.C

 
Output of file : BUFSET.C contained in archive : PJ91.ZIP
/* _bufset.c -- Listing 2. */

#include
#include "textbuf.h"

/* You can't use the standard memset() and memmove() functions for
* buffers because they may have been allocated from the far heap.
* The bufset() and bufmove() calls are mapped to memset() and
* memmove() when NEAR_HEAP is true, otherwise they are mapped to
* calls to the following, equivalent, far-pointer functions. Bufset
* is made a function, even though it's short enough for a macro,
* to avoid side effects on "size" and "p."
*/

void _bufset( bufptr p, const int c, bufsize size )
{
while( size-- > 0 ) /* Assume size can be unsigned */
*p++ = c;
}

void _bufmove( bufptr dst, bufptr src, bufsize size )
{
if( dst < src )
while( size-- > 0 )
*dst++ = *src++ ;
else
{
dst += size;
src += size;
while( size-- > 0 )
*--dst = *--src;
}
}



  3 Responses to “Category : Files from Magazines
Archive   : PJ91.ZIP
Filename : BUFSET.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/