1 |
dashley |
71 |
//$Header$ |
2 |
|
|
//------------------------------------------------------------------------------------------------- |
3 |
|
|
//This file is part of "David T. Ashley's Shared Source Code", a set of shared components |
4 |
|
|
//integrated into many of David T. Ashley's projects. |
5 |
|
|
//------------------------------------------------------------------------------------------------- |
6 |
|
|
//This source code and any program in which it is compiled/used is provided under the MIT License, |
7 |
|
|
//reproduced below. |
8 |
|
|
//------------------------------------------------------------------------------------------------- |
9 |
|
|
//Permission is hereby granted, free of charge, to any person obtaining a copy of |
10 |
|
|
//this software and associated documentation files(the "Software"), to deal in the |
11 |
|
|
//Software without restriction, including without limitation the rights to use, |
12 |
|
|
//copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the |
13 |
|
|
//Software, and to permit persons to whom the Software is furnished to do so, |
14 |
|
|
//subject to the following conditions : |
15 |
|
|
// |
16 |
|
|
//The above copyright notice and this permission notice shall be included in all |
17 |
|
|
//copies or substantial portions of the Software. |
18 |
|
|
// |
19 |
|
|
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
20 |
|
|
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
21 |
|
|
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE |
22 |
|
|
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
23 |
|
|
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
24 |
|
|
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
25 |
|
|
//SOFTWARE. |
26 |
|
|
//------------------------------------------------------------------------------------------------- |
27 |
|
|
/* Messages common to command-line utilities. They are collected |
28 |
|
|
** in one place to avoided redundancy. |
29 |
|
|
*/ |
30 |
|
|
|
31 |
|
|
#ifndef CU_MSGS_H_INCLUDED |
32 |
|
|
#define CU_MSGS_H_INCLUDED |
33 |
|
|
|
34 |
|
|
#ifdef MODULE_CU_MSGS |
35 |
|
|
#define DECMOD_CU_MSGS |
36 |
|
|
#else |
37 |
|
|
#define DECMOD_CU_MSGS extern |
38 |
|
|
#endif |
39 |
|
|
|
40 |
|
|
//This is the structure type used to pass back to a caller |
41 |
|
|
//the results of looking at his command-line parameter(s). |
42 |
|
|
typedef struct |
43 |
|
|
{ |
44 |
|
|
int debug; |
45 |
|
|
//True if -debug flag was used. |
46 |
|
|
int noformat; |
47 |
|
|
//True if -noformat flag was used. |
48 |
|
|
int help; |
49 |
|
|
//True if -help flag was used. |
50 |
|
|
int verbose; |
51 |
|
|
//True if the -verbose option was used. |
52 |
|
|
} CU_MSGS_std_cmd_line_par_results_struct; |
53 |
|
|
|
54 |
|
|
//Prints out the message which should occur when too few |
55 |
|
|
//arguments are used on the command-line. |
56 |
|
|
DECMOD_CU_MSGS |
57 |
|
|
void CU_MSGS_too_few_args_msg(FILE *s, const char *pname); |
58 |
|
|
|
59 |
|
|
//Prints out the message which supplies download |
60 |
|
|
//and license information. |
61 |
|
|
DECMOD_CU_MSGS |
62 |
|
|
void CU_MSGS_toolset_info_msg(FILE *s, const char *pname); |
63 |
|
|
|
64 |
|
|
//Prints standard options, indented by 3 and 6 spaces. |
65 |
|
|
DECMOD_CU_MSGS |
66 |
|
|
void CU_MSGS_std_options(FILE *s, const char *pname); |
67 |
|
|
|
68 |
|
|
//Initializes the common parameter block structure, |
69 |
|
|
//including any dynamic allocation (at this time, none). |
70 |
|
|
DECMOD_CU_MSGS |
71 |
|
|
void CU_MSGS_cmd_line_par_results_struct_create( |
72 |
|
|
CU_MSGS_std_cmd_line_par_results_struct *arg); |
73 |
|
|
|
74 |
|
|
//Processes the passed command-line argument into the |
75 |
|
|
//structure. |
76 |
|
|
DECMOD_CU_MSGS |
77 |
|
|
void CU_MSGS_cmd_line_par_results_struct_process_arg( |
78 |
|
|
CU_MSGS_std_cmd_line_par_results_struct *argblock, |
79 |
|
|
const char *arg, int *recognized); |
80 |
|
|
|
81 |
|
|
//Finalizes the results, such as taking care of conflicting |
82 |
|
|
//switches, etc. |
83 |
|
|
void CU_MSGS_cmd_line_par_results_struct_finalize( |
84 |
|
|
CU_MSGS_std_cmd_line_par_results_struct *arg); |
85 |
|
|
|
86 |
|
|
//Destroys the command-line argument. This is left as a |
87 |
|
|
//hook in case dynamic allocation is ever required. |
88 |
|
|
DECMOD_CU_MSGS |
89 |
|
|
void CU_MSGS_cmd_line_par_results_struct_destroy( |
90 |
|
|
CU_MSGS_std_cmd_line_par_results_struct *arg); |
91 |
|
|
|
92 |
|
|
//Passed a pointer to a table of function pointers, each of which |
93 |
|
|
//returns a character string, emit version control information |
94 |
|
|
//to the passed stream. Should supply program name in all upper |
95 |
|
|
//case. |
96 |
|
|
DECMOD_CU_MSGS |
97 |
|
|
void CU_MSGS_emit_vcinfo_from_ptr_table(FILE *s, |
98 |
|
|
const char *(**ptrs)(void), |
99 |
|
|
const char *pname); |
100 |
|
|
|
101 |
|
|
DECMOD_CU_MSGS const char *CU_MSGS_cvcinfo(void); |
102 |
|
|
DECMOD_CU_MSGS const char *CU_MSGS_hvcinfo(void); |
103 |
|
|
#define CU_MSGS_H_VERSION ("$Header$") |
104 |
|
|
#endif |
105 |
|
|
|
106 |
|
|
//End of cu_msgs.h. |