Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/src/cmd/refer/inv5.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


# include "inv.h"

int recopy(FILE *ft, FILE *fb, FILE *fa, int nhash)
{
	/* copy fb (old hash items/pointers) to ft (new ones) */
	int i, n;
	long k;
	Index ind;

	if (fa == NULL) {
		err("No old pointers");
		return 0;
	}
	initindex(&ind);
	n = getindex(&ind, fa);
	fclose(fa);
	if (n != nhash)
		fprintf(stderr, "Changing hash value to old %d\n", n);
	for (i = 0; i < n; i++) {
		fseek(fb, ind.hash.el[i], 0);
		while ((k = getl(fb)) != -1)
			fprintf(ft, "%.5d %.9ld\n", i, k);
	}
	emptyindex(&ind);
	fclose(fb);
	return n;
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.