+ // Ask the coke machine
+ Writef("s%i\r\n", Item);
+
+ #if TRACE_COKE
+ printf("Coke_CanDispense: reading response\n");
+ #endif
+ // Read from the machine (ignoring empty lines)
+ while( (ret = ReadLine(sizeof(tmp)-1, tmp)) == 0 );
+ #if TRACE_COKE
+ printf("ret = %i, tmp = '%s'\n", ret, tmp);
+ #endif
+ // Read back-echoed lines
+ while( tmp[0] == ':' || tmp[1] != 'l' )
+ {
+ ret = ReadLine(sizeof(tmp)-1, tmp);
+ printf("ret = %i, tmp = '%s'\n", ret, tmp);
+ }
+
+ // Catch an error