This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cygpath copyright/version patch


--- Christopher Faylor <cgf@redhat.com> wrote:
> I've checked in a modified version of your patch.  I cleaned up some of
> the non-GNU formatting, added a ChangeLog, and added a "print_version"
> function which parses the 'version' array for version info.
> 
Your patch looks much cleaner. I will try to read up on GNU formatting to avoid
this in the future. I assume my indenting was off. 

Here is a patch for cygpath that fixes the copyright dates I changed
incorrectly. It also uses cgf's print_version() instead of the previous
hard-coded and wrong version. (The current cygpath.exe outputs version 1.2,
while in reality the CVS version is 1.13.) The first line of the new version
output is in the GNU standard "file (package) #.##", i.e. "cygpath (cygwin)
1.13" or "ls (fileutils) 4.1". It also initializes the variable 'o' to prevent
a compiler warning.

Changelog:

2002-02-27 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>

* cygpath.cc (print_version): New function.
(main): Accommodate new version function. Initialize 'o' to prevent warning.

__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com
--- cygpath.cc-orig	Sun Feb 24 13:28:27 2002
+++ cygpath.cc	Wed Feb 27 14:32:51 2002
@@ -1,5 +1,5 @@
 /* cygpath.cc -- convert pathnames between Windows and Unix format
-   Copyright 1998-2002 Red Hat, Inc.
+   Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
 
 This file is part of Cygwin.
 
@@ -21,6 +21,8 @@ details. */
 #include <sys/cygwin.h>
 #include <ctype.h>
 
+static const char version[] = "$Revision: 1.13 $";
+
 static char *prog_name;
 static char *file_arg;
 static char *close_arg;
@@ -231,6 +233,28 @@ doit (char *filename)
   puts (buf);
 }
 
+static void
+print_version ()
+{
+  const char *v = strchr (version, ':');
+  int len;
+  if (!v)
+    {
+      v = "?";
+      len = 1;
+    }
+  else
+    {
+      v += 2;
+      len = strchr (v, ' ') - v;
+    }
+  printf ("\
+cygpath (cygwin) %.*s\n\
+Path Conversion Utility\n\
+Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
+Compiled on %s", len, v, __DATE__);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -257,6 +281,7 @@ main (int argc, char **argv)
   options_from_file_flag = 0;
   allusers_flag = 0;
   output_flag = 0;
+  o=0;
   while ((c = getopt_long (argc, argv, (char *) "hac:f:opsSuvwWiDPA", long_options, (int *) NULL))
 	 != EOF)
     {
@@ -341,8 +366,7 @@ main (int argc, char **argv)
 	  break;
 
 	case 'v':
-	  printf ("Cygwin path conversion version 1.2\n");
-	  printf ("Copyright 1998-2002 Red Hat, Inc.\n");
+          print_version();
 	  exit (0);
 
 	default:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]