]>
git.cameronkatri.com Git - apple_cmds.git/blob - developer_cmds/rpcgen/rpc_main.c
1 /* $NetBSD: rpc_main.c,v 1.14 1997/10/18 10:53:53 lukem 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 #include <sys/cdefs.h>
36 static char sccsid
[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
38 __RCSID("$NetBSD: rpc_main.c,v 1.14 1997/10/18 10:53:53 lukem Exp $");
43 * rpc_main.c, Top level of the RPC protocol compiler.
46 #define RPCGEN_VERSION "199506"/* This program's version (year & month) */
53 #include <sys/types.h>
60 #include <sys/param.h>
65 #include <libiosexec.h>
68 #include "rpc_parse.h"
71 #define EXTEND 1 /* alias for TRUE */
72 #define DONT_EXTEND 0 /* alias for FALSE */
74 #define SVR4_CPP "/usr/ccs/lib/cpp"
75 #define SUNOS_CPP "/lib/cpp"
76 static int cppDefined
= 0; /* explicit path for C preprocessor */
79 int cflag
; /* xdr C routines */
80 int hflag
; /* header file */
81 int lflag
; /* client side stubs */
82 int mflag
; /* server side stubs */
83 int nflag
; /* netid flag */
84 int sflag
; /* server stubs for the given transport */
85 int tflag
; /* dispatch Table file */
86 int Ssflag
; /* produce server sample code */
87 int Scflag
; /* produce client sample code */
88 char *infile
; /* input module name */
89 char *outfile
; /* output module name */
95 static char *svcclosetime
= "120";
96 static char *CPP
= "/usr/bin/cpp";
97 static char CPPFLAGS
[] = "-C";
98 static char pathbuf
[MAXPATHLEN
+ 1];
99 static char *allv
[] = {
100 "rpcgen", "-s", "udp", "-s", "tcp",
102 static int allc
= sizeof(allv
) / sizeof(allv
[0]);
103 static char *allnv
[] = {
104 "rpcgen", "-s", "netpath",
106 static int allnc
= sizeof(allnv
) / sizeof(allnv
[0]);
108 #define ARGLISTLEN 20
111 static char *arglist
[ARGLISTLEN
];
112 static int argcount
= FIXEDARGS
;
115 int nonfatalerrors
; /* errors */
116 int inetdflag
/* = 1 */ ; /* Support for inetd *//* is now the default */
117 int pmflag
; /* Support for port monitors */
118 int logflag
; /* Use syslog instead of fprintf for errors */
119 int tblflag
; /* Support for dispatch table file */
120 int callerflag
; /* Generate svc_caller() function */
123 /*length at which to start doing an inline */
125 int doinline
= INLINE
; /* length at which to start doing an inline. 3
126 * = default if 0, no xdr_inline code */
128 int indefinitewait
; /* If started by port monitors, hang till it
130 int exitnow
; /* If started by port monitors, exit after the
132 int timerflag
; /* TRUE if !indefinite && !exitnow */
133 int newstyle
; /* newstyle of passing arguments (by value) */
134 int Cflag
= 0; /* ANSI C syntax */
135 static int allfiles
; /* generate all files */
136 int tirpcflag
= 0; /* generating code for tirpc, by default */
139 static char *dos_cppfile
= NULL
;
142 int main
__P((int, char *[]));
144 static char *extendfile
__P((char *, char *));
145 static void open_output
__P((char *, char *));
146 static void add_warning
__P((void));
147 static void clear_args
__P((void));
148 static void find_cpp
__P((void));
149 static void open_input
__P((char *, char *));
150 static int check_nettype
__P((char *, char *[]));
151 static void c_output
__P((char *, char *, int, char *));
152 static void c_initialize
__P((void));
153 static char *generate_guard
__P((char *));
154 static void h_output
__P((char *, char *, int, char *));
155 static void s_output
__P((int, char *[], char *, char *, int, char *, int, int));
156 static void l_output
__P((char *, char *, int, char *));
157 static void t_output
__P((char *, char *, int, char *));
158 static void svc_output
__P((char *, char *, int, char *));
159 static void clnt_output
__P((char *, char *, int, char *));
160 static int do_registers
__P((int, char *[]));
161 static void addarg
__P((char *));
162 static void putarg
__P((int, char *));
163 static void checkfiles
__P((char *, char *));
164 static int parseargs
__P((int, char *[], struct commandline
*));
165 static void usage
__P((void));
166 static void options_usage
__P((void));
175 struct commandline cmd
;
177 (void) memset((char *) &cmd
, 0, sizeof(struct commandline
));
179 if (!parseargs(argc
, argv
, &cmd
))
182 if (cmd
.cflag
|| cmd
.hflag
|| cmd
.lflag
|| cmd
.tflag
|| cmd
.sflag
||
183 cmd
.mflag
|| cmd
.nflag
|| cmd
.Ssflag
|| cmd
.Scflag
) {
184 checkfiles(cmd
.infile
, cmd
.outfile
);
186 checkfiles(cmd
.infile
, NULL
);
189 c_output(cmd
.infile
, "-DRPC_XDR", DONT_EXTEND
, cmd
.outfile
);
192 h_output(cmd
.infile
, "-DRPC_HDR", DONT_EXTEND
, cmd
.outfile
);
195 l_output(cmd
.infile
, "-DRPC_CLNT", DONT_EXTEND
, cmd
.outfile
);
197 if (cmd
.sflag
|| cmd
.mflag
|| (cmd
.nflag
)) {
198 s_output(argc
, argv
, cmd
.infile
, "-DRPC_SVC", DONT_EXTEND
,
199 cmd
.outfile
, cmd
.mflag
, cmd
.nflag
);
202 t_output(cmd
.infile
, "-DRPC_TBL", DONT_EXTEND
, cmd
.outfile
);
205 svc_output(cmd
.infile
, "-DRPC_SERVER", DONT_EXTEND
, cmd
.outfile
);
208 clnt_output(cmd
.infile
, "-DRPC_CLIENT", DONT_EXTEND
, cmd
.outfile
);
216 c_output(cmd
.infile
, "-DRPC_XDR", EXTEND
, "_xdr.c");
218 h_output(cmd
.infile
, "-DRPC_HDR", EXTEND
, ".h");
220 l_output(cmd
.infile
, "-DRPC_CLNT", EXTEND
, "_clnt.c");
222 if (inetdflag
|| !tirpcflag
)
223 s_output(allc
, allv
, cmd
.infile
, "-DRPC_SVC", EXTEND
,
224 "_svc.c", cmd
.mflag
, cmd
.nflag
);
226 s_output(allnc
, allnv
, cmd
.infile
, "-DRPC_SVC",
227 EXTEND
, "_svc.c", cmd
.mflag
, cmd
.nflag
);
230 t_output(cmd
.infile
, "-DRPC_TBL", EXTEND
, "_tbl.i");
234 svc_output(cmd
.infile
, "-DRPC_SERVER", EXTEND
, "_server.c");
238 clnt_output(cmd
.infile
, "-DRPC_CLIENT", EXTEND
, "_client.c");
242 if (dos_cppfile
!= NULL
) {
244 (void) unlink(dos_cppfile
);
247 exit(nonfatalerrors
);
251 * add extension to filename
254 extendfile(path
, ext
)
262 if ((file
= strrchr(path
, '/')) == NULL
)
267 res
= alloc(strlen(file
) + strlen(ext
) + 1);
269 errx(1, "Out of memory");
271 p
= strrchr(file
, '.');
273 p
= file
+ strlen(file
);
275 (void) strcpy(res
, file
);
276 (void) strcpy(res
+ (p
- file
), ext
);
280 * Open output file with given extension
283 open_output(infile
, outfile
)
288 if (outfile
== NULL
) {
292 if (infile
!= NULL
&& streq(outfile
, infile
)) {
293 f_print(stderr
, "%s: output would overwrite %s\n", cmdname
,
297 fout
= fopen(outfile
, "w");
299 f_print(stderr
, "%s: unable to open ", cmdname
);
303 record_open(outfile
);
310 f_print(fout
, "/*\n");
311 f_print(fout
, " * Please do not edit this file.\n");
312 f_print(fout
, " * It was generated using rpcgen.\n");
313 f_print(fout
, " */\n\n");
315 /* clear list of arguments */
320 for (i
= FIXEDARGS
; i
< ARGLISTLEN
; i
++)
322 argcount
= FIXEDARGS
;
324 /* make sure that a CPP exists */
330 if (stat(CPP
, &buf
) < 0) { /* SVR4 or explicit cpp does not exist */
332 fprintf(stderr
, "cannot find C preprocessor: %s\n", CPP
);
334 } else { /* try the other one */
336 if (stat(CPP
, &buf
) < 0) { /* can't find any cpp */
337 fprintf(stderr
, "cannot find any C preprocessor (cpp)\n");
344 * Open input file with given define for C-preprocessor
347 open_input(infile
, define
)
353 infilename
= (infile
== NULL
) ? "<stdin>" : infile
;
355 #define DOSCPP "\\prog\\bc31\\bin\\cpp.exe"
358 char drive
[MAXDRIVE
], dir
[MAXDIR
], name
[MAXFILE
], ext
[MAXEXT
];
359 char cppfile
[MAXPATH
];
362 if ((cpp
= searchpath("cpp.exe")) == NULL
363 && (cpp
= getenv("RPCGENCPP")) == NULL
)
373 retval
= spawnvp(P_WAIT
, arglist
[0], arglist
);
375 fprintf(stderr
, "%s: C PreProcessor failed\n", cmdname
);
378 fnsplit(infile
, drive
, dir
, name
, ext
);
379 fnmerge(cppfile
, drive
, dir
, name
, ".i");
381 fin
= fopen(cppfile
, "r");
383 f_print(stderr
, "%s: ", cmdname
);
387 dos_cppfile
= strdup(cppfile
);
388 if (dos_cppfile
== NULL
) {
389 fprintf(stderr
, "%s: out of memory\n", cmdname
);
395 switch (childpid
= fork()) {
402 addarg((char *) NULL
);
404 (void) dup2(pd
[1], 1);
406 execv(arglist
[0], arglist
);
414 fin
= fdopen(pd
[0], "r");
417 f_print(stderr
, "%s: ", cmdname
);
422 /* valid tirpc nettypes */
423 static char *valid_ti_nettypes
[] =
436 /* valid inetd nettypes */
437 static char *valid_i_nettypes
[] =
445 check_nettype(name
, list_to_check
)
447 char *list_to_check
[];
450 for (i
= 0; list_to_check
[i
] != NULL
; i
++) {
451 if (strcmp(name
, list_to_check
[i
]) == 0) {
455 f_print(stderr
, "illegal nettype :\'%s\'\n", name
);
459 * Compile into an XDR routine output file
463 c_output(infile
, define
, extend
, outfile
)
475 open_input(infile
, define
);
476 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
477 open_output(infile
, outfilename
);
479 if (infile
&& (include
= extendfile(infile
, ".h"))) {
480 f_print(fout
, "#include \"%s\"\n", include
);
482 /* .h file already contains rpc/rpc.h */
484 f_print(fout
, "#include <rpc/rpc.h>\n");
486 while ((def
= get_definition()) != NULL
) {
489 if (extend
&& tell
== ftell(fout
)) {
490 (void) unlink(outfilename
);
499 /* add all the starting basic types */
503 add_type(1, "short");
506 add_type(1, "u_int");
507 add_type(1, "u_long");
508 add_type(1, "u_short");
512 char rpcgen_table_dcl
[] = "struct rpcgen_table {\n\
514 xdrproc_t xdr_arg;\n\
516 xdrproc_t xdr_res;\n\
522 generate_guard(pathname
)
525 char *filename
, *guard
, *tmp
;
527 filename
= strrchr(pathname
, '/'); /* find last component */
528 filename
= ((filename
== 0) ? pathname
: filename
+ 1);
529 guard
= strdup(filename
);
530 /* convert to upper case */
534 *tmp
= toupper(*tmp
);
538 guard
= extendfile(guard
, "_H_RPCGEN");
542 * Compile into an XDR header file
546 h_output(infile
, define
, extend
, outfile
)
558 open_input(infile
, define
);
559 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
560 open_output(infile
, outfilename
);
562 guard
= generate_guard(outfilename
? outfilename
: infile
);
564 f_print(fout
, "#ifndef _%s\n#define _%s\n\n", guard
,
567 f_print(fout
, "#define RPCGEN_VERSION\t%s\n\n", RPCGEN_VERSION
);
568 f_print(fout
, "#include <rpc/rpc.h>\n\n");
571 /* print data definitions */
572 while ((def
= get_definition()) != NULL
) {
576 /* print function declarations. Do this after data definitions
577 * because they might be used as arguments for functions */
578 for (l
= defined
; l
!= NULL
; l
= l
->next
) {
579 print_funcdef(l
->val
);
581 if (extend
&& tell
== ftell(fout
)) {
582 (void) unlink(outfilename
);
585 f_print(fout
, "%s", rpcgen_table_dcl
);
587 f_print(fout
, "\n#endif /* !_%s */\n", guard
);
590 * Compile into an RPC service
593 s_output(argc
, argv
, infile
, define
, extend
, outfile
, nomain
, netflag
)
605 int foundprogram
= 0;
608 open_input(infile
, define
);
609 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
610 open_output(infile
, outfilename
);
612 if (infile
&& (include
= extendfile(infile
, ".h"))) {
613 f_print(fout
, "#include \"%s\"\n", include
);
616 f_print(fout
, "#include <rpc/rpc.h>\n");
618 f_print(fout
, "#include <sys/ioctl.h>\n");
619 f_print(fout
, "#include <fcntl.h>\n");
620 f_print(fout
, "#include <stdio.h>\n");
621 f_print(fout
, "#include <stdlib.h>\n");
623 f_print(fout
, "#include <unistd.h>\n");
625 "#include <rpc/pmap_clnt.h>\n");
626 f_print(fout
, "#include <string.h>\n");
628 f_print(fout
, "#include <netdb.h>\n");
629 if (strcmp(svcclosetime
, "-1") == 0)
632 if (strcmp(svcclosetime
, "0") == 0)
635 if (inetdflag
|| pmflag
) {
636 f_print(fout
, "#include <signal.h>\n");
639 if (!tirpcflag
&& inetdflag
)
640 f_print(fout
, "#include <sys/ttycom.h>\n");
641 if (Cflag
&& (inetdflag
|| pmflag
)) {
642 f_print(fout
, "#ifdef __cplusplus\n");
643 f_print(fout
, "#include <sysent.h>\n");
644 f_print(fout
, "#endif /* __cplusplus */\n");
647 f_print(fout
, "#include <sys/types.h>\n");
649 f_print(fout
, "#include <memory.h>\n");
651 f_print(fout
, "#include <stropts.h>\n");
653 if (inetdflag
|| !tirpcflag
) {
654 f_print(fout
, "#include <sys/socket.h>\n");
655 f_print(fout
, "#include <netinet/in.h>\n");
657 if ((netflag
|| pmflag
) && tirpcflag
) {
658 f_print(fout
, "#include <netconfig.h>\n");
660 if ( /* timerflag && */ tirpcflag
)
661 f_print(fout
, "#include <sys/resource.h>\n");
662 if (logflag
|| inetdflag
|| pmflag
)
663 f_print(fout
, "#include <syslog.h>\n");
666 f_print(fout
, "\n#ifdef __STDC__\n#define SIG_PF void(*)(int)\n#endif\n");
668 f_print(fout
, "\n#ifdef DEBUG\n#define RPC_SVC_FG\n#endif\n");
670 f_print(fout
, "\n#define _RPCSVC_CLOSEDOWN %s\n", svcclosetime
);
671 while ((def
= get_definition()) != NULL
) {
672 foundprogram
|= (def
->def_kind
== DEF_PROGRAM
);
674 if (extend
&& !foundprogram
) {
675 (void) unlink(outfilename
);
678 if (callerflag
) /* EVAS */
679 f_print(fout
, "\nstatic SVCXPRT *caller;\n"); /* EVAS */
680 write_most(infile
, netflag
, nomain
);
682 if (!do_registers(argc
, argv
)) {
684 (void) unlink(outfilename
);
691 * generate client side stubs
694 l_output(infile
, define
, extend
, outfile
)
702 int foundprogram
= 0;
705 open_input(infile
, define
);
706 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
707 open_output(infile
, outfilename
);
710 f_print(fout
, "#include <memory.h>\n");
711 if (infile
&& (include
= extendfile(infile
, ".h"))) {
712 f_print(fout
, "#include \"%s\"\n", include
);
715 f_print(fout
, "#include <rpc/rpc.h>\n");
716 while ((def
= get_definition()) != NULL
) {
717 foundprogram
|= (def
->def_kind
== DEF_PROGRAM
);
719 if (extend
&& !foundprogram
) {
720 (void) unlink(outfilename
);
726 * generate the dispatch table
729 t_output(infile
, define
, extend
, outfile
)
736 int foundprogram
= 0;
739 open_input(infile
, define
);
740 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
741 open_output(infile
, outfilename
);
743 while ((def
= get_definition()) != NULL
) {
744 foundprogram
|= (def
->def_kind
== DEF_PROGRAM
);
746 if (extend
&& !foundprogram
) {
747 (void) unlink(outfilename
);
752 /* sample routine for the server template */
754 svc_output(infile
, define
, extend
, outfile
)
765 open_input(infile
, define
);
766 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
767 checkfiles(infile
, outfilename
); /* check if outfile already
768 * exists. if so, print an
769 * error message and exit */
770 open_output(infile
, outfilename
);
773 if (infile
&& (include
= extendfile(infile
, ".h"))) {
774 f_print(fout
, "#include \"%s\"\n", include
);
777 f_print(fout
, "#include <rpc/rpc.h>\n");
780 while ((def
= get_definition()) != NULL
) {
781 write_sample_svc(def
);
783 if (extend
&& tell
== ftell(fout
)) {
784 (void) unlink(outfilename
);
789 /* sample main routine for client */
791 clnt_output(infile
, define
, extend
, outfile
)
803 open_input(infile
, define
);
804 outfilename
= extend
? extendfile(infile
, outfile
) : outfile
;
805 checkfiles(infile
, outfilename
); /* check if outfile already
806 * exists. if so, print an
807 * error message and exit */
809 open_output(infile
, outfilename
);
811 if (infile
&& (include
= extendfile(infile
, ".h"))) {
812 f_print(fout
, "#include \"%s\"\n", include
);
815 f_print(fout
, "#include <rpc/rpc.h>\n");
817 while ((def
= get_definition()) != NULL
) {
818 has_program
+= write_sample_clnt(def
);
822 write_sample_clnt_main();
824 if (extend
&& tell
== ftell(fout
)) {
825 (void) unlink(outfilename
);
829 * Perform registrations for service output
830 * Return 0 if failed; 1 otherwise.
833 do_registers(argc
, argv
)
839 if (inetdflag
|| !tirpcflag
) {
840 for (i
= 1; i
< argc
; i
++) {
841 if (streq(argv
[i
], "-s")) {
842 if (!check_nettype(argv
[i
+ 1], valid_i_nettypes
))
844 write_inetd_register(argv
[i
+ 1]);
849 for (i
= 1; i
< argc
; i
++)
850 if (streq(argv
[i
], "-s")) {
851 if (!check_nettype(argv
[i
+ 1], valid_ti_nettypes
))
853 write_nettype_register(argv
[i
+ 1]);
856 if (streq(argv
[i
], "-n")) {
857 write_netid_register(argv
[i
+ 1]);
864 * Add another argument to the arg list
870 if (argcount
>= ARGLISTLEN
) {
871 f_print(stderr
, "rpcgen: too many defines\n");
875 arglist
[argcount
++] = cp
;
884 if (where
>= ARGLISTLEN
) {
885 f_print(stderr
, "rpcgen: arglist coding error\n");
893 * if input file is stdin and an output file is specified then complain
894 * if the file already exists. Otherwise the file may get overwritten
895 * If input file does not exist, exit with an error
899 checkfiles(infile
, outfile
)
906 if (infile
) /* infile ! = NULL */
907 if (stat(infile
, &buf
) < 0) {
913 if (stat(outfile
, &buf
) < 0)
914 return; /* file does not exist */
917 "file '%s' already exists and may be overwritten\n", outfile
);
924 * Parse command line arguments
927 parseargs(argc
, argv
, cmd
)
930 struct commandline
*cmd
;
935 char flag
[(1 << 8 * sizeof(char))];
939 cmd
->infile
= cmd
->outfile
= NULL
;
954 for (i
= 1; i
< argc
; i
++) {
955 if (argv
[i
][0] != '-') {
957 f_print(stderr
, "Cannot specify more than one input file!\n");
961 cmd
->infile
= argv
[i
];
963 for (j
= 1; argv
[i
][j
] != 0; j
++) {
983 /* sample flag: Ss or Sc. Ss means set
984 * flag['S']; Sc means set flag['C']; */
985 c
= argv
[i
][++j
]; /* get next char */
999 case 'C': /* ANSI C syntax */
1003 case 'b': /* turn TIRPC flag off for
1004 * generating backward
1022 svcclosetime
= argv
[i
];
1031 doinline
= atoi(argv
[i
]);
1036 if (argv
[i
][j
- 1] != '-' ||
1037 argv
[i
][j
+ 1] != 0) {
1045 if (!streq(argv
[i
], "udp") &&
1046 !streq(argv
[i
], "tcp")) {
1054 cmd
->outfile
= argv
[i
];
1058 if (argv
[i
][j
- 1] != '-') {
1061 (void) addarg(argv
[i
]);
1067 (void) strcpy(pathbuf
, argv
[i
]);
1068 (void) strcat(pathbuf
, "/cpp");
1084 cmd
->cflag
= flag
['c'];
1085 cmd
->hflag
= flag
['h'];
1086 cmd
->lflag
= flag
['l'];
1087 cmd
->mflag
= flag
['m'];
1088 cmd
->nflag
= flag
['n'];
1089 cmd
->sflag
= flag
['s'];
1090 cmd
->tflag
= flag
['t'];
1091 cmd
->Ssflag
= flag
['S'];
1092 cmd
->Scflag
= flag
['C'];
1095 pmflag
= inetdflag
? 0 : 1; /* pmflag or inetdflag is
1097 if ((inetdflag
&& cmd
->nflag
)) { /* netid not allowed
1099 f_print(stderr
, "Cannot use netid flag with inetd flag!\n");
1102 } else { /* 4.1 mode */
1103 pmflag
= 0; /* set pmflag only in tirpcmode */
1104 inetdflag
= 1; /* inetdflag is TRUE by default */
1105 if (cmd
->nflag
) { /* netid needs TIRPC */
1106 f_print(stderr
, "Cannot use netid flag without TIRPC!\n");
1111 if (newstyle
&& (tblflag
|| cmd
->tflag
)) {
1112 f_print(stderr
, "Cannot use table flags with newstyle!\n");
1115 /* check no conflicts with file generation flags */
1116 nflags
= cmd
->cflag
+ cmd
->hflag
+ cmd
->lflag
+ cmd
->mflag
+
1117 cmd
->sflag
+ cmd
->nflag
+ cmd
->tflag
+ cmd
->Ssflag
+ cmd
->Scflag
;
1120 if (cmd
->outfile
!= NULL
|| cmd
->infile
== NULL
) {
1125 f_print(stderr
, "Cannot have more than one file generation flag!\n");
1134 f_print(stderr
, "usage: %s infile\n", cmdname
);
1135 f_print(stderr
, "\t%s [-a][-b][-C][-Dname[=value]] -i size [-I [-K seconds]] [-A][-L][-M toolkit][-N][-T] infile\n",
1137 f_print(stderr
, "\t%s [-c | -h | -l | -m | -t | -Sc | -Ss] [-o outfile] [infile]\n",
1139 f_print(stderr
, "\t%s [-s nettype]* [-o outfile] [infile]\n", cmdname
);
1140 f_print(stderr
, "\t%s [-n netid]* [-o outfile] [infile]\n", cmdname
);
1148 f_print(stderr
, "options:\n");
1149 f_print(stderr
, "-A\t\tgenerate svc_caller() function\n");
1150 f_print(stderr
, "-a\t\tgenerate all files, including samples\n");
1151 f_print(stderr
, "-b\t\tbackward compatibility mode (generates code for SunOS 4.1)\n");
1152 f_print(stderr
, "-c\t\tgenerate XDR routines\n");
1153 f_print(stderr
, "-C\t\tANSI C mode\n");
1154 f_print(stderr
, "-Dname[=value]\tdefine a symbol (same as #define)\n");
1155 f_print(stderr
, "-h\t\tgenerate header file\n");
1156 f_print(stderr
, "-i size\t\tsize at which to start generating inline code\n");
1157 f_print(stderr
, "-I\t\tgenerate code for inetd support in server (for SunOS 4.1)\n");
1158 f_print(stderr
, "-K seconds\tserver exits after K seconds of inactivity\n");
1159 f_print(stderr
, "-l\t\tgenerate client side stubs\n");
1160 f_print(stderr
, "-L\t\tserver errors will be printed to syslog\n");
1161 f_print(stderr
, "-m\t\tgenerate server side stubs\n");
1162 f_print(stderr
, "-n netid\tgenerate server code that supports named netid\n");
1163 f_print(stderr
, "-N\t\tsupports multiple arguments and call-by-value\n");
1164 f_print(stderr
, "-o outfile\tname of the output file\n");
1165 f_print(stderr
, "-s nettype\tgenerate server code that supports named nettype\n");
1166 f_print(stderr
, "-Sc\t\tgenerate sample client code that uses remote procedures\n");
1167 f_print(stderr
, "-Ss\t\tgenerate sample server code that defines remote procedures\n");
1168 f_print(stderr
, "-t\t\tgenerate RPC dispatch table\n");
1169 f_print(stderr
, "-T\t\tgenerate code to support RPC dispatch tables\n");
1170 f_print(stderr
, "-Y path\t\tdirectory name to find C preprocessor (cpp)\n");