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 */
74 static char *IncludeDir[MAXCPPARGS];
76 char *OutFileFlag = "";
78 char Sflag = 0, Cflag = 0, hflag = 0, cflag = 0, kflag = 0, uflag = 0;
79 char ansic_flag = 0; /* If set, build ANSI C style prototypes */
80 char brief_flag = 0; /* If set, shorten names */
81 char zflag = 0; /* If set, abort server stub if rpc call returns non-zero */
82 char xflag = 0; /* if set, add stats code to stubs */
83 char yflag = 0; /* if set, only emit function name arrays to xdr file */
85 static int pclose_fin = 0;
88 static char *CPP = PATH_CPP;
91 static char *CPP = "cl /EP /C /nologo";
93 static char *CPP = "/lib/cpp";
98 * Running "cpp" directly on DEC OSF/1 does not define anything; the "cc"
99 * driver is responsible. To compensate (and allow for other definitions
100 * which should always be passed to "cpp"), place definitions which whould
101 * always be passed to "rxgen" in this string.
103 static char *CPPFLAGS = "-C"
114 #include "AFS_component_version_number.c"
116 /* static prototypes */
117 static char *extendfile(char *file, char *ext);
118 static void open_output(char *infile, char *outfile);
119 static void open_input(char *infile, char *define);
120 static void c_output(char *infile, char *define, int extend, char *outfile,
122 static void h_output(char *infile, char *define, int extend, char *outfile,
124 static void s_output(int argc, char *argv[], char *infile, char *define,
125 int extend, char *outfile, int nomain);
126 static void l_output(char *infile, char *define, int extend, char *outfile);
127 static void do_registers(int argc, char *argv[]);
128 static int parseargs(int argc, char *argv[], struct commandline *cmd);
129 static void C_output(char *infile, char *define, int extend, char *outfile,
131 static void S_output(char *infile, char *define, int extend, char *outfile,
133 static char *uppercase(char *str);
136 main(int argc, char *argv[])
138 struct commandline cmd;
141 ep = getenv("RXGEN_CPPCMD");
146 * The following signal action for AIX is necessary so that in case of a
147 * crash (i.e. core is generated) we can include the user's data section
148 * in the core dump. Unfortunately, by default, only a partial core is
149 * generated which, in many cases, isn't too useful.
151 struct sigaction nsa;
153 sigemptyset(&nsa.sa_mask);
154 nsa.sa_handler = SIG_DFL;
155 nsa.sa_flags = SA_FULLDUMP;
156 sigaction(SIGSEGV, &nsa, NULL);
159 if (!parseargs(argc, argv, &cmd)) {
160 f_print(stderr, "usage: %s infile\n", cmdname);
162 " %s [-c | -h | -l | -m | -C | -S | -r | -b | -k | -R | -p | -d | -z | -u] [-Pprefix] [-Idir] [-o outfile] [infile]\n",
164 f_print(stderr, " %s [-s udp|tcp]* [-o outfile] [infile]\n",
168 OutFileFlag = cmd.outfile;
170 strcpy(OutFile, cmd.outfile);
173 c_output(cmd.infile, "-DRPC_XDR", !EXTEND, cmd.outfile, 0);
174 } else if (cmd.hflag) {
175 h_output(cmd.infile, "-DRPC_HDR", !EXTEND, cmd.outfile, 0);
176 } else if (cmd.lflag) {
177 l_output(cmd.infile, "-DRPC_CLNT", !EXTEND, cmd.outfile);
178 } else if (cmd.sflag || cmd.mflag) {
179 s_output(argc, argv, cmd.infile, "-DRPC_SVC", !EXTEND, cmd.outfile,
181 } else if (cmd.Cflag) {
183 C_output(cmd.infile, "-DRPC_CLIENT", !EXTEND, cmd.outfile, 1);
184 } else if (cmd.Sflag) {
186 S_output(cmd.infile, "-DRPC_SERVER", !EXTEND, cmd.outfile, 1);
188 if (OutFileFlag && (strrchr(OutFile, '.') == NULL))
189 strcat(OutFile, ".");
191 C_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_CLIENT",
194 S_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_SERVER",
199 c_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_XDR",
200 EXTEND, ".xdr.c", 0);
202 h_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_HDR",
205 C_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_CLIENT",
208 S_output((OutFileFlag ? OutFile : cmd.infile), "-DRPC_SERVER",
213 if (fin && pclose_fin) {
214 /* the cpp command we called returned a non-zero exit status */
223 * add extension to filename
226 extendfile(char *file, char *ext)
232 res = alloc(strlen(file) + strlen(ext) + 1);
236 p = (char *)strrchr(file, '.');
238 p = file + strlen(file);
240 sname = (char *)strrchr(file, '/');
246 strcpy(res + (p - sname), ext);
251 * Open output file with given extension
254 open_output(char *infile, char *outfile)
256 if (outfile == NULL) {
260 if (infile != NULL && streq(outfile, infile)) {
261 f_print(stderr, "%s: output would overwrite %s\n", cmdname, infile);
264 fout = fopen(outfile, "w");
266 f_print(stderr, "%s: unable to open ", cmdname);
270 record_open(outfile);
274 * Open input file with given define for C-preprocessor
277 open_input(char *infile, char *define)
283 infilename = (infile == NULL) ? "<stdin>" : infile;
284 l = strlen(CPP) + strlen(CPPFLAGS) + strlen(define) + 3;
285 for (i = 0; i < nincludes; i++)
286 l += strlen(IncludeDir[i]) + 1;
287 l += strlen(infile) + 1;
288 cpp_cmdline = malloc(l);
290 perror("Unable to allocate space for cpp command line");
294 sprintf(cpp_cmdline, "%s %s %s", CPP, CPPFLAGS, define);
295 l = strlen(cpp_cmdline);
296 for (i = 0; i < nincludes; i++) {
297 cpp_cmdline[l++] = ' ';
298 strcpy(cpp_cmdline + l, IncludeDir[i]);
299 l += strlen(IncludeDir[i]);
301 cpp_cmdline[l++] = ' ';
302 strcpy(cpp_cmdline + l, infile);
304 fin = popen(cpp_cmdline, "r");
310 if (infile == NULL) {
314 fin = fopen(infile, "r");
317 f_print(stderr, "%s: ", cmdname);
324 * Compile into an XDR routine output file
327 c_output(char *infile, char *define, int extend, char *outfile, int append)
334 char *currfile = (OutFileFlag ? OutFile : infile);
337 open_input(infile, define);
339 memset(fullname, 0, sizeof(fullname));
341 strcpy(fullname, prefix);
342 strcat(fullname, infile);
344 strcpy(fullname, infile);
345 outfilename = extend ? extendfile(fullname, outfile) : outfile;
346 open_output(infile, outfilename);
347 f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n");
350 f_print(fout, "#include \"afsconfig.h\"\n");
351 f_print(fout, "#include \"afs/param.h\"\n");
353 f_print(fout, "#include <afsconfig.h>\n");
354 f_print(fout, "#include <afs/param.h>\n");
355 f_print(fout, "#include <roken.h>\n");
357 f_print(fout, "#ifdef AFS_NT40_ENV\n");
358 f_print(fout, "#define AFS_RXGEN_EXPORT __declspec(dllexport)\n");
359 f_print(fout, "#endif /* AFS_NT40_ENV */\n");
361 if (currfile && (include = extendfile(currfile, ".h"))) {
363 f_print(fout, "#include \"%s\"\n\n", include);
365 f_print(fout, "#include \"%s\"\n\n", include);
368 /* In case we can't include the interface's own header file... */
370 f_print(fout, "#include \"h/types.h\"\n");
371 f_print(fout, "#include \"h/socket.h\"\n");
372 f_print(fout, "#include \"h/file.h\"\n");
373 f_print(fout, "#include \"h/stat.h\"\n");
374 f_print(fout, "#include \"netinet/in.h\"\n");
375 f_print(fout, "#include \"h/time.h\"\n");
376 f_print(fout, "#include \"rx/xdr.h\"\n");
377 f_print(fout, "#include \"afs/rxgen_consts.h\"\n");
379 f_print(fout, "#include <rx/xdr.h>\n");
384 while ((def = get_definition())) {
386 if ((!IsRxgenDefinition(def)) && def->def_kind != DEF_CUSTOMIZED)
392 * Print out array containing list of all functions in the interface
397 for (j = 0; j <= PackageIndex; j++) {
398 f_print(fout, "AFS_RXGEN_EXPORT\n");
399 f_print(fout, "const char *%sfunction_names[] = {\n",
402 for (i = 0; i < no_of_stat_funcs_header[j]; i++) {
404 f_print(fout, "\t\"%s\"", function_list[j][i]);
406 f_print(fout, ",\n\t\"%s\"", function_list[j][i]);
411 f_print(fout, "\n};\n");
413 er_Proc_CodeGeneration();
416 if (extend && tell == ftell(fout)) {
417 (void)unlink(outfilename);
423 * Compile into an XDR header file
426 h_output(char *infile, char *define, int extend, char *outfile, int append)
431 char fullname[1024], *p;
433 open_input(infile, define);
435 memset(fullname, 0, sizeof(fullname));
437 strcpy(fullname, prefix);
438 strcat(fullname, infile);
440 strcpy(fullname, infile);
441 outfilename = extend ? extendfile(fullname, outfile) : outfile;
442 open_output(infile, outfilename);
443 strcpy(fullname, outfilename);
444 if ((p = strchr(fullname, '.')))
446 f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n");
447 f_print(fout, "#ifndef _RXGEN_%s_\n", uppercase(fullname));
448 f_print(fout, "#define _RXGEN_%s_\n\n", uppercase(fullname));
449 f_print(fout, "#ifdef KERNEL\n");
451 "/* 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");
452 f_print(fout, "#include <afsconfig.h>\n");
453 f_print(fout, "#include \"afs/param.h\"\n");
454 f_print(fout, "#ifdef UKERNEL\n");
455 f_print(fout, "#include \"afs/sysincludes.h\"\n");
456 f_print(fout, "#include \"rx/xdr.h\"\n");
457 f_print(fout, "#include \"rx/rx.h\"\n");
459 f_print(fout, "#include \"rx/rx_globals.h\"\n");
462 f_print(fout, "#include \"rx/rx_opaque.h\"\n");
464 f_print(fout, "#else /* UKERNEL */\n");
465 f_print(fout, "#include \"h/types.h\"\n");
466 f_print(fout, "#ifndef SOCK_DGRAM /* XXXXX */\n");
467 f_print(fout, "#include \"h/socket.h\"\n");
468 f_print(fout, "#endif\n");
469 f_print(fout, "#ifndef DTYPE_SOCKET /* XXXXX */\n");
470 f_print(fout, "#ifndef AFS_LINUX22_ENV\n");
471 f_print(fout, "#include \"h/file.h\"\n");
472 f_print(fout, "#endif\n");
473 f_print(fout, "#endif\n");
474 f_print(fout, "#ifndef S_IFMT /* XXXXX */\n");
475 f_print(fout, "#include \"h/stat.h\"\n");
476 f_print(fout, "#endif\n");
477 f_print(fout, "#if defined (AFS_OBSD_ENV) && !defined (MLEN)\n");
478 f_print(fout, "#include \"sys/mbuf.h\"\n");
479 f_print(fout, "#endif\n");
480 f_print(fout, "#ifndef IPPROTO_UDP /* XXXXX */\n");
481 f_print(fout, "#include \"netinet/in.h\"\n");
482 f_print(fout, "#endif\n");
483 f_print(fout, "#ifndef DST_USA /* XXXXX */\n");
484 f_print(fout, "#include \"h/time.h\"\n");
485 f_print(fout, "#endif\n");
486 f_print(fout, "#ifndef AFS_LINUX22_ENV\n");
487 f_print(fout, "#include \"rpc/types.h\"\n");
488 f_print(fout, "#endif /* AFS_LINUX22_ENV */\n");
489 f_print(fout, "#ifndef XDR_GETLONG /* XXXXX */\n");
490 f_print(fout, "#ifdef AFS_LINUX22_ENV\n");
491 f_print(fout, "#ifndef quad_t\n");
492 f_print(fout, "#define quad_t __quad_t\n");
493 f_print(fout, "#define u_quad_t __u_quad_t\n");
494 f_print(fout, "#endif\n");
495 f_print(fout, "#endif\n");
496 f_print(fout, "#include \"rx/xdr.h\"\n");
497 f_print(fout, "#endif /* XDR_GETLONG */\n");
498 f_print(fout, "#endif /* UKERNEL */\n");
499 f_print(fout, "#include \"afs/rxgen_consts.h\"\n");
500 f_print(fout, "#include \"afs_osi.h\"\n");
501 f_print(fout, "#include \"rx/rx.h\"\n");
503 f_print(fout, "#include \"rx/rx_globals.h\"\n");
506 f_print(fout, "#include \"rx/rx_opaque.h\"\n");
508 f_print(fout, "#else /* KERNEL */\n");
509 f_print(fout, "#include <afs/param.h>\n");
510 f_print(fout, "#include <afs/stds.h>\n");
511 f_print(fout, "#include <sys/types.h>\n");
512 f_print(fout, "#include <rx/xdr.h>\n");
513 f_print(fout, "#include <rx/rx.h>\n");
515 f_print(fout, "#include <rx/rx_globals.h>\n");
518 f_print(fout, "#include <rx/rx_opaque.h>\n");
520 f_print(fout, "#include <afs/rxgen_consts.h>\n");
522 f_print(fout, "#include <ubik.h>\n");
523 f_print(fout, "#endif /* KERNEL */\n\n");
524 f_print(fout, "#ifdef AFS_NT40_ENV\n");
525 f_print(fout, "#ifndef AFS_RXGEN_EXPORT\n");
526 f_print(fout, "#define AFS_RXGEN_EXPORT __declspec(dllimport)\n");
527 f_print(fout, "#endif /* AFS_RXGEN_EXPORT */\n");
528 f_print(fout, "#else /* AFS_NT40_ENV */\n");
529 f_print(fout, "#define AFS_RXGEN_EXPORT\n");
530 f_print(fout, "#endif /* AFS_NT40_ENV */\n\n");
532 while ((def = get_definition())) {
535 h_Proc_CodeGeneration();
538 f_print(fout, "#endif /* _RXGEN_%s_ */\n", uppercase(fullname));
539 if (extend && tell == ftell(fout)) {
540 (void)unlink(outfilename);
545 * Compile into an RPC service
548 s_output(int argc, char *argv[], char *infile, char *define, int extend,
549 char *outfile, int nomain)
556 open_input(infile, define);
557 outfilename = extend ? extendfile(infile, outfile) : outfile;
558 open_output(infile, outfilename);
559 f_print(fout, "#include <stdio.h>\n");
560 f_print(fout, "#include <rpc/rpc.h>\n");
561 if (infile && (include = extendfile(infile, ".h"))) {
562 f_print(fout, "#include \"%s\"\n", include);
566 while ((def = get_definition())) {
567 foundprogram |= (def->def_kind == DEF_PROGRAM);
569 if (extend && !foundprogram) {
570 (void)unlink(outfilename);
574 write_programs(NULL);
577 do_registers(argc, argv);
579 write_programs("static");
584 l_output(char *infile, char *define, int extend, char *outfile)
591 open_input(infile, define);
592 outfilename = extend ? extendfile(infile, outfile) : outfile;
593 open_output(infile, outfilename);
594 f_print(fout, "#include <rpc/rpc.h>\n");
595 f_print(fout, "#include <sys/time.h>\n");
596 if (infile && (include = extendfile(infile, ".h"))) {
597 f_print(fout, "#include \"%s\"\n", include);
601 while ((def = get_definition())) {
602 foundprogram |= (def->def_kind == DEF_PROGRAM);
604 if (extend && !foundprogram) {
605 (void)unlink(outfilename);
612 * Perform registrations for service output
615 do_registers(int argc, char *argv[])
619 for (i = 1; i < argc; i++) {
620 if (streq(argv[i], "-s")) {
621 write_register(argv[i + 1]);
629 C_output(char *infile, char *define, int extend, char *outfile, int append)
635 char *currfile = (OutFileFlag ? OutFile : infile);
638 open_input(infile, define);
639 memset(fullname, 0, sizeof(fullname));
641 strcpy(fullname, prefix);
642 strcat(fullname, infile);
644 strcpy(fullname, infile);
645 outfilename = extend ? extendfile(fullname, outfile) : outfile;
646 open_output(infile, outfilename);
647 f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n");
648 if (currfile && (include = extendfile(currfile, ".h"))) {
650 f_print(fout, "#include \"%s\"\n\n", include);
652 f_print(fout, "#include <afsconfig.h>\n");
653 f_print(fout, "#include <afs/param.h>\n");
654 f_print(fout, "#include <roken.h>\n");
655 f_print(fout, "#include <afs/opr.h>\n");
656 f_print(fout, "#ifdef AFS_PTHREAD_ENV\n");
657 f_print(fout, "# include <opr/lock.h>\n");
658 f_print(fout, "#endif\n");
659 f_print(fout, "#include \"%s\"\n\n", include);
664 f_print(fout, "#include \"h/types.h\"\n");
665 f_print(fout, "#include \"h/socket.h\"\n");
666 f_print(fout, "#include \"h/file.h\"\n");
667 f_print(fout, "#include \"h/stat.h\"\n");
668 f_print(fout, "#include \"netinet/in.h\"\n");
669 f_print(fout, "#include \"h/time.h\"\n");
670 f_print(fout, "#include \"rpc/types.h\"\n");
671 f_print(fout, "#include \"rx/xdr.h\"\n");
672 f_print(fout, "#include \"afs/rxgen_consts.h\"\n");
673 f_print(fout, "#include \"afs/afs_osi.h\"\n");
674 f_print(fout, "#include \"rx/rx.h\"\n");
676 f_print(fout, "#include \"rx/rx_globals.h\"\n");
679 f_print(fout, "#include \"rx/rx_opaque.h\"\n");
682 f_print(fout, "#include <sys/types.h>\n");
683 f_print(fout, "#include <rx/xdr.h>\n");
684 f_print(fout, "#include <rx/rx.h>\n");
686 f_print(fout, "#include <rx/rx_globals.h>\n");
689 f_print(fout, "#include <rx/rx_opaque.h\"\n");
691 f_print(fout, "#include <afs/rxgen_consts.h>\n");
696 while (get_definition())
698 if (extend && tell == ftell(fout)) {
699 (void)unlink(outfilename);
706 S_output(char *infile, char *define, int extend, char *outfile, int append)
713 char *currfile = (OutFileFlag ? OutFile : infile);
716 open_input(infile, define);
717 memset(fullname, 0, sizeof(fullname));
719 strcpy(fullname, prefix);
720 strcat(fullname, infile);
722 strcpy(fullname, infile);
723 outfilename = extend ? extendfile(fullname, outfile) : outfile;
724 open_output(infile, outfilename);
725 f_print(fout, "/* Machine generated file -- Do NOT edit */\n\n");
726 if (currfile && (include = extendfile(currfile, ".h"))) {
728 f_print(fout, "#include \"%s\"\n", include);
730 f_print(fout, "#include <afsconfig.h>\n");
731 f_print(fout, "#include <afs/param.h>\n");
732 f_print(fout, "#include <roken.h>\n");
733 f_print(fout, "#include \"%s\"\n\n", include);
738 f_print(fout, "#include \"h/types.h\"\n");
739 f_print(fout, "#include \"h/socket.h\"\n");
740 f_print(fout, "#include \"h/file.h\"\n");
741 f_print(fout, "#include \"h/stat.h\"\n");
742 f_print(fout, "#include \"netinet/in.h\"\n");
743 f_print(fout, "#include \"h/time.h\"\n");
744 f_print(fout, "#include \"rpc/types.h\"\n");
745 f_print(fout, "#include \"rx/xdr.h\"\n");
746 f_print(fout, "#include \"afs/rxgen_consts.h\"\n");
747 f_print(fout, "#include \"afs/afs_osi.h\"\n");
748 f_print(fout, "#include \"rx/rx.h\"\n");
750 f_print(fout, "#include \"rx/rx_globals.h\"\n");
753 f_print(fout, "#include \"rx/rx_opaque.h\"\n");
756 f_print(fout, "#include <sys/types.h>\n");
757 f_print(fout, "#include <rx/xdr.h>\n");
758 f_print(fout, "#include <rx/rx.h>\n");
760 f_print(fout, "#include <rx/rx_globals.h>\n");
763 f_print(fout, "#include <rx/rx_opaque.h>\n");
765 f_print(fout, "#include <afs/rxgen_consts.h>\n");
771 while ((def = get_definition())) {
776 er_Proc_CodeGeneration();
778 if (extend && tell == ftell(fout)) {
779 (void)unlink(outfilename);
787 static char max_size[100];
789 int len = (int)strlen(str);
791 for (pnt = max_size; len > 0; len--, str++) {
792 *pnt++ = (islower(*str) ? toupper(*str) : *str);
799 * Parse command line arguments
802 parseargs(int argc, char *argv[], struct commandline *cmd)
807 char flag[(1 << (8 * sizeof(char)))];
811 cmd->infile = cmd->outfile = NULL;
815 memset(flag, 0, sizeof(flag));
817 for (i = 1; i < argc; i++) {
818 if (argv[i][0] != '-') {
822 cmd->infile = argv[i];
824 for (j = 1; argv[i][j] != 0; j++) {
851 if (argv[i][j - 1] != '-' || argv[i][j + 1] != 0) {
859 if (!streq(argv[i], "udp") && !streq(argv[i], "tcp")) {
862 } else if (c == 'o') {
866 cmd->outfile = argv[i];
870 if (argv[i][j - 1] != '-')
872 prefix = &argv[i][j + 1];
875 if (nincludes >= MAXCPPARGS) {
876 f_print(stderr, "Too many -I arguments\n");
879 if (argv[i][j - 1] != '-')
881 IncludeDir[nincludes++] = &argv[i][j - 1];
891 cmd->ansic_flag = ansic_flag = flag['A'];
892 cmd->brief_flag = brief_flag = flag['b'];
893 cmd->cflag = cflag = flag['c'];
894 cmd->hflag = hflag = flag['h'];
895 cmd->sflag = flag['s'];
896 cmd->lflag = flag['l'];
897 cmd->mflag = flag['m'];
898 cmd->xflag = xflag = flag['x'];
899 cmd->yflag = yflag = flag['y'];
900 cmd->Cflag = Cflag = flag['C'];
901 cmd->Sflag = Sflag = flag['S'];
902 cmd->rflag = flag['r'];
903 cmd->uflag = uflag = flag['u'];
904 cmd->kflag = kflag = flag['k'];
905 cmd->pflag = flag['p'];
906 cmd->dflag = debug = flag['d'];
911 cmd->cflag + cmd->hflag + cmd->sflag + cmd->lflag + cmd->mflag +
912 cmd->Cflag + cmd->Sflag + cmd->rflag;
914 if (cmd->outfile != NULL || cmd->infile == NULL) {
917 } else if (nflags > 1) {