1 /* File generated by GAA 1.6.0b3
10 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(WINDOWS)
15 void __gaa_helpsingle(char short_name
, char *name
,
16 char *arg_desc
, char *opt_help
)
18 int col1
, col3
, col4
, tabsize
= 3, curr
;
21 col1
= 5; /* Default values */
26 for(i
= 0; i
< col1
; i
++)
35 printf("-%c, ", short_name
);
40 printf("-%c ", short_name
);
46 printf("--%s ", name
);
47 curr
+= 3 + strlen(name
);
49 if(arg_desc
&& *arg_desc
)
51 printf("%s ", arg_desc
);
52 curr
+= 1 + strlen(arg_desc
);
59 if(opt_help
) /* let's print the option's help body */
61 const char *str
= opt_help
;
81 while((curr
- col3
) % tabsize
!= 0 && curr
< col4
);
88 for(i
= 1; str
[i
] && str
[i
] != ' ' && str
[i
] != '\n'
89 && str
[i
] != '\t'; i
++);
90 if(curr
+ i
- 1 >= col4
)
110 printf("gnutls-serv help\nUsage: gnutls-serv [options]""\n");
111 __gaa_helpsingle('g', "generate", "", "Generate Diffie Hellman Parameters.");
112 __gaa_helpsingle('p', "port", """integer"" ", "The port to connect to.");
113 __gaa_helpsingle(0, "http", "", "Act as an HTTP Server.");
114 __gaa_helpsingle(0, "cafile", """FILE"" ", "Certificate file to use.");
115 __gaa_helpsingle(0, "pgpkeyring", """FILE"" ", "PGP Key ring file to use.");
116 __gaa_helpsingle(0, "pgptrustdb", """FILE"" ", "PGP trustdb file to use.");
117 __gaa_helpsingle(0, "pgpkeyfile", """FILE"" ", "PGP Key file to use.");
118 __gaa_helpsingle(0, "pgpcertfile", """FILE"" ", "PGP Public Key (certificate) file to use.");
119 __gaa_helpsingle(0, "x509keyfile", """FILE"" ", "X.509 key file to use.");
120 __gaa_helpsingle(0, "x509certfile", """FILE"" ", "X.509 Certificate file to use.");
121 __gaa_helpsingle(0, "pgpkeyserver", """FILE"" ", "PGP Keyserver to use.");
122 __gaa_helpsingle(0, "srppasswd", """FILE"" ", "SRP password file to use.");
123 __gaa_helpsingle(0, "srppasswdconf", """FILE"" ", "SRP password conf file to use.");
124 __gaa_helpsingle(0, "ciphers", """cipher1 cipher2..."" ", "Ciphers to enable.");
125 __gaa_helpsingle(0, "protocols", """protocol1 protocol2..."" ", "Protocols to enable.");
126 __gaa_helpsingle(0, "comp", """comp1 comp2..."" ", "Compression methods to enable.");
127 __gaa_helpsingle(0, "macs", """mac1 mac2..."" ", "MACs to enable.");
128 __gaa_helpsingle(0, "kx", """kx1 kx2..."" ", "Key exchange methods to enable.");
129 __gaa_helpsingle(0, "ctypes", """certType1 certType2..."" ", "Certificate types to enable.");
130 __gaa_helpsingle('l', "list", "", "Print a list of the supported algorithms and modes.");
131 __gaa_helpsingle('h', "help", "", "prints this help");
139 #ifndef GAA_HEADER_POKY
140 #define GAA_HEADER_POKY
142 typedef struct _gaainfo gaainfo
;
171 char *srp_passwd_conf
;
205 int gaa(int argc
, char *argv
[], gaainfo
*gaaval
);
209 int gaa_file(char *name
, gaainfo
*gaaval
);
222 #define GAAERROR(x) \
228 char *gaa_current_option
;
231 /* Generated by gaa */
239 #define GAA_ERROR_NOMATCH 0
240 #define GAA_ERROR_NOTENOUGH_ARGS 1
241 #define GAA_ERROR_INVALID_ARG 2
242 #define GAA_ERROR_UNKNOWN 3
244 #define GAA_NOT_AN_OPTION 0
245 #define GAA_WORD_OPTION 1
246 #define GAA_LETTER_OPTION 2
247 #define GAA_MULTIPLE_OPTION 3
250 #define GAA_NB_OPTION 21
251 #define GAAOPTID_help 1
252 #define GAAOPTID_list 2
253 #define GAAOPTID_ctypes 3
254 #define GAAOPTID_kx 4
255 #define GAAOPTID_macs 5
256 #define GAAOPTID_comp 6
257 #define GAAOPTID_protocols 7
258 #define GAAOPTID_ciphers 8
259 #define GAAOPTID_srppasswdconf 9
260 #define GAAOPTID_srppasswd 10
261 #define GAAOPTID_pgpkeyserver 11
262 #define GAAOPTID_x509certfile 12
263 #define GAAOPTID_x509keyfile 13
264 #define GAAOPTID_pgpcertfile 14
265 #define GAAOPTID_pgpkeyfile 15
266 #define GAAOPTID_pgptrustdb 16
267 #define GAAOPTID_pgpkeyring 17
268 #define GAAOPTID_cafile 18
269 #define GAAOPTID_http 19
270 #define GAAOPTID_port 20
271 #define GAAOPTID_generate 21
275 #define GAA_CHECK1STR(a,b) \
278 gaa_current_option = a; \
282 #define GAA_CHECKSTR(a,b) \
283 if(strcmp(a,str) == 0) \
285 gaa_current_option = a; \
289 #define GAA_TESTMOREARGS \
292 while((gaa_last_non_option != gaa_index) && (gaa_arg_used[gaa_index] == 1)) \
294 if(gaa_last_non_option == gaa_index) \
295 return GAA_ERROR_NOTENOUGH_ARGS; \
298 #define GAA_TESTMOREOPTIONALARGS \
301 while((gaa_last_non_option != gaa_index) && (gaa_arg_used[gaa_index] == 1)) \
303 if(gaa_last_non_option == gaa_index) \
307 #define GAA_FILL_2ARGS(target, func) \
308 target = func(GAAargv[gaa_index]); \
309 gaa_arg_used[gaa_index] = 1; \
313 return GAA_ERROR_INVALID_ARG; \
318 #define GAA_FILL(target, func, num) \
321 target = func(GAAargv[gaa_index]); \
322 gaa_arg_used[gaa_index] = 1; \
326 return GAA_ERROR_INVALID_ARG; \
335 #define GAA_LIST_FILL(target, func, type ,num) \
340 if ( gaa_last_non_option - gaa_index > 0) \
341 target = malloc((gaa_last_non_option - gaa_index) * sizeof(type));\
342 for(; gaa_index < gaa_last_non_option; gaa_index++) \
344 if(gaa_arg_used[gaa_index] == 0) \
346 GAA_FILL_2ARGS(target[num], func); \
351 return GAA_ERROR_NOTENOUGH_ARGS; \
354 #define GAA_OPTIONALLIST_FILL(target, func, type ,num) \
359 if ( gaa_last_non_option - gaa_index > 0) \
360 target = malloc((gaa_last_non_option - gaa_index) * sizeof(type));\
361 for(; gaa_index < gaa_last_non_option; gaa_index++) \
363 if(gaa_arg_used[gaa_index] == 0) \
365 GAA_FILL_2ARGS(target[num], func); \
371 #define GAA_OBLIGAT(str) \
373 for(i = 0; i < strlen(str); i++) \
375 j = gaa_get_option_num(str + i, GAA_LETTER_OPTION); \
376 if(j == GAA_ERROR_NOMATCH) \
378 printf("Error: invalid 'obligat' set\n"); \
381 if(opt_list[j] == 1) \
386 if(strlen(str) == 1) \
387 printf("You must give the -%s option\n", str); \
389 printf("You must give at least one option of '%s'\n", str); \
393 #define GAA_INCOMP(str) \
395 for(i = 0; i < strlen(str); i++) \
397 j = gaa_get_option_num(str + i, GAA_LETTER_OPTION); \
398 if(j == GAA_ERROR_NOMATCH) \
400 printf("Error: invalid 'obligat' set\n"); \
403 if(opt_list[j] == 1) \
408 printf("The options '%s' are incompatible\n", str); \
416 int gaa_processing_file
= 0;
419 int gaa_getint(char *arg
)
423 if(sscanf(arg
, "%d%c", &tmp
, &a
) != 1)
425 printf("Option %s: '%s' isn't an integer\n", gaa_current_option
, arg
);
431 char gaa_getchar(char *arg
)
435 printf("Option %s: '%s' isn't an character\n", gaa_current_option
, arg
);
441 char* gaa_getstr(char *arg
)
445 float gaa_getfloat(char *arg
)
449 if(sscanf(arg
, "%f%c", &tmp
, &a
) != 1)
451 printf("Option %s: '%s' isn't a float number\n", gaa_current_option
, arg
);
456 /* option structures */
458 struct GAAOPTION_ctypes
470 struct GAAOPTION_macs
476 struct GAAOPTION_comp
482 struct GAAOPTION_protocols
488 struct GAAOPTION_ciphers
494 struct GAAOPTION_srppasswdconf
500 struct GAAOPTION_srppasswd
506 struct GAAOPTION_pgpkeyserver
512 struct GAAOPTION_x509certfile
518 struct GAAOPTION_x509keyfile
524 struct GAAOPTION_pgpcertfile
530 struct GAAOPTION_pgpkeyfile
536 struct GAAOPTION_pgptrustdb
542 struct GAAOPTION_pgpkeyring
548 struct GAAOPTION_cafile
554 struct GAAOPTION_port
561 int gaa_is_an_argument(char *str
)
564 if(str
[0] == '/' && str
[1] != 0)
565 return GAA_MULTIPLE_OPTION
;
568 return GAA_NOT_AN_OPTION
;
570 return GAA_NOT_AN_OPTION
;
574 return GAA_WORD_OPTION
;
576 return GAA_NOT_AN_OPTION
;
579 return GAA_LETTER_OPTION
;
581 return GAA_MULTIPLE_OPTION
;
584 int gaa_get_option_num(char *str
, int status
)
588 case GAA_LETTER_OPTION
:
589 GAA_CHECK1STR("", GAAOPTID_ctypes
);
590 GAA_CHECK1STR("", GAAOPTID_kx
);
591 GAA_CHECK1STR("", GAAOPTID_macs
);
592 GAA_CHECK1STR("", GAAOPTID_comp
);
593 GAA_CHECK1STR("", GAAOPTID_protocols
);
594 GAA_CHECK1STR("", GAAOPTID_ciphers
);
595 GAA_CHECK1STR("", GAAOPTID_srppasswdconf
);
596 GAA_CHECK1STR("", GAAOPTID_srppasswd
);
597 GAA_CHECK1STR("", GAAOPTID_pgpkeyserver
);
598 GAA_CHECK1STR("", GAAOPTID_x509certfile
);
599 GAA_CHECK1STR("", GAAOPTID_x509keyfile
);
600 GAA_CHECK1STR("", GAAOPTID_pgpcertfile
);
601 GAA_CHECK1STR("", GAAOPTID_pgpkeyfile
);
602 GAA_CHECK1STR("", GAAOPTID_pgptrustdb
);
603 GAA_CHECK1STR("", GAAOPTID_pgpkeyring
);
604 GAA_CHECK1STR("", GAAOPTID_cafile
);
605 GAA_CHECK1STR("p", GAAOPTID_port
);
606 case GAA_MULTIPLE_OPTION
:
608 GAA_CHECK1STR("h", GAAOPTID_help
);
609 GAA_CHECK1STR("l", GAAOPTID_list
);
610 GAA_CHECK1STR("", GAAOPTID_http
);
611 GAA_CHECK1STR("g", GAAOPTID_generate
);
615 case GAA_WORD_OPTION
:
616 GAA_CHECKSTR("help", GAAOPTID_help
);
617 GAA_CHECKSTR("list", GAAOPTID_list
);
618 GAA_CHECKSTR("ctypes", GAAOPTID_ctypes
);
619 GAA_CHECKSTR("kx", GAAOPTID_kx
);
620 GAA_CHECKSTR("macs", GAAOPTID_macs
);
621 GAA_CHECKSTR("comp", GAAOPTID_comp
);
622 GAA_CHECKSTR("protocols", GAAOPTID_protocols
);
623 GAA_CHECKSTR("ciphers", GAAOPTID_ciphers
);
624 GAA_CHECKSTR("srppasswdconf", GAAOPTID_srppasswdconf
);
625 GAA_CHECKSTR("srppasswd", GAAOPTID_srppasswd
);
626 GAA_CHECKSTR("pgpkeyserver", GAAOPTID_pgpkeyserver
);
627 GAA_CHECKSTR("x509certfile", GAAOPTID_x509certfile
);
628 GAA_CHECKSTR("x509keyfile", GAAOPTID_x509keyfile
);
629 GAA_CHECKSTR("pgpcertfile", GAAOPTID_pgpcertfile
);
630 GAA_CHECKSTR("pgpkeyfile", GAAOPTID_pgpkeyfile
);
631 GAA_CHECKSTR("pgptrustdb", GAAOPTID_pgptrustdb
);
632 GAA_CHECKSTR("pgpkeyring", GAAOPTID_pgpkeyring
);
633 GAA_CHECKSTR("cafile", GAAOPTID_cafile
);
634 GAA_CHECKSTR("http", GAAOPTID_http
);
635 GAA_CHECKSTR("port", GAAOPTID_port
);
636 GAA_CHECKSTR("generate", GAAOPTID_generate
);
642 return GAA_ERROR_NOMATCH
;
645 int gaa_try(int gaa_num
, int gaa_index
, gaainfo
*gaaval
, char *opt_list
)
648 int gaa_last_non_option
;
649 struct GAAOPTION_ctypes GAATMP_ctypes
;
650 struct GAAOPTION_kx GAATMP_kx
;
651 struct GAAOPTION_macs GAATMP_macs
;
652 struct GAAOPTION_comp GAATMP_comp
;
653 struct GAAOPTION_protocols GAATMP_protocols
;
654 struct GAAOPTION_ciphers GAATMP_ciphers
;
655 struct GAAOPTION_srppasswdconf GAATMP_srppasswdconf
;
656 struct GAAOPTION_srppasswd GAATMP_srppasswd
;
657 struct GAAOPTION_pgpkeyserver GAATMP_pgpkeyserver
;
658 struct GAAOPTION_x509certfile GAATMP_x509certfile
;
659 struct GAAOPTION_x509keyfile GAATMP_x509keyfile
;
660 struct GAAOPTION_pgpcertfile GAATMP_pgpcertfile
;
661 struct GAAOPTION_pgpkeyfile GAATMP_pgpkeyfile
;
662 struct GAAOPTION_pgptrustdb GAATMP_pgptrustdb
;
663 struct GAAOPTION_pgpkeyring GAATMP_pgpkeyring
;
664 struct GAAOPTION_cafile GAATMP_cafile
;
665 struct GAAOPTION_port GAATMP_port
;
668 #ifdef GAA_REST_EXISTS
669 struct GAAREST GAAREST_tmp
;
672 opt_list
[gaa_num
] = 1;
674 for(gaa_last_non_option
= gaa_index
;
675 (gaa_last_non_option
!= GAAargc
) && (gaa_is_an_argument(GAAargv
[gaa_last_non_option
]) == GAA_NOT_AN_OPTION
);
676 gaa_last_non_option
++);
678 if(gaa_num
== GAA_REST
)
681 gaa_last_non_option
= GAAargc
;
689 { gaa_help(); exit(0); ;};
696 { print_list(); exit(0); ;};
700 case GAAOPTID_ctypes
:
702 GAA_LIST_FILL(GAATMP_ctypes
.arg1
, gaa_getstr
, char*, GAATMP_ctypes
.size1
);
704 { gaaval
->ctype
= GAATMP_ctypes
.arg1
; gaaval
->nctype
= GAATMP_ctypes
.size1
;};
710 GAA_LIST_FILL(GAATMP_kx
.arg1
, gaa_getstr
, char*, GAATMP_kx
.size1
);
712 { gaaval
->kx
= GAATMP_kx
.arg1
; gaaval
->nkx
= GAATMP_kx
.size1
;};
718 GAA_LIST_FILL(GAATMP_macs
.arg1
, gaa_getstr
, char*, GAATMP_macs
.size1
);
720 { gaaval
->macs
= GAATMP_macs
.arg1
; gaaval
->nmacs
= GAATMP_macs
.size1
;};
726 GAA_LIST_FILL(GAATMP_comp
.arg1
, gaa_getstr
, char*, GAATMP_comp
.size1
);
728 { gaaval
->comp
= GAATMP_comp
.arg1
; gaaval
->ncomp
= GAATMP_comp
.size1
;};
732 case GAAOPTID_protocols
:
734 GAA_LIST_FILL(GAATMP_protocols
.arg1
, gaa_getstr
, char*, GAATMP_protocols
.size1
);
736 { gaaval
->proto
= GAATMP_protocols
.arg1
; gaaval
->nproto
= GAATMP_protocols
.size1
;};
740 case GAAOPTID_ciphers
:
742 GAA_LIST_FILL(GAATMP_ciphers
.arg1
, gaa_getstr
, char*, GAATMP_ciphers
.size1
);
744 { gaaval
->ciphers
= GAATMP_ciphers
.arg1
; gaaval
->nciphers
= GAATMP_ciphers
.size1
;};
748 case GAAOPTID_srppasswdconf
:
751 GAA_FILL(GAATMP_srppasswdconf
.arg1
, gaa_getstr
, GAATMP_srppasswdconf
.size1
);
754 { gaaval
->srp_passwd_conf
= GAATMP_srppasswdconf
.arg1
;};
758 case GAAOPTID_srppasswd
:
761 GAA_FILL(GAATMP_srppasswd
.arg1
, gaa_getstr
, GAATMP_srppasswd
.size1
);
764 { gaaval
->srp_passwd
= GAATMP_srppasswd
.arg1
;};
768 case GAAOPTID_pgpkeyserver
:
771 GAA_FILL(GAATMP_pgpkeyserver
.arg1
, gaa_getstr
, GAATMP_pgpkeyserver
.size1
);
774 { gaaval
->pgp_keyserver
= GAATMP_pgpkeyserver
.arg1
;};
778 case GAAOPTID_x509certfile
:
781 GAA_FILL(GAATMP_x509certfile
.arg1
, gaa_getstr
, GAATMP_x509certfile
.size1
);
784 { gaaval
->x509_certfile
= GAATMP_x509certfile
.arg1
;};
788 case GAAOPTID_x509keyfile
:
791 GAA_FILL(GAATMP_x509keyfile
.arg1
, gaa_getstr
, GAATMP_x509keyfile
.size1
);
794 { gaaval
->x509_keyfile
= GAATMP_x509keyfile
.arg1
;};
798 case GAAOPTID_pgpcertfile
:
801 GAA_FILL(GAATMP_pgpcertfile
.arg1
, gaa_getstr
, GAATMP_pgpcertfile
.size1
);
804 { gaaval
->pgp_certfile
= GAATMP_pgpcertfile
.arg1
;};
808 case GAAOPTID_pgpkeyfile
:
811 GAA_FILL(GAATMP_pgpkeyfile
.arg1
, gaa_getstr
, GAATMP_pgpkeyfile
.size1
);
814 { gaaval
->pgp_keyfile
= GAATMP_pgpkeyfile
.arg1
;};
818 case GAAOPTID_pgptrustdb
:
821 GAA_FILL(GAATMP_pgptrustdb
.arg1
, gaa_getstr
, GAATMP_pgptrustdb
.size1
);
824 { gaaval
->pgp_keyring
= GAATMP_pgptrustdb
.arg1
;};
828 case GAAOPTID_pgpkeyring
:
831 GAA_FILL(GAATMP_pgpkeyring
.arg1
, gaa_getstr
, GAATMP_pgpkeyring
.size1
);
834 { gaaval
->pgp_keyring
= GAATMP_pgpkeyring
.arg1
;};
838 case GAAOPTID_cafile
:
841 GAA_FILL(GAATMP_cafile
.arg1
, gaa_getstr
, GAATMP_cafile
.size1
);
844 { gaaval
->x509_cafile
= GAATMP_cafile
.arg1
;};
851 { gaaval
->http
= 1 ;};
858 GAA_FILL(GAATMP_port
.arg1
, gaa_getint
, GAATMP_port
.size1
);
861 { gaaval
->port
= GAATMP_port
.arg1
;};
865 case GAAOPTID_generate
:
868 { gaaval
->generate
= 1 ;};
876 return GAA_ERROR_UNKNOWN
;
879 int gaa(int argc
, char **argv
, gaainfo
*gaaval
)
888 opt_list
= (char*) malloc(GAA_NB_OPTION
+ 1);
889 for(i
= 0; i
< GAA_NB_OPTION
+ 1; i
++)
896 { gaaval
->generate
=0; gaaval
->port
=5556; gaaval
->http
=0; gaaval
->ciphers
=NULL
;
897 gaaval
->kx
=NULL
; gaaval
->comp
=NULL
; gaaval
->macs
=NULL
; gaaval
->ctype
=NULL
; gaaval
->nciphers
=0;
898 gaaval
->nkx
=0; gaaval
->ncomp
=0; gaaval
->nmacs
=0; gaaval
->nctype
= 0;
899 gaaval
->x509_cafile
= NULL
; gaaval
->pgp_keyfile
=NULL
; gaaval
->pgp_certfile
=NULL
;
900 gaaval
->x509_keyfile
=NULL
; gaaval
->x509_certfile
=NULL
; gaaval
->pgp_keyserver
=NULL
;
901 gaaval
->srp_passwd
=NULL
; gaaval
->srp_passwd_conf
=NULL
;
902 gaaval
->pgp_trustdb
=NULL
; gaaval
->pgp_keyring
=NULL
; ;};
910 gaa_arg_used
= malloc(argc
* sizeof(char));
911 for(i
= 1; i
< argc
; i
++)
913 for(i
= 1; i
< argc
; i
++)
915 if(gaa_arg_used
[i
] == 0)
918 tmp1
= gaa_is_an_argument(GAAargv
[i
]);
921 case GAA_WORD_OPTION
:
923 case GAA_LETTER_OPTION
:
925 tmp2
= gaa_get_option_num(argv
[i
]+j
, tmp1
);
926 if(tmp2
== GAA_ERROR_NOMATCH
)
928 printf("Invalid option '%s'\n", argv
[i
]+j
);
931 switch(gaa_try(tmp2
, i
+1, gaaval
, opt_list
))
933 case GAA_ERROR_NOTENOUGH_ARGS
:
934 printf("'%s': not enough arguments\n",gaa_current_option
);
936 case GAA_ERROR_INVALID_ARG
:
937 printf("Invalid arguments\n");
942 printf("Unknown error\n");
946 case GAA_MULTIPLE_OPTION
:
947 for(j
= 1; j
< strlen(argv
[i
]); j
++)
949 tmp2
= gaa_get_option_num(argv
[i
]+j
, tmp1
);
950 if(tmp2
== GAA_ERROR_NOMATCH
)
952 printf("Invalid option '%c'\n", *(argv
[i
]+j
));
955 switch(gaa_try(tmp2
, i
+1, gaaval
, opt_list
))
957 case GAA_ERROR_NOTENOUGH_ARGS
:
958 printf("'%s': not enough arguments\n",gaa_current_option
);
960 case GAA_ERROR_INVALID_ARG
:
961 printf("Invalid arguments\n");
966 printf("Unknown error\n");
975 if(gaa_processing_file
== 0)
979 #ifdef GAA_REST_EXISTS
980 switch(gaa_try(GAA_REST
, 1, gaaval
, opt_list
))
982 case GAA_ERROR_NOTENOUGH_ARGS
:
983 printf("Rest: not enough arguments\n");
985 case GAA_ERROR_INVALID_ARG
:
986 printf("Invalid arguments\n");
991 printf("Unknown error\n");
995 for(i
= 1; i
< argc
; i
++)
997 if(gaa_arg_used
[i
] == 0)
999 printf("Too many arguments\n");
1011 struct gaastrnode
*next
;
1014 typedef struct gaastrnode gaa_str_node
;
1016 int gaa_internal_get_next_str(FILE *file
, gaa_str_node
*tmp_str
, int argc
)
1020 int i
= 0, len
= 0, newline
= 0;
1025 if(fscanf(file
,"%c", &a
) != 1) return 0;
1027 while(a
== ' ' || a
== 9 || a
== '\n')
1034 if(fscanf(file
,"%c", &a
) != 1) return 0;
1037 pos_ini
= ftell(file
) - 1;
1039 while(a
!= ' ' && a
!= 9 && a
!= '\n')
1043 if(fscanf(file
,"%c", &a
) != 1) a
= ' ';
1046 tmp_str
->str
= malloc((len
+ 1) * sizeof(char));
1049 tmp_str
->str
[0] = '-';
1050 tmp_str
->str
[1] = '-';
1058 fseek(file
,pos_ini
, SEEK_SET
);
1061 if(fscanf(file
, "%c", &a
) != 1)
1066 tmp_str
->str
[i
] = a
;
1069 while(a
!= ' ' && a
!= 9 && a
!= '\n');
1071 tmp_str
->str
[i
- 1] = 0;
1073 fseek(file
,- 1, SEEK_CUR
);
1074 /* printf("%d\n", ftell(file)); */
1079 int gaa_file(char *name
, gaainfo
*gaaval
)
1081 gaa_str_node
*first_str
, **tmp_str
, *tmp_str2
;
1087 gaa_processing_file
= 1;
1089 if((file
= fopen(name
, "r")) == NULL
)
1091 printf("Couldn't open '%s' configuration file for reading\n", name
);
1095 tmp_str
= &first_str
;
1099 *tmp_str
= malloc(sizeof(gaa_str_node
));
1100 (*tmp_str
)->str
= NULL
;
1101 (*tmp_str
)->next
= NULL
;
1103 rval
= gaa_internal_get_next_str(file
, *tmp_str
, argc
);
1104 tmp_str
= &((*tmp_str
)->next
);
1111 argv
= malloc((1 + argc
) * sizeof(char*));
1112 tmp_str2
= first_str
;
1114 for(i
= 1; i
< argc
; i
++)
1116 argv
[i
] = tmp_str2
->str
;
1117 tmp_str2
= tmp_str2
->next
;
1120 rval
= gaa(argc
, argv
, gaaval
);
1121 gaa_processing_file
= 0;