From: John Hodge Date: Tue, 23 Aug 2011 23:47:27 +0000 (+0800) Subject: Client - Switched back to cents display, fixed an infinite loop in ReadLine X-Git-Url: https://git.ucc.asn.au/?p=tpg%2Fopendispense2.git;a=commitdiff_plain;h=3432da85567f41563026c4ae9ef1edf958f57715 Client - Switched back to cents display, fixed an infinite loop in ReadLine --- diff --git a/src/client/main.c b/src/client/main.c index 8c4237e..bf04443 100644 --- a/src/client/main.c +++ b/src/client/main.c @@ -1112,7 +1112,7 @@ int ShowItemAt(int Row, int Col, int Width, int Index, int bHilighted) if( Width > 0 ) { // 4 preceding, 5 price - int nameWidth = Width - 4 - 4 - snprintf(NULL, 0, "%i", price/100); + int nameWidth = Width - 4 - snprintf(NULL, 0, " %4i", price); move( Row, Col ); if( Index >= 0 ) @@ -1138,7 +1138,7 @@ int ShowItemAt(int Row, int Col, int Width, int Index, int bHilighted) printw("%-*.*s", nameWidth, nameWidth, name); - printw(" %i.%02i", price/100, price%100); + printw(" %4i", price); } else { @@ -2253,9 +2253,10 @@ char *ReadLine(int Socket) if( newline ) { int newLen = newline - (buf+bufPos) + 1; bufValid = len - newLen; - bufPos += newLen; + len = newLen; } if( len + bufPos == BUFSIZ - 1 ) bufPos = 0; + else bufPos += len; } #if DEBUG_TRACE_SERVER