version 1.9, 2001/11/24 19:17:47 |
version 1.10, 2001/11/24 19:19:59 |
|
|
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) { |
|
|
{ |
{ |
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(); |
} |
} |
|
|
} |
} |
|
|
/* valid tirpc nettypes */ |
/* valid tirpc nettypes */ |
static char *valid_ti_nettypes[] = |
static char* valid_ti_nettypes[] = |
{ |
{ |
"netpath", |
"netpath", |
"visible", |
"visible", |
|
|
}; |
}; |
|
|
/* valid inetd nettypes */ |
/* valid inetd nettypes */ |
static char *valid_i_nettypes[] = |
static char* valid_i_nettypes[] = |
{ |
{ |
"udp", |
"udp", |
"tcp", |
"tcp", |
|
|
}; |
}; |
|
|
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; |
} |
} |
|
|
/* |
/* |
|
|
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(); |
|
|
};\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); |
|
|
*tmp = toupper(*tmp); |
*tmp = toupper(*tmp); |
tmp++; |
tmp++; |
} |
} |
|
|
guard = extendfile(guard, "_H_RPCGEN"); |
guard = extendfile(guard, "_H_RPCGEN"); |
return( guard ); |
return( guard ); |
} |
} |
|
|
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"); |
|
|
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(); |
|
|
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*/ |
|
|
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*/ |
|
|
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)) { |
|
|
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++; |
|
|
} 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++; |
|
|
/*NOTREACHED*/ |
/*NOTREACHED*/ |
} |
} |
arglist[where] = cp; |
arglist[where] = cp; |
|
|
} |
} |
|
|
/* |
/* |
|
|
|
|
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(); |
|
|
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 ); |
|
|
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 ); |
} |
} |