Index: src/OFProcess.h ================================================================== --- src/OFProcess.h +++ src/OFProcess.h @@ -27,10 +27,32 @@ int readPipe[2], writePipe[2]; int status; BOOL atEndOfStream; } +/** + * \brief Creates a new OFProcess with the specified program and invokes the + * program. + * + * \param program The program to execute. If it does not start with a slash, the + * search path specified in PATH is used. + * \return A new, autoreleased OFProcess. + */ ++ processWithProgram: (OFString*)program; + +/** + * \brief Creates a new OFProcess with the specified program and arguments and + * invokes the program. + * + * \param program The program to execute. If it does not start with a slash, the + * search path specified in PATH is used. + * \param arguments The arguments to pass to the program, or nil + * \return A new, autoreleased OFProcess. + */ ++ processWithProgram: (OFString*)program + arguments: (OFArray*)arguments; + /** * \brief Creates a new OFProcess with the specified program, program name and * arguments and invokes the program. * * \param program The program to execute. If it does not start with a slash, the @@ -43,12 +65,34 @@ + processWithProgram: (OFString*)program programName: (OFString*)programName arguments: (OFArray*)arguments; /** - * \brief Initializes an already allocated OFProcess with the specified - * program, program name and arguments and invokes the program. + * \brief Initializes an already allocated OFProcess with the specified program + * and invokes the program. + * + * \param program The program to execute. If it does not start with a slash, the + * search path specified in PATH is used. + * \return An initialized OFProcess. + */ +- initWithProgram: (OFString*)program; + +/** + * \brief Initializes an already allocated OFProcess with the specified program + * and arguments and invokes the program. + * + * \param program The program to execute. If it does not start with a slash, the + * search path specified in PATH is used. + * \param arguments The arguments to pass to the program, or nil + * \return An initialized OFProcess. + */ +- initWithProgram: (OFString*)program + arguments: (OFArray*)arguments; + +/** + * \brief Initializes an already allocated OFProcess with the specified program, + * program name and arguments and invokes the program. * * \param program The program to execute. If it does not start with a slash, the * search path specified in PATH is used. * \param programName The program name for the program to invoke (argv[0]). * Usually, this is equal to program. Index: src/OFProcess.m ================================================================== --- src/OFProcess.m +++ src/OFProcess.m @@ -28,18 +28,45 @@ #import "OFInitializationFailedException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" @implementation OFProcess ++ processWithProgram: (OFString*)program +{ + return [[[self alloc] initWithProgram: program] autorelease]; +} + ++ processWithProgram: (OFString*)program + arguments: (OFArray*)arguments +{ + return [[[self alloc] initWithProgram: program + arguments: arguments] autorelease]; +} + + processWithProgram: (OFString*)program programName: (OFString*)programName arguments: (OFArray*)arguments { return [[[self alloc] initWithProgram: program programName: programName arguments: arguments] autorelease]; } + +- initWithProgram: (OFString*)program +{ + return [self initWithProgram: program + programName: program + arguments: nil]; +} + +- initWithProgram: (OFString*)program + arguments: (OFArray*)arguments +{ + return [self initWithProgram: program + programName: program + arguments: arguments]; +} - initWithProgram: (OFString*)program programName: (OFString*)programName arguments: (OFArray*)arguments {