/*********************************************************************************** ** ** ** KDEOpFileChooser::OpenDialog ***********************************************************************************/ OP_STATUS KDEOpFileChooser::OpenDialog(const DesktopFileChooserRequest& request) { // Make argv array ArgumentCreator arg_creator; RETURN_IF_ERROR(PrepareArguments(request, arg_creator)); // Execute the application if (execvp("kdialog", arg_creator.GetArgumentArray()) != 0) { // Can't start application return OpStatus::ERR; } // We should never get here return OpStatus::OK; }
int main(void) { const OpenFileId INPUT = CONSOLE_INPUT; const OpenFileId OUTPUT = CONSOLE_OUTPUT; char line[MAX_LINE_SIZE]; char *argv[MAX_ARG_COUNT]; for (;;) { WritePrompt(OUTPUT); const unsigned lineSize = ReadLine(line, MAX_LINE_SIZE, INPUT); if (lineSize == 0) continue; if (PrepareArguments(line, argv, MAX_ARG_COUNT) == 0) { WriteError("too many arguments.", OUTPUT); continue; } // Comment and uncomment according to whether command line arguments // are given in the system call or not. const SpaceId newProc = Exec(line); //const SpaceId newProc = Exec(line, argv); // TO DO: check for errors when calling `Exec`; this depends on how // errors are reported. Join(newProc); // TO DO: is it necessary to check for errors after `Join` too, or // can you be sure that, with the implementation of the system // call handler you made, it will never give an error?; what // happens if tomorrow the implementation changes and new // error conditions appear? } return 0; // Never reached. }