summaryrefslogtreecommitdiffstats
path: root/usr.bin/rpcgen
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>2002-07-21 12:55:04 +0000
committercharnier <charnier@FreeBSD.org>2002-07-21 12:55:04 +0000
commit26ad533edbc3e54e07a85fde8180be9cd25ed1fa (patch)
treeb7b64d6f677d73a28bdc53eeb9c62b73bdfdcb45 /usr.bin/rpcgen
parent9f90b488fd6314e317a25d522e46eb4f211794f3 (diff)
downloadFreeBSD-src-26ad533edbc3e54e07a85fde8180be9cd25ed1fa.zip
FreeBSD-src-26ad533edbc3e54e07a85fde8180be9cd25ed1fa.tar.gz
Removal of spaces at EOL. Add __FBSDID. New function xmalloc, xrealloc,
xstrdup. There is a crash() function that do cleaning before exiting the program. The new functions are wrappers that make use of crash() in case of allocation failure. warn, exit -> err. Reviewed by: alfred
Diffstat (limited to 'usr.bin/rpcgen')
-rw-r--r--usr.bin/rpcgen/rpc_clntout.c21
-rw-r--r--usr.bin/rpcgen/rpc_cout.c45
-rw-r--r--usr.bin/rpcgen/rpc_hout.c24
-rw-r--r--usr.bin/rpcgen/rpc_main.c37
-rw-r--r--usr.bin/rpcgen/rpc_parse.c47
-rw-r--r--usr.bin/rpcgen/rpc_parse.h18
-rw-r--r--usr.bin/rpcgen/rpc_sample.c37
-rw-r--r--usr.bin/rpcgen/rpc_scan.c49
-rw-r--r--usr.bin/rpcgen/rpc_scan.h24
-rw-r--r--usr.bin/rpcgen/rpc_svcout.c25
-rw-r--r--usr.bin/rpcgen/rpc_tblout.c21
-rw-r--r--usr.bin/rpcgen/rpc_util.c62
-rw-r--r--usr.bin/rpcgen/rpc_util.h37
-rw-r--r--usr.bin/rpcgen/rpcgen.16
14 files changed, 244 insertions, 209 deletions
diff --git a/usr.bin/rpcgen/rpc_clntout.c b/usr.bin/rpcgen/rpc_clntout.c
index 6104213..31f4fbf 100644
--- a/usr.bin/rpcgen/rpc_clntout.c
+++ b/usr.bin/rpcgen/rpc_clntout.c
@@ -5,38 +5,39 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
- *
- * $FreeBSD$
*/
#ident "@(#)rpc_clntout.c 1.15 94/04/25 SMI"
-#ifndef lint
#if 0
+#ifndef lint
static char sccsid[] = "@(#)rpc_clntout.c 1.11 89/02/22 (C) 1987 SMI";
#endif
#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
/*
* rpc_clntout.c, Client-stub outputter for the RPC protocol compiler
* Copyright (C) 1987, Sun Microsytsems, Inc.
@@ -177,7 +178,7 @@ void printarglist(proc, result, addargname, addargtype)
for (l = proc->args.decls; l != NULL; l = l->next)
f_print(fout, "%s, ", l->decl.name);
if (mtflag)
- f_print(fout, "%s, ", result);
+ f_print(fout, "%s, ", result);
f_print(fout, "%s)\n", addargname);
for (l = proc->args.decls; l != NULL; l = l->next) {
@@ -262,7 +263,7 @@ printbody(proc)
f_print(fout, "\t if ");
f_print(fout,
- "(clnt_call(clnt, %s,\n\t\t(xdrproc_t) xdr_void, ",
+ "(clnt_call(clnt, %s,\n\t\t(xdrproc_t) xdr_void, ",
proc->proc_name);
f_print(fout,
"(caddr_t) NULL,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,",
diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c
index 8f1bcdc..bccc858 100644
--- a/usr.bin/rpcgen/rpc_cout.c
+++ b/usr.bin/rpcgen/rpc_cout.c
@@ -5,43 +5,43 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
-#ident "@(#)rpc_cout.c 1.14 93/07/05 SMI"
+#ident "@(#)rpc_cout.c 1.14 93/07/05 SMI"
-#ifndef lint
#if 0
+#ifndef lint
static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI";
#endif
-static const char rcsid[] =
- "$FreeBSD$";
#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
/*
* rpc_cout.c, XDR routine outputter for the RPC protocol compiler
* Copyright (C) 1987, Sun Microsystems, Inc.
*/
-#include <err.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
@@ -98,7 +98,7 @@ emit(def)
emit_typedef(def);
break;
/* DEF_CONST and DEF_PROGRAM have already been handled */
- default:
+ default:
break;
}
print_trailer();
@@ -358,8 +358,8 @@ emit_union(def)
continue;
cs = &cl->case_decl;
if (!streq(cs->type, "void")) {
- object = alloc(strlen(def->def_name) + strlen(format) +
- strlen(cs->name) + 1);
+ object = xmalloc(strlen(def->def_name) +
+ strlen(format) + strlen(cs->name) + 1);
if (isvectordef (cs->type, cs->rel)) {
s_print(object, vecformat, def->def_name,
cs->name);
@@ -377,8 +377,8 @@ emit_union(def)
if (dflt != NULL) {
if (!streq(dflt->type, "void")) {
f_print(fout, "\tdefault:\n");
- object = alloc(strlen(def->def_name) + strlen(format) +
-strlen(dflt->name) + 1);
+ object = xmalloc(strlen(def->def_name) +
+ strlen(format) + strlen(dflt->name) + 1);
if (isvectordef (dflt->type, dflt->rel)) {
s_print(object, vecformat, def->def_name,
dflt->name);
@@ -453,16 +453,13 @@ int flag;
dl->decl.array_max);
/* now concatenate to sizestr !!!! */
- if (sizestr == NULL)
- sizestr = strdup(ptemp);
+ if (sizestr == NULL) {
+ sizestr = xstrdup(ptemp);
+ }
else{
- sizestr = realloc(sizestr,
+ sizestr = xrealloc(sizestr,
strlen(sizestr)
+strlen(ptemp)+1);
- if (sizestr == NULL){
- warnx("fatal error: no memory");
- crash();
- };
sizestr = strcat(sizestr, ptemp);
/* build up length of array */
}
@@ -753,9 +750,7 @@ char *str;
{
char *ptr, *hptr;
- ptr = (char *)malloc(strlen(str)+1);
- if (ptr == (char *) NULL)
- errx(1, "malloc failed");
+ ptr = (char *)xmalloc(strlen(str)+1);
hptr = ptr;
while (*str != '\0')
diff --git a/usr.bin/rpcgen/rpc_hout.c b/usr.bin/rpcgen/rpc_hout.c
index 648a95f..ad9baaa 100644
--- a/usr.bin/rpcgen/rpc_hout.c
+++ b/usr.bin/rpcgen/rpc_hout.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -6,23 +5,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -30,12 +29,15 @@
#ident "@(#)rpc_hout.c 1.16 94/04/25 SMI"
-#ifndef lint
#if 0
+#ifndef lint
static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI";
#endif
#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
/*
* rpc_hout.c, Header file outputter for the RPC protocol compiler
* Copyright (C) 1987, Sun Microsystems, Inc.
@@ -126,7 +128,7 @@ int pointerp;
{
xdrfunc * xdrptr;
- xdrptr = (xdrfunc *) malloc(sizeof (struct xdrfunc));
+ xdrptr = XALLOC(struct xdrfunc);
xdrptr->name = name;
xdrptr->pointerp = pointerp;
@@ -151,9 +153,9 @@ int i;
{
if (i == 2) {
f_print(fout, "extern bool_t xdr_%s();\n", name);
- return;
+ return;
}
- else
+ else
f_print(fout, "extern bool_t xdr_%s(XDR *, %s%s);\n", name,
name, pointerp ? "*" : "");
@@ -337,7 +339,7 @@ pprogramdef(def)
puldefine(vers->vers_name, vers->vers_num);
/*
- * Print out 2 definitions, one for ANSI-C, another for
+ * Print out 2 definitions, one for ANSI-C, another for
* old K & R C
*/
diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c
index a4913ca..6321735 100644
--- a/usr.bin/rpcgen/rpc_main.c
+++ b/usr.bin/rpcgen/rpc_main.c
@@ -5,23 +5,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -30,14 +30,15 @@
#ident "@(#)rpc_main.c 1.21 94/04/25 SMI"
-#ifndef lint
#if 0
+#ifndef lint
static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
#endif
-static const char rcsid[] =
- "$FreeBSD$";
#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
/*
* rpc_main.c, Top level of the RPC protocol compiler.
* Copyright (C) 1987, Sun Microsystems, Inc.
@@ -65,7 +66,6 @@ static void h_output( char *, char *, int, char * );
static void l_output( char *, char *, int, char * );
static void t_output( char *, char *, int, char * );
static void clnt_output( char *, char *, int, char * );
-
void c_initialize( void );
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
@@ -244,10 +244,7 @@ extendfile(path, ext)
file = path;
else
file++;
- res = alloc(strlen(file) + strlen(ext) + 1);
- if (res == NULL) {
- abort();
- }
+ res = xmalloc(strlen(file) + strlen(ext) + 1);
p = strrchr(file, '.');
if (p == NULL) {
p = file + strlen(file);
@@ -347,11 +344,9 @@ open_input(infile, define)
(void) dup2(pd[1], 1);
(void) close(pd[0]);
execv(arglist[0], arglist);
- warn("execv");
- exit(1);
+ err(1, "execv");
case -1:
- warn("fork");
- exit(1);
+ err(1, "fork");
}
(void) close(pd[1]);
fin = fdopen(pd[0], "r");
@@ -478,7 +473,7 @@ char *generate_guard(pathname)
filename = strrchr(pathname, '/'); /* find last component */
filename = ((filename == 0) ? pathname : filename+1);
- guard = strdup(filename);
+ guard = xstrdup(filename);
/* convert to upper case */
tmp = guard;
while (*tmp) {
@@ -874,8 +869,8 @@ struct commandline *cmd;
clntprogname = extendfile(cmd->infile, "_client");
if (allfiles){
- mkfilename = alloc(strlen("makefile.") +
- strlen(cmd->infile) + 1);
+ mkfilename = xmalloc(strlen("makefile.") +
+ strlen(cmd->infile) + 1);
temp = (char *)rindex(cmd->infile, '.');
strcat(mkfilename, "makefile.");
(void) strncat(mkfilename, cmd->infile,
@@ -1264,7 +1259,7 @@ parseargs(argc, argv, cmd)
static void
usage()
{
- f_print(stderr, "%s\n%s\n%s\n%s\n%s\n",
+ f_print(stderr, "%s\n%s\n%s\n%s\n%s\n",
"usage: rpcgen infile",
" rpcgen [-abCLNTM] [-Dname[=value]] [-i size]\
[-I -P [-K seconds]] [-Y path] infile",
diff --git a/usr.bin/rpcgen/rpc_parse.c b/usr.bin/rpcgen/rpc_parse.c
index f2321ed..b2c3312 100644
--- a/usr.bin/rpcgen/rpc_parse.c
+++ b/usr.bin/rpcgen/rpc_parse.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -6,23 +5,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -30,12 +29,15 @@
#ident "@(#)rpc_parse.c 1.12 93/07/05 SMI"
-#ifndef lint
#if 0
+#ifndef lint
static char sccsid[] = "@(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI";
#endif
#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
/*
* rpc_parse.c, Parser for the RPC protocol compiler
* Copyright (C) 1987 Sun Microsystems, Inc.
@@ -71,7 +73,7 @@ get_definition()
definition *defp;
token tok;
- defp = ALLOC(definition);
+ defp = XALLOC(definition);
get_token(&tok);
switch (tok.kind) {
case TOK_STRUCT:
@@ -126,7 +128,7 @@ def_struct(defp)
tailp = &defp->def.st.decls;
do {
get_declaration(&dec, DEF_STRUCT);
- decls = ALLOC(decl_list);
+ decls = XALLOC(decl_list);
decls->decl = dec;
*tailp = decls;
tailp = &decls->next;
@@ -160,13 +162,13 @@ def_program(defp)
scan(TOK_VERSION, &tok);
do {
scan(TOK_IDENT, &tok);
- vlist = ALLOC(version_list);
+ vlist = XALLOC(version_list);
vlist->vers_name = tok.str;
scan(TOK_LBRACE, &tok);
ptailp = &vlist->procs;
do {
/* get result type */
- plist = ALLOC(proc_list);
+ plist = XALLOC(proc_list);
get_type(&plist->res_prefix, &plist->res_type,
DEF_PROGRAM);
if (streq(plist->res_type, "opaque")) {
@@ -186,7 +188,7 @@ def_program(defp)
get_prog_declaration(&dec, DEF_PROGRAM, num_args);
if (streq(dec.type, "void"))
isvoid = TRUE;
- decls = ALLOC(decl_list);
+ decls = XALLOC(decl_list);
plist->args.decls = decls;
decls->decl = dec;
tailp = &decls->next;
@@ -195,7 +197,7 @@ def_program(defp)
num_args++;
get_prog_declaration(&dec, DEF_STRUCT,
num_args);
- decls = ALLOC(decl_list);
+ decls = XALLOC(decl_list);
decls->decl = dec;
*tailp = decls;
if (streq(dec.type, "void"))
@@ -259,7 +261,7 @@ def_enum(defp)
tailp = &defp->def.en.vals;
do {
scan(TOK_IDENT, &tok);
- elist = ALLOC(enumval_list);
+ elist = XALLOC(enumval_list);
elist->name = tok.str;
elist->assignment = NULL;
scan3(TOK_COMMA, TOK_RBRACE, TOK_EQUAL, &tok);
@@ -311,7 +313,7 @@ def_union(defp)
scan(TOK_CASE, &tok);
while (tok.kind == TOK_CASE) {
scan2(TOK_IDENT, TOK_CHARCONST, &tok);
- cases = ALLOC(case_list);
+ cases = XALLOC(case_list);
cases->case_name = tok.str;
scan(TOK_COLON, &tok);
/* now peek at next token */
@@ -323,7 +325,7 @@ def_union(defp)
/* continued case statement */
*tailp = cases;
tailp = &cases->next;
- cases = ALLOC(case_list);
+ cases = XALLOC(case_list);
cases->case_name = tok.str;
scan(TOK_COLON, &tok);
} while (peekscan(TOK_CASE, &tok));
@@ -334,7 +336,7 @@ def_union(defp)
*tailp = cases;
tailp = &cases->next;
- cases = ALLOC(case_list);
+ cases = XALLOC(case_list);
};
get_declaration(&dec, DEF_UNION);
@@ -350,7 +352,7 @@ def_union(defp)
if (tok.kind == TOK_DEFAULT) {
scan(TOK_COLON, &tok);
get_declaration(&dec, DEF_UNION);
- defp->def.un.default_decl = ALLOC(declaration);
+ defp->def.un.default_decl = XALLOC(declaration);
*defp->def.un.default_decl = dec;
scan(TOK_SEMICOLON, &tok);
scan(TOK_RBRACE, &tok);
@@ -513,7 +515,7 @@ get_prog_declaration(dec, dkind, num)
sprintf(name, "%s%d", ARGNAME, num);
/* default name of argument */
- dec->name = (char *) strdup(name);
+ dec->name = (char *) xstrdup(name);
if (streq(dec->type, "void")) {
return;
}
@@ -523,12 +525,13 @@ get_prog_declaration(dec, dkind, num)
}
if (peekscan(TOK_STAR, &tok)) {
if (streq(dec->type, "string")) {
- error("pointer to string not allowed in program arguments\n");
+ error("pointer to string not allowed in program arguments");
}
dec->rel = REL_POINTER;
- if (peekscan(TOK_IDENT, &tok))
+ if (peekscan(TOK_IDENT, &tok)) {
/* optional name of argument */
- dec->name = strdup(tok.str);
+ dec->name = xstrdup(tok.str);
+ }
}
if (peekscan(TOK_LANGLE, &tok)) {
if (!streq(dec->type, "string")) {
diff --git a/usr.bin/rpcgen/rpc_parse.h b/usr.bin/rpcgen/rpc_parse.h
index fdc31d4..4f3547b 100644
--- a/usr.bin/rpcgen/rpc_parse.h
+++ b/usr.bin/rpcgen/rpc_parse.h
@@ -8,23 +8,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -50,20 +50,20 @@
*
*
*
-* Copyright Notice
+* Copyright Notice
*
-* Notice of copyright on this source code product does not indicate
+* Notice of copyright on this source code product does not indicate
* publication.
*
* (c) 1986,1987,1988.1989 Sun Microsystems, Inc
* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
* All rights reserved.
-*/
+*/
/* @(#)rpc_parse.h 1.3 90/08/29 (C) 1987 SMI */
/*
- * rpc_parse.h, Definitions for the RPCL parser
+ * rpc_parse.h, Definitions for the RPCL parser
*/
enum defkind {
diff --git a/usr.bin/rpcgen/rpc_sample.c b/usr.bin/rpcgen/rpc_sample.c
index 1f55797..b960cd6 100644
--- a/usr.bin/rpcgen/rpc_sample.c
+++ b/usr.bin/rpcgen/rpc_sample.c
@@ -5,32 +5,33 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
- *
- * $FreeBSD$
*/
/* #pragma ident "@(#)rpc_sample.c 1.9 94/04/25 SMI" */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
/*
* rpc_sample.c, Sample client-server code outputter for the RPC protocol compiler
* Copyright (C) 1987, Sun Microsystems, Inc.
@@ -54,7 +55,7 @@ write_sample_svc(def)
definition *def;
{
- if (def->def_kind != DEF_PROGRAM)
+ if (def->def_kind != DEF_PROGRAM)
return;
write_sample_server(def);
}
@@ -67,7 +68,7 @@ write_sample_clnt(def)
version_list *vp;
int count = 0;
- if (def->def_kind != DEF_PROGRAM)
+ if (def->def_kind != DEF_PROGRAM)
return(0);
/* generate sample code for each version */
for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
@@ -110,7 +111,7 @@ write_sample_client(program_name, vp)
if(proc->arg_num < 2 && !newstyle) {
f_print(fout, "\t");
if(!streq(proc->args.decls->decl.type, "void"))
- ptype(proc->args.decls->decl.prefix,
+ ptype(proc->args.decls->decl.prefix,
proc->args.decls->decl.type, 1);
else
f_print(fout, "char * "); /* cannot have "void" type */
@@ -131,7 +132,7 @@ write_sample_client(program_name, vp)
/* generate creation of client handle */
f_print(fout, "\n#ifndef\tDEBUG\n");
- f_print(fout, "\tclnt = clnt_create(host, %s, %s, \"%s\");\n",
+ f_print(fout, "\tclnt = clnt_create(host, %s, %s, \"%s\");\n",
program_name, vp->vers_name, tirpcflag? "netpath" : "udp");
f_print(fout, "\tif (clnt == (CLIENT *) NULL) {\n");
f_print(fout, "\t\tclnt_pcreateerror(host);\n");
@@ -142,13 +143,13 @@ write_sample_client(program_name, vp)
i = 0;
for (proc = vp->procs; proc != NULL; proc = proc->next) {
if (mtflag)
- f_print(fout, "\tretval_%d = ",++i);
+ f_print(fout, "\tretval_%d = ",++i);
else
- f_print(fout, "\tresult_%d = ",++i);
+ f_print(fout, "\tresult_%d = ",++i);
pvname(proc->proc_name, vp->vers_num);
if (proc->arg_num < 2 && !newstyle) {
f_print(fout, "(");
- if(streq(proc->args.decls->decl.type, "void"))
+ if(streq(proc->args.decls->decl.type, "void"))
/* cast to void * */
f_print(fout, "(void *)");
f_print(fout, "&");
@@ -227,14 +228,14 @@ write_sample_server(def)
}
else
f_print(fout, "\tbool_t retval;\n");
- f_print(fout,
+ f_print(fout,
"\n\t/*\n\t * insert server code here\n\t */\n\n");
if (!mtflag)
if(!streq(proc->res_type, "void"))
f_print(fout, "\treturn (&result);\n}\n");
else /* cast back to void * */
- f_print(fout, "\treturn((void *) &result);\n}\n");
+ f_print(fout, "\treturn((void *) &result);\n}\n");
else
f_print(fout, "\treturn (retval);\n}\n");
}
@@ -242,7 +243,7 @@ write_sample_server(def)
if (mtflag) {
f_print(fout, "\nint\n");
pvname(def->def_name, vp->vers_num);
- if (Cflag)
+ if (Cflag)
f_print(fout,"_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)\n");
else {
f_print(fout,"_freeresult(transp, xdr_result, result)\n");
@@ -252,7 +253,7 @@ write_sample_server(def)
}
f_print(fout, "{\n");
f_print(fout, "\t(void) xdr_free(xdr_result, result);\n");
- f_print(fout,
+ f_print(fout,
"\n\t/*\n\t * Insert additional freeing code here, if needed\n\t */\n");
f_print(fout, "\n}\n");
diff --git a/usr.bin/rpcgen/rpc_scan.c b/usr.bin/rpcgen/rpc_scan.c
index 8c3f9d0..1cc41f2 100644
--- a/usr.bin/rpcgen/rpc_scan.c
+++ b/usr.bin/rpcgen/rpc_scan.c
@@ -5,41 +5,42 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
- *
- * $FreeBSD$
*/
#ident "@(#)rpc_scan.c 1.13 93/07/05 SMI"
-#ifndef lint
#if 0
+#ifndef lint
static char sccsid[] = "@(#)rpc_scan.c 1.11 89/02/22 (C) 1987 SMI";
#endif
#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
/*
- * rpc_scan.c, Scanner for the RPC protocol compiler
- * Copyright (C) 1987, Sun Microsystems, Inc.
+ * rpc_scan.c, Scanner for the RPC protocol compiler
+ * Copyright (C) 1987, Sun Microsystems, Inc.
*/
#include <sys/types.h>
@@ -69,7 +70,7 @@ static void printdirective( char * );
static void docppline( char *, int *, char ** );
/*
- * scan expecting 1 given token
+ * scan expecting 1 given token
*/
void
scan(expect, tokp)
@@ -83,7 +84,7 @@ scan(expect, tokp)
}
/*
- * scan expecting any of the 2 given tokens
+ * scan expecting any of the 2 given tokens
*/
void
scan2(expect1, expect2, tokp)
@@ -98,7 +99,7 @@ scan2(expect1, expect2, tokp)
}
/*
- * scan expecting any of the 3 given token
+ * scan expecting any of the 3 given token
*/
void
scan3(expect1, expect2, expect3, tokp)
@@ -115,7 +116,7 @@ scan3(expect1, expect2, expect3, tokp)
}
/*
- * scan expecting a constant, possibly symbolic
+ * scan expecting a constant, possibly symbolic
*/
void
scan_num(tokp)
@@ -131,7 +132,7 @@ scan_num(tokp)
}
/*
- * Peek at the next token
+ * Peek at the next token
*/
void
peek(tokp)
@@ -142,7 +143,7 @@ peek(tokp)
}
/*
- * Peek at the next token and scan it if it matches what you expect
+ * Peek at the next token and scan it if it matches what you expect
*/
int
peekscan(expect, tokp)
@@ -158,7 +159,7 @@ peekscan(expect, tokp)
}
/*
- * Get the next token, printing out any directive that are encountered.
+ * Get the next token, printing out any directive that are encountered.
*/
void
get_token(tokp)
@@ -192,7 +193,7 @@ get_token(tokp)
if (commenting) {
break;
} else if (cppline(curline)) {
- docppline(curline, &linenum,
+ docppline(curline, &linenum,
&infilename);
} else if (directive(curline)) {
printdirective(curline);
@@ -222,7 +223,7 @@ get_token(tokp)
}
/*
- * 'where' is not whitespace, comment or directive Must be a token!
+ * 'where' is not whitespace, comment or directive Must be a token!
*/
switch (*where) {
case ':':
@@ -346,7 +347,7 @@ findstrconst(str, val)
}
p++;
size = p - *str;
- *val = alloc(size + 1);
+ *val = xmalloc(size + 1);
(void) strncpy(*val, *str, size);
(*val)[size] = 0;
*str = p;
@@ -372,7 +373,7 @@ findchrconst(str, val)
if (size != 3) {
error("empty char string");
}
- *val = alloc(size + 1);
+ *val = xmalloc(size + 1);
(void) strncpy(*val, *str, size);
(*val)[size] = 0;
*str = p;
@@ -398,7 +399,7 @@ findconst(str, val)
} while (isdigit(*p));
}
size = p - *str;
- *val = alloc(size + 1);
+ *val = xmalloc(size + 1);
(void) strncpy(*val, *str, size);
(*val)[size] = 0;
*str = p;
@@ -454,7 +455,7 @@ findkind(mark, tokp)
}
tokp->kind = TOK_IDENT;
for (len = 0; isalnum(str[len]) || str[len] == '_'; len++);
- tokp->str = alloc(len + 1);
+ tokp->str = xmalloc(len + 1);
(void) strncpy(tokp->str, str, len);
tokp->str[len] = 0;
*mark = str + len;
@@ -506,7 +507,7 @@ docppline(line, lineno, fname)
error("preprocessor error");
}
line++;
- p = file = alloc(strlen(line) + 1);
+ p = file = xmalloc(strlen(line) + 1);
while (*line && *line != '"') {
*p++ = *line++;
}
diff --git a/usr.bin/rpcgen/rpc_scan.h b/usr.bin/rpcgen/rpc_scan.h
index 57a2ed6..1b887b0 100644
--- a/usr.bin/rpcgen/rpc_scan.h
+++ b/usr.bin/rpcgen/rpc_scan.h
@@ -8,23 +8,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -51,24 +51,24 @@
*
*
*
-* Copyright Notice
+* Copyright Notice
*
-* Notice of copyright on this source code product does not indicate
+* Notice of copyright on this source code product does not indicate
* publication.
*
* (c) 1986,1987,1988.1989 Sun Microsystems, Inc
* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
* All rights reserved.
-*/
+*/
/* @(#)rpc_scan.h 1.3 90/08/29 (C) 1987 SMI */
/*
- * rpc_scan.h, Definitions for the RPCL scanner
+ * rpc_scan.h, Definitions for the RPCL scanner
*/
/*
- * kinds of tokens
+ * kinds of tokens
*/
enum tok_kind {
TOK_IDENT,
@@ -115,7 +115,7 @@ enum tok_kind {
typedef enum tok_kind tok_kind;
/*
- * a token
+ * a token
*/
struct token {
tok_kind kind;
@@ -125,7 +125,7 @@ typedef struct token token;
/*
- * routine interface
+ * routine interface
*/
void scan();
void scan2();
diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c
index 0705ef1..fbaf398 100644
--- a/usr.bin/rpcgen/rpc_svcout.c
+++ b/usr.bin/rpcgen/rpc_svcout.c
@@ -5,23 +5,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -29,14 +29,15 @@
#ident "@(#)rpc_svcout.c 1.4 90/04/13 SMI"
-#ifndef lint
#if 0
+#ifndef lint
static char sccsid[] = "@(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI";
#endif
-static const char rcsid[] =
- "$FreeBSD$";
#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
/*
* rpc_svcout.c, Server-skeleton outputter for the RPC protocol compiler
* Copyright (C) 1987, Sun Microsystems, Inc.
@@ -174,7 +175,7 @@ serviced */\n");
f_print(fout, "\telse {\n");
write_rpc_svc_fg(infile, "\t\t");
f_print(fout, "\t}\n");
- } else
+ } else
write_rpc_svc_fg(infile, "\t\t");
} else {
@@ -484,7 +485,7 @@ write_program(def, storage)
f_print(fout, "\t} %s;\n", RESULT);
f_print(fout, "\tbool_t %s;\n", RETVAL);
- } else
+ } else
f_print(fout, "\tchar *%s;\n", RESULT);
if (Cflag) {
@@ -583,7 +584,7 @@ write_program(def, storage)
print_return("\t\t");
f_print(fout, "\t}\n");
- if (!mtflag)
+ if (!mtflag)
if (Cflag)
f_print(fout, "\t%s = (*%s)((char *)&%s, %s);\n",
RESULT, ROUTINE, ARG, RQSTP);
@@ -772,7 +773,7 @@ write_msg_out(void)
* in the toplevel RPC server code.
*/
f_print(fout, "static\n");
-
+
if (!Cflag) {
f_print(fout, "void _msgout(msg)\n");
f_print(fout, "\tchar *msg;\n");
diff --git a/usr.bin/rpcgen/rpc_tblout.c b/usr.bin/rpcgen/rpc_tblout.c
index 9488f76..e23e058 100644
--- a/usr.bin/rpcgen/rpc_tblout.c
+++ b/usr.bin/rpcgen/rpc_tblout.c
@@ -5,38 +5,39 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
-#ident "@(#)rpc_tblout.c 1.11 93/07/05 SMI"
+#ident "@(#)rpc_tblout.c 1.11 93/07/05 SMI"
-#ifndef lint
#if 0
+#ifndef lint
static char sccsid[] = "@(#)rpc_tblout.c 1.4 89/02/22 (C) 1988 SMI";
#endif
-static const char rcsid[] =
- "$FreeBSD$";
#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
/*
* rpc_tblout.c, Dispatch table outputter for the RPC protocol compiler
* Copyright (C) 1989, Sun Microsystems, Inc.
@@ -133,7 +134,7 @@ write_table(def)
/* argument info */
if( proc->arg_num > 1 )
printit((char*) NULL, proc->args.argname );
- else
+ else
/* do we have to do something special for newstyle */
printit( proc->args.decls->decl.prefix,
proc->args.decls->decl.type );
diff --git a/usr.bin/rpcgen/rpc_util.c b/usr.bin/rpcgen/rpc_util.c
index 939ddaf..b6f3464 100644
--- a/usr.bin/rpcgen/rpc_util.c
+++ b/usr.bin/rpcgen/rpc_util.c
@@ -5,23 +5,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -29,14 +29,15 @@
#ident "@(#)rpc_util.c 1.14 93/07/05 SMI"
-#ifndef lint
#if 0
+#ifndef lint
static char sccsid[] = "@(#)rpc_util.c 1.11 89/02/22 (C) 1987 SMI";
#endif
-static const char rcsid[] =
- "$FreeBSD$";
#endif
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
/*
* rpc_util.c, Utility routines for the RPC protocol compiler
* Copyright (C) 1989, Sun Microsystems, Inc.
@@ -122,7 +123,7 @@ storeval(lstp, val)
list *lst;
for (l = lstp; *l != NULL; l = (list **) & (*l)->next);
- lst = ALLOC(list);
+ lst = XALLOC(list);
lst->val = val;
lst->next = NULL;
*l = lst;
@@ -462,9 +463,7 @@ make_argname(pname, vname)
{
char *name;
- name = malloc(strlen(pname) + strlen(vname) + strlen(ARGEXT) + 3);
- if (!name)
- errx(1, "failed in malloc");
+ name = xmalloc(strlen(pname) + strlen(vname) + strlen(ARGEXT) + 3);
sprintf(name, "%s_%s_%s", locase(pname), vname, ARGEXT);
return (name);
}
@@ -479,8 +478,7 @@ char *type;
{
bas_type *ptr;
- if ((ptr = (bas_type *) malloc(sizeof (bas_type))) == (bas_type *)NULL)
- errx(1, "failed in malloc");
+ ptr = XALLOC(bas_type);
ptr->name = type;
ptr->length = len;
@@ -514,3 +512,39 @@ char *type;
};
return (NULL);
}
+
+void *
+xmalloc(size_t size)
+{
+ void *p;
+
+ if ((p = malloc(size)) == NULL) {
+ warnx("malloc failed");
+ crash();
+ }
+ return (p);
+}
+
+void *
+xrealloc(void *ptr, size_t size)
+{
+ void *p;
+
+ if ((p = realloc(ptr, size)) == NULL) {
+ warnx("realloc failed");
+ crash();
+ }
+ return (p);
+}
+
+char *
+xstrdup(const char *str)
+{
+ char *p;
+
+ if ((p = strdup(str)) == NULL) {
+ warnx("strdup failed");
+ crash();
+ }
+ return (p);
+}
diff --git a/usr.bin/rpcgen/rpc_util.h b/usr.bin/rpcgen/rpc_util.h
index 833b9cf..7343827 100644
--- a/usr.bin/rpcgen/rpc_util.h
+++ b/usr.bin/rpcgen/rpc_util.h
@@ -8,23 +8,23 @@
* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
@@ -50,26 +50,25 @@
*
*
*
-* Copyright Notice
+* Copyright Notice
*
-* Notice of copyright on this source code product does not indicate
+* Notice of copyright on this source code product does not indicate
* publication.
*
* (c) 1986,1987,1988.1989 Sun Microsystems, Inc
* (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
* All rights reserved.
-*/
+*/
/* @(#)rpc_util.h 1.5 90/08/29 (C) 1987 SMI */
/*
- * rpc_util.h, Useful definitions for the RPC protocol compiler
+ * rpc_util.h, Useful definitions for the RPC protocol compiler
*/
#include <sys/types.h>
#include <stdlib.h>
-#define alloc(size) malloc((unsigned)(size))
-#define ALLOC(object) (object *) malloc(sizeof(object))
+#define XALLOC(object) (object *) xmalloc(sizeof(object))
#define s_print (void) sprintf
#define f_print (void) fprintf
@@ -106,7 +105,7 @@ struct commandline {
#define GET 2
/*
- * Global variables
+ * Global variables
*/
#define MAXLINESIZE 1024
extern char curline[MAXLINESIZE];
@@ -128,7 +127,7 @@ extern xdrfunc *xdrfunc_head, *xdrfunc_tail;
* All the option flags
*/
extern int inetdflag;
-extern int pmflag;
+extern int pmflag;
extern int tblflag;
extern int logflag;
extern int newstyle;
@@ -150,13 +149,15 @@ extern int nonfatalerrors;
extern pid_t childpid;
/*
- * rpc_util routines
+ * rpc_util routines
*/
void reinitialize();
void crash();
void add_type(int len, char *type);
-
void storeval();
+void *xmalloc(size_t size);
+void *xrealloc(void *ptr, size_t size);
+char *xstrdup(const char *str);
#define STOREVAL(list,item) \
storeval(list,item)
@@ -182,20 +183,20 @@ void tabify();
void record_open();
bas_type *find_type();
/*
- * rpc_cout routines
+ * rpc_cout routines
*/
void cprint();
void emit();
/*
- * rpc_hout routines
+ * rpc_hout routines
*/
void print_datadef();
void print_funcdef();
void print_xdr_func_def();
/*
- * rpc_svcout routines
+ * rpc_svcout routines
*/
void write_most();
void write_register();
diff --git a/usr.bin/rpcgen/rpcgen.1 b/usr.bin/rpcgen/rpcgen.1
index 60a9222..1a259f8 100644
--- a/usr.bin/rpcgen/rpcgen.1
+++ b/usr.bin/rpcgen/rpcgen.1
@@ -326,7 +326,7 @@ are always logged with
Note:
Contrary to some systems, in
.Fx
-this option is needed to generate
+this option is needed to generate
servers that can be invoked through portmonitors and inetd.
.Pp
.It Fl K Ar seconds
@@ -424,11 +424,11 @@ in the server side stubs.
Note:
Contrary to some systems, in
.Fx
-this option is needed to generate
+this option is needed to generate
servers that can be monitored.
.Pp
If the
-.Fl I
+.Fl I
option has been specified,
.Fl P
is turned off automatically.
OpenPOWER on IntegriCloud