/* DIVIDE_START=extern.h */
/*
	ＮＩＦＴＹのＬＯＧ整理				extern.h
*/

#include <errno.h>

/* 処理の途中経過について */
#define	mess_check	if ( MessSw == YES ) 

#define	GET_LINE	if ( catlog_fgets( ) == NULL ) return
#define	GET_LINE2	if ( catlog_fgets( ) == NULL )
#define	exit( re )	CATLOG_exit( re )
#define	ERROR_CHECK	if ( error == YES )	return
#ifndef		TYPE_LINUX
#define	printf		cprintf
#define	puts		cputs
#endif
#define	color		CATLOG_color

#define	IFPStrEqu(s,d)    if(PSL==d && strncmp(PSP,s,d)==0)
#define	IFPStrEqu2(s,d)   if(PSL!=0 && strncmp(PSP,s,d)==0)
#define	IFPStrEqu3(s,d)   if(                    strncmp(PSP,s,d)==0)
#define	IFPStrNotEqu(s,d) if(PSL!=d || strncmp(PSP,s,d)!=0)
#define	IFPStrNotEqu2(s,d) if(PSL==0||strncmp(PSP,s,d)!=0)

/***********/
/* error.c */
/***********/
void	error_end();
void	error_open_file( char *function_name );
void	error_return( char *str );
void	error_bug( char *str );
void	error_full_name( const int i );
void	ForcedEndCheck();

/**********/
/* main.c */
/**********/
void	main_loop( );
void	def_file( char *filename );
void	CATLOG_exit( int re );

/*************/
/* options.c */
/*************/
void	main_mes();
void	setOptions( char *str );

/*********/
/* sub.c */
/*********/
int		isSearchFileSub( const char *name1, const char *name2 );
int		isSearchFile( char *f_name );
int		isWithoutSearchDir( const char *dir_name, const char *ff_name );
int		isWithoutSearchFile( char *f_name );
void	print_now_time();
int		matchstr( const char *trg , const char *form );
int		matchLSP( const char *form );
int		matchPSP( const char *form );
int		matchNSP( const char *form );
char	*skip_space( char *str );
unsigned	int		id_to_int( const char *id );
			void	int_to_id( int num , char *id );
int		date_to_int( char *date );
void	int_to_date( char *date , int d );
void	catlog_findfirst(
	const char *path,
	void (*sub)( const char *file , const char *ff_name ),
	int		checkDirNameSw,
	int		checkFileNameSw
);
void	disp_start_check_file( const char *f_name , size_t fsize );
void	disp_end_check_file( size_t fsize );
void	set_catlog_file_line_1( const char *mes );
void	set_hatsugen_date_clip( char *ptr );
void	set_hatsugen_date_forum( char *ptr );
void	set_hatsugen_date_mail( char *ptr );
void	set_hatsugen_date_hp( char *ptr );
void	set_hatsugen_date_bill( char *ptr );
void	set_hatsugen_date_lib( char *ptr );
int		isCollectID( const char *str );
int		isIDname( const char *str );
char	*last_yen( char *str );
const	char	*last_comma( const char *str );
void	check_drive_space_23( );
void	get_mes_now_number( char *str , char *now );
int		get_digit( char *str );
void	without_crlf( char *str);
int		get_yesno();
int		get_yesno_mes();
char	*touppers( char *p );				/* 文字列を大文字に変換する */

/* フォーラムの入口からフォーラム名を取り出す */
int		get_forum_name_last_str( );

/* -Fxxxxx からフォーラム名を取り出す */
void	get_forum_name( char *str , char *forumName );

/* - Fxxxx から会議室番号を取り出す   */
int		get_mes_num_from_forum_name_line( char *str );

/* 文字列のチェック ＬＩＢの行 */
int		isLIBLine( );
int		isLIBFirstLine( );
int		isLibNumDir();

/* 文字列のチェック 会議室の行 */
int		isMesEnd( );
int		isMesInputLine( );
int		isMesForumNameLineNext( );
int		isMesForumNameLine( );
int		isMesHyoudaiLineNext( );
int		isMesHyoudaiLine( );
int		isMesSecondLine( );

/* 文字列のチェック ＨＰの行 */
int		isHPFirstLine( );
int		isHPEnd();

/* 文字列のチェック ＰＡＴＩＯの行 */
int		isPATIOFirstLine();
int		isPATIOEnd();

/* 文字列のチェック Ｍａｉｌの行 */
int		isMailFirstLine( );
int		isMailEnd();

/* src → targ : 半角を全角のSJIS コードにする */
/* targ は 充分なエリアを持つこと              */
void	to_shift_zen_s( const char *src , char *targ );

/**********/
/* file.c */
/**********/
size_t	file_size();
void	file_name_space_0( char *file );
void	set_tmp0_file_name( char *file );

void	open_out_tmp0_file();
void	open_append_tmp0_file();
void	open_read_tmp0_file();
void	delete_tmp0_file();

char	*catlog_fgets();
void	delete_present_line();
int		initial_check_pool( long fsize , int sw );
void	end_check_pool();
size_t	catlog_fwrite();
void	catlog_fprintf( const char *targ );
void	insert_char( char *start , int c );

int		CATLOG_tmp_file( const char *file );
void	set_index_file_name( char *new_forum );
void	set_file_name( int count );

/**********/
/* sort.c */
/**********/
int	sort();

/***********/
/* check.c */
/***********/
void	check_set_lib_number();
void	check_skip_useless_line();	/* 必要のない行を読み飛ばす */
void	print_start_line();
void	check_save_start_sub( );
int		check_check_end();
void	present_str_print();
void	present_str_copy( char *str );
int		check_bill_second_line();
extern void check_main( long fsize , const char *dir , const char *file_path );

/*************/
/* collect.c */
/*************/
void	check_drive_space( int fsize );
int		collect_main();

/************/
/* divide.c */
/************/
void	check_drive_space_23( );
void	check_and_make_output_path( const char *forumName );
void	divide_main();

/************/
/* catlog.c */
/************/
void	get_idx_data();
int		is_idx_data();
void	append_idx_data();
void	open_save_data_file( const int i , int make_new_file_sw );
void	catlog_malloc();
void	catlog_main();

/*************/
/* sortlog.c */
/*************/
void	sortlog_loop_file( const char *f_name );
void	sortlog_main();
void	check_MakeUpMAIL_mode();

/*************/
/* display.c */
/*************/
void	catlog_mes_file_open();
void	catlog_mes_file_close();
void	catlog_mes_file_reopen();
void	display_main();
void	CATLOG_color( int col );

/*************/
/* makeidx.c */
/*************/
int		isCATLOGFile( const char *f_name );
void	makeidx_forum_mode();
void	makeidx_new_type();
void	makeidx_from_catlog_file_main();
void	check_index_mode();

/************/
/* search.c */
/************/
void	search_id_name_main( const char *out_file );
void	search_id_mes_main( const char *path );

/*********/
/* lib.c */
/*********/
void	catlog_collect_lib( const char *file );
void	catlog_lib( const char *file );
void	MakeUpDLInto1File_main( char *file );

/**********/
/* clip.c */
/**********/
/* 文字列のチェック クリッピングサービスの行 */
int		isCLIPFirstLine();
int		isCLIPStr( const char *str );
int		isCLIPLine();
int		isCLIPEnd();

void	check_clip_main();
void	catlog_clip_main( const char *file );

/* DIVIDE_END */
