Deleted Added
full compact
rpc_svcout.c (100441) rpc_svcout.c (109363)
1/*
2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 * unrestricted use provided that this legend is included on all tape
4 * media and as a part of the software program in whole or part. Users
5 * may copy or modify Sun RPC without charge, but are not authorized
6 * to license or distribute it to anyone else except as part of a product or
7 * program developed by the user.
8 *

--- 22 unchanged lines hidden (view full) ---

31
32#if 0
33#ifndef lint
34static char sccsid[] = "@(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI";
35#endif
36#endif
37
38#include <sys/cdefs.h>
1/*
2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 * unrestricted use provided that this legend is included on all tape
4 * media and as a part of the software program in whole or part. Users
5 * may copy or modify Sun RPC without charge, but are not authorized
6 * to license or distribute it to anyone else except as part of a product or
7 * program developed by the user.
8 *

--- 22 unchanged lines hidden (view full) ---

31
32#if 0
33#ifndef lint
34static char sccsid[] = "@(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI";
35#endif
36#endif
37
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/usr.bin/rpcgen/rpc_svcout.c 100441 2002-07-21 12:55:04Z charnier $");
39__FBSDID("$FreeBSD: head/usr.bin/rpcgen/rpc_svcout.c 109363 2003-01-16 07:27:30Z mbr $");
40
41/*
42 * rpc_svcout.c, Server-skeleton outputter for the RPC protocol compiler
43 * Copyright (C) 1987, Sun Microsystems, Inc.
44 */
45#include <stdio.h>
46#include <string.h>
47#include "rpc_parse.h"

--- 94 unchanged lines hidden (view full) ---

142 write_programs(nomain? (char *)NULL : "static");
143
144 if (nomain)
145 return;
146
147 f_print(fout, "\nint\n");
148 f_print(fout, "main()\n");
149 f_print(fout, "{\n");
40
41/*
42 * rpc_svcout.c, Server-skeleton outputter for the RPC protocol compiler
43 * Copyright (C) 1987, Sun Microsystems, Inc.
44 */
45#include <stdio.h>
46#include <string.h>
47#include "rpc_parse.h"

--- 94 unchanged lines hidden (view full) ---

142 write_programs(nomain? (char *)NULL : "static");
143
144 if (nomain)
145 return;
146
147 f_print(fout, "\nint\n");
148 f_print(fout, "main()\n");
149 f_print(fout, "{\n");
150 if (tirpcflag) {
151 if (!inetdflag)
152 f_print(fout, "\t");
153 f_print(fout, "\tint maxrec = RPC_MAXDATASIZE;\n");
154 }
150 if (inetdflag) {
151 write_inetmost(infile);
152 /* Includes call to write_rpc_svc_fg() */
153 } else {
154 if (tirpcflag) {
155 if (netflag) {
156 f_print(fout,
157 "\tregister SVCXPRT *%s;\n", TRANSP);

--- 49 unchanged lines hidden (view full) ---

207 f_print(fout, "\n");
208 f_print(fout, "%s\tnconf = getnetconfigent(\"%s\");\n", sp, transp);
209 f_print(fout, "%s\tif (nconf == NULL) {\n", sp);
210 (void) sprintf(_errbuf, "cannot find %s netid.", transp);
211 sprintf(tmpbuf, "%s\t\t", sp);
212 print_err_message(tmpbuf);
213 f_print(fout, "%s\t\texit(1);\n", sp);
214 f_print(fout, "%s\t}\n", sp);
155 if (inetdflag) {
156 write_inetmost(infile);
157 /* Includes call to write_rpc_svc_fg() */
158 } else {
159 if (tirpcflag) {
160 if (netflag) {
161 f_print(fout,
162 "\tregister SVCXPRT *%s;\n", TRANSP);

--- 49 unchanged lines hidden (view full) ---

212 f_print(fout, "\n");
213 f_print(fout, "%s\tnconf = getnetconfigent(\"%s\");\n", sp, transp);
214 f_print(fout, "%s\tif (nconf == NULL) {\n", sp);
215 (void) sprintf(_errbuf, "cannot find %s netid.", transp);
216 sprintf(tmpbuf, "%s\t\t", sp);
217 print_err_message(tmpbuf);
218 f_print(fout, "%s\t\texit(1);\n", sp);
219 f_print(fout, "%s\t}\n", sp);
215 f_print(fout, "%s\t%s = svc_tli_create(RPC_ANYFD, nconf, 0, 0, 0);\n",
216 sp, TRANSP);
220 if (tirpcflag) {
221 f_print(fout, "%s\t%s = svc_tli_create(RPC_ANYFD, ",
222 sp, TRANSP);
223 f_print(fout,"nconf, 0, RPC_MAXDATASIZE, RPC_MAXDATASIZE);\n");
224 } else {
225 f_print(fout,
226 "%s\t%s = svc_tli_create(RPC_ANYFD, nconf, 0, 0, 0);\n",
227 sp, TRANSP);
228 }
217 f_print(fout, "%s\tif (%s == NULL) {\n", sp, TRANSP);
218 (void) sprintf(_errbuf, "cannot create %s service.", transp);
219 print_err_message(tmpbuf);
220 f_print(fout, "%s\t\texit(1);\n", sp);
221 f_print(fout, "%s\t}\n", sp);
222
223 for (l = defined; l != NULL; l = l->next) {
224 def = (definition *) l->val;

--- 31 unchanged lines hidden (view full) ---

256 definition *def;
257 version_list *vp;
258
259 for (l = defined; l != NULL; l = l->next) {
260 def = (definition *) l->val;
261 if (def->def_kind != DEF_PROGRAM) {
262 continue;
263 }
229 f_print(fout, "%s\tif (%s == NULL) {\n", sp, TRANSP);
230 (void) sprintf(_errbuf, "cannot create %s service.", transp);
231 print_err_message(tmpbuf);
232 f_print(fout, "%s\t\texit(1);\n", sp);
233 f_print(fout, "%s\t}\n", sp);
234
235 for (l = defined; l != NULL; l = l->next) {
236 def = (definition *) l->val;

--- 31 unchanged lines hidden (view full) ---

268 definition *def;
269 version_list *vp;
270
271 for (l = defined; l != NULL; l = l->next) {
272 def = (definition *) l->val;
273 if (def->def_kind != DEF_PROGRAM) {
274 continue;
275 }
276 if (tirpcflag) {
277 f_print(fout,
278 "\trpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);\n");
279 }
264 for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
265 f_print(fout, "\tif (!svc_create(");
266 pvname(def->def_name, vp->vers_num);
267 f_print(fout, ", %s, %s, \"%s\")) {\n",
268 def->def_name, vp->vers_name, transp);
269 (void) sprintf(_errbuf,
270 "unable to create (%s, %s) for %s.",
271 def->def_name, vp->vers_name, transp);

--- 660 unchanged lines hidden (view full) ---

932 f_print(fout, "\t\t\tif (ioctl(0, I_POP, 0) || ");
933 f_print(fout, "ioctl(0, I_PUSH, \"timod\")) {\n");
934 sprintf(_errbuf, "could not get the right module");
935 print_err_message("\t\t\t\t");
936 f_print(fout, "\t\t\t\texit(1);\n");
937 f_print(fout, "\t\t\t}\n");
938 f_print(fout, "\t\t}\n");
939 }
280 for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) {
281 f_print(fout, "\tif (!svc_create(");
282 pvname(def->def_name, vp->vers_num);
283 f_print(fout, ", %s, %s, \"%s\")) {\n",
284 def->def_name, vp->vers_name, transp);
285 (void) sprintf(_errbuf,
286 "unable to create (%s, %s) for %s.",
287 def->def_name, vp->vers_name, transp);

--- 660 unchanged lines hidden (view full) ---

948 f_print(fout, "\t\t\tif (ioctl(0, I_POP, 0) || ");
949 f_print(fout, "ioctl(0, I_PUSH, \"timod\")) {\n");
950 sprintf(_errbuf, "could not get the right module");
951 print_err_message("\t\t\t\t");
952 f_print(fout, "\t\t\t\texit(1);\n");
953 f_print(fout, "\t\t\t}\n");
954 f_print(fout, "\t\t}\n");
955 }
940 f_print(fout,
941 "\t\tif ((%s = svc_tli_create(0, nconf, NULL, 0, 0)) \
942== NULL) {\n",
956 if (tirpcflag) {
957 f_print(fout,
958 "\t\tif ((%s = svc_tli_create(0, nconf, NULL, \
959 RPC_MAXDATASIZE, RPC_MAXDATASIZE)) \
960 == NULL) {\n",
943 TRANSP);
961 TRANSP);
962 } else {
963 f_print(fout,
964 "\t\tif ((%s = svc_tli_create(0, nconf, NULL, 0, 0)) \
965 == NULL) {\n",
966 TRANSP);
967 }
944 sprintf(_errbuf, "cannot create server handle");
945 print_err_message("\t\t\t");
946 f_print(fout, "\t\t\texit(1);\n");
947 f_print(fout, "\t\t}\n");
948 f_print(fout, "\t\tif (nconf)\n");
949 f_print(fout, "\t\t\tfreenetconfigent(nconf);\n");
950 for (l = defined; l != NULL; l = l->next) {
951 def = (definition *) l->val;

--- 122 unchanged lines hidden (view full) ---

1074 else
1075 isudp = 0;
1076 f_print(fout, "\n");
1077 if (inetdflag) {
1078 f_print(fout,
1079 "\tif ((_rpcfdtype == 0) || (_rpcfdtype == %s)) {\n",
1080 isudp ? "SOCK_DGRAM" : "SOCK_STREAM");
1081 }
968 sprintf(_errbuf, "cannot create server handle");
969 print_err_message("\t\t\t");
970 f_print(fout, "\t\t\texit(1);\n");
971 f_print(fout, "\t\t}\n");
972 f_print(fout, "\t\tif (nconf)\n");
973 f_print(fout, "\t\t\tfreenetconfigent(nconf);\n");
974 for (l = defined; l != NULL; l = l->next) {
975 def = (definition *) l->val;

--- 122 unchanged lines hidden (view full) ---

1098 else
1099 isudp = 0;
1100 f_print(fout, "\n");
1101 if (inetdflag) {
1102 f_print(fout,
1103 "\tif ((_rpcfdtype == 0) || (_rpcfdtype == %s)) {\n",
1104 isudp ? "SOCK_DGRAM" : "SOCK_STREAM");
1105 }
1106 if (tirpcflag)
1107 f_print(fout, "\t\trpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);\n");
1082 f_print(fout, "%s\t%s = svc%s_create(%s",
1083 sp, TRANSP, transp, inetdflag? "sock": "RPC_ANYSOCK");
1084 if (!isudp)
1085 f_print(fout, ", 0, 0");
1086 f_print(fout, ");\n");
1087 f_print(fout, "%s\tif (%s == NULL) {\n", sp, TRANSP);
1088 (void) sprintf(_errbuf, "cannot create %s service.", transp);
1089 (void) sprintf(tmpbuf, "%s\t\t", sp);

--- 34 unchanged lines hidden ---
1108 f_print(fout, "%s\t%s = svc%s_create(%s",
1109 sp, TRANSP, transp, inetdflag? "sock": "RPC_ANYSOCK");
1110 if (!isudp)
1111 f_print(fout, ", 0, 0");
1112 f_print(fout, ");\n");
1113 f_print(fout, "%s\tif (%s == NULL) {\n", sp, TRANSP);
1114 (void) sprintf(_errbuf, "cannot create %s service.", transp);
1115 (void) sprintf(tmpbuf, "%s\t\t", sp);

--- 34 unchanged lines hidden ---