1 /* $NetBSD: rpc_main.c,v 1.32 2008/03/08 19:49:08 christos Exp $ */
4 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5 * unrestricted use provided that this legend is included on all tape
6 * media and as a part of the software program in whole or part. Users
7 * may copy or modify Sun RPC without charge, but are not authorized
8 * to license or distribute it to anyone else except as part of a product or
9 * program developed by the user or with the express written consent of
10 * Sun Microsystems, Inc.
12 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
13 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
14 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
16 * Sun RPC is provided with no support and without any obligation on the
17 * part of Sun Microsystems, Inc. to assist in its use, correction,
18 * modification or enhancement.
20 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
21 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
22 * OR ANY PART THEREOF.
24 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
25 * or profits or other special, indirect and consequential damages, even if
26 * Sun has been advised of the possibility of such damages.
28 * Sun Microsystems, Inc.
30 * Mountain View, California 94043
33 #if HAVE_NBTOOL_CONFIG_H
34 #include "nbtool_config.h"
37 #include <sys/cdefs.h>
38 #if defined(__RCSID) && !defined(lint)
40 static char sccsid
[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
42 __RCSID("$NetBSD: rpc_main.c,v 1.32 2008/03/08 19:49:08 christos Exp $");
47 * rpc_main.c, Top level of the RPC protocol compiler.
50 #define RPCGEN_VERSION "199506"/* This program's version (year & month) */
52 #include <sys/types.h>
53 #include <sys/param.h>
63 #include "rpc_parse.h"
66 #define EXTEND 1 /* alias for TRUE */
67 #define DONT_EXTEND 0 /* alias for FALSE */
70 int cflag
; /* xdr C routines */
71 int hflag
; /* header file */
72 int lflag
; /* client side stubs */
73 int mflag
; /* server side stubs */
74 int nflag
; /* netid flag */
75 int sflag
; /* server stubs for the given transport */
76 int tflag
; /* dispatch Table file */
77 int Ssflag
; /* produce server sample code */
78 int Scflag
; /* produce client sample code */
79 char *infile
; /* input module name */
80 char *outfile
; /* output module name */
86 static char *svcclosetime
= "120";
88 static char CPPFLAGS
[] = "-C";
89 static char pathbuf
[MAXPATHLEN
+ 1];
90 static char *allv
[] = {
91 "rpcgen", "-s", "udp", "-s", "tcp",
93 static int allc
= sizeof(allv
) / sizeof(allv
[0]);
94 static char *allnv
[] = {
95 "rpcgen", "-s", "netpath",
97 static int allnc
= sizeof(allnv
) / sizeof(allnv
[0]);
102 static char *arglist
[ARGLISTLEN
];
103 static int argcount
= FIXEDARGS
;
106 int nonfatalerrors
; /* errors */
107 int inetdflag
/* = 1 */ ; /* Support for inetd *//* is now the default */
108 int pmflag
; /* Support for port monitors */
109 int logflag
; /* Use syslog instead of fprintf for errors */
110 int tblflag
; /* Support for dispatch table file */
111 int callerflag
; /* Generate svc_caller() function */
114 /*length at which to start doing an inline */
116 int doinline
= INLINE
; /* length at which to start doing an inline. 3
117 * = default if 0, no xdr_inline code */
119 int indefinitewait
; /* If started by port monitors, hang till it
121 int exitnow
; /* If started by port monitors, exit after the
123 int timerflag
; /* TRUE if !indefinite && !exitnow */
124 int newstyle
; /* newstyle of passing arguments (by value) */
125 int Cflag
= 0; /* ANSI C syntax */
126 int Mflag
= 0; /* multithread safe */
127 static int allfiles
; /* generate all files */
128 int tirpcflag
= 1; /* generating code for tirpc, by default */
131 static char *dos_cppfile
= NULL
;
134 int main
__P((int, char *[]));
136 static char *extendfile
__P((char *, char *));
137 static void open_output
__P((char *, char *));
138 static void add_warning
__P((void));
139 static void clear_args
__P((void));
140 static void open_input
__P((char *, char *));
141 static int check_nettype
__P((char *, char *[]));
142 static void c_output
__P((char *, char *, int, char *));
143 static void c_initialize
__P((void));
144 static char *generate_guard
__P((char *));
145 static void h_output
__P((char *, char *, int, char *));
146 static void s_output
__P((int, char *[], char *, char *, int, char *, int, int));
147 static void l_output
__P((char *, char *, int, char *));
148 static void t_output
__P((char *, char *, int, char *));
149 static void svc_output
__P((char *, char *, int, char *));
150 static void clnt_output
__P((char *, char *, int, char *));
151 static int do_registers
__P((int, char *[]));
152 static void addarg
__P((char *));
153 static void putarg
__P((int, char *));
154 static void checkfiles
__P((char *, char *));
155 static int parseargs
__P((int, char *[], struct commandline
*));
156 static void usage
__P((void));
157 static void options_usage
__P((void));
164 struct commandline cmd
;
166 setprogname(argv
[0]);
167 if (!(CPP
= getenv("RPCGEN_CPP")))
168 CPP
= "/usr/bin/cpp";
170 (void) memset((char *) &cmd
, 0, sizeof(struct commandline
));
172 if (!parseargs(argc
, argv
, &cmd
))
175 if (cmd
.cflag
|| cmd
.hflag
|| cmd
.lflag
|| cmd
.tflag
|| cmd
.sflag
||
176 cmd
.mflag
|| cmd
.nflag
|| cmd
.Ssflag
|| cmd
.Scflag
) {
177 checkfiles(cmd
.infile
, cmd
.outfile
);
179 checkfiles(cmd
.infile
, NULL
);
182 c_output(cmd
.infile
, "-DRPC_XDR", DONT_EXTEND
, cmd
.outfile
);
185 h_output(cmd
.infile
, "-DRPC_HDR", DONT_EXTEND
, cmd
.outfile
);
188 l_output(cmd
.infile
, "-DRPC_CLNT", DONT_EXTEND
, cmd
.outfile
);
190 if (cmd
.sflag
|| cmd
.mflag
|| (cmd
.nflag
)) {
191 s_output(argc
, argv
, cmd
.infile
, "-DRPC_SVC", DONT_EXTEND
,
192 cmd
.outfile
, cmd
.mflag
, cmd
.nflag
);
195 t_output(cmd
.infile
, "-DRPC_TBL", DONT_EXTEND
, cmd
.outfile
);
198 svc_output(cmd
.infile
, "-DRPC_SERVER", DONT_EXTEND
, cmd
.outfile
);
201 clnt_output(cmd
.infile
, "-DRPC_CLIENT", DONT_EXTEND
, cmd
.outfile
);
209 c_output(cmd
.infile
, "-DRPC_XDR", EXTEND
, "_xdr.c");
211 h_output(cmd
.infile
, "-DRPC_HDR", EXTEND
, ".h");
213 l_output(cmd
.infile
, "-DRPC_CLNT", EXTEND
, "_clnt.c");
215 if (inetdflag
|| !tirpcflag
)
216 s_output(allc
, allv
, cmd
.infile
, "-DRPC_SVC", EXTEND
,
217 "_svc.c", cmd
.mflag
, cmd
.nflag
);
219 s_output(allnc
, allnv
, cmd
.infile
, "-DRPC_SVC",
220 EXTEND
, "_svc.c", cmd
.mflag
, cmd
.nflag
);
223 t_output(cmd
.infile
, "-DRPC_TBL", EXTEND
, "_tbl.i");
227 svc_output(cmd
.infile
, "-DRPC_SERVER", EXTEND
, "_server.c");
231 clnt_output(cmd
.infile
, "-DRPC_CLIENT", EXTEND
, "_client.c");
235 if (dos_cppfile
!= NULL
) {
237 (void) unlink(dos_cppfile
);
240 exit(nonfatalerrors
);
244 * add extension to filename
247 extendfile(path
, ext
)
255 if ((file
= strrchr(path
, '/')) == NULL
)
260 res
= alloc(strlen(file
) + strlen(ext
) + 1);
262 errx(1, "Out of memory");
264 p
= strrchr(file
, '.');
266 p
= file
+ strlen(file
);
268 (void) strcpy(res
, file
);
269 (void) strcpy(res
+ (p
- file
), ext
);
273 * Open output file with given extension
276 open_output(infile
, outfile
)
281 if (outfile
== NULL
) {
285 if (infile
!= NULL
&& streq(outfile
, infile
)) {
286 f_print(stderr
, "%s: output would overwrite %s\n", cmdname
,
290 fout
= fopen(outfile
, "w");
292 f_print(stderr
, "%s: unable to open ", cmdname
);
296 record_open(outfile
);
303 f_print(fout
, "/*\n");
304 f_print(fout
, " * Please do not edit this file.\n");
305 f_print(fout
, " * It was generated using rpcgen.\n");
306 f_print(fout
, " */\n\n");
308 /* clear list of arguments */
313 for (i
= FIXEDARGS
; i
< ARGLISTLEN
; i
++)
315 argcount
= FIXEDARGS
;
319 * Open input file with given define for C-preprocessor
322 open_input(infile
, define
)
328 infilename
= (infile
== NULL
) ? "<stdin>" : infile
;
330 #define DOSCPP "\\prog\\bc31\\bin\\cpp.exe"
333 char drive
[MAXDRIVE
], dir
[MAXDIR
], name
[MAXFILE
], ext
[MAXEXT
];
334 char cppfile
[MAXPATH
];
337 if ((cpp
= getenv("RPCGEN_CPP")) == NULL
&&
338 (cpp
= searchpath("cpp.exe")) == NULL
)
348 retval
= spawnvp(P_WAIT
, arglist
[0], arglist
);
350 fprintf(stderr
, "%s: C PreProcessor failed\n", cmdname
);
353 fnsplit(infile
, drive
, dir
, name
, ext
);
354 fnmerge(cppfile
, drive
, dir
, name
, ".i");
356 fin
= fopen(cppfile
, "r");
358 f_print(stderr
, "%s: ", cmdname
);
362 dos_cppfile
= strdup(cppfile
);
363 if (dos_cppfile
== NULL
) {
364 fprintf(stderr
, "%s: out of memory\n", cmdname
);
376 addarg((char *) NULL
);
378 (void) dup2(pd
[1], 1);
380 execvp(arglist
[0], arglist
);
381 err(1, "$RPCGEN_CPP: %s", CPP
);
386 fin
= fdopen(pd
[0], "r");
389 f_print(stderr
, "%s: ", cmdname
);
394 /* valid tirpc nettypes */
395 static char *valid_ti_nettypes
[] =
408 /* valid inetd nettypes */
409 static char *valid_i_nettypes
[] =
417 check_nettype(name
, list_to_check
)
419 char *list_to_check
[];
422 for (i
= 0; list_to_check
[i
] != NULL
; i
++) {
423 if (strcmp(name
, list_to_check
[i
]) == 0) {
427 f_print(stderr
, "illegal nettype :\'%s\'\n", name
);
431 * Compile into an XDR routine output file
435 c_output(infile
, define
, extend
, outfile
)
447 open_input(infile
, define
);
448 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
449 open_output(infile
, outfilename
);
451 if (infile
&& (include
= extendfile(infile
, ".h"))) {
452 f_print(fout
, "#include \"%s\"\n", include
);
454 /* .h file already contains rpc/rpc.h */
456 f_print(fout
, "#include <rpc/rpc.h>\n");
458 while ((def
= get_definition()) != NULL
) {
461 if (extend
&& tell
== ftell(fout
)) {
462 (void) unlink(outfilename
);
471 /* add all the starting basic types */
475 add_type(1, "short");
478 add_type(1, "u_int");
479 add_type(1, "u_long");
480 add_type(1, "u_short");
484 const char rpcgen_table_dcl
[] = "struct rpcgen_table {\n\
486 xdrproc_t xdr_arg;\n\
488 xdrproc_t xdr_res;\n\
494 generate_guard(pathname
)
497 char *filename
, *guard
, *tmp
, *tmp2
;
499 filename
= strrchr(pathname
, '/'); /* find last component */
500 filename
= ((filename
== 0) ? pathname
: filename
+ 1);
501 guard
= strdup(filename
);
502 /* convert to upper case */
505 *tmp
= toupper((unsigned char)*tmp
);
509 tmp2
= extendfile(guard
, "_H_RPCGEN");
515 * Compile into an XDR header file
519 h_output(infile
, define
, extend
, outfile
)
531 open_input(infile
, define
);
532 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
533 open_output(infile
, outfilename
);
535 if (outfilename
|| infile
)
536 guard
= generate_guard(outfilename
? outfilename
: infile
);
540 f_print(fout
, "#ifndef _%s\n#define _%s\n\n", guard
,
543 f_print(fout
, "#define RPCGEN_VERSION\t%s\n\n", RPCGEN_VERSION
);
544 f_print(fout
, "#include <rpc/rpc.h>\n\n");
547 /* print data definitions */
548 while ((def
= get_definition()) != NULL
) {
552 /* print function declarations. Do this after data definitions
553 * because they might be used as arguments for functions */
554 for (l
= defined
; l
!= NULL
; l
= l
->next
) {
555 print_funcdef(l
->val
);
557 if (extend
&& tell
== ftell(fout
)) {
558 (void) unlink(outfilename
);
561 f_print(fout
, rpcgen_table_dcl
);
563 f_print(fout
, "\n#endif /* !_%s */\n", guard
);
568 * Compile into an RPC service
571 s_output(argc
, argv
, infile
, define
, extend
, outfile
, nomain
, netflag
)
583 int foundprogram
= 0;
586 open_input(infile
, define
);
587 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
588 open_output(infile
, outfilename
);
590 if (infile
&& (include
= extendfile(infile
, ".h"))) {
591 f_print(fout
, "#include \"%s\"\n", include
);
594 f_print(fout
, "#include <rpc/rpc.h>\n");
596 f_print(fout
, "#include <sys/ioctl.h>\n");
597 f_print(fout
, "#include <fcntl.h>\n");
598 f_print(fout
, "#include <stdio.h>\n");
599 f_print(fout
, "#include <stdlib.h>\n");
601 f_print(fout
, "#include <unistd.h>\n");
603 "#include <rpc/pmap_clnt.h>\n");
604 f_print(fout
, "#include <string.h>\n");
606 f_print(fout
, "#include <netdb.h>\n");
607 if (strcmp(svcclosetime
, "-1") == 0)
610 if (strcmp(svcclosetime
, "0") == 0)
613 if (inetdflag
|| pmflag
) {
614 f_print(fout
, "#include <signal.h>\n");
617 if (!tirpcflag
&& inetdflag
)
618 f_print(fout
, "#include <sys/ttycom.h>\n");
619 if (Cflag
&& (inetdflag
|| pmflag
)) {
620 f_print(fout
, "#ifdef __cplusplus\n");
621 f_print(fout
, "#include <sysent.h>\n");
622 f_print(fout
, "#endif /* __cplusplus */\n");
625 f_print(fout
, "#include <sys/types.h>\n");
627 f_print(fout
, "#include <memory.h>\n");
629 if (inetdflag
|| !tirpcflag
) {
630 f_print(fout
, "#include <sys/socket.h>\n");
631 f_print(fout
, "#include <netinet/in.h>\n");
633 if ((netflag
|| pmflag
) && tirpcflag
) {
634 f_print(fout
, "#include <netconfig.h>\n");
636 if ( /* timerflag && */ tirpcflag
)
637 f_print(fout
, "#include <sys/resource.h>\n");
638 if (logflag
|| inetdflag
|| pmflag
)
639 f_print(fout
, "#include <syslog.h>\n");
642 f_print(fout
, "\n#ifdef __STDC__\n#define SIG_PF void(*)(int)\n#endif\n");
644 f_print(fout
, "\n#ifdef DEBUG\n#define RPC_SVC_FG\n#endif\n");
646 f_print(fout
, "\n#define _RPCSVC_CLOSEDOWN %s\n", svcclosetime
);
647 while ((def
= get_definition()) != NULL
) {
648 foundprogram
|= (def
->def_kind
== DEF_PROGRAM
);
650 if (extend
&& !foundprogram
) {
651 (void) unlink(outfilename
);
654 if (callerflag
) /* EVAS */
655 f_print(fout
, "\nstatic SVCXPRT *caller;\n"); /* EVAS */
656 write_most(infile
, netflag
, nomain
);
658 if (!do_registers(argc
, argv
)) {
660 (void) unlink(outfilename
);
667 * generate client side stubs
670 l_output(infile
, define
, extend
, outfile
)
678 int foundprogram
= 0;
681 open_input(infile
, define
);
682 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
683 open_output(infile
, outfilename
);
686 f_print(fout
, "#include <memory.h>\n");
687 if (infile
&& (include
= extendfile(infile
, ".h"))) {
688 f_print(fout
, "#include \"%s\"\n", include
);
691 f_print(fout
, "#include <rpc/rpc.h>\n");
692 while ((def
= get_definition()) != NULL
) {
693 foundprogram
|= (def
->def_kind
== DEF_PROGRAM
);
695 if (extend
&& !foundprogram
) {
696 (void) unlink(outfilename
);
702 * generate the dispatch table
705 t_output(infile
, define
, extend
, outfile
)
712 int foundprogram
= 0;
715 open_input(infile
, define
);
716 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
717 open_output(infile
, outfilename
);
719 while ((def
= get_definition()) != NULL
) {
720 foundprogram
|= (def
->def_kind
== DEF_PROGRAM
);
722 if (extend
&& !foundprogram
) {
723 (void) unlink(outfilename
);
728 /* sample routine for the server template */
730 svc_output(infile
, define
, extend
, outfile
)
741 open_input(infile
, define
);
742 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
743 checkfiles(infile
, outfilename
); /* check if outfile already
744 * exists. if so, print an
745 * error message and exit */
746 open_output(infile
, outfilename
);
749 if (infile
&& (include
= extendfile(infile
, ".h"))) {
750 f_print(fout
, "#include \"%s\"\n", include
);
753 f_print(fout
, "#include <rpc/rpc.h>\n");
756 while ((def
= get_definition()) != NULL
) {
757 write_sample_svc(def
);
759 if (extend
&& tell
== ftell(fout
)) {
760 (void) unlink(outfilename
);
765 /* sample main routine for client */
767 clnt_output(infile
, define
, extend
, outfile
)
779 open_input(infile
, define
);
780 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
781 checkfiles(infile
, outfilename
); /* check if outfile already
782 * exists. if so, print an
783 * error message and exit */
785 open_output(infile
, outfilename
);
788 f_print(fout
, "#include <stdio.h>\n");
789 if (infile
&& (include
= extendfile(infile
, ".h"))) {
790 f_print(fout
, "#include \"%s\"\n", include
);
793 f_print(fout
, "#include <rpc/rpc.h>\n");
795 while ((def
= get_definition()) != NULL
) {
796 has_program
+= write_sample_clnt(def
);
800 write_sample_clnt_main();
802 if (extend
&& tell
== ftell(fout
)) {
803 (void) unlink(outfilename
);
807 * Perform registrations for service output
808 * Return 0 if failed; 1 otherwise.
811 do_registers(argc
, argv
)
817 if (inetdflag
|| !tirpcflag
) {
818 for (i
= 1; i
< argc
; i
++) {
819 if (streq(argv
[i
], "-s")) {
820 if (!check_nettype(argv
[i
+ 1], valid_i_nettypes
))
822 write_inetd_register(argv
[i
+ 1]);
827 for (i
= 1; i
< argc
; i
++)
828 if (streq(argv
[i
], "-s")) {
829 if (!check_nettype(argv
[i
+ 1], valid_ti_nettypes
))
831 write_nettype_register(argv
[i
+ 1]);
834 if (streq(argv
[i
], "-n")) {
835 write_netid_register(argv
[i
+ 1]);
842 * Add another argument to the arg list
848 if (argcount
>= ARGLISTLEN
) {
849 f_print(stderr
, "rpcgen: too many defines\n");
853 arglist
[argcount
++] = cp
;
862 if (pwhere
>= ARGLISTLEN
) {
863 f_print(stderr
, "rpcgen: arglist coding error\n");
867 arglist
[pwhere
] = cp
;
871 * if input file is stdin and an output file is specified then complain
872 * if the file already exists. Otherwise the file may get overwritten
873 * If input file does not exist, exit with an error
877 checkfiles(infile
, outfile
)
884 if (infile
) /* infile ! = NULL */
885 if (stat(infile
, &buf
) < 0) {
891 if (stat(outfile
, &buf
) < 0)
892 return; /* file does not exist */
895 "file '%s' already exists and may be overwritten\n", outfile
);
902 * Parse command line arguments
905 parseargs(argc
, argv
, cmd
)
908 struct commandline
*cmd
;
913 char flag
[1 << CHAR_BIT
];
917 cmd
->infile
= cmd
->outfile
= NULL
;
932 for (i
= 1; i
< argc
; i
++) {
933 if (argv
[i
][0] != '-') {
935 f_print(stderr
, "Cannot specify more than one input file!\n");
939 cmd
->infile
= argv
[i
];
941 for (j
= 1; argv
[i
][j
] != 0; j
++) {
961 /* sample flag: Ss or Sc. Ss means set
962 * flag['S']; Sc means set flag['C']; */
963 c
= argv
[i
][++j
]; /* get next char */
977 case 'C': /* ANSI C syntax */
981 case 'b': /* turn TIRPC flag off for
982 * generating backward
1003 svcclosetime
= argv
[i
];
1012 doinline
= atoi(argv
[i
]);
1017 if (argv
[i
][j
- 1] != '-' ||
1018 argv
[i
][j
+ 1] != 0) {
1026 if (!streq(argv
[i
], "udp") &&
1027 !streq(argv
[i
], "tcp")) {
1035 cmd
->outfile
= argv
[i
];
1039 if (argv
[i
][j
- 1] != '-') {
1042 (void) addarg(argv
[i
]);
1048 (void) strlcpy(pathbuf
, argv
[i
],
1050 (void) strlcat(pathbuf
, "/cpp",
1056 printf("version 1.0\n");
1068 cmd
->cflag
= flag
['c'];
1069 cmd
->hflag
= flag
['h'];
1070 cmd
->lflag
= flag
['l'];
1071 cmd
->mflag
= flag
['m'];
1072 cmd
->nflag
= flag
['n'];
1073 cmd
->sflag
= flag
['s'];
1074 cmd
->tflag
= flag
['t'];
1075 cmd
->Ssflag
= flag
['S'];
1076 cmd
->Scflag
= flag
['C'];
1079 pmflag
= inetdflag
? 0 : 1; /* pmflag or inetdflag is
1081 if ((inetdflag
&& cmd
->nflag
)) { /* netid not allowed
1083 f_print(stderr
, "Cannot use netid flag with inetd flag!\n");
1086 } else { /* 4.1 mode */
1087 pmflag
= 0; /* set pmflag only in tirpcmode */
1088 inetdflag
= 1; /* inetdflag is TRUE by default */
1089 if (cmd
->nflag
) { /* netid needs TIRPC */
1090 f_print(stderr
, "Cannot use netid flag without TIRPC!\n");
1095 if (newstyle
&& (tblflag
|| cmd
->tflag
)) {
1096 f_print(stderr
, "Cannot use table flags with newstyle!\n");
1099 /* check no conflicts with file generation flags */
1100 nflags
= cmd
->cflag
+ cmd
->hflag
+ cmd
->lflag
+ cmd
->mflag
+
1101 cmd
->sflag
+ cmd
->nflag
+ cmd
->tflag
+ cmd
->Ssflag
+ cmd
->Scflag
;
1104 if (cmd
->outfile
!= NULL
|| cmd
->infile
== NULL
) {
1109 f_print(stderr
, "Cannot have more than one file generation flag!\n");
1118 f_print(stderr
, "usage: %s infile\n", cmdname
);
1119 f_print(stderr
, "\t%s [-a][-b][-C][-Dname[=value]] -i size [-I [-K seconds]] [-A] [-M] [-N] [-T] infile\n",
1121 f_print(stderr
, "\t%s [-L] [-M] [-c | -h | -l | -m | -t | -Sc | -Ss] [-o outfile] [infile]\n",
1123 f_print(stderr
, "\t%s [-s nettype]* [-o outfile] [infile]\n", cmdname
);
1124 f_print(stderr
, "\t%s [-n netid]* [-o outfile] [infile]\n", cmdname
);
1132 f_print(stderr
, "options:\n");
1133 f_print(stderr
, "-A\t\tgenerate svc_caller() function\n");
1134 f_print(stderr
, "-a\t\tgenerate all files, including samples\n");
1135 f_print(stderr
, "-b\t\tbackward compatibility mode (generates code for SunOS 4.1)\n");
1136 f_print(stderr
, "-c\t\tgenerate XDR routines\n");
1137 f_print(stderr
, "-C\t\tANSI C mode\n");
1138 f_print(stderr
, "-Dname[=value]\tdefine a symbol (same as #define)\n");
1139 f_print(stderr
, "-h\t\tgenerate header file\n");
1140 f_print(stderr
, "-i size\t\tsize at which to start generating inline code\n");
1141 f_print(stderr
, "-I\t\tgenerate code for inetd support in server (for SunOS 4.1)\n");
1142 f_print(stderr
, "-K seconds\tserver exits after K seconds of inactivity\n");
1143 f_print(stderr
, "-l\t\tgenerate client side stubs\n");
1144 f_print(stderr
, "-L\t\tserver errors will be printed to syslog\n");
1145 f_print(stderr
, "-m\t\tgenerate server side stubs\n");
1146 f_print(stderr
, "-M\t\tgenerate thread-safe stubs\n");
1147 f_print(stderr
, "-n netid\tgenerate server code that supports named netid\n");
1148 f_print(stderr
, "-N\t\tsupports multiple arguments and call-by-value\n");
1149 f_print(stderr
, "-o outfile\tname of the output file\n");
1150 f_print(stderr
, "-s nettype\tgenerate server code that supports named nettype\n");
1151 f_print(stderr
, "-Sc\t\tgenerate sample client code that uses remote procedures\n");
1152 f_print(stderr
, "-Ss\t\tgenerate sample server code that defines remote procedures\n");
1153 f_print(stderr
, "-t\t\tgenerate RPC dispatch table\n");
1154 f_print(stderr
, "-T\t\tgenerate code to support RPC dispatch tables\n");
1155 f_print(stderr
, "-Y path\t\tdirectory name to find C preprocessor (cpp)\n");