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 s

⟦e8d344d45⟧ TextFile

    Length: 952 (0x3b8)
    Types: TextFile
    Names: »seq.c«

Derivation

└─⟦db229ac7e⟧ Bits:30007240 EUUGD20: SSBA 1.2 / AFW Benchmarks
    └─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21E/bsd/seq.c« 
    └─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21F/bsd/seq.c« 

TextFile


char	*malloc();

main(argc, argv)
	char	*argv[];
{
	register i, niter;
	register char *pf, *lastpage;
	int npages = 4096,pagesize, vflag = 0;
	char *pages, *name;

	name = argv[0];
	argc--, argv++;
again:
	if (argc < 1){
usage:
		printf("usage: %s [ -v ] [ -p #pages ] niter \n", name);
		exit(1);
	}
	if (strcmp(*argv, "-p") == 0){
		argc--, argv++;
		if(argc < 1)
			goto usage;
		npages = atoi(*argv);
		if (npages <= 0){
			printf("%s: Bad page count.\n",*argv);
			exit(2);
		}
		argc--,argv++;
		goto again;
	}
	if (strcmp(*argv, "-v") == 0) {
		argc--,argv++;
		vflag++;
		goto again;
	}
	niter = atoi(*argv);
	pagesize = 1024;
	pages = malloc(npages * pagesize);
	if(pages == (char *) 0){
		printf("Can't allocate %d pages ( %2.1f megabytes).\n",
			npages, (npages * pagesize) / (1024. * 1024.));
		exit(3);
	}
	lastpage = pages + (npages * pagesize);
	for(i=0; i < niter; i++)
		for(pf = pages; pf < lastpage; pf += pagesize)
				*pf = 1;
}