Ejemplo n.º 1
0
int main( int argc, char** argv )
{
    //==== Get Vehicle Ptr ====//
    Vehicle* vPtr = VehicleMgr.GetVehicle();

    batchMode( argc, argv, vPtr );
}
Ejemplo n.º 2
0
int main(int argc, char *argv[]){
	printf("Campbell's Hella Rad Shell v.0.0\n");
	for(;;) { //this loops forever

		if (argc > 1){
			batchMode(argv[1]);
			return 0;
		}

		argSize = 0;
		char input[512]; //buffer where user input will be stored right before we actually do something with it
		memset(input, '\0', 512); //initializes every byte of the buffer to the null character

		char *tokens;

		printf("mysh> ");

		fgets(input, 512, stdin); //takes input from stdin and puts it in input, to a max length of 512 characters

		if (isEmpty(input) == 1){
			tokens = strtok(input, " \n\t\r");
			process(tokens);
		}
		else {
			continue;
		}
	}
}
Ejemplo n.º 3
0
int main(int argc, char** argv)
{
    if(argc > 1)
        return batchMode(argc, argv);
    else
        interactiveMode();
    return 0;
}
Ejemplo n.º 4
0
Archivo: samui.cpp Proyecto: KDE/simon
void SamUi::error(const QString& message)
{
  if (batchMode()) 
  {
    kWarning() << message;
  } else
    KMessageBox::sorry(reinterpret_cast<QWidget*>(this), message);
}
Ejemplo n.º 5
0
//========================================================//
//========================================================//
//========================= Main =========================//
int main( int argc, char** argv)
{
	// Seed RNG for batch mode.
	// rand() is used to create ptrID's in Geom constructor.
	unsigned int seed = (unsigned int)time( NULL );
	srand( seed );

//FILE* filePtr = fopen("debug.txt", "w" );
//freopen("debug.txt", "w", stdout); 

	//==== Create Aircraft ====//
	airPtr = new Aircraft();

	if ( batchMode( argc, argv, airPtr ) )
	    exit(0);

	screenMgrPtr = new ScreenMgr(airPtr);

	//==== Check Server For Version Number ====//
	CheckVersionNumber();

	// Seed RNG for interactive mode.
	// rand() is used to create ptrID's in Geom constructor.
	// CheckVersionNumber sets the seed based on the file path.  Failure to reset the seed
	// will leave the RNG in a repeatable state (given the same path to VSP).
	srand( seed );

	//==== Link Objects ====//
	airPtr->setScreenMgr( screenMgrPtr );

	// if only 1 argument it is the input filename
	if (argc == 2)
	{
		screenMgrPtr->s_open(ScriptMgr::GUI, argv[argc-1]);
	}

	// this works better after the 
	if (timerFlag) 
	{
		screenMgrPtr->showGui();
		Fl::add_timeout(timerTime, ScriptMgr::staticTimeoutHandler, scriptMgr);
		scriptMgr->setTimeout(timerTime, timerScriptFile);
	} 
	else 
	{
		if (VspPreferences::Instance()->autoSaveInterval > 0)
			Fl::add_timeout( VspPreferences::Instance()->autoSaveInterval, autoSaveTimeoutHandler, airPtr );
		screenMgrPtr->showGui( argc-1, argv );
	}

	return Fl::run();
		
//fclose(filePtr);

}
Ejemplo n.º 6
0
void SamView::closeEvent(QCloseEvent* event)
{
  if (batchMode() && KCmdLineArgs::parsedArgs()->isSet("w")) {
    save();
  } else {
    if (!askForSave()) {
      event->ignore();
      return;
    }
  }
  event->accept();
}
Ejemplo n.º 7
0
//========================= Main =========================//
int main( int argc, char** argv)
{

//FILE* filePtr = fopen("debug.txt", "w" );
//freopen("debug.txt", "w", stdout); 

#ifdef CHECK_FOR_KEY
	if ( !validKey() )
	{
		printf( "Invalid Reg Key\n" );
		printf( "Press Enter to Exit\n" );
		char str[256];
		gets( str );
		exit(0);
	}
#endif
	
	airPtr = new Aircraft();

	if ( batchMode( argc, argv, airPtr ) )
	    exit(0);

	screenMgrPtr = new ScreenMgr(airPtr);

	//==== Link Objects ====//
	airPtr->setScreenMgr( screenMgrPtr );

	// if only 1 argument it is the input filename
	if (argc == 2)
	{
		screenMgrPtr->s_open(ScriptMgr::GUI, argv[argc-1]);
	}

	// this works better after the 
	if (timerFlag) 
	{
		screenMgrPtr->showGui();
		Fl::add_timeout(timerTime, ScriptMgr::staticTimeoutHandler, scriptMgr);
		scriptMgr->setTimeout(timerTime, timerScriptFile);
	} 
	else 
	{
		Fl::add_timeout( AUTO_SAVE_TIME, autoSaveTimeoutHandler, airPtr );
		screenMgrPtr->showGui( argc-1, argv );
	}

	return Fl::run();
		
//fclose(filePtr);

}
Ejemplo n.º 8
0
//========================================================//
//========================================================//
//========================= Main =========================//
int main( int argc, char** argv)
{

//FILE* filePtr = fopen("debug.txt", "w" );
//freopen("debug.txt", "w", stdout); 

	//==== Create Aircraft ====//
	airPtr = new Aircraft();

	if ( batchMode( argc, argv, airPtr ) )
	    exit(0);

	screenMgrPtr = new ScreenMgr(airPtr);

	//==== Check Server For Version Number ====//
	CheckVersionNumber();

	//==== Link Objects ====//
	airPtr->setScreenMgr( screenMgrPtr );

	// if only 1 argument it is the input filename
	if (argc == 2)
	{
		screenMgrPtr->s_open(ScriptMgr::GUI, argv[argc-1]);
	}

	// this works better after the 
	if (timerFlag) 
	{
		screenMgrPtr->showGui();
		Fl::add_timeout(timerTime, ScriptMgr::staticTimeoutHandler, scriptMgr);
		scriptMgr->setTimeout(timerTime, timerScriptFile);
	} 
	else 
	{
		if (VspPreferences::Instance()->autoSaveInterval > 0)
			Fl::add_timeout( VspPreferences::Instance()->autoSaveInterval, autoSaveTimeoutHandler, airPtr );
		screenMgrPtr->showGui( argc-1, argv );
	}

	return Fl::run();
		
//fclose(filePtr);

}
Ejemplo n.º 9
0
bool SamView::askForSave()
{
  if (batchMode())
    return true;

  if (m_dirty)
  {
    int ret = KMessageBox::questionYesNoCancel(this, i18n("Your Sam configuration has changed.\n\nDo you want to save?"));
    switch (ret)
    {
      case KMessageBox::Yes:
        return save();
      case KMessageBox::Cancel:
        return false;
      default:
        return true;
    }
  }
  return true;
}