home *** CD-ROM | disk | FTP | other *** search
- // -------------------------------------------------------------------------------------
- // ExecRunCommand.h
- // (Indent:4, Tabs:4)
- // -------------------------------------------------------------------------------------
- // Copyright 1996 Persistent Technologies, Inc. - all rights reserved
- // -------------------------------------------------------------------------------------
- // This source code comes with no warranty of any kind, and the user assumes all
- // responsibility for its use.
- // -------------------------------------------------------------------------------------
- #import <objc/Object.h>
-
- // -------------------------------------------------------------------------------------
- // errors passed by 'commandDidComplete:withError:' via 'runCommand:...'
- // Note: these codes may be shared by the running command which executes an exit(#)
- #define RUNCMD_STOPPED 0x100 // command stopped/aborted
- #define RUNCMD_SUCCESS 0x000 // executed/completed successfully
- #define RUNCMD_USER 0x0FF // (255) cannot switch to user
- #define RUNCMD_EXEC 0x07F // (127) cannot execute execl shell
-
- /* ExecRunCommand delegate */
- @protocol ExecRunCommand_Delegate
- - (void)commandOutput:(id)execId buffer:(const char*)buffer len:(int)len;
- - (void)commandDidComplete:(id)execId withError:(int)errorCode;
- @end
-
- // -------------------------------------------------------------------------------------
- // Command execution controller
- @interface ExecRunCommand : Object
- {
- int cmdChild; // command execution
- int inputDescriptor; // input pipe
- id delegate; // delegate
- int tag; // tag
- }
- + runCommand:(const char*)command user:(const char*)user output:(id)theDelegate;
- + runCommand:(const char*)command output:(id)theDelegate;
- + (int)system:(const char*)command user:(const char*)user output:(id)theDelegate;
- + (int)system:(const char*)command user:(const char*)user;
- + (int)system:(const char*)command;
- - setTag:(int)tag;
- - (int)tag;
- - (BOOL)isActive;
- - setDelegate:(id)theDelegate;
- - (id)delegate;
- - interruptCommand;
- - terminateCommand;
- - killCommand;
- // -------------------------------------------------------------------------------------
- + (BOOL)isRunningAsRoot;
- // returns true if effective user is 'root'
- //
- // -------------------------------------------------------------------------------------
- - (void)commandOutput:(const char*)buffer len:(int)len;
- - (void)commandDidCompleteWithError:(int)errorCode;
- // Provides support for ExecServer.
- //
- // -------------------------------------------------------------------------------------
- @end
-