|
|
@@ -228,7 +228,6 @@ struct in_addr requested_address;
|
|
|
|
|
|
|
|
|
int process_arguments(int, char **);
|
|
|
-int call_getopt(int, char **);
|
|
|
int validate_arguments(void);
|
|
|
void print_usage(void);
|
|
|
void print_help(void);
|
|
|
@@ -1072,30 +1071,9 @@ int get_results(void){
|
|
|
|
|
|
/* process command-line arguments */
|
|
|
int process_arguments(int argc, char **argv){
|
|
|
- int c;
|
|
|
-
|
|
|
- if(argc<1)
|
|
|
- return ERROR;
|
|
|
-
|
|
|
- c=0;
|
|
|
- while((c+=(call_getopt(argc-c,&argv[c])))<argc){
|
|
|
-
|
|
|
- /*
|
|
|
- if(is_option(argv[c]))
|
|
|
- continue;
|
|
|
- */
|
|
|
- }
|
|
|
-
|
|
|
- return validate_arguments();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-int call_getopt(int argc, char **argv){
|
|
|
- int c=0;
|
|
|
- int i=0;
|
|
|
-
|
|
|
+ int c = 0;
|
|
|
int option_index = 0;
|
|
|
+
|
|
|
static struct option long_options[] =
|
|
|
{
|
|
|
{"serverip", required_argument,0,'s'},
|
|
|
@@ -1110,11 +1088,12 @@ int call_getopt(int argc, char **argv){
|
|
|
{0,0,0,0}
|
|
|
};
|
|
|
|
|
|
+ if(argc<1)
|
|
|
+ return ERROR;
|
|
|
+
|
|
|
while(1){
|
|
|
c=getopt_long(argc,argv,"+hVvt:s:r:t:i:m:u",long_options,&option_index);
|
|
|
|
|
|
- i++;
|
|
|
-
|
|
|
if(c==-1||c==EOF||c==1)
|
|
|
break;
|
|
|
|
|
|
@@ -1123,7 +1102,6 @@ int call_getopt(int argc, char **argv){
|
|
|
case 'r':
|
|
|
case 't':
|
|
|
case 'i':
|
|
|
- i++;
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
@@ -1195,7 +1173,8 @@ int call_getopt(int argc, char **argv){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return i+1;
|
|
|
+
|
|
|
+ return validate_arguments();
|
|
|
}
|
|
|
|
|
|
|