- don't generate register variables

- always include syslog.h if -L; remove test for #ifdef SYSLOG
- create ANSI C function prototype in server write_program()
- clean up .Nm usage in man page
- document -L in man page
This commit is contained in:
lukem 1997-10-17 15:51:48 +00:00
parent d2f6e52d96
commit 03e194f678
4 changed files with 48 additions and 40 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpc_cout.c,v 1.11 1997/10/11 21:01:31 christos Exp $ */
/* $NetBSD: rpc_cout.c,v 1.12 1997/10/17 15:51:48 lukem Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI";
#else
__RCSID("$NetBSD: rpc_cout.c,v 1.11 1997/10/11 21:01:31 christos Exp $");
__RCSID("$NetBSD: rpc_cout.c,v 1.12 1997/10/17 15:51:48 lukem Exp $");
#endif
#endif
@ -450,7 +450,7 @@ emit_struct(def)
};
/* May cause lint to complain. but ... */
f_print(fout, "\tregister int32_t *buf;\n");
f_print(fout, "\tint32_t *buf;\n");
flag = PUT;
f_print(fout, "\n\tif (xdrs->x_op == XDR_ENCODE) {\n");
@ -658,8 +658,8 @@ emit_inline(decl, flag)
break;
case REL_VECTOR:
f_print(fout, "\t\t\t{\n");
f_print(fout, "\t\t\t\tregister int i;\n");
f_print(fout, "\t\t\t\tregister %s *genp;\n", decl->type);
f_print(fout, "\t\t\t\tint i;\n");
f_print(fout, "\t\t\t\t%s *genp;\n", decl->type);
f_print(fout, "\n");
f_print(fout, "\t\t\t\tfor (i = 0, genp = objp->%s;\n",
decl->name);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpc_main.c,v 1.12 1997/10/11 21:01:37 christos Exp $ */
/* $NetBSD: rpc_main.c,v 1.13 1997/10/17 15:51:55 lukem Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
#else
__RCSID("$NetBSD: rpc_main.c,v 1.12 1997/10/11 21:01:37 christos Exp $");
__RCSID("$NetBSD: rpc_main.c,v 1.13 1997/10/17 15:51:55 lukem Exp $");
#endif
#endif
@ -651,14 +651,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");
if (logflag || inetdflag || pmflag)
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");
}
/* for ANSI-C */
f_print(fout, "\n#ifdef __STDC__\n#define SIG_PF void(*)(int)\n#endif\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpc_svcout.c,v 1.8 1997/10/11 21:01:52 christos Exp $ */
/* $NetBSD: rpc_svcout.c,v 1.9 1997/10/17 15:52:00 lukem Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI";
#else
__RCSID("$NetBSD: rpc_svcout.c,v 1.8 1997/10/11 21:01:52 christos Exp $");
__RCSID("$NetBSD: rpc_svcout.c,v 1.9 1997/10/17 15:52:00 lukem Exp $");
#endif
#endif
@ -128,7 +128,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");
@ -139,7 +139,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");
}
@ -360,6 +360,17 @@ write_program(def, storage)
int filled;
for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
if (Cflag) {
f_print(fout, "\n");
if (storage != NULL) {
f_print(fout, "%s ", storage);
}
f_print(fout, "void ");
pvname(def->def_name, vp->vers_num);
f_print(fout, "(struct svc_req *%s, ", RQSTP);
f_print(fout, "SVCXPRT *%s);\n", TRANSP);
}
f_print(fout, "\n");
if (storage != NULL) {
f_print(fout, "%s ", storage);
@ -369,11 +380,11 @@ write_program(def, storage)
if (Cflag) {
f_print(fout, "(struct svc_req *%s, ", RQSTP);
f_print(fout, "register SVCXPRT *%s)\n", TRANSP);
f_print(fout, "SVCXPRT *%s)\n", TRANSP);
} else {
f_print(fout, "(%s, %s)\n", RQSTP, TRANSP);
f_print(fout, " struct svc_req *%s;\n", RQSTP);
f_print(fout, " register SVCXPRT *%s;\n", TRANSP);
f_print(fout, " SVCXPRT *%s;\n", TRANSP);
}
f_print(fout, "{\n");
@ -528,7 +539,7 @@ static void
write_inetmost(infile)
char *infile;
{
f_print(fout, "\tregister SVCXPRT *%s;\n", TRANSP);
f_print(fout, "\tSVCXPRT *%s;\n", TRANSP);
f_print(fout, "\tint sock;\n");
f_print(fout, "\tint proto;\n");
f_print(fout, "\tstruct sockaddr_in saddr;\n");

View File

@ -1,4 +1,4 @@
.\" $NetBSD: rpcgen.1,v 1.6 1997/01/09 20:21:08 tls Exp $
.\" $NetBSD: rpcgen.1,v 1.7 1997/10/17 15:52:05 lukem Exp $
.\" from: @(#)rpcgen.new.1 1.1 90/11/09 TIRPC 1.0; from 40.10 of 10/10/89
.\" Copyright (c) 1988,1990 Sun Microsystems, Inc. - All Rights Reserved.
.Dd June 11, 1995
@ -7,16 +7,17 @@
.Nm rpcgen
.Nd RPC protocol compiler
.Sh SYNOPSIS
.Nm rpcgen
.Nm
.Ar infile
.Nm rpcgen
.Nm ""
.Op Fl D Op Ar name=value
.Op Fl A
.Op Fl M
.Op Fl T
.Op Fl K Ar secs
.Ar infile
.Nm rpcgen
.Nm ""
.Op Fl L
.Fl c Li |
.Fl h Li |
.Fl l Li |
@ -26,18 +27,18 @@
.Fl S\&s Li |
.Op Fl o Ar outfile
.Op Ar infile
.Nm rpcgen
.Nm ""
.Fl c Li |
.Ar nettype
.Op Fl o Ar outfile
.Op Ar infile
.Nm rpcgen
.Nm ""
.Fl s Li |
.Ar netid
.Op Fl o Ar outfile
.Op Ar infile
.Sh DESCRIPTION
.Nm rpcgen
.Nm
is a tool that generates C code to implement an
.Tn RPC
protocol.
@ -46,7 +47,7 @@ The input to
is a language similar to C known as
.Tn RPC
Language (Remote Procedure Call Language).
.Nm rpcgen
.Nm
is normally used as in the first synopsis where
it takes an input file and generates up to four output files.
If the
@ -54,7 +55,7 @@ If the
is named
.Pa proto.x ,
then
.Nm rpcgen
.Nm
will generate a header file in
.Pa proto.h ,
.Tn XDR
@ -97,7 +98,7 @@ The name of the transport must be specified
by setting up the environmental variable
.Ev PM_TRANSPORT .
When the server generated by
.Nm rpcgen
.Nm
is executed,
it creates server handles for all the transports
specified in
@ -151,7 +152,7 @@ Some examples of their usage is described in the
EXAMPLE
section below.
When
.Nm rpcgen
.Nm
is executed with the
.Fl s
option,
@ -165,17 +166,17 @@ it creates a server for the transport specified by
If
.Ar infile
is not specified,
.Nm rpcgen
.Nm
accepts the standard input.
.Pp
The C preprocessor,
.Xr cpp 1
is run on the input file before it is actually interpreted by
.Nm rpcgen
.Nm
For each type of output file,
.Nm rpcgen
.Nm
defines a special preprocessor symbol for use by the
.Nm rpcgen
.Nm
programmer:
.Pp
.PD 0
@ -204,11 +205,11 @@ Any line beginning with
.Sq %
is passed directly into the output file,
uninterpreted by
.Nm rpcgen
.Nm
.Pp
For every data type referred to in
.Ar infile
.Nm rpcgen
.Nm
assumes that there exists a
routine with the string
.Dq xdr_
@ -257,7 +258,7 @@ header file which supports
dispatch tables.
.It Fl K Ar secs
By default, services created using
.Nm rpcgen
.Nm
wait 120 seconds
after servicing a request before exiting.
That interval can be changed using the
@ -279,11 +280,13 @@ spawn a new process in response to a service request.
If it is known that a server will be used with such a monitor, the
server should exit immediately on completion.
For such servers,
.Nm rpcgen
.Nm
should be used with
.Dq Fl K No -1 .
.It Fl l
Compile into client-side stubs.
.It Fl L
Server errors will be sent to syslog instead of stderr.
.It Fl m
Compile into server-side stubs,
but do not generate a