summaryrefslogtreecommitdiffstats
path: root/clientcomm/rpcif_clnt.c.awk_dec
diff options
context:
space:
mode:
Diffstat (limited to 'clientcomm/rpcif_clnt.c.awk_dec')
-rw-r--r--clientcomm/rpcif_clnt.c.awk_dec62
1 files changed, 62 insertions, 0 deletions
diff --git a/clientcomm/rpcif_clnt.c.awk_dec b/clientcomm/rpcif_clnt.c.awk_dec
new file mode 100644
index 0000000..46a4bdf
--- /dev/null
+++ b/clientcomm/rpcif_clnt.c.awk_dec
@@ -0,0 +1,62 @@
+BEGIN { nodebug = 0;
+ print"#include <stdio.h>";
+ print"#ifdef AIX";
+ print"#include <strings.h>";
+ print"#endif";
+ print"#include \"raslib/error.hh\"";
+ print"#include \"raslib/rminit.hh\"";
+ }
+/^rpc[^(]*([^)]*)/ {
+ sig = substr($0, 1, index($0,"(") - 1);
+ getline;
+ par1 = substr($0, 1, length - 1);
+ getline;
+ par2 = substr($0, 1, length - 1);
+ print sig "(" par1 "," par2 ")";
+ if ( sig == "rpcshutdown" )
+ nodebug = 1;
+ next;
+ }
+
+#/rpcshutdown/ { nodebug = 1; print $0; next; }
+/^}/ { nodebug = 0; print $0; next; }
+nodebug==1 { print $0; next; }
+/static.*res;/ { print $0; print "\tenum clnt_stat stat;\n"; next; }
+/if.*clnt_call/ { x=$0;
+ sub(/if *\( *clnt_call/, "if ( (stat = clnt_call", x);
+ sub(/\) *!= *RPC_SUCCESS *\)/, ") ) != RPC_SUCCESS )", x);
+ print x;
+ next;
+ }
+/\) *!= *RPC_SUCCESS/ { x=$0;
+ sub(/\) *!= *RPC_SUCCESS *\)/, ") ) != RPC_SUCCESS )", x);
+ print x;
+ next;
+ }
+/return *\(NULL\)/ {
+ print "\t\tclnt_perrno( stat );";
+ print $0;
+ print "\t\t}";
+
+ print "\tif (*((u_short*)&res) == 42)";
+ print "\t\t{";
+ print "\t\tGetExtendedErrorInfo* result = NULL;";
+ print "\t\tint dummy;";
+ print "\t\tint counter = 0;";
+ print "\t\twhile (!(result = rpcgeterrorinfo_1(&dummy, clnt)) && (counter < RMInit::rpcMaxRetry))";
+ print "\t\t\t{";
+ print "\t\t\tcounter++;";
+ print "\t\t\t}";
+ print "\t\tr_Error* t = NULL, e;";
+ print "\t\tif (counter == RMInit::rpcMaxRetry)";
+ print "\t\t\tt = new r_Error(RPCCOMMUNICATIONFAILURE);";
+ print "\t\telse";
+ print "\t\t\tt = r_Error::getAnyError(result->errorText);";
+ print "\t\te=*t;";
+ print "\t\tdelete t;";
+ print "\t\tthrow e;";
+ next;
+ }
+
+
+ { print $0; }