DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T d

⟦14bacb45c⟧ TextFile

    Length: 996 (0x3e4)
    Types: TextFile
    Names: »dupk.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Adventure/src/kio/dupk.c« 

TextFile

/*
**		    Copyright (c) 1985	Ken Wellsch
**
**     Permission is hereby granted to all users to possess, use, copy,
**     distribute, and modify the programs and files in this package
**     provided it is not for direct commercial benefit and secondly,
**     that this notice and all modification information be kept and
**     maintained in the package.
**
*/

#include "kio.h"

int dupk (unit,oldkey,newkey)
  int unit ;
  int oldkey, newkey ;
{
	struct mkey k ;
	long int loc ;
	register int siz ;

	if ( unit == EXISTING )
		return (ERROR) ;

	MapKey (oldkey,&k) ;

	if ( GetBlk (k.b) != k.b || Iblk.i_siz[k.e] <= 0 )
		return (ERROR) ;
	
	loc = Iblk.i_loc[k.e] ;
	siz = Iblk.i_siz[k.e] ;

	MapKey (newkey,&k) ;

	if ( GetBlk (k.b) != k.b )
		if ( MakBlk (k.b) != k.b )
			error ("Dupk","unable to create key %d!",newkey) ;

	if ( Iblk.i_siz[k.e] > 0 )
		error ("Dupk","key %d already exists!",newkey) ;

	Iblk.i_loc[k.e] = loc ;
	Iblk.i_siz[k.e] = siz ;
	Modified++ ;

	return (siz) ;
}