/*
 *========================================================================
 *
 *   시스템명 : 요금징수 시스템
 *   파 일 명 : ft_main.c
 *   작 성 자 : 오효섭 (catacath@neighbor21.co.kr)
 *   작 성 일 : 2012.10.10
 *   수 정 일 :
 *   설    명 : File & DB Table간 변환 Main
 *
 *========================================================================
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <signal.h>
#include <arpa/inet.h>

#include "chg_struc.h"
#include "file_lb.h"
#include "dir_path.h"
#include "debug_def.h"
#include "path_def.h"

static   int    sockfd = -1;      /* socket for AF_UNIX,SOCK_DGRAM */
static   char   buf[512];         /* request data                  */
static   int    size;             /* length of request data        */

struct   sockaddr_un   sock_svr;   /* socket for me               */

void   SIG_term();             /* signal handler               */

int    init_sock();
int    chk_event();
int    file_tbl_chng();

/*******************************************************************************
** 1. 모 듈 명 :  main
** 2. 모듈기능 :  File & DB Table간 변환 Main
** 3. 입    력 :
**
** 4. 입 출 력 :
**
** 5. 출    력 :
**
** 6. Fuction Return:
**
** 7. 변경이력 :
**------------------------------------------------------------------------------
** Version  Date        Comment
** 1.00     2012/07/23  - TCS VERSION(C/S 환경)
*******************************************************************************/
int main(int argc, char *argv[])
{
    struct  chg_struc   *pcs;
    int ret_event, status;
    int ret, ii;
    char uid[20];
    char pwd[20];
    time_t ctime;
    struct tm *struc_tm;

    sprintf(uid, "%s", lb_get_inifile(INI_FILE, "ORACLE", "UID"));
    sprintf(pwd, "%s", lb_get_inifile(INI_FILE, "ORACLE", "PWD"));
    ctime = time(0);
    struc_tm = local_time(&ctime);

        while(c_DbConnect(uid, pwd) <0)
        {
            printf("oltp_svr db connect error\n");
            sleep(1);
        }

        chng_t2f_wfrmst(pcs);

        //inst_plmst();
        //inst_blmst();
/*
        strcpy(pcs->plz_id, "080");
        pcs->file_year = struc_tm->tm_year + 1900;
        pcs->file_mon = struc_tm->tm_mon+1;
        pcs->file_day = struc_tm->tm_mday;
printf("%04d/%02d/%02d\n", pcs->file_year, pcs->file_mon, pcs->file_day);
        chng_t2f_passfaretbl(pcs);
        chng_t2f_basictbl(pcs);
*/

        oracle_disconnect();   /* Disconnect Oracle */

}

