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 e

⟦a5e750c9b⟧ TextFile

    Length: 1500 (0x5dc)
    Types: TextFile
    Names: »effic.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Adventure/src/kio/effic.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"

main (argc,argv)
int argc ;
char *argv[] ;
{
	int fd ;
	register int i, j, free ;
	int used ;

	if ( argc != 2 )
	{
		printf ("Usage: %s file\n",argv[0]) ;
		exit (1) ;
	}

	if ( ( fd = openk (argv[1]) ) == ERROR )
	{
		printf ("Unable to open %s\n",argv[1]) ;
		exit (1) ;
	}
	
	for ( free = i = 0 ; i < MAXIBLK ; i++ )
		if ( Sblk[i] == EMPTY )
			free ++ ;
	
	printf ("Key file %s statistics:\n\n",argv[1]) ;

	printf ("\tFree slots in super block: %d (%f%%)\n",free,
		((float)free*100.0/MAXIBLK)) ;

	for ( used = free = i = 0 ; i < MAXIBLK ; i++ )
	{
		if ( Sblk[i] != EMPTY )
		{
			if ( GetBlk (i) != i )
			{
				printf ("can't read block %d!\n",Sblk[i]) ;
				exit (1) ;
			}
			for ( j = 0 ; j < MAXENTRIES ; j++ )
			{
				if ( Iblk.i_siz[j] == 0 )
					free ++ ;
				used++ ;
			}
		}
	}

	printf ("\tTotal record entries available: %d\n",used) ;

	printf ("\tTotal unused record entries: %d (%f%%)\n",free,
		((float)free*100.0/used)) ;
	
	closek (fd) ;
	exit (0) ;
}

error (rnam,a1,a2,a3,a4,a5)
char *rnam, *a1, *a2, *a3, *a4, *a5 ;
{
	printf ("%s: ",rnam) ;
	printf (a1,a2,a3,a4,a5) ;
	exit (1) ;
}