Tue, 16 Mar 2004 21:35:13 +0100
trunk: changeset 1408
Changed include directives to reflect change in locations of headers.
0 | 1 | /* |
2 | * libtu/util.c | |
3 | * | |
36 | 4 | * Copyright (c) Tuomo Valkonen 1999-2002. |
53 | 5 | * |
6 | * You may distribute and modify this library under the terms of either | |
7 | * the Clarified Artistic License or the GNU LGPL, version 2.1 or later. | |
0 | 8 | */ |
9 | ||
10 | #include <stdarg.h> | |
11 | #include <stdio.h> | |
12 | #include <stdlib.h> | |
13 | #include <string.h> | |
14 | ||
15 | #ifdef CONFIG_LOCALE | |
16 | #include <libintl.h> | |
17 | #endif | |
18 | ||
70 | 19 | #include "util.h" |
20 | #include "misc.h" | |
0 | 21 | |
22 | ||
23 | static const char *progname=NULL; | |
24 | ||
25 | ||
12 | 26 | void libtu_init(const char *argv0) |
0 | 27 | { |
62 | 28 | progname=argv0; |
29 | ||
0 | 30 | #ifdef CONFIG_LOCALE |
62 | 31 | textdomain(simple_basename(argv0)); |
0 | 32 | #endif |
33 | } | |
34 | ||
35 | ||
12 | 36 | void libtu_init_copt(int argc, char *const argv[], |
62 | 37 | const OptParserCommonInfo *cinfo) |
0 | 38 | { |
62 | 39 | int opt; |
40 | ||
41 | libtu_init(argv[0]); | |
42 | ||
43 | optparser_init(argc, argv, OPTP_DEFAULT, NULL, cinfo); | |
44 | ||
45 | while((opt=optparser_get_opt())){ | |
46 | switch(opt){ | |
47 | default: | |
48 | optparser_print_error(); | |
49 | exit(EXIT_FAILURE); | |
50 | } | |
51 | } | |
0 | 52 | } |
53 | ||
54 | ||
55 | const char *prog_execname() | |
56 | { | |
62 | 57 | return progname; |
0 | 58 | } |
59 |