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

📄 ntp_setup_cgi.c

📁 使用C语言的cgi程序
💻 C
字号:
#ifndef _NTP__SETUP_CGI_C_#define _NTP_SETUP_CGI_C_#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/stat.h>#include "ntp_setup.h"#include "parser.h"#include "system.h"#include "wan.h"#include "dev_opt.h"#include "ntp_setup.h"static int r2t_ntp_enable(char buf[CGI_BUF_LEN],char **buf1){	sprintf(buf,"%d",ntp_conf.ntp_enable);	return 0;}static int r2t_server_select(char buf[CGI_BUF_LEN],char **buf1){	sprintf(buf,"%d",ntp_conf.server_select);	return 0;}static int r2t_ntp_server_ip(char buf[CGI_BUF_LEN],char **buf1){	sprintf(buf,ntp_conf.ntp_server_ip);	return 0;}static int r2t_ntp_server_domain(char buf[CGI_BUF_LEN],char **buf1){	sprintf(buf,ntp_conf.ntp_server_domain);	return 0;}static int r2t_ntp_timezone(char buf[CGI_BUF_LEN],char **buf1){	sprintf(buf,"%d",ntp_conf.ntp_timezone);	return 0;}static int r2t_message(char buf[CGI_BUF_LEN],char **buf1){	set_err_msg(buf,buf1);	return 0;}				static int t2r_ntp_enable(const char *value,int index){	ntp_conf.ntp_enable = atoi(value); 	return 0 ;}	static int t2r_ntp_server_ip(const char *value,int index){	sprintf(ntp_conf.ntp_server_ip,value);	return 0;}static int t2r_ntp_server_domain(const char *value,int index){	sprintf(ntp_conf.ntp_server_domain,value);	return 0;}	static int t2r_server_select(const char *value,int index){	ntp_conf.server_select = atoi(value); 	return 0 ;}static int t2r_ntp_timezone(const char *value,int index){	ntp_conf.ntp_timezone = atoi(value); 	return 0 ;}static int t2r_save(const char *value,int index){	return 0;}	static int t2r_help(const char *value,int index){	return 0;}	static int t2r_message(const char *value,int index){	return 0;}	int ntp_setup_main(void){	LIST *hd=NULL;	int ccode;	char cmd[128],timezone[50];		ccode=ReadNTPConf(&ntp_conf);		if(strcmp(REQUEST_METHOD,POST) == 0)	{		hd=cgi_input_parse() ;				if(!hd)		{			cgi_err("","");		}		if(!do_cgi_t2r(hd, key_fun_tab))		{			if(fork()==0)			{				cgi_fork_do();				time_zone_adjust();				exit(0);			}			if((ccode=SaveNTPConf(&ntp_conf))==NTP_SaveConfErr)			{				fmt_err_msg("Save Error in ntp_main function!!!!!") ;			}			else			{				WriteConfToFlash();			}		}	}	ccode =  html_parser("ntp_setup.htm", key_fun_tab);	return ccode;	}#endif /* _NTP_SETUP_CGI_C_ */

⌨️ 快捷键说明

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