1 /* @(#)rpc_main.c 1.4 87/11/30 3.9 RPCSRC */
3 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
4 * unrestricted use provided that this legend is included on all tape
5 * media and as a part of the software program in whole or part. Users
6 * may copy or modify Sun RPC without charge, but are not authorized
7 * to license or distribute it to anyone else except as part of a product or
8 * program developed by the user.
10 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14 * Sun RPC is provided with no support and without any obligation on the
15 * part of Sun Microsystems, Inc. to assist in its use, correction,
16 * modification or enhancement.
18 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20 * OR ANY PART THEREOF.
22 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23 * or profits or other special, indirect and consequential damages, even if
24 * Sun has been advised of the possibility of such damages.
26 * Sun Microsystems, Inc.
28 * Mountain View, California 94043
32 * rpc_main.c, Top level of the RPC protocol compiler.
33 * Copyright (C) 1987, Sun Microsystems, Inc.
36 #include <afsconfig.h>
37 #include <afs/param.h>
45 #include "rpc_parse.h"
48 #define EXTEND 1 /* alias for TRUE */
71 #define MAXCPPARGS 256 /* maximum number of arguments to cpp */
72 #define MAXCMDLINE 1024 /* MAX chars on a single cmd line */
75 static char *IncludeDir[MAXCPPARGS];
77 char *OutFileFlag = "";
79 char Sflag = 0, Cflag = 0, hflag = 0, cflag = 0, kflag = 0, uflag = 0;
80 char ansic_flag = 0; /* If set, build ANSI C style prototypes */
81 char brief_flag = 0; /* If set, shorten names */
82 char zflag = 0; /* If set, abort server stub if rpc call returns non-zero */
83 char xflag = 0; /* if set, add stats code to stubs */
84 char yflag = 0; /* if set, only emit function name arrays to xdr file */
86 static int pclose_fin = 0;
89 static char *CPP = NULL;
90 #else /* AFS_NT40_ENV */
92 static char CPP[] = PATH_CPP;
94 static char CPP[] = "/lib/cpp";
96 #endif /* AFS_NT40_ENV */
97 static char CPPFLAGS[] = "-C";
101 * Running "cpp" directly on DEC OSF/1 does not define anything; the "cc"
102 * driver is responsible. To compensate (and allow for other definitions
103 * which should always be passed to "cpp"), place definitions which whould
104 * always be passed to "rxgen" in this table.
106 static char *XTRA_CPPFLAGS[] = {
117 #include "AFS_component_version_number.c"
119 /* static prototypes */
120 static char *extendfile(char *file, char *ext);
121 static void open_output(char *infile, char *outfile);
122 static void open_input(char *infile, char *define);
123 static void c_output(char *infile, char *define, int extend, char *outfile,
125 static void h_output(char *infile, char *define, int extend, char *outfile,
127 static void s_output(int argc, char *argv[], char *infile, char *define,
128 int extend, char *outfile, int nomain);
129 static void l_output(char *infile, char *define, int extend, char *outfile);
130 static void do_registers(int argc, char *argv[]);
131 static int parseargs(int argc, char *argv[], struct commandline *cmd);
132 static void C_output(char *infile, char *define, int extend, char *outfile,
134 static void S_output(char *infile, char *define, int extend, char *outfile,
136 static char *uppercase(char *str);
139 main(int argc, char *argv[])
141 struct commandline cmd;
144 /* initialize CPP with the correct pre-processor for Windows */
145 CPP = getenv("RXGEN_CPPCMD");
147 CPP = "cl /EP /C /nologo";
148 #endif /* AFS_NT40_ENV */
152 * The following signal action for AIX is necessary so that in case of a
153 * crash (i.e. core is generated) we can include the user's data section
154 * in the core dump. Unfortunately, by default, only a partial core is
155 * generated which, in many cases, isn't too useful.
157 struct sigaction nsa;
159 sigemptyset(&nsa.sa_mask);
160 nsa.sa_handler = SIG_DFL;
161 nsa.sa_flags = SA_FULLDUMP;
162 sigaction(SIGSEGV, &nsa, NULL);
165 if (!parseargs(argc, argv, &cmd)) {
166 f_print(stderr, "usage: %s infile\n", cmdname);
168 " %s [-c | -h | -l | -m | -C | -S | -r | -b | -k | -R | -p | -d | -z | -u] [-Pprefix] [-Idir] [-o outfile] [infile]\n",
170 f_print(stderr, " %s [-s udp|tcp]* [-o outfile] [infile]\n",
174 OutFileFlag = cmd.outfile;
176 strcpy(OutFile, cmd.outfile);
179 c_output(cmd.infile, "-DRPC_XDR", !EXTEND, cmd.outfile, 0);
180 } else if (cmd.hflag) {
181 h_output(cmd.infile, "-DRPC_HDR", !EXTEND, cmd.outfile, 0);
182 } else if (cmd.lflag) {
183 l_output(cmd.infile, "-DRPC_CLNT", !EXTEND, cmd.outfile);
184 } else if (cmd.sflag || cmd.mflag) {
185 s_output(argc, argv, cmd.infile, "-DRPC_SVC", !EXTEND, cmd.outfile,
187 } else if (cmd.Cflag) {
189 C_output(cmd.infile, "-DRPC_CLIENT", !EXTEND, cmd.outfile, 1);
190 } else if (cmd.Sflag) {
192 S_output(cmd.infile, "-DRPC_SERVER", !EXTEND, cmd.outfile, 1);
194 if (OutFileFlag && (strrchr(OutFile, '.') == NULL))
195 strcat(OutFile, ".");
197 C_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_CLIENT",
200 S_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_SERVER",
205 c_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_XDR",
206 EXTEND, ".xdr.c", 0);
208 h_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_HDR",
211 C_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_CLIENT",
214 S_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_SERVER",
219 if (fin && pclose_fin) {
220 /* the cpp command we called returned a non-zero exit status */
229 * add extension to filename
232 extendfile(char *file, char *ext)
238 res = alloc(strlen(file) + strlen(ext) + 1);
242 p = (char *)strrchr(file, '.');
244 p = file + strlen(file);
246 sname = (char *)strrchr(file, '/');
252 strcpy(res + (p - sname), ext);
257 * Open output file with given extension
260 open_output(char *infile, char *outfile)
262 if (outfile == NULL) {
266 if (infile != NULL && streq(outfile, infile)) {
267 f_print(stderr, "%s: output would overwrite %s\n", cmdname, infile);
270 fout = fopen(outfile, "w");
272 f_print(stderr, "%s: unable to open ", cmdname);
276 record_open(outfile);
280 * Open input file with given define for C-preprocessor
283 open_input(char *infile, char *define)
285 char cpp_cmdline[MAXCMDLINE];
289 infilename = (infile == NULL) ? "<stdin>" : infile;
290 strcpy(cpp_cmdline, CPP);
291 strcat(cpp_cmdline, " ");
292 strcat(cpp_cmdline, CPPFLAGS);
293 strcat(cpp_cmdline, " ");
294 strcat(cpp_cmdline, define);
298 i < (sizeof(XTRA_CPPFLAGS) / sizeof(XTRA_CPPFLAGS[0])) - 1;
300 strcat(cpp_cmdline, " ");
301 strcat(cpp_cmdline, XTRA_CPPFLAGS[i]);
304 for (i = 0; i < nincludes; i++) {
305 strcat(cpp_cmdline, " ");
306 strcat(cpp_cmdline, IncludeDir[i]);
309 strcat(cpp_cmdline, " ");
310 strcat(cpp_cmdline, infile);
312 fin = popen(cpp_cmdline, "r");
318 if (infile == NULL) {
322 fin = fopen(infile, "r");
325 f_print(stderr, "%s: ", cmdname);
332 * Compile into an XDR routine output file
335 c_output(char *infile, char *define, int extend, char *outfile, int append)
342 char *currfile = (OutFileFlag ? OutFile : infile);
345 open_input(infile, define);
347 memset(fullname, 0, sizeof(fullname));
349 strcpy(fullname, prefix);
350 strcat(fullname, infile);
352 strcpy(fullname, infile);
353 outfilename = extend ? extendfile(fullname, outfile) : outfile;
354 open_output(infile, outfilename);
355 f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n");
358 f_print(fout, "#include \"afsconfig.h\"\n");
359 f_print(fout, "#include \"afs/param.h\"\n");
361 f_print(fout, "#include <afsconfig.h>\n");
362 f_print(fout, "#include <afs/param.h>\n");
363 f_print(fout, "#include <roken.h>\n");
365 f_print(fout, "#ifdef AFS_NT40_ENV\n");
366 f_print(fout, "#define AFS_RXGEN_EXPORT __declspec(dllexport)\n");
367 f_print(fout, "#endif /* AFS_NT40_ENV */\n");
369 if (currfile && (include = extendfile(currfile, ".h"))) {
371 f_print(fout, "#include \"%s\"\n\n", include);
373 f_print(fout, "#include \"%s\"\n\n", include);
376 /* In case we can't include the interface's own header file... */
378 f_print(fout, "#include \"h/types.h\"\n");
379 f_print(fout, "#include \"h/socket.h\"\n");
380 f_print(fout, "#include \"h/file.h\"\n");
381 f_print(fout, "#include \"h/stat.h\"\n");
382 f_print(fout, "#include \"netinet/in.h\"\n");
383 f_print(fout, "#include \"h/time.h\"\n");
384 f_print(fout, "#include \"rx/xdr.h\"\n");
385 f_print(fout, "#include \"afs/rxgen_consts.h\"\n");
387 f_print(fout, "#include <rx/xdr.h>\n");
392 while ((def = get_definition())) {
394 if ((!IsRxgenDefinition(def)) && def->def_kind != DEF_CUSTOMIZED)
400 * Print out array containing list of all functions in the interface
405 for (j = 0; j <= PackageIndex; j++) {
406 f_print(fout, "AFS_RXGEN_EXPORT\n");
407 f_print(fout, "const char *%sfunction_names[] = {\n",
410 for (i = 0; i < no_of_stat_funcs_header[j]; i++) {
412 f_print(fout, "\t\"%s\"", function_list[j][i]);
414 f_print(fout, ",\n\t\"%s\"", function_list[j][i]);
419 f_print(fout, "\n};\n");
421 er_Proc_CodeGeneration();
424 if (extend && tell == ftell(fout)) {
425 (void)unlink(outfilename);
431 * Compile into an XDR header file
434 h_output(char *infile, char *define, int extend, char *outfile, int append)
439 char fullname[1024], *p;
441 open_input(infile, define);
443 memset(fullname, 0, sizeof(fullname));
445 strcpy(fullname, prefix);
446 strcat(fullname, infile);
448 strcpy(fullname, infile);
449 outfilename = extend ? extendfile(fullname, outfile) : outfile;
450 open_output(infile, outfilename);
451 strcpy(fullname, outfilename);
452 if ((p = strchr(fullname, '.')))
454 f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n");
455 f_print(fout, "#ifndef _RXGEN_%s_\n", uppercase(fullname));
456 f_print(fout, "#define _RXGEN_%s_\n\n", uppercase(fullname));
457 f_print(fout, "#ifdef KERNEL\n");
459 "/* The following 'ifndefs' are not a good solution to the vendor's omission of surrounding all system includes with 'ifndef's since it requires that this file is included after the system includes...*/\n");
460 f_print(fout, "#include <afsconfig.h>\n");
461 f_print(fout, "#include \"afs/param.h\"\n");
462 f_print(fout, "#ifdef UKERNEL\n");
463 f_print(fout, "#include \"afs/sysincludes.h\"\n");
464 f_print(fout, "#include \"rx/xdr.h\"\n");
465 f_print(fout, "#include \"rx/rx.h\"\n");
467 f_print(fout, "#include \"rx/rx_globals.h\"\n");
470 f_print(fout, "#include \"rx/rx_opaque.h\"\n");
473 f_print(fout, "#include <ubik.h>\n");
474 f_print(fout, "#else /* UKERNEL */\n");
475 f_print(fout, "#include \"h/types.h\"\n");
476 f_print(fout, "#ifndef SOCK_DGRAM /* XXXXX */\n");
477 f_print(fout, "#include \"h/socket.h\"\n");
478 f_print(fout, "#endif\n");
479 f_print(fout, "struct ubik_client;\n");
480 f_print(fout, "#ifndef DTYPE_SOCKET /* XXXXX */\n");
481 f_print(fout, "#ifndef AFS_LINUX22_ENV\n");
482 f_print(fout, "#include \"h/file.h\"\n");
483 f_print(fout, "#endif\n");
484 f_print(fout, "#endif\n");
485 f_print(fout, "#ifndef S_IFMT /* XXXXX */\n");
486 f_print(fout, "#include \"h/stat.h\"\n");
487 f_print(fout, "#endif\n");
488 f_print(fout, "#if defined (AFS_OBSD_ENV) && !defined (MLEN)\n");
489 f_print(fout, "#include \"sys/mbuf.h\"\n");
490 f_print(fout, "#endif\n");
491 f_print(fout, "#ifndef IPPROTO_UDP /* XXXXX */\n");
492 f_print(fout, "#include \"netinet/in.h\"\n");
493 f_print(fout, "#endif\n");
494 f_print(fout, "#ifndef DST_USA /* XXXXX */\n");
495 f_print(fout, "#include \"h/time.h\"\n");
496 f_print(fout, "#endif\n");
497 f_print(fout, "#ifndef AFS_LINUX22_ENV\n");
498 f_print(fout, "#include \"rpc/types.h\"\n");
499 f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
500 f_print(fout, "#ifndef XDR_GETLONG /* XXXXX */\n");
501 f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
502 f_print(fout, "#ifndef quad_t\n");
503 f_print(fout, "#define quad_t __quad_t\n");
504 f_print(fout, "#define u_quad_t __u_quad_t\n");
505 f_print(fout, "#endif\n");
506 f_print(fout, "#endif\n");
507 f_print(fout, "#include \"rx/xdr.h\"\n");
508 f_print(fout, "#endif /* XDR_GETLONG */\n");
509 f_print(fout, "#endif /* UKERNEL */\n");
510 f_print(fout, "#include \"afs/rxgen_consts.h\"\n");
511 f_print(fout, "#include \"afs_osi.h\"\n");
512 f_print(fout, "#include \"rx/rx.h\"\n");
514 f_print(fout, "#include \"rx/rx_globals.h\"\n");
517 f_print(fout, "#include \"rx/rx_opaque.h\"\n");
519 f_print(fout, "#else /* KERNEL */\n");
520 f_print(fout, "#include <afs/param.h>\n");
521 f_print(fout, "#include <afs/stds.h>\n");
522 f_print(fout, "#include <sys/types.h>\n");
523 f_print(fout, "#include <rx/xdr.h>\n");
524 f_print(fout, "#include <rx/rx.h>\n");
526 f_print(fout, "#include <rx/rx_globals.h>\n");
529 f_print(fout, "#include <rx/rx_opaque.h>\n");
531 f_print(fout, "#include <afs/rxgen_consts.h>\n");
533 f_print(fout, "#include <ubik.h>\n");
534 f_print(fout, "#endif /* KERNEL */\n\n");
535 f_print(fout, "#ifdef AFS_NT40_ENV\n");
536 f_print(fout, "#ifndef AFS_RXGEN_EXPORT\n");
537 f_print(fout, "#define AFS_RXGEN_EXPORT __declspec(dllimport)\n");
538 f_print(fout, "#endif /* AFS_RXGEN_EXPORT */\n");
539 f_print(fout, "#else /* AFS_NT40_ENV */\n");
540 f_print(fout, "#define AFS_RXGEN_EXPORT\n");
541 f_print(fout, "#endif /* AFS_NT40_ENV */\n\n");
543 while ((def = get_definition())) {
546 h_Proc_CodeGeneration();
549 f_print(fout, "#endif /* _RXGEN_%s_ */\n", uppercase(fullname));
550 if (extend && tell == ftell(fout)) {
551 (void)unlink(outfilename);
556 * Compile into an RPC service
559 s_output(int argc, char *argv[], char *infile, char *define, int extend,
560 char *outfile, int nomain)
567 open_input(infile, define);
568 outfilename = extend ? extendfile(infile, outfile) : outfile;
569 open_output(infile, outfilename);
570 f_print(fout, "#include <stdio.h>\n");
571 f_print(fout, "#include <rpc/rpc.h>\n");
572 if (infile && (include = extendfile(infile, ".h"))) {
573 f_print(fout, "#include \"%s\"\n", include);
577 while ((def = get_definition())) {
578 foundprogram |= (def->def_kind == DEF_PROGRAM);
580 if (extend && !foundprogram) {
581 (void)unlink(outfilename);
585 write_programs(NULL);
588 do_registers(argc, argv);
590 write_programs("static");
595 l_output(char *infile, char *define, int extend, char *outfile)
602 open_input(infile, define);
603 outfilename = extend ? extendfile(infile, outfile) : outfile;
604 open_output(infile, outfilename);
605 f_print(fout, "#include <rpc/rpc.h>\n");
606 f_print(fout, "#include <sys/time.h>\n");
607 if (infile && (include = extendfile(infile, ".h"))) {
608 f_print(fout, "#include \"%s\"\n", include);
612 while ((def = get_definition())) {
613 foundprogram |= (def->def_kind == DEF_PROGRAM);
615 if (extend && !foundprogram) {
616 (void)unlink(outfilename);
623 * Perform registrations for service output
626 do_registers(int argc, char *argv[])
630 for (i = 1; i < argc; i++) {
631 if (streq(argv[i], "-s")) {
632 write_register(argv[i + 1]);
640 C_output(char *infile, char *define, int extend, char *outfile, int append)
646 char *currfile = (OutFileFlag ? OutFile : infile);
649 open_input(infile, define);
650 memset(fullname, 0, sizeof(fullname));
652 strcpy(fullname, prefix);
653 strcat(fullname, infile);
655 strcpy(fullname, infile);
656 outfilename = extend ? extendfile(fullname, outfile) : outfile;
657 open_output(infile, outfilename);
658 f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n");
659 if (currfile && (include = extendfile(currfile, ".h"))) {
661 f_print(fout, "#include \"%s\"\n\n", include);
663 f_print(fout, "#include <afsconfig.h>\n");
664 f_print(fout, "#include <afs/param.h>\n");
665 f_print(fout, "#include <roken.h>\n");
666 f_print(fout, "#include <afs/opr.h>\n");
667 f_print(fout, "#include \"%s\"\n\n", include);
672 f_print(fout, "#include \"h/types.h\"\n");
673 f_print(fout, "#include \"h/socket.h\"\n");
674 f_print(fout, "#include \"h/file.h\"\n");
675 f_print(fout, "#include \"h/stat.h\"\n");
676 f_print(fout, "#include \"netinet/in.h\"\n");
677 f_print(fout, "#include \"h/time.h\"\n");
678 f_print(fout, "#include \"rpc/types.h\"\n");
679 f_print(fout, "#include \"rx/xdr.h\"\n");
680 f_print(fout, "#include \"afs/rxgen_consts.h\"\n");
681 f_print(fout, "#include \"afs/afs_osi.h\"\n");
682 f_print(fout, "#include \"rx/rx.h\"\n");
684 f_print(fout, "#include \"rx/rx_globals.h\"\n");
687 f_print(fout, "#include \"rx/rx_opaque.h\"\n");
690 f_print(fout, "#include <sys/types.h>\n");
691 f_print(fout, "#include <rx/xdr.h>\n");
692 f_print(fout, "#include <rx/rx.h>\n");
694 f_print(fout, "#include <rx/rx_globals.h>\n");
697 f_print(fout, "#include <rx/rx_opaque.h\"\n");
699 f_print(fout, "#include <afs/rxgen_consts.h>\n");
704 while (get_definition())
706 if (extend && tell == ftell(fout)) {
707 (void)unlink(outfilename);
714 S_output(char *infile, char *define, int extend, char *outfile, int append)
721 char *currfile = (OutFileFlag ? OutFile : infile);
724 open_input(infile, define);
725 memset(fullname, 0, sizeof(fullname));
727 strcpy(fullname, prefix);
728 strcat(fullname, infile);
730 strcpy(fullname, infile);
731 outfilename = extend ? extendfile(fullname, outfile) : outfile;
732 open_output(infile, outfilename);
733 f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n");
734 if (currfile && (include = extendfile(currfile, ".h"))) {
736 f_print(fout, "#include \"%s\"\n", include);
738 f_print(fout, "#include <afsconfig.h>\n");
739 f_print(fout, "#include <afs/param.h>\n");
740 f_print(fout, "#include <roken.h>\n");
741 f_print(fout, "#include \"%s\"\n\n", include);
746 f_print(fout, "#include \"h/types.h\"\n");
747 f_print(fout, "#include \"h/socket.h\"\n");
748 f_print(fout, "#include \"h/file.h\"\n");
749 f_print(fout, "#include \"h/stat.h\"\n");
750 f_print(fout, "#include \"netinet/in.h\"\n");
751 f_print(fout, "#include \"h/time.h\"\n");
752 f_print(fout, "#include \"rpc/types.h\"\n");
753 f_print(fout, "#include \"rx/xdr.h\"\n");
754 f_print(fout, "#include \"afs/rxgen_consts.h\"\n");
755 f_print(fout, "#include \"afs/afs_osi.h\"\n");
756 f_print(fout, "#include \"rx/rx.h\"\n");
758 f_print(fout, "#include \"rx/rx_globals.h\"\n");
761 f_print(fout, "#include \"rx/rx_opaque.h\"\n");
764 f_print(fout, "#include <sys/types.h>\n");
765 f_print(fout, "#include <rx/xdr.h>\n");
766 f_print(fout, "#include <rx/rx.h>\n");
768 f_print(fout, "#include <rx/rx_globals.h>\n");
771 f_print(fout, "#include <rx/rx_opaque.h>\n");
773 f_print(fout, "#include <afs/rxgen_consts.h>\n");
779 while ((def = get_definition())) {
784 er_Proc_CodeGeneration();
786 if (extend && tell == ftell(fout)) {
787 (void)unlink(outfilename);
795 static char max_size[100];
797 int len = (int)strlen(str);
799 for (pnt = max_size; len > 0; len--, str++) {
800 *pnt++ = (islower(*str) ? toupper(*str) : *str);
807 * Parse command line arguments
810 parseargs(int argc, char *argv[], struct commandline *cmd)
815 char flag[(1 << (8 * sizeof(char)))];
819 cmd->infile = cmd->outfile = NULL;
823 memset(flag, 0, sizeof(flag));
825 for (i = 1; i < argc; i++) {
826 if (argv[i][0] != '-') {
830 cmd->infile = argv[i];
832 for (j = 1; argv[i][j] != 0; j++) {
859 if (argv[i][j - 1] != '-' || argv[i][j + 1] != 0) {
867 if (!streq(argv[i], "udp") && !streq(argv[i], "tcp")) {
870 } else if (c == 'o') {
874 cmd->outfile = argv[i];
878 if (argv[i][j - 1] != '-')
880 prefix = &argv[i][j + 1];
883 if (argv[i][j - 1] != '-')
885 IncludeDir[nincludes++] = &argv[i][j - 1];
895 cmd->ansic_flag = ansic_flag = flag['A'];
896 cmd->brief_flag = brief_flag = flag['b'];
897 cmd->cflag = cflag = flag['c'];
898 cmd->hflag = hflag = flag['h'];
899 cmd->sflag = flag['s'];
900 cmd->lflag = flag['l'];
901 cmd->mflag = flag['m'];
902 cmd->xflag = xflag = flag['x'];
903 cmd->yflag = yflag = flag['y'];
904 cmd->Cflag = Cflag = flag['C'];
905 cmd->Sflag = Sflag = flag['S'];
906 cmd->rflag = flag['r'];
907 cmd->uflag = uflag = flag['u'];
908 cmd->kflag = kflag = flag['k'];
909 cmd->pflag = flag['p'];
910 cmd->dflag = debug = flag['d'];
915 cmd->cflag + cmd->hflag + cmd->sflag + cmd->lflag + cmd->mflag +
916 cmd->Cflag + cmd->Sflag + cmd->rflag;
918 if (cmd->outfile != NULL || cmd->infile == NULL) {
921 } else if (nflags > 1) {