Example #1
0
void ProjectNode::showCmdLineDialog()
{
    CmdLineEditDialog dlg;
    dlg.setCurrentCmdLine(getCommandLine());

    if( dlg.exec() == QDialog::Accepted)
    {
        setCommandLine(dlg.getResult());
    }
}
Example #2
0
int main  ( int argc, char **argv )
{
  int density;        /* Density of the data set to generate */
  double maxRadius;   /* Maximum radius of the data set to generate */

  getCommandLine ( &density, &maxRadius, argc, argv );
  printHeader    ( density, maxRadius );
  printSet       ( density, maxRadius );
  return 0; 
}
Example #3
0
/*
** This function is threaded and wait until
** some command has been input by user using
** the shell.
*/
static void *watchGetCommandLine(void *in)
{
    getCommandLine();

    __LockSignal(pReadyForLaunch);
    WatchGetCmdLineThreadAlive = FALSE;
    __Signal(&TimeToWork);
    __UnLockSignal(pReadyForLaunch);

    return NULL;

}
Example #4
0
void CompileMKTask::run(ThreadWeaver::JobPointer, ThreadWeaver::Thread*)
{
    QStringList args;
    args << QLatin1String("-f");
    args << mkUrl.toLocalFile();
    args << QString::fromLatin1("ENBLEND='%1'").arg(enblendPath);
    args << QString::fromLatin1("NONA='%1'").arg(nonaPath);

    runProcess(args);

    qCDebug(DIGIKAM_GENERAL_LOG) << "make command line: " << getCommandLine();

    qCDebug(DIGIKAM_GENERAL_LOG) << "make output:" << endl << output;
}
void VideoConverter::startConversionVideo(VideoItem *videoItem)
{
	if (videoItem == NULL || !canStartConversion() || !ffmpegInstalled()) return;
	// check if this videoItem has an overrided conversion config
	if (videoItem->hasOverridedConversion())
	{
		// the user don't want convert it
		if (!videoItem->getOverridedVideoConversionConfig().convertVideo)
		{
			// mark as "converted"
			videoItem->setAsConverted(NULL);
			// emit the conversion finished
			emit conversionFinished(videoItem);
			return;
		}
		else // set the "overrided" conversion config
		{
			convConfToUse = videoItem->getOverridedVideoConversionConfig().videoConversionConfig;
		}
	}
	else // set the conversion config stored in options (standard user options)
	{
		convConfToUse = convConf;
	}
	// assign data
	this->videoItem = videoItem;
	videoItem->lock(this);
	videoItem->setProgress(0, this);
	// init internal data
	videoLength = 0;
	outputAll = "";
	// check if the "input" video file exists
	if (QFile::exists(videoItem->getVideoFile()))
	{
		QFile input(videoItem->getVideoFile());
		// the video is > than 0kb? if yes, then start the conversion
		if (input.size() > 0)
		{
			lastProgress = 0;
			// launch the ffmpeg application
			ffmpegProcess->start(ffmpegApp, getCommandLine());
			return;
		}
	}
	// if we are here, then this video is invalid (error)
	videoItem->setAsError(this);
	videoItem->unlock(this);
	emit videoItemUpdated(videoItem);
}
Example #6
0
File: tsh.c Project: esun9064/tsh
int main (int argc, char *argv[])
{
  /* Initialize command buffer */
  char* cmdLine = malloc(sizeof(char*)*BUFSIZE);
  fgcommands = (char *) malloc(500 * sizeof(char));

  /* shell initialization */
  if (signal(SIGINT, sig) == SIG_ERR) PrintPError("SIGINT");
  if (signal(SIGTSTP, sig) == SIG_ERR) PrintPError("SIGTSTP");
  if (signal(SIGCHLD, sig) == SIG_ERR) PrintPError("SIGCHLD");

  // printPrompt();
 
     
  while (!forceExit) /* repeat forever */
  {
    //printPrompt();
    /* read command line */
    getCommandLine(&cmdLine, BUFSIZE);

    //cmdLine  = strdup(checkAlias2(cmdLine));

    //printf("The new is %s\n", cmdLine);
    if(strcmp(cmdLine, "exit") == 0 )
    {
      forceExit=TRUE;
      continue;
    }
    else if (feof(stdin)){
  //printf("\n");
  forceExit = TRUE;
        break;
  } 
    fgpid = 0;
    /* checks the status of background jobs */
    CheckJobs();

    /* interpret command and line
     * includes executing of commands */
    Interpret(cmdLine);
    //fflush(stdout);
    fgpid = 0;
  }

  /* shell termination */
  free(cmdLine);
  free(fgcommands);
  return 0;
} /* end main */
Example #7
0
/*
 * main
 *
 * arguments:
 *	 int argc: the number of arguments provided on the command line
 *	 char *argv[]: array of strings provided on the command line
 *
 * returns: int: 0 = OK, else error
 *
 * This sets up signal handling and implements the main loop of tsh.
 */
int main(int argc, char *argv[])
{
	/* Initialize command buffer */
	char* cmdLine = malloc(sizeof(char*) * BUFSIZE);

	/* shell initialization */
	if (signal(SIGINT, sig) == SIG_ERR)
		PrintPError("SIGINT");
	if (signal(SIGTSTP, sig) == SIG_ERR)
		PrintPError("SIGTSTP");

	while (!forceExit) /* repeat forever */ {
		char* prompt = getenv("PS1");
		if (prompt != NULL) {
			printf("%s", prompt);
		}
		
		/* read command line */
		getCommandLine(&cmdLine, BUFSIZE);

		if (strcmp(cmdLine, "exit") == 0)
			forceExit = TRUE;
		
		/* checks the status of background jobs */
		if (!forceExit) {
			CheckJobs();
		}

		/* interpret command and line
		 * includes executing of commands */
		Interpret(cmdLine);

	}

	bgjobL* curr = bgjobs;
	while (curr != NULL) {
		curr = bgjobs;
		int status;
		int res = waitpid(curr->pid, &status, WNOHANG | WUNTRACED | WCONTINUED);
		if (!(res == curr->pid && !WIFCONTINUED(status))) {
			kill(curr->pid, SIGKILL);
		}
		RemoveJob(curr->jid);
	}
	
	/* shell termination */
	free(cmdLine);
	return 0;
} /* main */
void CpCleanTask::run(ThreadWeaver::JobPointer, ThreadWeaver::Thread*)
{
    cpCleanPtoUrl = tmpDir.resolved(QUrl::fromLocalFile(QStringLiteral("cp_pano_clean.pto")));

    QStringList args;
    args << QStringLiteral("-o");
    args << cpCleanPtoUrl.toLocalFile();
    args << cpFindPtoUrl.toLocalFile();

    runProcess(args);

    qCDebug(KIPIPLUGINS_LOG) << "cpclean command line: " << getCommandLine();

    qCDebug(KIPIPLUGINS_LOG) << "cpclean output:" << endl << output;
}
Example #9
0
int main (int argc, char *argv[])
{
    /* Initialize command buffer */
    char* cmdLine = malloc(sizeof(char*)*BUFSIZE);

    /* shell initialization */
    if (signal(SIGINT, sig_handler) == SIG_ERR) PrintPError("SIGINT");
    if (signal(SIGTSTP, sig_handler) == SIG_ERR) PrintPError("SIGTSTP");

    while (TRUE) /* repeat forever */
    {
        /* print prompt */
        printf("%%");
        //printf("my status: %d", waitpid(getpid(), &status, WNOHANG));
        //printf("%%");
        /* read command line */
        getCommandLine(&cmdLine, BUFSIZE);

        if(strcmp(cmdLine, "exit") == 0 || feof(stdin))
        {
            forceExit=TRUE;
            break;
        } else {
            // If we juse printf(cmdLine), compiler gives a warning because the cmdLine can contain things like  %s
            // and the program will try to find some string that does not exist. This could be exploited to run virus.
            //fprintf(stderr, "%s", cmdLine);
        }

        /* checks the status of background jobs */
        CheckJobs();

        /* interpret command and line
         * includes executing of commands */
        Interpret(cmdLine);
    }

    // make sure all the shell's child processes are terminated
    if (forceExit == TRUE) {
        while (bgjobs != NULL) {
            kill(bgjobs->pid, SIGINT);
            bgjobs = bgjobs->next;
        }
    }

    /* shell termination */
    free(cmdLine);
    return 0;
} /* end main */
Example #10
0
static
bool
launchApp(HWND hwnd, bool testing, HANDLE* thread, DWORD* threadID)
{
	if (thread != NULL) {
		*thread = NULL;
	}
	if (threadID != NULL) {
		*threadID = 0;
	}

	// start daemon if it's installed and we're not testing
	if (!testing && CAutoStart::startDaemon()) {
		return true;
	}

	// decide if client or server
	const bool isClient = isClientChecked(hwnd);
	const char* app = isClient ? CLIENT_APP : SERVER_APP;

	// prepare command line
	CString cmdLine = getCommandLine(hwnd, testing, false);
	if (cmdLine.empty()) {
		return false;
	}

	// start child
	PROCESS_INFORMATION procInfo;
	if (!execApp(app, cmdLine, &procInfo)) {
		showError(hwnd, CStringUtil::format(
								getString(IDS_STARTUP_FAILED).c_str(),
								getErrorString(GetLastError()).c_str()));
		return false;
	}

	// don't need process handle
	CloseHandle(procInfo.hProcess);

	// save thread handle and thread ID if desired
	if (thread != NULL) {
		*thread = procInfo.hThread;
	}
	if (threadID != NULL) {
		*threadID = procInfo.dwThreadId;
	}

	return true;
}
Example #11
0
void CompileMKStepTask::run(ThreadWeaver::JobPointer, ThreadWeaver::Thread*)
{
    QFileInfo fi(mkUrl.toLocalFile());

    QString mkFile = fi.completeBaseName() + QString::number(id).rightJustified(4, QLatin1Char('0')) + QLatin1String(".tif");
    QStringList args;
    args << QLatin1String("-f");
    args << mkUrl.toLocalFile();
    args << QString::fromLatin1("ENBLEND='%1'").arg(enblendPath);
    args << QString::fromLatin1("NONA='%1'").arg(nonaPath);
    args << mkFile;

    runProcess(args);

    qCDebug(DIGIKAM_DPLUGIN_GENERIC_LOG) << "make job command line: " << getCommandLine();

    qCDebug(DIGIKAM_DPLUGIN_GENERIC_LOG) << "make job output (" << mkFile << "):" << endl << output;
}
Example #12
0
void CpFindTask::run(ThreadWeaver::JobPointer, ThreadWeaver::Thread*)
{
    // Run CPFind to get control points and order the images
    cpFindPtoUrl = tmpDir.resolved(QUrl::fromLocalFile(QStringLiteral("cp_pano.pto")));

    QStringList args;
    if (celeste)
        args << QStringLiteral("--celeste");
    args << QStringLiteral("-o");
    args << cpFindPtoUrl.toLocalFile();
    args << ptoUrl.toLocalFile();

    runProcess(args);

    qCDebug(KIPIPLUGINS_LOG) << "cpfind command line: " << getCommandLine();

    qCDebug(KIPIPLUGINS_LOG) << "cpfind output:" << endl << output;
}
Example #13
0
/**
 * This is the main entry point of a native application that is using
 * android_native_app_glue.  It runs in its own thread, with its own
 * event loop for receiving input events and doing other things.
 */
void android_main(struct android_app* app) {
    if (!app)
        return;

    NvAssetLoaderInit((void*)app->activity->assetManager);

    Engine* engine = new Engine(app);

    char* commandLine = NULL;
    
    if (getCommandLine(engine, commandLine)) {
        LOGI("Found command line %s", commandLine);
        // add command line arguments
        NvTokenizer cmdtok(commandLine);
        std::string sarg;
        while (cmdtok.getTokenString(sarg))
            engine->m_commandLine.push_back(sarg);
    }

    NvAppBase* sdkapp = NvAppFactory(engine);

    sdkapp->configurationCallback(sDefaultConfig);

    engine->mEGL = NvEGLUtil::create(localEGLChooser);
    if (!engine->mEGL) 
    {
        // if we have a basic EGL failure, we need to exit immediately; nothing else we can do
        delete sdkapp;
        sdkapp = NULL;
        nv_app_force_quit_no_cleanup(app);
    }
    NvEGLAppContext* context = new NvEGLAppContext(engine->mEGL);
    sdkapp->setGLContext(context);

    // Make sure glue isn't stripped.
    app_dummy();

    // loop waiting for stuff to do.
    sdkapp->mainLoop();

    delete sdkapp;
    delete engine;
    NvAssetLoaderShutdown();
}
Example #14
0
/*
 * main
 *
 * arguments:
 *   int argc: the number of arguments provided on the command line
 *   char *argv[]: array of strings provided on the command line
 *
 * returns: int: 0 = OK, else error
 *
 * This sets up signal handling and implements the main loop of tsh.
 */
int
main(int argc, char *argv[])
{
  /* Initialize command buffer */
  char* cmdLine = malloc(sizeof(char*) * BUFSIZE);

  /* shell initialization */
  if (signal(SIGINT, sig) == SIG_ERR)
    PrintPError("SIGINT");
  if (signal(SIGTSTP, sig) == SIG_ERR)
    PrintPError("SIGTSTP");
    /* Terminated or stopped child */
  
  while (!forceExit) /* repeat forever */
    {
      /*Insert tsh$ prompt*/
      printPrompt();
      
      /* read command line */
      getCommandLine(&cmdLine, BUFSIZE);

      if (strcmp(cmdLine, "exit") == 0)
        forceExit = TRUE;
      
      /* checks the status of background jobs */
      if(!forceExit){
	CheckJobs();
	fflush(NULL);
      }
      /* interpret command and line
       * includes executing of commands */
      Interpret(cmdLine);
      fflush(NULL);
      //getPath();


    }

  /* shell termination */
  free(cmdLine);
  return 0;
} /* main */
Example #15
0
int main (int argc, char *argv[])
{
  /* Initialize command buffer */
  char* cmdLine = malloc(sizeof(char*)*BUFSIZE);

  /* shell initialization */
  if (signal(SIGINT, sig) == SIG_ERR) PrintPError("SIGINT");
  if (signal(SIGTSTP, sig) == SIG_ERR) PrintPError("SIGTSTP");
  if (signal(SIGCONT, sig) == SIG_ERR) PrintPError("SIGCONT");
  if (signal(SIGCHLD, sigHandler) == SIG_ERR) PrintPError("SIGCHLD");

  while (!forceExit) /* repeat forever */
  {
	printPrompt();
    /* read command line */
    getCommandLine(&cmdLine, BUFSIZE);

	// strcmp: string compare
    if(strcmp(cmdLine, "exit") == 0)
    {
      forceExit=TRUE;
      continue;
    }

    /* checks the status of background jobs */
    CheckJobs();

    /* interpret command and line
     * includes executing of commands */
    Interpret(cmdLine);

  }

  /* shell termination */
  free(cmdLine);
  releaseAlias(aliasList);
  /* print all lists and check 
  printf("\n\n ---------TERMINATE SHELL--------\n");
  printf("Alias:\n");
  printAlias();*/
  return 0;
} /* end main */
Example #16
0
void
submitJob(const char* modem, char* otag)
{
    u_long tts = 0;
    time_t t = time(0);
    struct tm* now = localtime(&t);

    sprintf(qfile, "%s/q%d", FAX_SENDDIR, seqnum = getSequenceNumber());
    qfd = fopen(qfile, "w");
    if (qfd == NULL) {
	syslog(LOG_ERR, "%s: Can not create qfile: %m", qfile);
	sendError("Can not create qfile \"%s\".", qfile);
	cleanupJob();
    }
    flock(fileno(qfd), LOCK_EX);
    fprintf(qfd, "modem:%s\n", modem);
    for (;;) {
	if (!getCommandLine())
	    cleanupJob();
	if (isCmd("end") || isCmd(".")) {
	    setupData(seqnum);
	    break;
	}
	if (isCmd("sendAt")) {
	    tts = cvtTime(tag, now, "time-to-send");
	} else if (isCmd("killtime")) {
	    fprintf(qfd, "%s:%lu\n", line, cvtTime(tag, now, "kill-time"));
	} else if (isCmd("cover")) {
	    coverProtocol(atoi(tag), seqnum);
	} else
	    fprintf(qfd, "%s:%s\n", line, tag);	/* XXX check info */
    }
    fprintf(qfd, "tts:%lu\n", tts);
    fclose(qfd), qfd = NULL;
    if (!notifyServer(modem, "S%s", qfile))
	sendError("Warning, no server appears to be running.");
    sendClient("job", "%d", seqnum);
}
int main(int argc, char **argv)
{
    Graph *G = NULL; 
    parameters params;
    
    //read from command line 
    getCommandLine(argc, argv, &params);
    
    /*create graph*/ 
    // check graph cridentials
    
    if(params->G_Type == 1)
    	params->Num_Vertices = 7;
    	 
    if(params.G_Type > 0 && params.G_Type < 4)
   		G = buildGraph(G,&params); 
    else 
    	printf("Invalid graph type \t -g[1|2|3]\n");
    	
    //do operation 
    //exit program
    return 0;
}
Example #18
0
int main (int argc, char *argv[])
{
  /* Initialize command buffer */
  char* cmdLine = malloc(sizeof(char*)*BUFSIZE);

  /* shell initialization */
  if (signal(SIGINT, sig_handler) == SIG_ERR) PrintPError("SIGINT");
  if (signal(SIGTSTP, sig_handler) == SIG_ERR) PrintPError("SIGTSTP");
  if (signal(SIGCHLD, sig_handler) == SIG_ERR) PrintPError("SIGCHLD");

  while (!forceExit) /* repeat forever */
  {
    /* read command line */
    getCommandLine(&cmdLine, BUFSIZE);
   // printf("\n");
    if(strcmp(cmdLine, "exit") == 0)
    {
      forceExit=TRUE;
      continue;
    }

    /* checks the status of background jobs */
    //implement this to get rid of jobs that finished
    CheckJobs();

    /* interpret command and line
     * includes executing of commands */
    Interpret(cmdLine);
//    printf("Not getting here! \n");

  }

  /* shell termination */
  free(cmdLine);
  return 0;
} /* end main */
Example #19
0
static
LRESULT CALLBACK
mainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message) {
	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDCANCEL:
			// test for unsaved data
			if (ARG->m_config != ARG->m_oldConfig) {
				if (!askVerify(hwnd, getString(IDS_UNSAVED_DATA_REALLY_QUIT))) {
					return 0;
				}
			}

			// quit
			PostQuitMessage(0);
			return 0;

		case IDOK:
		case IDC_MAIN_TEST: {
			// note if testing
			const bool testing = (LOWORD(wParam) == IDC_MAIN_TEST);

			// save data
			if (ARG->m_config != ARG->m_oldConfig) {
				if (!saveConfig(ARG->m_config, false)) {
					showError(hwnd, CStringUtil::format(
								getString(IDS_SAVE_FAILED).c_str(),
								getErrorString(GetLastError()).c_str()));
					return 0;
				}
				ARG->m_oldConfig = ARG->m_config;
				enableSaveControls(hwnd);
			}

			// launch child app
			DWORD threadID;
			HANDLE thread = launchApp(hwnd, testing, &threadID);
			if (thread == NULL) {
				return 0;
			}

			// handle child program
			if (testing) {
				// wait for process to stop, allowing the user to kill it
				waitForChild(hwnd, thread, threadID);

				// clean up
				CloseHandle(thread);
			}
			else {
				// don't need thread handle
				CloseHandle(thread);

				// notify of success
				askOkay(hwnd, getString(IDS_STARTED_TITLE),
								getString(IDS_STARTED));

				// quit
				PostQuitMessage(0);
			}
			return 0;
		}

		case IDC_MAIN_AUTOSTART: {
			// construct command line
			CString cmdLine = getCommandLine(hwnd, false);
			if (!cmdLine.empty()) {
				// run dialog
				CAutoStart autoStart(hwnd,
							isClientChecked(hwnd) ? NULL : &ARG->m_config,
							cmdLine);
				autoStart.doModal();
				if (autoStart.wasUserConfigSaved()) {
					ARG->m_oldConfig = ARG->m_config;
					enableSaveControls(hwnd);
				}
			}
			return 0;
		}

		case IDC_MAIN_SAVE:
			if (!saveConfig(ARG->m_config, false)) {
				showError(hwnd, CStringUtil::format(
								getString(IDS_SAVE_FAILED).c_str(),
								getErrorString(GetLastError()).c_str()));
			}
			else {
				ARG->m_oldConfig = ARG->m_config;
				enableSaveControls(hwnd);
			}
			return 0;

		case IDC_MAIN_CLIENT_RADIO:
		case IDC_MAIN_SERVER_RADIO:
			enableMainWindowControls(hwnd);
			return 0;

		case IDC_MAIN_SERVER_ADD_BUTTON:
			addScreen(hwnd);
			return 0;

		case IDC_MAIN_SERVER_EDIT_BUTTON:
			editScreen(hwnd);
			return 0;

		case IDC_MAIN_SERVER_REMOVE_BUTTON:
			removeScreen(hwnd);
			return 0;

		case IDC_MAIN_SERVER_SCREENS_LIST:
			if (HIWORD(wParam) == LBN_SELCHANGE) {
				enableScreensControls(hwnd);
				updateNeighbors(hwnd);
			}
			else if (HIWORD(wParam) == LBN_DBLCLK) {
				editScreen(hwnd);
				return 0;
			}
			break;

		case IDC_MAIN_SERVER_LEFT_COMBO:
			if (HIWORD(wParam) == CBN_SELENDOK) {
				changeNeighbor(hwnd, (HWND)lParam, kLeft);
				return 0;
			}
			break;

		case IDC_MAIN_SERVER_RIGHT_COMBO:
			if (HIWORD(wParam) == CBN_SELENDOK) {
				changeNeighbor(hwnd, (HWND)lParam, kRight);
				return 0;
			}
			break;

		case IDC_MAIN_SERVER_TOP_COMBO:
			if (HIWORD(wParam) == CBN_SELENDOK) {
				changeNeighbor(hwnd, (HWND)lParam, kTop);
				return 0;
			}
			break;

		case IDC_MAIN_SERVER_BOTTOM_COMBO:
			if (HIWORD(wParam) == CBN_SELENDOK) {
				changeNeighbor(hwnd, (HWND)lParam, kBottom);
				return 0;
			}
			break;

		case IDC_MAIN_OPTIONS:
			s_globalOptions->doModal();
			enableSaveControls(hwnd);
			break;

		case IDC_MAIN_ADVANCED:
			s_advancedOptions->doModal(isClientChecked(hwnd));
			enableSaveControls(hwnd);
			break;
		}

	default:
		break;
	}
	return DefDlgProc(hwnd, message, wParam, lParam);
}
Example #20
0
BOOL CDOSProcess::executeTool(CProcessStatus& status)
{
	CString sCl = getCommandLine(status);

	/* FIND OUT WHERE THE EXECUTABLE IS */

	 CString sActualPath;
	 HINSTANCE hInstance = FindExecutable(getToolPath(), NULL, sActualPath.GetBuffer(MAX_PATH));
	 sActualPath.ReleaseBuffer();

	if((DWORD)hInstance == ERROR_FILE_NOT_FOUND)
	{
		CString s;
		s.Format("The executable %s could not be found.  Make sure it is part of the PATH statement in your AUTOEXEC.BAT file\n", getToolPath());
		throw(CProcessFailure(this, s));
	}
	else if((DWORD)hInstance == ERROR_PATH_NOT_FOUND)
	{
		CString s;
		s.Format("Windows gave a PATH NOT FOUND error while trying to  execute %s\n", getToolPath());
		throw(CProcessFailure(this, s));
	}
	else if((DWORD)hInstance == SE_ERR_ACCESSDENIED)
	{
		CString s;
		s.Format("Windows gave an ACCESS DENIED error while trying to  execute %s\n", getToolPath());
		throw(CProcessFailure(this, s));
	}
	else if((DWORD)hInstance <=32)
	{
		CString s;
		s.Format("Unknown problem trying to execute(find?) %s\n", getToolPath());
		throw(CProcessFailure(this, s));
	}


	CString sBatchPath = status.makeTempPath(getBatchName(status), ".bat");

	ofstream fout(sBatchPath);
	if(!fout.is_open())
	{
		MessageBox( NULL, "executeTool()", "Couldn't open batch file for writing", MB_ICONEXCLAMATION | MB_OK);
		return FALSE;
	}
	//TRACE("%s Command Line Length=%d\n", getToolPath(), strlen(sCl));
	fout << "REM created by CARLAStudio during a parse operation\n";
	fout << "\"" << sActualPath << "\" " << sCl << "\n";
	fout.close();

	CString s;
#ifdef Before1_04
	if(status.getVerbosity())
		s = sBatchPath;
	else
		s.Format("C:\\WINDOWS\\COMMAND.COM  /c \"%s\"", sBatchPath);
#else  // hab and drz 1.04 to make work with NT
	TCHAR lpszCommand[MAX_PATH];
	if (RunningNT())
	{
		GetSystemDirectory(lpszCommand, MAX_PATH);
		lstrcat(lpszCommand, "\\cmd.exe");
	}
	else
	{
		GetWindowsDirectory(lpszCommand, MAX_PATH);
		lstrcat(lpszCommand, "\\command.com");
	}
	s.Format("%s %s \"%s\"", lpszCommand,
						 (status.getVerbosity()& 0x01)  ? "/k" : "/c", //jdh 11/10/99
						 sBatchPath);
#endif // Before1_04

	return WinExecWait(s, TRUE); //status.getVerbosity());// false makes winoldapps

/*	 hInstance = ShellExecute(
		AfxGetMainWnd( )->m_hWnd,	// handle to parent window
		"open",	// pointer to string that specifies operation to perform
		sBatchPath,	// pointer to filename or folder name string
		NULL,	// pointer to string that specifies executable-file parameters
		// To Do: this is just a guess at the best place to put them
		//status.sRAWPath.getDirectory(),	// pointer to string that specifies default directory
		status.getTempDirectory(),
		status.getVerbosity()?SW_SHOW:SW_HIDE	// whether file is shown when opened
	   );

	return TRUE;
*/
}
Example #21
0
/*
** used by mscanf to get a line from the Scilab console
*/
char *getConsoleInputLine(void)
{
    getCommandLine();
    return strdup(__CommandLine);
}
Example #22
0
static
bool
saveMainWindow(HWND hwnd, bool quiting, CString* cmdLineOut = NULL)
{
	DWORD errorID = 0;
	CString arg;
	CString cmdLine;

	// save dialog state
	bool isClient = isClientChecked(hwnd);
	HKEY key = CArchMiscWindows::addKey(HKEY_CURRENT_USER, getSettingsPath());
	if (key != NULL) {
		HWND child;
		child = getItem(hwnd, IDC_MAIN_CLIENT_SERVER_NAME_EDIT);
		CArchMiscWindows::setValue(key, "server", getWindowText(child));
		child = getItem(hwnd, IDC_MAIN_DEBUG);
		CArchMiscWindows::setValue(key, "debug",
								SendMessage(child, CB_GETCURSEL, 0, 0));
		CArchMiscWindows::setValue(key, "isServer", isClient ? 0 : 1);
		CArchMiscWindows::closeKey(key);
	}

	// save user's configuration
	if (!saveConfig(ARG->m_config, false)) {
		errorID = IDS_SAVE_FAILED;
		arg     = getErrorString(GetLastError());
		goto failed;
	}

	// save autostart configuration
	if (CAutoStart::isDaemonInstalled()) {
		if (!saveConfig(ARG->m_config, true)) {
			errorID = IDS_AUTOSTART_SAVE_FAILED;
			arg     = getErrorString(GetLastError());
			goto failed;
		}
	}

	// get autostart command
	cmdLine = getCommandLine(hwnd, false, quiting);
	if (cmdLineOut != NULL) {
		*cmdLineOut = cmdLine;
	}
	if (cmdLine.empty()) {
		return quiting;
	}

	// save autostart command
	if (CAutoStart::isDaemonInstalled()) {
		try {
			CAutoStart::reinstallDaemon(isClient, cmdLine);
			CAutoStart::uninstallDaemons(!isClient);
		}
		catch (XArchDaemon& e) {
			errorID = IDS_INSTALL_GENERIC_ERROR;
			arg     = e.what();
			goto failed;
		}
	}

	return true;

failed:
	CString errorMessage =
		CStringUtil::format(getString(errorID).c_str(), arg.c_str());
	if (quiting) {
		errorMessage += "\n";
		errorMessage += getString(IDS_UNSAVED_DATA_REALLY_QUIT);
		if (askVerify(hwnd, errorMessage)) {
			return true;
		}
	}
	else {
		showError(hwnd, errorMessage);
	}
	return false;
}