diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/test_textfile.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/common/test_textfile.c b/common/test_textfile.c index 1c001f46..14320c17 100644 --- a/common/test_textfile.c +++ b/common/test_textfile.c @@ -43,11 +43,26 @@ int main(int argc, char *argv[]) { char filename[] = "/tmp/textfile"; char key[18], value[512], *str; - int i, j, fd, max = 10; + int i, j, fd, err, size, max = 10; + + size = getpagesize(); + printf("System uses a page size of %d bytes\n\n", size); fd = creat(filename, 0644); + err = ftruncate(fd, 0); + + memset(value, 0, sizeof(value)); + for (i = 0; i < (size / sizeof(value)); i++) + err = write(fd, value, sizeof(value)); + close(fd); + sprintf(key, "11:11:11:11:11:11"); + str = textfile_get(filename, key); + + err = truncate(filename, 0); + + sprintf(key, "00:00:00:00:00:00"); if (textfile_del(filename, key) < 0) fprintf(stderr, "%s (%d)\n", strerror(errno), errno); |