<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic INETD and environment in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/inetd-and-environment/m-p/2416677#M765097</link>
    <description>When I run a C program main(argc, **arcv, **environ)from INETD (tcp), I find &lt;BR /&gt;that getenv() returns no env vars, and I cannot set env vars using putenv() or &lt;BR /&gt;env().  For example, &lt;BR /&gt;   system("putenv SYBASE=/usr/Syb11.3");&lt;BR /&gt;    fprintf(log_file, "SybPath: %s\n", getenv("SYBASE"); .&lt;BR /&gt;&lt;BR /&gt;How do I set/get env vars from a process running via tcp INETD?</description>
    <pubDate>Fri, 10 Dec 1999 10:56:10 GMT</pubDate>
    <dc:creator>Rodger Williams</dc:creator>
    <dc:date>1999-12-10T10:56:10Z</dc:date>
    <item>
      <title>INETD and environment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inetd-and-environment/m-p/2416677#M765097</link>
      <description>When I run a C program main(argc, **arcv, **environ)from INETD (tcp), I find &lt;BR /&gt;that getenv() returns no env vars, and I cannot set env vars using putenv() or &lt;BR /&gt;env().  For example, &lt;BR /&gt;   system("putenv SYBASE=/usr/Syb11.3");&lt;BR /&gt;    fprintf(log_file, "SybPath: %s\n", getenv("SYBASE"); .&lt;BR /&gt;&lt;BR /&gt;How do I set/get env vars from a process running via tcp INETD?</description>
      <pubDate>Fri, 10 Dec 1999 10:56:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inetd-and-environment/m-p/2416677#M765097</guid>
      <dc:creator>Rodger Williams</dc:creator>
      <dc:date>1999-12-10T10:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: INETD and environment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inetd-and-environment/m-p/2416678#M765098</link>
      <description>I the lack of environment variables is intentional;&lt;BR /&gt;you will have to set up your own PATH and such instead&lt;BR /&gt;of relying whatever is there.&lt;BR /&gt;&lt;BR /&gt;As to why the 'system("putenv SYBASE=/usr/Syb11.3");'&lt;BR /&gt;fails for you is that there you create a new shell&lt;BR /&gt;process (see system(3) manual page) and set the&lt;BR /&gt;environment variable in there. As environment&lt;BR /&gt;variables are not inherited from a child process to&lt;BR /&gt;the parent, the effect of "putenv" ends as soon as&lt;BR /&gt;the subsequent shell exits (and the system() call returns).&lt;BR /&gt;&lt;BR /&gt;To set an environment variable in the current process&lt;BR /&gt;(and to be inherited by child processes) you'll need&lt;BR /&gt;to call the putenv() function call directly without&lt;BR /&gt;an intervening shell:&lt;BR /&gt;  putenv("SYBASE=/usr/Syb11.3");&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;..Juha</description>
      <pubDate>Mon, 13 Dec 1999 03:54:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inetd-and-environment/m-p/2416678#M765098</guid>
      <dc:creator>Juha Laiho</dc:creator>
      <dc:date>1999-12-13T03:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: INETD and environment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inetd-and-environment/m-p/2416679#M765099</link>
      <description>You're right about inheiritance, but the problem I'm having is that within a &lt;BR /&gt;process (main()) that's called by INETD, I am unable to successfully set &lt;BR /&gt;environment variables, such as by reading my .profile or by using setenv().  If &lt;BR /&gt;INETD calls a shell and then I spawn a child process, I can no longer pass data &lt;BR /&gt;to/from the client, so INETD must call main() directly.&lt;BR /&gt;&lt;BR /&gt;Thanks, Rodger</description>
      <pubDate>Mon, 13 Dec 1999 07:48:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inetd-and-environment/m-p/2416679#M765099</guid>
      <dc:creator>Rodger Williams</dc:creator>
      <dc:date>1999-12-13T07:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: INETD and environment</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inetd-and-environment/m-p/2416680#M765100</link>
      <description>My apologies to Mr. Laiho for not reading his email carefully enough before I &lt;BR /&gt;responded.  Calling setenv() directly from main() does work.  Thanks for the &lt;BR /&gt;help!&lt;BR /&gt;&lt;BR /&gt;Rodger</description>
      <pubDate>Mon, 13 Dec 1999 08:51:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inetd-and-environment/m-p/2416680#M765100</guid>
      <dc:creator>Rodger Williams</dc:creator>
      <dc:date>1999-12-13T08:51:00Z</dc:date>
    </item>
  </channel>
</rss>

