summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/c4cat.c2
-rw-r--r--examples/c4cat_dyn.c2
-rw-r--r--examples/c4info.c2
3 files changed, 6 insertions, 0 deletions
diff --git a/examples/c4cat.c b/examples/c4cat.c
index ee0ed9b..322ff70 100644
--- a/examples/c4cat.c
+++ b/examples/c4cat.c
@@ -7,6 +7,7 @@
#include <unistd.h>
#include "cc4group.h"
+// the internal platform-header is used for the mmap below
#include "platform/platform.h"
bool catNormalFile(const char* const path, const off_t size)
@@ -18,6 +19,7 @@ bool catNormalFile(const char* const path, const off_t size)
return false;
}
+ // don't worry about this (and the unmap), it is just another way of reading the file more conveniently
void* mappedFile = cc4group_mmap(NULL, size, PROT_READ, MAP_PRIVATE, file, 0);
if(close(file) == -1)
diff --git a/examples/c4cat_dyn.c b/examples/c4cat_dyn.c
index 92da979..51161ef 100644
--- a/examples/c4cat_dyn.c
+++ b/examples/c4cat_dyn.c
@@ -17,6 +17,8 @@
CC4Group_API* cc4group_dyn;
#define cc4group (*cc4group_dyn)
+// if you already inspected the normal c4cat you may skip down to main, as the rest is exactly the same thanks to the #define-trick above
+
bool catNormalFile(const char* const path, const off_t size)
{
int file = open(path, O_RDONLY);
diff --git a/examples/c4info.c b/examples/c4info.c
index 6fa63fe..ef4ace0 100644
--- a/examples/c4info.c
+++ b/examples/c4info.c
@@ -29,6 +29,8 @@ int main(int argc, char* argv[])
else
{
CC4Group_EntryInfo info;
+ // yes, this should be error checked, but this is only an example. and actually, if the root entry info can not be retrieved, there must be some serious problem somewhere else
+ // anyway, the worst thing that can happen would be printing some random uninitialized data to stdout. what a nice surprise!
cc4group.getEntryInfo(group, "", &info);
puts(argv[1]);