consistent display of strongSwan version

This commit is contained in:
Andreas Steffen 2009-06-13 16:03:08 +02:00
parent 2b92fc9880
commit ebde1a7ddd
13 changed files with 17 additions and 104 deletions

View File

@ -37,7 +37,6 @@ main(int argc, char *argv[])
int opt;
extern int optind;
int errflg = 0;
const char *version = ipsec_version_code();
const char **notice = ipsec_copyright_notice();
const char **co;
@ -48,7 +47,7 @@ main(int argc, char *argv[])
exit(0);
break;
case 'v': /* version */
printf("%s %s\n", me, version);
printf("%s strongSwan "VERSION"\n", me);
exit(0);
break;
case '?':

View File

@ -467,7 +467,7 @@ static bool initialize(private_daemon_t *this, bool syslog, level_t levels[])
initialize_loggers(this, !syslog, levels);
DBG1(DBG_DMN, "starting charon (strongSwan Version %s)", VERSION);
DBG1(DBG_DMN, "Starting IKEv2 charon daemon (strongSwan "VERSION")");
/* load secrets, ca certificates and crls */
this->public.processor = processor_create();

View File

@ -375,7 +375,7 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo
time_t now = time(NULL);
u_int size, online, offline;
fprintf(out, "Daemon status (charon "VERSION"):\n");
fprintf(out, "Status of IKEv2 charon daemon (strongSwan "VERSION"):\n");
fprintf(out, " uptime: %V, since %T\n", &now, &this->uptime, &this->uptime, FALSE);
fprintf(out, " worker threads: %d idle of %d,",
charon->processor->get_idle_threads(charon->processor),

View File

@ -7,7 +7,7 @@ libfreeswan_a_SOURCES = addrtoa.c addrtot.c addrtypeof.c anyaddr.c atoaddr.c ato
pfkey.h pfkeyv2.h rangetosubnet.c sameaddr.c satoa.c \
satot.c subnetof.c subnettoa.c subnettot.c \
subnettypeof.c ttoaddr.c ttodata.c ttoprotoport.c ttosa.c ttosubnet.c ttoul.c \
ultoa.c ultot.c version.c
ultoa.c ultot.c
INCLUDES = \
-I$(top_srcdir)/src/libstrongswan \
@ -15,5 +15,5 @@ INCLUDES = \
dist_man3_MANS = anyaddr.3 atoaddr.3 atoasr.3 atosa.3 atoul.3 goodmask.3 initaddr.3 initsubnet.3 \
keyblobtoid.3 portof.3 prng.3 rangetosubnet.3 sameaddr.3 subnetof.3 \
ttoaddr.3 ttodata.3 ttosa.3 ttoul.3 version.3
ttoaddr.3 ttodata.3 ttosa.3 ttoul.3

View File

@ -16,7 +16,7 @@
#include "freeswan.h"
static const char *co[] = {
"Copyright (C) 1999-2008 Henry Spencer, Richard Guy Briggs,",
"Copyright (C) 1999-2009 Henry Spencer, Richard Guy Briggs,",
" D. Hugh Redelmeier, Sandy Harris, Claudia Schmeing,",
" Michael Richardson, Angelos D. Keromytis, John Ioannidis,",
"",

View File

@ -218,8 +218,6 @@ unsigned long prng_count(struct prng *prng);
void prng_final(struct prng *prng);
/* odds and ends */
const char *ipsec_version_code(void);
const char *ipsec_version_string(void);
const char **ipsec_copyright_notice(void);
const char *dns_string_rr(int rr, char *buf, int bufsize);

View File

@ -1,43 +0,0 @@
.TH IPSEC_VERSION 3 "21 Nov 2001"
.SH NAME
ipsec ipsec_version_code \- get IPsec version code
.br
ipsec ipsec_version_string \- get full IPsec version string
.br
ipsec ipsec_copyright_notice \- get IPsec copyright notice
.SH SYNOPSIS
.B "#include <freeswan.h>
.sp
.B "const char *ipsec_version_code(void);"
.br
.B "const char *ipsec_version_string(void);"
.br
.B "const char **ipsec_copyright_notice(void);"
.SH DESCRIPTION
These functions provide information on version numbering and copyright
of the Linux FreeS/WAN IPsec implementation.
.PP
.I Ipsec_version_code
returns a pointer to a string constant
containing the current IPsec version code,
such as ``1.92'' or ``snap2001Nov19b''.
.PP
.I Ipsec_version_string
returns a pointer to a string constant giving a full version identification,
consisting of the version code preceded by a prefix identifying the software,
e.g. ``Linux FreeS/WAN 1.92''.
.PP
.I Ipsec_copyright_notice
returns a pointer to a vector of pointers,
terminated by a
.BR NULL ,
which is the text of a suitable copyright notice.
Each pointer points to a string constant (possibly empty) which is one line
of the somewhat-verbose copyright notice.
The strings are NUL-terminated and do not contain a newline;
supplying suitable line termination for the output device is
the caller's responsibility.
.SH SEE ALSO
ipsec(8)
.SH HISTORY
Written for the FreeS/WAN project by Henry Spencer.

View File

@ -1,37 +0,0 @@
/*
* return IPsec version information
* Copyright (C) 2001 Henry Spencer.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/lgpl.txt>.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
* License for more details.
*/
#include "freeswan.h"
static const char strongswan_number[] = VERSION;
static const char strongswan_string[] = "Linux strongSwan " VERSION;
/*
- ipsec_version_code - return IPsec version number/code, as string
*/
const char *
ipsec_version_code()
{
return strongswan_number;
}
/*
- ipsec_version_string - return full version string
*/
const char *
ipsec_version_string()
{
return strongswan_string;
}

View File

@ -577,7 +577,7 @@ adns_usage(const char *fmt, const char *arg)
fprintf(stderr, "INTERNAL TO PLUTO: DO NOT EXECUTE\n");
fprintf(stderr, fmt, arg);
fprintf(stderr, "\n%s\n", ipsec_version_string());
fprintf(stderr, "\nstrongSwan "VERSION"\n");
for (; *sp != NULL; sp++)
fprintf(stderr, "%s\n", *sp);

View File

@ -850,7 +850,7 @@ void show_status(bool all, const char *name)
{
if (all)
{
whack_log(RC_COMMENT, "Daemon status (pluto "VERSION"):");
whack_log(RC_COMMENT, "Status of IKEv1 pluto daemon (strongSwan "VERSION"):");
show_ifaces_status();
show_myid_status();
show_loaded_plugins();

View File

@ -137,11 +137,10 @@ static void usage(const char *mess)
"[--nat_traversal] [--keep_alive <delay_sec>]"
" \\\n\t"
"[--force_keepalive] [--disable_port_floating]"
" \\\n\t"
"[--virtual_private <network_list>]"
" \\\n\t"
"[--virtual_private <network_list>]"
"\n"
"strongSwan %s\n"
, ipsec_version_code());
"strongSwan "VERSION"\n");
exit_pluto(mess == NULL? 0 : 1);
}
@ -359,8 +358,7 @@ int main(int argc, char **argv)
{
const char **sp = ipsec_copyright_notice();
printf("%s%s\n", ipsec_version_string(),
compile_time_interop_options);
printf("strongSwan "VERSION"%s\n", compile_time_interop_options);
for (; *sp != NULL; sp++)
puts(*sp);
}
@ -636,9 +634,8 @@ int main(int argc, char **argv)
/* Note: some scripts may look for this exact message -- don't change
* ipsec barf was one, but it no longer does.
*/
plog("Starting Pluto (strongSwan Version %s%s)"
, ipsec_version_code()
, compile_time_interop_options);
plog("Starting IKEv1 pluto daemon (strongSwan "VERSION")%s",
compile_time_interop_options);
/* load plugins, further infrastructure may need it */
lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR,

View File

@ -275,7 +275,7 @@ int main (int argc, char **argv)
signal(SIGALRM, fsig);
signal(SIGUSR1, fsig);
plog("Starting strongSwan %s IPsec [starter]...", ipsec_version_code());
plog("Starting strongSwan "VERSION" IPsec [starter]...");
/* verify that we can start */
if (getuid() != 0)

View File

@ -230,8 +230,7 @@ static void help(void)
"shutdown: whack"
" --shutdown"
"\n\n"
"strongSwan %s\n"
, ipsec_version_code());
"strongSwan "VERSION"\n");
}
static const char *label = NULL; /* --label operand, saved for diagnostics */
@ -1004,7 +1003,7 @@ int main(int argc, char **argv)
{
const char **sp = ipsec_copyright_notice();
printf("%s\n", ipsec_version_string());
printf("strongSwan "VERSION"\n");
for (; *sp != NULL; sp++)
puts(*sp);
}