/*
* This file is part of vbig.
- * Copyright (C) 2011 Richard Kettlewell
+ * Copyright (C) 2011, 2013 Richard Kettlewell
+ * Copyright (C) 2013 Ian Jackson
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
printf("vbig - create or verify a large but pseudo-random file\n"
"\n"
"Usage:\n"
- " vbig [--seed SEED] --verify|--create PATH [SIZE]\n"
+ " vbig [OPTIONS] [--both|--verify|--create] PATH] [SIZE]\n"
"\n"
"Options:\n"
" --seed, -s Specify random seed as string\n"
" --seed-length, -L Set (maximum) seed length to read from file\n"
" --verify, -v Verify that PATH contains the expected contents\n"
" --create, -c Create PATH with psuedo-random contents\n"
+ " --both, -b Do both create and verify (default)\n"
" --flush, -f Flush cache\n"
" --entire, -e Write until full; read until EOF\n"
" --progress, -p Show progress as we go\n"
else if(*end)
fatal(0, "invalid size");
} else if(entireopt) {
- size = LONG_LONG_MAX;
+ size = LLONG_MAX;
} else {
struct stat sb;
if(stat(path, &sb) < 0)
static void clearprogress() {
if (!progress) return;
- printf(" %-10s %*s \r", "", sizeof(long long)*4, "");
+ printf(" %-10s %*s \r", "", (int)sizeof(long long)*4, "");
flushstdout();
}
int triples = sizeof(amount);
char rawbuf[triples*3 + 1];
char outbuf[triples*4 + 1];
- snprintf(rawbuf, sizeof(rawbuf), "% *lld", sizeof(rawbuf)-1, amount);
+ snprintf(rawbuf, sizeof(rawbuf), "% *lld", (int)sizeof(rawbuf)-1, amount);
for (int i=0; i<triples; i++) {
outbuf[i*4] = ' ';
memcpy(outbuf + i*4 + 1, rawbuf + i*3, 3);