fsetupcmd code cleanup
This commit is contained in:
parent
abfce62c10
commit
a241a9f1d6
|
|
@ -26,7 +26,10 @@ Version NEXT
|
||||||
Upload starting at zero position are now always allowed no matter if
|
Upload starting at zero position are now always allowed no matter if
|
||||||
source port was reused or not. Old code did that but not over
|
source port was reused or not. Old code did that but not over
|
||||||
server restarts.
|
server restarts.
|
||||||
INFO file updated with fresh information
|
INFO file updated with fresh information
|
||||||
|
fsetupcmd - reject port number > 65535
|
||||||
|
fsetupcmd - code cleaned a bit. Error message is now
|
||||||
|
fsetup: No host given! instead of fhost:
|
||||||
|
|
||||||
Version 2.8.1b25 - 10 Sep 2009
|
Version 2.8.1b25 - 10 Sep 2009
|
||||||
GNU autotools build system was entirely replaced by SCons
|
GNU autotools build system was entirely replaced by SCons
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*********************************************************************\
|
/*********************************************************************\
|
||||||
* Copyright (c) 1993 by Michael Meskes *
|
* Copyright (c) 1993 by Michael Meskes *
|
||||||
* (meskes@ulysses.informatik.rwth-aachen.de) *
|
* (meskes@ulysses.informatik.rwth-aachen.de) *
|
||||||
* Copyright (c) 2003-5by Radim Kolar (hsn@cybermail.net) *
|
* Copyright (c) 2003-9by Radim Kolar (hsn@sendmail.cz) *
|
||||||
* *
|
* *
|
||||||
* You may copy or modify this file in any manner you wish, provided *
|
* You may copy or modify this file in any manner you wish, provided *
|
||||||
* that this notice is always included, and that you hold the author *
|
* that this notice is always included, and that you hold the author *
|
||||||
|
|
@ -42,36 +42,19 @@ static void setup_usage (void) /* print usage message */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get data out of resource file */
|
/* get data out of resource file */
|
||||||
static void parse_prof_file_new (const char * filename)
|
static void parse_prof_file_new (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
FILE *input=NULL;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if(filename)
|
rc=sitewrap();
|
||||||
{
|
|
||||||
input=fopen(filename,"r");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(input)
|
|
||||||
{
|
|
||||||
sitein=input;
|
|
||||||
rc=0;
|
|
||||||
} else
|
|
||||||
rc=sitewrap();
|
|
||||||
|
|
||||||
if(rc==0)
|
if(rc==0)
|
||||||
sitelex();
|
sitelex();
|
||||||
|
|
||||||
if(input)
|
|
||||||
fclose(input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, char ** argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int optletter,csh,lhost=0;
|
int optletter,csh,lhost=0;
|
||||||
register char *p;
|
register char *p;
|
||||||
const char *filename=NULL;
|
|
||||||
char *log;
|
char *log;
|
||||||
struct passwd *pw=0L;
|
struct passwd *pw=0L;
|
||||||
struct fsp_host *setup=NULL;
|
struct fsp_host *setup=NULL;
|
||||||
|
|
@ -117,26 +100,29 @@ int main (int argc, char ** argv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(argc > optind+1 && !filename) { /* host and port and no filename given */
|
if(argc > optind + 1) {
|
||||||
|
/* host and port given */
|
||||||
for (p=argv[optind];!setup->hostname && *p && *p!='\n';p++)
|
for (p=argv[optind];!setup->hostname && *p && *p!='\n';p++)
|
||||||
if (!isdigit(*p) && *p!='.') setup->hostname=argv[optind];
|
if (!isdigit(*p) && *p!='.') setup->hostname=argv[optind];
|
||||||
if (!setup->hostname) setup->hostaddr=argv[optind];
|
if (!setup->hostname) setup->hostaddr=argv[optind];
|
||||||
setup->port=atol(argv[optind+1]);
|
setup->port=atol(argv[optind+1]);
|
||||||
if(setup->port==0)
|
if(setup->port==0 || setup->port>65535) {
|
||||||
|
/* port is not number, clear hostname/address */
|
||||||
setup=init_host();
|
setup=init_host();
|
||||||
|
}
|
||||||
if (argc > optind + 1) setup->dir=argv[optind+2]; /* directory given, too */
|
if (argc > optind + 1) setup->dir=argv[optind+2]; /* directory given, too */
|
||||||
} else if (argc > optind) { /* abbreviation given */
|
} else if (argc > optind) { /* abbreviation given */
|
||||||
parse_prof_file_new(filename);
|
parse_prof_file_new();
|
||||||
setup=find_host(argv[optind]);
|
setup=find_host(argv[optind]);
|
||||||
if(!setup) setup=init_host();
|
if(!setup) setup=init_host();
|
||||||
} else { /* list or set command-line options */
|
} else { /* list or set command-line options */
|
||||||
if (filename || argc==1) { /* no arguments */
|
if (argc==1) { /* no arguments */
|
||||||
setup_usage();
|
setup_usage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(setup->hostname==NULL && setup->hostaddr==NULL)
|
if(setup->hostname==NULL && setup->hostaddr==NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"fhost: No host given!\n");
|
fprintf(stderr,"fsetup: No host given!\n");
|
||||||
exit(EX_USAGE);
|
exit(EX_USAGE);
|
||||||
}
|
}
|
||||||
print_host_setup(setup,csh,lhost);
|
print_host_setup(setup,csh,lhost);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user