/*
  mkfile.c
  --------
  Real stupid program to make an empty file.
  Should take advantage of sparse stuff too!

  $Id: mkfile.c,v 1.1 2004/04/11 05:28:46 stewart Exp $

  (C)2003 Stewart Smith
  Distributed under the GNU Public License
 */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

typedef u_int64_t u64;

u64 atou64(const char *nptr)
{
	u64 out,i;
	for(out=0,i=0;nptr[i]!='\0';i++) {
		out*=10;
		out+=nptr[i]-'0';
	}
	
	return out;
}

int main(int argc,char* argv[])
{
	FILE* file;
	
	if(argc<4) {
		fprintf(stderr,"Usage:\n");
		fprintf(stderr,"\t%s file bsize blocksnr\n\n",argv[0]);
		exit(1);
	}
 
	file = fopen(argv[1],"w");
	fseek(file,atou64(argv[2])*atou64(argv[3]),SEEK_SET);
	fprintf(file,"%c",0);
	fclose(file);
	return 0;
}
