diff options
-rw-r--r-- | usr.bin/rpcgen/rpc_cout.c | 85 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_main.c | 12 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_parse.c | 4 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_sample.c | 4 | ||||
-rw-r--r-- | usr.bin/rpcgen/rpc_svcout.c | 25 |
5 files changed, 65 insertions, 65 deletions
diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c index 6411c09fb8e..1b2731949ae 100644 --- a/usr.bin/rpcgen/rpc_cout.c +++ b/usr.bin/rpcgen/rpc_cout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_cout.c,v 1.6 2001/07/18 22:26:00 deraadt Exp $ */ +/* $OpenBSD: rpc_cout.c,v 1.7 2001/11/07 18:44:28 deraadt Exp $ */ /* $NetBSD: rpc_cout.c,v 1.6 1996/10/01 04:13:53 cgd Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -85,7 +85,7 @@ emit(def) if (strcmp(def->def.ty.old_type, def->def_name) == 0) return; - }; + } print_header(def); switch (def->def_kind) { @@ -143,14 +143,14 @@ print_generic_header(procname, pointerp) f_print(fout, "%s ", procname); if (pointerp) f_print(fout, "*"); - f_print(fout, "objp)\n{\n\n"); + f_print(fout, "objp)\n{\n"); } else { f_print(fout, "xdr_%s(xdrs, objp)\n", procname); f_print(fout, "\tXDR *xdrs;\n"); f_print(fout, "\t%s ", procname); if (pointerp) f_print(fout, "*"); - f_print(fout, "objp;\n{\n\n"); + f_print(fout, "objp;\n{\n"); } } @@ -174,7 +174,7 @@ print_header(def) if (doinline == 0) return; /* May cause lint to complain. but ... */ - f_print(fout, "\t register int32_t *buf;\n\n"); + f_print(fout, "\tint32_t *buf;\n\n"); } @@ -199,7 +199,7 @@ print_ifopen(indent, name) char *name; { tabify(fout, indent); - f_print(fout, " if (!xdr_%s(xdrs", name); + f_print(fout, "if (!xdr_%s(xdrs", name); } static @@ -231,9 +231,9 @@ print_ifclose(indent) { f_print(fout, ")) {\n"); tabify(fout, indent); - f_print(fout, "\t return (FALSE);\n"); + f_print(fout, "\treturn (FALSE);\n"); tabify(fout, indent); - f_print(fout, " }\n"); + f_print(fout, "}\n"); } static @@ -427,7 +427,7 @@ emit_struct(def) } for (dl = def->def.st.decls; dl != NULL; dl = dl->next) if (dl->decl.rel == REL_VECTOR) { - f_print(fout, "\t int i;\n"); + f_print(fout, "\tint i;\n"); break; } size = 0; @@ -442,7 +442,7 @@ emit_struct(def) else { can_inline = 1; break; /* can be inlined */ - }; + } } else { if (size >= doinline) { can_inline = 1; @@ -457,7 +457,7 @@ emit_struct(def) for (dl = def->def.st.decls; dl != NULL; dl = dl->next) print_stat(1, &dl->decl); return; - }; + } @@ -466,9 +466,9 @@ emit_struct(def) for (j = 0; j < 2; j++) { if (flag == PUT) - f_print(fout, "\n\t if (xdrs->x_op == XDR_ENCODE) {\n"); + f_print(fout, "\n\tif (xdrs->x_op == XDR_ENCODE) {\n"); else - f_print(fout, "\n \t return (TRUE);\n\t} else if (xdrs->x_op == XDR_DECODE) {\n"); + f_print(fout, "\t\treturn (TRUE);\n\t} else if (xdrs->x_op == XDR_DECODE) {\n"); i = 0; @@ -504,9 +504,9 @@ emit_struct(def) sizestr = (char *)realloc(sizestr, strlen(sizestr) + strlen(ptemp) + 1); if (sizestr == NULL) { - f_print(stderr, "Fatal error : no memory \n"); + f_print(stderr, "Fatal error : no memory\n"); crash(); - }; + } sizestr = strcat(sizestr, ptemp); /* build up length of * array */ @@ -519,7 +519,7 @@ emit_struct(def) /* don't expand into inline * code if size < doinline */ while (cur != dl) { - print_stat(1, &cur->decl); + print_stat(2, &cur->decl); cur = cur->next; } } else { @@ -529,27 +529,27 @@ emit_struct(def) /* were already looking at a * xdr_inlineable structure */ if (sizestr == NULL) - f_print(fout, "\t buf = (int32_t *)XDR_INLINE(xdrs,%d * BYTES_PER_XDR_UNIT);", + f_print(fout, "\t\tbuf = (int32_t *)XDR_INLINE(xdrs, %d * BYTES_PER_XDR_UNIT);", size); else if (size == 0) f_print(fout, - "\t buf = (int32_t *)XDR_INLINE(xdrs,%s * BYTES_PER_XDR_UNIT);", + "\t\tbuf = (int32_t *)XDR_INLINE(xdrs, %s * BYTES_PER_XDR_UNIT);", sizestr); else f_print(fout, - "\t buf = (int32_t *)XDR_INLINE(xdrs,(%d + %s)* BYTES_PER_XDR_UNIT);", + "\t\tbuf = (int32_t *)XDR_INLINE(xdrs, (%d + %s)* BYTES_PER_XDR_UNIT);", size, sizestr); - f_print(fout, "\n\t if (buf == NULL) {\n"); + f_print(fout, "\n\t\tif (buf == NULL) {\n"); psav = cur; while (cur != dl) { - print_stat(2, &cur->decl); + print_stat(3, &cur->decl); cur = cur->next; } - f_print(fout, "\n\t }\n\t else {\n"); + f_print(fout, "\t\t} else {\n"); cur = psav; while (cur != dl) { @@ -557,12 +557,12 @@ emit_struct(def) cur = cur->next; } - f_print(fout, "\t }\n"); + f_print(fout, "\t\t}\n"); } size = 0; i = 0; sizestr = NULL; - print_stat(1, &dl->decl); + print_stat(2, &dl->decl); } } @@ -571,7 +571,7 @@ emit_struct(def) /* don't expand into inline code if size < * doinline */ while (cur != dl) { - print_stat(1, &cur->decl); + print_stat(2, &cur->decl); cur = cur->next; } } else { @@ -579,26 +579,26 @@ emit_struct(def) /* were already looking at a xdr_inlineable * structure */ if (sizestr == NULL) - f_print(fout, "\t\tbuf = (int32_t *)XDR_INLINE(xdrs,%d * BYTES_PER_XDR_UNIT);", + f_print(fout, "\t\tbuf = (int32_t *)XDR_INLINE(xdrs, %d * BYTES_PER_XDR_UNIT);", size); else if (size == 0) f_print(fout, - "\t\tbuf = (int32_t *)XDR_INLINE(xdrs,%s * BYTES_PER_XDR_UNIT);", + "\t\tbuf = (int32_t *)XDR_INLINE(xdrs, %s * BYTES_PER_XDR_UNIT);", sizestr); else f_print(fout, - "\t\tbuf = (int32_t *)XDR_INLINE(xdrs,(%d + %s)* BYTES_PER_XDR_UNIT);", + "\t\tbuf = (int32_t *)XDR_INLINE(xdrs, (%d + %s)* BYTES_PER_XDR_UNIT);", size, sizestr); f_print(fout, "\n\t\tif (buf == NULL) {\n"); psav = cur; while (cur != NULL) { - print_stat(2, &cur->decl); + print_stat(3, &cur->decl); cur = cur->next; } - f_print(fout, "\n\t }\n\t else {\n"); + f_print(fout, "\t\t} else {\n"); cur = psav; while (cur != dl) { @@ -606,12 +606,12 @@ emit_struct(def) cur = cur->next; } - f_print(fout, "\t }\n"); + f_print(fout, "\t\t}\n"); } flag = GET; } - f_print(fout, "\t return(TRUE);\n\t}\n\n"); + f_print(fout, "\t\treturn (TRUE);\n\t}\n\n"); /* now take care of XDR_FREE case */ @@ -664,14 +664,15 @@ emit_inline(decl, flag) switch (decl->rel) { case REL_ALIAS: + f_print(fout, "\t"); emit_single_in_line(decl, flag, REL_ALIAS); break; case REL_VECTOR: - f_print(fout, "\t\t{ register %s *genp; \n", decl->type); - f_print(fout, "\t\t for ( i = 0,genp=objp->%s;\n \t\t\ti < %s; i++){\n\t\t", + f_print(fout, "\t\t\t{\n\t\t\t\t%s *genp;\n\n", decl->type); + f_print(fout, "\t\t\t\tfor (i = 0, genp = objp->%s;\n\t\t\t\t i < %s; i++) {\n\t\t\t", decl->name, decl->array_max); emit_single_in_line(decl, flag, REL_VECTOR); - f_print(fout, "\t\t }\n\t\t };\n"); + f_print(fout, "\t\t\t\t}\n\t\t\t}\n"); } } @@ -687,12 +688,12 @@ emit_single_in_line(decl, flag, rel) if (flag == PUT) - f_print(fout, "\t\t IXDR_PUT_"); + f_print(fout, "\t\tIXDR_PUT_"); else if (rel == REL_ALIAS) - f_print(fout, "\t\t objp->%s = IXDR_GET_", decl->name); + f_print(fout, "\t\tobjp->%s = IXDR_GET_", decl->name); else - f_print(fout, "\t\t *genp++ = IXDR_GET_"); + f_print(fout, "\t\t*genp++ = IXDR_GET_"); upp_case = upcase(decl->type); @@ -709,9 +710,9 @@ emit_single_in_line(decl, flag, rel) } if (flag == PUT) if (rel == REL_ALIAS) - f_print(fout, "%s(buf,objp->%s);\n", upp_case, decl->name); + f_print(fout, "%s(buf, objp->%s);\n", upp_case, decl->name); else - f_print(fout, "%s(buf,*genp++);\n", upp_case); + f_print(fout, "%s(buf, *genp++);\n", upp_case); else f_print(fout, "%s(buf);\n", upp_case); @@ -730,9 +731,9 @@ upcase(str) ptr = (char *) malloc(strlen(str)+1); if (ptr == (char *) NULL) { - f_print(stderr, "malloc failed \n"); + f_print(stderr, "malloc failed\n"); exit(1); - }; + } hptr = ptr; while (*str != '\0') diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index 327051bf9c7..c9b49e57e01 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_main.c,v 1.7 2001/07/18 22:26:00 deraadt Exp $ */ +/* $OpenBSD: rpc_main.c,v 1.8 2001/11/07 18:44:28 deraadt Exp $ */ /* $NetBSD: rpc_main.c,v 1.9 1996/02/19 11:12:43 pk Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -32,7 +32,7 @@ #ifndef lint static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI"; -static char cvsid[] = "$OpenBSD: rpc_main.c,v 1.7 2001/07/18 22:26:00 deraadt Exp $"; +static char cvsid[] = "$OpenBSD: rpc_main.c,v 1.8 2001/11/07 18:44:28 deraadt Exp $"; #endif /* @@ -633,12 +633,8 @@ s_output(argc, argv, infile, define, extend, outfile, nomain, netflag) if (/*timerflag &&*/ tirpcflag) f_print(fout, "#include <sys/resource.h> /* rlimit */\n"); if (logflag || inetdflag || pmflag) { - f_print(fout, "#ifdef SYSLOG\n"); f_print(fout, "#include <syslog.h>\n"); - f_print(fout, "#else\n"); - f_print(fout, "#define LOG_ERR 1\n"); - f_print(fout, "#define openlog(a, b, c)\n"); - f_print(fout, "#endif\n"); + f_print(fout, "#include <errno.h>\n"); } /* for ANSI-C */ @@ -890,7 +886,7 @@ char *outfile; { perror(infile); crash(); - }; + } #if 0 if (outfile) { if (stat(outfile, &buf) < 0) diff --git a/usr.bin/rpcgen/rpc_parse.c b/usr.bin/rpcgen/rpc_parse.c index 3e16e172267..661e9d4e223 100644 --- a/usr.bin/rpcgen/rpc_parse.c +++ b/usr.bin/rpcgen/rpc_parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_parse.c,v 1.4 2001/07/18 22:26:00 deraadt Exp $ */ +/* $OpenBSD: rpc_parse.c,v 1.5 2001/11/07 18:44:28 deraadt Exp $ */ /* $NetBSD: rpc_parse.c,v 1.5 1995/08/29 23:05:55 cgd Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -335,7 +335,7 @@ def_union(defp) *tailp = cases; tailp = &cases->next; cases = ALLOC(case_list); - }; + } get_declaration(&dec, DEF_UNION); cases->case_decl = dec; diff --git a/usr.bin/rpcgen/rpc_sample.c b/usr.bin/rpcgen/rpc_sample.c index 37e47ae4d38..6fedae8df6e 100644 --- a/usr.bin/rpcgen/rpc_sample.c +++ b/usr.bin/rpcgen/rpc_sample.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_sample.c,v 1.5 2001/07/18 22:26:00 deraadt Exp $ */ +/* $OpenBSD: rpc_sample.c,v 1.6 2001/11/07 18:44:28 deraadt Exp $ */ /* $NetBSD: rpc_sample.c,v 1.2 1995/06/11 21:50:01 pk Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -196,7 +196,7 @@ write_sample_server(def) else /* cast back to void * */ f_print(fout, "\treturn((void*) &result);\n}\n"); /* if( Cflag) - f_print( fout, "};\n"); + f_print( fout, "}\n"); */ } diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c index 0e6bf01665a..2c4b6259bde 100644 --- a/usr.bin/rpcgen/rpc_svcout.c +++ b/usr.bin/rpcgen/rpc_svcout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_svcout.c,v 1.5 2001/07/18 22:26:00 deraadt Exp $ */ +/* $OpenBSD: rpc_svcout.c,v 1.6 2001/11/07 18:44:28 deraadt Exp $ */ /* $NetBSD: rpc_svcout.c,v 1.7 1995/06/24 14:59:59 pk Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -123,7 +123,7 @@ write_most(infile, netflag, nomain) } else { if( tirpcflag ) { if (netflag) { - f_print(fout, "\tregister SVCXPRT *%s;\n", TRANSP); + f_print(fout, "\tSVCXPRT *%s;\n", TRANSP); f_print(fout, "\tstruct netconfig *nconf = NULL;\n"); } f_print(fout, "\tpid_t pid;\n"); @@ -134,7 +134,7 @@ write_most(infile, netflag, nomain) write_rpc_svc_fg(infile, "\t\t"); f_print(fout, "\t}\n"); } else { - f_print(fout, "\tregister SVCXPRT *%s;\n", TRANSP); + f_print(fout, "\tSVCXPRT *%s;\n", TRANSP); f_print(fout, "\n"); print_pmapunset("\t"); } @@ -218,7 +218,7 @@ write_nettype_register(transp) for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) { f_print(fout, "\tif (!svc_create("); pvname(def->def_name, vp->vers_num); - f_print(fout, ", %s, %s, \"%s\")) {\n ", + f_print(fout, ", %s, %s, \"%s\")) {\n", def->def_name, vp->vers_name, transp); (void) sprintf(_errbuf, "unable to create (%s, %s) for %s.", @@ -534,7 +534,7 @@ write_inetmost(infile) f_print(fout, "\t\tif (saddr.sin_family != AF_INET)\n"); f_print(fout, "\t\t\texit(1);\n"); f_print(fout, "\t\tif (getsockopt(0, SOL_SOCKET, SO_TYPE,\n"); - f_print(fout, "\t\t\t\t(char *)&_rpcfdtype, &ssize) == -1)\n"); + f_print(fout, "\t\t (char *)&_rpcfdtype, &ssize) == -1)\n"); f_print(fout, "\t\t\texit(1);\n"); f_print(fout, "\t\tsock = 0;\n"); f_print(fout, "\t\t_rpcpmstart = 1;\n"); @@ -626,9 +626,10 @@ write_msg_out() if (inetdflag || pmflag) f_print(fout, "\tif (_rpcpmstart)\n"); f_print(fout, "\t\tsyslog(LOG_ERR, msg);\n"); - f_print(fout, "\telse\n"); - f_print(fout, "\t\t(void) fprintf(stderr, \"%%s\\n\", msg);\n"); - f_print(fout, "#else\n"); + f_print(fout, "\telse {\n"); + f_print(fout, "\t\t(void) write(STDERR_FILENO, msg, strlen(msg));\n"); + f_print(fout, "\t\t(void) write(STDERR_FILENO, \"\\n\", 1);\n"); + f_print(fout, "\t}\n#else\n"); f_print(fout, "\tsyslog(LOG_ERR, msg);\n"); f_print(fout, "#endif\n"); f_print(fout, "}\n"); @@ -646,6 +647,7 @@ write_timeout_func() f_print(fout, "static void\n"); f_print(fout, "closedown()\n"); f_print(fout, "{\n"); + f_print(fout, "\tint save_errno = errno;\n\n"); f_print(fout, "\tif (_rpcsvcdirty == 0) {\n"); f_print(fout, "\t\textern fd_set *__svc_fdset;\n"); f_print(fout, "\t\textern int __svc_fdsetsize;\n"); @@ -656,14 +658,15 @@ write_timeout_func() } else { f_print(fout, "\n\t\tif (_rpcfdtype == SOCK_DGRAM)\n"); } - f_print(fout, "\t\t\texit(0);\n"); + f_print(fout, "\t\t\t_exit(0);\n"); f_print(fout, "\t\tfor (i = 0, openfd = 0; i < __svc_fdsetsize && openfd < 2; i++)\n"); f_print(fout, "\t\t\tif (FD_ISSET(i, __svc_fdset))\n"); f_print(fout, "\t\t\t\topenfd++;\n"); f_print(fout, "\t\tif (openfd <= (_rpcpmstart?0:1))\n"); - f_print(fout, "\t\t\texit(0);\n"); + f_print(fout, "\t\t\t_exit(0);\n"); f_print(fout, "\t}\n"); f_print(fout, "\t(void) alarm(_RPCSVC_CLOSEDOWN);\n"); + f_print(fout, "\terrno = save_errno;\n"); f_print(fout, "}\n"); } @@ -885,7 +888,7 @@ write_inetd_register(transp) isudp = 0; f_print(fout, "\n"); if (inetdflag) { - f_print(fout, "\tif ((_rpcfdtype == 0) || (_rpcfdtype == %s)) {\n", + f_print(fout, "\tif (_rpcfdtype == 0 || _rpcfdtype == %s) {\n", isudp ? "SOCK_DGRAM" : "SOCK_STREAM"); } if (inetdflag && streq(transp, "tcp")) { |