亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? main.c

?? 開發板bios源碼 開發板bios源碼
?? C
字號:
/*
 * main.c -- Main program for the GoAhead WebServer (NetWareversion)
 *
 * Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved.
 *
 * See the file "license.txt" for usage and redistribution license requirements
 *
 * $Id: main.c,v 1.3 2002/01/24 21:57:47 bporter Exp $
 */

/******************************** Description *********************************/

/*
 * Main program for for the GoAhead WebServer. This is a demonstration
 * main program to initialize and configure the web server.
 */

/********************************* Includes ***********************************/

#include "../uemf.h"
#include "../wsIntrn.h"
#include <signal.h>
#include <sys/types.h>

#ifdef WEBS_SSL_SUPPORT
#include "../websSSL.h"
#endif

#ifdef USER_MANAGEMENT_SUPPORT
#include "../um.h"
void  formDefineUserMgmt(void);
#endif


/*********************************** Locals ***********************************/
/*
 * Change configuration here
 */

static char_t     *rootWeb = T("web");       /* Root web directory */
static char_t     *password = T("");            /* Security password */
static int        port = 80;                 /* Server port */
static int        retries = 5;               /* Server port retries */
static int        finished;                  /* Finished flag */

/*********************************** Defines **********************************/
/*
 * Debug defines for testing only (Should be removed for final compile)
 */

#ifdef debug
   #define P( x ) printf( "\rWEBS: %d\n\r", x )
   #define Ps( x, s ) printf( "\rWEBS: %d [%s]\n\r", x, s )
#else
   #define P( x ) 
   #define Ps( x, s ) 
#endif

NETDB_DEFINE_CONTEXT ;
NETINET_DEFINE_CONTEXT ;

/****************************** Forward Declarations **************************/

static void NLMcleanup( void ) ;
static int  initWebs();
static int  aspTest(int eid, webs_t wp, int argc, char_t **argv);
static void formTest(webs_t wp, char_t *path, char_t *query);
static int  websHomePageHandler(webs_t wp, char_t *urlPrefix, char_t *webDir,
            int arg, char_t *url, char_t *path, char_t *query);
extern void defaultErrorHandler(int etype, char_t *msg);
extern void defaultTraceHandler(int level, char_t *buf);

#ifdef B_STATS
static void printMemStats(int handle, char_t *fmt, ...);
static void memLeaks();
#endif

void SigTermSignalHandler( int sigtype );
void NLMcleanup( void );

/*********************************** Code *************************************/
/*
 * Main 
 */

int main(int argc, char** argv)
{
/*
 *	Hook the unload routine in
 */
   signal( SIGTERM, SigTermSignalHandler ) ;

/*
 * Initialize the memory allocator. Allow use of malloc and start 
 * with a 60K heap.  For each page request approx 8KB is allocated.
 * 60KB allows for several concurrent page requests.  If more space
 * is required, malloc will be used for the overflow.
 */
   bopen(NULL, (60 * 1024), B_USE_MALLOC);

   P( 1 ) ;

/*
 *	Switch to LONG name-space. If LONG is not loaded, WEBS will default
 *	to 8.3
 */
   SetCurrentNameSpace( 4 ) ;

/*
 * Initialize the web server
 */
   if (initWebs() < 0) {
      return -1;
   }

#ifdef WEBS_SSL_SUPPORT
   websSSLOpen();
#endif

   P( 20 ) ;

/*
 * Basic event loop. SocketReady returns true when a socket is ready for
 * service. SocketSelect will block until an event occurs. SocketProcess
 * will actually do the servicing.
 */
   while (!finished) {
      if (socketReady(-1) || socketSelect(-1, 1000)) {
         socketProcess(-1);
         ThreadSwitch() ;
      }
      websCgiCleanup();
      emfSchedProcess();
   }

   NLMcleanup() ;

   return 0;
}

/******************************************************************************/
/*
 * Initialize the web server.
 */

static int initWebs()
{
   struct hostent *hp;
   struct in_addr intaddr;
   char   host[128], dir[128], webdir[128];
   char   *cp;
   char_t wbuf[128];
   char_t *ipaddr;

   P( 2 ) ;
/*
 * Initialize the socket subsystem
 */
   socketOpen();

   P( 3 ) ;

#ifdef USER_MANAGEMENT_SUPPORT
/*
 * Initialize the User Management database
 */
   umOpen();
   umRestore(T("umconfig.txt"));
#endif

/*
 * Define the local Ip address, host name, default home page and the 
 * root web directory.
 */
   if (gethostname(host, sizeof(host)) < 0) {
      error(E_L, E_LOG, T("Can't get hostname"));
      return -1;
   }
   
   P( 4 ) ;
   
   if ((hp = gethostbyname(host)) == NULL) {
      error(E_L, E_LOG, T("Can't get host address"));
      return -1;
   }

   P( 5 ) ;

   memcpy((char *) &intaddr, (char *) hp->h_addr_list[0],
      (size_t) hp->h_length);


/*
 * Set ../web as the root web. Modify this to suit your needs
 */
   getcwd(dir, sizeof(dir)); 
   Ps( 6, dir ) ;
   if ((cp = strrchr(dir, '/'))) 
      cp ++ ;
   else
      cp = dir ;

   Ps( 6, cp ) ;
   sprintf(webdir, "%s/%s", cp, rootWeb);

   Ps( 6, webdir ) ;

/*
 * Configure the web server options before opening the web server
 */
   websSetDefaultDir(webdir);
   ipaddr = inet_ntoa(intaddr);
   ascToUni(wbuf, ipaddr, gstrlen(ipaddr) + 1);
   websSetIpaddr(wbuf);
   ascToUni(wbuf, host, gstrlen(host) + 1);
   websSetHost(wbuf);

   P( 7 ) ;

/*
 * Configure the web server options before opening the web server
 */
   websSetDefaultPage(T("default.asp"));
   websSetPassword(password);

   P( 8 ) ;

/* 
 * Open the web server on the given port. If that port is taken, try
 * the next sequential port for up to "retries" attempts.
 */
   websOpenServer(port, retries);

   P( 9 ) ;

/*
 *	First create the URL handlers. Note: handlers are called in sorted order
 *	with the longest path handler examined first. Here we define the security 
 *	handler, forms handler and the default web page handler.
 */
   websUrlHandlerDefine(T(""), NULL, 0, websSecurityHandler, 
      WEBS_HANDLER_FIRST);
   websUrlHandlerDefine(T("/goform"), NULL, 0, websFormHandler, 0);
   websUrlHandlerDefine(T("/cgi-bin"), NULL, 0, websCgiHandler, 0);
   websUrlHandlerDefine(T(""), NULL, 0, websDefaultHandler, 
      WEBS_HANDLER_LAST);

   P( 10 ) ;

/*
 * Now define two test procedures. Replace these with your application
 * relevant ASP script procedures and form functions.
 */
   websAspDefine(T("aspTest"), aspTest);
   websFormDefine(T("formTest"), formTest);

   P( 11 ) ;

/*
 * Create the Form handlers for the User Management pages
 */
#ifdef USER_MANAGEMENT_SUPPORT
   formDefineUserMgmt();
#endif

/*
 * Create a handler for the default home page
 */
   websUrlHandlerDefine(T("/"), NULL, 0, websHomePageHandler, 0);

   P( 12 ) ;

   return 0;
}

/******************************************************************************/
/*
 * Cleanup routine (prevents duplicate code)
 */

void NLMcleanup( void )
{
   P( 23 ) ;

#ifdef WEBS_SSL_SUPPORT
   websSSLClose();
#endif

#ifdef USER_MANAGEMENT_SUPPORT
   umClose();
#endif

/*
 * Close the socket module, report memory leaks and close the memory allocator
 */
   websCloseServer();
   
   P( 24 ) ;

   socketClose();
#ifdef B_STATS
   memLeaks();
#endif
   P( 25 ) ;

   bclose();

   P( 26 ) ;
}

/******************************************************************************/
/*
 *	Routine to handle the UNLOAD command gracefully
 *	Note:	sigtype is not used
 */

#pragma off(unreferenced)
void SigTermSignalHandler( int sigtype )
#pragma on(unreferenced)
{
   finished ++ ;
   NLMcleanup() ;
}

/******************************************************************************/
/*
 * Test Javascript binding for ASP. This will be invoked when "aspTest" is
 * embedded in an ASP page. See web/asp.asp for usage. Set browser to 
 * "localhost/asp.asp" to test.
 */

static int aspTest(int eid, webs_t wp, int argc, char_t **argv)
{
   char_t   *name, *address;

   if (ejArgs(argc, argv, T("%s %s"), &name, &address) < 2) {
      websError(wp, 400, T("Insufficient args\n"));
      return -1;
   }
   return websWrite(wp, T("Name: %s, Address %s"), name, address);
}

/******************************************************************************/
/*
 * Test form for posted data (in-memory CGI). This will be called when the
 * form in web/forms.asp is invoked. Set browser to "localhost/forms.asp" to test.
 */

static void formTest(webs_t wp, char_t *path, char_t *query)
{
   char_t   *name, *address;

   name = websGetVar(wp, T("name"), T("Joe Smith")); 
   address = websGetVar(wp, T("address"), T("1212 Milky Way Ave.")); 

   websHeader(wp);
   websWrite(wp, T("<body><h2>Name: %s, Address: %s</h2>\n"), name, address);
   websFooter(wp);
   websDone(wp, 200);
}

/******************************************************************************/
/*
 * Home page handler
 */

static int websHomePageHandler(webs_t wp, char_t *urlPrefix, char_t *webDir,
   int arg, char_t *url, char_t *path, char_t *query)
{
/*
 * If the empty or "/" URL is invoked, redirect default URLs to the home page
 */
   if (*url == '\0' || gstrcmp(url, T("/")) == 0) {
      websRedirect(wp, T("home.asp"));
      return 1;
   }
   return 0;
}

/******************************************************************************/
/*
 * Default error handler.  The developer should insert code to handle
 * error messages in the desired manner.
 */

void defaultErrorHandler(int etype, char_t *msg)
{
#if 0
   write(1, msg, gstrlen(msg));
#endif
}

/******************************************************************************/
/*
 * Trace log. Customize this function to log trace output
 */

void defaultTraceHandler(int level, char_t *buf)
{
/*
 * The following code would write all trace regardless of level
 * to stdout.
 */
#if 0
   if (buf) {
      write(1, buf, gstrlen(buf));
   }
#endif
}

/******************************************************************************/
/*
 * Returns a pointer to an allocated qualified unique temporary file name.
 * This filename must eventually be deleted with bfree();
 */

char_t *websGetCgiCommName()
{
   char_t   *pname;

   pname = bstrdup(B_L, tmpnam( NULL ) );
   return pname;
}



/******************************************************************************/
/*
 * Launch the CGI process and return a handle to it.
 */

int websLaunchCgiProc(char_t *cgiPath, char_t **argp, char_t **envp,
                 char_t *stdIn, char_t *stdOut)
{
   int   pid, fdin, fdout, hstdin, hstdout, rc;

   fdin = fdout = -1; 
   if ((fdin = open(stdIn, O_RDWR | O_CREAT, 0666)) < 0 ||
      (fdout = open(stdOut, O_RDWR | O_CREAT, 0666)) < 0 )
      goto DONE;

/*	COMMENTED BLOCK 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产经典色站一区二区三区| 亚洲黄色片在线观看| 中文字幕在线一区二区三区| 日韩黄色片在线观看| 丁香六月久久综合狠狠色| 欧美日韩三级一区二区| 国产精品素人一区二区| 久久99热狠狠色一区二区| 欧美亚洲综合色| 国产精品久久久久久久久久免费看 | 欧美sm美女调教| 亚洲国产综合在线| 91色视频在线| 国产精品欧美久久久久一区二区| 亚洲不卡在线观看| 日韩av一区二| 色悠久久久久综合欧美99| 精品国产一二三区| 亚洲 欧美综合在线网络| 91在线视频观看| 中文字幕国产一区二区| 国产一区二区三区免费播放| 欧美成人r级一区二区三区| 五月激情丁香一区二区三区| 在线观看免费成人| 一区二区在线观看免费| 色999日韩国产欧美一区二区| 中文字幕一区免费在线观看| 国产成人av电影在线播放| 久久婷婷久久一区二区三区| 老司机精品视频导航| 精品国产免费人成在线观看| 久久精品免费看| 欧美成人官网二区| 午夜精品久久久| 91黄色小视频| 亚洲免费色视频| 不卡的电视剧免费网站有什么| 久久久精品欧美丰满| 国产高清在线观看免费不卡| 日本一区二区在线不卡| 92精品国产成人观看免费| 1024成人网| 91国偷自产一区二区开放时间 | 韩国成人精品a∨在线观看| 精品国产一区二区亚洲人成毛片| 欧美在线观看一区二区| 日本黄色一区二区| 一二三区精品福利视频| 欧美日韩1区2区| 秋霞国产午夜精品免费视频| 日韩欧美国产wwwww| 久久精品国产精品亚洲综合| 国产日韩欧美不卡在线| 99国产一区二区三精品乱码| 亚洲综合精品久久| 91精品国产综合久久蜜臀| 国产做a爰片久久毛片| 国产精品久久久久影院亚瑟 | 国产日韩三级在线| 粉嫩蜜臀av国产精品网站| 亚洲精品少妇30p| 这里是久久伊人| 国产成人综合精品三级| 亚洲四区在线观看| 欧美日韩综合一区| 久久国产精品色| 亚洲欧洲一区二区三区| 制服.丝袜.亚洲.中文.综合| 极品少妇一区二区| 亚洲精选视频免费看| 日韩一区二区三区免费看 | 欧美日韩综合不卡| 国产一区二区三区国产| 亚洲一区二区三区国产| 国产喂奶挤奶一区二区三区| 欧美日韩成人高清| 成人天堂资源www在线| 亚洲成a人v欧美综合天堂下载| 欧美亚洲国产怡红院影院| 久久 天天综合| 亚洲一级二级在线| 欧美国产视频在线| 91麻豆精品国产| 91一区二区在线| 国产精品一区二区你懂的| 婷婷综合另类小说色区| 亚洲欧美一区二区在线观看| 欧美精品一区在线观看| 欧美老人xxxx18| 色综合久久66| 成人免费视频一区二区| 精品综合久久久久久8888| 一区二区三区四区在线| 国产精品美女久久久久aⅴ | 亚洲免费观看高清完整 | 日韩欧美国产三级| 在线亚洲欧美专区二区| 波多野结衣一区二区三区 | 久久99国内精品| 丝袜美腿高跟呻吟高潮一区| 亚洲欧美电影院| 国产精品色噜噜| 国产偷v国产偷v亚洲高清| 精品少妇一区二区| 欧美成人乱码一区二区三区| 日韩网站在线看片你懂的| 91精品国产色综合久久| 欧美在线影院一区二区| 91高清视频在线| 色综合一个色综合亚洲| 色综合久久久久网| 色综合久久中文字幕综合网| 在线观看三级视频欧美| 色婷婷激情综合| 欧美揉bbbbb揉bbbbb| 欧美日韩一区二区电影| 欧美人xxxx| 欧美精品日韩精品| 在线播放中文一区| 日韩精品一区二区三区老鸭窝| 国产91精品一区二区麻豆网站| 午夜国产不卡在线观看视频| 午夜精品一区二区三区电影天堂| 五月天中文字幕一区二区| 五月婷婷欧美视频| 另类小说欧美激情| 在线一区二区三区四区五区| 欧美性生活大片视频| 91精品国产综合久久久久| 精品久久国产老人久久综合| 国产人妖乱国产精品人妖| 国产精品久久久久久久久免费丝袜 | 韩国视频一区二区| 成人av资源站| 欧美专区在线观看一区| 日韩欧美一区在线| 国产亚洲综合在线| 亚洲欧美日韩在线不卡| 爽好久久久欧美精品| 激情丁香综合五月| 99精品视频一区二区三区| 在线电影一区二区三区| 久久久久99精品一区| 亚洲精选免费视频| 精品成人佐山爱一区二区| 亚洲国产高清在线| 亚洲欧洲国产日韩| 亚洲国产精品久久久久婷婷884| 日韩有码一区二区三区| 久久国产精品99久久人人澡| 99免费精品在线| 91精品国产色综合久久不卡蜜臀| 久久一区二区视频| 亚洲午夜电影网| 国产999精品久久久久久| 在线电影院国产精品| 欧美韩国日本一区| 免费一级片91| 一本大道综合伊人精品热热| 精品精品国产高清a毛片牛牛| 亚洲精品伦理在线| 国产一区二区影院| 欧美视频一区二区三区| 中文字幕av在线一区二区三区| 日本特黄久久久高潮| 91丨porny丨户外露出| 欧美一二三在线| 一二三区精品视频| 成年人网站91| 欧美大黄免费观看| 亚洲一区在线观看免费 | 国产精品自拍在线| 欧美日韩高清影院| 日韩美女视频一区| 国内精品视频666| 欧美一级精品大片| 亚洲综合成人网| 91免费在线视频观看| 国产视频一区在线播放| 麻豆成人综合网| 欧美日韩一区视频| 亚洲精品国产无天堂网2021| 成人avav影音| 欧美激情在线一区二区| 狠狠色伊人亚洲综合成人| 欧美日韩一卡二卡三卡 | 欧美日韩国产免费一区二区| 中文字幕字幕中文在线中不卡视频| 激情综合五月天| 日韩免费看的电影| 免费一区二区视频| 91精品国产免费| 调教+趴+乳夹+国产+精品| 欧美亚洲一区二区在线| 亚洲国产日韩综合久久精品| 在线免费观看日韩欧美| 亚洲免费av高清| 欧美日韩日日摸| 香港成人在线视频|