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

📄 ncs_depart_src_file.c

📁 unix 下用pro*c tuxedo 开发的东西
💻 C
字号:
/*
*	File name	: NCS_Depart_Src_File.c
*	Module ID	:
*	Module Name	:
*	Purpose		: Process FSFILE.TXT from YWJ, into individual type file
*	Author		: Mr. Zhujingkun
*	Date Created	: 1999,05,27
*	Version		: Version 1.0
*	Environment	: Digital UNIX
*	Portability	: UNIX Platform
*	Warnings	: no
*	References	: tip.txt and readme.txt
*	Calling Syntax	: NCS_Depart_Src_File
*	Parameters	: None
*	Returns		: void
*	Calling Function: myapi_ReadALine, myapi_GetItem, GetTimeInterval,
*			  MyExistFile, myapi_ProcessOriginalFile
*	Called Functions: When system startup
*	Datastores and usages:
*	Report		: None
*	Screens		: None
*	Messages Files	: None
*	Change Log	:
*	Change No. 01	: 
*/

#include "stdlib.h"
#include "stdio.h"
#include "unistd.h"
#include "NCS_Depart_Src_File.h"
#include "my_api.h"
#include "errlog.h"
#include "signal.h"

void main()
{
	int iItem, i, j;
	
	FILE* hTable;
	char sDescription[200];
	char cNextChar, cOneLine[MAX_LINE_LEN+1];
	
	iTInterval = 0;
	signal( SIGTERM, EndDepartSrcFile );
	InitDepartSrcFile();
	//read correspondence table
	hTable = fopen( CONFIG_FILE_FOR_DATATYPE2PROCESSFILE, "r" );
	if( hTable == NULL )  //file does not exist
	{
		sprintf( sDescription, "ERROR: PCS_Depart_Src_File: Cannot open file: %s,The file may not exist!\n",\
CONFIG_FILE_FOR_DATATYPE2PROCESSFILE );
		ErrorLog( sDescription );
		exit(0);
	}
	
	for( i=0; i<TOTAL_FILE_TYPE; i++ )
	{
		strcpy( cTypeArray[i], "\0" );
		strcpy( cProgramArray[i], "\0" );
	}
	
	i=0;
	//open the file, read it
	while( myapi_ReadALine( cOneLine, hTable ) )
	{
		if( cOneLine[0] == '#' ) continue;
		if( cOneLine[0] == NULL )continue;
		myapi_GetItem( cOneLine, cTypeArray[i], cProgramArray[i] );
		i++;
		if( i >= TOTAL_FILE_TYPE ) break;  //more than declared.
	}
	fclose( hTable );
	
	//Do some if decisions
	if( i==0 )
	{
		printf("Critical! No item was listed in the corresponding table file!\n");
	}
	
	//Get the sleep  time interval
	iTInterval = GetTimeInterval("PCS_DEPART_FILE");
#ifdef DEBUG	
	printf( "Time interval is: %i\n", iTInterval );
#endif

	
	//Loop forever until the system is down
	while(1)
	{
		if( MyExistFile( FILE_FROM_YWJ ) )
		{
			//Process the file
			myapi_ProcessOriginalFile( FILE_FROM_YWJ );
			printf("Process the BKFX file.\n");
#ifdef DEBUG			
			break;
#endif			
		}
		else if( ExistYXFile( TXJ_RCV_DATA_DIR ) )
		{
			//Process the file
			myapi_ProcessYXFile( YXFILE_LIST );
			printf("Process the NONE_BKFX file.\n");
#ifdef DEBUG			
			break;
#endif			
		}
		else
		{
#ifdef DEBUG			
			sprintf( sDescription, "PCS_Depart_Src_File: File does not exist!\n");
			ErrorLog( sDescription );
			break;
#endif			
		}
		sleep( iTInterval );
	}
	EndDepartSrcFile();

}

⌨️ 快捷键说明

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