Server - Fixed leaked file handles in both itemdb and modbus
[tpg/opendispense2.git] / src / server / common.h
index 19337e5..74c42d9 100644 (file)
@@ -22,6 +22,8 @@
 
 #define UNUSED(var)    unused__##var __attribute__((__unused__))
 
+#define ASSERT(cnd) do{if(!(cnd)){fprintf(stderr, "ASSERT failed at "__FILE__":"EXPSTR(__LINE__)" - "EXPSTR(cnd)"\n");exit(-1);}}while(0)
+
 // === STRUCTURES ===
 typedef struct sItem   tItem;
 typedef struct sUser   tUser;
@@ -71,6 +73,7 @@ extern int    giNumItems;
 extern tHandler        *gaHandlers[];
 extern int     giNumHandlers;
 extern int     giDebugLevel;
+extern int     gbNoCostMode;
 
 // === FUNCTIONS ===
 extern void    Items_UpdateFile(void);
@@ -93,7 +96,19 @@ extern int   DispenseDonate(int ActualUser, int User, int Ammount, const char *Rea
 extern int     DispenseUpdateItem(int User, tItem *Item, const char *NewName, int NewPrice);
 
 // --- Logging ---
+// to syslog
 extern void    Log_Error(const char *Format, ...);
 extern void    Log_Info(const char *Format, ...);
+// To stdout
+#define Debug_Notice(msg, v...)        fprintf(stderr, "%08llun: "msg"\n", (unsigned long long)time(NULL) ,##v)
+#define Debug_Debug(msg, v...) fprintf(stderr, "%08llud: "msg"\n", (unsigned long long)time(NULL) ,##v)
+
+// --- Config Database ---
+extern void    Config_ParseFile(const char *Filename);
+extern void    Config_AddValue(const char *Key, const char *Value);
+extern int     Config_GetValueCount(const char *KeyName);
+extern const char      *Config_GetValue(const char *KeyName, int Index);
+extern int     Config_GetValue_Bool(const char *KeyName, int Index);
+extern int     Config_GetValue_Int(const char *KeyName, int Index);
 
 #endif

UCC git Repository :: git.ucc.asn.au