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>
48 #ifdef HAVE_SYS_FILE_H
55 #include "rpc_parse.h"
58 #define EXTEND 1 /* alias for TRUE */
81 #define MAXCPPARGS 256 /* maximum number of arguments to cpp */
82 #define MAXCMDLINE 1024 /* MAX chars on a single cmd line */
85 static char *IncludeDir[MAXCPPARGS];
87 char *OutFileFlag = "";
89 char Sflag = 0, Cflag = 0, hflag = 0, cflag = 0, kflag = 0, uflag = 0;
90 char ansic_flag = 0; /* If set, build ANSI C style prototypes */
91 char brief_flag = 0; /* If set, shorten names */
92 char zflag = 0; /* If set, abort server stub if rpc call returns non-zero */
93 char xflag = 0; /* if set, add stats code to stubs */
94 char yflag = 0; /* if set, only emit function name arrays to xdr file */
96 static int pclose_fin = 0;
99 static char *CPP = NULL;
100 #else /* AFS_NT40_ENV */
102 static char CPP[] = PATH_CPP;
104 static char CPP[] = "/lib/cpp";
106 #endif /* AFS_NT40_ENV */
107 static char CPPFLAGS[] = "-C";
111 * Running "cpp" directly on DEC OSF/1 does not define anything; the "cc"
112 * driver is responsible. To compensate (and allow for other definitions
113 * which should always be passed to "cpp"), place definitions which whould
114 * always be passed to "rxgen" in this table.
116 static char *XTRA_CPPFLAGS[] = {
127 #include "AFS_component_version_number.c"
129 /* static prototypes */
130 static char *extendfile(char *file, char *ext);
131 static void open_output(char *infile, char *outfile);
132 static void open_input(char *infile, char *define);
133 static void c_output(char *infile, char *define, int extend, char *outfile,
135 static void h_output(char *infile, char *define, int extend, char *outfile,
137 static void s_output(int argc, char *argv[], char *infile, char *define,
138 int extend, char *outfile, int nomain);
139 static void l_output(char *infile, char *define, int extend, char *outfile);
140 static void do_registers(int argc, char *argv[]);
141 static int parseargs(int argc, char *argv[], struct commandline *cmd);
142 static void C_output(char *infile, char *define, int extend, char *outfile,
144 static void S_output(char *infile, char *define, int extend, char *outfile,
146 static char *uppercase(char *str);
149 main(int argc, char *argv[])
151 struct commandline cmd;
154 /* initialize CPP with the correct pre-processor for Windows */
155 CPP = getenv("RXGEN_CPPCMD");
157 CPP = "cl /EP /C /nologo";
158 #endif /* AFS_NT40_ENV */
162 * The following signal action for AIX is necessary so that in case of a
163 * crash (i.e. core is generated) we can include the user's data section
164 * in the core dump. Unfortunately, by default, only a partial core is
165 * generated which, in many cases, isn't too useful.
167 struct sigaction nsa;
169 sigemptyset(&nsa.sa_mask);
170 nsa.sa_handler = SIG_DFL;
171 nsa.sa_flags = SA_FULLDUMP;
172 sigaction(SIGSEGV, &nsa, NULL);
175 if (!parseargs(argc, argv, &cmd)) {
176 f_print(stderr, "usage: %s infile\n", cmdname);
178 " %s [-c | -h | -l | -m | -C | -S | -r | -b | -k | -R | -p | -d | -z | -u] [-Pprefix] [-Idir] [-o outfile] [infile]\n",
180 f_print(stderr, " %s [-s udp|tcp]* [-o outfile] [infile]\n",
184 OutFileFlag = cmd.outfile;
186 strcpy(OutFile, cmd.outfile);
189 c_output(cmd.infile, "-DRPC_XDR", !EXTEND, cmd.outfile, 0);
190 } else if (cmd.hflag) {
191 h_output(cmd.infile, "-DRPC_HDR", !EXTEND, cmd.outfile, 0);
192 } else if (cmd.lflag) {
193 l_output(cmd.infile, "-DRPC_CLNT", !EXTEND, cmd.outfile);
194 } else if (cmd.sflag || cmd.mflag) {
195 s_output(argc, argv, cmd.infile, "-DRPC_SVC", !EXTEND, cmd.outfile,
197 } else if (cmd.Cflag) {
199 C_output(cmd.infile, "-DRPC_CLIENT", !EXTEND, cmd.outfile, 1);
200 } else if (cmd.Sflag) {
202 S_output(cmd.infile, "-DRPC_SERVER", !EXTEND, cmd.outfile, 1);
204 if (OutFileFlag && (strrchr(OutFile, '.') == NULL))
205 strcat(OutFile, ".");
207 C_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_CLIENT",
210 S_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_SERVER",
215 c_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_XDR",
216 EXTEND, ".xdr.c", 0);
218 h_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_HDR",
221 C_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_CLIENT",
224 S_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_SERVER",
229 if (fin && pclose_fin) {
230 /* the cpp command we called returned a non-zero exit status */
239 * add extension to filename
242 extendfile(char *file, char *ext)
248 res = alloc(strlen(file) + strlen(ext) + 1);
252 p = (char *)strrchr(file, '.');
254 p = file + strlen(file);
256 sname = (char *)strrchr(file, '/');
262 strcpy(res + (p - sname), ext);
267 * Open output file with given extension
270 open_output(char *infile, char *outfile)
272 if (outfile == NULL) {
276 if (infile != NULL && streq(outfile, infile)) {
277 f_print(stderr, "%s: output would overwrite %s\n", cmdname, infile);
280 fout = fopen(outfile, "w");
282 f_print(stderr, "%s: unable to open ", cmdname);
286 record_open(outfile);
290 * Open input file with given define for C-preprocessor
293 open_input(char *infile, char *define)
295 char cpp_cmdline[MAXCMDLINE];
299 infilename = (infile == NULL) ? "<stdin>" : infile;
300 strcpy(cpp_cmdline, CPP);
301 strcat(cpp_cmdline, " ");
302 strcat(cpp_cmdline, CPPFLAGS);
303 strcat(cpp_cmdline, " ");
304 strcat(cpp_cmdline, define);
308 i < (sizeof(XTRA_CPPFLAGS) / sizeof(XTRA_CPPFLAGS[0])) - 1;
310 strcat(cpp_cmdline, " ");
311 strcat(cpp_cmdline, XTRA_CPPFLAGS[i]);
314 for (i = 0; i < nincludes; i++) {
315 strcat(cpp_cmdline, " ");
316 strcat(cpp_cmdline, IncludeDir[i]);
319 strcat(cpp_cmdline, " ");
320 strcat(cpp_cmdline, infile);
322 fin = popen(cpp_cmdline, "r");
328 if (infile == NULL) {
332 fin = fopen(infile, "r");
335 f_print(stderr, "%s: ", cmdname);
342 * Compile into an XDR routine output file
345 c_output(char *infile, char *define, int extend, char *outfile, int append)
352 char *currfile = (OutFileFlag ? OutFile : infile);
355 open_input(infile, define);
357 memset(fullname, 0, sizeof(fullname));
359 strcpy(fullname, prefix);
360 strcat(fullname, infile);
362 strcpy(fullname, infile);
363 outfilename = extend ? extendfile(fullname, outfile) : outfile;
364 open_output(infile, outfilename);
365 f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n");
368 f_print(fout, "#include \"afsconfig.h\"\n");
369 f_print(fout, "#include \"afs/param.h\"\n");
371 f_print(fout, "#include <afsconfig.h>\n");
372 f_print(fout, "#include <afs/param.h>\n");
373 f_print(fout, "#include <roken.h>\n");
375 f_print(fout, "#ifdef AFS_NT40_ENV\n");
376 f_print(fout, "#define AFS_RXGEN_EXPORT __declspec(dllexport)\n");
377 f_print(fout, "#include <winsock2.h>\n");
378 f_print(fout, "#endif /* AFS_NT40_ENV */\n");
380 if (currfile && (include = extendfile(currfile, ".h"))) {
382 f_print(fout, "#include \"%s\"\n\n", include);
384 f_print(fout, "#include \"%s\"\n\n", include);
387 /* In case we can't include the interface's own header file... */
389 f_print(fout, "#include \"h/types.h\"\n");
390 f_print(fout, "#include \"h/socket.h\"\n");
391 f_print(fout, "#include \"h/file.h\"\n");
392 f_print(fout, "#include \"h/stat.h\"\n");
393 f_print(fout, "#include \"netinet/in.h\"\n");
394 f_print(fout, "#include \"h/time.h\"\n");
395 f_print(fout, "#include \"rx/xdr.h\"\n");
396 f_print(fout, "#include \"afs/rxgen_consts.h\"\n");
398 f_print(fout, "#include <rx/xdr.h>\n");
403 while ((def = get_definition())) {
405 if ((!IsRxgenDefinition(def)) && def->def_kind != DEF_CUSTOMIZED)
411 * Print out array containing list of all functions in the interface
416 for (j = 0; j <= PackageIndex; j++) {
417 f_print(fout, "AFS_RXGEN_EXPORT\n");
418 f_print(fout, "const char *%sfunction_names[] = {\n",
421 for (i = 0; i < no_of_stat_funcs_header[j]; i++) {
423 f_print(fout, "\t\"%s\"", function_list[j][i]);
425 f_print(fout, ",\n\t\"%s\"", function_list[j][i]);
430 f_print(fout, "\n};\n");
432 er_Proc_CodeGeneration();
435 if (extend && tell == ftell(fout)) {
436 (void)unlink(outfilename);
442 * Compile into an XDR header file
445 h_output(char *infile, char *define, int extend, char *outfile, int append)
450 char fullname[1024], *p;
452 open_input(infile, define);
454 memset(fullname, 0, sizeof(fullname));
456 strcpy(fullname, prefix);
457 strcat(fullname, infile);
459 strcpy(fullname, infile);
460 outfilename = extend ? extendfile(fullname, outfile) : outfile;
461 open_output(infile, outfilename);
462 strcpy(fullname, outfilename);
463 if ((p = strchr(fullname, '.')))
465 f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n");
466 f_print(fout, "#ifndef _RXGEN_%s_\n", uppercase(fullname));
467 f_print(fout, "#define _RXGEN_%s_\n\n", uppercase(fullname));
468 f_print(fout, "#ifdef KERNEL\n");
470 "/* 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");
471 f_print(fout, "#include <afsconfig.h>\n");
472 f_print(fout, "#include \"afs/param.h\"\n");
473 f_print(fout, "#ifdef UKERNEL\n");
474 f_print(fout, "#include \"afs/sysincludes.h\"\n");
475 f_print(fout, "#include \"rx/xdr.h\"\n");
476 f_print(fout, "#include \"rx/rx.h\"\n");
478 f_print(fout, "#include \"rx/rx_globals.h\"\n");
481 f_print(fout, "#include \"rx/rx_opaque.h\"\n");
484 f_print(fout, "#include <ubik.h>\n");
485 f_print(fout, "#else /* UKERNEL */\n");
486 f_print(fout, "#include \"h/types.h\"\n");
487 f_print(fout, "#ifndef SOCK_DGRAM /* XXXXX */\n");
488 f_print(fout, "#include \"h/socket.h\"\n");
489 f_print(fout, "#endif\n");
490 f_print(fout, "struct ubik_client;\n");
491 f_print(fout, "#ifndef DTYPE_SOCKET /* XXXXX */\n");
492 f_print(fout, "#ifndef AFS_LINUX22_ENV\n");
493 f_print(fout, "#include \"h/file.h\"\n");
494 f_print(fout, "#endif\n");
495 f_print(fout, "#endif\n");
496 f_print(fout, "#ifndef S_IFMT /* XXXXX */\n");
497 f_print(fout, "#include \"h/stat.h\"\n");
498 f_print(fout, "#endif\n");
499 f_print(fout, "#if defined (AFS_OBSD_ENV) && !defined (MLEN)\n");
500 f_print(fout, "#include \"sys/mbuf.h\"\n");
501 f_print(fout, "#endif\n");
502 f_print(fout, "#ifndef IPPROTO_UDP /* XXXXX */\n");
503 f_print(fout, "#include \"netinet/in.h\"\n");
504 f_print(fout, "#endif\n");
505 f_print(fout, "#ifndef DST_USA /* XXXXX */\n");
506 f_print(fout, "#include \"h/time.h\"\n");
507 f_print(fout, "#endif\n");
508 f_print(fout, "#ifndef AFS_LINUX22_ENV\n");
509 f_print(fout, "#include \"rpc/types.h\"\n");
510 f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
511 f_print(fout, "#ifndef XDR_GETLONG /* XXXXX */\n");
512 f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
513 f_print(fout, "#ifndef quad_t\n");
514 f_print(fout, "#define quad_t __quad_t\n");
515 f_print(fout, "#define u_quad_t __u_quad_t\n");
516 f_print(fout, "#endif\n");
517 f_print(fout, "#endif\n");
518 f_print(fout, "#include \"rx/xdr.h\"\n");
519 f_print(fout, "#endif /* XDR_GETLONG */\n");
520 f_print(fout, "#endif /* UKERNEL */\n");
521 f_print(fout, "#include \"afs/rxgen_consts.h\"\n");
522 f_print(fout, "#include \"afs_osi.h\"\n");
523 f_print(fout, "#include \"rx/rx.h\"\n");
525 f_print(fout, "#include \"rx/rx_globals.h\"\n");
528 f_print(fout, "#include \"rx/rx_opaque.h\"\n");
530 f_print(fout, "#else /* KERNEL */\n");
531 f_print(fout, "#include <afs/param.h>\n");
532 f_print(fout, "#include <afs/stds.h>\n");
533 f_print(fout, "#include <sys/types.h>\n");
534 f_print(fout, "#include <rx/xdr.h>\n");
535 f_print(fout, "#include <rx/rx.h>\n");
537 f_print(fout, "#include <rx/rx_globals.h>\n");
540 f_print(fout, "#include <rx/rx_opaque.h>\n");
542 f_print(fout, "#include <afs/rxgen_consts.h>\n");
544 f_print(fout, "#include <ubik.h>\n");
545 f_print(fout, "#endif /* KERNEL */\n\n");
546 f_print(fout, "#ifdef AFS_NT40_ENV\n");
547 f_print(fout, "#ifndef AFS_RXGEN_EXPORT\n");
548 f_print(fout, "#define AFS_RXGEN_EXPORT __declspec(dllimport)\n");
549 f_print(fout, "#endif /* AFS_RXGEN_EXPORT */\n");
550 f_print(fout, "#else /* AFS_NT40_ENV */\n");
551 f_print(fout, "#define AFS_RXGEN_EXPORT\n");
552 f_print(fout, "#endif /* AFS_NT40_ENV */\n\n");
554 while ((def = get_definition())) {
557 h_Proc_CodeGeneration();
560 f_print(fout, "#endif /* _RXGEN_%s_ */\n", uppercase(fullname));
561 if (extend && tell == ftell(fout)) {
562 (void)unlink(outfilename);
567 * Compile into an RPC service
570 s_output(int argc, char *argv[], char *infile, char *define, int extend,
571 char *outfile, int nomain)
578 open_input(infile, define);
579 outfilename = extend ? extendfile(infile, outfile) : outfile;
580 open_output(infile, outfilename);
581 f_print(fout, "#include <stdio.h>\n");
582 f_print(fout, "#include <rpc/rpc.h>\n");
583 if (infile && (include = extendfile(infile, ".h"))) {
584 f_print(fout, "#include \"%s\"\n", include);
588 while ((def = get_definition())) {
589 foundprogram |= (def->def_kind == DEF_PROGRAM);
591 if (extend && !foundprogram) {
592 (void)unlink(outfilename);
596 write_programs((char *)NULL);
599 do_registers(argc, argv);
601 write_programs("static");
606 l_output(char *infile, char *define, int extend, char *outfile)
613 open_input(infile, define);
614 outfilename = extend ? extendfile(infile, outfile) : outfile;
615 open_output(infile, outfilename);
616 f_print(fout, "#include <rpc/rpc.h>\n");
617 f_print(fout, "#include <sys/time.h>\n");
618 if (infile && (include = extendfile(infile, ".h"))) {
619 f_print(fout, "#include \"%s\"\n", include);
623 while ((def = get_definition())) {
624 foundprogram |= (def->def_kind == DEF_PROGRAM);
626 if (extend && !foundprogram) {
627 (void)unlink(outfilename);
634 * Perform registrations for service output
637 do_registers(int argc, char *argv[])
641 for (i = 1; i < argc; i++) {
642 if (streq(argv[i], "-s")) {
643 write_register(argv[i + 1]);
651 C_output(char *infile, char *define, int extend, char *outfile, int append)
657 char *currfile = (OutFileFlag ? OutFile : infile);
660 open_input(infile, define);
661 memset(fullname, 0, sizeof(fullname));
663 strcpy(fullname, prefix);
664 strcat(fullname, infile);
666 strcpy(fullname, infile);
667 outfilename = extend ? extendfile(fullname, outfile) : outfile;
668 open_output(infile, outfilename);
669 f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n");
670 if (currfile && (include = extendfile(currfile, ".h"))) {
672 f_print(fout, "#include \"%s\"\n\n", include);
674 f_print(fout, "#include <afsconfig.h>\n");
675 f_print(fout, "#include <afs/param.h>\n");
676 f_print(fout, "#include <roken.h>\n");
677 f_print(fout, "#include \"%s\"\n\n", include);
682 f_print(fout, "#include \"h/types.h\"\n");
683 f_print(fout, "#include \"h/socket.h\"\n");
684 f_print(fout, "#include \"h/file.h\"\n");
685 f_print(fout, "#include \"h/stat.h\"\n");
686 f_print(fout, "#include \"netinet/in.h\"\n");
687 f_print(fout, "#include \"h/time.h\"\n");
688 f_print(fout, "#include \"rpc/types.h\"\n");
689 f_print(fout, "#include \"rx/xdr.h\"\n");
690 f_print(fout, "#include \"afs/rxgen_consts.h\"\n");
691 f_print(fout, "#include \"afs/afs_osi.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");
700 f_print(fout, "#include <sys/types.h>\n");
701 f_print(fout, "#include <rx/xdr.h>\n");
702 f_print(fout, "#include <rx/rx.h>\n");
704 f_print(fout, "#include <rx/rx_globals.h>\n");
707 f_print(fout, "#include <rx/rx_opaque.h\"\n");
709 f_print(fout, "#include <afs/rxgen_consts.h>\n");
714 while (get_definition())
716 if (extend && tell == ftell(fout)) {
717 (void)unlink(outfilename);
724 S_output(char *infile, char *define, int extend, char *outfile, int append)
731 char *currfile = (OutFileFlag ? OutFile : infile);
734 open_input(infile, define);
735 memset(fullname, 0, sizeof(fullname));
737 strcpy(fullname, prefix);
738 strcat(fullname, infile);
740 strcpy(fullname, infile);
741 outfilename = extend ? extendfile(fullname, outfile) : outfile;
742 open_output(infile, outfilename);
743 f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n");
744 if (currfile && (include = extendfile(currfile, ".h"))) {
746 f_print(fout, "#include \"%s\"\n", include);
748 f_print(fout, "#include <afsconfig.h>\n");
749 f_print(fout, "#include <afs/param.h>\n");
750 f_print(fout, "#include <roken.h>\n");
751 f_print(fout, "#include \"%s\"\n\n", include);
756 f_print(fout, "#include \"h/types.h\"\n");
757 f_print(fout, "#include \"h/socket.h\"\n");
758 f_print(fout, "#include \"h/file.h\"\n");
759 f_print(fout, "#include \"h/stat.h\"\n");
760 f_print(fout, "#include \"netinet/in.h\"\n");
761 f_print(fout, "#include \"h/time.h\"\n");
762 f_print(fout, "#include \"rpc/types.h\"\n");
763 f_print(fout, "#include \"rx/xdr.h\"\n");
764 f_print(fout, "#include \"afs/rxgen_consts.h\"\n");
765 f_print(fout, "#include \"afs/afs_osi.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");
774 f_print(fout, "#include <sys/types.h>\n");
775 f_print(fout, "#include <rx/xdr.h>\n");
776 f_print(fout, "#include <rx/rx.h>\n");
778 f_print(fout, "#include <rx/rx_globals.h>\n");
781 f_print(fout, "#include <rx/rx_opaque.h>\n");
783 f_print(fout, "#include <afs/rxgen_consts.h>\n");
789 while ((def = get_definition())) {
794 er_Proc_CodeGeneration();
796 if (extend && tell == ftell(fout)) {
797 (void)unlink(outfilename);
805 static char max_size[100];
807 int len = (int)strlen(str);
809 for (pnt = max_size; len > 0; len--, str++) {
810 *pnt++ = (islower(*str) ? toupper(*str) : *str);
817 * Parse command line arguments
820 parseargs(int argc, char *argv[], struct commandline *cmd)
825 char flag[(1 << (8 * sizeof(char)))];
829 cmd->infile = cmd->outfile = NULL;
833 memset(flag, 0, sizeof(flag));
835 for (i = 1; i < argc; i++) {
836 if (argv[i][0] != '-') {
840 cmd->infile = argv[i];
842 for (j = 1; argv[i][j] != 0; j++) {
869 if (argv[i][j - 1] != '-' || argv[i][j + 1] != 0) {
877 if (!streq(argv[i], "udp") && !streq(argv[i], "tcp")) {
880 } else if (c == 'o') {
884 cmd->outfile = argv[i];
888 if (argv[i][j - 1] != '-')
890 prefix = &argv[i][j + 1];
893 if (argv[i][j - 1] != '-')
895 IncludeDir[nincludes++] = &argv[i][j - 1];
905 cmd->ansic_flag = ansic_flag = flag['A'];
906 cmd->brief_flag = brief_flag = flag['b'];
907 cmd->cflag = cflag = flag['c'];
908 cmd->hflag = hflag = flag['h'];
909 cmd->sflag = flag['s'];
910 cmd->lflag = flag['l'];
911 cmd->mflag = flag['m'];
912 cmd->xflag = xflag = flag['x'];
913 cmd->yflag = yflag = flag['y'];
914 cmd->Cflag = Cflag = flag['C'];
915 cmd->Sflag = Sflag = flag['S'];
916 cmd->rflag = flag['r'];
917 cmd->uflag = uflag = flag['u'];
918 cmd->kflag = kflag = flag['k'];
919 cmd->pflag = flag['p'];
920 cmd->dflag = debug = flag['d'];
925 cmd->cflag + cmd->hflag + cmd->sflag + cmd->lflag + cmd->mflag +
926 cmd->Cflag + cmd->Sflag + cmd->rflag;
928 if (cmd->outfile != NULL || cmd->infile == NULL) {
931 } else if (nflags > 1) {