HP3000-L Archives

July 2003, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
John Korb <[log in to unmask]>
Reply To:
John Korb <[log in to unmask]>
Date:
Wed, 2 Jul 2003 17:13:46 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (92 lines)
I'm trying to pass information (a variable) back from the MPE CI (or a
program running under it) to the POSIX shell that initiated the CI, and I'm
stumped.

What I'm trying to do:
-- the Apache web server is told to execute a shell script in the cgi-bin
    directory.
-- There can be multiple people executing this shell script
    simultaneously.
-- The shell script displays the "Content-type:" header and top part of the
    web page, then a "callci" invokes an MPE progam which processes the form
    and writes the results of its processing out to a file with the file name
    based upon the PIN of the MPE program (so that each invocation has its
    own file).
-- The MPE program terminates and control reverts back to the shell script.
-- The shell script needs to know the PIN of the FILE NAME (or PIN, if
    that is easier) of the MPE program, so that the shell script can then
    "cat" the file produced by the MPE program so that the page will be
    displayed.
-- The shell script writes a few remaining HTML tags and ends.

Note the use of "cat" rather than writing directly to the MPE program's
$STDLIST.  There apparently is some oddity in the way Apache interacts with
MPE programs where if I generate more than about 2k bytes of output to the
MPE program's $STDLIST, everything following the start of the record before
the 2k boundary is reached is NOT sent to the user's web browser.

In my test I was able to get around this by having the MPE program write to
a file, then, after the MPE program terminates, have the shell script "cat"
the file to the shell's stdlist.

Unfortunately, the file name needs to be dynamic, so the MPE program must
have some way to telling the shell the PIN or file name of the output file
so that the shell can know the name of the file it needs to "cat".

I tried having the MPE program issue a SETVAR command, but apparently the
MPE variables don't ride the environment back from MPE Land to POSIX Land.

So I tried invoking the shell and having it issue an "export" command.  No
luck there either.

Below is an example of the second approach described above, as attempted
through an interactive session.

:
:print exptest.temp.apache
echo About to execute the command:
echo xeq sh.hpbin.sys "-c 'export childpin=4321'"
xeq sh.hpbin.sys "-c 'export childpin=4321'"
echo export command execution complete
:
:
:
:sh
########################################################################

                MPE/iX Shell and Utilities (A.50.02)
     COPYRIGHT (c) Hewlett-Packard Company 1992, All Rights Reserved.

########################################################################


shell/iX> callci exptest.temp.apache
About to execute the
command:

xeq sh.hpbin.sys "-c 'export childpin=4321'"
export command execution complete
shell/iX>
shell/iX> echo $childpin

shell/iX> exit
:
:showvar childpin
          ^
Variable not found in variable table. (CIERR 8106)
:

As can been seen above, the "export" does not affect the underlying (outer)
shell process, as the "echo $childpin" prints only a blank line.

Does anyone have an idea as to how to, from the MPE program, pass either
its PIN number or the name of the output file it wrote to, back to the
outer shell process?

Thanks!

John

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2