[Bf-committers] patch to print version info

dan sinclair bf-committers@blender.org
Tue, 23 Dec 2003 17:23:35 -0500


--=-EdVC/wzgZ8qbCXD6ygNh
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hello,

I've attached a simple patch to make blender print its version info when
the user enters -v or --version and exit.

(I had to do patch -p0 in the blender directory when I applied it)

dj2

--=-EdVC/wzgZ8qbCXD6ygNh
Content-Disposition: attachment; filename=version.diff
Content-Type: text/x-patch; name=version.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Index: source/creator/creator.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/creator/creator.c,v
retrieving revision 1.30
diff -u -r1.30 creator.c
--- source/creator/creator.c	25 Nov 2003 18:14:00 -0000	1.30
+++ source/creator/creator.c	24 Dec 2003 02:21:40 -0000
@@ -107,6 +107,7 @@
 
 /*	Local Function prototypes */
 static void print_help();
+static void print_version();
 
 /* for the callbacks: */
 
@@ -139,7 +140,10 @@
 	}
 }
 
-
+static void print_version(void)
+{
+	printf ("Blender %d.%02d\n", G.version/100, G.version%100);
+}
 
 static void print_help(void)
 {
@@ -181,6 +185,7 @@
 #ifdef WIN32
 	printf ("  -R\t\tRegister .blend extension\n");
 #endif
+	printf ("  -v\t\tPrint Blender version and exit\n");
 }
 
 
@@ -258,6 +263,12 @@
 			exit(0);
 		}
 
+		/* Handle long version request */
+		if (!strcmp(argv[a], "--version")){
+			print_version();
+			exit(0);
+		}
+
 		/* Handle -* switches */
 		else if(argv[a][0] == '-') {
 			switch(argv[a][1]) {
@@ -301,7 +312,11 @@
 			case 'h':			
 				print_help();
 				exit(0);
-								
+			
+			case 'v':
+				print_version();
+				exit(0);
+
 			default:
 				break;
 			}

--=-EdVC/wzgZ8qbCXD6ygNh--