home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d2xx
/
d282
/
rcs.lha
/
RCS
/
rcs.zoo
/
rcs
/
rsbx.lib
/
rsbx.lib.doc
< prev
next >
Wrap
Text File
|
1989-11-08
|
15KB
|
516 lines
TABLE OF CONTENTS
rsbx.lib/ChildStatus()
rsbx.lib/CreateFamily()
rsbx.lib/EmptyMorgue()
rsbx.lib/EscapeAdditions()
rsbx.lib/EscapeString()
rsbx.lib/LaunchChildl()
rsbx.lib/LaunchChildv()
rsbx.lib/OrphanChild()
rsbx.lib/OrphanChildren()
rsbx.lib/pclose()
rsbx.lib/popenl()
rsbx.lib/popenv()
rsbx.lib/WaitChild()
rsbx.lib/ChildStatus() rsbx.lib/ChildStatus()
NAME
ChildStatus -- Check completion status of child process.
SYNOPSIS
completion = ChildStatus(child, status)
struct ChildNode *ChildStatus(struct ChildNode *, long *);
FUNCTION
Checks if a child process has completed and sets status to the return
code from the child process if it has.
INPUTS
child - Child process identifier returned from LaunchChildX();
status - Pointer to a long to place the return code from the
child process in.
RESULT
completion - Child process identifier if child is a child process
of this process and has completed. If child is a child
process of this process and has not completed, then
completion is 0 and status is set to 0. If child is
not a child procewss of this process, then completion
is 0 and status will be non-zero.
NOTES
SEE ALSO
CreateFamily(), EmptyMorgue(), LaunchChildl(), LaunchChildv(),
OrphanChild(), OrphanChildren(), WaitChild().
BUGS
None known.
rsbx.lib/CreateFamily() rsbx.lib/CreateFamily()
NAME
CreateFamily --
SYNOPSIS
success = CreateFamily()
int CreateFamily( void );
FUNCTION
This function initializes the structures used to keep track of child
processes of this process.
INPUTS
RESULT
success - Zero if unable to allocate and initialize needed
structures.
NOTES
SEE ALSO
ChildStatus(), EmptyMorgue(), LaunchChildl(), LaunchChildv(),
OrphanChild(), OrphanChildren(), WaitChild().
BUGS
None Known.
rsbx.lib/EmptyMorgue() rsbx.lib/EmptyMorgue()
NAME
EmptyMorgue -- Process child termination messages.
SYNOPSIS
EmptyMorgue()
void EmptyMorgue( void );
FUNCTION
This function processes any termination messages from child processes
of this process.
INPUTS
RESULT
NOTES
SEE ALSO
ChildStatus(), CreateFamily(), LaunchChildl(), LaunchChildv(),
OrphanChild(), OrphanChildren(), WaitChild().
BUGS
None Known.
rsbx.lib/EscapeAdditions() rsbx.lib/EscapeAdditions()
NAME
EscapeAdditions -- Return number of characters to escape an argument.
SYNOPSIS
escapes = EscapeAdditions(argv)
int EscapeAdditions(char *);
FUNCTION
Determines the number of extra characters that are needed to escape
a command argument for AmigaDos command parsing.
INPUTS
argv - Argument to check.
RESULT
escapes - The number of characters that need to be added to the
argument to escape the characters special to AmigaDos.
NOTES
Characters special to AmigaDos are " [0x22], * [0x2a], ESC [0x1b],
LF [0x0a], SP [0x20].
SEE ALSO
EscapeAdditions(), EscapeString().
BUGS
Thinks spaces need an AmigaDos escape character preceeding them.
rsbx.lib/EscapeString() rsbx.lib/EscapeString()
NAME
EscapeString -- Copy argument to buffer escaping as needed.
SYNOPSIS
dest = EscapeString(buffer, argv)
char *EscapeAdditions(char *, char *);
FUNCTION
Copies a string containing a single argument to a buffer, escaping
characters special to AmigaDos.
INPUTS
buffer - Buffer for escaped argument string.
argv - Argument string to escape.
RESULT
dest - The same as buffer.
NOTES
Characters special to AmigaDos are " [0x22], * [0x2a], ESC [0x1b],
LF [0x0a], SP [0x20].
SEE ALSO
EscapeAdditions(), EscapeString().
BUGS
Thinks spaces need an AmigaDos escape character preceeding them.
rsbx.lib/LaunchChildl() rsbx.lib/LaunchChildl()
NAME
LaunchChildl -- Launch a child process with argument list.
SYNOPSIS
cpid = LaunchChildl(envp, name, arg0, ..., argn, NULL)
struct ChildNode *LaunchChildl(struct LAUNCHENV *, char *, char *, ...);
FUNCTION
This function behaves like a combination of the Unix 'fork' and 'execl'
functions. That is, a new process is created, as with 'fork', and
executes a load module, as with 'execl'.
INPUTS
envp - Pointer to a LAUNCHENV structure that has been
initialized with apropriate values prior to calling
this function. The LAUNCHENV structure only need exist
during the execution of this function.
name - Name of the file to execute.
arg0 - Same as name, by Unix convention.
... - Other command line arguments needed by the file to be
executed.
NULL - Zero.
RESULT
cpid - Pointer to a ChildNode structure, used to identify the
child process.
NOTES
struct LAUNCHENV
{
long priority; priority for child process
ULONG stack; stack size for child process.
If zero, stack size of calling
process will be used.
BPTR std_in; AmigaDos filehandle for child's
Input() stream. If zero, Input()
stream of calling process used.
BPTR std_out; AmigaDos filehandle for child's
Output() stream. If zero, Output()
stream of calling process used.
BPTR console; console window handler port for
child.
BPTR le_fh1; AmigaDos filehandle for child to
close at exit.
BPTR le_fh2; AmigaDos filehandle for child to
close at exit.
};
SEE ALSO
ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildv(),
OrphanChild(), OrphanChildren(), WaitChild().
BUGS
This function does not create a complete CLI enviroment for the child
process. Use of this function with a command that expects a BCPL
environment will crash the system.
rsbx.lib/LaunchChildv() rsbx.lib/LaunchChildv()
NAME
LaunchChildv -- Launch a child process with argument list.
SYNOPSIS
cpid = LaunchChildv(envp, name, argv)
struct ChildNode *LaunchChildv(struct LAUNCHENV *, char **);
FUNCTION
This function behaves like a combination of the Unix 'fork' and 'execv'
functions. That is, a new process is created, as with 'fork', and
executes a load module, as with 'execv'.
INPUTS
envp - Pointer to a LAUNCHENV structure that has been
initialized with apropriate values prior to calling
this function. The LAUNCHENV structure only need exist
during the execution of this function.
name - Name of the file to execute.
argv - An array of pointers to the argument strings for the
command. The last argument pointer must be followed
by a 0 pointer. The first pointer, argv[0], is the
same as name, by unix convention.
RESULT
cpid - Pointer to a ChildNode structure, used to identify the
child process.
NOTES
struct LAUNCHENV
{
long priority; priority for child process
ULONG stack; stack size for child process.
If zero, stack size of calling
process will be used.
BPTR std_in; AmigaDos filehandle for child's
Input() stream. If zero, Input()
stream of calling process used.
BPTR std_out; AmigaDos filehandle for child's
Output() stream. If zero, Output()
stream of calling process used.
BPTR console; console window handler port for
child.
BPTR le_fh1; AmigaDos filehandle for child to
close at exit.
BPTR le_fh2; AmigaDos filehandle for child to
close at exit.
};
SEE ALSO
ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
OrphanChild(), OrphanChildren(), WaitChild().
BUGS
This function does not create a complete CLI enviroment for the child
process. Use of this function with a command that expects a BCPL
environment will crash the system.
rsbx.lib/OrphanChild() rsbx.lib/OrphanChild()
NAME
OrphanChild -- Dis-associate a child process from this process.
SYNOPSIS
success = OrphanChild(child)
int OrphanChild(struct ChildNode * );
FUNCTION
This function will dis-associate a child process from this process and
free the structures used to track the child process.
INPUTS
child - Child identifier returned by LaunchChildl() or by
LaunchChildv().
RESULT
success - Zero if invalid child identifier.
NOTES
SEE ALSO
ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
LaunchChildv(), OrphanChildren(), WaitChild().
BUGS
None Known.
rsbx.lib/OrphanChildren() rsbx.lib/OrphanChildren()
NAME
OrphanChildren -- Orphan all child processes of this process.
SYNOPSIS
OrphanChildren()
void OrphanChildren( void );
FUNCTION
This function orphans all child processes of this process and frees
the memory used to keep track of the children.
INPUTS
RESULT
NOTES
SEE ALSO
ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
LaunchChildv(), OrphanChild(), WaitChild().
BUGS
None Known.
rsbx.lib/pclose() rsbx.lib/pclose()
NAME
pclose -- Closes pipe opened by popenl() or by popenv().
SYNOPSIS
status = pclose(pipe)
int pclose(FILE *);
FUNCTION
Waits for the command associated with the pipe to exit, closes the
stream, and returns the return code from the command.
INPUTS
pipe - Stream pointer returned by a call to popenl() or to
popenv().
RESULT
status - The return code from the command executed, or -1 if
pipe wasn't opened by popenl() or by popenv().
NOTES
SEE ALSO
popenl(), popenv().
BUGS
None known.
rsbx.lib/popenl() rsbx.lib/popenl()
NAME
popenl -- Initiate I/O to or from a command.
SYNOPSIS
pipe = popenl(arg0, ..., argn, NULL, mode)
FILE *popenl(char *, char *, ...);
FUNCTION
Creates a stream between the calling process and the stdin or stdout
streams of the command it executes. Mode should be "r" to read
the stdout stream of the command, or "w" to write to the stdin
stream of the command.
INPUTS
arg0 - Name of file to execute.
... - Other command line arguments needed by the file to be
executed.
NULL - Zero.
mode _ I/O mode string.
RESULT
pipe - File pointer to use to read or write to the command
with.
NOTES
A stream opened by popenl() should be closed by pclose().
SEE ALSO
popenv(), pclose().
BUGS
This function does not create a complete CLI enviroment for the child
process. Use of this function with a command that expects a BCPL
environment will crash the system. The Unix function 'popen' takes
as arguments a command string which it passes to the shell, and a
mode string.
rsbx.lib/popenv() rsbx.lib/popenv()
NAME
popenv -- Initiate I/O to or from a command.
SYNOPSIS
pipe = popenv(argv, mode)
FILE *popenv(char **, char *);
FUNCTION
Creates a stream between the calling process and the stdin or stdout
streams of the command it executes. Mode should be "r" to read
the stdout stream of the command, or "w" to write to the stdin
stream of the command.
INPUTS
argv - An array of pointer to the argument strings for the
command. The last pointer must be followed by a 0
pointer. The first pointer, argv[0], is the name of
file to execute.
mode _ I/O mode string.
RESULT
pipe - File pointer to use to read or write to the command
with.
NOTES
A stream opened by popenv() should be closed by pclose().
SEE ALSO
popenl(), pclose().
BUGS
This function does not create a complete CLI enviroment for the child
process. Use of this function with a command that expects a BCPL
environment will crash the system. The Unix function 'popen' takes
as arguments a command string which it passes to the shell, and a
mode string.
rsbx.lib/WaitChild() rsbx.lib/WaitChild()
NAME
WaitChild -- Wait for child process to terminate.
SYNOPSIS
term = WaitChild(child, status)
struct ChildNode *WaitChild(struct ChildNode *, long * );
FUNCTION
This function waits for a child process to terminate, and places the
child's return val in the long pointed to by status. If the child
identifier provided doen't belong to a child of this process, then
0 is returned. If the child identifier is zero, returns the child
identifier of a child that has terminated and sets the long status
points to to its return val. If the child identifier is zero and
no child has yet terminated, wait for any child to terminate and
return its identifier and set the long status points to to its
return val. If the child identifier is zero and there are no child
processes of this process, return zero.
INPUTS
child - Child identifier as returned by LaunchChildl() or by
LaunchChildv().
status - Pointer to a long to store the return val of the child
in.
RESULT
term - Child identifier of the child process whos return val
was stored in the long pointed to by status, or zero
if there was an error.
NOTES
SEE ALSO
ChildStatus(), CreateFamily(), EmptyMorgue(), LaunchChildl(),
LaunchChildv(), OrphanChild(), OrphanChildren().
BUGS
None Known.