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:
Bill Cadier <[log in to unmask]>
Reply To:
Bill Cadier <[log in to unmask]>
Date:
Wed, 2 Jul 2003 15:28:47 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (59 lines)
John writes:

> 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.
>
< snip >

Couldn't you use Perl? A script like this seems as if it would do what you want:

#!/usr/local/bin/perl

print "Content-type: text/plain", "\n\n";
print "<html>", "\n\n";

$cicmd = "[your program to run]";

$out = "/tmp/out.$$";
system("callci '$cicmd' > $out");

# Display
open(f_out, "$out");
print "<pre>", "\n";
while (<f_out>)
{
      print "$_"  if !(/END OF PROGRAM/);
}
print "</pre>", "\n";
close f_out;
unlink($out);

print "</html>", "\n\n";
exit(0)

hth,

Bill
hp/vCSY

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

ATOM RSS1 RSS2