Initial move to common config code directory
[tpg/opendispense2.git] / src / server / server.c
index 6077b9b..11846bb 100644 (file)
@@ -10,6 +10,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "common.h"
+#include "../common/config.h"
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -28,9 +29,6 @@
 
 #define PIDFILE        "/var/run/dispsrv.pid"
 
-#define Debug_Notice(msg, v...)        printf("%08llun: "msg"\n", (unsigned long long)time(NULL) ,##v)
-#define Debug_Debug(msg, v...) printf("%08llud: "msg"\n", (unsigned long long)time(NULL) ,##v)
-
 // Statistics
 #define MAX_CONNECTION_QUEUE   5
 #define INPUT_BUFFER_SIZE      256
@@ -1168,17 +1166,15 @@ void Server_Cmd_SET(tClient *Client, char *Args)
                return ;
        }
 
+       int origBalance, rv;
        // Do give
-       switch( DispenseSet(Client->UID, uid, iAmmount, reason) )
+       switch( rv = DispenseSet(Client->UID, uid, iAmmount, reason, &origBalance) )
        {
        case 0:
-               sendf(Client->Socket, "200 Add OK\n");
-               return ;
-       case 2:
-               sendf(Client->Socket, "402 Poor Guy\n");
+               sendf(Client->Socket, "200 Add OK (%i)\n", origBalance);
                return ;
        default:
-               sendf(Client->Socket, "500 Unknown error\n");
+               sendf(Client->Socket, "500 Unknown error (%i)\n", rv);
                return ;
        }
 }

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