summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authornijtmans@users.sourceforge.net <jan.nijtmans>2012-08-17 07:50:29 (GMT)
committernijtmans@users.sourceforge.net <jan.nijtmans>2012-08-17 07:50:29 (GMT)
commit91d7b8a4e2cd9e95365cd4e0fa54908a569282a6 (patch)
tree7ca7e31995b2766f76a7743682ad9efb8c7e4e61 /win
parent4536b50cd305d2fb80cfe8e43d396d03e1f27466 (diff)
downloadtk-91d7b8a4e2cd9e95365cd4e0fa54908a569282a6.zip
tk-91d7b8a4e2cd9e95365cd4e0fa54908a569282a6.tar.gz
tk-91d7b8a4e2cd9e95365cd4e0fa54908a569282a6.tar.bz2
nmakehlp: Add "-V<num>" option, in order to be able to detect partial version numbers.
Diffstat (limited to 'win')
-rw-r--r--win/nmakehlp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index 2868857..d0edcf0 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -47,7 +47,7 @@ static int CheckForLinkerFeature(const char *option);
static int IsIn(const char *string, const char *substring);
static int SubstituteFile(const char *substs, const char *filename);
static int QualifyPath(const char *path);
-static const char *GetVersionFromFile(const char *filename, const char *match);
+static const char *GetVersionFromFile(const char *filename, const char *match, int numdots);
static DWORD WINAPI ReadFromPipe(LPVOID args);
/* globals */
@@ -153,7 +153,7 @@ main(
&dwWritten, NULL);
return 0;
}
- printf("%s\n", GetVersionFromFile(argv[2], argv[3]));
+ printf("%s\n", GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0'));
return 0;
case 'Q':
if (argc != 3) {
@@ -479,7 +479,8 @@ IsIn(
static const char *
GetVersionFromFile(
const char *filename,
- const char *match)
+ const char *match,
+ int numdots)
{
size_t cbBuffer = 100;
static char szBuffer[100];
@@ -509,7 +510,8 @@ GetVersionFromFile(
*/
q = p;
- while (*q && (isalnum(*q) || *q == '.')) {
+ while (*q && (strchr("0123456789.ab", *q)) && ((!strchr(".ab", *q)
+ && (!strchr("ab", q[-1])) || --numdots))) {
++q;
}