Initial move to common config code directory
[tpg/opendispense2.git] / src / server / common.h
index 7ad01c5..1bdca84 100644 (file)
 #define        DEFAULT_ITEM_FILE       "/etc/opendispense/items.cfg"
 
 // === HELPER MACROS ===
-#define _EXPSTR(x)     #x
-#define EXPSTR(x)      _EXPSTR(x)
 
-#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)
+#define UNUSED(var)    unused__##var __attribute__((__unused__))
 
 // === STRUCTURES ===
 typedef struct sItem   tItem;
@@ -91,20 +87,16 @@ extern int  DispenseItem(int ActualUser, int User, tItem *Item);
 extern int     DispenseRefund(int ActualUser, int DestUser, tItem *Item, int OverridePrice);
 extern int     DispenseGive(int ActualUser, int SrcUser, int DestUser, int Ammount, const char *ReasonGiven);
 extern int     DispenseAdd(int ActualUser, int User, int Ammount, const char *ReasonGiven);
-extern int     DispenseSet(int ActualUser, int User, int Balance, const char *ReasonGiven);
+extern int     DispenseSet(int ActualUser, int User, int Balance, const char *ReasonGiven, int *OrigBalance);
 extern int     DispenseDonate(int ActualUser, int User, int Ammount, const char *ReasonGiven);
 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, ...);
-
-// --- 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);
+// 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)
 
 #endif

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