Category : C Source Code
Archive   : CSRC2.ZIP
Filename : CSCOPY.C

 
Output of file : CSCOPY.C contained in archive : CSRC2.ZIP
/*
* c s c o p y . c
*/

/*)LIBRARY
*/

#ifdef DOCUMENTATION

title cscopy Copy a Cset
index Copy a cset

synopsis

#ifdef vms
#include "c:cset.h"
#else
#include
#endif

int
cscopy(cs);
CSET *cs;

description

cscopy() returns a cset whose members are exactly the same as the
members of cs; however, the copy is independent of cs, and changes
to cs will not affect it.

cscopy() returns NULL if it can't obtain space for the new cset.

bugs

author

Jerry Leichter

#endif

/*
)EDITLEVEL=12
* Edit history
* 0.0 16-Jul-82 JSL Invention
*/

#ifdef vms
#include "c:cset.h"
#else
#include
#endif
#define NULL 0
#define TRUE 1
#define FALSE 0

CSET *
cscopy(cs)
register CSET *cs;
{ CSET *newcs;
register int i;
register int flip;

if ((newcs = cset("")) != NULL)
{ if ((int)cs & 1) /* A complemented cset */
{ cs = cscomp(cs); /* Get base cset */
flip = TRUE; /* Flip everything */
}
else
flip = FALSE; /* Leave things alone */

for (i = 0; i < cssize; i++) /* Scan the set */
if (((cs->table[i] & cs->mask) != 0) ^ flip)
newcs->table[i] |= newcs->mask;
}
return(newcs);
}


  3 Responses to “Category : C Source Code
Archive   : CSRC2.ZIP
Filename : CSCOPY.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/