<?xml version="1.0" encoding="UTF-8"?>
<!-- **************************************************************************
.... For copyright and licensing terms, see the file named COPYING.
.... **************************************************************************
.-->
<?xml-stylesheet href="docbook-xml.css" type="text/css"?>

<refentry id="machineenv">

<refmeta xmlns:xi="http://www.w3.org/2001/XInclude">
<refentrytitle>machineenv</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">user commands</refmiscinfo>
<refmiscinfo class="source">nosh</refmiscinfo>
<xi:include href="version.xml" />
</refmeta>

<refnamediv>
<refname>machineenv</refname>
<refpurpose>set the "machine" environment variables from the dynamic values</refpurpose>
</refnamediv>

<refsynopsisdiv>
<cmdsynopsis>
<command>machineenv</command>
<arg choice='req'><replaceable>next-prog</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>

<refsection><title>Description</title>

<para>
<command>machineenv</command> is a chain-loading utility that sets environment variables and then chain loads to <replaceable>next-prog</replaceable> with the <citerefentry><refentrytitle>execvp</refentrytitle><manvolnum>3</manvolnum></citerefentry> function.
</para>

<para>
<replaceable>next-prog</replaceable> may contain its own command line options, which <command>machineenv</command> will ignore.
</para>

<para>
The following environment variables are set:
<variablelist>

<varlistentry>
<term><envar>MACHINEID</envar></term>
<listitem><para>
Set to the human-readable hexadecimal non-punctuated form of the machine ID, for details on which (and some caveats as to mis-use) see <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
</para></listitem>
</varlistentry><varlistentry>
<term><envar>HOSTNAME</envar></term>
<listitem><para>
Set to the dynamic "host" name, as initialized by <citerefentry><refentrytitle>set-dynamic-hostname</refentrytitle><manvolnum>1</manvolnum></citerefentry> (for example) and obtained by the <citerefentry><refentrytitle>gethostname</refentrytitle><manvolnum>2</manvolnum></citerefentry> function.
</para></listitem>
</varlistentry><varlistentry>
<term><envar>DOMAINNAME</envar></term>
<listitem><para>
Set to the dynamic "NIS domain" name, as obtained by the <citerefentry><refentrytitle>getdomainname</refentrytitle><manvolnum>2</manvolnum></citerefentry> function.
</para>
<note>
This is not the "DNS domain" name, conventionally found in a <envar>LOCALDOMAIN</envar> environment variable.
</note>
</listitem>
</varlistentry>

</variablelist>
</para>

</refsection><refsection><title>Bugs</title>

<para>
As of version 1.34 this program no longer employs the GNU C library nor the BSD C library for environment variable handling.
The previously documented workaround for those libraries' having memory leaks in their <citerefentry><refentrytitle>setenv</refentrytitle><manvolnum>3</manvolnum></citerefentry> and <citerefentry><refentrytitle>clearenv</refentrytitle><manvolnum>3</manvolnum></citerefentry> functions, is therefore no longer necessary.
</para>

</refsection><refsection><title>See also</title>

<itemizedlist>
<listitem><para>
<citerefentry><refentrytitle>userenv-fromenv</refentrytitle><manvolnum>1</manvolnum></citerefentry>
</para></listitem>
<listitem><para>
<citerefentry><refentrytitle>setenv</refentrytitle><manvolnum>1</manvolnum></citerefentry>
</para></listitem>
<listitem><para>
<citerefentry><refentrytitle>envuidgid</refentrytitle><manvolnum>1</manvolnum></citerefentry>
</para></listitem>
<listitem><para>
<citerefentry><refentrytitle>clearenv</refentrytitle><manvolnum>1</manvolnum></citerefentry>
</para></listitem>
</itemizedlist>

</refsection><refsection><title>Author</title>
<para><author><personname><firstname>Jonathan</firstname> <surname>de Boyne Pollard</surname></personname></author></para>
</refsection>

</refentry>
