comparison th_util.c @ 60:eef9c6312b88

Change some internals.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 19 Sep 2012 23:55:44 +0300
parents 82cfbebaa8b9
children c0eefd6b2d11
comparison
equal deleted inserted replaced
59:82cfbebaa8b9 60:eef9c6312b88
9 #include <stdio.h> 9 #include <stdio.h>
10 10
11 /* Default settings 11 /* Default settings
12 */ 12 */
13 static BOOL th_initialized = FALSE; 13 static BOOL th_initialized = FALSE;
14 int th_verbosityLevel = 2; 14 int th_verbosityLevel = 2;
15 char *th_prog_name = NULL, 15 char *th_prog_name = NULL,
16 *th_prog_fullname = NULL, 16 *th_prog_desc = NULL,
17 *th_prog_version = NULL, 17 *th_prog_version = NULL,
18 *th_prog_author = NULL, 18 *th_prog_author = NULL,
19 *th_prog_license = NULL; 19 *th_prog_license = NULL;
20 20
21 21
22 /* Initialize th_util-library and global variables 22 /* Initialize th_util-library and global variables
23 */ 23 */
24 void th_init(char *progName, char *progFullName, char *progVersion, 24 void th_init(char *name, char *desc, char *version,
25 char *progAuthor, char *progLicense) 25 char *author, char *license)
26 { 26 {
27 th_prog_name = progName; 27 th_prog_name = name;
28 th_prog_fullname = progFullName; 28 th_prog_desc = desc;
29 th_prog_version = progVersion; 29 th_prog_version = version;
30 30
31 if (progAuthor) 31 if (author)
32 th_prog_author = progAuthor; 32 th_prog_author = author;
33 else 33 else
34 th_prog_author = TH_PROG_AUTHOR; 34 th_prog_author = TH_PROG_AUTHOR;
35 35
36 if (progLicense) 36 if (license)
37 th_prog_license = progLicense; 37 th_prog_license = license;
38 else 38 else
39 th_prog_license = TH_PROG_LICENSE; 39 th_prog_license = TH_PROG_LICENSE;
40 40
41 th_initialized = TRUE; 41 th_initialized = TRUE;
42 } 42 }
43 43
44 44
45 void th_print_banner(FILE *outFile, const char *binName, const char *progUsage) 45 void th_print_banner(FILE *outFile, const char *binName, const char *usage)
46 { 46 {
47 fprintf(outFile, 47 fprintf(outFile,
48 "\n%s v%s (%s)\n" 48 "\n%s v%s (%s)\n"
49 "%s\n" 49 "%s\n"
50 "%s\n" 50 "%s\n"
51 "Usage: %s %s\n", 51 "Usage: %s %s\n",
52 th_prog_name, th_prog_version, th_prog_fullname, 52 th_prog_name, th_prog_version, th_prog_desc,
53 th_prog_author, th_prog_license, binName, progUsage); 53 th_prog_author, th_prog_license, binName, usage);
54 } 54 }
55 55
56 56
57 /* Print formatted error, warning and information messages 57 /* Print formatted error, warning and information messages
58 * TODO: Implement th_vfprintf() and friends? 58 * TODO: Implement th_vfprintf() and friends?