From: John Hodge Date: Fri, 25 Feb 2011 01:03:22 +0000 (+0800) Subject: Fixed client returning 0 for error conditions (zero gives specifically) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=9c09d7c9d308ebbf61fcbb09ded6d193eaced270;hp=7dcb4f540cf662f60433cd9822f73969d5800cce;p=tpg%2Fopendispense2.git Fixed client returning 0 for error conditions (zero gives specifically) --- diff --git a/src/client/main.c b/src/client/main.c index 9863814..342441a 100644 --- a/src/client/main.c +++ b/src/client/main.c @@ -1488,6 +1488,12 @@ int Dispense_AlterBalance(int Socket, const char *Username, int Ammount, const c printf("Dry Run - No action\n"); return 0; } + + // Sanity + if( Ammount == 0 ) { + printf("An ammount would be nice\n"); + return 1; + } sendf(Socket, "ADD %s %i %s\n", Username, Ammount, Reason); buf = ReadLine(Socket); @@ -1563,13 +1569,13 @@ int Dispense_Give(int Socket, const char *Username, int Ammount, const char *Rea if( Ammount < 0 ) { printf("Sorry, you can only give, you can't take.\n"); - return -1; + return 1; } // Fast return on zero if( Ammount == 0 ) { printf("Are you actually going to give any?\n"); - return 0; + return 1; } // Check for a dry run @@ -1623,7 +1629,7 @@ int Dispense_Donate(int Socket, int Ammount, const char *Reason) // Fast return on zero if( Ammount == 0 ) { printf("Are you actually going to give any?\n"); - return 0; + return 1; } // Check for a dry run