diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-09-19 14:50:11 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-09-19 14:50:11 (GMT) |
commit | c57eb3c77c77749299dfec90a74977fa9c5c559b (patch) | |
tree | b1a93c9472066ad889bb814aa68d0b255123be23 /win/nmakehlp.c | |
parent | bd029b94a1f825a22bf635e4c255406562741d5b (diff) | |
parent | 562176ad5a881a5f92f2985feab5401c375d559a (diff) | |
download | tcl-c57eb3c77c77749299dfec90a74977fa9c5c559b.zip tcl-c57eb3c77c77749299dfec90a74977fa9c5c559b.tar.gz tcl-c57eb3c77c77749299dfec90a74977fa9c5c559b.tar.bz2 |
merge trunkfrq_3527238
<p>change dde version to 1.4.0b2
Diffstat (limited to 'win/nmakehlp.c')
-rw-r--r-- | win/nmakehlp.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 2868857..b1a1517 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]; @@ -497,9 +498,10 @@ GetVersionFromFile( p = strstr(szBuffer, match); if (p != NULL) { /* - * Skip to first digit. + * Skip to first digit after the match. */ + p += strlen(match); while (*p && !isdigit(*p)) { ++p; } @@ -509,7 +511,8 @@ GetVersionFromFile( */ q = p; - while (*q && (isalnum(*q) || *q == '.')) { + while (*q && (strchr("0123456789.ab", *q)) && ((!strchr(".ab", *q) + && (!strchr("ab", q[-1])) || --numdots))) { ++q; } @@ -628,11 +631,11 @@ SubstituteFile( } } #endif - + /* * Run the substitutions over each line of the input */ - + while (fgets(szBuffer, cbBuffer, fp) != NULL) { list_item_t *p = NULL; for (p = substPtr; p != NULL; p = p->nextPtr) { @@ -652,7 +655,7 @@ SubstituteFile( } printf(szBuffer); } - + list_free(&substPtr); } fclose(fp); |