2
/* $Id: version.c,v 4.9 2006/09/24 02:11:16 bkorb Exp $
3
* Time-stamp: "2006-09-22 18:15:00 bkorb"
5
* This module implements the default usage procedure for
6
* Automated Options. It may be overridden, of course.
9
static char const zAOV[] =
10
"Automated Options version %s, copyright (c) 1999-2006 Bruce Korb\n";
12
/* Automated Options is free software.
13
* You may redistribute it and/or modify it under the terms of the
14
* GNU General Public License, as published by the Free Software
15
* Foundation; either version 2, or (at your option) any later version.
17
* Automated Options is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* You should have received a copy of the GNU General Public License
23
* along with Automated Options. See the file "COPYING". If not,
24
* write to: The Free Software Foundation, Inc.,
25
* 51 Franklin Street, Fifth Floor,
26
* Boston, MA 02110-1301, USA.
28
* As a special exception, Bruce Korb gives permission for additional
29
* uses of the text contained in his release of AutoOpts.
31
* The exception is that, if you link the AutoOpts library with other
32
* files to produce an executable, this does not by itself cause the
33
* resulting executable to be covered by the GNU General Public License.
34
* Your use of that executable is in no way restricted on account of
35
* linking the AutoOpts library code into it.
37
* This exception does not however invalidate any other reasons why
38
* the executable file might be covered by the GNU General Public License.
40
* This exception applies only to the code released by Bruce Korb under
41
* the name AutoOpts. If you copy code from other sources under the
42
* General Public License into a copy of AutoOpts, as the General Public
43
* License permits, the exception does not apply to the code that you add
44
* in this way. To avoid misleading anyone as to the status of such
45
* modified files, you must delete this exception notice from them.
47
* If you write modifications of your own for AutoOpts, it is your choice
48
* whether to permit this exception to apply to your modifications.
49
* If you do not wish that, delete this exception notice.
52
/* = = = START-STATIC-FORWARD = = = */
53
/* static forward declarations maintained by :mkfwd */
55
printVersion( tOptions* pOpts, tOptDesc* pOD, FILE* fp );
56
/* = = = END-STATIC-FORWARD = = = */
58
/*=export_func optionVersion
60
* what: return the compiled AutoOpts version number
61
* ret_type: char const*
62
* ret_desc: the version string in constant memory
64
* Returns the full version string compiled into the library.
65
* The returned string cannot be modified.
70
static char const zVersion[] =
71
STR( AO_CURRENT.AO_REVISION );
78
printVersion( tOptions* pOpts, tOptDesc* pOD, FILE* fp )
82
if (pOD->optArg.argString == NULL)
84
else swCh = pOD->optArg.argString[0];
86
if (pOpts->pzFullVersion != NULL) {
87
fputs( pOpts->pzFullVersion, fp );
91
char const *pz = pOpts->pzUsageTitle;
92
do { fputc( *pz, fp ); } while (*(pz++) != '\n');
103
if (pOpts->pzCopyright != NULL) {
104
fputs( pOpts->pzCopyright, fp );
107
fprintf( fp, zAOV, optionVersion() );
108
if (pOpts->pzBugAddr != NULL)
109
fprintf( fp, zPlsSendBugs, pOpts->pzBugAddr );
114
if (pOpts->pzCopyright != NULL) {
115
fputs( pOpts->pzCopyright, fp );
120
if (pOpts->pzCopyNotice != NULL) {
121
fputs( pOpts->pzCopyNotice, fp );
125
fprintf( fp, zAOV, optionVersion() );
126
if (pOpts->pzBugAddr != NULL)
127
fprintf( fp, zPlsSendBugs, pOpts->pzBugAddr );
131
fprintf( stderr, zBadVerArg, swCh );
132
exit( EXIT_FAILURE );
135
exit( EXIT_SUCCESS );
138
/*=export_func optionPrintVersion
141
* what: Print the program version
142
* arg: + tOptions* + pOpts + program options descriptor +
143
* arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
146
* This routine will print the version to stdout.
149
optionPrintVersion( tOptions* pOpts, tOptDesc* pOD )
151
printVersion( pOpts, pOD, stdout );
154
/*=export_func optionVersionStderr
157
* what: Print the program version to stderr
158
* arg: + tOptions* + pOpts + program options descriptor +
159
* arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
162
* This routine will print the version to stderr.
165
optionVersionStderr( tOptions* pOpts, tOptDesc* pOD )
167
printVersion( pOpts, pOD, stderr );
173
* c-file-style: "stroustrup"
174
* indent-tabs-mode: nil
176
* end of autoopts/version.c */