diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-04-27 02:28:57 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-04-27 02:28:57 +0200 |
commit | e1265fa32837f457ee2c2fa259d12c9545af4bbf (patch) | |
tree | 64b8d5f1c81c14f019047b0cb00cb77c2dcecf55 /apps/check_counter.c | |
parent | a37beb44d59cca329d0d9345c21505af81030688 (diff) | |
download | ipecamera-e1265fa32837f457ee2c2fa259d12c9545af4bbf.tar.gz ipecamera-e1265fa32837f457ee2c2fa259d12c9545af4bbf.tar.bz2 ipecamera-e1265fa32837f457ee2c2fa259d12c9545af4bbf.tar.xz ipecamera-e1265fa32837f457ee2c2fa259d12c9545af4bbf.zip |
First stand-alone ipecamera implementation
Diffstat (limited to 'apps/check_counter.c')
-rw-r--r-- | apps/check_counter.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/apps/check_counter.c b/apps/check_counter.c deleted file mode 100644 index b19b7d0..0000000 --- a/apps/check_counter.c +++ /dev/null @@ -1,45 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> - -int main(int argc, char *argv[]) { - int block = 0; - uint32_t value = 0; - uint32_t buf[1024]; - - if (argc < 2) { - printf("Usage:\n\t\t%s <file-to-check>\n", argv[0]); - exit(0); - } - - FILE *f = fopen(argv[1], "r"); - if (!f) { - printf("Failed to open file %s\n", argv[1]); - exit(1); - } - - - while (!feof(f)) { - int i, n = fread(buf, 4, 1024, f); - - if (block) i = 0; - else { - i = 1; - value = (buf[0]); - } - - for (; i < n; i++) { - if ((buf[i]) != ++value) { - printf("Pos %lx (Block %i, dword %i) expected %x, but got %x\n", block * 4096 + i * 4, block, i, value, (buf[i])); - exit(1); - } - } - - if (n) block++; - } - - fclose(f); - - printf("Checked %i blocks. All is fine\n", block); - return 0; -} |