This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
RE: help/version patches
- From: "Robert Collins" <robert dot collins at itdomain dot com dot au>
- To: "Joshua Daniel Franklin" <joshuadfranklin at yahoo dot com>
- Cc: <cygwin-patches at cygwin dot com>
- Date: Tue, 26 Feb 2002 23:12:47 +1100
- Subject: RE: help/version patches
> -----Original Message-----
> From: Joshua Daniel Franklin [mailto:joshuadfranklin@yahoo.com]
It's not - strace is manually entered version info.
> Anyway here is a patch for cygcheck that I think does the
> right thing. Somebody want to take a look?
+const char *revision="$Revision: 1.22 $";
This is suspect: The revision string can look like $Revision:$ in some circumstances - see man co again - which is why I had "$Revision: $ " - note the space after the second $ sign.
Likewise, the
+ /* Get version number out of the autogenerated revision string */
+ (void *) version = malloc(sizeof(revision));
+ strcpy(version, revision+11);
+ version[strlen(version)-1]= 0;
Could be more robustly done as
+ version = (char *) malloc(sizeof(revision));
+ strcpy(version, revision+11);
+ {
+ char *temp=version + strlen (version);
+ while (isspace(--temp) && temp >= version);
+ temp[1]='\0';
+ }
Which will munch an arbitrary amount of whitespace.
Rob