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

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

?? mirror.c

?? BC3.1編譯,小交換機計費系統(tǒng).使用Dos做出如此好的界面,少有.
?? C
字號:
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <sys\stat.h>
#include <string.h>

#include <def.inc>
#include <func.inc>

static UC File1[64];				/* the 1st filespec */
static UC File2[64];				/* the 2nd filespec */
static UC Tmpfile[64];				/* the tempfile's filespec */
static UC Mirror_setted = FALSE;    /* TRUE if the two mirror files are defined */

/* ---------------------------------------------------------------------
	FUNCTION:	Check weither or not the two mirror files are lawful !
	CALLS:
	CALLED BY:
	INPUT:      None.
	OUTPUT:		None.
	RETURN:     0 -- Two files checked OK!
				1 -- Two files are both NOT exist.
				2 -- Two files are different size.
				3 -- Error occurred when accessing the two mirror files.
					 Including: copy failed, delete the <Tempfile> failed.
				4 -- File1 exist & File2 not.
				5 -- File2 exist & File1 not.
   --------------------------------------------------------------------- */
static UC chkfile(void)
{
UI sf1, sf2, hd1, hd2;

	sf1 = access(File1, 0);
	sf2 = access(File2, 0);

	if ( sf1 && sf2 )
		return 1;					/* The two files are all not exist.*/

	if ( (!sf1) && (!sf2) )
	{
		hd1 = open(File1, O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
		hd2 = open(File2, O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
		if ( filelength(hd1)!=filelength(hd2) )
			return 2;				/* two files has different sizes */
        close(hd1);
        close(hd2);
		if ( access(Tmpfile,0)==0 )
			if ( unlink(Tmpfile)!=0 )
				return 3;			/* delete file error */
		return 0;
	}

	if ( (!sf1)&&(sf2) )
	{
		if ( fcopy(File1, Tmpfile)==1 )
			return 3; 				/* copy error */
		return 4;	 				/* File1 exist, and File2 was rename to Tmpfile */
	}

	if((sf1)&&(!sf2))
	{
		if ( fcopy(File2,Tmpfile)==1 )
			return 3; 				/* copy error */
		return 5; 					/* File2 exist ! */
	}
}


/* ---------------------------------------------------------------------
	FUNCTION:	Check weither or not the two mirror files are lawful !
	CALLS:
	CALLED BY:
	INPUT:      None.
	OUTPUT:		None.
	RETURN:     0 -- Two files checked OK!
				1 -- Two files are both NOT exist.
				2 -- Two files are different size.
				3 -- Error occurred when accessing the two mirror files.
					 Including: copy failed, delete the <Tempfile> failed,
								rename the Tempfile to File1(2) failed.
   --------------------------------------------------------------------- */
UC check_mirror(void)
{
UC result;

	if (!Mirror_setted)
		exit_scr(0, "MIRROR/Chkfile(): The two mirror files NOT defined.");

	result = chkfile();
    switch(result)
	{
	case 4:
		if ( rename(Tmpfile, File2)!=0 )
			return 3; 			/* rename error */
		else
			return 0;
	case 5:
		if ( rename(Tmpfile, File1)!=0)
			return 3; 			/* rename error */
		else
			return 0;
	}
	return result;
}
/* --------------------------------------------------------------------
	FUNCTION:	Init the two mirror files.
				If the two files already exist, just delete them.
				Files were create in READWRITE attribe.
	CALLS:      Turbo C librarys.
	CALLED BY:  All-purpose routine.
	INPUT:		None.
	OUTPUT:		None.
	RETURN:		If create any of the two mirror files failed,
				return 1, else return 0.
   ----------------------------------------------------------------- */
UC init_mirror(void)
{
UI handle;

	if (!Mirror_setted)
		exit_scr(0, "MIRROR/init_mirror(): Mirror files NOT defined.");

	handle = creat( File1, S_IREAD|S_IWRITE );
	if ( handle==0xFFFF )
		return 1;
	close(handle);

	handle = creat( File2, S_IREAD|S_IWRITE );
	if ( handle==0xFFFF )
		return 1;
	close(handle);

    return 0;
}

/* ----------------------------------------------------------------------
	FUNCTION: 	Write date to a file using the stream mode (fopen, "r+b").
	CALLED BY:  This is a general-purposed routine.
	INPUT:		file	the filespec of the file.
				buf		the buffer of data to be written.
				offset	the offset of the file from beginning.
				size	the size of the data type to be written (Unit: byte).
				nitems	the items of such data type to be written.
	OUTPUT:		None.
	RETURN:     0 -- file written OK!
				1 -- file written failed.
					 including: fopen error, fseek error, fwrite error.
   ---------------------------------------------------------------------- */
UC stream_write(UC *file, UL offset, void *buf, UI size, UI nitems)
{
FILE *tmpfp;
UL fpos;

	tmpfp = fopen(file, "r+b");
	if (tmpfp==NULL)
		return 1; 				/* open file error */

	if ( fseek(tmpfp, offset, SEEK_SET)!=0 )
	{
		fclose(tmpfp);
		return 1;       		/* fseek error */
	}

	if ( fwrite(buf, size, nitems, tmpfp)!=nitems )
	{
		fclose(tmpfp);
		return 1;				/* fwrite error */
	}

	fclose(tmpfp);
	return 0;
}

/* ----------------------------------------------------------------------
	FUNCTION: 	Write date to a file using the handle mode (open, O_WRONLY|O_BINARY)
	CALLED BY:  This is a general-purposed routine.
	INPUT:		file	the filespec of the file.
				buf		the buffer of data to be written.
				offset	the offset of the file from beginning.
				nbytes	the number of bytes to be written (Unit: byte).
	OUTPUT:		None.
	RETURN:     0 -- file written OK!
				1 -- file written failed.
					 including: fopen error, fseek error, fwrite error, rename error.
   ---------------------------------------------------------------------- */
UC handle_write(UC *file, UL offset, void *buf, UI nbytes)
{
UI handle;

	handle = open(file, O_WRONLY|O_BINARY);
	if (handle==0xFFFF)
		return 1;							/* open file error */
	if ( lseek(handle, offset, SEEK_SET)==-1 )
	{
		close(handle);
		return 1;
	}										/* seek error */
	if ( write(handle, buf, nbytes)==-1 )
	{
		close(handle);
		return 1;
	}										/* write error */

	close(handle);
    return 0;
}

/* ---------------------------------------------------------------------
	FUNCTION:	Write the mirror files: File1 and File2, stream mode(fopen)
	CALLED BY:	This is a general-purposed routine.
	INPUT:		buf:	the buffer of the data to be written.
				offset:	the offset from the beginning of the mirror files.
				size:	the size of the data type to be written (Unit: byte).
				nitems: the items of such data type to be written.
	OUTPUT:		None.
	RETURN:     0 -- Two files checked OK!
				1 -- Two files are both NOT exist.
				2 -- Two files are different size.
				3 -- Error occurred when accessing the two mirror files.
					 Including: copy failed, delete the <Tempfile> failed,
								rename the Tempfile to File1(2) failed.
   -----------------------------------------------------------------------*/
UC mirror_fwrite(UL offset, void *buf, UI size, UI nitems)
{
UC result;

	if (!Mirror_setted)
		exit_scr(0, "MIRROR/mirror_fwrite(): Mirror files NOT defined.");

	result = chkfile();
	switch (result)
    {
	case 0:		/* File1, File2 all exist. */
		if ( rename(File1, Tmpfile)!=0 )
			return 3;
		if ( stream_write(Tmpfile, offset, buf, size, nitems)!=0 )
			return 3;
		if ( rename(Tmpfile ,File1)!=0 )
			return 3;
		if ( rename(File2, Tmpfile)!=0 )
			return 3;
		if ( stream_write(Tmpfile, offset, buf, size, nitems)!=0 )
			return 3;
		if ( rename(Tmpfile ,File2)!=0 )
			return 3;
		break;

	case 4:                     /* File1 exist, File2 in Tempfile mode */
		if ( stream_write(Tmpfile, offset, buf, size, nitems)!=0 )
			return 3;
		if ( rename(Tmpfile ,File2)!=0 )
			return 3;
		if ( rename(File1, Tmpfile)!=0 )
			return 3;
		if ( stream_write(Tmpfile, offset, buf, size, nitems)!=0 )
			return 3;
		if ( rename(Tmpfile ,File1)!=0 )
			return 3;
		break;

	case 5:                     /* File2 exist, File1 in Tempfile mode */
		if ( stream_write(Tmpfile, offset, buf, size, nitems)!=0 )
			return 3;
		if ( rename(Tmpfile ,File1)!=0 )
			return 3;
		if ( rename(File2, Tmpfile)!=0 )
			return 3;
		if ( stream_write(Tmpfile, offset, buf, size, nitems)!=0 )
			return 3;
		if ( rename(Tmpfile ,File2)!=0 )
			return 3;
		break;

	default:
		return result;
    }
    return 0;
}

/* ---------------------------------------------------------------------
	FUNCTION:	Write the mirror files: File1 and File2, handle mode(open)
	CALLED BY:	This is a general-purposed routine.
	INPUT:		buf:	the buffer of the data to be written.
				offset:	the offset from the beginning of the mirror files.
				nbytes:	the number of bytes to be written (Unit: byte).
	OUTPUT:		None.
	RETURN:     0 -- Two files checked OK!
				1 -- Two files are both NOT exist.
				2 -- Two files are different size.
				3 -- Error occurred when accessing the two mirror files.
					 Including: copy failed, delete the <Tempfile> failed,
								rename the Tempfile to File1(2) failed.
   -----------------------------------------------------------------------*/
UC mirror_write(UL offset, void *buf, UI nbytes)
{
UC result;

	result = chkfile();
	switch (result)
	{
	case 0:			/* File1,File2 all exist! */
		if ( rename(File1, Tmpfile)!=0 )
			return 3;
		if ( handle_write(Tmpfile, offset, buf, nbytes )!=0 )
			return 3;
		if ( rename(Tmpfile, File1)!=0 )
			return 3;
		if ( rename(File2, Tmpfile) )
			return 3;
		if ( handle_write(Tmpfile, offset, buf, nbytes )!=0 )
			return 3;
		if ( rename(Tmpfile, File2)!=0 )
			return 3;
		break;

	case 4:			/* File1 exist, and File2 in Tempfile mode */
		if ( handle_write(Tmpfile, offset, buf, nbytes )!=0 )
			return 3;
		if ( rename(Tmpfile, File2)!=0 )
			return 3;
		if ( rename(File1, Tmpfile) )
			return 3;
		if ( handle_write(Tmpfile, offset, buf, nbytes )!=0 )
			return 3;
		if ( rename(Tmpfile, File1)!=0 )
			return 3;
		break;

	case 5:			/* File2 exist, and File1 in Tempfile mode */
		if ( handle_write(Tmpfile, offset, buf, nbytes )!=0 )
			return 3;
		if ( rename(Tmpfile, File1)!=0 )
			return 3;
		if ( rename(File2, Tmpfile) )
			return 3;
		if ( handle_write(Tmpfile, offset, buf, nbytes )!=0 )
			return 3;
		if ( rename(Tmpfile, File2)!=0 )
			return 3;
		break;

	default:
		return result;
	}

	return 0;
}

/* --------------------------------------------------------------------
	FUNCTION:	Specify the two mirror files.
	CALLED BY:	This is a general-purposed routine.
	INPUT:		file1	the filespec of file 1st.
				file2	the filespec of file 2nd.
				tmpfile	the filespec of temp file.
	OUTPUT:		None.
	RETURN:		None.
   -------------------------------------------------------------------- */
void set_mirror(UC *file1, UC *file2, UC *tmpfile)
{
	strcpy(File1, file1);
	strcpy(File2, file2);
	strcpy(Tmpfile, tmpfile);
	Mirror_setted = TRUE;
}

/* --------------------------------------------------------------------
	FUNCTION:	Reset the flag of set_mirror().
	CALLED BY:	This is a general-purposed routine.
	INPUT:		None.
	OUTPUT:		None.
	RETURN:		None.
   -------------------------------------------------------------------- */
void reset_mirror(void)
{
	Mirror_setted = FALSE;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美影院一区二区三区| 奇米精品一区二区三区在线观看| 国产大片一区二区| 国产精品久久久久影视| 成人黄色在线看| 亚洲精品成a人| 欧美精品第1页| 国产一区二区不卡在线| 亚洲欧洲日产国码二区| 欧美性淫爽ww久久久久无| 日韩精品欧美精品| 久久中文娱乐网| 91视频一区二区| 日本伊人午夜精品| 亚洲国产高清aⅴ视频| 一本色道久久加勒比精品| 全部av―极品视觉盛宴亚洲| 久久综合久色欧美综合狠狠| 97久久精品人人做人人爽| 亚洲电影一级片| 久久亚洲精品小早川怜子| 色一情一乱一乱一91av| 蜜桃av一区二区| 国产精品不卡在线| 91精品免费观看| 欧美夫妻性生活| 处破女av一区二区| 午夜精品一区二区三区三上悠亚 | 99视频国产精品| 亚洲综合视频网| 久久精品亚洲精品国产欧美kt∨| 91精品福利在线| 国产美女精品人人做人人爽| 一区二区三区**美女毛片| 亚洲精品一区二区三区香蕉| 日本韩国一区二区| 国产高清无密码一区二区三区| 亚洲黄色免费网站| 久久九九影视网| 91麻豆精品国产91久久久久久久久| 国产精品一卡二卡在线观看| 亚洲午夜久久久久久久久电影院 | 免费看欧美美女黄的网站| 国产精品家庭影院| 日韩精品自拍偷拍| 欧美日韩免费不卡视频一区二区三区| 国产激情一区二区三区四区 | 色久优优欧美色久优优| 国产麻豆欧美日韩一区| 亚洲一区二区三区四区不卡| 国产精品色哟哟网站| 精品免费日韩av| 欧美手机在线视频| 91丝袜美女网| 北条麻妃一区二区三区| 国产精品羞羞答答xxdd| 毛片av中文字幕一区二区| 一区二区三区 在线观看视频| 国产精品免费看片| 久久精品欧美一区二区三区不卡| 欧美一区二区三区视频免费| 欧美日韩国产高清一区二区三区 | 中文字幕一区不卡| 国产亚洲欧美一区在线观看| 毛片av一区二区三区| 蜜桃av一区二区三区电影| 亚洲一区二区三区影院| 亚洲免费视频中文字幕| 国产精品国产三级国产普通话蜜臀 | 日韩精品一区二区三区中文不卡| 欧美亚洲国产一区二区三区va| av电影天堂一区二区在线| 国产99久久久国产精品潘金网站| 久久不见久久见免费视频7| 日韩av中文字幕一区二区| 天天亚洲美女在线视频| 五月婷婷欧美视频| 日韩不卡一区二区三区| 日本视频在线一区| 奇米在线7777在线精品| 男男视频亚洲欧美| 精品一区二区三区欧美| 久久成人羞羞网站| 激情深爱一区二区| 国产精品一色哟哟哟| 成人黄色国产精品网站大全在线免费观看 | 欧美一区二区美女| 精品三级av在线| 久久久亚洲精华液精华液精华液 | 中文字幕在线一区二区三区| 国产精品区一区二区三| 中文字幕综合网| 亚洲自拍偷拍九九九| 亚洲成人777| 麻豆91精品视频| 国产成人免费av在线| 99综合电影在线视频| 91福利国产精品| 欧美α欧美αv大片| 亚洲国产高清aⅴ视频| 亚洲黄色免费网站| 久久国产剧场电影| 99视频有精品| 欧美一区二区三区在线视频| 国产亚洲一区二区在线观看| 亚洲男女一区二区三区| 秋霞电影网一区二区| 成人网在线免费视频| 欧美老肥妇做.爰bbww视频| 久久久午夜精品| 一区二区理论电影在线观看| 免费xxxx性欧美18vr| 粉嫩av亚洲一区二区图片| 亚洲色图另类专区| 蜜臀av性久久久久蜜臀av麻豆| 风间由美一区二区三区在线观看| 欧洲人成人精品| 精品粉嫩aⅴ一区二区三区四区| 成人欧美一区二区三区小说| 日韩中文字幕亚洲一区二区va在线| 国产精品一区一区三区| 欧美性大战久久久| 国产精品亲子乱子伦xxxx裸| 免费精品视频在线| 色综合久久九月婷婷色综合| 精品久久免费看| 亚洲午夜三级在线| 99精品视频一区| 久久久久久久av麻豆果冻| 视频在线观看国产精品| 91网页版在线| 国产日韩欧美高清| 久久精品久久综合| 欧美日韩精品一二三区| 国产精品伦理一区二区| 久久精品国产99| 欧美精品在线一区二区三区| 日韩美女啊v在线免费观看| 国产一级精品在线| 欧美一区二区三区免费在线看| 懂色av一区二区在线播放| 日韩一区和二区| 亚洲一区二区欧美| 91欧美一区二区| 中文字幕乱码久久午夜不卡 | 国产精品国产自产拍在线| 韩国三级电影一区二区| 91精品国产综合久久福利| 一区二区三区精品视频| 不卡视频一二三| 国产日韩欧美不卡| 国产伦精品一区二区三区视频青涩 | 91网站最新网址| 国产精品久久久久永久免费观看| 国产一区欧美一区| 久久精品亚洲国产奇米99| 激情综合亚洲精品| 日韩欧美国产精品| 久久草av在线| 精品久久久久久最新网址| 日韩精品电影一区亚洲| 精品视频在线免费观看| 亚洲在线成人精品| 色先锋aa成人| 一区二区三区四区在线播放| 91在线免费看| 亚洲九九爱视频| 欧美在线一二三| 天天操天天干天天综合网| 欧美日韩成人综合| 免费高清在线一区| 精品福利二区三区| 丁香婷婷综合五月| 成人欧美一区二区三区白人| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 亚洲欧美在线aaa| 色天天综合色天天久久| 亚洲在线中文字幕| 欧美男男青年gay1069videost | 一区二区三区在线观看视频| 色狠狠色狠狠综合| 亚洲成人动漫av| 欧美变态tickling挠脚心| 国产乱人伦偷精品视频免下载| 中文子幕无线码一区tr| 国产欧美精品一区二区三区四区| 成人免费视频免费观看| 一区二区三区国产精华| 91精品国产高清一区二区三区| 蜜桃视频在线观看一区| 日本一区二区综合亚洲| 在线视频欧美区| 青青国产91久久久久久| 久久精品视频在线看| 色婷婷亚洲综合| 精品一区二区三区蜜桃| 国产精品护士白丝一区av| 8v天堂国产在线一区二区| 狠狠v欧美v日韩v亚洲ⅴ| 亚洲欧美电影一区二区|