1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
Index: fbsd-6.2/usr.bin/rpcgen/rpc_hout.c
===================================================================
--- fbsd-6.2.orig/usr.bin/rpcgen/rpc_hout.c
+++ fbsd-6.2/usr.bin/rpcgen/rpc_hout.c
@@ -50,7 +50,7 @@ void storexdrfuncdecl( char *, int );
static void pconstdef( definition * );
static void pstructdef( definition * );
static void puniondef( definition * );
-static void pprogramdef( definition *, int );
+static void pprogramdef( definition *, int, int );
static void pstructdef( definition * );
static void penumdef( definition * );
static void ptypedef( definition * );
@@ -64,7 +64,7 @@ void pdeclaration( char *, declaration *
* Print the C-version of an xdr definition
*/
void
-print_datadef(definition *def, int headeronly)
+print_datadef(definition *def, int headeronly, int nomain)
{
if (def->def_kind == DEF_PROGRAM) /* handle data only */
@@ -87,7 +87,7 @@ print_datadef(definition *def, int heade
ptypedef(def);
break;
case DEF_PROGRAM:
- pprogramdef(def, headeronly);
+ pprogramdef(def, headeronly, nomain);
break;
case DEF_CONST:
pconstdef(def);
@@ -103,12 +103,12 @@ print_datadef(definition *def, int heade
void
-print_funcdef(definition *def, int headeronly)
+print_funcdef(definition *def, int headeronly, int nomain)
{
switch (def->def_kind) {
case DEF_PROGRAM:
f_print(fout, "\n");
- pprogramdef(def, headeronly);
+ pprogramdef(def, headeronly, nomain);
break;
default:
break;
@@ -313,7 +313,7 @@ pdispatch(char * name, char *vers, int m
}
static void
-pprogramdef(definition *def, int headeronly)
+pprogramdef(definition *def, int headeronly, int nomain)
{
version_list *vers;
proc_list *proc;
@@ -341,7 +341,7 @@ pprogramdef(definition *def, int headero
if(!Cflag){
ext = "extern ";
- if (headeronly) {
+ if (headeronly && nomain) {
f_print(fout, "%s", ext);
pdispatch(def->def_name, vers->vers_num, 2);
}
@@ -372,7 +372,7 @@ pprogramdef(definition *def, int headero
ext = "extern ";
}
- if (headeronly) {
+ if (headeronly && nomain) {
f_print(fout, "%s", ext);
pdispatch(def->def_name, vers->vers_num,
i);
Index: fbsd-6.2/usr.bin/rpcgen/rpc_main.c
===================================================================
--- fbsd-6.2.orig/usr.bin/rpcgen/rpc_main.c
+++ fbsd-6.2/usr.bin/rpcgen/rpc_main.c
@@ -61,7 +61,7 @@ extern int write_sample_clnt( definition
extern void write_sample_clnt_main( void );
extern void add_sample_msg( void );
static void c_output( char *, char *, int, char * );
-static void h_output( char *, char *, int, char *, int );
+static void h_output( char *, char *, int, char *, int, int );
static void l_output( char *, char *, int, char * );
static void t_output( char *, char *, int, char * );
static void clnt_output( char *, char *, int, char * );
@@ -173,7 +173,7 @@ main(argc, argv)
c_output(cmd.infile, "-DRPC_XDR", DONT_EXTEND, cmd.outfile);
} else if (cmd.hflag) {
h_output(cmd.infile, "-DRPC_HDR", DONT_EXTEND, cmd.outfile,
- cmd.hflag);
+ cmd.hflag, cmd.nflag);
} else if (cmd.lflag) {
l_output(cmd.infile, "-DRPC_CLNT", DONT_EXTEND, cmd.outfile);
} else if (cmd.sflag || cmd.mflag || (cmd.nflag)) {
@@ -193,7 +193,7 @@ main(argc, argv)
/* the rescans are required, since cpp may effect input */
c_output(cmd.infile, "-DRPC_XDR", EXTEND, "_xdr.c");
reinitialize();
- h_output(cmd.infile, "-DRPC_HDR", EXTEND, ".h", cmd.hflag);
+ h_output(cmd.infile, "-DRPC_HDR", EXTEND, ".h", cmd.hflag, cmd.nflag);
reinitialize();
l_output(cmd.infile, "-DRPC_CLNT", EXTEND, "_clnt.c");
reinitialize();
@@ -515,7 +515,7 @@ char *generate_guard(pathname)
static void
-h_output(char *infile, char *define, int extend, char *outfile, int headeronly)
+h_output(char *infile, char *define, int extend, char *outfile, int headeronly, int nomain)
{
definition *def;
char *outfilename;
@@ -555,7 +555,7 @@ h_output(char *infile, char *define, int
/* print data definitions */
while ( (def = get_definition()) ) {
- print_datadef(def, headeronly);
+ print_datadef(def, headeronly, nomain);
}
/*
@@ -564,7 +564,7 @@ h_output(char *infile, char *define, int
* arguments for functions
*/
for (l = defined; l != NULL; l = l->next) {
- print_funcdef(l->val, headeronly);
+ print_funcdef(l->val, headeronly, nomain);
}
/* Now print all xdr func declarations */
if (xdrfunc_head != NULL){
|