Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -13,11 +13,11 @@ example.c: $(shell find example -type f) $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-c xvfs-create Makefile rm -f example.c.new.1 example.c.new.2 ./xvfs-create-c --directory example --name example > example.c.new.1 ./xvfs-create --directory example --name example > example.c.new.2 - #diff -u example.c.new.1 example.c.new.2 + bash -c "diff -u <(grep -v '^ *$$' example.c.new.1) <(grep -v '^ *$$' example.c.new.2)" || : rm -f example.c.new.2 mv example.c.new.1 example.c example-standalone.o: example.c xvfs-core.h xvfs-core.c Makefile $(CC) $(CPPFLAGS) -DXVFS_MODE_STANDALONE $(CFLAGS) -o example-standalone.o -c example.c Index: lib/xvfs/xvfs.tcl ================================================================== --- lib/xvfs/xvfs.tcl +++ lib/xvfs/xvfs.tcl @@ -125,19 +125,19 @@ } ::xvfs::_emitLine "\t\{" ::xvfs::_emitLine "\t\t.name = \"[sanitizeCString $outputFile]\"," ::xvfs::_emitLine "\t\t.type = $type," - ::xvfs::_emitLine "\t\t.size = $size," switch -exact -- $fileInfo(type) { "file" { - ::xvfs::_emitLine "\t\t.data.fileContents = (const unsigned char *) $data" + ::xvfs::_emitLine "\t\t.data.fileContents = (const unsigned char *) $data," } "directory" { - ::xvfs::_emitLine "\t\t.data.dirChildren = $children" + ::xvfs::_emitLine "\t\t.data.dirChildren = $children," } } + ::xvfs::_emitLine "\t\t.size = $size" ::xvfs::_emitLine "\t\}," } proc ::xvfs::processDirectory {fsName directory {subDirectory ""}} { set subDirectories [list] Index: xvfs-create-c.c ================================================================== --- xvfs-create-c.c +++ xvfs-create-c.c @@ -186,11 +186,10 @@ child_count = child_idx; fprintf(outfp, "\t{\n"); fprintf(outfp, "\t\t.name = \"%s\",\n", prefix); fprintf(outfp, "\t\t.type = XVFS_FILE_TYPE_DIR,\n"); - fprintf(outfp, "\t\t.size = %lu,\n", child_count); fprintf(outfp, "\t\t.data.dirChildren = (const char *[]) {"); for (child_idx = 0; child_idx < child_count; child_idx++) { if (child_idx != 0) { fprintf(outfp, ", "); } @@ -197,11 +196,12 @@ fprintf(outfp, "\"%s\"", children[child_idx]); free(children[child_idx]); } - fprintf(outfp, "}\n"); + fprintf(outfp, "},\n"); + fprintf(outfp, "\t\t.size = %lu\n", child_count); free(children); fprintf(outfp, "\t},\n");