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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? pc.c

?? 很不錯(cuò)的tcpip源碼, 尤其是針對(duì)嵌入式系統(tǒng)編程來(lái)說(shuō)是個(gè)非常不錯(cuò)的選擇
?? C
字號(hào):
/* OS- and machine-dependent stuff for IBM-PC running MS-DOS and Turbo-C
 */
#include <stdio.h>
#include <conio.h>
#include <dir.h>
#include <dos.h>
#include <io.h>
#include <sys/stat.h>
#include <string.h>
#include <process.h>
#include <fcntl.h>
/*#include <alloc.h> */
#include <stdarg.h>
#include <bios.h>
#include <time.h>
#include "global.h"
#include "mbuf.h"
#include "proc.h"
#include "iface.h"
#include "internet.h"
#include "session.h"
#include "socket.h"
#include "usock.h"
#include "cmdparse.h"
#include "nospc.h"
#include "display.h"

static void statline(struct display *dp,struct session *sp);

extern int Curdisp;
extern struct proc *Display;
unsigned _stklen = 8192;
int Tick;
static int32 Clock;
extern INTERRUPT (*Kbvec)();

/* This flag is set by setirq() if IRQ 8-15 is used, indicating
 * that the machine is a PC/AT with a second 8259 interrupt controller.
 * If this flag is set, the interrupt return code in pcgen.asm will
 * send an End of Interrupt command to the second 8259 as well as the
 * first.
 */
#ifdef	CPU386
int Isat = 1;
#else
int Isat;
#endif

static int saved_break;

int
errhandler(errval,ax,bp,si)
int errval,ax,bp,si;
{
	return 3;	/* Fail the system call */
}

/* Called at startup time to set up console I/O, memory heap */
void
ioinit()
{
	union REGS inregs;

	/* Increase the size of the file table.
	 * Note: this causes MS-DOS
	 * to allocate a block of memory to hold the larger file table.
	 * By default, this happens right after our program, which means
	 * any further sbrk() calls from morecore (called from malloc)
	 * will fail. Hence there is now code in alloc.c that can call
	 * the MS-DOS allocmem() function to grab additional MS-DOS
	 * memory blocks that are not contiguous with the program and
	 * put them on the heap.
	 */
	inregs.h.ah = 0x67;
	inregs.x.bx = Nfiles;	/* Up to the base of the socket numbers */
	intdos(&inregs,&inregs);	

	/* Allocate space for the fd reference count table */
	Refcnt = (unsigned *)calloc(sizeof(unsigned),Nfiles);

	Refcnt[3] = 1;
	Refcnt[4] = 1;
	_close(3);
	_close(4);

	/* Fail all I/O errors */
	harderr(errhandler);

	saved_break = getcbrk();
	setcbrk(0);

	/* Link timer handler into timer interrupt chain */
	chtimer(btick);

	/* Find out what multitasker we're running under, if any */
	chktasker();

	/* Hook keyboard interrupt */
	Kbvec = getirq(KBIRQ);
	setirq(KBIRQ,kbint);
}
/* Called just before exiting to restore console state */
void
iostop()
{
	struct iface *ifp,*iftmp;
	void (**fp)(void);

	setcbrk(saved_break);

	for(ifp = Ifaces;ifp != NULL;ifp = iftmp){
		iftmp = ifp->next;
		if_detach(ifp);
	}
	/* Call list of shutdown functions */
	for(fp = Shutdown;*fp != NULL;fp++){
		(**fp)();
	}
	fcloseall();
	setirq(KBIRQ,Kbvec);	/* Restore original keyboard vec */
}
/* Spawn subshell */
int
doshell(argc,argv,p)
int argc;
char *argv[];
void *p;
{
	char *command;
	int ret;

	if((command = getenv("COMSPEC")) == NULL)
		command = "/COMMAND.COM";
	ret = spawnv(P_WAIT,command,argv);

	return ret;
}

/* Read characters from the keyboard, translating them to "real" ASCII.
 * If none are ready, block. The special keys are translated to values
 * above 256, e.g., F-10 is 256 + 68 = 324.
 */
int
kbread()
{
	uint16 c;

	while((c = kbraw()) == 0)
		kwait(&Kbvec);

	rtype(c);	/* Randomize random number state */

	/* Convert "extended ascii" to something more standard */
	if((c & 0xff) != 0)
		return c & 0xff;
	c >>= 8;
	switch(c){
	case 3:		/* NULL (bizzare!) */
		c = 0;
		break;
	case 83:	/* DEL key */
		c = DEL;
		break;
	default:	/* Special key */
		c += 256;
	}
	return c;
}
/* Install hardware interrupt handler.
 * Takes IRQ numbers from 0-7 (0-15 on AT) and maps to actual 8086/286 vectors
 * Note that bus line IRQ2 maps to IRQ9 on the AT
 */
int
setirq(irq,handler)
unsigned irq;
INTERRUPT (*handler)();
{
	/* Set interrupt vector */
	if(irq < 8){
		setvect(8+irq,handler);
	} else if(irq < 16){
		Isat = 1;
		setvect(0x70 + irq - 8,handler);
	} else {
		return -1;
	}
	return 0;
}
/* Return pointer to hardware interrupt handler.
 * Takes IRQ numbers from 0-7 (0-15 on AT) and maps to actual 8086/286 vectors
 */
INTERRUPT
(*getirq(irq))()
unsigned int irq;
{
	/* Set interrupt vector */
	if(irq < 8){
		return getvect(8+irq);
	} else if(irq < 16){
		return getvect(0x70 + irq - 8);
	} else {
		return NULL;
	}
}
/* Disable hardware interrupt */
int
maskoff(irq)
unsigned irq;
{
	if(irq < 8){
		setbit(0x21,(char)(1<<irq));
	} else if(irq < 16){
		irq -= 8;
		setbit(0xa1,(char)(1<<irq));
	} else {
		return -1;
	}
	return 0;
}
/* Enable hardware interrupt */
int
maskon(irq)
unsigned irq;
 {
	if(irq < 8){
		clrbit(0x21,(char)(1<<irq));
	} else if(irq < 16){
		irq -= 8;
		clrbit(0xa1,(char)(1<<irq));
	} else {
		return -1;
	}
	return 0;
}
/* Return 1 if specified interrupt is enabled, 0 if not, -1 if invalid */
int
getmask(irq)
unsigned irq;
{
	if(irq < 8)
		return (inportb(0x21) & (1 << irq)) ? 0 : 1;
	else if(irq < 16){
		irq -= 8;
		return (inportb(0xa1) & (1 << irq)) ? 0 : 1;
	} else
		return -1;
}
/* Called from assembler stub linked to BIOS interrupt 1C, called on each
 * hardware clock tick. Signal a clock tick to the timer process.
 */
void
ctick()
{
	Tick++;
	Clock++;
	ksignal(&Tick,1);
}
/* Read the Clock global variable, with interrupts off to avoid possible
 * inconsistency on 16-bit machines
 */
int32
rdclock()
{
	int i_state;
	int32 rval;

	i_state = dirps();
	rval = Clock;
	restore(i_state);
	return rval;
}

/* Called from the timer process on every tick. NOTE! This function
 * can NOT be called at interrupt time because it calls the BIOS
 */
void
pctick()
{
	long t;
	static long oldt;	/* Value of bioscnt() on last call */

	/* Check for day change */
	t = bioscnt();
	if(t < oldt){
		/* Call the regular DOS time func to handle the midnight flag */
		(void)time(NULL);
	}
}

/* Set bit(s) in I/O port */
void
setbit(port,bits)
unsigned port;
char bits;
{
	outportb(port,inportb(port)|bits);
}
/* Clear bit(s) in I/O port */
void
clrbit(port,bits)
unsigned port;
char bits;
{
	outportb(port,inportb(port) & ~bits);
}
/* Set or clear selected bits(s) in I/O port */
void
writebit(port,mask,val)
unsigned port;
char mask;
int val;
{
	register char x;

	x = inportb(port);
	if(val)
		x |= mask;
	else
		x &= ~mask;
	outportb(port,x);
}
void *
ltop(l)
long l;
{
	register unsigned seg,offset;

	seg = l >> 16;
	offset = l;
	return MK_FP(seg,offset);
}
#ifdef	notdef	/* Assembler versions in pcgen.asm */
/* Multiply a 16-bit multiplier by an arbitrary length multiplicand.
 * Product is left in place of the multiplicand, and the carry is
 * returned
 */
uint16
longmul(multiplier,n,multiplicand)
uint16 multiplier;
int n;				/* Number of words in multiplicand[] */
register uint16 *multiplicand;	/* High word is in multiplicand[0] */
{
	register int i;
	unsigned long pc;
	uint16 carry;

	carry = 0;
	multiplicand += n;
	for(i=n;i != 0;i--){
		multiplicand--;
		pc = carry + (unsigned long)multiplier * *multiplicand;
		*multiplicand = pc;
		carry = pc >> 16;
	}
	return carry;
}
/* Divide a 16-bit divisor into an arbitrary length dividend using
 * long division. The quotient is returned in place of the dividend,
 * and the function returns the remainder.
 */
uint16
longdiv(divisor,n,dividend)
uint16 divisor;
int n;				/* Number of words in dividend[] */
register uint16 *dividend;	/* High word is in dividend[0] */
{
	/* Before each division, remquot contains the 32-bit dividend for this
	 * step, consisting of the 16-bit remainder from the previous division
	 * in the high word plus the current 16-bit dividend word in the low
	 * word.
	 *
	 * Immediately after the division, remquot contains the quotient
	 * in the low word and the remainder in the high word (which is
	 * exactly where we need it for the next division).
	 */
	unsigned long remquot;
	register int i;

	if(divisor == 0)
		return 0;	/* Avoid divide-by-zero crash */
	remquot = 0;
	for(i=0;i<n;i++,dividend++){
		remquot |= *dividend;
		if(remquot == 0)
			continue;	/* Avoid unnecessary division */
#ifdef	__TURBOC__
		/* Use assembly lang routine that returns both quotient
		 * and remainder, avoiding a second costly division
		 */
		remquot = divrem(remquot,divisor);
		*dividend = remquot;	/* Extract quotient in low word */
		remquot &= ~0xffffL;	/* ... and mask it off */
#else
		*dividend = remquot / divisor;
		remquot = (remquot % divisor) << 16;
#endif
	}
	return remquot >> 16;
}
#endif
void
sysreset()
{
	void (*foo)(void);

	foo = MK_FP(0xffff,0);	/* FFFF:0000 is hardware reset vector */
	(*foo)();
}

void
display(i,v1,v2)
int i;
void *v1;
void *v2;
{
	struct session *sp;
	struct display *dp;
	static struct display *lastdp;
	static long lastkdebug;

	for(;;){
		sp = Current;
		if(sp == NULL || sp->output == NULL
		 || (dp = (struct display *)sp->output->ptr) == NULL){
			/* Something weird happened */
			ppause(500L);
			continue;
		}
		if(dp != lastdp || Kdebug != lastkdebug)
			dp->flags.dirty_screen = 1;
		statline(dp,sp);
		dupdate(dp);
		lastdp = dp;
		lastkdebug = Kdebug;
		kalarm(100L);	/* Poll status every 100 ms */
		kwait(dp);
		kalarm(0L);
	}
}

/* Compose status line for bottom of screen
 * Return 1 if session has unacked data and status should be polled,
 * 0 otherwise.
 *
 */
static void
statline(dp,sp)
struct display *dp;
struct session *sp;
{
	int attr;
	char buf[81];
	struct text_info text_info;
	int unack;
	int s1;
	int s = -1;

	/* Determine attribute to use */
	gettextinfo(&text_info);
	if(text_info.currmode == MONO)
		attr = 0x07;	/* Regular white on black */
	else
		attr = 0x02;	/* Green on black */

	if(sp->network != NULL && (s = fileno(sp->network)) != -1){
		unack = socklen(s,1);
		if(sp->type == FTP && (s1 = fileno(sp->cb.ftp->data)) != -1)
			unack += socklen(s1,1);
	}
	sprintf(buf,"%2d: %s",sp->index,sp->name);
	statwrite(dp,0,buf,strlen(buf),attr);

	if(dp->flags.scrollbk){
		sprintf(buf,"Scroll:%-5lu",dp->sfoffs);
	} else if(s != -1 && unack != 0){
		sprintf(buf,"Unack: %-5u",unack);
	} else
		sprintf(buf,"            ");
	statwrite(dp,54,buf,strlen(buf),attr);
	sprintf(buf,"F8:nxt F10:cmd");
	statwrite(dp,66,buf,strlen(buf),attr);
}

/* Return time since startup in milliseconds. If the system has an
 * 8254 clock chip (standard on ATs and up) then resolution is improved
 * below 55 ms (the clock tick interval) by reading back the instantaneous
 * value of the counter and combining it with the global clock tick counter.
 * Otherwise 55 ms resolution is provided.
 *
 * Reading the 8254 is a bit tricky since a tick could occur asynchronously
 * between the two reads. The tick counter is examined before and after the
 * hardware counter is read. If the tick counter changes, try again.
 * Note: the hardware counter counts down from 65536.
 */
int32
msclock()
{
	int32 hi;
	uint16 lo;
	uint16 count[4];	/* extended (48-bit) counter of timer clocks */

	if(!Isat)
		return rdclock() * MSPTICK;

	do {
		hi = rdclock();
		lo = clockbits();
	} while(hi != rdclock());

	count[0] = 0;
	count[1] = hi >> 16;
	count[2] = hi;
	count[3] = -lo;
	longmul(11,4,count);	/* The ratio 11/13125 is exact */
	longdiv(13125,4,count);
	return ((long)count[2] << 16) + count[3];
}
/* Return clock in seconds */
int32
secclock()
{
	int32 hi;
	uint16 lo;
	uint16 count[4];	/* extended (48-bit) counter of timer clocks */

	if(!Isat)
		return (rdclock() * MSPTICK) / 1000L;

	do {
		hi = rdclock();
		lo = clockbits();
	} while(hi != rdclock());

	count[0] = 0;
	count[1] = hi >> 16;
	count[2] = hi;
	count[3] = -lo;
	longmul(11,4,count);	/* The ratio 11/13125 is exact */
	longdiv(13125,4,count);
	longdiv(1000,4,count);	/* Convert to seconds */
	return ((long)count[2] << 16) + count[3];
}
/* Return time in raw clock counts, approx 838 ns */
int32
usclock()
{
	int32 hi;
	uint16 lo;

	do {
		hi = rdclock();
		lo = clockbits();
	} while(hi != rdclock());

	return (hi << 16) - (int32)lo;
}


#if !defined(CPU386)	/* 386s and above always have an AT bus */
int
doisat(argc,argv,p)
int argc;
char *argv[];
void *p;
{
	return setbool(&Isat,"AT/386 mode",argc,argv);
}
#endif
/* Directly read BIOS count of time ticks. This is used instead of
 * calling biostime(0,0L). The latter calls BIOS INT 1A, AH=0,
 * which resets the midnight overflow flag, losing days on the clock.
 */
long
bioscnt()
{
	long rval;
	int i_state;

	i_state = dirps();
	rval = * (long far *)MK_FP(0x40,0x6c);
	restore(i_state);
	return rval;
}
/* Null stub to replace Borland C++ library function called at startup time
 * to setup the stdin/stdout/stderr streams
 */
void
_setupio()
{
}

/* Return 1 if running in interrupt context, 0 otherwise. Works by seeing if
 * the stack pointer is inside the interrupt stack
 */
int
intcontext()
{
	if(_SS == FP_SEG(Intstk)
	 && _SP >= FP_OFF(Intstk) && _SP <= FP_OFF(Stktop))
		return 1;
	return 0;
}
/* Atomic read-and-decrement operation.
 * Read the variable pointed to by p. If it is
 * non-zero, decrement it. Return the original value.
 */
int
arddec(p)
volatile int *p;
{
	int tmp;
	int i_state;

	i_state = dirps();
	tmp = *p;
	if(tmp != 0)
		(*p)--;
	restore(i_state);
	return tmp;
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人动漫av在线| 在线中文字幕不卡| 亚洲欧美日韩精品久久久久| 日韩一区二区三区视频在线观看| 国产成人精品午夜视频免费| 亚洲高清视频在线| 国产精品毛片久久久久久| 欧美精品在线观看播放| www.av亚洲| 国模少妇一区二区三区| 日韩精品一二三区| 亚洲欧美aⅴ...| 欧美国产丝袜视频| 欧美xxx久久| 欧美欧美欧美欧美首页| 一本一道久久a久久精品综合蜜臀| 国内精品国产成人| 日本aⅴ免费视频一区二区三区| 依依成人精品视频| 中文在线资源观看网站视频免费不卡 | 欧美日韩国产一级片| 成人网页在线观看| 国产高清精品网站| 精品一区二区三区在线播放视频| 亚洲成人av资源| 一区二区三区四区五区视频在线观看| 国产欧美日韩视频在线观看| 精品国产乱码久久| 精品免费国产一区二区三区四区| 91精品国产综合久久久蜜臀图片| 在线观看www91| 在线精品视频一区二区三四| 色狠狠桃花综合| 色综合中文字幕国产 | 日韩精彩视频在线观看| 一区二区在线观看av| 3751色影院一区二区三区| 国产成人精品亚洲777人妖| 亚洲日本一区二区| 国产精品蜜臀av| 国产精品久久久久久久久免费樱桃| 2020国产精品久久精品美国| 精品国产伦一区二区三区观看方式 | 国产99精品国产| 国产一区二区日韩精品| 国内精品伊人久久久久av一坑| 麻豆国产91在线播放| 美日韩一级片在线观看| 久久国产剧场电影| 国产九九视频一区二区三区| 国产白丝精品91爽爽久久| 丁香另类激情小说| 91美女片黄在线| 91电影在线观看| 欧美日本一区二区在线观看| 欧美另类videos死尸| 日韩欧美在线123| 久久久国产午夜精品| 国产精品久久久久久久久图文区| 国产精品久久国产精麻豆99网站| 亚洲精品视频一区二区| 亚洲成人黄色影院| 秋霞午夜鲁丝一区二区老狼| 极品少妇一区二区三区精品视频 | 99久免费精品视频在线观看| 色婷婷激情久久| 91精品国产综合久久福利| 精品国产乱子伦一区| 国产精品色哟哟网站| 亚洲一区国产视频| 国产一区欧美一区| 91亚洲精品一区二区乱码| 69av一区二区三区| 国产精品视频一二三区| 亚洲国产你懂的| 国产一区二区福利视频| 色综合欧美在线视频区| 日韩欧美另类在线| 亚洲婷婷综合色高清在线| 亚洲成av人综合在线观看| 久久丁香综合五月国产三级网站| 成人久久久精品乱码一区二区三区| 91麻豆高清视频| 欧美刺激脚交jootjob| 亚洲天堂精品视频| 毛片不卡一区二区| 91影院在线观看| 精品国产成人系列| 亚洲高清免费视频| 国产一区二区三区免费在线观看| 一本一道波多野结衣一区二区| 日韩美女一区二区三区| 亚洲乱码国产乱码精品精小说| 麻豆精品视频在线观看视频| 一本大道av伊人久久综合| 日韩一级二级三级精品视频| 日韩美女视频一区| 国产乱码精品一区二区三| 欧美视频日韩视频在线观看| 欧美国产综合色视频| 青青国产91久久久久久| 91在线看国产| 国产欧美一区二区在线| 精品综合免费视频观看| 欧美日韩色一区| 国产精品护士白丝一区av| 毛片一区二区三区| 欧美精品在欧美一区二区少妇| 中文字幕一区二区三区视频| 91久久人澡人人添人人爽欧美| 久久免费视频一区| 精品在线观看免费| 欧美喷水一区二区| 亚洲国产日韩a在线播放| 99免费精品视频| 欧美国产精品专区| 国产成人在线视频网址| 日韩三级在线免费观看| 日韩高清不卡一区二区| 欧美色精品在线视频| 亚洲女同一区二区| 91天堂素人约啪| 国产精品久久福利| 成人免费电影视频| 国产精品乱人伦| 国产xxx精品视频大全| 久久久不卡网国产精品一区| 狂野欧美性猛交blacked| 91精品国产综合久久久久久| 婷婷中文字幕综合| 欧美三级日本三级少妇99| 亚洲一区二区三区自拍| 在线免费观看一区| 一区二区三国产精华液| 91久久香蕉国产日韩欧美9色| 日韩码欧中文字| 91理论电影在线观看| 悠悠色在线精品| 欧美日韩精品一区二区天天拍小说 | 国产欧美精品一区二区三区四区| 精品亚洲porn| 久久精品视频免费| 成人激情校园春色| 中文字幕中文字幕一区二区| 成人av网站在线| 亚洲精品免费播放| 欧美精品123区| 麻豆91在线观看| 久久九九全国免费| 成人av在线看| 亚洲国产另类av| 日韩三级视频在线看| 国产在线麻豆精品观看| 国产精品色在线观看| 在线一区二区三区四区五区| 亚洲成人免费在线| 精品日韩一区二区| 成人美女视频在线观看18| 亚洲精选视频在线| 欧美一区二区三区日韩视频| 久久精品国产一区二区三| 国产午夜精品一区二区三区四区| 91一区二区在线| 丝袜亚洲另类丝袜在线| 精品国产伦一区二区三区观看体验 | 亚洲一区二区美女| 日韩一区二区精品在线观看| 国产一区二区三区蝌蚪| 国产精品久久久久9999吃药| 欧美日本一区二区三区| 国产乱一区二区| 尤物av一区二区| 精品久久人人做人人爽| 99精品桃花视频在线观看| 日本欧美在线观看| 国产女主播一区| 欧美日韩视频在线观看一区二区三区| 久久电影网电视剧免费观看| 亚洲视频你懂的| 日韩欧美在线网站| 色综合久久天天综合网| 久久国产精品第一页| 亚洲美女在线一区| 日韩精品中文字幕一区二区三区| www.欧美.com| 久久精品72免费观看| 亚洲精品videosex极品| 久久亚洲精华国产精华液 | 91一区二区三区在线播放| 美脚の诱脚舐め脚责91| 亚洲精品一二三| 久久久久久一级片| 3751色影院一区二区三区| 97久久精品人人做人人爽50路| 美女在线一区二区| 亚洲一级二级在线| 欧美国产激情一区二区三区蜜月| 日韩视频免费观看高清完整版 | 精品av综合导航| 欧美色综合天天久久综合精品|