www.pudn.com > apdb2ndb.rar > atn_init_apdb.cc


#ifndef lint 
static char copyright[] = "Copyright (C) FUJITO LIMITED 2000 "; 
static char id[]= "$Id: atn_init_apdb.cc,v 1.3 2001/02/13 10:33:00 JST rad1 Exp $"; 
#endif 
/* 
 * $Log: atn_init_apdb.cc,v $ 
 * Revision 1.3  2001/02/13 10:33:00 JST  rad1 
 * $B:eK\(B(TSL) 
 * $B!&(Bapif$B$N(Binit$B$NI|5"CM%A%'%C%/$r=$@5(B 
 * 
 * Revision 1.2  2000/12/07 16:43:23 JST  rad1 
 * deleted. 
 * 
 * Revision 1.1.1.1  2000/12/04 10:22:29 JST  rad1 
 * 
 * $Com: 阪本(TSL) 
 * $Com: ・apifのinitの復帰値チェックを修正 
 */ 
 
#include "atn_inc.h" 
 
ATN_FDECL int atn_init_apdb(int argc,char **argv,atn_com &com) 
{ 
  int rc; 
  int rcode = 0; 
 
  /* cleate apif */ 
  try { 
    com.apif = new AirAPIF(); 
  } 
  catch(...) 
  { 
    cerr << "Failure to create apif \n"; 
    rcode = -1; 
    return rcode ; // goto exit_func; 
  } 
  AirAPIF &apif = *com.apif; 
   
  /* Initialize apif */ 
  rc = apif.init(argc, argv); 
  switch(rc) 
    { 
       
    case AIR_R_NOKEY : break; 
    case AIR_R_SUCCESS : break; // Changed : 2000.12.6 
    default: 
      cerr << " Faulure to init apif \n"; 
      rcode = -1; 
      return rcode ; //goto exit_func; 
    } 
   
  /* init. env */ 
  char *msg_path = NULL_PTR; 
   
  try  
    { 
      com.env = new AirCfEnv(argc,argv); 
    } 
  catch(...) 
    { 
      cerr << "Failure to create env \n"; 
      rcode = -1; 
      goto exit_func; 
    } 
  com.env->get_var(AIR_ENVKEY_MESSAGE_PATHNAME,NULL_PTR,&msg_path); 
#ifdef ATN_MSG_PATH 
  if(msg_path == NULL_PTR) 
    { 
      msg_path = strdup(ATN_MSG_PATH); 
    } 
#endif 
  if(msg_path ==NULL_PTR) 
    { 
      cerr << " faulure to get message path\n"; 
      rcode = -1; 
      goto exit_func; 
    } 
 
  try  
    { 
      com.afm = new AirCfMsg(msg_path); 
    } 
  catch(...) 
    { 
      cerr << "Fauluer to get Mssage path\n"; 
      rcode = -1; 
      goto exit_func; 
    } 
  //  rc = apif.set_program((char *)"ndb2apdb", (char *)"V01L01", time(0)); 
   
  // apif.logging("logfile"); 
 
  exit_func: 
   // if(msg_path) delete msg_path; 
  return rcode; 
}