2008-05-02 18:36:16 +00:00
|
|
|
#!/usr/bin/awk -f
|
|
|
|
BEGIN {
|
2009-09-01 18:39:07 +00:00
|
|
|
if (ENVIRON["USEOPENSSLFORXCAT"]) {
|
2014-03-21 07:14:47 +00:00
|
|
|
server = "openssl s_client -connect " ENVIRON["XCATSERVER"] " -rand /bin/nice 2> /dev/null"
|
2009-09-01 18:39:07 +00:00
|
|
|
} else {
|
|
|
|
server = "/inet/tcp/0/127.0.0.1/400"
|
|
|
|
}
|
2013-01-06 05:27:22 +00:00
|
|
|
|
2008-05-02 18:36:16 +00:00
|
|
|
quit = "no"
|
|
|
|
|
|
|
|
print "<xcatrequest>" |& server
|
|
|
|
print " <command>getpostscript</command>" |& server
|
2013-01-06 05:27:22 +00:00
|
|
|
if ( ARGV[1] ) {
|
|
|
|
args = sprintf(" <arg>%s</arg>", ARGV[1])
|
|
|
|
print args |& server
|
|
|
|
}
|
2008-05-02 18:36:16 +00:00
|
|
|
print "</xcatrequest>" |& server
|
|
|
|
|
2011-04-28 04:33:19 +00:00
|
|
|
start = 0
|
2008-05-02 18:36:16 +00:00
|
|
|
while (server |& getline) {
|
2011-04-28 04:33:19 +00:00
|
|
|
if (match($0,"<xcatresponse>")) {
|
|
|
|
start = 1
|
|
|
|
}
|
|
|
|
if (start == 1) {
|
|
|
|
print $0
|
|
|
|
}
|
|
|
|
|
2008-05-07 19:34:12 +00:00
|
|
|
if (match($0,"<serverdone>")) {
|
|
|
|
quit = "yes"
|
|
|
|
}
|
|
|
|
if (match($0,"</xcatresponse>") && match(quit,"yes")) {
|
|
|
|
close(server)
|
|
|
|
exit
|
|
|
|
}
|
2008-05-02 18:36:16 +00:00
|
|
|
}
|
|
|
|
}
|