'\"macro stdmacro
.if n .pH g3n.doconfig @(#)doconfig	40.17 of 1/29/90
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} doconfig 3N "Networking Services Architecture" "\&"
.if \nX=1 .ds x} doconfig 3N "Networking Services Architecture"
.if \nX=2 .ds x} doconfig 3N "" "\&"
.if \nX=3 .ds x} doconfig "" "" "\&"
.TH \*(x}
.SH NAME
\f4doconfig\f1 \- execute a configuration script
.SH SYNOPSIS
\f4# include <sac.h>\f1
\f4int doconfig(int fd, char *script, long rflag);\fP
.SH DESCRIPTION
\f4doconfig\f1 is a Service Access Facility library function
that interprets the configuration scripts
contained in the files
\f4/etc/saf/\f2pmtag\f4/_config\f1,
\f4/etc/saf/_sysconfig\f1,
and \f4/etc/saf/\f2pmtag\f1/\f2svctag\f1.
.P
\f4script\fP is the name of the configuration script;
\f2fd\f1
is a file descriptor that designates
the stream to which stream
manipulation operations are to be applied;
\f2rflag\f1 is a bitmask that indicates the mode in which
\f4script\fP is to be interpreted.
\f2rflag\f1 may take two values, \f4NORUN\fP and \f4NOASSIGN\fP,
which may be or'd.
If \f2rflag\f1 is zero, all commands in the configuration script
are eligible to be interpreted.
If \f2rflag\f1 has the \f4NOASSIGN\fP bit set,
the \f4assign\f1 command is considered illegal
and will generate an error return.
If \f2rflag\f1 has the \f4NORUN\fP bit set,
the \f4run\f1 and \f4runwait\f1 commands are considered illegal
and will generate error returns.
.P
The configuration language in which \f4script\fP is written
consists of a sequence of commands, each of which is
interpreted separately.
The following reserved
keywords are defined:  \f4assign\f1, \f4push\f1, \f4pop\f1, \f4runwait\f1,
and \f4run\f1.
The comment character is \f4#\f1; when a \f4#\f1
occurs on a line, everything
from that point to the end of the line is ignored.
Blank lines are not significant.
No line in a command script may exceed 1024 characters.
.P
.in +.5i
.ti -.5i
\f4assign\f1 \f2variable\f1=\f2value\f1
.br
Used to define environment variables.
\f2variable\f1 is the name of the environment variable
and \f2value\f1 is the value to be assigned to
it.
The value assigned must be a string constant; no form of
parameter substitution is available.
\f2value\f1 may be quoted.
The quoting rules are those used by the shell
for defining environment variables.
\f4assign\f1 will fail if space cannot be allocated for the new variable or
if any part of the specification is invalid.
.sp .5
.ti -.5i
\f4push\f1 \f2module1\f1[, \f2module2\f1, \f2module3\f1, . . .] 
.br
Used to push \s-1STREAMS\s0 modules onto the
stream designated by \f2fd\f1.
\f2module1\f1 is the name of the first module to be pushed, \f2module2\f1
is the name of the second module to be pushed, etc.
The command will fail if any of the named modules cannot be pushed.
If a module cannot be pushed, the subsequent modules on the
same command line
will be ignored and modules that have already been pushed 
will be popped.
.sp .5
.ti -.5i
\f4pop\f1 [\f2module\f1]
.br
Used to pop \s-1STREAMS\s0 modules off the designated
stream.
If \f4pop\f1 is invoked with no arguments,
the top module on the 
stream is popped.
If an argument is given, modules will be popped one
at a time until the named module is at the top of the stream.
If the named module is not on the designated stream, the stream is left
as it was and the command fails.
If \f2module\f1 is the special keyword \s-1ALL\s0, then all modules
on the stream will be popped.
Note that only modules above the topmost driver are affected.
.sp .5
.ti .5i
\f4runwait\f1 \f2command\f1
.br
The \f4runwait\f1 command runs a command and waits for it
to complete.
\f2command\f1 is the pathname of the command to be run.
The command is run with \f4/usr/bin/sh \-c\f1 prepended to it;
shell scripts may thus be executed from configuration scripts.
The \f4runwait\f1 command will fail if \f2command\f1
cannot be found or cannot be executed,
or if \f2command\f1 exits with a non-zero status.
.sp .5
.ti -.5i
\f4run\f1 \f2command\f1
.br
The \f4run\f1 command is identical to \f4runwait\f1 except that it
does not wait for \f2command\f1 to complete.
\f2command\f1 is the pathname of the command to be run.
\f4run\f1 will not fail unless it is unable to create a child
process to execute the command.
.in -.5i
.P
Although they are syntactically indistinguishable, some of the commands
available to \f4run\f1
and \f4runwait\f1
are interpreter built-in commands.
Interpreter built-ins are used
when it is necessary to alter the
state of a process within the context of that process.
The \f4doconfig\f1 interpreter built-in commands are similar to the
shell special commands and, like these, they do not
spawn another process for execution.
See \f4sh\f1(1).
The initial set of built-in commands is:
.sp .5
.in +1i
.nf
\f4cd\f1
\f4ulimit\f1
\f4umask\f1
.fi
.in -1i
.SH DIAGNOSTICS
\f4doconfig\f1 returns \f40\f1 if the script was interpreted successfully.
If a command in the script fails, the interpretation of the script ceases
at that point and a positive number is returned; this number
indicates which line in the script
failed.
If a system error occurs, a value of \f4\-1\f1 is returned.
When a script fails, the process whose environment was being established
should \f2not\f1 be started.
.SH "SEE ALSO"
\f4pmadm\fP(1M),
\f4sacadm\fP(1M),
\f4sh\fP(1).
.\"	@(#)doconfig.3n	40.2 of 11/1/88
.Ee
