Jelajahi Sumber

delete finsh macro judge

luo jiao 7 tahun lalu
induk
melakukan
d97195ba60

+ 2 - 4
httpclient/httpclient_sample.c

@@ -25,6 +25,7 @@
 #include <sys/socket.h> /* 使用BSD socket,需要包含socket.h头文件 */
 #include <netdb.h>
 #include <cJSON.h>
+#include <finsh.h>
 
 #define BUF_SZ       4096        //缓冲区大小
 #define URL_LEN_MAX  256         //网址最大长度
@@ -140,8 +141,5 @@ __exit:
         rt_free(ptr);
 }
 
-#ifdef FINSH_USING_MSH
-#include <finsh.h>
-
 MSH_CMD_EXPORT(weather, Get weather by webclient);
-#endif
+

+ 1 - 3
tcpclient/tcpclient_sample.c

@@ -20,6 +20,7 @@
 #include <sys/socket.h> /* 使用BSD socket,需要包含socket.h头文件 */
 #include <netdb.h>
 #include <string.h>
+#include <finsh.h>
 
 #define BUFSZ   1024
 
@@ -147,8 +148,5 @@ void tcpclient(int argc, char **argv)
     }
     return;
 }
-#ifdef FINSH_USING_MSH
-#include <finsh.h>
 
 MSH_CMD_EXPORT(tcpclient, a tcp client sample);
-#endif

+ 9 - 9
tcpclient_select/tcpclient_select_sample.c

@@ -7,20 +7,22 @@
  * Date             Author      Notes
  * 
  */
-/*
- * 程序清单:tcp 客户端
+/* 程序清单:利用 select 实现的 tcp 客户端
  *
- * 这是一个 tcp 客户端的例程
- * 导出 tcpclient 命令到控制终端
- * 命令调用格式:tcpclient URL PORT
+ * 这是一个 利用 select 实现 tcp 客户端的例程
+ * 导出 tcpclient_select 命令到控制终端
+ * 命令调用格式:tcpclient_select URL PORT
  * URL:服务器地址 PORT::端口号
- * 程序功能:接收并显示从服务端发送过来的信息,接收到开头是 'q' 或 'Q' 的信息退出程序
+ * 程序功能:利用 select 监听 socket 是否有数据到达,
+ * 有数据到达的话再接收并显示从服务端发送过来的信息,
+ * 接收到开头是 'q' 或 'Q' 的信息退出程序
 */
 #include <rtthread.h>
 #include <sys/socket.h> /* 使用BSD socket,需要包含socket.h头文件 */
 #include <netdb.h>
 #include <sys/select.h> /* 使用 dfs select 功能  */
 #include <string.h>
+#include <finsh.h>
 
 #define BUFSZ   1024
 
@@ -169,8 +171,6 @@ void tcpclient_select(int argc, char **argv)
     }
     return;
 }
-#ifdef FINSH_USING_MSH
-#include <finsh.h>
 
 MSH_CMD_EXPORT(tcpclient_select, a tcp client sample by select api);
-#endif
+

+ 1 - 3
tcpserver/tcpserver_sample.c

@@ -20,6 +20,7 @@
 #include <sys/socket.h> /* 使用BSD socket,需要包含socket.h头文件 */
 #include <netdb.h>
 #include <string.h>
+#include <finsh.h>
 
 #define BUFSZ       (1024)
 
@@ -161,8 +162,5 @@ static void tcpserv(int argc, char **argv)
 
     return ;
 }
-#ifdef FINSH_USING_MSH
-#include <finsh.h>
 
 MSH_CMD_EXPORT(tcpserv, a tcp server sample);
-#endif

+ 1 - 4
udpclient/udpclient_sample.c

@@ -20,6 +20,7 @@
 #include <sys/socket.h> /* 使用BSD socket,需要包含sockets.h头文件 */
 #include <netdb.h>
 #include <string.h>
+#include <finsh.h>
 
 const char send_data[] = "This is UDP Client from RT-Thread.\n"; /* 发送用到的数据 */
 void udpclient(int argc, char **argv)
@@ -77,9 +78,5 @@ void udpclient(int argc, char **argv)
     /* 关闭这个socket */
     closesocket(sock);
 }
-#ifdef FINSH_USING_MSH
-#include <finsh.h>
 
 MSH_CMD_EXPORT(udpclient, a udp client sample);
-#endif
-

+ 1 - 3
udpserver/udpserver_sample.c

@@ -20,6 +20,7 @@
 #include <sys/socket.h> /* 使用BSD socket,需要包含socket.h头文件 */
 #include <netdb.h>
 #include <string.h>
+#include <finsh.h>
 
 #define BUFSZ   1024
 
@@ -98,8 +99,5 @@ static void udpserv(int argc, char **argv)
 
     return;
 }
-#ifdef FINSH_USING_MSH
-#include <finsh.h>
 
 MSH_CMD_EXPORT(udpserv, a udp server sample);
-#endif