⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debug.bak

📁 这是一个在在Dynamic C环境下实现的设备web服务器的建立
💻 BAK
字号:
#class auto

#ifdef FREQ_184320
	#define		FREQ_9600				60
	#define		FREQ_19200				30
#else
	#define		FREQ_9600				36
	#define		FREQ_19200				18
#endif


#define USE_ETHERNET    				0x01

#define TCPCONFIG 	  0

#define LOCAL_IP			"192.192.4.12"
#define LOCAL_NETMASK	"255.255.255.0"
#define LOCAL_GATEWAY	"192.192.4.1"




#memmap xmem
//#ifdef _RAM_
//	#use "HuaHTFTP.lib"
//	#use "BootRom.c"
//#endif
//#use "FiFunc.c"

#use "dcrtcp.lib"

#use "Variables.c"
#use "store.c"

//#define DISABLE_DNS



extern char			bios_divider19200;
extern char			freq_divider;



void main()
{
	#GLOBAL_INIT
	{
	   freq_divider      = FREQ_9600;
	   bios_divider19200 = FREQ_19200;
	}

   RstChip();
   DefVarsInit();
   sock_init();
   SetAddr();


   while (1)
   {
      Calcval();
   }
}

/*
 *  test string what is served by test_cgi.  It is used
 *  as one of the parameters to sprintf() to build a buffer
 *  that is later sent.  The format of the first three lines
 *  is important.
 *
 *  HTTP/1.0 200 OK\r\n
 *  Date: <current date/time from http_date_str()>\r\n
 *  Content-Type: text/html\r\n\r\n
 *
 *  The first line tells the internet browser that the content
 *  was found and will be returned in the body.  The next line
 *  is the date which is followed by the mime type of the body.
 *  Notice the \r\n\r\n.  If you leave out the second \r\n the
 *  browser will assume that the next line is part of the header.
 *  The document follows.
 *
 *  There are many books and online references for the format
 *  of CGI responses.
 *
 */

/*const char teststr[] =
	"HTTP/1.0 200 OK\r\n" \
	"Date: %s\r\n" \
	"Content-Type: text/html\r\n\r\n" \
	"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD W3 HTML//EN\">\r\n" \
	"<HTML>" \
	"<HEAD><TITLE><cgi.c></TITLE></HEAD>" \
	"<BODY><H1>cgi.c, hit count %d</H1>" \
	"      <BR><BR><BR><A HREF=\"%s\">home</A>" \
	"</BODY>" \
	"</HEAD>"; */

/*
 *  This is the internal cgi routine.  It uses teststr to build
 *  a buffer which it uses to respond to the request.
 *
 *  This routine increments the hit count value and uses the
 *  cgi_sendstring routine to send the page.  The cgi_sendstring
 *  routine immediately returns and the string is sent the next
 *  time this server gets a tick.  If you want the server to
 *  immediately close the connection return a one otherwise you
 *  should return a zero.
 *
 */

/*int test_cgi(HttpState* state)
{
	static char date[30];
	static char buffer[512];
	static int hitcount;

	#GLOBAL_INIT { hitcount=0; }

	hitcount++;
	http_date_str(date);

	sprintf(buffer,teststr,date,hitcount,REDIRECTTO);

	cgi_sendstring(state,buffer);
   return 0;
} */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -