Deleted Added
full compact
rpc_main.c (12798) rpc_main.c (17142)
1/*
2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 * unrestricted use provided that this legend is included on all tape
4 * media and as a part of the software program in whole or part. Users
5 * may copy or modify Sun RPC without charge, but are not authorized
6 * to license or distribute it to anyone else except as part of a product or
7 * program developed by the user.
8 *

--- 28 unchanged lines hidden (view full) ---

37/*
38 * rpc_main.c, Top level of the RPC protocol compiler.
39 * Copyright (C) 1987, Sun Microsystems, Inc.
40 */
41
42#include <stdio.h>
43#include <string.h>
44#include <unistd.h>
1/*
2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 * unrestricted use provided that this legend is included on all tape
4 * media and as a part of the software program in whole or part. Users
5 * may copy or modify Sun RPC without charge, but are not authorized
6 * to license or distribute it to anyone else except as part of a product or
7 * program developed by the user.
8 *

--- 28 unchanged lines hidden (view full) ---

37/*
38 * rpc_main.c, Top level of the RPC protocol compiler.
39 * Copyright (C) 1987, Sun Microsystems, Inc.
40 */
41
42#include <stdio.h>
43#include <string.h>
44#include <unistd.h>
45#include <ctype.h>
45#include <sys/types.h>
46#include <sys/param.h>
47#include <sys/file.h>
48#include <sys/stat.h>
49#include "rpc_parse.h"
50#include "rpc_util.h"
51#include "rpc_scan.h"
52
53extern void write_sample_svc __P(( definition * ));
54extern int write_sample_clnt __P(( definition * ));
55extern void write_sample_clnt_main __P(( void ));
46#include <sys/types.h>
47#include <sys/param.h>
48#include <sys/file.h>
49#include <sys/stat.h>
50#include "rpc_parse.h"
51#include "rpc_util.h"
52#include "rpc_scan.h"
53
54extern void write_sample_svc __P(( definition * ));
55extern int write_sample_clnt __P(( definition * ));
56extern void write_sample_clnt_main __P(( void ));
56static int c_output __P(( char *, char *, int, char * ));
57static int h_output __P(( char *, char *, int, char * ));
58static int l_output __P(( char *, char *, int, char * ));
59static int t_output __P(( char *, char *, int, char * ));
60static int clnt_output __P(( char *, char *, int, char * ));
57extern void add_sample_msg __P(( void ));
58static void c_output __P(( char *, char *, int, char * ));
59static void h_output __P(( char *, char *, int, char * ));
60static void l_output __P(( char *, char *, int, char * ));
61static void t_output __P(( char *, char *, int, char * ));
62static void clnt_output __P(( char *, char *, int, char * ));
61
63
64void c_initialize __P(( void ));
65
62#ifndef __FreeBSD__
63char * rindex();
64#endif
65
66#ifndef __FreeBSD__
67char * rindex();
68#endif
69
66static int usage __P(( void ));
67static int options_usage __P (( void ));
70static void usage __P(( void ));
71static void options_usage __P (( void ));
68static int do_registers __P(( int, char ** ));
69static int parseargs __P(( int, char **, struct commandline * ));
72static int do_registers __P(( int, char ** ));
73static int parseargs __P(( int, char **, struct commandline * ));
70static int svc_output __P(( char *, char *, int, char * ));
74static void svc_output __P(( char *, char *, int, char * ));
71static void mkfile_output __P(( struct commandline * ));
75static void mkfile_output __P(( struct commandline * ));
72static int s_output __P(( int, char **, char *, char *, int, char *, int, int ));
76static void s_output __P(( int, char **, char *, char *, int, char *, int, int ));
73
74#define EXTEND 1 /* alias for TRUE */
75#define DONT_EXTEND 0 /* alias for FALSE */
76
77#define SVR4_CPP "/usr/ccs/lib/cpp"
78#ifdef __FreeBSD__
79#define SUNOS_CPP "/usr/libexec/cpp"
80#else

--- 70 unchanged lines hidden (view full) ---

151#else
152int tirpcflag = 1; /* generating code for tirpc, by default */
153#endif
154xdrfunc *xdrfunc_head = NULL; /* xdr function list */
155xdrfunc *xdrfunc_tail = NULL; /* xdr function list */
156pid_t childpid;
157
158
77
78#define EXTEND 1 /* alias for TRUE */
79#define DONT_EXTEND 0 /* alias for FALSE */
80
81#define SVR4_CPP "/usr/ccs/lib/cpp"
82#ifdef __FreeBSD__
83#define SUNOS_CPP "/usr/libexec/cpp"
84#else

--- 70 unchanged lines hidden (view full) ---

155#else
156int tirpcflag = 1; /* generating code for tirpc, by default */
157#endif
158xdrfunc *xdrfunc_head = NULL; /* xdr function list */
159xdrfunc *xdrfunc_tail = NULL; /* xdr function list */
160pid_t childpid;
161
162
163int
159main(argc, argv)
160 int argc;
161 char *argv[];
162{
163 struct commandline cmd;
164
165 (void) memset((char *)&cmd, 0, sizeof (struct commandline));
166 clear_args();

--- 102 unchanged lines hidden (view full) ---

269 (void) strcpy(res, file);
270 (void) strcpy(res + (p - file), ext);
271 return (res);
272}
273
274/*
275 * Open output file with given extension
276 */
164main(argc, argv)
165 int argc;
166 char *argv[];
167{
168 struct commandline cmd;
169
170 (void) memset((char *)&cmd, 0, sizeof (struct commandline));
171 clear_args();

--- 102 unchanged lines hidden (view full) ---

274 (void) strcpy(res, file);
275 (void) strcpy(res + (p - file), ext);
276 return (res);
277}
278
279/*
280 * Open output file with given extension
281 */
277static
282static void
278open_output(infile, outfile)
279 char *infile;
280 char *outfile;
281{
282
283 if (outfile == NULL) {
284 fout = stdout;
285 return;

--- 7 unchanged lines hidden (view full) ---

293 fout = fopen(outfile, "w");
294 if (fout == NULL) {
295 f_print(stderr, "%s: unable to open ", cmdname);
296 perror(outfile);
297 crash();
298 }
299 record_open(outfile);
300
283open_output(infile, outfile)
284 char *infile;
285 char *outfile;
286{
287
288 if (outfile == NULL) {
289 fout = stdout;
290 return;

--- 7 unchanged lines hidden (view full) ---

298 fout = fopen(outfile, "w");
299 if (fout == NULL) {
300 f_print(stderr, "%s: unable to open ", cmdname);
301 perror(outfile);
302 crash();
303 }
304 record_open(outfile);
305
306 return;
301}
302
307}
308
303static
309static void
304add_warning()
305{
306 f_print(fout, "/*\n");
307 f_print(fout, " * Please do not edit this file.\n");
308 f_print(fout, " * It was generated using rpcgen.\n");
309 f_print(fout, " */\n\n");
310}
311

--- 25 unchanged lines hidden (view full) ---

337 }
338 }
339 }
340}
341
342/*
343 * Open input file with given define for C-preprocessor
344 */
310add_warning()
311{
312 f_print(fout, "/*\n");
313 f_print(fout, " * Please do not edit this file.\n");
314 f_print(fout, " * It was generated using rpcgen.\n");
315 f_print(fout, " */\n\n");
316}
317

--- 25 unchanged lines hidden (view full) ---

343 }
344 }
345 }
346}
347
348/*
349 * Open input file with given define for C-preprocessor
350 */
345static
351static void
346open_input(infile, define)
347 char *infile;
348 char *define;
349{
350 int pd[2];
351
352 infilename = (infile == NULL) ? "<stdin>" : infile;
353 (void) pipe(pd);

--- 73 unchanged lines hidden (view full) ---

427 if (access(temp, F_OK) != -1)
428 return (temp);
429 else
430 return ((char *)" ");
431
432}
433
434
352open_input(infile, define)
353 char *infile;
354 char *define;
355{
356 int pd[2];
357
358 infilename = (infile == NULL) ? "<stdin>" : infile;
359 (void) pipe(pd);

--- 73 unchanged lines hidden (view full) ---

433 if (access(temp, F_OK) != -1)
434 return (temp);
435 else
436 return ((char *)" ");
437
438}
439
440
435static
441static void
436c_output(infile, define, extend, outfile)
437 char *infile;
438 char *define;
439 int extend;
440 char *outfile;
441{
442 definition *def;
443 char *include;

--- 7 unchanged lines hidden (view full) ---

451 add_warning();
452 if (infile && (include = extendfile(infile, ".h"))) {
453 f_print(fout, "#include \"%s\"\n", include);
454 free(include);
455 /* .h file already contains rpc/rpc.h */
456 } else
457 f_print(fout, "#include <rpc/rpc.h>\n");
458 tell = ftell(fout);
442c_output(infile, define, extend, outfile)
443 char *infile;
444 char *define;
445 int extend;
446 char *outfile;
447{
448 definition *def;
449 char *include;

--- 7 unchanged lines hidden (view full) ---

457 add_warning();
458 if (infile && (include = extendfile(infile, ".h"))) {
459 f_print(fout, "#include \"%s\"\n", include);
460 free(include);
461 /* .h file already contains rpc/rpc.h */
462 } else
463 f_print(fout, "#include <rpc/rpc.h>\n");
464 tell = ftell(fout);
459 while (def = get_definition()) {
465 while ( (def = get_definition()) ) {
460 emit(def);
461 }
462 if (extend && tell == ftell(fout)) {
463 (void) unlink(outfilename);
464 }
465}
466
467
466 emit(def);
467 }
468 if (extend && tell == ftell(fout)) {
469 (void) unlink(outfilename);
470 }
471}
472
473
474void
468c_initialize()
469{
470
471 /* add all the starting basic types */
472 add_type(1, "int");
473 add_type(1, "long");
474 add_type(1, "short");
475 add_type(1, "bool");

--- 31 unchanged lines hidden (view full) ---

507 return (guard);
508}
509
510/*
511 * Compile into an XDR header file
512 */
513
514
475c_initialize()
476{
477
478 /* add all the starting basic types */
479 add_type(1, "int");
480 add_type(1, "long");
481 add_type(1, "short");
482 add_type(1, "bool");

--- 31 unchanged lines hidden (view full) ---

514 return (guard);
515}
516
517/*
518 * Compile into an XDR header file
519 */
520
521
515static
522static void
516h_output(infile, define, extend, outfile)
517 char *infile;
518 char *define;
519 int extend;
520 char *outfile;
521{
522 definition *def;
523 char *outfilename;

--- 29 unchanged lines hidden (view full) ---

553 f_print(fout, "#endif\n\n");
554 }
555
556 /* put in a typedef for quadprecision. Only with Cflag */
557
558 tell = ftell(fout);
559
560 /* print data definitions */
523h_output(infile, define, extend, outfile)
524 char *infile;
525 char *define;
526 int extend;
527 char *outfile;
528{
529 definition *def;
530 char *outfilename;

--- 29 unchanged lines hidden (view full) ---

560 f_print(fout, "#endif\n\n");
561 }
562
563 /* put in a typedef for quadprecision. Only with Cflag */
564
565 tell = ftell(fout);
566
567 /* print data definitions */
561 while (def = get_definition()) {
568 while ( (def = get_definition()) ) {
562 print_datadef(def);
563 }
564
565 /*
566 * print function declarations.
567 * Do this after data definitions because they might be used as
568 * arguments for functions
569 */

--- 52 unchanged lines hidden (view full) ---

622 }
623
624 f_print(fout, "\n#endif /* !_%s */\n", guard);
625}
626
627/*
628 * Compile into an RPC service
629 */
569 print_datadef(def);
570 }
571
572 /*
573 * print function declarations.
574 * Do this after data definitions because they might be used as
575 * arguments for functions
576 */

--- 52 unchanged lines hidden (view full) ---

629 }
630
631 f_print(fout, "\n#endif /* !_%s */\n", guard);
632}
633
634/*
635 * Compile into an RPC service
636 */
630static
637static void
631s_output(argc, argv, infile, define, extend, outfile, nomain, netflag)
632 int argc;
633 char *argv[];
634 char *infile;
635 char *define;
636 int extend;
637 char *outfile;
638 int nomain;

--- 66 unchanged lines hidden (view full) ---

705 f_print(fout,
706 "\n#ifndef SIG_PF\n#define SIG_PF void(*)\
707(int)\n#endif\n");
708
709 f_print(fout, "\n#ifdef DEBUG\n#define RPC_SVC_FG\n#endif\n");
710 if (timerflag)
711 f_print(fout, "\n#define _RPCSVC_CLOSEDOWN %s\n",
712 svcclosetime);
638s_output(argc, argv, infile, define, extend, outfile, nomain, netflag)
639 int argc;
640 char *argv[];
641 char *infile;
642 char *define;
643 int extend;
644 char *outfile;
645 int nomain;

--- 66 unchanged lines hidden (view full) ---

712 f_print(fout,
713 "\n#ifndef SIG_PF\n#define SIG_PF void(*)\
714(int)\n#endif\n");
715
716 f_print(fout, "\n#ifdef DEBUG\n#define RPC_SVC_FG\n#endif\n");
717 if (timerflag)
718 f_print(fout, "\n#define _RPCSVC_CLOSEDOWN %s\n",
719 svcclosetime);
713 while (def = get_definition()) {
720 while ( (def = get_definition()) ) {
714 foundprogram |= (def->def_kind == DEF_PROGRAM);
715 }
716 if (extend && !foundprogram) {
717 (void) unlink(outfilename);
718 return;
719 }
720 write_most(infile, netflag, nomain);
721 if (!nomain) {

--- 4 unchanged lines hidden (view full) ---

726 }
727 write_rest();
728 }
729}
730
731/*
732 * generate client side stubs
733 */
721 foundprogram |= (def->def_kind == DEF_PROGRAM);
722 }
723 if (extend && !foundprogram) {
724 (void) unlink(outfilename);
725 return;
726 }
727 write_most(infile, netflag, nomain);
728 if (!nomain) {

--- 4 unchanged lines hidden (view full) ---

733 }
734 write_rest();
735 }
736}
737
738/*
739 * generate client side stubs
740 */
734static
741static void
735l_output(infile, define, extend, outfile)
736 char *infile;
737 char *define;
738 int extend;
739 char *outfile;
740{
741 char *include;
742 definition *def;

--- 6 unchanged lines hidden (view full) ---

749 add_warning();
750 if (Cflag)
751 f_print (fout, "#include <memory.h> /* for memset */\n");
752 if (infile && (include = extendfile(infile, ".h"))) {
753 f_print(fout, "#include \"%s\"\n", include);
754 free(include);
755 } else
756 f_print(fout, "#include <rpc/rpc.h>\n");
742l_output(infile, define, extend, outfile)
743 char *infile;
744 char *define;
745 int extend;
746 char *outfile;
747{
748 char *include;
749 definition *def;

--- 6 unchanged lines hidden (view full) ---

756 add_warning();
757 if (Cflag)
758 f_print (fout, "#include <memory.h> /* for memset */\n");
759 if (infile && (include = extendfile(infile, ".h"))) {
760 f_print(fout, "#include \"%s\"\n", include);
761 free(include);
762 } else
763 f_print(fout, "#include <rpc/rpc.h>\n");
757 while (def = get_definition()) {
764 while ( (def = get_definition()) ) {
758 foundprogram |= (def->def_kind == DEF_PROGRAM);
759 }
760 if (extend && !foundprogram) {
761 (void) unlink(outfilename);
762 return;
763 }
764 write_stubs();
765}
766
767/*
768 * generate the dispatch table
769 */
765 foundprogram |= (def->def_kind == DEF_PROGRAM);
766 }
767 if (extend && !foundprogram) {
768 (void) unlink(outfilename);
769 return;
770 }
771 write_stubs();
772}
773
774/*
775 * generate the dispatch table
776 */
770static
777static void
771t_output(infile, define, extend, outfile)
772 char *infile;
773 char *define;
774 int extend;
775 char *outfile;
776{
777 definition *def;
778 int foundprogram = 0;
779 char *outfilename;
780
781 open_input(infile, define);
782 outfilename = extend ? extendfile(infile, outfile) : outfile;
783 open_output(infile, outfilename);
784 add_warning();
778t_output(infile, define, extend, outfile)
779 char *infile;
780 char *define;
781 int extend;
782 char *outfile;
783{
784 definition *def;
785 int foundprogram = 0;
786 char *outfilename;
787
788 open_input(infile, define);
789 outfilename = extend ? extendfile(infile, outfile) : outfile;
790 open_output(infile, outfilename);
791 add_warning();
785 while (def = get_definition()) {
792 while ( (def = get_definition()) ) {
786 foundprogram |= (def->def_kind == DEF_PROGRAM);
787 }
788 if (extend && !foundprogram) {
789 (void) unlink(outfilename);
790 return;
791 }
792 write_tables();
793}
794
795/* sample routine for the server template */
793 foundprogram |= (def->def_kind == DEF_PROGRAM);
794 }
795 if (extend && !foundprogram) {
796 (void) unlink(outfilename);
797 return;
798 }
799 write_tables();
800}
801
802/* sample routine for the server template */
796static
803static void
797svc_output(infile, define, extend, outfile)
798 char *infile;
799 char *define;
800 int extend;
801 char *outfile;
802{
803 definition *def;
804 char *include;

--- 11 unchanged lines hidden (view full) ---

816
817 if (infile && (include = extendfile(infile, ".h"))) {
818 f_print(fout, "#include \"%s\"\n", include);
819 free(include);
820 } else
821 f_print(fout, "#include <rpc/rpc.h>\n");
822
823 tell = ftell(fout);
804svc_output(infile, define, extend, outfile)
805 char *infile;
806 char *define;
807 int extend;
808 char *outfile;
809{
810 definition *def;
811 char *include;

--- 11 unchanged lines hidden (view full) ---

823
824 if (infile && (include = extendfile(infile, ".h"))) {
825 f_print(fout, "#include \"%s\"\n", include);
826 free(include);
827 } else
828 f_print(fout, "#include <rpc/rpc.h>\n");
829
830 tell = ftell(fout);
824 while (def = get_definition()) {
831 while ( (def = get_definition()) ) {
825 write_sample_svc(def);
826 }
827 if (extend && tell == ftell(fout)) {
828 (void) unlink(outfilename);
829 }
830}
831
832/* sample main routine for client */
832 write_sample_svc(def);
833 }
834 if (extend && tell == ftell(fout)) {
835 (void) unlink(outfilename);
836 }
837}
838
839/* sample main routine for client */
833static
840static void
834clnt_output(infile, define, extend, outfile)
835 char *infile;
836 char *define;
837 int extend;
838 char *outfile;
839{
840 definition *def;
841 char *include;

--- 12 unchanged lines hidden (view full) ---

854 open_output(infile, outfilename);
855 add_sample_msg();
856 if (infile && (include = extendfile(infile, ".h"))) {
857 f_print(fout, "#include \"%s\"\n", include);
858 free(include);
859 } else
860 f_print(fout, "#include <rpc/rpc.h>\n");
861 tell = ftell(fout);
841clnt_output(infile, define, extend, outfile)
842 char *infile;
843 char *define;
844 int extend;
845 char *outfile;
846{
847 definition *def;
848 char *include;

--- 12 unchanged lines hidden (view full) ---

861 open_output(infile, outfilename);
862 add_sample_msg();
863 if (infile && (include = extendfile(infile, ".h"))) {
864 f_print(fout, "#include \"%s\"\n", include);
865 free(include);
866 } else
867 f_print(fout, "#include <rpc/rpc.h>\n");
868 tell = ftell(fout);
862 while (def = get_definition()) {
869 while ( (def = get_definition()) ) {
863 has_program += write_sample_clnt(def);
864 }
865
866 if (has_program)
867 write_sample_clnt_main();
868
869 if (extend && tell == ftell(fout)) {
870 (void) unlink(outfilename);

--- 105 unchanged lines hidden (view full) ---

976}
977
978
979
980/*
981 * Perform registrations for service output
982 * Return 0 if failed; 1 otherwise.
983 */
870 has_program += write_sample_clnt(def);
871 }
872
873 if (has_program)
874 write_sample_clnt_main();
875
876 if (extend && tell == ftell(fout)) {
877 (void) unlink(outfilename);

--- 105 unchanged lines hidden (view full) ---

983}
984
985
986
987/*
988 * Perform registrations for service output
989 * Return 0 if failed; 1 otherwise.
990 */
984static
985int do_registers(argc, argv)
991static int
992do_registers(argc, argv)
986 int argc;
987 char *argv[];
988{
989 int i;
990
991 if (inetdflag || !tirpcflag) {
992 for (i = 1; i < argc; i++) {
993 if (streq(argv[i], "-s")) {

--- 79 unchanged lines hidden (view full) ---

1073 crash();
1074 }
1075 }
1076}
1077
1078/*
1079 * Parse command line arguments
1080 */
993 int argc;
994 char *argv[];
995{
996 int i;
997
998 if (inetdflag || !tirpcflag) {
999 for (i = 1; i < argc; i++) {
1000 if (streq(argv[i], "-s")) {

--- 79 unchanged lines hidden (view full) ---

1080 crash();
1081 }
1082 }
1083}
1084
1085/*
1086 * Parse command line arguments
1087 */
1081static
1088static int
1082parseargs(argc, argv, cmd)
1083 int argc;
1084 char *argv[];
1085 struct commandline *cmd;
1086{
1087 int i;
1088 int j;
1089 char c, ch;

--- 34 unchanged lines hidden (view full) ---

1124 case 'a':
1125 allfiles = 1;
1126 break;
1127 case 'c':
1128 case 'h':
1129 case 'l':
1130 case 'm':
1131 case 't':
1089parseargs(argc, argv, cmd)
1090 int argc;
1091 char *argv[];
1092 struct commandline *cmd;
1093{
1094 int i;
1095 int j;
1096 char c, ch;

--- 34 unchanged lines hidden (view full) ---

1131 case 'a':
1132 allfiles = 1;
1133 break;
1134 case 'c':
1135 case 'h':
1136 case 'l':
1137 case 'm':
1138 case 't':
1132 if (flag[c]) {
1139 if (flag[(int)c]) {
1133 return (0);
1134 }
1140 return (0);
1141 }
1135 flag[c] = 1;
1142 flag[(int)c] = 1;
1136 break;
1137 case 'S':
1138 /*
1139 * sample flag: Ss or Sc.
1140 * Ss means set flag['S'];
1141 * Sc means set flag['C'];
1142 * Sm means set flag['M'];
1143 */
1144 ch = argv[i][++j]; /* get next char */
1145 if (ch == 's')
1146 ch = 'S';
1147 else if (ch == 'c')
1148 ch = 'C';
1149 else if (ch == 'm')
1150 ch = 'M';
1151 else
1152 return (0);
1153
1143 break;
1144 case 'S':
1145 /*
1146 * sample flag: Ss or Sc.
1147 * Ss means set flag['S'];
1148 * Sc means set flag['C'];
1149 * Sm means set flag['M'];
1150 */
1151 ch = argv[i][++j]; /* get next char */
1152 if (ch == 's')
1153 ch = 'S';
1154 else if (ch == 'c')
1155 ch = 'C';
1156 else if (ch == 'm')
1157 ch = 'M';
1158 else
1159 return (0);
1160
1154 if (flag[ch]) {
1161 if (flag[(int)ch]) {
1155 return (0);
1156 }
1162 return (0);
1163 }
1157 flag[ch] = 1;
1164 flag[(int)ch] = 1;
1158 break;
1159 case 'C': /* ANSI C syntax */
1160 Cflag = 1;
1161 ch = argv[i][j+1]; /* get next char */
1162
1163 if (ch != 'C')
1164 break;
1165 CCflag = 1;

--- 40 unchanged lines hidden (view full) ---

1206 goto nextarg;
1207 case 'n':
1208 case 'o':
1209 case 's':
1210 if (argv[i][j - 1] != '-' ||
1211 argv[i][j + 1] != 0) {
1212 return (0);
1213 }
1165 break;
1166 case 'C': /* ANSI C syntax */
1167 Cflag = 1;
1168 ch = argv[i][j+1]; /* get next char */
1169
1170 if (ch != 'C')
1171 break;
1172 CCflag = 1;

--- 40 unchanged lines hidden (view full) ---

1213 goto nextarg;
1214 case 'n':
1215 case 'o':
1216 case 's':
1217 if (argv[i][j - 1] != '-' ||
1218 argv[i][j + 1] != 0) {
1219 return (0);
1220 }
1214 flag[c] = 1;
1221 flag[(int)c] = 1;
1215 if (++i == argc) {
1216 return (0);
1217 }
1218 if (c == 'o') {
1219 if (cmd->outfile) {
1220 return (0);
1221 }
1222 cmd->outfile = argv[i];

--- 78 unchanged lines hidden (view full) ---

1301 } if (nflags > 1) {
1302 f_print(stderr,
1303 "Cannot have more than one file generation flag.\n");
1304 return (0);
1305 }
1306 return (1);
1307}
1308
1222 if (++i == argc) {
1223 return (0);
1224 }
1225 if (c == 'o') {
1226 if (cmd->outfile) {
1227 return (0);
1228 }
1229 cmd->outfile = argv[i];

--- 78 unchanged lines hidden (view full) ---

1308 } if (nflags > 1) {
1309 f_print(stderr,
1310 "Cannot have more than one file generation flag.\n");
1311 return (0);
1312 }
1313 return (1);
1314}
1315
1309static
1316static void
1310usage()
1311{
1312 f_print(stderr, "usage: %s infile\n", cmdname);
1313 f_print(stderr,
1314 "\t%s [-abCLNTM] [-Dname[=value]] [-i size]\
1315[-I [-K seconds]] [-Y path] infile\n",
1316 cmdname);
1317 f_print(stderr,
1318 "\t%s [-c | -h | -l | -m | -t | -Sc | -Ss | -Sm]\
1319[-o outfile] [infile]\n",
1320 cmdname);
1321 f_print(stderr, "\t%s [-s nettype]* [-o outfile] [infile]\n", cmdname);
1322 f_print(stderr, "\t%s [-n netid]* [-o outfile] [infile]\n", cmdname);
1323 options_usage();
1324 exit(1);
1325}
1326
1317usage()
1318{
1319 f_print(stderr, "usage: %s infile\n", cmdname);
1320 f_print(stderr,
1321 "\t%s [-abCLNTM] [-Dname[=value]] [-i size]\
1322[-I [-K seconds]] [-Y path] infile\n",
1323 cmdname);
1324 f_print(stderr,
1325 "\t%s [-c | -h | -l | -m | -t | -Sc | -Ss | -Sm]\
1326[-o outfile] [infile]\n",
1327 cmdname);
1328 f_print(stderr, "\t%s [-s nettype]* [-o outfile] [infile]\n", cmdname);
1329 f_print(stderr, "\t%s [-n netid]* [-o outfile] [infile]\n", cmdname);
1330 options_usage();
1331 exit(1);
1332}
1333
1327static
1334static void
1328options_usage()
1329{
1330 f_print(stderr, "options:\n");
1331 f_print(stderr, "-a\t\tgenerate all files, including samples\n");
1332 f_print(stderr, "-b\t\tbackward compatibility mode (generates code\
1333for SunOS 4.X)\n");
1334 f_print(stderr, "-c\t\tgenerate XDR routines\n");
1335 f_print(stderr, "-C\t\tANSI C mode\n");

--- 46 unchanged lines hidden ---
1335options_usage()
1336{
1337 f_print(stderr, "options:\n");
1338 f_print(stderr, "-a\t\tgenerate all files, including samples\n");
1339 f_print(stderr, "-b\t\tbackward compatibility mode (generates code\
1340for SunOS 4.X)\n");
1341 f_print(stderr, "-c\t\tgenerate XDR routines\n");
1342 f_print(stderr, "-C\t\tANSI C mode\n");

--- 46 unchanged lines hidden ---