if(db->version == 1){
__dw_lockfile(db->fp);
fseek(db->fp, sizeof(sig) + 10, SEEK_SET);
+ struct dataworks_db_v1_indexentry index;
+ printf("%d\n", sizeof(index));
+ int i;
+ for(i = 0; i < 256; i++){
+ fread(&index, 1, sizeof(index), db->fp);
+ if(index.flag & DATAWORKS_V1_INDEXENTRY_USED){
+ printf("%d\n", index.dbname_len);
+ printf("[");
+ fflush(stdout);
+ fwrite(index.dbname, 1, index.dbname_len, stdout);
+ printf("]\n");
+ }
+ }
__dw_unlockfile(db->fp);
}else{
/* Not implemented for the version */
#include <stdint.h>
#include <stdio.h>
+#define PACKED __attribute__((packed))
+
/**
* @~english
* @brief Database struct
* @note See \ref FORMATv1 for more info.
*
*/
+PACKED
struct dataworks_db_v1_indexentry {
uint8_t flag;
uint64_t count;
char fields[4096];
};
+/**
+ * @~english
+ * @brief "Used" bitmask for indexentry for v1 database.
+ * @note See \ref FORMATv1 for more info.
+ *
+ */
+#define DATAWORKS_V1_INDEXENTRY_USED (1 << 7)
+
/**
* @~english
* @brief infoentry for database.
* @note See \ref FORMATv1 for more info.
*
*/
+PACKED
struct dataworks_db_infoentry {
uint16_t version;
uint64_t mtime;