// Printf("running (%ld bytes avail)\n", AvailMem(0)); #define __CLIB_PRAGMA_LIBCALL #include #include #define __NOLIBBASE__ #include "containers/stringarray.h" #include "containers/linearray.h" #include "configmodel.h" #include WORD DoTheWork(STRPTR filename); VOID ProcessFile(BPTR configFile); char *vers="\0$VER: ConfigReader (dd.mm.yyyy)"; char *stacksize = "$STACK:8192"; // only works when started from CLI struct Library *ContainerkitBase; WORD DoTheWork(STRPTR filename) { WORD result = RETURN_OK; STRPTR joined = NULL; if (ContainerkitBase) { StringArray parts = ConfigFileSplitKey("foo.bar.baz.blah"); StringArrayForEach(parts, Printf("[%s]\n",aString);); // joined = StringArrayJoined(parts, '>'); // Printf("{%s}", joined); // FreeVec(joined); StringArrayFree(parts); // CONFIGFILEPTR config = ConfigFileRead(filename); // if( config != NULL ) // { // Printf("XXXXXXX\n"); // ConfigFileDump(config); // Printf("XXXXXXX\n"); // ConfigFileFree(config); // } // else // { // result = RETURN_ERROR; // } } return result; } WORD main(WORD argc, STRPTR *argv) { WORD result = RETURN_OK; // this does nothing but the first call to Print drops a bunch of memory, // I assume because of opening some resource so this means my start and // end markers are "clean" and I can ensure I'm not leaking. Printf("\n"); ContainerkitBase = OpenLibrary("containerkit.library", 1); if( ContainerkitBase ) { Printf("\n\nrunning (%ld bytes avail)\n\n", AvailMem(0)); result = DoTheWork(argv[1]); Printf("\n\ndone (%ld bytes avail)\n\n", AvailMem(0)); CloseLibrary(ContainerkitBase); } else { Printf("failed to open library\n"); result = RETURN_ERROR; } return result; }