[BACK]Return to rpc_main.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rpcgen

Diff for /src/usr.bin/rpcgen/rpc_main.c between version 1.9 and 1.10

version 1.9, 2001/11/24 19:17:47 version 1.10, 2001/11/24 19:19:59
Line 203 
Line 203 
                 if (allfiles) {                  if (allfiles) {
                   reinitialize();                    reinitialize();
                   clnt_output(cmd.infile, "-DRPC_CLIENT", EXTEND, "_client.c");                    clnt_output(cmd.infile, "-DRPC_CLIENT", EXTEND, "_client.c");
                 }                  }
         }          }
 #ifdef __MSDOS__  #ifdef __MSDOS__
         if (dos_cppfile != NULL) {          if (dos_cppfile != NULL) {
Line 297 
Line 297 
 {  {
   struct stat buf;    struct stat buf;
   
   if (stat(CPP, &buf) < 0 )  {  /* SVR4 or explicit cpp does not exist */    if( stat(CPP, &buf) < 0 )  {  /* SVR4 or explicit cpp does not exist */
     if (cppDefined) {      if (cppDefined) {
       fprintf( stderr, "cannot find C preprocessor: %s \n", CPP );        fprintf( stderr, "cannot find C preprocessor: %s \n", CPP );
       crash();        crash();
     } else {                    /* try the other one */      } else {                    /* try the other one */
       CPP = SUNOS_CPP;        CPP = SUNOS_CPP;
       if (stat( CPP, &buf ) < 0 ) { /* can't find any cpp */        if( stat( CPP, &buf ) < 0 ) { /* can't find any cpp */
         fprintf( stderr, "cannot find any C preprocessor: %s\n", CPP );          fprintf( stderr, "cannot find any C preprocessor: %s\n", CPP );
         crash();          crash();
       }        }
Line 392 
Line 392 
 }  }
   
 /* valid tirpc nettypes */  /* valid tirpc nettypes */
 static char *valid_ti_nettypes[] =  static char* valid_ti_nettypes[] =
 {  {
   "netpath",    "netpath",
   "visible",    "visible",
Line 407 
Line 407 
   };    };
   
 /* valid inetd nettypes */  /* valid inetd nettypes */
 static char *valid_i_nettypes[] =  static char* valid_i_nettypes[] =
 {  {
   "udp",    "udp",
   "tcp",    "tcp",
Line 415 
Line 415 
 };  };
   
 static int check_nettype( name, list_to_check )  static int check_nettype( name, list_to_check )
 char *name;  char* name;
 char *list_to_check[];  char* list_to_check[];
 {  {
         int i;    int i;
         for( i = 0; list_to_check[i] != NULL; i++ ) {    for( i = 0; list_to_check[i] != NULL; i++ ) {
                 if (strcmp( name, list_to_check[i] ) == 0)            if( strcmp( name, list_to_check[i] ) == 0 ) {
                         return 1;              return 1;
         }            }
         f_print(stderr, "illegal nettype :\'%s\'\n", name);    }
         return 0;    f_print( stderr, "illegal nettype :\'%s\'\n", name );
     return 0;
 }  }
   
 /*  /*
Line 444 
Line 445 
         long tell;          long tell;
   
         c_initialize();          c_initialize();
         open_input(infile, define);          open_input(infile, define);
         outfilename = extend ? extendfile(infile, outfile) : outfile;          outfilename = extend ? extendfile(infile, outfile) : outfile;
         open_output(infile, outfilename);          open_output(infile, outfilename);
         add_warning();          add_warning();
Line 489 
Line 490 
 };\n";  };\n";
   
   
 char *generate_guard( pathname )  char* generate_guard( pathname )
      char *pathname;       char* pathname;
 {  {
         char *filename, *guard, *tmp;          char* filename, *guard, *tmp;
   
         filename = strrchr(pathname, '/' );  /* find last component */          filename = strrchr(pathname, '/' );  /* find last component */
         filename = ((filename == 0) ? pathname : filename+1);          filename = ((filename == 0) ? pathname : filename+1);
Line 504 
Line 505 
                         *tmp = toupper(*tmp);                          *tmp = toupper(*tmp);
                 tmp++;                  tmp++;
         }          }
   
         guard = extendfile(guard, "_H_RPCGEN");          guard = extendfile(guard, "_H_RPCGEN");
         return( guard );          return( guard );
 }  }
Line 604 
Line 605 
           timerflag = 1;            timerflag = 1;
         }          }
   
         if (!tirpcflag && inetdflag)          if( !tirpcflag && inetdflag )
           f_print(fout, "#include <sys/ttycom.h>/* TIOCNOTTY */\n");            f_print(fout, "#include <sys/ttycom.h>/* TIOCNOTTY */\n");
         if (Cflag && (inetdflag || pmflag )) {          if( Cflag && (inetdflag || pmflag ) ) {
           f_print(fout, "#ifdef __cplusplus\n");            f_print(fout, "#ifdef __cplusplus\n");
           f_print(fout, "#include <sysent.h> /* getdtablesize, open */\n");            f_print(fout, "#include <sysent.h> /* getdtablesize, open */\n");
           f_print(fout, "#endif /* __cplusplus */\n");            f_print(fout, "#endif /* __cplusplus */\n");
   
           if (tirpcflag)            if( tirpcflag )
             f_print(fout, "#include <unistd.h> /* setsid */\n");              f_print(fout, "#include <unistd.h> /* setsid */\n");
         }          }
         if (tirpcflag)          if( tirpcflag )
           f_print(fout, "#include <sys/types.h>\n");            f_print(fout, "#include <sys/types.h>\n");
   
         f_print(fout, "#include <memory.h>\n");          f_print(fout, "#include <memory.h>\n");
Line 653 
Line 654 
                 f_print(fout, "\nstatic SVCXPRT *caller;\n");   /*EVAS*/                  f_print(fout, "\nstatic SVCXPRT *caller;\n");   /*EVAS*/
         write_most(infile, netflag, nomain);          write_most(infile, netflag, nomain);
         if (!nomain) {          if (!nomain) {
                 if (!do_registers(argc, argv)) {                  if( !do_registers(argc, argv) ) {
                   if (outfilename)                    if (outfilename)
                     (void) unlink(outfilename);                      (void) unlink(outfilename);
                   usage();                    usage();
Line 739 
Line 740 
   char *outfilename;    char *outfilename;
   long tell;    long tell;
   
   open_input(infile, define);    open_input(infile, define);
   outfilename = extend ? extendfile(infile, outfile) : outfile;    outfilename = extend ? extendfile(infile, outfile) : outfile;
   checkfiles(infile,outfilename); /*check if outfile already exists.    checkfiles(infile,outfilename); /*check if outfile already exists.
                                   if so, print an error message and exit*/                                    if so, print an error message and exit*/
Line 776 
Line 777 
   long tell;    long tell;
   int has_program = 0;    int has_program = 0;
   
   open_input(infile, define);    open_input(infile, define);
   outfilename = extend ? extendfile(infile, outfile) : outfile;    outfilename = extend ? extendfile(infile, outfile) : outfile;
   checkfiles(infile,outfilename); /*check if outfile already exists.    checkfiles(infile,outfilename); /*check if outfile already exists.
                                   if so, print an error message and exit*/                                    if so, print an error message and exit*/
Line 793 
Line 794 
     has_program += write_sample_clnt(def);      has_program += write_sample_clnt(def);
   }    }
   
   if (has_program)    if( has_program )
     write_sample_clnt_main();      write_sample_clnt_main();
   
   if (extend && tell == ftell(fout)) {    if (extend && tell == ftell(fout)) {
Line 815 
Line 816 
         if ( inetdflag || !tirpcflag) {          if ( inetdflag || !tirpcflag) {
                 for (i = 1; i < argc; i++) {                  for (i = 1; i < argc; i++) {
                         if (streq(argv[i], "-s")) {                          if (streq(argv[i], "-s")) {
                                 if (!check_nettype( argv[i + 1], valid_i_nettypes ))                                  if(!check_nettype( argv[i + 1], valid_i_nettypes ))
                                   return 0;                                    return 0;
                                 write_inetd_register(argv[i + 1]);                                  write_inetd_register(argv[i + 1]);
                                 i++;                                  i++;
Line 824 
Line 825 
         } else {          } else {
                 for (i = 1; i < argc; i++)                  for (i = 1; i < argc; i++)
                         if (streq(argv[i], "-s")) {                          if (streq(argv[i], "-s")) {
                                 if (!check_nettype( argv[i + 1], valid_ti_nettypes ))                                  if(!check_nettype( argv[i + 1], valid_ti_nettypes ))
                                   return 0;                                    return 0;
                                 write_nettype_register(argv[i + 1]);                                  write_nettype_register(argv[i + 1]);
                                 i++;                                  i++;
Line 863 
Line 864 
                 /*NOTREACHED*/                  /*NOTREACHED*/
         }          }
         arglist[where] = cp;          arglist[where] = cp;
   
 }  }
   
 /*  /*
Line 879 
Line 881 
   
   struct stat buf;    struct stat buf;
   
   if (infile)                   /* infile ! = NULL */    if(infile)                    /* infile ! = NULL */
     if (stat(infile,&buf) < 0)      if(stat(infile,&buf) < 0)
       {        {
         perror(infile);          perror(infile);
         crash();          crash();
Line 962 
Line 964 
                                            Ss means set flag['S'];                                             Ss means set flag['S'];
                                            Sc means set flag['C']; */                                             Sc means set flag['C']; */
                                         c = argv[i][++j];  /* get next char */                                          c = argv[i][++j];  /* get next char */
                                         if(c == 's')                                          if( c == 's' )
                                           c = 'S';                                            c = 'S';
                                         else if(c == 'c')                                          else if( c == 'c' )
                                           c = 'C';                                            c = 'C';
                                         else                                          else
                                           return( 0 );                                            return( 0 );
Line 1069 
Line 1071 
         cmd->Ssflag = flag['S'];          cmd->Ssflag = flag['S'];
         cmd->Scflag = flag['C'];          cmd->Scflag = flag['C'];
   
         if(tirpcflag) {          if( tirpcflag ) {
           pmflag = inetdflag ? 0 : 1;     /* pmflag or inetdflag is always TRUE */            pmflag = inetdflag ? 0 : 1;     /* pmflag or inetdflag is always TRUE */
           if((inetdflag && cmd->nflag)) { /* netid not allowed with inetdflag */            if( (inetdflag && cmd->nflag)) { /* netid not allowed with inetdflag */
             f_print(stderr, "Cannot use netid flag with inetd flag!\n");              f_print(stderr, "Cannot use netid flag with inetd flag!\n");
             return (0);              return (0);
           }            }
         } else {  /* 4.1 mode */          } else {  /* 4.1 mode */
           pmflag = 0;               /* set pmflag only in tirpcmode */            pmflag = 0;               /* set pmflag only in tirpcmode */
           inetdflag = 1;            /* inetdflag is TRUE by default */            inetdflag = 1;            /* inetdflag is TRUE by default */
           if (cmd->nflag) {          /* netid needs TIRPC */            if( cmd->nflag ) {          /* netid needs TIRPC */
             f_print( stderr, "Cannot use netid flag without TIRPC!\n");              f_print( stderr, "Cannot use netid flag without TIRPC!\n");
             return( 0 );              return( 0 );
           }            }
         }          }
   
         if (newstyle && ( tblflag || cmd->tflag)) {          if( newstyle && ( tblflag || cmd->tflag) ) {
           f_print( stderr, "Cannot use table flags with newstyle!\n");            f_print( stderr, "Cannot use table flags with newstyle!\n");
           return( 0 );            return( 0 );
         }          }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10