23 static const char *progname=NULL; |
23 static const char *progname=NULL; |
24 |
24 |
25 |
25 |
26 void libtu_init(const char *argv0) |
26 void libtu_init(const char *argv0) |
27 { |
27 { |
28 progname=argv0; |
28 progname=argv0; |
29 |
29 |
30 #ifdef CONFIG_LOCALE |
30 #ifdef CONFIG_LOCALE |
31 textdomain(simple_basename(argv0)); |
31 textdomain(simple_basename(argv0)); |
32 #endif |
32 #endif |
33 } |
33 } |
34 |
34 |
35 |
35 |
36 void libtu_init_copt(int argc, char *const argv[], |
36 void libtu_init_copt(int argc, char *const argv[], |
37 const OptParserCommonInfo *cinfo) |
37 const OptParserCommonInfo *cinfo) |
38 { |
38 { |
39 int opt; |
39 int opt; |
40 |
40 |
41 libtu_init(argv[0]); |
41 libtu_init(argv[0]); |
42 |
42 |
43 optparser_init(argc, argv, OPTP_DEFAULT, NULL, cinfo); |
43 optparser_init(argc, argv, OPTP_DEFAULT, NULL, cinfo); |
44 |
44 |
45 while((opt=optparser_get_opt())){ |
45 while((opt=optparser_get_opt())){ |
46 switch(opt){ |
46 switch(opt){ |
47 default: |
47 default: |
48 optparser_print_error(); |
48 optparser_print_error(); |
49 exit(EXIT_FAILURE); |
49 exit(EXIT_FAILURE); |
50 } |
50 } |
51 } |
51 } |
52 } |
52 } |
53 |
53 |
54 |
54 |
55 const char *prog_execname() |
55 const char *prog_execname() |
56 { |
56 { |
57 return progname; |
57 return progname; |
58 } |
58 } |
59 |
59 |