Below is a trascription of the code that SCO has been showing off as purloined from Linux. This makes up about 30 lines, including comments (almost 1/2 SCO's flagship examples).

Red indicates code that I think SCO is trying to claim.

Bruce Perins has a pretty good analyxis of the history of the code and where it's been (and been from), but I'm just going to look at the code itself for a moment.

 * Allocate size units from the given map.
 * Return the base of the allocated space.
 * In a map the adddresses are increasing and the
 * list is terminated by a 0 size
 * Algorithm is first fit.

  struct map *mp,
  size_t size)


Looking at that chunk of malloc code, it is extremely functional. It is a very straightforward and minimal implementation of first-fit memory allocation from a free pool.

static struct ( size_t m_size, char *m_addr } *chunk;
While(there are more chunks){

# couldn't find a big enough chunk
return(NULL) # error

It would be pretty difficult to produce a tight version of this algorithm without a high degree of duplication. I'd say you might as well cut and paste, because about the only changes that I can see making in a tight implementation would be to change the variable names. You'd be lucky to find 4 meaningful permutations of this algorithm, once you tighten up the code for the kernel.

Try to implement the pseudo code above, and see just how far away you end up.

Once you have the algorithm, and the variable names (mostly single-letter), the code is pretty easy to reconstruct with a clean room and a handfull of (code) monkeys.

BTW, this is not part of a block of duplicate code.. This is pretty much the entire thing. If that's the best that they can find, then they're SOL.

If you're not on somebody's shit list, you're not doing anything worthwhile.