

#include<stdio.h>
#include<netinet/in.h>
#include<string.h>
#include<stdlib.h>
#include<pthread.h>

#include"sitar.h"
#include<almemsys/almemsys.h>

extern global_data_t gd;
extern struct scan_buf sb;


/* ------------------ PATH CHECK ----------------- */
int path_check(char *chA)
{
int bu, count, co;
char ch[31][BUF_COM];
count = 0;
bu = 0;

for(co = 0; co < 31; co++){
   memset(ch[co], 0x00, BUF_COM);
   }

char * non = "NOT";
char * sock_ipaddr="SOCK_IPADDR";
char * sock_port="SOCK_PORT";
char * life_int="LIFE_INT";
char * life_los="LIFE_LOS";
char * c_name="C_NAME";
char * c_info="C_INFO";
char * mail_cc="MAIL_CC";
char * bat_file="BAT_FILE";
char * bat2_file="BAT2_FILE";
char * bat_int="BAT_INT";
char * bat2_int="BAT2_INT";
char * command_path="COMMAND_PATH";
char * cron_path="CRON_PATH";
char * cron_file="CRON_FILE";
char * cron_list="CRON_LIST";
char * sock2_ipaddr="SOCK2_IPADDR";
char * sock2_port="SOCK2_PORT";
char * update_com="UPDATE_COM";
char * thread_max="THREAD_MAX";
char * tbuf_max="TBUF_MAX";
char * life_onoff="LIFE_ONOFF";
char * cron_onoff="CRON_ONOFF";
char * midump_filename ="MIDUMP_FILE";
char * midump_filename_2 ="MIDUMP_FILE_2";
char * mid_max ="MID_MAX";
char * thread_len="THREAD_LEN";
char * mid_int="MID_INT";
char * dns_ip="DNS_IP";
char * dns_ip2="DNS_IP2";

self_memcpy(ch[0], non, BUF_COM);
self_memcpy(ch[1], sock_ipaddr, BUF_COM);
self_memcpy(ch[2], sock_port, BUF_COM);
self_memcpy(ch[3], life_int, BUF_COM);
self_memcpy(ch[4], life_los, BUF_COM);
self_memcpy(ch[5], c_info, BUF_COM);
self_memcpy(ch[6], mail_cc, BUF_COM);
self_memcpy(ch[7], c_name, BUF_COM);
self_memcpy(ch[8], bat_file, BUF_COM);
self_memcpy(ch[9], bat2_file, BUF_COM);
self_memcpy(ch[10], bat_int, BUF_COM);
self_memcpy(ch[11], bat2_int, BUF_COM);
self_memcpy(ch[12], command_path, BUF_COM);
self_memcpy(ch[13], sock2_ipaddr, BUF_COM);
self_memcpy(ch[14], sock2_port, BUF_COM);
self_memcpy(ch[15], update_com, BUF_COM);
self_memcpy(ch[16], thread_max, BUF_COM);
self_memcpy(ch[17], tbuf_max, BUF_COM);
self_memcpy(ch[18], life_onoff, BUF_COM);
self_memcpy(ch[19], cron_path, BUF_COM);
self_memcpy(ch[20], cron_file, BUF_COM);
self_memcpy(ch[21], cron_list, BUF_COM);
self_memcpy(ch[22], cron_onoff, BUF_COM);
self_memcpy(ch[23], midump_filename, BUF_COM);
self_memcpy(ch[24], mid_max, BUF_COM);
self_memcpy(ch[25], thread_len, BUF_COM);
self_memcpy(ch[26], mid_int, BUF_COM);
self_memcpy(ch[27], midump_filename_2, BUF_COM);
self_memcpy(ch[28], dns_ip, BUF_COM);
self_memcpy(ch[29], dns_ip2, BUF_COM);

if(BUF_COM > strlen(chA)){
   for(count=1; count < 30; count++){
      if(0 == memcmp(chA, ch[count], (int)strlen(ch[count])+1)){
         bu=count;
         }
      }
   }
else{
   fprintf(stderr,"big size mess err. %s\n", chA);
   }
return(bu);
}






