reindent-20030715
[openafs.git] / src / rxgen / rpc_clntout.c
index d60928a..8a3b2aa 100644 (file)
@@ -35,7 +35,8 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header$");
+RCSID
+    ("$Header$");
 
 #include <stdio.h>
 #include <string.h>
@@ -46,79 +47,82 @@ RCSID("$Header$");
 #define DEFAULT_TIMEOUT 25     /* in seconds */
 
 /* static prototypes */
-static void write_program(definition *def);
+static void write_program(definition * def);
 static char *ampr(char *type);
-static void printbody(proc_list *proc);
+static void printbody(proc_list * proc);
 
-void write_stubs(void)
+void
+write_stubs(void)
 {
-       list *l;
-       definition *def;
+    list *l;
+    definition *def;
 
-       f_print(fout, "\nstatic struct timeval TIMEOUT = { %d, 0 };\n",
-               DEFAULT_TIMEOUT);
-       for (l = defined; l != NULL; l = l->next) {
-               def = (definition *) l->val;
-               if (def->def_kind == DEF_PROGRAM) {
-                       write_program(def);
-               }
+    f_print(fout, "\nstatic struct timeval TIMEOUT = { %d, 0 };\n",
+           DEFAULT_TIMEOUT);
+    for (l = defined; l != NULL; l = l->next) {
+       def = (definition *) l->val;
+       if (def->def_kind == DEF_PROGRAM) {
+           write_program(def);
        }
+    }
 }
 
 
-static void write_program(definition *def)
+static void
+write_program(definition * def)
 {
-       version_list *vp;
-       proc_list *proc;
+    version_list *vp;
+    proc_list *proc;
 
-       for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
-               for (proc = vp->procs; proc != NULL; proc = proc->next) {
-                       f_print(fout, "\n");
-                       ptype(proc->res_prefix, proc->res_type, 1);
-                       f_print(fout, "*\n");
-                       pvname(proc->proc_name, vp->vers_num);
-                       f_print(fout, "(argp, clnt)\n");
-                       f_print(fout, "\t");
-                       ptype(proc->arg_prefix, proc->arg_type, 1);
-                       f_print(fout, "*argp;\n");
-                       f_print(fout, "\tCLIENT *clnt;\n");
-                       f_print(fout, "{\n");
-                       printbody(proc);
-                       f_print(fout, "}\n\n");
-               }
+    for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
+       for (proc = vp->procs; proc != NULL; proc = proc->next) {
+           f_print(fout, "\n");
+           ptype(proc->res_prefix, proc->res_type, 1);
+           f_print(fout, "*\n");
+           pvname(proc->proc_name, vp->vers_num);
+           f_print(fout, "(argp, clnt)\n");
+           f_print(fout, "\t");
+           ptype(proc->arg_prefix, proc->arg_type, 1);
+           f_print(fout, "*argp;\n");
+           f_print(fout, "\tCLIENT *clnt;\n");
+           f_print(fout, "{\n");
+           printbody(proc);
+           f_print(fout, "}\n\n");
        }
+    }
 }
 
-static char *ampr(char *type)
+static char *
+ampr(char *type)
 {
-       if (isvectordef(type, REL_ALIAS)) {
-               return ("");
-       } else {
-               return ("&");
-       }
+    if (isvectordef(type, REL_ALIAS)) {
+       return ("");
+    } else {
+       return ("&");
+    }
 }
 
-static void printbody(proc_list *proc)
+static void
+printbody(proc_list * proc)
 {
-       f_print(fout, "\tstatic ");
-       if (streq(proc->res_type, "void")) {
-               f_print(fout, "char ");
-       } else {
-               ptype(proc->res_prefix, proc->res_type, 0);
-       }
-       f_print(fout, "res;\n");
-       f_print(fout, "\n");
-       f_print(fout, "\tmemset(%sres, 0, sizeof(res));\n", ampr(proc->res_type));
-       f_print(fout,
-               "\tif (clnt_call(clnt, %s, xdr_%s, argp, xdr_%s, %sres, TIMEOUT) != RPC_SUCCESS) {\n",
-               proc->proc_name, stringfix(proc->arg_type),
-               stringfix(proc->res_type), ampr(proc->res_type));
-       f_print(fout, "\t\treturn (NULL);\n");
-       f_print(fout, "\t}\n");
-       if (streq(proc->res_type, "void")) {
-               f_print(fout, "\treturn ((void *)%sres);\n",
-                       ampr(proc->res_type));
-       } else {
-               f_print(fout, "\treturn (%sres);\n", ampr(proc->res_type));
-       }
+    f_print(fout, "\tstatic ");
+    if (streq(proc->res_type, "void")) {
+       f_print(fout, "char ");
+    } else {
+       ptype(proc->res_prefix, proc->res_type, 0);
+    }
+    f_print(fout, "res;\n");
+    f_print(fout, "\n");
+    f_print(fout, "\tmemset(%sres, 0, sizeof(res));\n", ampr(proc->res_type));
+    f_print(fout,
+           "\tif (clnt_call(clnt, %s, xdr_%s, argp, xdr_%s, %sres, TIMEOUT) != RPC_SUCCESS) {\n",
+           proc->proc_name, stringfix(proc->arg_type),
+           stringfix(proc->res_type), ampr(proc->res_type));
+    f_print(fout, "\t\treturn (NULL);\n");
+    f_print(fout, "\t}\n");
+    if (streq(proc->res_type, "void")) {
+       f_print(fout, "\treturn ((void *)%sres);\n", ampr(proc->res_type));
+    } else {
+       f_print(fout, "\treturn (%sres);\n", ampr(proc->res_type));
+    }
 }