void DBusConfiguration::retrieveCommonApiDBusConfiguration() {
    std::string fqnOfConfigFile = getCurrentBinaryFileFQN();
    std::ifstream addressConfigFile;

    fqnOfConfigFile += DBUS_CONFIG_SUFFIX;

    addressConfigFile.open(fqnOfConfigFile.c_str());

    if (addressConfigFile.is_open()) {
        readConfigFile(addressConfigFile);
        addressConfigFile.close();
    }

    addressConfigFile.clear();
    std::vector<std::string> splittedConfigFQN = split(fqnOfConfigFile, '/');
    std::string globalConfigFQN = DBUS_GLOBAL_CONFIG_ROOT + splittedConfigFQN.at(splittedConfigFQN.size() - 1);
    addressConfigFile.open(globalConfigFQN);
    if (addressConfigFile.is_open()) {
        readConfigFile(addressConfigFile);
        addressConfigFile.close();
    }
    addressConfigFile.clear();

    addressConfigFile.open(DBUS_GLOBAL_CONFIG_FQN);
    if(addressConfigFile.is_open()) {
        readConfigFile(addressConfigFile);
        addressConfigFile.close();
    }
}
예제 #2
0
int 
main(int argc, char *argv[])
{
  int fractal_window ;

  glutInitWindowSize(500, 250);
  glutInitWindowPosition ( 140, 140 );
  glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE );
  glutInit(&argc, argv);

  if ( argc > 1 )
    readConfigFile ( argv[1] ) ;
  else
    readConfigFile ( "fractals.dat" ) ;

  fractal_window = glutCreateWindow( window_title );

  glClearColor(1.0, 1.0, 1.0, 1.0);

  glutReshapeFunc(Reshape);
  glutKeyboardFunc(Key);
  glutSpecialFunc(Special);
  glutDisplayFunc(Display);

#ifdef WIN32
#endif

  while ( continue_in_main_loop )
    glutMainLoopEvent();

  printf ( "Back from the 'freeglut' main loop\n" ) ;

  return 0;             /* ANSI C requires main to return int. */
}
예제 #3
0
int emct_main::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: exitChild(); break;
        case 1: closeEvent((*reinterpret_cast< QCloseEvent*(*)>(_a[1]))); break;
        case 2: getPath(); break;
        case 3: executeOption(); break;
        case 4: saveLog(); break;
        case 5: helpPdf(); break;
        case 6: { int _r = readConfigFile();
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 7: openCon((*reinterpret_cast< QWidget*(*)>(_a[1]))); break;
        case 8: disableButtons(); break;
        case 9: enableButtons(); break;
        case 10: changeEStatus((*reinterpret_cast< std::string(*)>(_a[1]))); break;
        case 11: { int _r = readVersionFile();
            if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; }  break;
        case 12: logAppend((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 13: logAppendError((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 14: logAppendOp((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
예제 #4
0
void Config::readConfigFile(QString filePath){
  QFile conf(filePath);
  bool ok = conf.open(QIODevice::ReadOnly | QIODevice::Text);
  if(!ok){ 
    Backend::log("Could not open configuration file: "+filePath+"\nLoading default configuration");
    if(filePath!=":samples/pcdm.conf"){ readConfigFile(":samples/pcdm.conf"); }
    return;
  }
  QTextStream in(&conf);
  while( !in.atEnd() ){
    QString line = in.readLine().simplified();
    //Skip comment lines
    if(!line.startsWith("#")){
      line = line.section("#",0,0).simplified(); //cut any comments off the end of the line
      QString var = line.section("=",0,0).simplified(); // get the variable
      QString val = line.section("=",1,1).simplified(); // get the value
      
      //Parse the Configuration File
      if(var=="THEME_FILE"){ confStruct[0] = val; }
      else if(var=="DE_STARTUP_DIR"){ confStruct[1] = val; }
      else if(var=="DE_STARTUP_IMAGE_DIR"){ confStruct[2] = val; }
      else if(var=="ENABLE_AUTO_LOGIN"){ confStruct[3] = val; }
      else if(var=="AUTO_LOGIN_USER"){ confStruct[4] = val; }
      //else if(var=="AUTO_LOGIN_DESKTOP"){ confStruct[5] = val; } //legacy option
      else if(var=="AUTO_LOGIN_PASSWORD"){ confStruct[6] = val; }
      else if(var=="SPLASHSCREEN_FILE"){ confStruct[7] = val; }
      else if(var=="ENABLE_VIEW_PASSWORD_BUTTON"){ confStruct[8] = val; }
      else if(var=="AUTO_LOGIN_DELAY"){ confStruct[9] = val; }
      else if(var=="SHOW_SYSTEM_USERS"){ confStruct[10] = val; }
      else{}
      
    }
  }
  conf.close();
}
예제 #5
0
void main(void)
{
        int tmpFlag;
        tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
        tmpFlag |= _CRTDBG_CHECK_ALWAYS_DF;
        tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
        _CrtSetDbgFlag( tmpFlag );

        readConfigFile("C:\\Simulink_SimServer\\io_config.cfg");

        PortNumber = 80;

        startServer();

        printf("\n");
        printf("***** Press any key to quit *****\n");
        printf("\n");

        while(1)
        {

                if(kbhit())
                {
                        break;
                }
        }

        stopServer();

#ifdef TEST_HARNESS
_ASSERTE(_CrtCheckMemory());
#endif
}
예제 #6
0
int main(int argc, char **argv) {
    CommandStruct_t theCmd;
    char *progName=basename(argv[0]);
    int count;

    readConfigFile();
    makeDirectories(CMDD_COMMAND_LINK_DIR);

    theCmd.numCmdBytes=0;
    theCmd.fromSipd=0;
    if(argc>1) {
       for(count=1;count<argc;count++) {
           theCmd.cmd[count-1]=(unsigned char)atoi(argv[count]);
           theCmd.numCmdBytes++;
       }
    }
    else {
	fprintf(stderr,"Usage:\n\t%s <cmd byte 1> .... <cmd byte N> (N<=20)\n",
		progName);
	exit(0);	
    }

    if(theCmd.numCmdBytes!=cmdLengths[(int)theCmd.cmd[0]]) {
	fprintf(stderr,"Command %d requires %d bytes\n",(int)theCmd.cmd[0],cmdLengths[(int)theCmd.cmd[0]]);
	exit(0);
    }
    return writeCommandAndLink(&theCmd);
}
예제 #7
0
PhoneGap::PhoneGap(QWebView *webView) : QObject(webView) {
    m_webView = webView;
    // Configure web view
    m_webView->settings()->enablePersistentStorage();

    // Listen to load finished signal
    QObject::connect( m_webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)) );

    // Set our own WebPage class
    m_webView->setPage( new PGWebPage() );

    // Read the phonegap.xml options config file
    readConfigFile();

    if (QCoreApplication::instance()->arguments().size() == 2) {
        // If user specified a URL on the command line, use that
        m_webView->load( QUrl::fromUserInput(QCoreApplication::instance()->arguments()[1]));
    } else {
        // Otherwise load www/index.html relative to current working directory

        // Determine index file path
        m_workingDir = QDir::current();
        QDir wwwDir( m_workingDir );
        wwwDir.cd( "www" );

        // Load the correct startup file
        m_webView->load( QUrl::fromUserInput(wwwDir.absoluteFilePath("index.html")) );
        //m_webView->load( QUrl::fromUserInput("http://html5test.com/") );
    }
}
예제 #8
0
Settings::Settings(){
	m_db_type = e_db_Unknown;
	m_db_connected	= false;
	m_db_filename	= "";
	m_db_address	= "127.0.0.1";
	m_db_username	= "******";
	m_db_password	= "";
	m_db_dbname		= "qt_sql";
	m_db_tablename	= "books";
	m_db_type		= e_db_SQL;
	mp_qsettings	= 0;

	m_remember_password = false;

#ifndef Q_OS_WIN32
	struct passwd *pw = getpwuid(getuid());

	const char *homedir = pw->pw_dir;
	char filename[512] = { 0 };
	strcpy(filename, homedir);
	strcat(filename, "/.ltr-acc/config.ini");
	if( 0 != access( filename, 0 ) ){
		strcpy(filename, "config.ini");
	}
	m_conf_file.setFileName(filename);
 #else
    m_conf_file.setFileName("config.ini");
#endif
    mp_qsettings = new QSettings( m_conf_file.fileName(), QSettings::IniFormat );
	readConfigFile();
}
예제 #9
0
int main(int argc, char** argv)
{
	int opt;
	int pid;

	while ((opt = getopt(argc, argv, "vdh")) != -1) {
		switch(opt)  {
		case 'v':
			printf("udp2can V.02 " __DATE__" " __TIME__ "\n(C) Marum, 2014\n   [email protected]\n");
			exit(EXIT_SUCCESS);
		case 'h':
			printUsage();
			exit(EXIT_SUCCESS);
		case 'd':
			debug = 1;
			printf("Start in foreground, debug messages are printed\n");
			break;
		default:
			printf("Unknown option!\n");
			printUsage();
			exit(EXIT_FAILURE);
		}
	}

	signal(SIGTERM, signalHandler);

	if (debug) {
		can_setDebug(1);
		udp_setDebug(1);
	}

	readConfigFile();


	if ((initCanDevice() < 0) || (initUDPSocket() < 0)) {
		fprintf(stderr, "Unable to initialze CAN device or UDP socket\nAbort.....\n");
		close(canFd);
		close(udpFd);
		exit(EXIT_FAILURE);
	}


	if (debug == 0) {
		/* Fork off the parent process */
		pid = fork();
		if (pid < 0) {
			exit(EXIT_FAILURE);
		}

		if (pid > 0) {
			printf("Going into background ...\n");
			exit(EXIT_SUCCESS);
		}
	}

	run();

	return EXIT_SUCCESS;
}
예제 #10
0
//******** PUBLIC FUNCTIONS **************
void Config::loadConfigFile(QString filePath){
  loadDefaults();
  if(!QFile::exists(filePath)){
    Backend::log("Configuration file does not exist: "+filePath+"\nLoading default configuration");
    filePath=":samples/pcdm.conf";
  }
  readConfigFile(filePath);
}
예제 #11
0
/*
 * ReadProfile - read our current status from the .ini file
 */
void ReadProfile( void )
{
    getConfigFilePaths();   /* get paths to ini files */
    readToolBarSize();
    readInitialPosition();
    readConfigFile();

} /* ReadProfile */
예제 #12
0
파일: test.c 프로젝트: SergMir/gep
//!
int main(int argc, char *argv[])
{
  if (argc != 5)
  {
    fprintf(stderr, "Usage: gep_test <config_file> <input_samples_file> <output_samples_file> <enable_graphics>\n");
    exit(0);
  }

  gep_short_params_t *short_params = createDefaultParams();

  const char *arg_config_filename         = argv[1];
  const char *arg_input_samples_filename  = argv[2];
  const char *arg_output_samples_filename = argv[3];
  const char *arg_enable_graphics_str     = argv[4];

  readConfigFile(arg_config_filename, short_params);
  strncpy(short_params->input_samples_filename,  arg_input_samples_filename,  sizeof(short_params->input_samples_filename));
  strncpy(short_params->output_samples_filename, arg_output_samples_filename, sizeof(short_params->output_samples_filename));

  sscanf(arg_enable_graphics_str, "%d",  &graph_enabled);

  gep_ctx = GEP_CreateContext(short_params, &stat_params);

  if (signal(SIGUSR1, gep_sigterm_handler) == SIG_ERR)
  {
    fprintf(stderr, "Can't setup SIGUSR1 hanlder\n");
  }

  last_frame_rendered = simulation_started = last_output_printed = getTimeNs();

  if (graph_enabled)
  {
    graph_init(argc, argv);

    pthread_t gep_thread;
    int status = pthread_create(&gep_thread, NULL, gep_run_routine, NULL);
    if (0 != status)
    {
      fprintf(stderr, "Can't create GEP thread!\n");
      exit(-1);
    }

    glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
    glutMainLoop();

    pthread_join(gep_thread, NULL);
  }
  else
  {
    GEP_Run(gep_ctx, stat_callback);
  }

  GEP_DestroyContext(gep_ctx);
  free(short_params);

  return 0;
}
ConfigFile::ConfigFile() :
  generator_(NULL),
  handler_(NULL)
{
  char const * const home = getenv("HOME");
  configFile_ = QString(home) + "/" + ConfigFileName::instance()->fileName();

  readConfigFile();  
}
예제 #14
0
파일: Config.cpp 프로젝트: rarosu/FnulAI
string Config::getScriptPath()
{
	if (!init)
	{
		readConfigFile();
	}

	return scriptPath;
}
예제 #15
0
void testObj::test<4>(void)
{
  ensure("oops - registration failed", g_rhPP.isRegistered());
  readConfigFile("testdata/preproc_test_trigger_reject_all.xml");
  TriggersCollection fc=create(queue_);
  ensure_equals("no triggers created", fc.size(), 1u);
  ensure_equals("interface already called", g_testInterfaceCalled, 0);
  fc.at(0)->process(sn_);
  usleep(500*1000);         // wait a while, until data is processed...
  ensure_equals("call not blocked by preprocessor", g_testInterfaceCalled, 0);
}
예제 #16
0
파일: editor.cpp 프로젝트: CruzR/stk-editor
// ----------------------------------------------------------------------------
bool Editor::init()
{
    m_maps_path         = NULL;
    m_music_loc         = NULL;
    m_indicator         = NULL;
    m_valid_data_dir    = false;
    m_exe_loc           = "";
    m_toolbar           = NULL;
    m_toolbox           = NULL;
    m_rcs               = NULL;
    m_tex_sel           = NULL;
    m_indicator         = NULL;
    m_viewport          = NULL;
    m_rcs               = NULL;
    m_font              = NULL;
    m_new_dialog_wndw   = NULL;

    m_screen_size = dimension2du(10, 10);

    IrrlichtDevice *nulldevice = createDevice(video::EDT_NULL);
    m_screen_size = nulldevice->getVideoModeList()->getDesktopResolution();
    readConfigFile(nulldevice->getFileSystem());
    nulldevice->drop();

    m_device = createDevice(EDT_OPENGL, m_screen_size, 16, false, false, true);
    if (!m_device) return false;

    m_device->setResizable(true);
    m_device->setWindowCaption(L"SuperTuxKart Track Editor Beta v0.03");

    if (m_screen_size.Width < 20 || m_screen_size.Height < 20)
        m_device->maximizeWindow();

    m_video_driver  = m_device->getVideoDriver();
    m_scene_manager = m_device->getSceneManager();
    m_gui_env       = m_device->getGUIEnvironment();

    m_screen_size   = m_video_driver->getScreenSize();
    m_def_wd        = m_device->getFileSystem()->getWorkingDirectory();

    // lights
    m_scene_manager->setAmbientLight(SColorf(0.3f, 0.3f, 0.3f, 1.0f));
    ILightSceneNode* l = m_scene_manager->addLightSceneNode(0, vector3df(0, 1, 0),
                                              SColorf(1.0f, 1.0f, 1.0f), 500, -1);
    l->setLightType(ELT_DIRECTIONAL);
    l->setPosition(vector3df(0,
        1, 0));

    m_device->setEventReceiver(this);

    if (!isValidDataLoc()) dataDirLocDlg();

    return true;
} // init
예제 #17
0
int 
main(int argc, char *argv[])
{
  int fractal_window ;

  glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE );

  glutInitWindowSize(500, 250);
  glutInitWindowPosition ( 140, 140 ) ;
  glutInit(&argc, argv);

  if ( argc > 1 )
    readConfigFile ( argv[1] ) ;
  else
    readConfigFile ( "fractals.dat" ) ;

  fractal_window = glutCreateWindow( window_title );

  glClearColor(1.0, 1.0, 1.0, 1.0);

  glutReshapeFunc(Reshape);
  glutKeyboardFunc(Key);
  glutSpecialFunc(Special);
  glutDisplayFunc(Display);
  glutMouseFunc(Mouse);
  glutMotionFunc(MouseMotion);
  glutMouseWheelFunc(MouseWheel);

  glutMainLoop();

  printf ( "Back from the 'freeglut' main loop\n" ) ;

  free ( affine ) ;

#ifdef _MSC_VER
  /* DUMP MEMORY LEAK INFORMATION */
  _CrtDumpMemoryLeaks () ;
#endif

  return 0;             /* ANSI C requires main to return int. */
}
예제 #18
0
bool GhostwriterPlugin::init(PluginHub *hub, int id, int groupId, const QString &)
{
	//Q_UNUSED( groupId );
	
	m_hub = hub;
	m_id = id;
	m_groupId = groupId;
	m_logoDirName = NULL;

	readConfigFile();
	return true;
}
예제 #19
0
파일: Config.c 프로젝트: punktniklas/NiKom
void ReadFidoConfig(void) {
  int i;
  for(i = 0; i < 10; i++) {
    Servermem->fidodata.fd[i].domain[0] = '\0';
  }
  for(i = 0; i < 20; i++) {
    Servermem->fidodata.fa[i].namn[0] = '\0';
  }
  Servermem->fidodata.mailgroups = 0;

  readConfigFile("NiKom:DatoCfg/NiKomFido.cfg", handleFidoConfigLine);
}
예제 #20
0
void AddCamera::on_readYAML_clicked()
{

    QString filename = QFileDialog::getOpenFileName(this,tr("Load Distortion Coefficients"), ".", tr(".yaml Files (*.yaml)"));

    if(filename != "")
    {
        std::cout << filename.toStdString() << std::endl;

        readConfigFile(filename);
    }
}
예제 #21
0
/*!
 * \fn G_MODULE_EXPORT void chooseGameConfigurationNewAssistant(GtkWidget *widget, gpointer data)
 *  Load the game configuration
 * \param[in] widget the widget which send the signal
 * \param[in] data the globalData
 */
G_MODULE_EXPORT void chooseGameConfigurationNewAssistant(GtkWidget *widget, gpointer data)
{
    globalData *user_data = (globalData*) data;
    gint index;
    game_config *ptr_config = NULL;
    game_config config = {0,1,1,0,-1,-1,"",0};

    /* Read the game configuration list */
    char home_path[SIZE_MAX_FILE_NAME]="";
    list_game_config *ptr_list_config;
    #ifndef PORTABLE
    readHomePathSlash(home_path);
    #endif // PORTABLE
    ptr_list_config = readConfigListFile(home_path);

    index = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));

    /* If the index is not valid return */
    if (index < 0)
    {
        closeListGameConfig(ptr_list_config);
        return;
    }

    /* if the index correspond to to a game configuration, read it */
    if (index < ptr_list_config->nb_config)
        readConfigFile(index,ptr_list_config,&(user_data->config),home_path);
    /* Otherwise ask a new game configuration */
    else
    {
        changeNewGameConfigurationDialog(user_data,config);
        ptr_config=newGameConfiguration(user_data,GTK_WINDOW(user_data->ptr_new_csu_file_assistant));
        if (ptr_config == NULL)
        {
            gtk_combo_box_set_active(GTK_COMBO_BOX(widget),-1);
            validAssistantNewCsuOne(NULL,data);
            return;
        }

        /* Save the game configuration if ask */
        if (index == ptr_list_config->nb_config)
            user_data->save_new_game_config = TRUE;
        else
            user_data->save_new_game_config = FALSE;

        user_data->config = *ptr_config;
        free(ptr_config);
    }

    validAssistantNewCsuOne(NULL,data);
    closeListGameConfig(ptr_list_config);
}
예제 #22
0
static SynceInfo* synce_info_from_file(const char* filename)
{
  SynceInfo* result = calloc(1, sizeof(SynceInfo));
  bool success = false;
  char* connection_filename;
 	struct configFile* config = NULL;

  if (filename)
    connection_filename = strdup(filename);
  else
    synce_get_connection_filename(&connection_filename);

	config = readConfigFile(connection_filename);
	if (!config)
	{
		synce_error("unable to open file: %s", connection_filename);
		goto exit;
	}

  result->dccm_pid        = getConfigInt(config, "dccm",   "pid");

  result->key             = getConfigInt(config, "device", "key");
  result->os_version      = getConfigInt(config, "device", "os_version");
  result->build_number    = getConfigInt(config, "device", "build_number");
  result->processor_type  = getConfigInt(config, "device", "processor_type");
  result->partner_id_1    = getConfigInt(config, "device", "partner_id_1");
  result->partner_id_2    = getConfigInt(config, "device", "partner_id_2");

  result->ip        = STRDUP(getConfigString(config, "device", "ip"));
  result->password  = STRDUP(getConfigString(config, "device", "password"));
  result->name      = STRDUP(getConfigString(config, "device", "name"));
  result->os_name   = STRDUP(getConfigString(config, "device", "os_name"));
  result->model     = STRDUP(getConfigString(config, "device", "model"));

  result->transport = STRDUP(getConfigString(config, "connection", "transport"));

  success = true;

exit:
  FREE(connection_filename);

  if (config)
    unloadConfigFile(config);

  if (success)
    return result;
  else
  {
    synce_info_destroy(result);
    return NULL;
  }
}
예제 #23
0
void ConfigFile::setPath(const std::string &path)
{
    if(!path.empty())
    {
        this->path = path;
        readConfigFile();
    }
    else
    {
        Log::getInstance()->append("Given config file path is not valid! Quitting.");
        exit(CONFIG_NOT_FOUND);
    }
}
예제 #24
0
void
FileSource::getConfig()
{
    std::vector<vespalib::string> lines(readConfigFile(_fileName));
    int64_t last = getLast(_fileName);

    if (last > _lastLoaded) {
        _holder->handle(ConfigUpdate::UP(new ConfigUpdate(ConfigValue(lines, calculateContentMd5(lines)), true, _generation)));
        _lastLoaded = last;
    } else {
        _holder->handle(ConfigUpdate::UP(new ConfigUpdate(ConfigValue(lines, calculateContentMd5(lines)), false, _generation)));
    }
}
int
main(int argc, char *argv[])
{
    const int SLEEP_TIME = 15;      /* Time to sleep between messages */
    int count = 0;                  /* Number of completed SLEEP_TIME intervals */
    int unslept;                    /* Time remaining in sleep interval */
    struct sigaction sa;

    sigemptyset(&sa.sa_mask);
    sa.sa_flags = SA_RESTART;
    sa.sa_handler = sighupHandler;
    if (sigaction(SIGHUP, &sa, NULL) == -1)
        errExit("sigaction");

    if (becomeDaemon(0) == -1)
        errExit("becomeDaemon");

    logOpen(LOG_FILE);
    readConfigFile(CONFIG_FILE);

    unslept = SLEEP_TIME;

    for (;;) {
        unslept = sleep(unslept);       /* Returns > 0 if interrupted */

        if (hupReceived) {              /* If we got SIGHUP... */
            hupReceived = 0;            /* Get ready for next SIGHUP */
            logClose();
            logOpen(LOG_FILE);
            readConfigFile(CONFIG_FILE);
        }

        if (unslept == 0) {             /* On completed interval */
            count++;
            logMessage("Main: %d", count);
            unslept = SLEEP_TIME;       /* Reset interval */
        }
    }
}
예제 #26
0
FLDigiDoc::FLDigiDoc(const QString &configfile)
{

  int err = ERR_OK;
  initDigiDocLib();
  if (!configfile.isEmpty()) {
    err = initConfigStore(NULL);
    if (err == ERR_OK)
      err = readConfigFile(configfile.latin1(), ITEM_TYPE_PRIVATE);
    if (err != ERR_OK)
      qWarning("FLDigiDoc:" + QString(getErrorString(err)));
  }
}
예제 #27
0
void readConfigsForGame(gamedef_t *gamedef)
{
    TCHAR basePath[MAX_PATH];
    int basePathFullLen = GetModuleFileName((HMODULE)NULL, basePath, MAX_PATH);
    int basePathLen = strlenUntilLast((PTSTR)basePath, _T('\\'));
    if (basePathLen > -1 && basePathLen < MAX_PATH - 1)
    {
        basePath[basePathLen + 1] = _T('\0'); // don't need executable file name
    }

    LPCTSTR tBasePath = (LPCTSTR)basePath;
    readConfigFile(
        DEFAULT_INI_FILE_NAME,
        _T(DEFAULT_INI_FILE_NAME),
        tBasePath,
        gamedef);
    readConfigFile(
        (const char*)(gamedef->configFileName),
        gamedef->tConfigFileName,
        tBasePath,
        gamedef);
}
예제 #28
0
int mainService(int argc, char *argv[])
{
	char	sourceURL[1024] = "";
	char	configFile[1024] = "";
	int		c = 0;
	int 	numEncoders = 1;


    char    currentlogFile[1024] = "";
	char	logPrefix[255] = "streamTranscoder";

    sprintf(configFile, "%s", logPrefix);
    sprintf(currentlogFile, "%s", logPrefix);

    setgLogFile(&gMain, currentlogFile);
    setConfigFileName(&gMain, configFile);

	addConfigVariable(&gMain, "SourceURL");
	addConfigVariable(&gMain, "NumEncoders");
	addConfigVariable(&gMain, "AutomaticReconnectSecs");
	addConfigVariable(&gMain, "AutoConnect");
	addConfigVariable(&gMain, "LogLevel");
	addConfigVariable(&gMain, "LogFile");


    readConfigFile(&gMain, 0);

	strcpy(sourceURL, gMain.gSourceURL);

    for(int i = 0; i < gMain.gNumEncoders; i++) {
        if(!g[i]) {
            g[i] = (edcastGlobals *) malloc(sizeof(edcastGlobals));
            memset(g[i], '\000', sizeof(edcastGlobals));
        }

        g[i]->encoderNumber = i + 1;
        setgLogFile(g[i], gMain.gLogFile);
        setConfigFileName(g[i], gMain.gConfigFileName);
		addBasicEncoderSettings(g[i]);
        initializeGlobals(g[i]);
        edcast_init(g[i]);
		connectToServer(g[i]);
    }

	pthread_create(&sourceThread, NULL, &startSourceThread, sourceURL);
	pthread_create(&reconnectThread, NULL, &startReconnectThread, NULL);
	pthread_create(&decodeThread, NULL, &startDecodeThread, NULL);
	pthread_join(sourceThread, NULL);
	pthread_join(decodeThread, NULL);
	return 1;
}
예제 #29
0
파일: 7.19.01.c 프로젝트: apktool/Temp
int main(int argc, char* argv[]){
	const int SLEEP_TIME=15;
	int count=0;
	int unslept;

	struct sigaction sa;
	sigemptyset(&sa.sa_mask);
	//sa.sa_flags=SA_RESTART;
	sa.sa_flags=SA_NOCLDSTOP;
	sa.sa_handler=sighupHandler;
	if(sigaction(SIGHUP,&sa,NULL)==-1){
		perror("error sigation");
	}
	if(becomeDaemon(0)==-1){
		perror("error becomeDaemon");
	}

	logOpen(LOG_FILE);
	readConfigFile(CONFIG_FILE);

	unslept=SLEEP_TIME;

	for(;;){
		unslept=sleep(unslept);
		if(hupReceived){
			hupReceived=0;
			logClose();
			logOpen(LOG_FILE);
			readConfigFile(CONFIG_FILE);
		}
		if(unslept==0){
			count++;
			logMessage("Main: %d", count);
			unslept=SLEEP_TIME;	
		}
	}
	return 0;
}
예제 #30
0
int main(int argc, char* argv[]) {

    printf("-------------------------------------------------------\n");
    printf("                   Classifier Tracker                    \n");
    printf("-------------------------------------------------------\n\n");

    ImageSource::InputDevice input;
    input = ImageSource::USB;

    int numBaseClassifier;
    char* source;
    char* resultDir;
    float overlap, searchFactor;
    Rect initBB;

    resultDir = new char[100];
    memset(resultDir, '\0', 100);
    source = new char[100];
    memset(source, '\0', 100);
    initBB = Rect(0, 0, 0, 0);

    //read parameters from config file
    int ret;
    if (argc >= 2)
        ret = readConfigFile(argv[1], input, numBaseClassifier, overlap, searchFactor, resultDir, source, initBB);
    else
        ret = readConfigFile("./config.txt", input, numBaseClassifier, overlap, searchFactor, resultDir, source, initBB);

    if (ret < 0) {
        printf("ERROR: config file damaged\n");
        return -1;
    }

    //start tracking
    track3(input, numBaseClassifier, overlap, searchFactor, resultDir, initBB, source);

    return 0;
}