code: mafs

ref: fb53d7e68bcb2108fb304c81dccb1d7ff50ffa1f
dir: /tests/nlastdatablocks.c/

View raw version
#include <u.h>
#include <libc.h>
#include "../dat.h"
#include "../fns.h"

/*
	write out the number of blocks in the last Tdata block

	tests/chknlastdatablocks.rc has the details
 */

int debug = 0;

static void
usage(void)
{
	fprint(2, "usage: nlastdatablocks [-D] size\n");
	exits("usage");
}

void
main(int argc, char *argv[])
{
	u64 size;

	ARGBEGIN{
	default:	usage();
	case 'D':	debug++; break;
	}ARGEND

	if(argc != 1)
		usage();

	size = atoll(argv[0]);
	print("%llud\n", nlastdatablocks(size));
	exits(nil);
}