From 139d1e959364eccb361f7363815d386274bad8f0 Mon Sep 17 00:00:00 2001
From: Jan Breuer <jan.breuer@jaybee.cz>
Date: 周五, 13 11月 2015 08:25:23 +0800
Subject: [PATCH] Add SCPI_ResultXYZ unit tests for basic types

---
 examples/test-interactive/main.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/examples/test-interactive/main.c b/examples/test-interactive/main.c
index b149558..06b2fca 100644
--- a/examples/test-interactive/main.c
+++ b/examples/test-interactive/main.c
@@ -45,14 +45,14 @@
     return fwrite(data, 1, len, stdout);
 }
 
-scpi_result_t SCPI_Flush(scpi_t * context) {    
+scpi_result_t SCPI_Flush(scpi_t * context) {
     return SCPI_RES_OK;
 }
 
 int SCPI_Error(scpi_t * context, int_fast16_t err) {
     (void) context;
 
-    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int32_t) err, SCPI_ErrorTranslate(err));
+    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int16_t) err, SCPI_ErrorTranslate(err));
     return 0;
 }
 
@@ -65,11 +65,6 @@
     return SCPI_RES_OK;
 }
 
-scpi_result_t SCPI_Test(scpi_t * context) {
-    fprintf(stderr, "**Test\r\n");
-    return SCPI_RES_OK;
-}
-
 scpi_result_t SCPI_Reset(scpi_t * context) {
     fprintf(stderr, "**Reset\r\n");
     return SCPI_RES_OK;
@@ -78,6 +73,7 @@
 scpi_result_t SCPI_SystemCommTcpipControlQ(scpi_t * context) {
     return SCPI_RES_ERR;
 }
+
 /*
  * 
  */
@@ -92,8 +88,10 @@
     printf("SCPI Interactive demo\r\n");
     char smbuffer[10];
     while (1) {
-         fgets(smbuffer, 10, stdin);
-         SCPI_Input(&scpi_context, smbuffer, strlen(smbuffer));
+        if (NULL == fgets(smbuffer, 10, stdin)) {
+            break;
+        }
+        SCPI_Input(&scpi_context, smbuffer, strlen(smbuffer));
     }
 
 

--
Gitblit v1.9.1