Adding pidlogname checking for configuration and getopts

This commit is contained in:
hoaxter 2004-09-01 19:25:27 +00:00
parent 6e90740634
commit 284f67382a

View File

@ -36,7 +36,7 @@ static void display_version PROTO0((void))
static void arg_err PROTO0((void))
{
fputs("Usage: fspd [-f configfile] [-d directory] [-v|-V] [-i] [-F] [-p port] [-X] [-t timeout] [-T temporary directory] [-l logfile]\n", stderr);
fputs("Usage: fspd [-f configfile] [-d directory] [-v|-V] [-i] [-F] [-p port] [-X] [-t timeout] [-T temporary directory] [-l logfile] [-P pidlogname]\n", stderr);
}
static void check_required_vars PROTO0((void))
@ -61,6 +61,10 @@ static void check_required_vars PROTO0((void))
fprintf(stderr,"home directory [%s] does not start with a /.\n", home_dir);
exit(1);
}
if(!pidlogname) {
fprintf(stderr, "No pidlogname set in your fspd.conf.\n");
exit(1);
}
if(!readme_file) {
readme_file = strdup(".README");
}
@ -103,7 +107,7 @@ int main PROTO2(int, argc, char **, argv)
if(strlen(argv[0])>=7)
inetd_mode = !strcasecmp(&argv[0][strlen(argv[0])-7],"in.fspd");
while( (opt=getopt(argc,argv,"h?Xd:f:vVip:t:FT:l:"))!=EOF)
while( (opt=getopt(argc,argv,"h?Xd:f:vVip:t:FT:l:P:"))!=EOF)
{
switch(opt)
{
@ -123,6 +127,10 @@ int main PROTO2(int, argc, char **, argv)
logname = strdup(optarg);
logging = L_ALL ^ L_RDONLY;
break;
case 'P':
if(pidlogname) free(pidlogname);
pidlogname = strdup(optarg);
break;
case 'T':
if(tmp_dir)
free(tmp_dir);