In case of CVS sources, add the date of the last change to the version
authorjmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 16 Jan 2004 20:04:21 +0000 (20:04 +0000)
committerjmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 16 Jan 2004 20:04:21 +0000 (20:04 +0000)
number.

2do: Add support to Makefile.nmake
     Enforce the generation of cvsversion.h on each run of make

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9679 f5534014-38df-0310-8fa8-9805f1628bb7

Makefile.am
gtk/main.c
make-version.pl [new file with mode: 0755]
mergecap.c
tethereal.c

index 320d3674c4c38b38fa8583b6ff4b6f5837d8d143..138156609260802617b472c2a68d2a29d032df5e 100644 (file)
@@ -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
@@ -1047,6 +1048,12 @@ mergecap_LDADD = wiretap/libwiretap.a @GLIB_LIBS@
 # Common headers
 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.
 #
index 3b080e1dd844c92d370e24db7dfb1a3fc56b9cb2..b5b820cce9bc0df0e0330cebb6499c7c6d4468ff 100644 (file)
@@ -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 (executable)
index 0000000..2c52b4e
--- /dev/null
@@ -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__
+
+
index a8dc435822e813cc6326e74d28ec5673a685c190..5abe344d536d553d40123e0ba2f0063d93c45a5e 100644 (file)
@@ -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;
index baf73ec641971140be7c782c41c6bdbc6ded76d7..16a969445845a26c2f93e4b5b4018cf3cf6b6984 100644 (file)
@@ -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;