Mon, 17 Feb 2003 23:24:47 +0100
trunk: changeset 46
UNLINK_ITEM fixed to reset next/previous pointers to NULL
| 0 | 1 | /* |
| 2 | * libtu/util.c | |
| 3 | * | |
| 36 | 4 | * Copyright (c) Tuomo Valkonen 1999-2002. |
| 0 | 5 | * See the included file LICENSE for details. |
| 6 | */ | |
| 7 | ||
| 8 | #include <stdarg.h> | |
| 9 | #include <stdio.h> | |
| 10 | #include <stdlib.h> | |
| 11 | #include <string.h> | |
| 12 | ||
| 13 | #ifdef CONFIG_LOCALE | |
| 14 | #include <libintl.h> | |
| 15 | #endif | |
| 16 | ||
| 5 | 17 | #include <libtu/util.h> |
| 18 | #include <libtu/misc.h> | |
| 0 | 19 | |
| 20 | ||
| 21 | static const char *progname=NULL; | |
| 22 | ||
| 23 | ||
| 12 | 24 | void libtu_init(const char *argv0) |
| 0 | 25 | { |
| 26 | progname=argv0; | |
| 27 | ||
| 28 | #ifdef CONFIG_LOCALE | |
| 29 | textdomain(simple_basename(argv0)); | |
| 30 | #endif | |
| 31 | } | |
| 32 | ||
| 33 | ||
| 12 | 34 | void libtu_init_copt(int argc, char *const argv[], |
| 35 | const OptParserCommonInfo *cinfo) | |
| 0 | 36 | { |
| 12 | 37 | int opt; |
| 38 | ||
| 39 | libtu_init(argv[0]); | |
| 40 | ||
| 41 | optparser_init(argc, argv, OPTP_DEFAULT, NULL, cinfo); | |
| 0 | 42 | |
| 12 | 43 | while((opt=optparser_get_opt())){ |
| 44 | switch(opt){ | |
| 45 | default: | |
| 46 | optparser_print_error(); | |
| 47 | exit(EXIT_FAILURE); | |
| 48 | } | |
| 49 | } | |
| 0 | 50 | } |
| 51 | ||
| 52 | ||
| 53 | const char *prog_execname() | |
| 54 | { | |
| 55 | return progname; | |
| 56 | } | |
| 57 |