int InitializeMessages(TMessage *&messages, int &count, CFTPClient *clientInstance)
{
	int size = 3; //we have to know how many messages we know about
	messages = (TMessage *) malloc(size * sizeof(TMessage)); //allocate enough space for them
	//and then fill them one by one :(
	InitMessage(messages[0], CMD_HELP, "help", Binder(&CFTPClient::HandleHelpCommand, clientInstance));
	InitMessage(messages[1], CMD_LIST, "list", Binder(&CFTPClient::HandleListCommand, clientInstance));
	InitMessage(messages[2], CMD_STAT, "stat", Binder(&CFTPClient::HandleStatCommand, clientInstance));
}
Example #2
0
extern int main(int argc, char *argv[]) {
  GError *error = NULL;
  GOptionContext *context;

  setlocale(LC_CTYPE, "ja_JP.UTF-8");
  context = g_option_context_new("file");
  g_option_context_add_main_entries(context, entries, NULL);
  if (!g_option_context_parse(context, &argc, &argv, &error)) {
    g_warning("option parsing failed: %s\n", error->message);
    exit(1);
  }

  if (argc < 2) {
    g_warning("$ monupload [options] file\n");
    exit(1);
  }

  Directory = getenv("MON_DIRECTORY_PATH");
  if (Directory == NULL) {
    g_warning("Directory empty;set MON_DIRECTORY_PATH");
    exit(1);
  }

  InitMessage("monupload",NULL);
  InitDirectory();
  SetUpDirectory(Directory, NULL, NULL, NULL, P_NONE);
  if (ThisEnv == NULL) {
    g_warning("invalid Directory");
    exit(1);
  }

  MonUpload(argv[1]);

  return 0;
}
Example #3
0
extern	int
main(
	int argc,
	char **argv)
{
	FILE_LIST	*fl;
	char		*name;
	int i;
	
	SetDefault();
	fl = GetOption(option, argc, argv, NULL);
	
	InitMessage("dbmaster", NULL);
	
	for (i = 0; i < argc; ++i) {
	  dbgprintf("%s ", argv[i]);
	}
	
	if (fl && fl->name) {
		name = fl->name;
	} else {
		name = "";
	}
	InitSystem(name);
	Message("dbmaster start");
	ExecuteServer();
	Message("dbmaster end");
	
	return	(0);
}
Example #4
0
extern int main(int argc, char **argv) {
  struct sigaction sa;

  SetDefault();
  GetOption(option, argc, argv, NULL);
  InitMessage("monitor", Log);

  if (!fRedirector) {
    fNoCheck = TRUE;
  }

  InitSystem();
  Message("start system");

  InitServers();

  sa.sa_handler = (void *)RestartSystem;
  sa.sa_flags |= SA_RESTART;
  if (sigaction(SIGHUP, &sa, NULL) != 0) {
    Error("sigaction(2) failure");
  }

  StartSetup();

  while (fLoop) {
    fRestart = TRUE;
    StartServers();
    ProcessMonitor();
  }
  return (0);
}
Example #5
0
static void InitSystem(void) {
  InitMessage("glserver", NULL);
  InitDirectory();
  SetUpDirectory(Directory, NULL, NULL, NULL, P_NONE);
  if (ThisEnv == NULL) {
    Error("DI file parse error.");
  }
  ParseURL(&Auth, AuthURL, "file");
  InitNET();
  RecParserInit();
}
Example #6
0
static void InitSystem(void) {
  char *dir;
  InitMessage("monblobapi", NULL);
  if ((dir = getenv("MON_DIRECTORY_PATH")) != NULL) {
    Directory = dir;
  }
  InitDirectory();
  SetUpDirectory(Directory, NULL, NULL, NULL, P_NONE);
  if (ThisEnv == NULL) {
    Error("DI file parse error.");
  }
}
Example #7
0
byte InitLevel(byte map)
{
	JamulSoundPurge(); // each level, that should be good

	if (curWorld.numMaps <= map)
		return 0; // can't go to illegal map

	// make a copy of the map to be played
	curMap = new Map(curWorld.map[map]);

	curMapFlags = curMap->flags;

	switch (PlayerGetMusicSettings()) {
		case MUSIC_OFF:
			CDStop(); // in case it's playing for some reason
			break;
		case MUSIC_ON:
			CDPlay(curMap->song);
			break;
		case MUSIC_RAND:
			break; // do nothing- if there is a song currently playing, let it finish, else a new
			// one will automatically start at the next call to CDPlayerUpdate
	}

	gameStartTime = timeGetTime();
	tickerTime = timeGetTime();
	updFrameCount = 0;
	visFrameCount = 0;
	numRunsToMakeUp = 0;
	frmRate = 30.0f;
	visFrms = 0;
	if (msgFromOtherModules != MSG_NEWFEATURE)
		msgFromOtherModules = 0;

	InitGuys(256);
	InitBullets();
	InitPlayer(INIT_LEVEL, 0, map);
	InitMessage();
	NewBigMessage(curMap->name, 100);
	InitParticles(512);
	lastKey = 0;
	curMap->Init(&curWorld);

	windingDown = 0;
	windingUp = 30;
	ResetInterface();
	InitCheater();

	SetGiveUpText((byte) (map != 0));

	return 1;
}
Example #8
0
dbgGraphWindow::dbgGraphWindow(): QDialog()
{
    QHBoxLayout* layout=new QHBoxLayout(this);
    mScene=new QGraphicsScene();
    mView=new QGraphicsView(mScene);
    mResult=mScene->addText("");
    mResult->setPos(clientPrToPixelsCoef*1, 0);
    mInitMessage=mScene->addText("");
    InitMessage("");
    layout->addWidget(mView);
    mMaxTime=0;
    mCreationTime.start();
}
Example #9
0
//==============================================================
// タイトル初期化
//==============================================================
void CTitle::Init( void )
{
	// 変数初期化
	m_bPushButton	= FALSE;	// スタートボタンが押されたか?
	m_bFadeInEnd    = FALSE;	// フェードインが終了した(入力を受け付ける)
	m_bFadeOutEnd   = TRUE;		// フェードアウトが終了した(ゲームへ移行)
	m_fAlphaAngle   = 0.0f;		// PressEnterKeyの透明度を算出するための角度
	m_nMsgAlpha		= 0;		// PressEnterKeyの透明度
	m_bTitleEnd		= FALSE;	// タイトル終了(フェードアウト開始)
	
	// メッセージ初期化
	InitMessage();
}
Example #10
0
extern	int
main(
	int		argc,
	char	**argv)
{
	FILE_LIST	*fl;

	SetDefault();
	fl = GetOption(option,argc,argv,NULL);
	InitMessage("checkdir",NULL);

	DumpDirectory();

	return	(0);
}
Example #11
0
 mc::result InitHandler::Handle(const IDevicePtr& device)
 {
     ServiceDescriptorPtr descriptor = device->FindDescriptor(serviceHandler_);
     bool notify = descriptor->Properties()->GetProperty(FBService::PROP_SFB_REQUIRED).toBool();
     if ( notify )
     {
         mc::MutexScope locker( descriptor->StreamsLock() );
         if ( descriptor->StreamsCount() > 0 )
         {
             mc::IProtocolPtr stream( descriptor->StreamAtIndex(0) );
             stream->Send( InitMessage() );
         }
     }
     return mc::_S_OK;
 }
Example #12
0
extern int main(int argc, char **argv) {
  FILE_LIST *fl;
  char *name;

  SetDefault();
  fl = GetOption(option, argc, argv, NULL);
  InitMessage("msgd", NULL);

  if ((fl != NULL) && (fl->name != NULL)) {
    name = fl->name;
  } else {
    name = NULL;
  }
  InitSystem();
  ExecuteServer(name);
  return (0);
}
Example #13
0
extern	int
main(
	int		argc,
	char	**argv)
{
	struct sigaction sa_segv, sa_stop;
	FILE_LIST	*fl;
	int		rc;

ENTER_FUNC;
	InitNET();

	memset( &sa_segv, 0, sizeof(struct sigaction) );
	sa_segv.sa_flags = SA_SIGINFO;
	sa_segv.sa_sigaction = SegvProcess;
	sigemptyset (&sa_segv.sa_mask);	
	sigaction( SIGSEGV, &sa_segv, NULL );

	memset( &sa_stop, 0, sizeof(struct sigaction) );
	sigemptyset (&sa_stop.sa_mask);
	sa_stop.sa_flags = 0;
	sa_stop.sa_handler = StopProcess;
	sigaction( SIGHUP, &sa_stop, NULL );

	SetDefault();
	fl = GetOption(option,argc,argv,NULL);
	InitMessage("dbstub",NULL);
	InitNET();

	if		(  BD_Name  ==  NULL  ) {
		Error("BD name is not specified.");
	}
	if		( fl == NULL ) {
		Error("module name is not specified.");
	}
	snprintf(AppName, sizeof(AppName), "dbstub-%s",fl->name);
	InitSystem(fl->name);
	Message("module %s: %.20s", fl->name, CommandParameter);
	rc = ExecuteSubProcess(fl->name);
	StopProcess(rc);
	return	(rc);
}
Example #14
0
extern int main(int argc, char **argv) {

  FILE_LIST *fl;
  char *command;

  SetDefault();
  fl = GetOption(option, argc, argv, NULL);

  InitMessage("wfccontrol", NULL);

  if ((fl != NULL) && (fl->name != NULL)) {
    command = fl->name;
  } else {
    command = "stop";
  }

  InitSystem();
  MainProc(command);
  CleanUp();
  return (0);
}
Example #15
0
int InitQueue(CommunicationQueue* queue)
{
  int retval = NVN_NOERR;

  if(queue)
  {
    int i = 0;

    queue->Capacity = QUEUE_SIZE;
    queue->Front = 0;
    queue->Size = 0;
    for(i = 0; i < QUEUE_SIZE; i++)
      InitMessage(&queue->Messages[i], "INVALID");
		pthread_mutex_init(&queue->Mutex, 0);
  }
  else
  {
    retval = NVN_EINVARGS;
  }

  return retval;
}
Example #16
0
int Pop(CommunicationQueue* queue, Message* msg, int* valid)
{
  int retval = NVN_NOERR;

  if(queue && msg)
  {
	  InitMessage(msg, "INVALID");
    if(valid)
      *valid = 0;

    if(queue->Size > 0)
    {
      int i = 0;
    
			pthread_mutex_lock(&queue->Mutex);

		  if(queue->Size > 0)
		  {
			  *msg = queue->Messages[queue->Front];
        if(valid)
          *valid = 1;

        queue->Size--;
        queue->Front = (queue->Front + 1) % queue->Capacity;
		  }

			pthread_mutex_unlock(&queue->Mutex);
    }
  }
  else
  {
    retval = NVN_EINVARGS;
  }

  return retval;
}
Example #17
0
void MainServer()
{
	InitInterfaceLocks(); 
	
	InitInterface(); /* starts a thread with the window */

   WrapInit();
	
	InitMemory(); /* memory needs channels in general, but need to start before config,
	so just be careful. */
	
	InitConfig();
	LoadConfig();		/* must be nearly first since channels use it */
	
	InitDebug();
	
	InitChannelBuffer();
	
	OpenDefaultChannels();
	
	lprintf("Starting %s\n",BlakServLongVersionString());
	
	InitClass();
	InitMessage();
	InitObject();
	InitList();
	InitTimer();
	InitSession();
	InitResource();
	InitRoomData();
	InitString();
	InitUser();
	InitAccount();
	InitNameID();
	InitDLlist();   
	InitSysTimer();
	InitMotd();
	InitLoadBof();
	InitTime();
	InitGameLock();
	InitBkodInterpret();
	InitBufferPool();
	InitTable();
	AddBuiltInDLlist();
	
	LoadMotd();
	LoadBof();
	LoadRsc();
	LoadKodbase();
	
	LoadAdminConstants();
	
	PauseTimers();
	
	if (LoadAll() == True)
	{
	/* this loaded_game_msg tells it to disconnect all blakod info about sessions,
		* that were logged on when we saved */
		
		SendTopLevelBlakodMessage(GetSystemObjectID(),LOADED_GAME_MSG,0,NULL);
		DoneLoadAccounts();
	}
	
	/* these must be after LoadAll and ClearList */
	InitCommCli(); 
	InitParseClient(); 
	InitProfiling();
	InitAsyncConnections();
	
	UpdateSecurityRedbook();
	
	UnpauseTimers();

	

	ServiceTimers();
	/* returns if server termiated */
	
	MainExitServer();
   WrapShutdown();
}