diff options
-rw-r--r-- | src/cli-gaa.c | 25 | ||||
-rw-r--r-- | src/cli.c | 2 | ||||
-rw-r--r-- | src/cli.gaa | 4 | ||||
-rw-r--r-- | src/serv-gaa.c | 21 | ||||
-rw-r--r-- | src/tls_test-gaa.c | 54 | ||||
-rw-r--r-- | src/tls_test-gaa.h | 2 | ||||
-rw-r--r-- | src/tls_test.c | 2 | ||||
-rw-r--r-- | src/tls_test.gaa | 4 |
8 files changed, 61 insertions, 53 deletions
diff --git a/src/cli-gaa.c b/src/cli-gaa.c index c0bc8df4f3..e5f3037c8b 100644 --- a/src/cli-gaa.c +++ b/src/cli-gaa.c @@ -1,8 +1,7 @@ -/* File generated by GAA 1.6.0b1 on Wed Feb 20 22:51:21 2002 +/* File generated by GAA 1.6.0b3 */ #define GAA_NO_WIN32 -#line 53 "cli.gaa" - +#line 54 "cli.gaa" /* C declarations */ @@ -346,7 +345,7 @@ for(i = 0; i < strlen(str); i++) \ j = gaa_get_option_num(str + i, GAA_LETTER_OPTION); \ if(j == GAA_ERROR_NOMATCH) \ { \ - printf("Error : invalid 'obligat' set\n"); \ + printf("Error: invalid 'obligat' set\n"); \ exit(-1); \ } \ if(opt_list[j] == 1) \ @@ -368,7 +367,7 @@ for(i = 0; i < strlen(str); i++) \ j = gaa_get_option_num(str + i, GAA_LETTER_OPTION); \ if(j == GAA_ERROR_NOMATCH) \ { \ - printf("Error : invalid 'obligat' set\n"); \ + printf("Error: invalid 'obligat' set\n"); \ exit(-1); \ } \ if(opt_list[j] == 1) \ @@ -393,7 +392,7 @@ int gaa_getint(char *arg) char a; if(sscanf(arg, "%d%c", &tmp, &a) != 1) { - printf("Option %s : '%s' isn't an integer\n", gaa_current_option, arg); + printf("Option %s: '%s' isn't an integer\n", gaa_current_option, arg); GAAERROR(-1); } return tmp; @@ -403,7 +402,7 @@ char gaa_getchar(char *arg) { if(strlen(arg) != 1) { - printf("Option %s : '%s' isn't an character\n", gaa_current_option, arg); + printf("Option %s: '%s' isn't an character\n", gaa_current_option, arg); GAAERROR(-1); } return arg[0]; @@ -419,7 +418,7 @@ float gaa_getfloat(char *arg) char a; if(sscanf(arg, "%f%c", &tmp, &a) != 1) { - printf("Option %s : '%s' isn't a float number\n", gaa_current_option, arg); + printf("Option %s: '%s' isn't a float number\n", gaa_current_option, arg); GAAERROR(-1); } return tmp; @@ -677,7 +676,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) return GAA_OK; break; case GAA_REST: - GAA_OPTIONALLIST_FILL(GAAREST_tmp.arg1, gaa_getstr, char*, GAAREST_tmp.size1); + GAA_LIST_FILL(GAAREST_tmp.arg1, gaa_getstr, char*, GAAREST_tmp.size1); #line 46 "cli.gaa" { gaaval->rest_args = GAAREST_tmp.arg1; gaaval->nrest_args = GAAREST_tmp.size1 ;}; @@ -707,7 +706,7 @@ int gaa(int argc, char **argv, gaainfo *gaaval) { #line 48 "cli.gaa" -{ gaaval->resume=0; gaaval->port=5556; gaaval->rest_args=NULL; gaaval->nrest_args=0; gaaval->ciphers=NULL; +{ gaaval->resume=0; gaaval->port=443; gaaval->rest_args=NULL; gaaval->nrest_args=0; gaaval->ciphers=NULL; gaaval->kx=NULL; gaaval->comp=NULL; gaaval->macs=NULL; gaaval->ctype=NULL; gaaval->nciphers=0; gaaval->nkx=0; gaaval->ncomp=0; gaaval->nmacs=0; gaaval->nctype = 0; gaaval->record_size=0; gaaval->fingerprint=0; ;}; @@ -742,7 +741,7 @@ int gaa(int argc, char **argv, gaainfo *gaaval) switch(gaa_try(tmp2, i+1, gaaval, opt_list)) { case GAA_ERROR_NOTENOUGH_ARGS: - printf("'%s' : not enough arguments\n",gaa_current_option); + printf("'%s': not enough arguments\n",gaa_current_option); return 0; case GAA_ERROR_INVALID_ARG: printf("Invalid arguments\n"); @@ -766,7 +765,7 @@ int gaa(int argc, char **argv, gaainfo *gaaval) switch(gaa_try(tmp2, i+1, gaaval, opt_list)) { case GAA_ERROR_NOTENOUGH_ARGS: - printf("'%s' : not enough arguments\n",gaa_current_option); + printf("'%s': not enough arguments\n",gaa_current_option); return 0; case GAA_ERROR_INVALID_ARG: printf("Invalid arguments\n"); @@ -791,7 +790,7 @@ if(gaa_processing_file == 0) switch(gaa_try(GAA_REST, 1, gaaval, opt_list)) { case GAA_ERROR_NOTENOUGH_ARGS: - printf("Rest : not enough arguments\n"); + printf("Rest: not enough arguments\n"); return 0; case GAA_ERROR_INVALID_ARG: printf("Invalid arguments\n"); @@ -468,7 +468,7 @@ void gaa_parser(int argc, char **argv) int i, j; if (gaa(argc, argv, &info) != -1) { - fprintf(stderr, "Error in the arguments.\n"); + fprintf(stderr, "Error in the arguments. Use the --help or -h parameters to get more information.\n"); exit(1); } diff --git a/src/cli.gaa b/src/cli.gaa index 8c16f35002..f27ab67914 100644 --- a/src/cli.gaa +++ b/src/cli.gaa @@ -43,9 +43,9 @@ option (h, help) { gaa_help(); exit(0); } "prints this help" #int nrest_args; #char **rest_args; -rest optional *STR "hostname" { $rest_args = $1; $nrest_args = @1 } +rest *STR "hostname" { $rest_args = $1; $nrest_args = @1 } -init { $resume=0; $port=5556; $rest_args=NULL; $nrest_args=0; $ciphers=NULL; +init { $resume=0; $port=443; $rest_args=NULL; $nrest_args=0; $ciphers=NULL; $kx=NULL; $comp=NULL; $macs=NULL; $ctype=NULL; $nciphers=0; $nkx=0; $ncomp=0; $nmacs=0; $nctype = 0; $record_size=0; $fingerprint=0; } diff --git a/src/serv-gaa.c b/src/serv-gaa.c index 00fa291472..36ec5528b0 100644 --- a/src/serv-gaa.c +++ b/src/serv-gaa.c @@ -1,8 +1,7 @@ -/* File generated by GAA 1.6.0b1 on Wed Feb 20 22:51:19 2002 +/* File generated by GAA 1.6.0b3 */ #define GAA_NO_WIN32 -#line 44 "serv.gaa" - +#line 45 "serv.gaa" #include <common.h> #include <stdio.h> @@ -336,7 +335,7 @@ for(i = 0; i < strlen(str); i++) \ j = gaa_get_option_num(str + i, GAA_LETTER_OPTION); \ if(j == GAA_ERROR_NOMATCH) \ { \ - printf("Error : invalid 'obligat' set\n"); \ + printf("Error: invalid 'obligat' set\n"); \ exit(-1); \ } \ if(opt_list[j] == 1) \ @@ -358,7 +357,7 @@ for(i = 0; i < strlen(str); i++) \ j = gaa_get_option_num(str + i, GAA_LETTER_OPTION); \ if(j == GAA_ERROR_NOMATCH) \ { \ - printf("Error : invalid 'obligat' set\n"); \ + printf("Error: invalid 'obligat' set\n"); \ exit(-1); \ } \ if(opt_list[j] == 1) \ @@ -383,7 +382,7 @@ int gaa_getint(char *arg) char a; if(sscanf(arg, "%d%c", &tmp, &a) != 1) { - printf("Option %s : '%s' isn't an integer\n", gaa_current_option, arg); + printf("Option %s: '%s' isn't an integer\n", gaa_current_option, arg); GAAERROR(-1); } return tmp; @@ -393,7 +392,7 @@ char gaa_getchar(char *arg) { if(strlen(arg) != 1) { - printf("Option %s : '%s' isn't an character\n", gaa_current_option, arg); + printf("Option %s: '%s' isn't an character\n", gaa_current_option, arg); GAAERROR(-1); } return arg[0]; @@ -409,7 +408,7 @@ float gaa_getfloat(char *arg) char a; if(sscanf(arg, "%f%c", &tmp, &a) != 1) { - printf("Option %s : '%s' isn't a float number\n", gaa_current_option, arg); + printf("Option %s: '%s' isn't a float number\n", gaa_current_option, arg); GAAERROR(-1); } return tmp; @@ -698,7 +697,7 @@ int gaa(int argc, char **argv, gaainfo *gaaval) switch(gaa_try(tmp2, i+1, gaaval, opt_list)) { case GAA_ERROR_NOTENOUGH_ARGS: - printf("'%s' : not enough arguments\n",gaa_current_option); + printf("'%s': not enough arguments\n",gaa_current_option); return 0; case GAA_ERROR_INVALID_ARG: printf("Invalid arguments\n"); @@ -722,7 +721,7 @@ int gaa(int argc, char **argv, gaainfo *gaaval) switch(gaa_try(tmp2, i+1, gaaval, opt_list)) { case GAA_ERROR_NOTENOUGH_ARGS: - printf("'%s' : not enough arguments\n",gaa_current_option); + printf("'%s': not enough arguments\n",gaa_current_option); return 0; case GAA_ERROR_INVALID_ARG: printf("Invalid arguments\n"); @@ -747,7 +746,7 @@ if(gaa_processing_file == 0) switch(gaa_try(GAA_REST, 1, gaaval, opt_list)) { case GAA_ERROR_NOTENOUGH_ARGS: - printf("Rest : not enough arguments\n"); + printf("Rest: not enough arguments\n"); return 0; case GAA_ERROR_INVALID_ARG: printf("Invalid arguments\n"); diff --git a/src/tls_test-gaa.c b/src/tls_test-gaa.c index d8293a3a4f..d6d068e3b2 100644 --- a/src/tls_test-gaa.c +++ b/src/tls_test-gaa.c @@ -1,3 +1,6 @@ +/* File generated by GAA 1.6.0b3 + */ +#define GAA_NO_WIN32 #include <stdio.h> #ifndef GAA_NO_WIN32 @@ -99,7 +102,7 @@ void __gaa_helpsingle(char short_name, char *name, printf("\n"); } -void gaa_help() +void gaa_help(void) { printf("tls_test help\nUsage: tls_test [options] hostname""\n"); __gaa_helpsingle('p', "port", """integer"" ", "The port to connect to."); @@ -135,7 +138,7 @@ extern "C" int gaa(int argc, char *argv[], gaainfo *gaaval); - void gaa_help(); + void gaa_help(void); int gaa_file(char *name, gaainfo *gaaval); @@ -150,10 +153,10 @@ extern "C" /* C declarations */ -#define GAAERROR \ +#define GAAERROR(x) \ { \ gaa_error = 1; \ -return; \ +return x; \ } char *gaa_current_option; @@ -248,12 +251,14 @@ num = 0; \ if(!OK) \ { \ num = 0; \ -target = malloc((gaa_last_non_option - gaa_index) * sizeof(type)); \ +target = NULL; \ +if ( gaa_last_non_option - gaa_index > 0) \ + target = malloc((gaa_last_non_option - gaa_index) * sizeof(type));\ for(; gaa_index < gaa_last_non_option; gaa_index++) \ { \ if(gaa_arg_used[gaa_index] == 0) \ { \ - GAA_FILL_2ARGS(target[num], func); \ + GAA_FILL_2ARGS(target[num], func); \ num++; \ } \ } \ @@ -265,7 +270,9 @@ if(num == 0) \ if(!OK) \ { \ num = 0; \ -target = malloc((gaa_last_non_option - gaa_index) * sizeof(type)); \ +target = NULL; \ +if ( gaa_last_non_option - gaa_index > 0) \ + target = malloc((gaa_last_non_option - gaa_index) * sizeof(type));\ for(; gaa_index < gaa_last_non_option; gaa_index++) \ { \ if(gaa_arg_used[gaa_index] == 0) \ @@ -283,7 +290,7 @@ for(i = 0; i < strlen(str); i++) \ j = gaa_get_option_num(str + i, GAA_LETTER_OPTION); \ if(j == GAA_ERROR_NOMATCH) \ { \ - printf("Error : invalid 'obligat' set\n"); \ + printf("Error: invalid 'obligat' set\n"); \ exit(-1); \ } \ if(opt_list[j] == 1) \ @@ -305,7 +312,7 @@ for(i = 0; i < strlen(str); i++) \ j = gaa_get_option_num(str + i, GAA_LETTER_OPTION); \ if(j == GAA_ERROR_NOMATCH) \ { \ - printf("Error : invalid 'obligat' set\n"); \ + printf("Error: invalid 'obligat' set\n"); \ exit(-1); \ } \ if(opt_list[j] == 1) \ @@ -330,8 +337,8 @@ int gaa_getint(char *arg) char a; if(sscanf(arg, "%d%c", &tmp, &a) != 1) { - printf("Option %s : '%s' isn't an integer\n", gaa_current_option, arg); - GAAERROR; + printf("Option %s: '%s' isn't an integer\n", gaa_current_option, arg); + GAAERROR(-1); } return tmp; } @@ -340,8 +347,8 @@ char gaa_getchar(char *arg) { if(strlen(arg) != 1) { - printf("Option %s : '%s' isn't an character\n", gaa_current_option, arg); - GAAERROR; + printf("Option %s: '%s' isn't an character\n", gaa_current_option, arg); + GAAERROR(-1); } return arg[0]; } @@ -356,8 +363,8 @@ float gaa_getfloat(char *arg) char a; if(sscanf(arg, "%f%c", &tmp, &a) != 1) { - printf("Option %s : '%s' isn't a float number\n", gaa_current_option, arg); - GAAERROR; + printf("Option %s: '%s' isn't a float number\n", gaa_current_option, arg); + GAAERROR(-1); } return tmp; } @@ -466,7 +473,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list) return GAA_OK; break; case GAA_REST: - GAA_OPTIONALLIST_FILL(GAAREST_tmp.arg1, gaa_getstr, char*, GAAREST_tmp.size1); + GAA_LIST_FILL(GAAREST_tmp.arg1, gaa_getstr, char*, GAAREST_tmp.size1); #line 10 "tls_test.gaa" { gaaval->rest_args = GAAREST_tmp.arg1; gaaval->nrest_args = GAAREST_tmp.size1 ;}; @@ -496,12 +503,15 @@ int gaa(int argc, char **argv, gaainfo *gaaval) { #line 12 "tls_test.gaa" -{ gaaval->rest_args=NULL; gaaval->nrest_args=0; gaaval->pp = 5556; ;}; +{ gaaval->rest_args=NULL; gaaval->nrest_args=0; gaaval->pp = 443; ;}; } inited = 1; #line 438 "gaa.skel" - gaa_arg_used = malloc(argc * sizeof(char)); + gaa_arg_used = NULL; + + if (argc > 0) + gaa_arg_used = malloc(argc * sizeof(char)); for(i = 1; i < argc; i++) gaa_arg_used[i] = 0; for(i = 1; i < argc; i++) @@ -525,7 +535,7 @@ int gaa(int argc, char **argv, gaainfo *gaaval) switch(gaa_try(tmp2, i+1, gaaval, opt_list)) { case GAA_ERROR_NOTENOUGH_ARGS: - printf("'%s' : not enough arguments\n",gaa_current_option); + printf("'%s': not enough arguments\n",gaa_current_option); return 0; case GAA_ERROR_INVALID_ARG: printf("Invalid arguments\n"); @@ -549,7 +559,7 @@ int gaa(int argc, char **argv, gaainfo *gaaval) switch(gaa_try(tmp2, i+1, gaaval, opt_list)) { case GAA_ERROR_NOTENOUGH_ARGS: - printf("'%s' : not enough arguments\n",gaa_current_option); + printf("'%s': not enough arguments\n",gaa_current_option); return 0; case GAA_ERROR_INVALID_ARG: printf("Invalid arguments\n"); @@ -574,7 +584,7 @@ if(gaa_processing_file == 0) switch(gaa_try(GAA_REST, 1, gaaval, opt_list)) { case GAA_ERROR_NOTENOUGH_ARGS: - printf("Rest : not enough arguments\n"); + printf("Rest: not enough arguments\n"); return 0; case GAA_ERROR_INVALID_ARG: printf("Invalid arguments\n"); @@ -665,7 +675,7 @@ int gaa_internal_get_next_str(FILE *file, gaa_str_node *tmp_str, int argc) tmp_str->str[i - 1] = 0; fseek(file,- 1, SEEK_CUR); -// printf("%d\n", ftell(file)); +/* printf("%d\n", ftell(file)); */ return -1; } diff --git a/src/tls_test-gaa.h b/src/tls_test-gaa.h index 51a138e287..6418500ba5 100644 --- a/src/tls_test-gaa.h +++ b/src/tls_test-gaa.h @@ -25,7 +25,7 @@ extern "C" int gaa(int argc, char *argv[], gaainfo *gaaval); - void gaa_help(); + void gaa_help(void); int gaa_file(char *name, gaainfo *gaaval); diff --git a/src/tls_test.c b/src/tls_test.c index bff3417bd1..d0cd8d0282 100644 --- a/src/tls_test.c +++ b/src/tls_test.c @@ -211,7 +211,7 @@ void gaa_parser(int argc, char **argv) int i, j; if (gaa(argc, argv, &info) != -1) { - fprintf(stderr, "Error in the arguments.\n"); + fprintf(stderr, "Error in the arguments. Use the -h or --help parameters to get more info.\n"); exit(1); } diff --git a/src/tls_test.gaa b/src/tls_test.gaa index 3251e2304a..de04bd7478 100644 --- a/src/tls_test.gaa +++ b/src/tls_test.gaa @@ -7,7 +7,7 @@ option (h, help) { gaa_help(); exit(0); } "prints this help" #int nrest_args; #char **rest_args; -rest optional *STR "hostname" { $rest_args = $1; $nrest_args = @1 } +rest *STR "hostname" { $rest_args = $1; $nrest_args = @1 } -init { $rest_args=NULL; $nrest_args=0; $pp = 5556; } +init { $rest_args=NULL; $nrest_args=0; $pp = 443; } |