diff options
author | Jörg Mayer <jmayer@loplof.de> | 2004-01-16 20:04:21 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2004-01-16 20:04:21 +0000 |
commit | 0ac74ed036dd796c8696b36c8905d593c1de6f26 (patch) | |
tree | 1bd87a5c47c80ff288a6dbb847dce4e060d3bf75 | |
parent | 8f89f05a860b895de97e1becf7a0a9dc0b2bb5a7 (diff) | |
download | wireshark-0ac74ed036dd796c8696b36c8905d593c1de6f26.tar.gz |
In case of CVS sources, add the date of the last change to the version
number.
2do: Add support to Makefile.nmake
Enforce the generation of cvsversion.h on each run of make
svn path=/trunk/; revision=9679
-rw-r--r-- | Makefile.am | 11 | ||||
-rw-r--r-- | gtk/main.c | 9 | ||||
-rwxr-xr-x | make-version.pl | 82 | ||||
-rw-r--r-- | mergecap.c | 5 | ||||
-rw-r--r-- | tethereal.c | 8 |
5 files changed, 104 insertions, 11 deletions
diff --git a/Makefile.am b/Makefile.am index 320d3674c4..1381566092 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.691 2004/01/16 04:37:54 gerald Exp $ +# $Id: Makefile.am,v 1.692 2004/01/16 20:03:10 jmayer Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@ethereal.com> @@ -848,6 +848,7 @@ DISSECTOR_SUPPORT_SRC = \ xmlstub.h BUILT_SOURCES = \ + cvsversion.h \ x11-declarations.h \ x11-register-info.h @@ -1032,7 +1033,7 @@ text2pcap_DEPENDENCIES = text2pcap.h text2pcap_LDADD = $(text2pcap_optional_objects) \ @GLIB_LIBS@ -lm -mergecap_SOURCES = mergecap.c +mergecap_SOURCES = mergecap.c cvsversion.h mergecap_DEPENDENCIES = wiretap/libwiretap.a editcap_SOURCES = editcap.c @@ -1048,6 +1049,12 @@ mergecap_LDADD = wiretap/libwiretap.a @GLIB_LIBS@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/wiretap # +# Build the version string +# +cvsversion.h: + $(PERL) make-version.pl `find . -name "Entries"` + +# # Build various header files for the X11 dissector. # x11-declarations.h x11-register-info.h: x11-fields process-x11-fields.pl diff --git a/gtk/main.c b/gtk/main.c index 3b080e1dd8..b5b820cce9 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.353 2004/01/11 22:17:43 guy Exp $ + * $Id: main.c,v 1.354 2004/01/16 20:04:21 jmayer Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -77,6 +77,7 @@ #include <epan/filesystem.h> #include <epan/epan_dissect.h> +#include "cvsversion.h" #include "main.h" #include <epan/timestamp.h> #include <epan/packet.h> @@ -207,7 +208,7 @@ about_ethereal( GtkWidget *w _U_, gpointer data _U_ ) { snprintf(message, MAX_ABOUT_MSG_LEN, "Ethereal - Network Protocol Analyzer\n\n" - "Version " VERSION " (C) 1998-2003 Gerald Combs <gerald@ethereal.com>\n\n" + "Version " VERSION CVSVERSION " (C) 1998-2003 Gerald Combs <gerald@ethereal.com>\n\n" "%s\n" "%s\n\n" @@ -1199,7 +1200,7 @@ static void print_usage(gboolean print_ver) { if (print_ver) { - fprintf(stderr, "This is GNU " PACKAGE " " VERSION "\n%s\n%s\n", + fprintf(stderr, "This is GNU " PACKAGE " " VERSION CVSVERSION "\n%s\n%s\n", comp_info_str->str, runtime_info_str->str); } #ifdef HAVE_LIBPCAP @@ -1230,7 +1231,7 @@ show_version(void) create_console(); #endif - printf("%s %s\n%s\n%s\n", PACKAGE, VERSION, comp_info_str->str, + printf("%s %s%s\n%s\n%s\n", PACKAGE, VERSION, CVSVERSION, comp_info_str->str, runtime_info_str->str); } diff --git a/make-version.pl b/make-version.pl new file mode 100755 index 0000000000..2c52b4e6d1 --- /dev/null +++ b/make-version.pl @@ -0,0 +1,82 @@ +#!/usr/bin/perl -w +# +# Copyright 2004 Jörg Mayer (see AUTHORS file) +# +# $Id: make-version.pl,v 1.1 2004/01/16 20:03:10 jmayer Exp $ +# +# Ethereal - Network traffic analyzer +# By Gerald Combs <gerald@ethereal.com> +# Copyright 1998 Gerald Combs +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# usage: ./make-version.pl `find . -name "Entries"` + +use strict; + +my ($d1,$d2,$d3,$date,$drest); +my ($wdayascii, $monthascii, $day, $time, $year); + +my %asctonum = ( "Jan" => "01", "Feb" => "02", "Mar" => "03", "Apr" => "04", + "May" => "05", "Jun" => "06", "Jul" => "07", "Aug" => "08", + "Sep" => "09", "Oct" => "10", "Nov" => "11", "Dec" => "12" ); + +my $current; +my $last = ""; + +if ($#ARGV >= 0) { + while (<>) { + chomp; + # Regular lines look like this: /ethereal_be.py/1.6/Fri Aug 2 22:55:19 2002// + next if (/^D/); + ($d1,$d2,$d2,$date,$drest) = split(/\//, $_, 5); + next if ($date !~ /\d:\d\d:\d\d/); + ($wdayascii, $monthascii, $day, $time, $year) = split(/\s+/, $date); + $day = substr("0".$day, 0, 2); + $time =~ s/://g; + $current = "$year$asctonum{$monthascii}$day$time"; + if ($current gt $last) { + $last = $current; + } + } +} elsif (-f "cvsversion") { + $last = `cat cvsversion`; +} +if ( $last ne "" ) { + $last = "#define CVSVERSION \"cvs$last\"\n"; +} else { + $last = "#define CVSVERSION \"\"\n"; +} + +my $needsupdate=0; + +if (! open(OLDVER, "<cvsversion.h")) { + $needsupdate = 1; +} else { + if (<OLDVER> ne $last) { + $needsupdate = 1; + } + close OLDVER; +} + +if ($needsupdate == 1) { + open(VER, ">cvsversion.h") || die ("Cannot write to cvsversion.h ($!)\n"); + print VER "$last"; + close VER; +} + +__END__ + + diff --git a/mergecap.c b/mergecap.c index a8dc435822..5abe344d53 100644 --- a/mergecap.c +++ b/mergecap.c @@ -1,6 +1,6 @@ /* Combine two dump files, either by appending or by merging by timestamp * - * $Id: mergecap.c,v 1.11 2002/08/28 21:00:06 jmayer Exp $ + * $Id: mergecap.c,v 1.12 2004/01/16 20:03:10 jmayer Exp $ * * Written by Scott Renfro <scott@renfro.org> based on * editcap by Richard Sharpe and Guy Harris @@ -30,6 +30,7 @@ #include "getopt.h" #endif +#include "cvsversion.h" /* * Global variables @@ -444,7 +445,7 @@ main(int argc, char *argv[]) break; case 'h': - fprintf(stderr, "mergecap version %s\n", VERSION); + fprintf(stderr, "mergecap version %s%s\n", VERSION, CVSVERSION); usage(); exit(1); break; diff --git a/tethereal.c b/tethereal.c index baf73ec641..16a9694458 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.217 2004/01/11 22:17:42 guy Exp $ + * $Id: tethereal.c,v 1.218 2004/01/16 20:03:10 jmayer Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -68,6 +68,8 @@ #include "getopt.h" #endif +#include "cvsversion.h" + #include <glib.h> #include <epan/epan.h> #include <epan/filesystem.h> @@ -234,7 +236,7 @@ print_usage(gboolean print_ver) int i; if (print_ver) { - fprintf(stderr, "This is GNU t%s %s\n%s\n%s\n", PACKAGE, VERSION, + fprintf(stderr, "This is GNU t%s %s%s\n%s\n%s\n", PACKAGE, VERSION, CVSVERSION, comp_info_str->str, runtime_info_str->str); } #ifdef HAVE_LIBPCAP @@ -1195,7 +1197,7 @@ main(int argc, char *argv[]) } break; case 'v': /* Show version and exit */ - printf("t%s %s\n%s\n%s\n", PACKAGE, VERSION, comp_info_str->str, + printf("t%s %s%s\n%s\n%s\n", PACKAGE, VERSION, CVSVERSION, comp_info_str->str, runtime_info_str->str); exit(0); break; |